[Pkg-ocaml-maint-commits] r2085 - in trunk/projects/approx/trunk: . debian

Eric Cooper ecc-guest at costa.debian.org
Sun Nov 20 17:31:01 UTC 2005


Author: ecc-guest
Date: 2005-11-20 17:31:00 +0000 (Sun, 20 Nov 2005)
New Revision: 2085

Added:
   trunk/projects/approx/trunk/debian/control.in
Modified:
   trunk/projects/approx/trunk/approx.ml
   trunk/projects/approx/trunk/config.ml
   trunk/projects/approx/trunk/config.mli
   trunk/projects/approx/trunk/debian/changelog
   trunk/projects/approx/trunk/debian/control
   trunk/projects/approx/trunk/debian/rules
   trunk/projects/approx/trunk/gen_version
Log:
make sure all data that is streamed to the client during download gets
flushed afterwards using cgi#output#commit_work

added debian/control.in and a rule to generate debian/control from it

added conditional dependency on OCaml bytecode interpreter for
architectures without native compilation


Modified: trunk/projects/approx/trunk/approx.ml
===================================================================
--- trunk/projects/approx/trunk/approx.ml	2005-11-20 17:05:12 UTC (rev 2084)
+++ trunk/projects/approx/trunk/approx.ml	2005-11-20 17:31:00 UTC (rev 2085)
@@ -203,7 +203,7 @@
 
 exception Wrong_size
 
-let close_cache mod_time size =
+let close_cache size mod_time =
   match !cache_chan with
   | None -> assert false
   | Some chan ->
@@ -260,6 +260,16 @@
   if debug then
     print_headers "Proxy response" cgi#environment#output_header_fields
 
+let finish_delivery size modtime cgi =
+  close_cache size modtime;
+  if size >= 0L then
+    begin
+      cgi#output#commit_work ();
+      Delivered
+    end
+  else
+    Cached
+
 (* Update the ctime but not the mtime of the file, if it exists *)
 
 let update_ctime name =
@@ -334,9 +344,7 @@
   in
   Url.download url ~headers ~header_callback body_callback;
   match !status with
-  | 200 ->
-      close_cache !last_modified !length;
-      if !length >= 0L then Delivered else Cached
+  | 200 -> finish_delivery !length !last_modified cgi
   | 304 -> Not_modified
   | 404 -> File_not_found
   | n -> error_message "Unexpected status code: %d" n; File_not_found
@@ -366,8 +374,7 @@
     in
     open_cache name;
     Url.download url body_callback;
-    close_cache mod_time size;
-    if size >= 0L then Delivered else Cached
+    finish_delivery size mod_time cgi
   else
     Not_modified
 

Modified: trunk/projects/approx/trunk/config.ml
===================================================================
--- trunk/projects/approx/trunk/config.ml	2005-11-20 17:05:12 UTC (rev 2084)
+++ trunk/projects/approx/trunk/config.ml	2005-11-20 17:31:00 UTC (rev 2085)
@@ -45,8 +45,10 @@
 
 let set key value = map := (key, value) :: !map
 
-let iter f = List.iter (fun (k, v) -> f k v) !map
+let fold f init = List.fold_left (fun x (k, v) -> f k v x) init !map
 
