Commit dc723052 authored by Bernhard Link's avatar Bernhard Link

add DownloadListsAs

parent f8954504
2009-01-06
* add DownloadListsAs: option for conf/updates to specify which index
files (.gz, .bz2, .lzma, ...) to download when available.
2009-01-04
* add support for libdb4.7 (yet with some warnings to note I have not
tested it much yet)
......
......@@ -1192,6 +1192,25 @@ times, with the environment variables
set to the where this file will be added and
.B REPREPRO_FILTER_PATTERN
to the name of the update rule causing it.
.TP
.B DownloadListsAs
The arguments of this field, which much be elements of the
form \fB.\fP, \fB.gz\fP, \fB.bz2\fP and \fB.lzma\fP specify in
which order reprepro will look for a useable variant of needed
index files in the downloaded Release file.
(The default is \fB.lzma .bz2 .gz .\fP, i.e. download .lzma if
listed in the Release file and there is a way to uncompress it,
then .bz2 if useable, then .gz and then uncompressed).
Together with \fBIgnoreRelease\fP reprepro will download the first
in this list that could be unpacked (and defaults to .gz).
Note that reprepro currently cannot resume when a file could not
be downloaded.
As there is no way to see if an uncompressed variant
of the file is available (as the Release file always lists their
checksums, even if not there),
it is usually not adviseable to list '\fB.\fP' not as the last argument.
.SS conf/pulls
This file contains the rules for pulling packages from one
distribution to another.
......
......@@ -865,14 +865,14 @@ static inline retvalue find_requested_encoding(struct remote_index *ri, const ch
return RET_ERROR_WRONG_MD5;
}
if( !found ) {
if( unsupported != c_COUNT && unrequested != c_COUNT) {
fprintf(stderr,
"Error: '%s' only lists unusable or unrequested compressions of '%s'.\n"
"Try e.g the '%s' option (or check what it is set to) to make more useable.\n"
"Or change your DownloadListsAs to request e.g. '%s'.\n",
releasefile, ri->filename_in_release,
uncompression_option[unsupported],
uncompression_suffix[unrequested]);
uncompression_config[unrequested]);
return RET_ERROR;
}
if( unsupported != c_COUNT ) {
......@@ -888,7 +888,7 @@ static inline retvalue find_requested_encoding(struct remote_index *ri, const ch
"Error: '%s' only lists unrequested compressions of '%s'.\n"
"Try changing your DownloadListsAs to request e.g. '%s'.\n",
releasefile, ri->filename_in_release,
uncompression_suffix[unrequested]);
uncompression_config[unrequested]);
return RET_ERROR;
}
fprintf(stderr,
......
......@@ -36,9 +36,8 @@ retvalue remote_preparelists(struct aptmethodrun *, bool nodownload);
struct encoding_preferences {
/* number of preferences, 0 means use default */
unsigned short count;
/* a list of compressions to use,
* a c_COUNT means end of the list... */
enum compression requested[c_COUNT];
/* a list of compressions to use */
enum compression requested[3*c_COUNT];
};
struct remote_index *remote_index(struct remote_distribution *, const char *architecture, const char *component, packagetype_t, const struct encoding_preferences *);
......
......@@ -45,12 +45,14 @@ Name: a
VerifyRelease: blindtrust
Method: copy:$WORKDIR/source1
Architectures: dummyarchitecture
DownloadListsAs: .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma .lzma
Components: dummycomponent
Name: b
VerifyRelease: blindtrust
Method: copy:$WORKDIR/source2
Architectures: dummyarchitecture
DownloadListsAs: .lzma .bz2 .gz .
Flat: dummycomponent
Name: ca
......@@ -161,6 +163,68 @@ dpkg-scanpackages pool/firmware /dev/null > dists/suitename/firmware/binary-$FAK
dpkg-scanpackages -a coal pool/firmware /dev/null > dists/suitename/firmware/binary-coal/Packages
cd ..
cat > source1/dists/suitename/Release <<EOF
Codename: hohoho
Suite: suitename
Architectures: coal $FAKEARCHITECTURE
MD5Sum:
00000000000000000000000000000000 0 main/binary-$FAKEARCHITECTURE/Packages.lzma
00000000000000000000000000000000 0 main/binary-$FAKEARCHITECTURE/Packages.gz
00000000000000000000000000000000 0 main/binary-coal/Packages.lzma
00000000000000000000000000000000 0 main/source/Sources.lzma
00000000000000000000000000000000 0 firmware/binary-$FAKEARCHITECTURE/Packages.lzma
00000000000000000000000000000000 0 firmware/binary-coal/Packages.lzma
00000000000000000000000000000000 0 firmware/source/Sources.lzma
00000000000000000000000000000000 0 main/binary-coal/Packages.gz
00000000000000000000000000000000 0 main/source/Sources.gz
00000000000000000000000000000000 0 firmware/binary-$FAKEARCHITECTURE/Packages.gz
00000000000000000000000000000000 0 firmware/binary-coal/Packages.gz
00000000000000000000000000000000 0 firmware/source/Sources.gz
EOF
testrun - --unlzma=NONE update boring 3<<EOF
stdout
-v2*=Created directory "./db"
-v2*=Created directory "./lists"
stderr
*=./conf/updates:5:90: Ignoring all but first 12 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'
-v1*=aptmethod got 'copy:$WORKDIR/source1/dists/suitename/Release'
*=Error: './lists/a_suitename_Release' only lists unusable or unrequested compressions of 'main/binary-${FAKEARCHITECTURE}/Packages'.
*=Try e.g the '--unlzma' option (or check what it is set to) to make more useable.
*=Or change your DownloadListsAs to request e.g. '.gz'.
-v0*=There have been errors!
returns 255
EOF
cat > source1/dists/suitename/Release <<EOF
Codename: hohoho
Suite: suitename
Architectures: coal $FAKEARCHITECTURE
MD5Sum:
00000000000000000000000000000000 0 main/binary-$FAKEARCHITECTURE/Packages.lzma
00000000000000000000000000000000 0 main/binary-coal/Packages.lzma
00000000000000000000000000000000 0 main/source/Sources.lzma
00000000000000000000000000000000 0 firmware/binary-$FAKEARCHITECTURE/Packages.lzma
00000000000000000000000000000000 0 firmware/binary-coal/Packages.lzma
00000000000000000000000000000000 0 firmware/source/Sources.lzma
EOF
testrun - --unlzma=NONE update boring 3<<EOF
stderr
*=./conf/updates:5:90: Ignoring all but first 12 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'
-v1*=aptmethod got 'copy:$WORKDIR/source1/dists/suitename/Release'
*=Error: './lists/a_suitename_Release' only lists unusable compressions of 'main/binary-${FAKEARCHITECTURE}/Packages'.
*=Try e.g the '--unlzma' option (or check what it is set to) to make more useable.
-v0*=There have been errors!
returns 255
EOF
cat > source1/dists/suitename/Release <<EOF
Codename: hohoho
Suite: suitename
......@@ -174,6 +238,25 @@ MD5Sum:
$(cd source1 ; md5releaseline suitename firmware/source/Sources)
EOF
testrun - update boring 3<<EOF
stderr
*=./conf/updates:5:90: Ignoring all but first 12 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'
-v1*=aptmethod got 'copy:$WORKDIR/source1/dists/suitename/Release'
*=Error: './lists/a_suitename_Release' only lists unrequested compressions of 'main/binary-${FAKEARCHITECTURE}/Packages'.
*=Try changing your DownloadListsAs to request e.g. '.'.
-v0*=There have been errors!
returns 255
EOF
ed -s conf/updates <<EOF
g/.lzma .lzma .lzma .lzma/d
w
q
EOF
testrun - update boring 3<<EOF
stderr
-v6*=aptmethod start 'copy:$WORKDIR/source2/x/Release'
......@@ -195,8 +278,6 @@ stderr
-v1*=aptmethod got 'copy:$WORKDIR/source1/dists/suitename/firmware/binary-$FAKEARCHITECTURE/Packages'
-v1*=aptmethod got 'copy:$WORKDIR/source1/dists/suitename/firmware/binary-coal/Packages'
stdout
-v2*=Created directory "./db"
-v2*=Created directory "./lists"
-v0*=Calculating packages to get...
-v3*= processing updates for 'boring|firmware|source'
# 6 times:
......
......@@ -44,6 +44,9 @@ const char * const uncompression_suffix[c_COUNT] = {
/* So help messages can hint what option to try */
const char * const uncompression_option[c_COUNT] = {
NULL, NULL, "--bunzip2", "--unlzma" };
/* how those are called in the config file */
const char * const uncompression_config[c_COUNT] = {
".", ".gz", ".bz2", ".lzma" };
/*@null@*/ char *extern_uncompressors[c_COUNT] = { NULL, NULL, NULL, NULL};
......
......@@ -6,6 +6,7 @@ extern const char * const uncompression_suffix[c_COUNT];
extern /*@null@*/ char *extern_uncompressors[c_COUNT];
/* so help messages know which option to cite: */
extern const char * const uncompression_option[c_COUNT];
extern const char * const uncompression_config[c_COUNT];
/* there are two different modes: uncompress a file to memory,
* or uncompress (possibly multiple files) on the filesystem,
......
......@@ -80,6 +80,7 @@
#include "configparser.h"
#include "filecntl.h"
#include "remoterepository.h"
#include "uncompression.h"
/* The data structures of this one: ("u_" is short for "update_")
......@@ -345,6 +346,76 @@ CFscriptSETPROC(update_pattern, listhook)
CFfilterlistSETPROC(update_pattern, filterlist)
CFtermSSETPROC(update_pattern, includecondition)
CFUSETPROC(update_pattern, downloadlistsas) {
CFSETPROCVAR(update_pattern, this);
char *word;
const char *u;
retvalue r;
unsigned int e = 0;
enum compression c;
this->downloadlistsas_set = true;
r = config_getword(iter, &word);
while( RET_IS_OK(r) ) {
if( e >= ARRAYCOUNT(this->downloadlistsas.requested) ) {
fprintf(stderr,
"%s:%d:%d: Ignoring all but first %d entries...\n",
config_filename(iter),
config_markerline(iter),
config_markercolumn(iter),
(int)(ARRAYCOUNT(
this->downloadlistsas.requested)));
free(word);
break;
}
if( strncmp(word, "force.", 6) == 0 ) {
u = word + 5;
fprintf(stderr,
"%s:%d:%d: forcing not yet supported in this version, treating as normal '%s'\n",
config_filename(iter),
config_markerline(iter),
config_markercolumn(iter),
u);
} else
u = word;
for( c = 0 ; c < c_COUNT ; c++ ) {
if( strcmp(uncompression_config[c], u) == 0 ||
strcmp(uncompression_config[c]+1, u) == 0 ) {
break;
}
}
if( c < c_COUNT ) {
this->downloadlistsas.requested[e++] = c;
free(word);
r = config_getword(iter, &word);
continue;
}
if( strcmp(u, ".diff") == 0 || strcmp(u, "diff") == 0 ) {
fprintf(stderr,
"%s:%d:%d: ignoring '%s', as not yet supported in this version\n",
config_filename(iter),
config_markerline(iter),
config_markercolumn(iter),
word);
free(word);
r = config_getword(iter, &word);
continue;
}
fprintf(stderr,
"%s:%d:%d: Error: unknown list download mode '%s'!\n",
config_filename(iter),
config_markerline(iter),
config_markercolumn(iter),
u);
free(word);
return RET_ERROR;
}
if( RET_WAS_ERROR(r) )
return r;
this->downloadlistsas.count = e;
return RET_OK;
}
CFUSETPROC(update_pattern, components) {
CFSETPROCVAR(update_pattern, this);
retvalue r;
......@@ -449,7 +520,8 @@ static const struct configfield updateconfigfields[] = {
CF("VerifyRelease", update_pattern, verifyrelease),
CF("ListHook", update_pattern, listhook),
CF("FilterFormula", update_pattern, includecondition),
CF("FilterList", update_pattern, filterlist)
CF("FilterList", update_pattern, filterlist),
CF("DownloadListsAs", update_pattern, downloadlistsas)
};
CFfinishparse(update_pattern) {
......
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