This is an automated email from the git hooks/post-receive script. ecc-guest pushed a commit to branch upstream in repository approx.
commit 6dc4be63f394683471286987df9cab4bd6bbfe12 Author: Eric Cooper <e...@cmu.edu> Date: Mon Apr 22 16:06:57 2013 -0400 change from gz to bz2 (closes: #639540, #689444, #705890) --- approx.ml | 9 ++++----- doc/FAQ | 2 +- doc/README.concurrency | 2 +- pdiff.ml | 10 +++++----- util.ml | 23 ++++++++++++++++------- 5 files changed, 27 insertions(+), 19 deletions(-) diff --git a/approx.ml b/approx.ml index 4bb1268..e5f5b1b 100644 --- a/approx.ml +++ b/approx.ml @@ -494,15 +494,14 @@ let cache_miss url name ims mod_time = (* See if the given file should be denied (reported to the client as not found) rather than fetched remotely. This is done in two cases: - * the client is requesting a non-gzipped version of an index - * the client is requesting a DiffIndex and an up-to-date .gz version + * the client is requesting a non-bz2 version of an index + * the client is requesting a DiffIndex and an up-to-date .bz2 version of the corresponding index exists in the cache By denying the request, the client will fall back to requesting - the Packages.gz or Sources.gz file. Using .gz instead of .bz2 - or other compressed formats allows pdiffs to be applied more quickly. *) + the Packages.bz2 or Sources.bz2 file. *) let should_deny name = - (Release.is_index name && extension name <> ".gz") || + (Release.is_index name && extension name <> ".bz2") || (pdiffs && Release.is_diff_index name && Release.valid (Pdiff.index_file name)) diff --git a/doc/FAQ b/doc/FAQ index eb24d4c..c921de7 100644 --- a/doc/FAQ +++ b/doc/FAQ @@ -22,7 +22,7 @@ Exporting a local package repository local file:///my/local/repo The repo must have the structure that apt expects, including a - Packages.gz index. You can maintain a local repo with a tool like + Packages.bz2 index. You can maintain a local repo with a tool like dpkg-scanpackages or reprepro. Changing the TCP port on which approx listens diff --git a/doc/README.concurrency b/doc/README.concurrency index 5249160..b9a14e6 100644 --- a/doc/README.concurrency +++ b/doc/README.concurrency @@ -34,7 +34,7 @@ B: between concurrent approx processes The atomic renaming of downloaded files prevents one approx process from delivering a file that has been partially downloaded by another. -But suppose a large download, like the main Packages.gz file, is in +But suppose a large download, like the main Packages.bz2 file, is in progress. Another approx process might decide to download it also. To avoid this, approx creates a hint file in the cache directory before starting the download. We use the presence of a current hint diff --git a/pdiff.ml b/pdiff.ml index aa1f7a4..56f09aa 100644 --- a/pdiff.ml +++ b/pdiff.ml @@ -7,7 +7,7 @@ open Log open Util let index_file path = - Filename.chop_suffix (Filename.dirname path) ".diff" ^ ".gz" + Filename.chop_suffix (Filename.dirname path) ".diff" ^ ".bz2" let read_diff_index dir = let diff_index = dir ^/ "Index" in @@ -34,11 +34,11 @@ let rec find_tail p = function (* Pdiff application must result in a Packages or Sources file that is identical to the one in the official archive, - so this function must use the same gzip parameters that dak does. + so this function must use the same bzip2 parameters that dak does. See http://ftp-master.debian.org/git/dak.git *) let compress ~src ~dst = - let cmd = Printf.sprintf "/bin/gzip -9cn --rsyncable < %s > %s" src dst in + let cmd = Printf.sprintf "/usr/bin/nice /usr/bin/ionice -c3 /bin/bzip2 -9 < %s > %s" src dst in debug_message "Compressing: %s" cmd; if Sys.command cmd <> 0 then failwith "compress"; if debug && not (Release.valid dst) then @@ -81,11 +81,11 @@ let apply_pdiffs file pdiffs final index = let update index = info_message "Updating %s" index; - if not (Filename.check_suffix index ".gz") then + if not (Filename.check_suffix index ".bz2") then invalid_string_arg "Pdiff.update" index; if not (Sys.file_exists index) then Url.download_file index; - let dir = Filename.chop_suffix index ".gz" ^ ".diff" in + let dir = Filename.chop_suffix index ".bz2" ^ ".diff" in let diffs, final = read_diff_index dir in let update_index file = let info = (file_sha1sum file, file_size file) in diff --git a/util.ml b/util.ml index 1eb978e..f136029 100644 --- a/util.ml +++ b/util.ml @@ -179,7 +179,14 @@ let tmp_dir () = let rm file = try Sys.remove file with _ -> () -let compressed_extensions = [".gz"; ".bz2"; ".lzma"; ".xz"] +(* Decompression programs for supported compression formats *) + +let decompressors = + [".bz2", "/bin/bzcat"; + ".gz", "/bin/zcat"; + ".xz", "/usr/bin/xzcat"] + +let compressed_extensions = List.map fst decompressors (* Check if a file is compressed by examining its extension *) @@ -192,12 +199,14 @@ let is_compressed file = List.mem (extension file) compressed_extensions Return the temporary file name, which must be removed by the caller *) let decompress file = - if extension file <> ".gz" then invalid_string_arg "decompress" file - else - let tmp = (tmp_dir ()) ^/ gensym (Filename.basename file) in - let cmd = sprintf "/bin/gunzip --stdout %s > %s" file tmp in - if Sys.command cmd = 0 then tmp - else (rm tmp; failwith ("decompress " ^ file)) + let prog = + try List.assoc (extension file) decompressors + with Not_found -> invalid_string_arg "decompress" file + in + let tmp = (tmp_dir ()) ^/ gensym (Filename.basename file) in + let cmd = sprintf "%s %s > %s" prog file tmp in + if Sys.command cmd = 0 then tmp + else (rm tmp; failwith ("decompress " ^ file)) let with_decompressed file = with_resource rm decompress file -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/approx.git _______________________________________________ Pkg-ocaml-maint-commits mailing list Pkg-ocaml-maint-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits