Commit 4164f417 authored by Bernhard Link's avatar Bernhard Link

-A, -T and -C can now have multiple arguments separated by '|'

parent f4d0b5ea
2009-08-15
* -A, -T and -C can now have multiple arguments separated by '|'.
2009-08-13
* FakeComponentPrefix now does not add the prefix to components
already having it and removes it from the relative directory where
......
......@@ -3,6 +3,9 @@ Updates since 3.11.1:
with './'
- directories starting '+b/' '+o/' and '+c/' are relative to basedir, outdir
or confdir.
- FakeComponentPrefix now no longer adds its arguments to components already
having it and shortens their dist directories to not duplicate that either.
- -A, -C and -T can have multiple arguments now, separated with '|'.
Updates since 3.11.0:
- new changestool option --create-with-all-fields
......
......@@ -270,6 +270,16 @@ void atomlist_move(struct atomlist *dest, struct atomlist *orig) {
orig->atoms = NULL;
}
bool atomlist_hasexcept(const struct atomlist *list, atom_t atom) {
int i;
for( i = 0 ; i < list->count ; i++ ) {
if( list->atoms[i] != atom )
return true;
}
return false;
}
bool atomlist_in(const struct atomlist *list, atom_t atom) {
int i;
......@@ -348,3 +358,33 @@ retvalue atomlist_fprint(FILE *file, enum atom_type type, const struct atomlist
component_t components_count(void) {
return components.count;
}
retvalue atomlist_filllist(enum atom_type type, struct atomlist *list, char *string, const char **missing) {
struct atomlist l;
char *e;
retvalue r;
atom_t a;
atomlist_init(&l);
while( *string != '\0' ) {
e = strchr(string, '|');
if( e == NULL )
e = strchr(string, '\0');
else
*(e++) = '\0';
a = atom_find(type, string);
if( !atom_defined(a) ) {
atomlist_done(&l);
*missing = string;
return RET_NOTHING;
}
r = atomlist_add(&l, a);
if( RET_WAS_ERROR(r) ) {
atomlist_done(&l);
return r;
}
string = e;
}
atomlist_move(list, &l);
return RET_OK;
}
......@@ -40,6 +40,7 @@ atom_t atom_find(enum atom_type, const char *);
retvalue atom_intern(enum atom_type, const char *, /*@out@*/atom_t *);
#define limitation_missed(a, b) ((atom_defined(a) && (a) != (b) ))
#define limitations_missed(a, b) ((a) != NULL && !atomlist_in(a, b))
struct atomlist {
......@@ -59,6 +60,7 @@ retvalue atomlist_add(struct atomlist *, atom_t);
/* replace the contents of dest with those from orig, which get emptied */
void atomlist_move(/*@out@*/struct atomlist *, /*@special@*/struct atomlist *orig) /*@releases orig->values @*/;
bool atomlist_hasexcept(const struct atomlist *, atom_t);
bool atomlist_in(const struct atomlist *, atom_t);
int atomlist_ofs(const struct atomlist *, atom_t);
......@@ -68,4 +70,5 @@ bool atomlist_subset(const struct atomlist *, const struct atomlist *subset, /*@
/* print a space separated list of elements */
retvalue atomlist_fprint(FILE *, enum atom_type, const struct atomlist *);
retvalue atomlist_filllist(enum atom_type, /*@out@*/struct atomlist *, char *string, /*@out@*/const char **missing);
#endif
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005,2006,2007 Bernhard R. Link
* Copyright (C) 2003,2004,2005,2006,2007,2009 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
......@@ -587,7 +587,7 @@ retvalue binaries_complete(const struct deb_headers *pkg, const char *filekey, c
return RET_OK;
}
retvalue binaries_adddeb(const struct deb_headers *deb, struct database *database, architecture_t forcearchitecture, packagetype_t packagetype, struct distribution *distribution, struct trackingdata *trackingdata, component_t component, const struct strlist *filekeys, const char *control) {
retvalue binaries_adddeb(const struct deb_headers *deb, struct database *database, const struct atomlist *forcearchitectures, packagetype_t packagetype, struct distribution *distribution, struct trackingdata *trackingdata, component_t component, const struct strlist *filekeys, const char *control) {
retvalue r,result;
int i;
......@@ -620,35 +620,28 @@ retvalue binaries_adddeb(const struct deb_headers *deb, struct database *databas
RET_ENDUPDATE(r,r2);
}
RET_UPDATE(result,r);
} else if( atom_defined(forcearchitecture) && forcearchitecture != architecture_all ) {
struct target *t = distribution_getpart(distribution,
component, forcearchitecture,
packagetype);
r = target_initpackagesdb(t, database, READWRITE);
if( !RET_WAS_ERROR(r) ) {
retvalue r2;
if( interrupted() )
r = RET_ERROR_INTERRUPTED;
else
r = target_addpackage(t, distribution->logger,
database,
deb->name, deb->version,
control,
filekeys,
false,
trackingdata,
deb->architecture_atom,
NULL, NULL);
r2 = target_closepackagesdb(t);
RET_ENDUPDATE(r,r2);
}
RET_UPDATE(result,r);
} else for( i = 0 ; i < distribution->architectures.count ; i++ ) {
RET_UPDATE(distribution->status, result);
return result;
}
/* It's an architecture all package */
/* if -A includes all, it is added everywhere, as if no -A was
* given. (as it behaved this way when there was only one -A possible,
* and to allow incoming to force it into architecture 'all' )
* */
if( forcearchitectures != NULL &&
atomlist_in(forcearchitectures, architecture_all) )
forcearchitectures = NULL;
for( i = 0 ; i < distribution->architectures.count ; i++ ) {
/*@dependent@*/struct target *t;
architecture_t a = distribution->architectures.atoms[i];
if( a == architecture_source )
continue;
if( forcearchitectures != NULL &&
!atomlist_in(forcearchitectures, a) )
continue;
t = distribution_getpart(distribution,
component, a, packagetype);
r = target_initpackagesdb(t, database, READWRITE);
......@@ -672,7 +665,6 @@ retvalue binaries_adddeb(const struct deb_headers *deb, struct database *databas
RET_UPDATE(result,r);
}
RET_UPDATE(distribution->status, result);
return result;
}
......
......@@ -51,6 +51,6 @@ retvalue binaries_calcfilekeys(component_t, const struct deb_headers *, packaget
struct overrideinfo;
retvalue binaries_complete(const struct deb_headers *, const char *filekey, const struct checksums *, const struct overrideinfo *, const char *section, const char *priority, char **newcontrol);
retvalue binaries_adddeb(const struct deb_headers *, struct database *, architecture_t forcedarchitecture, packagetype_t, struct distribution *, /*@null@*/struct trackingdata *, component_t, const struct strlist *filekeys, const char *control);
retvalue binaries_adddeb(const struct deb_headers *, struct database *, const struct atomlist *forcedarchitectures, packagetype_t, struct distribution *, /*@null@*/struct trackingdata *, component_t, const struct strlist *filekeys, const char *control);
retvalue binaries_checkadddeb(const struct deb_headers *, struct database *, architecture_t forcearchitecture, packagetype_t, struct distribution *, bool tracking, component_t, bool permitnewerold);
#endif
This diff is collapsed.
......@@ -20,7 +20,7 @@
* get it from the files or try to guess it.
* if dereferencedfilekeys is != NULL, add filekeys that lost reference,
* if tracks != NULL, update/add tracking information there... */
retvalue changes_add(struct database *, /*@null@*/trackingdb tracks, packagetype_t packagetypeonly, component_t, architecture_t forcearchitecture, /*@null@*/const char *forcesection, /*@null@*/const char *forcepriority, struct distribution *, const char *changesfilename, int delete);
retvalue changes_add(struct database *, /*@null@*/trackingdb tracks, const struct atomlist *packagetypes, component_t, const struct atomlist *forcearchitecture, /*@null@*/const char *forcesection, /*@null@*/const char *forcepriority, struct distribution *, const char *changesfilename, int delete);
#endif
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005,2006,2007 Bernhard R. Link
* Copyright (C) 2003,2004,2005,2006,2007,2009 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
......@@ -98,7 +98,7 @@ static retvalue deb_read(/*@out@*/struct debpackage **pkg, const char *filename,
return RET_OK;
}
static retvalue deb_preparelocation(struct debpackage *pkg, component_t forcecomponent, architecture_t forcearchitecture, const char *forcesection, const char *forcepriority, packagetype_t packagetype, struct distribution *distribution, const struct overrideinfo **oinfo_ptr, const char *debfilename){
static retvalue deb_preparelocation(struct debpackage *pkg, component_t forcecomponent, const struct atomlist *forcearchitectures, const char *forcesection, const char *forcepriority, packagetype_t packagetype, struct distribution *distribution, const struct overrideinfo **oinfo_ptr, const char *debfilename){
const struct atomlist *components;
const struct overrideinfo *binoverride;
const struct overrideinfo *oinfo;
......@@ -161,14 +161,15 @@ static retvalue deb_preparelocation(struct debpackage *pkg, component_t forcecom
/* some sanity checks: */
if( atom_defined(forcearchitecture) &&
forcearchitecture != architecture_all &&
pkg->deb.architecture_atom != forcearchitecture &&
pkg->deb.architecture_atom != architecture_all ) {
fprintf(stderr,"Cannot put '%s' into architecture '%s', as it is '%s'!\n",
if( forcearchitectures != NULL &&
pkg->deb.architecture_atom != architecture_all &&
!atomlist_in(forcearchitectures,
pkg->deb.architecture_atom) ) {
fprintf(stderr, "Cannot add '%s', as it is architecture '%s' and you specified to only include ",
debfilename,
atoms_architectures[forcearchitecture],
atoms_architectures[pkg->deb.architecture_atom]);
atomlist_fprint(stderr, at_architecture, forcearchitectures);
fputs(".\n", stderr);
return RET_ERROR;
} else if( pkg->deb.architecture_atom != architecture_all &&
!atomlist_in(&distribution->architectures,
......@@ -205,6 +206,7 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb, component_t forcecomponen
struct debpackage *pkg;
const struct overrideinfo *oinfo;
char *control;
struct atomlist forcearchitectures;
assert( givenfilekey != NULL );
assert( checksums != NULL );
......@@ -244,7 +246,11 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb, component_t forcecomponen
return RET_ERROR;
}
r = deb_preparelocation(pkg, forcecomponent, forcearchitecture, forcesection, forcepriority, packagetype, distribution, &oinfo, debfilename);
forcearchitectures.count = 1;
forcearchitectures.size = 1;
forcearchitectures.atoms = &forcearchitecture;
r = deb_preparelocation(pkg, forcecomponent, &forcearchitectures, forcesection, forcepriority, packagetype, distribution, &oinfo, debfilename);
if( RET_WAS_ERROR(r) ) {
deb_free(pkg);
return r;
......@@ -269,8 +275,8 @@ retvalue deb_prepare(/*@out@*/struct debpackage **deb, component_t forcecomponen
return RET_OK;
}
retvalue deb_addprepared(const struct debpackage *pkg, struct database *database, architecture_t forcearchitecture, packagetype_t packagetype, struct distribution *distribution, struct trackingdata *trackingdata) {
return binaries_adddeb(&pkg->deb, database, forcearchitecture,
retvalue deb_addprepared(const struct debpackage *pkg, struct database *database, const struct atomlist *forcearchitectures, packagetype_t packagetype, struct distribution *distribution, struct trackingdata *trackingdata) {
return binaries_adddeb(&pkg->deb, database, forcearchitectures,
packagetype, distribution, trackingdata,
pkg->component_atom, &pkg->filekeys,
pkg->deb.control);
......@@ -280,7 +286,7 @@ retvalue deb_addprepared(const struct debpackage *pkg, struct database *database
* putting things with architecture of "all" into <d->architectures> (and also
* causing error, if it is not one of them otherwise)
* if component is NULL, guessing it from the section. */
retvalue deb_add(struct database *database, component_t forcecomponent, architecture_t forcearchitecture, const char *forcesection, const char *forcepriority, packagetype_t packagetype, struct distribution *distribution, const char *debfilename, int delete, /*@null@*/trackingdb tracks) {
retvalue deb_add(struct database *database, component_t forcecomponent, const struct atomlist *forcearchitectures, const char *forcesection, const char *forcepriority, packagetype_t packagetype, struct distribution *distribution, const char *debfilename, int delete, /*@null@*/trackingdb tracks) {
struct debpackage *pkg;
retvalue r;
struct trackingdata trackingdata;
......@@ -294,7 +300,7 @@ retvalue deb_add(struct database *database, component_t forcecomponent, architec
if( RET_WAS_ERROR(r) ) {
return r;
}
r = deb_preparelocation(pkg, forcecomponent, forcearchitecture, forcesection, forcepriority, packagetype, distribution, &oinfo, debfilename);
r = deb_preparelocation(pkg, forcecomponent, forcearchitectures, forcesection, forcepriority, packagetype, distribution, &oinfo, debfilename);
if( RET_WAS_ERROR(r) ) {
deb_free(pkg);
return r;
......@@ -325,7 +331,7 @@ retvalue deb_add(struct database *database, component_t forcecomponent, architec
}
}
r = binaries_adddeb(&pkg->deb, database, forcearchitecture,
r = binaries_adddeb(&pkg->deb, database, forcearchitectures,
packagetype, distribution,
(tracks!=NULL)?&trackingdata:NULL,
pkg->component_atom, &pkg->filekeys,
......
......@@ -18,11 +18,11 @@
* if overwrite is not NULL, it will be search for fields to reset for this
* package. (forcesection and forcepriority have higher priority than the
* information there), */
retvalue deb_add(struct database *, component_t forcecomponent, architecture_t forcearchitecture, /*@null@*/const char *forcesection, /*@null@*/const char *forcepriority, packagetype_t, struct distribution *, const char *debfilename, int delete, /*@null@*/trackingdb);
retvalue deb_add(struct database *, component_t forcecomponent, const struct atomlist *forcearchitectures, /*@null@*/const char *forcesection, /*@null@*/const char *forcepriority, packagetype_t, struct distribution *, const char *debfilename, int delete, /*@null@*/trackingdb);
/* in two steps */
struct debpackage;
retvalue deb_addprepared(const struct debpackage *, struct database *, architecture_t forcearchitecture, packagetype_t, struct distribution *, struct trackingdata *);
retvalue deb_addprepared(const struct debpackage *, struct database *, const struct atomlist *forcearchitecture, packagetype_t, struct distribution *, struct trackingdata *);
retvalue deb_prepare(/*@out@*/struct debpackage **deb, component_t forcecomponent, architecture_t forcearchitecture, const char *forcesection, const char *forcepriority, packagetype_t, struct distribution *distribution, const char *debfilename, const char * const filekey, const struct checksums *checksums, const struct strlist *allowed_binaries, const char *expectedsourcename, const char *expectedsourceversion);
void deb_free(/*@only@*/struct debpackage *pkg);
#endif
......@@ -330,7 +330,7 @@ static retvalue packagelist_add(struct database *database, struct distribution *
return result;
}
static retvalue copy_by_func(struct package_list *list, struct database *database, struct distribution *into, struct distribution *from, component_t component_atom, architecture_t architecture_atom, packagetype_t packagetype_atom, retvalue action(struct package_list*, struct database *, struct distribution *, struct distribution *, struct target *, struct target *, void *), void *data) {
static retvalue copy_by_func(struct package_list *list, struct database *database, struct distribution *into, struct distribution *from, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, retvalue action(struct package_list*, struct database *, struct distribution *, struct distribution *, struct target *, struct target *, void *), void *data) {
retvalue result, r;
struct target *origtarget, *desttarget;
......@@ -338,7 +338,7 @@ static retvalue copy_by_func(struct package_list *list, struct database *databas
for( origtarget = from->targets ; origtarget != NULL ;
origtarget = origtarget->next ) {
if( !target_matches(origtarget,
component_atom, architecture_atom, packagetype_atom) )
components, architectures, packagetypes) )
continue;
desttarget = distribution_gettarget(into,
origtarget->component_atom,
......@@ -432,7 +432,7 @@ static void packagelist_done(struct package_list *list) {
}
}
retvalue copy_by_name(struct database *database, struct distribution *into, struct distribution *from, int argc, const char **argv, component_t component, architecture_t architecture, packagetype_t packagetype) {
retvalue copy_by_name(struct database *database, struct distribution *into, struct distribution *from, int argc, const char **argv, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes) {
struct package_list list;
struct namelist names = { argc, argv, calloc(argc, sizeof(bool)),
calloc(argc, sizeof(bool))};
......@@ -445,7 +445,7 @@ retvalue copy_by_name(struct database *database, struct distribution *into, stru
}
memset(&list, 0, sizeof(list));
r = copy_by_func(&list, database, into, from, component, architecture, packagetype, by_name, &names);
r = copy_by_func(&list, database, into, from, components, architectures, packagetypes, by_name, &names);
free(names.warnedabout);
if( verbose >= 0 && !RET_WAS_ERROR(r) ) {
int i;
......@@ -549,7 +549,7 @@ static retvalue by_source(struct package_list *list, struct database *database,
return result;
}
retvalue copy_by_source(struct database *database, struct distribution *into, struct distribution *from, int argc, const char **argv, component_t component, architecture_t architecture, packagetype_t packagetype) {
retvalue copy_by_source(struct database *database, struct distribution *into, struct distribution *from, int argc, const char **argv, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes) {
struct package_list list;
struct namelist names = { argc, argv, NULL, calloc(argc, sizeof(bool)) };
retvalue r;
......@@ -561,7 +561,7 @@ retvalue copy_by_source(struct database *database, struct distribution *into, st
memset(&list, 0, sizeof(list));
// TODO: implement fast way by looking at source tracking
// (also allow copying .changes and .logs)
r = copy_by_func(&list, database, into, from, component, architecture, packagetype, by_source, &names);
r = copy_by_func(&list, database, into, from, components, architectures, packagetypes, by_source, &names);
if( argc == 1 && !RET_WAS_ERROR(r) && verbose >= 0 ) {
assert(names.found != NULL);
......@@ -693,13 +693,13 @@ static retvalue by_glob(struct package_list *list, struct database *database, UN
return result;
}
retvalue copy_by_glob(struct database *database, struct distribution *into, struct distribution *from, const char *glob, component_t component, architecture_t architecture, packagetype_t packagetype) {
retvalue copy_by_glob(struct database *database, struct distribution *into, struct distribution *from, const char *glob, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes) {
struct package_list list;
retvalue r;
memset(&list, 0, sizeof(list));
r = copy_by_func(&list, database, into, from, component, architecture, packagetype, by_glob, (void*)glob);
r = copy_by_func(&list, database, into, from, components, architectures, packagetypes, by_glob, (void*)glob);
if( !RET_IS_OK(r) )
return r;
r = packagelist_add(database, into, &list, from->codename);
......@@ -707,7 +707,7 @@ retvalue copy_by_glob(struct database *database, struct distribution *into, stru
return r;
}
retvalue copy_by_formula(struct database *database, struct distribution *into, struct distribution *from, const char *filter, component_t component, architecture_t architecture, packagetype_t packagetype) {
retvalue copy_by_formula(struct database *database, struct distribution *into, struct distribution *from, const char *filter, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes) {
struct package_list list;
term *condition;
retvalue r;
......@@ -718,7 +718,7 @@ retvalue copy_by_formula(struct database *database, struct distribution *into, s
if( !RET_IS_OK(r) ) {
return r;
}
r = copy_by_func(&list, database, into, from, component, architecture, packagetype, by_formula, condition);
r = copy_by_func(&list, database, into, from, components, architectures, packagetypes, by_formula, condition);
term_free(condition);
if( !RET_IS_OK(r) )
return r;
......@@ -868,7 +868,7 @@ retvalue copy_from_file(struct database *database, struct distribution *into, co
typedef retvalue chooseaction(struct target *, const char *, const char *, const char *, void *);
static retvalue restore_from_snapshot(struct database *database, struct distribution *into, component_t component_atom, architecture_t architecture_atom, packagetype_t packagetype_atom, const char *snapshotname, chooseaction action, void *d) {
static retvalue restore_from_snapshot(struct database *database, struct distribution *into, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, const char *snapshotname, chooseaction action, void *d) {
retvalue result, r;
struct package_list list;
struct target *target;
......@@ -889,7 +889,7 @@ static retvalue restore_from_snapshot(struct database *database, struct distribu
struct indexfile *i;
if( !target_matches(target,
component_atom, architecture_atom, packagetype_atom) )
components, architectures, packagetypes) )
continue;
/* we do not know what compressions where used back then
......@@ -965,21 +965,21 @@ static retvalue restore_from_snapshot(struct database *database, struct distribu
return r;
}
retvalue restore_by_name(struct database *database, struct distribution *into, component_t component, architecture_t architecture, packagetype_t packagetype, const char *snapshotname, int argc, const char **argv) {
retvalue restore_by_name(struct database *database, struct distribution *into, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, const char *snapshotname, int argc, const char **argv) {
struct namelist d = {argc, argv, NULL, NULL};
return restore_from_snapshot(database, into,
component, architecture, packagetype,
components, architectures, packagetypes,
snapshotname, choose_by_name, &d);
}
retvalue restore_by_source(struct database *database, struct distribution *into, component_t component, architecture_t architecture, packagetype_t packagetype, const char *snapshotname, int argc, const char **argv) {
retvalue restore_by_source(struct database *database, struct distribution *into, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, const char *snapshotname, int argc, const char **argv) {
struct namelist d = {argc, argv, NULL, NULL};
return restore_from_snapshot(database, into,
component, architecture, packagetype,
components, architectures, packagetypes,
snapshotname, choose_by_source, &d);
}
retvalue restore_by_formula(struct database *database, struct distribution *into, component_t component, architecture_t architecture, packagetype_t packagetype, const char *snapshotname, const char *filter) {
retvalue restore_by_formula(struct database *database, struct distribution *into, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, const char *snapshotname, const char *filter) {
term *condition;
retvalue r;
......@@ -988,14 +988,14 @@ retvalue restore_by_formula(struct database *database, struct distribution *into
return r;
}
r = restore_from_snapshot(database, into,
component, architecture, packagetype,
components, architectures, packagetypes,
snapshotname, choose_by_condition, condition);
term_free(condition);
return r;
}
retvalue restore_by_glob(struct database *database, struct distribution *into, component_t component, architecture_t architecture, packagetype_t packagetype, const char *snapshotname, const char *glob) {
retvalue restore_by_glob(struct database *database, struct distribution *into, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, const char *snapshotname, const char *glob) {
return restore_from_snapshot(database, into,
component, architecture, packagetype,
components, architectures, packagetypes,
snapshotname, choose_by_glob, (void*)glob);
}
......@@ -5,17 +5,17 @@
#include "strlist.h"
#endif
retvalue copy_by_name(struct database *, struct distribution *into, struct distribution *from, int, const char **, component_t, architecture_t, packagetype_t);
retvalue copy_by_source(struct database *, struct distribution *into, struct distribution *from, int, const char **, component_t, architecture_t, packagetype_t);
retvalue copy_by_formula(struct database *, struct distribution *into, struct distribution *from, const char *formula, component_t, architecture_t, packagetype_t);
retvalue copy_by_glob(struct database *, struct distribution *into, struct distribution *from, const char *glob, component_t, architecture_t, packagetype_t);
retvalue copy_by_name(struct database *, struct distribution *into, struct distribution *from, int, const char **, const struct atomlist *, const struct atomlist *, const struct atomlist *);
retvalue copy_by_source(struct database *, struct distribution *into, struct distribution *from, int, const char **, const struct atomlist *, const struct atomlist *, const struct atomlist *);
retvalue copy_by_formula(struct database *, struct distribution *into, struct distribution *from, const char *formula, const struct atomlist *, const struct atomlist *, const struct atomlist *);
retvalue copy_by_glob(struct database *, struct distribution *into, struct distribution *from, const char *glob, const struct atomlist *, const struct atomlist *, const struct atomlist *);
retvalue copy_from_file(struct database *, struct distribution *into, component_t, architecture_t, packagetype_t, const char *filename, int, const char **);
/* note that snapshotname must live till logger_wait has run */
retvalue restore_by_name(struct database *, struct distribution *, component_t, architecture_t, packagetype_t, const char *snapshotname, int, const char **);
retvalue restore_by_source(struct database *, struct distribution *, component_t, architecture_t, packagetype_t, const char *snapshotname, int, const char **);
retvalue restore_by_formula(struct database *, struct distribution *, component_t, architecture_t, packagetype_t, const char *snapshotname, const char *filter);
retvalue restore_by_glob(struct database *, struct distribution *, component_t, architecture_t, packagetype_t, const char *snapshotname, const char *glob);
retvalue restore_by_name(struct database *, struct distribution *, const struct atomlist *, const struct atomlist *, const struct atomlist *, const char *snapshotname, int, const char **);
retvalue restore_by_source(struct database *, struct distribution *, const struct atomlist *, const struct atomlist *, const struct atomlist *, const char *snapshotname, int, const char **);
retvalue restore_by_formula(struct database *, struct distribution *, const struct atomlist *, const struct atomlist *, const struct atomlist *, const char *snapshotname, const char *filter);
retvalue restore_by_glob(struct database *, struct distribution *, const struct atomlist *, const struct atomlist *, const struct atomlist *, const char *snapshotname, const char *glob);
#endif
/* This file is part of "reprepro"
* Copyright (C) 2003,2004,2005,2006,2007,2008 Bernhard R. Link
* Copyright (C) 2003,2004,2005,2006,2007,2008,2009 Bernhard R. Link
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
......@@ -498,7 +498,7 @@ retvalue distribution_readall(struct distribution **distributions) {
}
/* call <action> for each package */
retvalue distribution_foreach_package(struct distribution *distribution, struct database *database, component_t component, architecture_t architecture, packagetype_t packagetype, each_package_action action, each_target_action target_action, void *data) {
retvalue distribution_foreach_package(struct distribution *distribution, struct database *database, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, each_package_action action, each_target_action target_action, void *data) {
retvalue result,r;
struct target *t;
struct target_cursor iterator IFSTUPIDCC(=TARGET_CURSOR_ZERO);
......@@ -506,7 +506,7 @@ retvalue distribution_foreach_package(struct distribution *distribution, struct
result = RET_NOTHING;
for( t = distribution->targets ; t != NULL ; t = t->next ) {
if( !target_matches(t, component, architecture, packagetype) )
if( !target_matches(t, components, architectures, packagetypes) )
continue;
if( target_action != NULL ) {
r = target_action(database, distribution, t, data);
......@@ -540,13 +540,14 @@ retvalue distribution_foreach_package_c(struct distribution *distribution, struc
const char *package, *control;
struct target_cursor iterator IFSTUPIDCC(=TARGET_CURSOR_ZERO);
assert( components != NULL );
result = RET_NOTHING;
for( t = distribution->targets ; t != NULL ; t = t->next ) {
if( !atomlist_in(components, t->component_atom) )
if( components != NULL &&
!atomlist_in(components, t->component_atom) )
continue;
if( limitation_missed(architecture, t->architecture_atom) )
continue;
if( !target_matches(t, atom_unknown, architecture, packagetype) )
if( limitation_missed(packagetype, t->packagetype_atom) )
continue;
r = target_openiterator(t, database, READONLY, &iterator);
RET_UPDATE(result, r);
......@@ -1078,7 +1079,7 @@ retvalue distribution_prepareforwriting(struct distribution *distribution) {
}
/* delete every package decider returns RET_OK for */
retvalue distribution_remove_packages(struct distribution *distribution, struct database *database, component_t component, architecture_t architecture, packagetype_t packagetype, each_package_action decider, struct trackingdata *trackingdata, void *data) {
retvalue distribution_remove_packages(struct distribution *distribution, struct database *database, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes, each_package_action decider, struct trackingdata *trackingdata, void *data) {
retvalue result,r;
struct target *t;
struct target_cursor iterator;
......@@ -1092,7 +1093,7 @@ retvalue distribution_remove_packages(struct distribution *distribution, struct
result = RET_NOTHING;
for( t = distribution->targets ; t != NULL ; t = t->next ) {
if( !target_matches(t, component, architecture, packagetype) )
if( !target_matches(t, components, architectures, packagetypes) )
continue;
r = target_openiterator(t, database, READWRITE, &iterator);
RET_UPDATE(result, r);
......
......@@ -113,11 +113,11 @@ typedef retvalue each_target_action(struct database *, struct distribution *, st
typedef retvalue each_package_action(struct database *, struct distribution *, struct target *, const char *, const char *, void *);
/* call <action> for each package of <distribution> */
retvalue distribution_foreach_package(struct distribution *, struct database *, component_t, architecture_t, packagetype_t, each_package_action, each_target_action, void *);
retvalue distribution_foreach_package_c(struct distribution *, struct database *, const struct atomlist *components, architecture_t, packagetype_t, each_package_action, void *);
retvalue distribution_foreach_package(struct distribution *, struct database *, /*@null@*/const struct atomlist *, /*@null@*/const struct atomlist *, /*@null@*/const struct atomlist *, each_package_action, /*@null@*/each_target_action, void *);
retvalue distribution_foreach_package_c(struct distribution *, struct database *, /*@null@*/const struct atomlist *, architecture_t, packagetype_t, each_package_action, void *);
/* delete every package decider returns RET_OK for */
retvalue distribution_remove_packages(struct distribution *, struct database *, component_t, architecture_t, packagetype_t, each_package_action decider, struct trackingdata *, void *);
retvalue distribution_remove_packages(struct distribution *, struct database *, const struct atomlist *, const struct atomlist *, const struct atomlist *, each_package_action decider, struct trackingdata *, void *);
/*@dependent@*/struct target *distribution_getpart(const struct distribution *distribution, component_t, architecture_t, packagetype_t);
......
......@@ -150,21 +150,27 @@ Look in \fImethoddir\fP instead of
.B /usr/lib/apt/methods
for methods to call when importing from other repositories.
.TP
.B \-C, \-\-component \fIcomponent\fP
Limit the specified command to this component only.
This will force added packages to this component,
limit removing packages from this component,
only list packages in this component,
and/or otherwise only look at packages in this component,
.B \-C, \-\-component \fIcomponents\fP
Limit the specified command to this components only.
This will force added packages to this components,
limit removing packages from this components,
only list packages in this components,
and/or otherwise only look at packages in this components,
depending on the command in question.
Multiple components are specified by separating them with \fB|\fP,
as in \fB\-C 'main|contrib'\fP.
.TP
.B \-A, \-\-architecture \fIarchitecture\fP
Limit the specified command to this architecture only.
.B \-A, \-\-architecture \fIarchitectures\fP
Limit the specified command to this architectures only.
(i.e. only list such packages,
only remove packages from the specified architecture,
or otherwise only look at/act on this architecture
only remove packages from the specified architectures,
or otherwise only look at/act on this architectures
depending on the specific command).
Multiple architectures are specified by separating them with \fB|\fP,
as in \fB\-A 'sparc|i386'\fP.
Note that architecture \fBall\fP packages can be included to each
architecture but are then handled separately.
Thus using \fB\-A\fP correctly allows to have different versions of
......@@ -172,7 +178,7 @@ an architecture \fBall\fP package in different architectures of the
same distribution.
.TP
.B \-T, \-\-type \fRdsc|deb|udeb
Limit the specified command to this packagetype only.
Limit the specified command to this packagetypes only.
(i.e. only list such packages, only remove such packages, only include
such packages, ...)
.TP
......
......@@ -1606,9 +1606,11 @@ static retvalue candidate_add_into(struct database *database, const struct incom
(tracks==NULL)?NULL:&trackingdata,
p);
} else if( FE_BINARY(p->master->type) ) {
architecture_t a = p->master->architecture_atom;
const struct atomlist architecture = {&a, 1, 1};
r = binaries_adddeb(&p->master->deb, database,
p->master->architecture_atom,
p->packagetype, into,
&architecture, p->packagetype, into,
(tracks==NULL)?NULL:&trackingdata,
p->component_atom, &p->filekeys,
p->control);
......
This diff is collapsed.
......@@ -232,7 +232,7 @@ static retvalue check_source_needs_build(UNUSED(struct database *database), stru
}
retvalue find_needs_build(struct database *database, struct distribution *distribution, architecture_t architecture, component_t onlycomponent, const char *glob) {
retvalue find_needs_build(struct database *database, struct distribution *distribution, architecture_t architecture, const struct atomlist *onlycomponents, const char *glob) {
retvalue result, r;
struct needbuild_data d;
......@@ -259,9 +259,9 @@ retvalue find_needs_build(struct database *database, struct distribution *distri
} else
d.tracks = NULL;
result = distribution_foreach_package(distribution, database,
onlycomponent, architecture_source, pt_dsc,
check_source_needs_build, NULL, &d);
result = distribution_foreach_package_c(distribution, database,
onlycomponents, architecture_source, pt_dsc,
check_source_needs_build, &d);
r = tracking_done(d.tracks);
RET_ENDUPDATE(result, r);
......
......@@ -11,6 +11,6 @@
#include "distribution.h"
#endif
retvalue find_needs_build(struct database *, struct distribution *, architecture_t, component_t onlycomponent, /*@null@*/const char *glob);
retvalue find_needs_build(struct database *, struct distribution *, architecture_t, const struct atomlist *, /*@null@*/const char *glob);
#endif
......@@ -159,12 +159,12 @@ retvalue target_reoverride(struct target *, struct distribution *, struct databa
retvalue package_rerunnotifiers(struct database *, struct distribution *, struct target *, const char *, const char *, void *);
static inline bool target_matches(const struct target *t, component_t component, architecture_t architecture, packagetype_t packagetype) {
if( atom_defined(component) && component != t->component_atom )
static inline bool target_matches(const struct target *t, const struct atomlist *components, const struct atomlist *architectures, const struct atomlist *packagetypes) {
if( limitations_missed(components, t->component_atom) )
return false;
if( atom_defined(architecture) && architecture != t->architecture_atom )
if( limitations_missed(architectures, t->architecture_atom) )
return false;
if( atom_defined(packagetype) && packagetype != t->packagetype_atom )
if( limitations_missed(packagetypes, t->packagetype_atom) )
return false;
return true;
}
......
......@@ -703,9 +703,9 @@ DISTRI=b PACKAGE=ac EPOCH="" VERSION=1 REVISION="-1" SECTION="stupid/base" genpa
testrun - -b . -A ${FAKEARCHITECTURE} --delete --delete --ignore=missingfile include b test.changes 3<<EOF
stderr
-v0=Data seems not to be signed trying to use directly...
-v2*=Skipping 'ac_1-1.dsc' as not for architecture '${FAKEARCHITECTURE}'.
-v2*=Skipping 'ac_1-1.tar.gz' as not for architecture '${FAKEARCHITECTURE}'.
-v3*=Placing 'ac-addons_1-1_all.deb' only in architecture '${FAKEARCHITECTURE}' as requested.
-v2*=Skipping 'ac_1-1.dsc' as architecture 'source' is not in the requested set.
-v2*=Skipping 'ac_1-1.tar.gz' as architecture 'source' is not in the requested set.
-v3*=Limiting 'ac-addons_1-1_all.deb' to architectures ${FAKEARCHITECTURE} as requested.
stdout
-v2*=Created directory "./pool/all/a/ac"
-e1*=db: 'pool/all/a/ac/ac-addons_1-1_all.deb' added to files.db(md5sums).
......