+let iter f = fold (fun k v () -> f k v) ()
+
 let read filename =
   with_channel open_in filename (fun chan ->
     let lines = List.map words_of_line (lines_of_channel chan) in

Modified: trunk/projects/approx/trunk/config.mli
===================================================================
--- trunk/projects/approx/trunk/config.mli	2005-11-20 17:05:12 UTC (rev 2084)
+++ trunk/projects/approx/trunk/config.mli	2005-11-20 17:31:00 UTC (rev 2085)
@@ -10,4 +10,6 @@
 
 val set : string -> string -> unit
 
+val fold : (string -> string -> 'a -> 'a) -> 'a -> 'a
+
 val iter : (string -> string -> unit) -> unit

Modified: trunk/projects/approx/trunk/debian/changelog
===================================================================
--- trunk/projects/approx/trunk/debian/changelog	2005-11-20 17:05:12 UTC (rev 2084)
+++ trunk/projects/approx/trunk/debian/changelog	2005-11-20 17:31:00 UTC (rev 2085)
@@ -1,3 +1,13 @@
+approx (2.02) unstable; urgency=low
+
+  * Make sure all data that is streamed to the client during download
+    gets flushed afterwards using cgi#output#commit_work
+  * Added debian/control.in and a rule to generate debian/control from it
+  * Added conditional dependency on OCaml bytecode interpreter
+    for architectures without native compilation
+
+ -- Eric Cooper <ecc at cmu.edu>  Sun, 20 Nov 2005 12:20:58 -0500
+
 approx (2.01) unstable; urgency=low
 
   * Updated debian/control for ocaml version 3.09.0

Modified: trunk/projects/approx/trunk/debian/control
===================================================================
--- trunk/projects/approx/trunk/debian/control	2005-11-20 17:05:12 UTC (rev 2084)
+++ trunk/projects/approx/trunk/debian/control	2005-11-20 17:31:00 UTC (rev 2085)
@@ -3,12 +3,12 @@
 Priority: optional
 Maintainer: Eric Cooper <ecc at cmu.edu>
 Uploaders: Sven Luther <luther at debian.org>, Stefano Zacchiroli <zack at debian.org>
-Build-Depends: debhelper (>= 4.0), ocaml-nox-3.09.0, ocaml-best-compilers, ocaml-tools, libocamlnet-ocaml-dev (>= 1.1), libpcre-ocaml-dev (>= 5.10.0), libsyslog-ocaml-dev (>= 1.2)
+Build-Depends: debhelper, ocaml-nox (>= 3.09.0), ocaml-best-compilers, ocaml-tools, libocamlnet-ocaml-dev (>= 1.1), libpcre-ocaml-dev (>= 5.10), libsyslog-ocaml-dev (>= 1.2)
 Standards-Version: 3.6.2
 
 Package: approx
 Architecture: any
-Depends: ${shlibs:Depends}, adduser, bzip2, curl
+Depends: ${shlibs:Depends}, ${F:OCamlRuntime}, adduser, bzip2, curl
 Description: caching proxy server for Debian archive files
  Approx is an HTTP-based Debian archive server.
  It fetches packages from remote repositories on demand,
@@ -26,7 +26,7 @@
  .
  Approx can be used as a replacement for apt-proxy,
  with no need to modify clients' /etc/apt/sources.list files,
- or as an alternative to apt-cacher, with no need to run Apache.
+ or as an alternative to apt-cacher.
  .
  Approx is intended to be robust, simple, and efficient.
  It is written in OCaml (Objective Caml).

Added: trunk/projects/approx/trunk/debian/control.in
===================================================================
--- trunk/projects/approx/trunk/debian/control.in	2005-11-20 17:05:12 UTC (rev 2084)
+++ trunk/projects/approx/trunk/debian/control.in	2005-11-20 17:31:00 UTC (rev 2085)
@@ -0,0 +1,32 @@
+Source: approx
+Section: admin
+Priority: optional
+Maintainer: Eric Cooper <ecc at cmu.edu>
+Uploaders: Sven Luther <luther at debian.org>, Stefano Zacchiroli <zack at debian.org>
+Build-Depends: debhelper, ocaml-nox (>= @OCamlABI@), ocaml-best-compilers, ocaml-tools, libocamlnet-ocaml-dev (>= 1.1), libpcre-ocaml-dev (>= 5.10), libsyslog-ocaml-dev (>= 1.2)
+Standards-Version: 3.6.2
+
+Package: approx
+Architecture: any
+Depends: ${shlibs:Depends}, ${F:OCamlRuntime}, adduser, bzip2, curl
+Description: caching proxy server for Debian archive files
+ Approx is an HTTP-based Debian archive server.
+ It fetches packages from remote repositories on demand,
+ and caches them for local use.
+ .
+ Approx saves time and network bandwidth if you need to install or
+ upgrade Debian software for a number of machines on a local network.
+ Each package is downloaded from a remote site only once,
+ regardless of how many local clients install it.
+ The approx cache typically requires a few gigabytes of disk space.
+ .
+ Approx also simplifies the administration of client machines:
+ repository locations need only be changed in approx's configuration file,
+ not in every client's /etc/apt/sources.list file.
+ .
+ Approx can be used as a replacement for apt-proxy,
+ with no need to modify clients' /etc/apt/sources.list files,
+ or as an alternative to apt-cacher.
+ .
+ Approx is intended to be robust, simple, and efficient.
+ It is written in OCaml (Objective Caml).

Modified: trunk/projects/approx/trunk/debian/rules
===================================================================
--- trunk/projects/approx/trunk/debian/rules	2005-11-20 17:05:12 UTC (rev 2084)
+++ trunk/projects/approx/trunk/debian/rules	2005-11-20 17:31:00 UTC (rev 2085)
@@ -1,16 +1,17 @@
 #!/usr/bin/make -f
 
-#export DH_VERBOSE=1
+OCAMLABI = $(shell ocamlc -version)
+BYTECODE = $(shell [ -x /usr/bin/ocamlopt ] || echo yes)
+RUNTIME = $(if $(BYTECODE),ocaml-base-nox-$(OCAMLABI))
 
+debian/control:
+	sed -e 's/@OCamlABI@/$(OCAMLABI)/g' $@.in > $@
+
 build: build-stamp
 build-stamp:
 	dh_testdir
 	./gen_version > version.ml
-	if [ -x /usr/bin/ocamlopt ]; then \
-	    $(MAKE) native-code; \
-	else \
-	    $(MAKE) byte-code; \
-	fi
+	$(MAKE) $(if $(BYTECODE),byte-code,native-code)
 	touch build-stamp
 
 clean:
@@ -18,8 +19,7 @@
 	dh_testroot
 	rm -f build-stamp
 	-$(MAKE) clean
-	rm -f version.ml
-	dh_clean
+	dh_clean version.ml
 
 install: build
 	dh_testdir
@@ -59,7 +59,7 @@
 #	dh_makeshlibs
 	dh_installdeb
 	dh_shlibdeps
-	dh_gencontrol
+	dh_gencontrol -- -VF:OCamlRuntime="$(RUNTIME)"
 	dh_md5sums
 	dh_builddeb
 

Modified: trunk/projects/approx/trunk/gen_version
===================================================================
--- trunk/projects/approx/trunk/gen_version	2005-11-20 17:05:12 UTC (rev 2084)
+++ trunk/projects/approx/trunk/gen_version	2005-11-20 17:31:00 UTC (rev 2085)
@@ -1,6 +1,8 @@
-#!/usr/bin/perl -w
+#!/usr/bin/perl -Tw
 use strict;
 
+$ENV{PATH} = "/usr/bin";
+
 my $name = undef;
 my $number = undef;
 




More information about the Pkg-ocaml-maint-commits mailing list