[Pkg-ocaml-maint-commits] r3253 - in /trunk/projects/approx/trunk: control_file.ml debian/changelog debian/control default_config.ml default_config.mli doc/approx.8 doc/approx.conf.5 etc/approx.conf url.ml

ecc-guest at users.alioth.debian.org ecc-guest at users.alioth.debian.org
Fri Oct 20 19:03:01 UTC 2006


Author: ecc-guest
Date: Fri Oct 20 19:03:00 2006
New Revision: 3253

URL: http://svn.debian.org/wsvn/?sc=1&rev=3253
Log:
handle tabs as well as spaces in control files

added "max_rate" configuration variable

improved description in approx man page of how repository mapping works

added XS-Vcs-Svn header to debian/control file

Modified:
    trunk/projects/approx/trunk/control_file.ml
    trunk/projects/approx/trunk/debian/changelog
    trunk/projects/approx/trunk/debian/control
    trunk/projects/approx/trunk/default_config.ml
    trunk/projects/approx/trunk/default_config.mli
    trunk/projects/approx/trunk/doc/approx.8
    trunk/projects/approx/trunk/doc/approx.conf.5
    trunk/projects/approx/trunk/etc/approx.conf
    trunk/projects/approx/trunk/url.ml

Modified: trunk/projects/approx/trunk/control_file.ml
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/control_file.ml?rev=3253&op=diff
==============================================================================
--- trunk/projects/approx/trunk/control_file.ml (original)
+++ trunk/projects/approx/trunk/control_file.ml Fri Oct 20 19:03:00 2006
@@ -10,14 +10,17 @@
 let trim_left s i =
   let n = String.length s in
   let rec loop i =
-    if i < n && s.[i] = ' ' then loop (i + 1)
+    if i < n && (s.[i] = ' ' || s.[i] = '\t') then loop (i + 1)
     else i
   in
   loop i
 
 let rec trim_right s i =
-  if i > 0 && s.[i - 1] = ' ' then trim_right s (i - 1)
-  else i
+  let rec loop i =
+    if i > 0 && (s.[i - 1] = ' ' || s.[i - 1] = '\t') then loop (i - 1)
+    else i
+  in
+  loop i
 
 let parse line =
   try
@@ -43,15 +46,15 @@
     match next with
     | None when lines = [] -> raise End_of_file
     | None | Some "" -> lines
-    | Some line when line.[0] = ' ' ->
+    | Some line when line.[0] = ' ' || line.[0] = '\t' ->
 	(match lines with
 	| last :: others ->
 	    let line =
 	      if line = " ." then ""
-	      else String.sub line 1 (String.length line - 1)
+	      else substring line ~from: 1
 	    in
 	    loop ((last ^ "\n" ^ line) :: others)
-	| [] -> failwith ("leading space: " ^ line))
+	| [] -> failwith ("leading white space: " ^ line))
     | Some line -> loop (line :: lines)
   in
   List.rev_map parse (loop [])

