Commit 9893ace9 authored by Bernhard Link's avatar Bernhard Link

add support for lzip compressed files

parent acde420d
2010-10-15
* add support for lzip compressed files
(Thanks to Daniel Baumann for the patch).
2010-09-10
* add special '$Delete' override field to delete fields
......
reprepro (4.2.1-0) UNRELEASED; urgency=low
* add support for lzip compressed files (Closes: 600230)
-- Bernhard R. Link <brlink@debian.org> Fri, 15 Oct 2010 12:11:23 +0200
reprepro (4.2.0-1) unstable; urgency=low
* Fix Berkley -> Berkeley (Closes: 586899)
......
......@@ -12,7 +12,7 @@ Package: reprepro
Architecture: any
Depends: ${shlibs:Depends}, ${reprepro:Depends}, ${misc:Depends}
Recommends: apt
Suggests: gnupg-agent, inoticoming, lzma, xz-utils
Suggests: gnupg-agent, inoticoming, lzip (>= 1.11-2), lzma, xz-utils
Description: Debian package repository producer
reprepro is a tool to manage a repository of Debian packages
(.deb, .udeb, .dsc, ...). It stores files either being
......
......@@ -80,6 +80,10 @@ into .diff.lzma, .tar.lzma or .tar.lzma within .debs.
External uncompressor used to uncompress xz files to look
into .diff.xz, .tar.xz or .tar.xz within .debs.
.TP
.B \-\-lunzip \fIcommand\fP
External uncompressor used to uncompress lzip files to look
into .diff.lz, .tar.lz or .tar.lz within .debs.
.TP
.B \-\-bunzip2 \fIcommand\fP
External uncompressor used to uncompress bz2 when compiled without
libbz2.
......
......@@ -374,6 +374,15 @@ xz files will not be possible.
The program has to accept the compressed file as stdin and write
the uncompressed file into stdout.
.TP
.BI \-\-lunzip " lzip-uncompressor"
When trying to uncompress or read \fPlzip\fP compressed files, this program
will be used.
The default value is \fBlunzip\fP.
If the program is not found or is \fBNONE\fP (all-uppercase) then uncompressing
lz files will not be possible.
The program has to accept the compressed file as stdin and write
the uncompressed file into stdout.
.TP
.BI \-\-list\-max " count"
Limits the output of \fBlist\fP, \fBlistmatched\fP and \fBlistfilter\fP to the first \fIcount\fP
results.
......
......@@ -118,7 +118,7 @@ _reprepro()
--section -S --priority -P --component -C\
--architecture -A --type -T --export --waitforlock \
--spacecheck --safetymargin --dbsafetymargin\
--gunzip --bunzip2 --unlzma --unxz --gnupghome --list-format --list-skip --list-max'
--gunzip --bunzip2 --unlzma --unxz --lunzip --gnupghome --list-format --list-skip --list-max'
i=1
prev=""
......@@ -166,7 +166,7 @@ _reprepro()
confdir="${COMP_WORDS[i+1]}"
i=$((i+2))
;;
-i|--ignore|--unignore|--methoddir|--distdir|--dbdir|--listdir|--section|-S|--priority|-P|--component|-C|--architecture|-A|--type|-T|--export|--waitforlock|--spacecheck|--checkspace|--safetymargin|--dbsafetymargin|--logdir|--gunzip|--bunzip2|--unlzma|--unxz|--gnupghome|--morguedir)
-i|--ignore|--unignore|--methoddir|--distdir|--dbdir|--listdir|--section|-S|--priority|-P|--component|-C|--architecture|-A|--type|-T|--export|--waitforlock|--spacecheck|--checkspace|--safetymargin|--dbsafetymargin|--logdir|--gunzip|--bunzip2|--unlzma|--unxz|--lunzip|--gnupghome|--morguedir)
prev="$cur"
i=$((i+2))
......@@ -421,7 +421,7 @@ _reprepro()
__uncompress)
# first argument is method
if [[ $i -eq $COMP_CWORD ]] ; then
COMPREPLY=( $( compgen -W ".gz .bz2 .lzma .xz" -- $cur ) )
COMPREPLY=( $( compgen -W ".gz .bz2 .lzma .xz .lz" -- $cur ) )
return 0
fi
if [[ $(( $i + 1 )) -eq $COMP_CWORD ]] ; then
......
......@@ -330,6 +330,7 @@ _arguments \
'--bunzip2[external Program to extract .bz2 files]:bunzip binary:_files' \
'--unlzma[external Program to extract .lzma files]:unlzma binary:_files' \
'--unxz[external Program to extract .xz files]:unxz binary:_files' \
'--lunzip[external Program to extract .lz files]:lunzip binary:_files' \
'--list-format[Format for list output]:listfilter format:' \
'--list-skip[Number of packages to skip in list output]:list skip:' \
'--list-max[Maximum number of packages in list output]:list max:' \
......@@ -486,7 +487,7 @@ case "$state" in
;;
(__uncompress)
if [[ "$state" = "first argument" ]] ; then
uncompressions=(.gz .bz2 .lzma .xz)
uncompressions=(.gz .bz2 .lzma .xz .lz)
_wanted -V 'uncompressions' expl 'uncompression' compadd -a uncompressions
elif [[ "$state" = "second argument" ]] ; then
_files
......
......@@ -84,6 +84,6 @@ extern struct global_config {
int showdownloadpercent;
} global;
enum compression { c_none, c_gzip, c_bzip2, c_lzma, c_xz, c_COUNT };
enum compression { c_none, c_gzip, c_bzip2, c_lzma, c_xz, c_lunzip, c_COUNT };
#endif
......@@ -109,6 +109,7 @@ static char /*@only@*/
*bunzip2 = NULL,
*unlzma = NULL,
*unxz = NULL,
*lunzip = NULL,
*gnupghome = NULL;
static int listmax = -1;
static int listskip = 0;
......@@ -135,7 +136,7 @@ static off_t reservedotherspace = 1024*1024;
* to change something owned by lower owners. */
enum config_option_owner config_state,
#define O(x) owner_ ## x = CONFIG_OWNER_DEFAULT
O(fast), O(x_morguedir), O(x_outdir), O(x_basedir), O(x_distdir), O(x_dbdir), O(x_listdir), O(x_confdir), O(x_logdir), O(x_methoddir), O(x_section), O(x_priority), O(x_component), O(x_architecture), O(x_packagetype), O(nothingiserror), O(nolistsdownload), O(keepunusednew), O(keepunreferenced), O(keeptemporaries), O(keepdirectories), O(askforpassphrase), O(skipold), O(export), O(waitforlock), O(spacecheckmode), O(reserveddbspace), O(reservedotherspace), O(guessgpgtty), O(verbosedatabase), O(gunzip), O(bunzip2), O(unlzma), O(unxz), O(gnupghome), O(listformat), O(listmax), O(listskip), O(onlysmalldeletes);
O(fast), O(x_morguedir), O(x_outdir), O(x_basedir), O(x_distdir), O(x_dbdir), O(x_listdir), O(x_confdir), O(x_logdir), O(x_methoddir), O(x_section), O(x_priority), O(x_component), O(x_architecture), O(x_packagetype), O(nothingiserror), O(nolistsdownload), O(keepunusednew), O(keepunreferenced), O(keeptemporaries), O(keepdirectories), O(askforpassphrase), O(skipold), O(export), O(waitforlock), O(spacecheckmode), O(reserveddbspace), O(reservedotherspace), O(guessgpgtty), O(verbosedatabase), O(gunzip), O(bunzip2), O(unlzma), O(unxz), O(lunzip), O(gnupghome), O(listformat), O(listmax), O(listskip), O(onlysmalldeletes);
#undef O
#define CONFIGSET(variable,value) if(owner_ ## variable <= config_state) { \
......@@ -283,6 +284,9 @@ ACTION_N(n, n, n, dumpuncompressors) {
case c_xz:
printf("not supported (install xz-utils or use --unxz to tell where unxz is).\n");
break;
case c_lunzip:
printf("not supported (install lzip or use --lunzip to tell where lunzip is).\n");
break;
default:
printf("not supported\n");
}
......@@ -3236,7 +3240,7 @@ static const struct action {
{"__dumpuncompressors", A_N(dumpuncompressors),
0, 0, "__dumpuncompressors"},
{"__uncompress", A_N(uncompress),
3, 3, "__uncompress .gz|.bz2|.lzma|.xz <compressed-filename> <into-filename>"},
3, 3, "__uncompress .gz|.bz2|.lzma|.xz|.lz <compressed-filename> <into-filename>"},
{"__extractsourcesection", A_N(extractsourcesection),
1, 1, "__extractsourcesection <.dsc-file>"},
{"__extractcontrol", A_N(extractcontrol),
......@@ -3680,6 +3684,7 @@ LO_GUNZIP,
LO_BUNZIP2,
LO_UNLZMA,
LO_UNXZ,
LO_LZIP,
LO_GNUPGHOME,
LO_LISTFORMAT,
LO_LISTSKIP,
......@@ -3955,6 +3960,9 @@ static void handle_option(int c, const char *argument) {
case LO_UNXZ:
CONFIGDUP(unxz, argument);
break;
case LO_LZIP:
CONFIGDUP(lunzip, argument);
break;
case LO_GNUPGHOME:
CONFIGDUP(gnupghome, argument);
break;
......@@ -4212,6 +4220,7 @@ int main(int argc,char *argv[]) {
{"bunzip2", required_argument, &longoption, LO_BUNZIP2},
{"unlzma", required_argument, &longoption, LO_UNLZMA},
{"unxz", required_argument, &longoption, LO_UNXZ},
{"lunzip", required_argument, &longoption, LO_LZIP},
{"gnupghome", required_argument, &longoption, LO_GNUPGHOME},
{"list-format", required_argument, &longoption, LO_LISTFORMAT},
{"list-skip", required_argument, &longoption, LO_LISTSKIP},
......@@ -4335,11 +4344,14 @@ int main(int argc,char *argv[]) {
unlzma = expand_plus_prefix(unlzma, "unlzma", "boc", true);
if( unxz != NULL && unxz[0] == '+' )
unxz = expand_plus_prefix(unxz, "unxz", "boc", true);
uncompressions_check(gunzip, bunzip2, unlzma, unxz);
if( lunzip != NULL && lunzip[0] == '+' )
lunzip = expand_plus_prefix(lunzip, "lunzip", "boc", true);
uncompressions_check(gunzip, bunzip2, unlzma, unxz, lunzip);
free(gunzip);
free(bunzip2);
free(unlzma);
free(unxz);
free(lunzip);
a = all_actions;
while( a->name != NULL ) {
......
......@@ -45,7 +45,7 @@ Name: a
VerifyRelease: blindtrust
Method: copy:$WORKDIR/source1
Architectures: dummyarchitecture
DownloadListsAs: .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma
DownloadListsAs: .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma
Components: dummycomponent
Name: b
......@@ -187,7 +187,7 @@ stdout
-v2*=Created directory "./db"
-v2*=Created directory "./lists"
stderr
*=./conf/updates:5:108: Ignoring all but first 15 entries...
*=./conf/updates:5:126: Ignoring all but first 18 entries...
-v6*=aptmethod start 'copy:$WORKDIR/source2/x/Release'
-v6*=aptmethod start 'copy:$WORKDIR/source1/dists/suitename/Release'
-v1*=aptmethod got 'copy:$WORKDIR/source2/x/Release'
......@@ -214,7 +214,7 @@ EOF
testrun - --unlzma=NONE update boring 3<<EOF
stderr
*=./conf/updates:5:108: Ignoring all but first 15 entries...
*=./conf/updates:5:126: Ignoring all but first 18 entries...
-v6*=aptmethod start 'copy:$WORKDIR/source2/x/Release'
-v6*=aptmethod start 'copy:$WORKDIR/source1/dists/suitename/Release'
-v1*=aptmethod got 'copy:$WORKDIR/source2/x/Release'
......@@ -240,7 +240,7 @@ EOF
testrun - update boring 3<<EOF
stderr
*=./conf/updates:5:108: Ignoring all but first 15 entries...
*=./conf/updates:5:126: Ignoring all but first 18 entries...
-v6*=aptmethod start 'copy:$WORKDIR/source2/x/Release'
-v6*=aptmethod start 'copy:$WORKDIR/source1/dists/suitename/Release'
-v1*=aptmethod got 'copy:$WORKDIR/source2/x/Release'
......
......@@ -11,51 +11,56 @@ dodo test ! -d pool
# First test if finding the binaries works properly...
testrun - --unxz=NONE __dumpuncompressors 3<<EOF
testrun - --lunzip=NONE --unxz=NONE __dumpuncompressors 3<<EOF
stdout
*=.gz: built-in + '/bin/gunzip'
*=.bz2: built-in + '/bin/bunzip2'
*=.lzma: '/usr/bin/unlzma'
*=.xz: not supported (install xz-utils or use --unxz to tell where unxz is).
*=.lz: not supported (install lzip or use --lunzip to tell where lunzip is).
EOF
testrun - --gunzip=NONE --bunzip2=NONE --unlzma=NONE --unxz=NONE __dumpuncompressors 3<<EOF
testrun - --lunzip=NONE --gunzip=NONE --bunzip2=NONE --unlzma=NONE --unxz=NONE __dumpuncompressors 3<<EOF
stdout
*=.gz: built-in
*=.bz2: built-in
*=.lzma: not supported (install lzma or use --unlzma to tell where unlzma is).
*=.xz: not supported (install xz-utils or use --unxz to tell where unxz is).
*=.lz: not supported (install lzip or use --lunzip to tell where lunzip is).
EOF
testrun - --gunzip=false --bunzip2=false --unlzma=false --unxz=NONE __dumpuncompressors 3<<EOF
testrun - --lunzip=NONE --gunzip=false --bunzip2=false --unlzma=false --unxz=NONE __dumpuncompressors 3<<EOF
stdout
*=.gz: built-in + '/bin/false'
*=.bz2: built-in + '/bin/false'
*=.lzma: '/bin/false'
*=.xz: not supported (install xz-utils or use --unxz to tell where unxz is).
*=.lz: not supported (install lzip or use --lunzip to tell where lunzip is).
EOF
touch fakeg fakeb fakel fakexz
touch fakeg fakeb fakel fakexz fakelz
testrun - --gunzip=./fakeg --bunzip2=./fakeb --unlzma=./fakel --unxz=./fakexz __dumpuncompressors 3<<EOF
testrun - --lunzip=./fakelz --gunzip=./fakeg --bunzip2=./fakeb --unlzma=./fakel --unxz=./fakexz __dumpuncompressors 3<<EOF
stdout
*=.gz: built-in
*=.bz2: built-in
*=.lzma: not supported (install lzma or use --unlzma to tell where unlzma is).
*=.xz: not supported (install xz-utils or use --unxz to tell where unxz is).
*=.lz: not supported (install lzip or use --lunzip to tell where lunzip is).
EOF
chmod u+x fakeg fakeb fakel fakexz
chmod u+x fakeg fakeb fakel fakexz fakelz
testrun - --gunzip=./fakeg --bunzip2=./fakeb --unlzma=./fakel --unxz=./fakexz __dumpuncompressors 3<<EOF
testrun - --lunzip=./fakelz --gunzip=./fakeg --bunzip2=./fakeb --unlzma=./fakel --unxz=./fakexz __dumpuncompressors 3<<EOF
stdout
*=.gz: built-in + './fakeg'
*=.bz2: built-in + './fakeb'
*=.lzma: './fakel'
*=.xz: './fakexz'
*=.lz: './fakelz'
EOF
rm fakeg fakeb fakel fakexz
rm fakeg fakeb fakel fakexz fakelz
# Then test the builtin formats and the external one...
......
......@@ -2864,12 +2864,13 @@ int main(int argc,char *argv[]) {
static const struct option longopts[] = {
{"help", no_argument, NULL, 'h'},
{"create", no_argument, NULL, 'C'},
{"create-with-all-fields", no_argument, &longoption, 5},
{"create-with-all-fields", no_argument, &longoption, 6},
{"searchpath", required_argument, NULL, 's'},
{"gunzip", required_argument, &longoption, 1},
{"bunzip2", required_argument, &longoption, 2},
{"unlzma", required_argument, &longoption, 3},
{"unxz", required_argument, &longoption, 4},
{"lunzip", required_argument, &longoption, 5},
{NULL, 0, NULL, 0},
};
int c;
......@@ -2879,7 +2880,7 @@ int main(int argc,char *argv[]) {
bool all_fields = false;
struct strlist searchpath;
struct changes *changesdata IFSTUPIDCC(=NULL);
char *gunzip = NULL, *bunzip2 = NULL, *unlzma = NULL, *unxz = NULL;
char *gunzip = NULL, *bunzip2 = NULL, *unlzma = NULL, *unxz = NULL, *lunzip = NULL;
retvalue r;
strlist_init(&searchpath);
......@@ -2901,6 +2902,9 @@ int main(int argc,char *argv[]) {
unxz = strdup(optarg);
break;
case 5:
lunzip = strdup(optarg);
break;
case 6:
create_file = true;
all_fields = true;
break;
......@@ -2925,7 +2929,7 @@ int main(int argc,char *argv[]) {
about(false);
}
signature_init(false);
uncompressions_check(gunzip, bunzip2, unlzma, unxz);
uncompressions_check(gunzip, bunzip2, unlzma, unxz, lunzip);
changesfilename = argv[optind];
if( strcmp(changesfilename,"-") != 0 && !endswith(changesfilename,".changes") ) {
......
......@@ -39,14 +39,14 @@
#include "uncompression.h"
const char * const uncompression_suffix[c_COUNT] = {
"", ".gz", ".bz2", ".lzma", ".xz" };
"", ".gz", ".bz2", ".lzma", ".xz", ".lz" };
/* So help messages can hint what option to try */
const char * const uncompression_option[c_COUNT] = {
NULL, NULL, "--bunzip2", "--unlzma", "--unxz" };
NULL, NULL, "--bunzip2", "--unlzma", "--unxz", "--lunzip" };
/* how those are called in the config file */
const char * const uncompression_config[c_COUNT] = {
".", ".gz", ".bz2", ".lzma", ".xz" };
".", ".gz", ".bz2", ".lzma", ".xz", "lz" };
/*@null@*/ char *extern_uncompressors[c_COUNT] = {
......@@ -340,11 +340,12 @@ static void search_binary(/*@null@*/const char *setting, const char *default_pro
}
/* check for existance of external programs */
void uncompressions_check(const char *gunzip, const char *bunzip2, const char *unlzma, const char *unxz) {
void uncompressions_check(const char *gunzip, const char *bunzip2, const char *unlzma, const char *unxz, const char *lunzip) {
search_binary(gunzip, "gunzip", &extern_uncompressors[c_gzip]);
search_binary(bunzip2, "bunzip2", &extern_uncompressors[c_bzip2]);
search_binary(unlzma, "unlzma", &extern_uncompressors[c_lzma]);
search_binary(unxz, "unxz", &extern_uncompressors[c_xz]);
search_binary(lunzip, "lunzip", &extern_uncompressors[c_lunzip]);
}
static inline retvalue builtin_uncompress(const char *compressed, const char *destination, enum compression compression) {
......
......@@ -55,7 +55,7 @@ retvalue uncompress_fdopen(/*@out@*/struct compressedfile **, int, off_t, enum c
/**** general initialisation ****/
/* check for existance of external programs */
void uncompressions_check(const char *gunzip, const char *bunzip2, const char *unlzma, const char *unxz);
void uncompressions_check(const char *gunzip, const char *bunzip2, const char *unlzma, const char *unxz, const char *lunzip);
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment