Commit 2492b0c4 authored by Bernhard Link's avatar Bernhard Link

add strlist_intersects, AlsoAcceptFor in distributions

parent 7719f674
2007-01-12 Bernhard R. Link <brlink@debian.org>
* add AlsoAcceptFor for distributions
2007-01-06 Bernhard R. Link <brlink@debian.org>
* incoming fixups and more testcases
* omit some warnings about versions not starting
......
......@@ -842,7 +842,9 @@ retvalue changes_add(const char *dbdir,trackingdb const tracks,references refs,f
if( (distribution->suite == NULL ||
!strlist_in(&changes->distributions,distribution->suite)) &&
!strlist_in(&changes->distributions,distribution->codename) ) {
!strlist_in(&changes->distributions,distribution->codename) &&
!strlist_intersects(&changes->distributions,
&distribution->alsoaccept) ) {
if( !IGNORING("Ignoring","To ignore",wrongdistribution,".changes put in a distribution not listed within it!\n") ) {
changes_free(changes);
return RET_ERROR;
......
......@@ -64,6 +64,7 @@ retvalue distribution_free(struct distribution *distribution) {
strlist_done(&distribution->components);
strlist_done(&distribution->updates);
strlist_done(&distribution->pulls);
strlist_done(&distribution->alsoaccept);
exportmode_done(&distribution->dsc);
exportmode_done(&distribution->deb);
exportmode_done(&distribution->udeb);
......@@ -199,7 +200,7 @@ static const char * const allowedfields[] = {
"UDebComponents", "DebIndices", "DscIndices", "UDebIndices",
"Pull", "Contents", "ContentsArchitectures",
"ContentsComponents", "ContentsUComponents",
"Uploaders",
"Uploaders", "AlsoAcceptFor",
NULL};
assert( chunk !=NULL && distribution != NULL );
......@@ -346,6 +347,12 @@ NULL};
return ret;
}
ret = chunk_getuniqwordlist(chunk, "AlsoAcceptFor", &r->alsoaccept);
if( RET_WAS_ERROR(ret) ) {
(void)distribution_free(r);
return ret;
}
ret = contentsoptions_parse(r, chunk);
if( RET_WAS_ERROR(ret) ) {
(void)distribution_free(r);
......@@ -708,6 +715,18 @@ struct distribution *distribution_find(struct distribution *distributions, const
if( d != NULL )
return d;
d = distributions;
while( d != NULL && !strlist_in(&d->alsoaccept, name) )
d = d->next;
r = d;
if( r != NULL ) {
while( d != NULL && ! strlist_in(&d->alsoaccept, name) )
d = d->next;
if( d == NULL )
return r;
fprintf(stderr, "No distribution has codename '%s' and multiple have it in AlsoAcceptFor!\n", name);
return NULL;
}
d = distributions;
while( d != NULL && ( d->suite == NULL || strcmp(d->suite, name) != 0 ))
d = d->next;
r = d;
......
......@@ -65,6 +65,9 @@ struct distribution {
/*@null@*/char *uploaders;
/* only loaded after _loaduploaders */
/*@null@*/struct uploaders *uploaderslist;
/* a list of names beside Codename and Suite to accept .changes
* files via include */
struct strlist alsoaccept;
/* RET_NOTHING: do not export with EXPORT_CHANGED, EXPORT_NEVER
* RET_OK: export unless EXPORT_NEVER
* RET_ERROR_*: only export with EXPORT_FORCE */
......
......@@ -259,3 +259,12 @@ retvalue strlist_adduniq(struct strlist *strlist,char *element) {
return strlist_add(strlist,element);
}
bool_t strlist_intersects(const struct strlist *a,const struct strlist *b) {
size_t i;
for( i = 0 ; i < a->count ; i++ )
if( strlist_in(b, a->values[i]) )
return TRUE;
return FALSE;
}
......@@ -42,6 +42,7 @@ retvalue strlist_mvadd(struct strlist *dest,struct strlist *orig);
bool_t strlist_in(const struct strlist *strlist,const char *element);
int strlist_ofs(const struct strlist *strlist,const char *element);
bool_t strlist_intersects(const struct strlist *,const struct strlist *);
/* if missing != NULL And subset no subset of strlist, set *missing to the first missing one */
bool_t strlist_subset(const struct strlist *strlist,const struct strlist *subset,const char **missing);
......
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