Modified: trunk/projects/approx/trunk/debian/changelog
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/debian/changelog?rev=3253&op=diff
==============================================================================
--- trunk/projects/approx/trunk/debian/changelog (original)
+++ trunk/projects/approx/trunk/debian/changelog Fri Oct 20 19:03:00 2006
@@ -1,3 +1,12 @@
+approx (2.8.0) unstable; urgency=low
+
+  * Handle tabs as well as spaces in control files (closes: #394062)
+  * Added "max_rate" configuration variable (closes: #392802)
+  * Improved description in approx man page of how repository mapping works
+  * Added XS-Vcs-Svn header to debian/control file
+
+ -- Eric Cooper <ecc at cmu.edu>  Fri, 20 Oct 2006 13:15:23 -0400
+
 approx (2.7.0) unstable; urgency=low
 
   * New version numbering with third component for packaging-only changes

Modified: trunk/projects/approx/trunk/debian/control
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/debian/control?rev=3253&op=diff
==============================================================================
--- trunk/projects/approx/trunk/debian/control (original)
+++ trunk/projects/approx/trunk/debian/control Fri Oct 20 19:03:00 2006
@@ -5,6 +5,7 @@
 Uploaders: Sven Luther <luther at debian.org>, Stefano Zacchiroli <zack at debian.org>
 Build-Depends: debhelper (>= 5.0), ocaml-nox (>= 3.09), ocaml-best-compilers, ocaml-tools, libocamlnet-ocaml-dev (>= 1.1), libpcre-ocaml-dev (>= 5.11), libsyslog-ocaml-dev (>= 1.3), libsha-ocaml-dev (>= 1.3)
 Standards-Version: 3.7.2
+XS-Vcs-Svn: svn://svn.debian.org/svn/pkg-ocaml-maint/trunk/projects/approx
 
 Package: approx
 Architecture: any

Modified: trunk/projects/approx/trunk/default_config.ml
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/default_config.ml?rev=3253&op=diff
==============================================================================
--- trunk/projects/approx/trunk/default_config.ml (original)
+++ trunk/projects/approx/trunk/default_config.ml Fri Oct 20 19:03:00 2006
@@ -13,4 +13,5 @@
 let port = get_int "port" ~default: 9999 (* for compatibility with apt-proxy *)
 let interval = get_int "interval" ~default: 720 (* minutes *)
 let max_wait = get_int "max_wait" ~default: 10 (* seconds *)
+let max_rate = get "max_rate" ~default: "unlimited"
 let debug = get_bool "debug" ~default: false

Modified: trunk/projects/approx/trunk/default_config.mli
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/default_config.mli?rev=3253&op=diff
==============================================================================
--- trunk/projects/approx/trunk/default_config.mli (original)
+++ trunk/projects/approx/trunk/default_config.mli Fri Oct 20 19:03:00 2006
@@ -9,4 +9,5 @@
 val port : int
 val interval : int  (* minutes *)
 val max_wait : int  (* seconds *)
+val max_rate : string  (* bytes/second with optional K, M, or G suffix *)
 val debug : bool

Modified: trunk/projects/approx/trunk/doc/approx.8
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/doc/approx.8?rev=3253&op=diff
==============================================================================
--- trunk/projects/approx/trunk/doc/approx.8 (original)
+++ trunk/projects/approx/trunk/doc/approx.8 Fri Oct 20 19:03:00 2006
@@ -2,7 +2,7 @@
 .\" Copyright (C) 2005  Eric C. Cooper <ecc at cmu.edu>
 .\" Released under the GNU General Public License
 .\" -*- nroff -*-
-.TH APPROX 8 "September 2006"
+.TH APPROX 8 "October 2006"
 .\" Please adjust this date whenever revising the manpage.
 
 .SH NAME
@@ -76,6 +76,31 @@
 debian   http://ftp.debian.org/debian
 .br
 security http://security.debian.org
+.PP
+The mapping scheme is very simple.
+If the
+.I approx.conf
+file contains the line
+.IP
+repository	http://remote-host/initial/path
+.PP
+then any request to the
+.B approx
+server of the form
+.IP
+http://approx-server/repository/rest/of/URL
+.PP
+is rewritten to
+.IP
+http://remote-host/initial/path/rest/of/URL
+.PP
+when there is a "cache miss", and that file is cached as
+.IP
+/var/cache/approx/repository/rest/of/URL
+.PP
+(Note that the repository name on the left-hand side is not
+included in the rewritten URL unless it is explicitly mentioned
+in the right-hand side's initial path.)
 
 .SH FILES
 .TP

Modified: trunk/projects/approx/trunk/doc/approx.conf.5
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/doc/approx.conf.5?rev=3253&op=diff
==============================================================================
--- trunk/projects/approx/trunk/doc/approx.conf.5 (original)
+++ trunk/projects/approx/trunk/doc/approx.conf.5 Fri Oct 20 19:03:00 2006
@@ -2,7 +2,7 @@
 .\" Copyright (C) 2006  Eric C. Cooper <ecc at cmu.edu>
 .\" Released under the GNU General Public License
 .\" -*- nroff -*-
-.TH APPROX.CONF 5 "September 2006"
+.TH APPROX.CONF 5 "October 2006"
 .\" Please adjust this date whenever revising the manpage.
 
 .SH NAME
@@ -36,6 +36,11 @@
 .BR approx (8)
 process will wait for a concurrent download of a file to complete,
 before attempting to download the file itself (default: 10)
+.IP max_rate
+Specifies the maximum download rate from remote repositories,
+in bytes per second (default: unlimited).
+The value may be suffixed with "K", "M", or "G"
+to indicate kilobytes, megabytes, or gigabytes per second, respectively.
 .IP debug
 Specifies whether debugging messages should be printed
 (default:
@@ -44,10 +49,9 @@
 The other name/value pairs  are used to map distribution names
 to remote repositories.  For example,
 .IP
-debian          http://debian.mirrors.pair.com
+debian          http://ftp.debian.org/debian
 .br
-security        http://security.debian.org/debian-security
-
+security        http://security.debian.org
 .SH SEE ALSO
 .BR approx (8),
 .BR gc_approx (8)

Modified: trunk/projects/approx/trunk/etc/approx.conf
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/etc/approx.conf?rev=3253&op=diff
==============================================================================
--- trunk/projects/approx/trunk/etc/approx.conf (original)
+++ trunk/projects/approx/trunk/etc/approx.conf Fri Oct 20 19:03:00 2006
@@ -6,6 +6,7 @@
 #port		9999
 #interval	720
 #max_wait	10
+#max_rate	unlimited
 #debug		false
 
 # Here are some examples of remote repository mappings.

Modified: trunk/projects/approx/trunk/url.ml
URL: http://svn.debian.org/wsvn/trunk/projects/approx/trunk/url.ml?rev=3253&op=diff
==============================================================================
--- trunk/projects/approx/trunk/url.ml (original)
+++ trunk/projects/approx/trunk/url.ml Fri Oct 20 19:03:00 2006
@@ -19,9 +19,14 @@
   with Not_found ->
     invalid_arg ("no method in URL " ^ url)
 
+let rate_option =
+  match String.lowercase max_rate with
+  | "" | "none" | "unlimited" -> ""
+  | str -> "--limit-rate " ^ str
+
 let curl_command options url =
-  "/usr/bin/curl --fail --silent --location " ^
-    String.concat " " options ^ " " ^ quoted_string url
+  sprintf "/usr/bin/curl --fail --silent --location %s %s %s"
+    rate_option (String.concat " " options) (quoted_string url)
 
 let head_command = curl_command ["--head"]
 




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