Commit 69c2083e authored by Bernhard Link's avatar Bernhard Link

Changes parsing of conf/distributions to make some fields optional and tell...

Changes parsing of conf/distributions to make some fields optional and tell about missing required fields
parent 6134e19d
2004-12-19 Bernhard R. Link <brlink@debian.org>
* change parsing of conf/distributions, the fields only
copied to Release files can be omitted now. Additional
it warns if required fields are missing intead of
silently ignoring this block...
2004-12-18 Bernhard R. Link <brlink@debian.org>
* remove now tells which packages were removed (with -v)
......
......@@ -746,7 +746,8 @@ retvalue changes_add(const char *dbdir,DB *references,filesdb filesdb,const char
// changes_free(changes);
// return RET_ERROR;
// }
if( !strlist_in(&changes->distributions,distribution->suite) &&
if( (distribution->suite == NULL ||
!strlist_in(&changes->distributions,distribution->suite)) &&
!strlist_in(&changes->distributions,distribution->codename) ) {
fprintf(stderr,"Warning: .changes put in a distribution not listed within it!\n");
}
......
/* This file is part of "reprepro"
* Copyright (C) 2003 Bernhard R. Link
* Copyright (C) 2003,2004 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 as published by
* the Free Software Foundation; either version 2 of the License, or
......@@ -137,51 +137,52 @@ static retvalue distribution_parse(struct distribution **distribution,const char
if( !r )
return RET_ERROR_OOM;
#define checkret if(!RET_IS_OK(ret)) { \
(void)distribution_free(r); \
return ret; \
}
// TODO: give some message here instead of silently ignoring,
// and/or make some fields optional (like Version)
#define fieldrequired(name) if( ret == RET_NOTHING ) { fputs("While parsing distribution definition, required field " name " not found!\n",stderr); ret = RET_ERROR_MISSING; }
ret = chunk_getvalue(chunk,"Codename",&r->codename);
checkret;
ret = chunk_getvalue(chunk,"Suite",&r->suite);
checkret;
ret = chunk_getvalue(chunk,"Version",&r->version);
checkret;
ret = chunk_getvalue(chunk,"Origin",&r->origin);
checkret;
ret = chunk_getvalue(chunk,"Label",&r->label);
checkret;
ret = chunk_getvalue(chunk,"Description",&r->description);
checkret;
ret = chunk_getwordlist(chunk,"Architectures",&r->architectures);
checkret;
ret = chunk_getwordlist(chunk,"Components",&r->components);
checkret;
ret = chunk_getwordlist(chunk,"Update",&r->updates);
fieldrequired("Codename");
if( RET_WAS_ERROR(ret) ) {
(void)distribution_free(r);
return ret;
}
ret = chunk_getvalue(chunk,"SignWith",&r->signwith);
#define nullifnone(a) if(RET_WAS_ERROR(ret)) { \
(void)distribution_free(r); \
return ret; \
} else r->a = NULL;
#define getpossibleemptyfield(key,fieldname) \
ret = chunk_getvalue(chunk,key,&r->fieldname); \
if(RET_WAS_ERROR(ret)) { \
(void)distribution_free(r); \
return ret; \
} else if( ret == RET_NOTHING) \
r->fieldname = NULL;
getpossibleemptyfield("Suite",suite);
getpossibleemptyfield("Version",version);
getpossibleemptyfield("Origin",origin);
getpossibleemptyfield("Label",label);
getpossibleemptyfield("Description",description);
ret = chunk_getwordlist(chunk,"Architectures",&r->architectures);
fieldrequired("Architectures");
if( RET_WAS_ERROR(ret) ) {
(void)distribution_free(r);
return ret;
} else if( ret == RET_NOTHING )
r->signwith = NULL;
ret = chunk_getvalue(chunk,"Override",&r->override);
}
ret = chunk_getwordlist(chunk,"Components",&r->components);
fieldrequired("Components");
if( RET_WAS_ERROR(ret) ) {
(void)distribution_free(r);
return ret;
} else if( ret == RET_NOTHING )
r->override = NULL;
ret = chunk_getvalue(chunk,"SourceOverride",&r->srcoverride);
}
ret = chunk_getwordlist(chunk,"Update",&r->updates);
if( RET_WAS_ERROR(ret) ) {
(void)distribution_free(r);
return ret;
} else if( ret == RET_NOTHING )
r->srcoverride = NULL;
}
getpossibleemptyfield("SignWith",signwith);
getpossibleemptyfield("Override",override);
getpossibleemptyfield("SourceOverride",srcoverride);
ret = chunk_getwordlist(chunk,"UDebComponents",&r->udebcomponents);
if( RET_WAS_ERROR(ret) ) {
(void)distribution_free(r);
......@@ -189,10 +190,16 @@ static retvalue distribution_parse(struct distribution **distribution,const char
}
ret = createtargets(r);
checkret;
if( RET_WAS_ERROR(ret) ) {
(void)distribution_free(r);
return ret;
}
*distribution = r;
return RET_OK;
#undef fieldrequired
#undef getpossibleemptyfield
}
struct distribution_filter {int count; const char **dists; };
......
......@@ -14,9 +14,17 @@
struct distribution {
struct distribution *next;
char *codename,*suite,*version;
/* the primary name to access this distribution: */
char *codename;
/* additional information for the Release-file to be
* generated, may be NULL. only suite is sometimes used
* (and only for sanity checks) */
char *suite,*version;
char *origin,*label,*description;
struct strlist architectures,components,updates;
/* What architectures and components are there */
struct strlist architectures,components;
/* which update rules to use */
struct strlist updates;
/* the key to sign with, may be NULL: */
char *signwith;
/* the override file to use by default */
......
......@@ -235,30 +235,30 @@ and used as directory name within
It is also copied into the Release files.
.TP
.B Suite
This required field is simply copied into the
This optional field is simply copied into the
Release files. In Debian it contains names like
stable, testing or unstable. It is not used otherwise
currently, there are no symlinks created. (though that
might change in the future)
.TP
.B Version
This required field is simply copied into the
This optional field is simply copied into the
Release files.
.TP
.B Origin
This required field is simply copied into the
This optional field is simply copied into the
Release files.
.TP
.B Label
This required field is simply copied into the
This optional field is simply copied into the
Release files.
.TP
.B Description
This required field is simply copied into the
This optional field is simply copied into the
Release files.
.TP
.B Architectures
This requiered field lists the binary architectures within
This required field lists the binary architectures within
this distribution.
.TP
.B Components
......
/* This file is part of "reprepro"
* Copyright (C) 2003 Bernhard R. Link
* Copyright (C) 2003,2004 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 as published by
* the Free Software Foundation; either version 2 of the License, or
......@@ -133,16 +133,18 @@ retvalue release_genrelease(const struct distribution *distribution,const struct
}
free(filename);
fprintf(f, "Archive: %s\n"
"Version: %s\n"
"Component: %s\n"
"Origin: %s\n"
"Label: %s\n"
"Architecture: %s\n"
"Description: %s\n",
distribution->suite,distribution->version,target->component,
distribution->origin,distribution->label,target->architecture,
distribution->description);
if( distribution->suite != NULL )
fprintf(f, "Archive: %s\n",distribution->suite);
if( distribution->version != NULL )
fprintf(f, "Version: %s\n",distribution->version);
fprintf(f, "Component: %s\n",target->component);
if( distribution->origin != NULL )
fprintf(f, "Origin: %s\n",distribution->origin);
if( distribution->label != NULL )
fprintf(f, "Label: %s\n",distribution->label);
fprintf(f, "Architecture: %s\n",target->architecture);
if( distribution->description != NULL )
fprintf(f, "Description: %s\n",distribution->description);
if( fclose(f) != 0 )
return RET_ERRNO(errno);
......@@ -202,22 +204,24 @@ retvalue release_gen(const struct distribution *distribution,const char *distdir
return RET_ERRNO(e);
}
fprintf(f,
"Origin: %s\n"
"Label: %s\n"
"Suite: %s\n"
"Codename: %s\n"
"Version: %s\n"
"Date: %s\n"
"Architectures: ",
distribution->origin, distribution->label, distribution->suite,
distribution->codename, distribution->version, buffer);
if( distribution->origin != NULL )
fprintf(f,"Origin: %s\n", distribution->origin);
if( distribution->label != NULL )
fprintf(f,"Label: %s\n", distribution->label);
if( distribution->suite != NULL )
fprintf(f,"Suite: %s\n", distribution->suite);
fprintf(f,"Codename: %s\n", distribution->codename);
if( distribution->version != NULL )
fprintf(f,"Version: %s\n", distribution->version);
fprintf(f,"Date: %s\n",buffer);
fprintf(f,"Architectures: ");
strlist_fprint(f,&distribution->architectures);
fprintf(f, "\nComponents: ");
fprintf(f,"\nComponents: ");
strlist_fprint(f,&distribution->components);
fprintf(f, "\nDescription: %s\n"
"MD5Sum:\n",
distribution->description);
fprintf(f,"\n);
if( distribution->description != NULL )
fprintf(f,Description: %s\n", distribution->description);
fprintf(f,"MD5Sum:\n");
/* generate bin/source-Release-files and add md5sums */
......
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