Commit dc9d9acb authored by Bernhard Link's avatar Bernhard Link

a bit more general update-decide-function

parent 790a9e8e
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
.SH NAME .SH NAME
reprepro \- produce, manage and sync a local repository of debian packages reprepro \- produce, manage and sync a local repository of debian packages
.SH SYNOPSIS .SH SYNOPSIS
.B reprepro --help .B reprepro \-\-help
.B reprepro .B reprepro
[ [
...@@ -20,31 +20,31 @@ libdb3 gpgme ...@@ -20,31 +20,31 @@ libdb3 gpgme
Global options can be specified before the command. They effect Global options can be specified before the command. They effect
some subset of commands and are ignored otherwise. some subset of commands and are ignored otherwise.
.TP .TP
.B -h --help .B \-h \-\-help
Displays a short list of options and commands with description. Displays a short list of options and commands with description.
.TP .TP
.B -v, -V, --verbose .B \-v, \-V, \-\-verbose
Be more verbose. Can be applied multiple times. One upcase Be more verbose. Can be applied multiple times. One upcase
.B -V .B \-V
counts as five lowercase counts as five lowercase
.B -v. .B \-v.
.TP .TP
.B -f, --force .B \-f, \-\-force
Do things nevertheless. Might be dangerous and destructive. Do things nevertheless. Might be dangerous and destructive.
.TP .TP
.B -b, --basedir \fIbasedir\fP .B \-b, \-\-basedir \fIbasedir\fP
Sets the base-dir of the repository to manage, i.e. where the Sets the base\-dir of the repository to manage, i.e. where the
.B pool/ .B pool/
subdirectory resides. Also sets subdirectory resides. Also sets
.B --distdir \fIbasedir\fP/dists --dbdir \fIbasedir\fP/db .B \-\-distdir \fIbasedir\fP/dists \-\-dbdir \fIbasedir\fP/db
.B --listdir \fIbasedir\fP/lists --confdir \fIbasedir\fP/conf .B \-\-listdir \fIbasedir\fP/lists \-\-confdir \fIbasedir\fP/conf
.B --overridedir \fIbasedir\fP/override .B \-\-overridedir \fIbasedir\fP/override
(that means especially: use those options afterwards if you want to use them). (that means especially: use those options afterwards if you want to use them).
.TP .TP
.B -c, --confdir \fIconfdir\fP .B \-c, \-\-confdir \fIconfdir\fP
Sets the directory where the configuration is searched in. Sets the directory where the configuration is searched in.
.TP .TP
.B -d, --distdir \fIdistdir\fP .B \-d, \-\-distdir \fIdistdir\fP
Sets the directory to generate index files relatively to. (i.e. things like Sets the directory to generate index files relatively to. (i.e. things like
Packages.gz Sources.gz and Release.gpg) Packages.gz Sources.gz and Release.gpg)
...@@ -54,31 +54,31 @@ apt has ...@@ -54,31 +54,31 @@ apt has
hardcoded in it, so this is only useful for testing or when your webserver hardcoded in it, so this is only useful for testing or when your webserver
pretends another directory structure than your physical layout. pretends another directory structure than your physical layout.
.TP .TP
.B -D, --dbdir \fIdbdir\fP .B \-D, \-\-dbdir \fIdbdir\fP
Sets the directory where reprepro keeps its databases. Sets the directory where reprepro keeps its databases.
.B Note: .B Note:
This is permanent data, no cache. One has almost to regenerate the whole This is permanent data, no cache. One has almost to regenerate the whole
repository when this is lost. repository when this is lost.
.TP .TP
.B -L, --listdir \fIlistdir\fP .B \-L, \-\-listdir \fIlistdir\fP
Sets the directory where downloads it downloads indices to when importing Sets the directory where downloads it downloads indices to when importing
from other repositories. This is temporary data and can be safely deleted from other repositories. This is temporary data and can be safely deleted
when not in an update run. when not in an update run.
.TP .TP
.B -o, --overridedir \fIoverridedir\fP .B \-o, \-\-overridedir \fIoverridedir\fP
Sets the directory where specified override-files will be searched in if Sets the directory where specified override\-files will be searched in if
they do not start with a slash. they do not start with a slash.
.TP .TP
.B -M, --methoddir \fImethoddir\fP .B \-M, \-\-methoddir \fImethoddir\fP
Look in \fImethoddir\fP instead of Look in \fImethoddir\fP instead of
.B /usr/lib/apt/methods .B /usr/lib/apt/methods
for methods to call when importing from other repositories. for methods to call when importing from other repositories.
.TP .TP
.B -C, --component \fIcomponent\fP .B \-C, \-\-component \fIcomponent\fP
Specify a component to force into, to remove from or to list only. Specify a component to force into, to remove from or to list only.
.TP .TP
.B -A, --architecture \fIarchitecture\fP .B \-A, \-\-architecture \fIarchitecture\fP
Specify an architecture to only include into, remove from or Specify an architecture to only include into, remove from or
list. list.
...@@ -88,27 +88,27 @@ versions of an ...@@ -88,27 +88,27 @@ versions of an
.B Architecture: all .B Architecture: all
\-package in different architectures of the same distribution. \-package in different architectures of the same distribution.
.TP .TP
.B -S, --section \fIsection\fP .B \-S, \-\-section \fIsection\fP
Overrides the section of inclusions. (Also override possible override files) Overrides the section of inclusions. (Also override possible override files)
.TP .TP
.B -P, --priority \fIpriority\fP .B \-P, \-\-priority \fIpriority\fP
Overrides the priority of inclusions. (Also override possible override files) Overrides the priority of inclusions. (Also override possible override files)
.SH COMMANDS .SH COMMANDS
.TP .TP
.BR export " [ " \fIcodenames\fP " ]" .BR export " [ " \fIcodenames\fP " ]"
Generate all index files for the specified distributions. (For all if none Generate all index files for the specified distributions. (For all if none
is specified). This will normaly be done automatically and more is specified). This will normaly be done automatically and more
fine-tuned when including or removing packages, so seldom needed; but is nevertheless fine\-tuned when including or removing packages, so seldom needed; but is nevertheless
a good way to see if a good way to see if
a new a new
.B distributions .B distributions
config-file does the expected things. config\-file does the expected things.
.TP .TP
.B list \fIcodename\fP \fIpackagename\fP .B list \fIcodename\fP \fIpackagename\fP
List all packages (source and binary, except when List all packages (source and binary, except when
.B -A .B \-A
is given) with the given name in all components (except when is given) with the given name in all components (except when
.B -c .B \-c
is given) of the specified distribution. is given) of the specified distribution.
.TP .TP
.B remove \fIcodename\fP \fIpackagename\fP .B remove \fIcodename\fP \fIpackagename\fP
...@@ -209,11 +209,11 @@ file of the specified .deb-file. ...@@ -209,11 +209,11 @@ file of the specified .deb-file.
.B reprepo .B reprepo
uses two config files, that are searched in uses two config files, that are searched in
the directory specified with the directory specified with
.B -c .B \-c
or in the or in the
.B conf/ .B conf/
subdirectory of the directory given by subdirectory of the directory given by
.B -b .B \-b
. The file . The file
.B distributions .B distributions
is always needed and describes what distributions is always needed and describes what distributions
...@@ -273,7 +273,7 @@ in the future.) ...@@ -273,7 +273,7 @@ in the future.)
This will also be copied into the Release files. This will also be copied into the Release files.
.TP .TP
.B UDebComponents .B UDebComponents
Components with a debian-installer subhirachy containing .udebs. Components with a debian\-installer subhirachy containing .udebs.
(E.g. simply "main") (E.g. simply "main")
.TP .TP
.B Update .B Update
...@@ -293,13 +293,25 @@ When this field is present, it describes the source override file. ...@@ -293,13 +293,25 @@ When this field is present, it describes the source override file.
.SS conf/updates .SS conf/updates
.TP .TP
.B Name .B Name
The name of this update-upstream as it can be used in the The name of this update\-upstream as it can be used in the
.B Update .B Update
field in conf/distributions. field in conf/distributions.
.TP .TP
.B Method .B Method
An URL as one could also give it apt, e.g. An URL as one could also give it apt, e.g.
.I http://ftp.debian.de/debian .I http://ftp.debian.de/debian
which is simply given to the corresponding
.B apt\-get
method. (So either
.B apt\-get has to be installed, or you have to point with
.B \-M
to a place where such methods are found.
.TP
.B Config
This can contain any number of lines, each in the format
.B apt\-get \-\-option
would expect. (Multiple lines - as always - marked with
leading spaces).
.TP .TP
.B Suite .B Suite
The suite to update from. If this is not present, the codename The suite to update from. If this is not present, the codename
...@@ -313,7 +325,7 @@ to update from. ...@@ -313,7 +325,7 @@ to update from.
.B Components .B Components
The components to update. Each item can be either the name The components to update. Each item can be either the name
of a component or a pair of a upstream component and a local of a component or a pair of a upstream component and a local
component seperated with ">". (e.g. "main>all contrib>all non-free>notall") component seperated with ">". (e.g. "main>all contrib>all non\-free>notall")
Items with a local part are ignored. If no items are there Items with a local part are ignored. If no items are there
all from the updated distribution are taken. (Use some nonexisting all from the updated distribution are taken. (Use some nonexisting
like "none", if you want none). like "none", if you want none).
...@@ -328,7 +340,7 @@ Download the ...@@ -328,7 +340,7 @@ Download the
.B Release.gpg .B Release.gpg
file and check if it is a signature of the file and check if it is a signature of the
.B Releasefile with the key given here. (In the Format as .B Releasefile with the key given here. (In the Format as
"gpg --with-colons --list-key" prints it, i.e. the last "gpg \-\-with-colons \-\-list-key" prints it, i.e. the last
16 hexdigits of the fingerprint) 16 hexdigits of the fingerprint)
.TP .TP
.B IgnoreRelease .B IgnoreRelease
...@@ -341,25 +353,25 @@ yet to be described ...@@ -341,25 +353,25 @@ yet to be described
.SH GUESSING .SH GUESSING
When including a binary or source package without explicitly When including a binary or source package without explicitly
declaring a component with declaring a component with
.B -C .B \-C
it will take the it will take the
first component with the name of the section, beeing first component with the name of the section, beeing
prefix to the section, beeing suffix to the section prefix to the section, beeing suffix to the section
or having the section as prefix or any. (In this order) or having the section as prefix or any. (In this order)
Thus having specifiend the components: Thus having specifiend the components:
"main non-free contrib non-US/main non-US/non-free non-US/contrib" "main non\-free contrib non\-US/main non\-US/non-free non\-US/contrib"
should map e.g. should map e.g.
"non-US" to "non-US/main" and "contrib/editors" to "contrib", "non\-US" to "non\-US/main" and "contrib/editors" to "contrib",
while having only "main non-free and contrib" as components should while having only "main non\-free and contrib" as components should
map "non-US/contrib" to "contrib" and "non-US" to "main". map "non\-US/contrib" to "contrib" and "non\-US" to "main".
.B NOTE: .B NOTE:
Always specify main as the first component, if you want things Always specify main as the first component, if you want things
to end up there. to end up there.
.B NOTE: .B NOTE:
unlike in dak, non-US and non-us are different things... unlike in dak, non\-US and non\-us are different things...
.SH NOMENCLATURE .SH NOMENCLATURE
.B Codename .B Codename
is the identifier ... is the identifier ...
...@@ -390,7 +402,7 @@ is sometimes also considered as architecture. ...@@ -390,7 +402,7 @@ is sometimes also considered as architecture.
Things like Things like
.B main .B main
. .
.B non-free .B non\-free
and and
.B contrib .B contrib
(somtimes also called sections) (somtimes also called sections)
...@@ -407,7 +419,7 @@ The checksum of a file, beeing in the format ...@@ -407,7 +419,7 @@ The checksum of a file, beeing in the format
"\fI<md5sum of file>\fP \fI<length of file>\fP" "\fI<md5sum of file>\fP \fI<length of file>\fP"
.SH BUGS .SH BUGS
The The
.B --force .B \-\-force
option needs to be replaced by something superior so that one can allow option needs to be replaced by something superior so that one can allow
stupid things but not descructive things. stupid things but not descructive things.
......
...@@ -737,7 +737,7 @@ static inline retvalue queueindex(struct update_index *index,int force) { ...@@ -737,7 +737,7 @@ static inline retvalue queueindex(struct update_index *index,int force) {
retvalue updates_prepare(struct aptmethodrun *run,struct distribution *distribution) { static retvalue updates_prepare(struct aptmethodrun *run,struct distribution *distribution) {
retvalue result,r; retvalue result,r;
struct update_origin *origin; struct update_origin *origin;
...@@ -751,7 +751,7 @@ retvalue updates_prepare(struct aptmethodrun *run,struct distribution *distribut ...@@ -751,7 +751,7 @@ retvalue updates_prepare(struct aptmethodrun *run,struct distribution *distribut
return result; return result;
} }
retvalue updates_queuelists(struct aptmethodrun *run,struct distribution *distribution,int force) { static retvalue updates_queuelists(struct aptmethodrun *run,struct distribution *distribution,int force) {
retvalue result,r; retvalue result,r;
struct update_origin *origin; struct update_origin *origin;
struct update_target *target; struct update_target *target;
...@@ -775,13 +775,13 @@ retvalue updates_queuelists(struct aptmethodrun *run,struct distribution *distri ...@@ -775,13 +775,13 @@ retvalue updates_queuelists(struct aptmethodrun *run,struct distribution *distri
return RET_OK;; return RET_OK;;
} }
static inline retvalue searchformissing(const char *dbdir,struct downloadcache *cache,filesdb filesdb,struct update_target *u,int force) { static inline retvalue searchformissing(const char *dbdir,struct downloadcache *cache,filesdb filesdb,struct update_target *u,upgrade_decide_function *decide,int force) {
struct update_index *index; struct update_index *index;
retvalue result,r; retvalue result,r;
if( verbose > 2 ) if( verbose > 2 )
fprintf(stderr," processing updates for '%s'\n",u->target->identifier); fprintf(stderr," processing updates for '%s'\n",u->target->identifier);
r = upgradelist_initialize(&u->upgradelist,u->target,dbdir,ud_always); r = upgradelist_initialize(&u->upgradelist,u->target,dbdir,decide);
if( RET_WAS_ERROR(r) ) if( RET_WAS_ERROR(r) )
return r; return r;
...@@ -807,13 +807,13 @@ static inline retvalue searchformissing(const char *dbdir,struct downloadcache * ...@@ -807,13 +807,13 @@ static inline retvalue searchformissing(const char *dbdir,struct downloadcache *
return result; return result;
} }
retvalue updates_readindices(const char *dbdir,struct downloadcache *cache,filesdb filesdb,struct distribution *distribution,int force) { static retvalue updates_readindices(const char *dbdir,struct downloadcache *cache,filesdb filesdb,struct distribution *distribution,int force) {
retvalue result,r; retvalue result,r;
struct update_target *u; struct update_target *u;
result = RET_NOTHING; result = RET_NOTHING;
for( u=distribution->updatetargets ; u ; u=u->next ) { for( u=distribution->updatetargets ; u ; u=u->next ) {
r = searchformissing(dbdir,cache,filesdb,u,force); r = searchformissing(dbdir,cache,filesdb,u,ud_always,force);
RET_UPDATE(result,r); RET_UPDATE(result,r);
if( RET_WAS_ERROR(r) && !force ) if( RET_WAS_ERROR(r) && !force )
break; break;
...@@ -822,7 +822,7 @@ retvalue updates_readindices(const char *dbdir,struct downloadcache *cache,files ...@@ -822,7 +822,7 @@ retvalue updates_readindices(const char *dbdir,struct downloadcache *cache,files
} }
retvalue updates_install(const char *dbdir,filesdb filesdb,DB *refsdb,struct distribution *distribution,int force) { static retvalue updates_install(const char *dbdir,filesdb filesdb,DB *refsdb,struct distribution *distribution,int force) {
retvalue result,r; retvalue result,r;
struct update_target *u; struct update_target *u;
......
...@@ -21,12 +21,12 @@ void updates_freetargets(struct update_target *t); ...@@ -21,12 +21,12 @@ void updates_freetargets(struct update_target *t);
retvalue updates_getindices(const char *listdir,const struct update_pattern *patterns,struct distribution *distributions); retvalue updates_getindices(const char *listdir,const struct update_pattern *patterns,struct distribution *distributions);
struct aptmethodrun; // struct aptmethodrun;
struct downloadcache; // struct downloadcache;
retvalue updates_prepare(struct aptmethodrun *run,struct distribution *distribution); // retvalue updates_prepare(struct aptmethodrun *run,struct distribution *distribution);
retvalue updates_queuelists(struct aptmethodrun *run,struct distribution *distribution,int force); // retvalue updates_queuelists(struct aptmethodrun *run,struct distribution *distribution,int force);
retvalue updates_readindices(const char *dbdir,struct downloadcache *cache,filesdb filesdb,struct distribution *distribution,int force); // retvalue updates_readindices(const char *dbdir,struct downloadcache *cache,filesdb filesdb,struct distribution *distribution,int force);
retvalue updates_update(const char *dbdir,const char *listdir,const char *methoddir,filesdb filesdb,DB *refsdb,struct distribution *distributions,int force); retvalue updates_update(const char *dbdir,const char *listdir,const char *methoddir,filesdb filesdb,DB *refsdb,struct distribution *distributions,int force);
......
...@@ -246,7 +246,7 @@ static retvalue upgradelist_trypackage(struct upgradelist *upgrade,const char *c ...@@ -246,7 +246,7 @@ static retvalue upgradelist_trypackage(struct upgradelist *upgrade,const char *c
/* adding a package not yet existing */ /* adding a package not yet existing */
struct package_data *new; struct package_data *new;
decision = (*upgrade->decide)(packagename,NULL,version); decision = (*upgrade->decide)(packagename,NULL,version,chunk);
if( decision != UD_UPGRADE ) { if( decision != UD_UPGRADE ) {
free(packagename); free(packagename);
free(version); free(version);
...@@ -317,7 +317,7 @@ static retvalue upgradelist_trypackage(struct upgradelist *upgrade,const char *c ...@@ -317,7 +317,7 @@ static retvalue upgradelist_trypackage(struct upgradelist *upgrade,const char *c
fprintf(stderr,"'%s' from '%s' is newer than '%s' currently\n", fprintf(stderr,"'%s' from '%s' is newer than '%s' currently\n",
version,packagename,current->version); version,packagename,current->version);
decision = upgrade->decide(current->name, decision = upgrade->decide(current->name,
current->version,version); current->version,version,chunk);
if( decision != UD_UPGRADE ) { if( decision != UD_UPGRADE ) {
//TODO: perhaps set a flag if hold was applied... //TODO: perhaps set a flag if hold was applied...
free(version); free(version);
...@@ -464,6 +464,6 @@ retvalue upgradelist_dump(struct upgradelist *upgrade){ ...@@ -464,6 +464,6 @@ retvalue upgradelist_dump(struct upgradelist *upgrade){
} }
/* standard answer function */ /* standard answer function */
upgrade_decision ud_always(const char *package,const char *old_version,const char *new_version) { upgrade_decision ud_always(const char *package,const char *old_version,const char *new_version,const char *new_controlchunk) {
return UD_UPGRADE; return UD_UPGRADE;
} }
...@@ -15,9 +15,9 @@ ...@@ -15,9 +15,9 @@
typedef enum { UD_NO, UD_UPGRADE, UD_HOLD } upgrade_decision; typedef enum { UD_NO, UD_UPGRADE, UD_HOLD } upgrade_decision;
typedef upgrade_decision upgrade_decide_function(const char *package,const char *old_version,const char *new_version); typedef upgrade_decision upgrade_decide_function(const char *package,const char *old_version,const char *new_version,const char *newcontrolchunk);
upgrade_decision ud_always(const char *p,const char *ov,const char *nv); upgrade_decision ud_always(const char *p,const char *ov,const char *nv,const char *nc);
/* The main part: */ /* The main part: */
......
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