Commit 70388ef3 authored by Bernhard Link's avatar Bernhard Link

renamed target to struct target

parent c28807eb
......@@ -346,7 +346,7 @@ retvalue binaries_findnew(packagesdb pkgs,const char *component,const char *pack
return chunk_foreach(packages_file,processbinary,&mydata,force,0);
}
retvalue binaries_getname(target t,const char *control,char **packagename){
retvalue binaries_getname(struct target *t,const char *control,char **packagename){
retvalue r;
r = chunk_getvalue(control,"Package",packagename);
......@@ -358,7 +358,7 @@ retvalue binaries_getname(target t,const char *control,char **packagename){
}
return r;
}
retvalue binaries_getversion(target t,const char *control,char **version) {
retvalue binaries_getversion(struct target *t,const char *control,char **version) {
retvalue r;
r = chunk_getvalue(control,"Version",version);
......@@ -371,7 +371,7 @@ retvalue binaries_getversion(target t,const char *control,char **version) {
return r;
}
retvalue binaries_getinstalldata(target t,const char *packagename,const char *version,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles) {
retvalue binaries_getinstalldata(struct target *t,const char *packagename,const char *version,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles) {
char *sourcename,*basename;
retvalue r;
......@@ -398,6 +398,6 @@ retvalue binaries_getinstalldata(target t,const char *packagename,const char *ve
return r;
}
retvalue binaries_getfilekeys(target t,const char *name,const char *chunk,struct strlist *filekeys) {
retvalue binaries_getfilekeys(struct target *t,const char *name,const char *chunk,struct strlist *filekeys) {
return binaries_parse_getfilekeys(chunk,filekeys);
}
......@@ -48,9 +48,9 @@ retvalue binaries_findnew(
);
/* Functions for the target.h-stuff: */
retvalue binaries_getname(target t,const char *chunk,char **packagename);
retvalue binaries_getversion(target t,const char *chunk,char **version);
retvalue binaries_getinstalldata(target t,const char *packagename,const char *version,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles);
retvalue binaries_getfilekeys(target t,const char *name,const char *chunk,struct strlist *filekeys);
retvalue binaries_getname(struct target *t,const char *chunk,char **packagename);
retvalue binaries_getversion(struct target *t,const char *chunk,char **version);
retvalue binaries_getinstalldata(struct target *t,const char *packagename,const char *version,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles);
retvalue binaries_getfilekeys(struct target *t,const char *name,const char *chunk,struct strlist *filekeys);
#endif
......@@ -379,13 +379,13 @@ retvalue deb_add(const char *dbdir,DB *references,filesdb filesdb,const char *fo
result = RET_NOTHING;
if( strcmp(pkg->architecture,"all") != 0 ) {
target t = distribution_getpart(distribution,pkg->component,pkg->architecture);
struct target *t = distribution_getpart(distribution,pkg->component,pkg->architecture);
r = target_initpackagesdb(t,dbdir,NULL);
if( !RET_WAS_ERROR(r) )
r = target_addpackage(t,references,NULL,pkg->package,pkg->version,pkg->control,&pkg->filekeys,NULL,force,0);
RET_UPDATE(result,r);
} else for( i = 0 ; i < distribution->architectures.count ; i++ ) {
target t = distribution_getpart(distribution,pkg->component,distribution->architectures.values[i]);
struct target *t = distribution_getpart(distribution,pkg->component,distribution->architectures.values[i]);
r = target_initpackagesdb(t,dbdir,NULL);
if( !RET_WAS_ERROR(r) )
r = target_addpackage(t,references,NULL,pkg->package,pkg->version,pkg->control,&pkg->filekeys,NULL,force,0);
......
......@@ -446,7 +446,7 @@ retvalue dsc_add(const char *dbdir,DB *references,filesdb filesdb,const char *fo
/* finaly put it into the source distribution */
if( !RET_WAS_ERROR(r) ) {
target t = distribution_getpart(distribution,pkg->component,"source");
struct target *t = distribution_getpart(distribution,pkg->component,"source");
r = target_initpackagesdb(t,dbdir,NULL);
if( !RET_WAS_ERROR(r) )
r = target_addpackage(t,references,NULL,pkg->package,pkg->version,pkg->control,&pkg->filekeys,NULL,force,0);
......
......@@ -50,7 +50,7 @@ void distribution_free(struct distribution *distribution) {
strlist_done(&distribution->updates);
while( distribution->targets ) {
target next = distribution->targets->next;
struct target *next = distribution->targets->next;
target_free(distribution->targets);
distribution->targets = next;
......@@ -64,8 +64,8 @@ static retvalue createtargets(struct distribution *distribution) {
retvalue r;
int i,j;
const char *arch,*comp;
target t;
target last = NULL;
struct target *t;
struct target *last = NULL;
for( i = 0 ; i < distribution->components.count ; i++ ) {
comp = distribution->components.values[i];
......@@ -167,7 +167,7 @@ static retvalue distribution_parse_and_filter(struct distribution **distribution
/* call <action> for each part of <distribution>. */
retvalue distribution_foreach_part(const struct distribution *distribution,distribution_each_action action,void *data,int force) {
retvalue result,r;
target t;
struct target *t;
result = RET_NOTHING;
for( t = distribution->targets ; t ; t = t->next ) {
......@@ -179,8 +179,8 @@ retvalue distribution_foreach_part(const struct distribution *distribution,distr
return result;
}
target distribution_getpart(const struct distribution *distribution,const char *component,const char *architecture) {
target t = distribution->targets;
struct target *distribution_getpart(const struct distribution *distribution,const char *component,const char *architecture) {
struct target *t = distribution->targets;
while( t && ( strcmp(t->component,component) != 0 || strcmp(t->architecture,architecture) )) {
t = t->next;
......
......@@ -18,19 +18,19 @@ struct distribution {
char *origin,*label,*description;
struct strlist architectures,components,updates;
/* A list of all targets contained in the distribution*/
target targets;
struct target *targets;
};
retvalue distribution_get(struct distribution **distribution,const char *conf,const char *name);
void distribution_free(struct distribution *distribution);
typedef retvalue distribution_each_action(void *data, const target t);
typedef retvalue distribution_each_action(void *data, struct target *t);
/* call <action> for each part of <distribution>. */
retvalue distribution_foreach_part(const struct distribution *distribution,distribution_each_action action,void *data,int force);
target distribution_getpart(const struct distribution *distribution,const char *component,const char *architecture);
struct target *distribution_getpart(const struct distribution *distribution,const char *component,const char *architecture);
typedef retvalue distributionaction(void *data,const char *chunk,const struct distribution *distribution);
......
......@@ -688,7 +688,7 @@ static int checkrelease(int argc,char *argv[]) {
struct data_export { const struct distribution *distribution;int force;};
static retvalue exportbinsrc(void *data,const target target) {
static retvalue exportbinsrc(void *data,struct target *target) {
retvalue result,r;
struct data_export *d = data;
......@@ -795,7 +795,7 @@ static int upgrade(int argc,char *argv[]) {
retvalue result,r;
upgradelist upgrade;
filesdb files;
target target;
struct target *target;
if( argc <=1 ) {
fprintf(stderr,"mirrorer upgrade [<distributions>]\n");
......@@ -837,7 +837,7 @@ static int upgrade(int argc,char *argv[]) {
/***********************rereferencing*************************/
struct data_binsrcreref { const struct distribution *distribution; DB *references;};
static retvalue reref(void *data,const target target) {
static retvalue reref(void *data,struct target *target) {
retvalue result;
struct data_binsrcreref *d = data;
......@@ -887,7 +887,7 @@ static int rereference(int argc,char *argv[]) {
/***********************checking*************************/
struct data_check { const struct distribution *distribution; DB *references; filesdb files;};
static retvalue check_target(void *data,const target target) {
static retvalue check_target(void *data,struct target *target) {
struct data_check *d = data;
retvalue r;
......
......@@ -188,7 +188,7 @@ retvalue release_checkfile(const char *releasefile,const char *nametocheck,const
}
/* Generate a "Release"-file for arbitrary directory */
retvalue release_genrelease(const struct distribution *distribution,const target target,const char *distdir) {
retvalue release_genrelease(const struct distribution *distribution,const struct target *target,const char *distdir) {
FILE *f;
char *filename;
int e;
......@@ -228,7 +228,7 @@ retvalue release_genrelease(const struct distribution *distribution,const target
struct genrel { FILE *f; const char *distdir; int force; };
static retvalue printmd5(void *data,const target target) {
static retvalue printmd5(void *data,struct target *target) {
struct genrel *d = data;
return target_printmd5sums(target,d->distdir,d->f,d->force);
......
......@@ -33,7 +33,7 @@ retvalue release_checkfile(const char *releasefile,const char *nametocheck,const
/****** Generate release-files *************/
/* Generate a "Release"-file for an arbitrary directory */
retvalue release_genrelease(const struct distribution *distribution,const target target,const char *distdir);
retvalue release_genrelease(const struct distribution *distribution,const struct target *target,const char *distdir);
/* Generate a main "Release" file for a distribution */
retvalue release_gen(const struct distribution *distribution,const char *distdir,const char *chunk,int force);
......
......@@ -502,7 +502,7 @@ retvalue sources_calcfilelines(const struct strlist *basenames,const struct strl
return RET_OK;
}
retvalue sources_getname(target t,const char *control,char **packagename){
retvalue sources_getname(struct target *t,const char *control,char **packagename){
retvalue r;
r = chunk_getvalue(control,"Package",packagename);
......@@ -514,7 +514,7 @@ retvalue sources_getname(target t,const char *control,char **packagename){
}
return r;
}
retvalue sources_getversion(target t,const char *control,char **version) {
retvalue sources_getversion(struct target *t,const char *control,char **version) {
retvalue r;
r = chunk_getvalue(control,"Version",version);
......@@ -527,7 +527,7 @@ retvalue sources_getversion(target t,const char *control,char **version) {
return r;
}
retvalue sources_getinstalldata(target t,const char *packagename,const char *version,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles) {
retvalue sources_getinstalldata(struct target *t,const char *packagename,const char *version,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles) {
retvalue r;
char *origdirectory;
struct strlist filelines,basenames;
......@@ -562,6 +562,6 @@ retvalue sources_getinstalldata(target t,const char *packagename,const char *ver
return r;
}
retvalue sources_getfilekeys(target t,const char *name,const char *chunk,struct strlist *filekeys) {
retvalue sources_getfilekeys(struct target *t,const char *name,const char *chunk,struct strlist *filekeys) {
return sources_parse_getfilekeys(chunk,filekeys);
}
......@@ -37,8 +37,8 @@ retvalue sources_findnew(packagesdb pkgs,const char *component,const char *sourc
retvalue sources_calcfilelines(const struct strlist *basenames,const struct strlist *md5sums,char **item);
/* Functions for the target.h-stuff: */
retvalue sources_getname(target t,const char *chunk,char **packagename);
retvalue sources_getversion(target ,const char *chunk,char **version);
retvalue sources_getinstalldata(target t,const char *packagename,const char *version,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles);
retvalue sources_getfilekeys(target t,const char *name,const char *chunk,struct strlist *filekeys);
retvalue sources_getname(struct target * t,const char *chunk,char **packagename);
retvalue sources_getversion(struct target *t,const char *chunk,char **version);
retvalue sources_getinstalldata(struct target *t,const char *packagename,const char *version,const char *chunk,char **control,struct strlist *filekeys,struct strlist *md5sums,struct strlist *origfiles);
retvalue sources_getfilekeys(struct target *t,const char *name,const char *chunk,struct strlist *filekeys);
#endif
......@@ -41,15 +41,15 @@ extern int verbose;
static retvalue target_initialize(
const char *codename,const char *component,const char *architecture,
get_name getname,get_version getversion,get_installdata getinstalldata,
get_filekeys getfilekeys, char *directory, const char *indexfile, int unc , target *d) {
get_filekeys getfilekeys, char *directory, const char *indexfile, int unc ,struct target **d) {
target t;
struct target *t;
assert(indexfile);
if( directory == NULL )
return RET_ERROR_OOM;
t = calloc(1,sizeof(struct s_target));
t = calloc(1,sizeof(struct target));
if( t == NULL ) {
free(directory);
return RET_ERROR_OOM;
......@@ -76,16 +76,16 @@ static retvalue target_initialize(
return RET_OK;
}
retvalue target_initialize_binary(const char *codename,const char *component,const char *architecture,target *target) {
retvalue target_initialize_binary(const char *codename,const char *component,const char *architecture,struct target **target) {
return target_initialize(codename,component,architecture,binaries_getname,binaries_getversion,binaries_getinstalldata,binaries_getfilekeys,mprintf("%s/%s/binary-%s",codename,component,architecture),"Packages",1,target);
}
retvalue target_initialize_source(const char *codename,const char *component,target *target) {
retvalue target_initialize_source(const char *codename,const char *component,struct target **target) {
return target_initialize(codename,component,"source",sources_getname,sources_getversion,sources_getinstalldata,sources_getfilekeys,mprintf("%s/%s/source",codename,component),"Sources",0,target);
}
void target_free(target target) {
void target_free(struct target *target) {
if( target == NULL )
return;
free(target->codename);
......@@ -97,7 +97,7 @@ void target_free(target target) {
}
/* This opens up the database, if db != NULL, *db will be set to it.. */
retvalue target_initpackagesdb(target target, const char *dbdir, packagesdb *db) {
retvalue target_initpackagesdb(struct target *target, const char *dbdir, packagesdb *db) {
retvalue r;
if( target->packages != NULL )
......@@ -114,7 +114,7 @@ retvalue target_initpackagesdb(target target, const char *dbdir, packagesdb *db)
return r;
}
retvalue target_addpackage(target target,DB *references,filesdb files,const char *name,const char *version,const char *control,const struct strlist *filekeys,const struct strlist *md5sums,int force,int downgrade) {
retvalue target_addpackage(struct target *target,DB *references,filesdb files,const char *name,const char *version,const char *control,const struct strlist *filekeys,const struct strlist *md5sums,int force,int downgrade) {
struct strlist oldfilekeys,*ofk;
char *oldcontrol;
retvalue r;
......@@ -183,7 +183,7 @@ retvalue target_addpackage(target target,DB *references,filesdb files,const char
/* rereference a full database */
struct data_reref {
DB *referencesdb;
target target;
struct target *target;
};
static retvalue rereferencepkg(void *data,const char *package,const char *chunk) {
......@@ -204,7 +204,7 @@ static retvalue rereferencepkg(void *data,const char *package,const char *chunk)
return r;
}
retvalue target_rereference(target target,DB *referencesdb,int force) {
retvalue target_rereference(struct target *target,DB *referencesdb,int force) {
retvalue result,r;
struct data_reref refdata;
......@@ -234,7 +234,7 @@ retvalue target_rereference(target target,DB *referencesdb,int force) {
struct data_check {
DB *referencesdb;
filesdb filesdb;
target target;
struct target *target;
};
static retvalue checkpkg(void *data,const char *package,const char *chunk) {
......@@ -256,7 +256,7 @@ static retvalue checkpkg(void *data,const char *package,const char *chunk) {
return r;
}
retvalue target_check(target target,filesdb filesdb,DB *referencesdb,int force) {
retvalue target_check(struct target *target,filesdb filesdb,DB *referencesdb,int force) {
struct data_check data;
assert(target->packages);
......@@ -269,7 +269,7 @@ retvalue target_check(target target,filesdb filesdb,DB *referencesdb,int force)
return packages_foreach(target->packages,checkpkg,&data,force);
}
/* export a database */
retvalue target_export(target target,const char *distdir,int force) {
retvalue target_export(struct target *target,const char *distdir,int force) {
indexcompression compression;
retvalue result,r;
......@@ -294,7 +294,8 @@ retvalue target_export(target target,const char *distdir,int force) {
return result;
}
static inline retvalue printfilemd5(target target,const char *distdir,FILE *out,
static inline retvalue printfilemd5(const struct target *target,
const char *distdir,FILE *out,
const char *filename,indexcompression compression) {
char *fn,*md;
const char *fn2;
......@@ -320,7 +321,7 @@ static inline retvalue printfilemd5(target target,const char *distdir,FILE *out,
return r;
}
retvalue target_printmd5sums(target target,const char *distdir,FILE *out,int force) {
retvalue target_printmd5sums(const struct target *target,const char *distdir,FILE *out,int force) {
indexcompression compression;
retvalue result,r;
......
......@@ -11,14 +11,14 @@
#include "packages.h"
#endif
typedef struct s_target *target;
struct target;
typedef retvalue get_name(target,const char *,char **);
typedef retvalue get_version(target,const char *,char **);
typedef retvalue get_installdata(target,const char *,const char *,const char *,char **,struct strlist *,struct strlist *,struct strlist *);
typedef retvalue get_filekeys(target,const char *,const char *,struct strlist *);
typedef retvalue get_name(struct target *,const char *,char **);
typedef retvalue get_version(struct target *,const char *,char **);
typedef retvalue get_installdata(struct target *,const char *,const char *,const char *,char **,struct strlist *,struct strlist *,struct strlist *);
typedef retvalue get_filekeys(struct target *,const char *,const char *,struct strlist *);
struct s_target {
struct target {
char *codename;
char *component;
char *architecture;
......@@ -31,26 +31,26 @@ struct s_target {
get_installdata *getinstalldata;
get_filekeys *getfilekeys;
/* the next one in the list of targets of a distribution */
struct s_target *next;
struct target *next;
/* is initialized as soon as needed: */
packagesdb packages;
};
retvalue target_initialize_binary(const char *codename,const char *component,const char *architecture,target *target);
retvalue target_initialize_source(const char *codename,const char *component,target *target);
void target_free(target target);
retvalue target_initialize_binary(const char *codename,const char *component,const char *architecture,struct target **target);
retvalue target_initialize_source(const char *codename,const char *component,struct target **target);
void target_free(struct target *target);
retvalue target_printmd5sums(target target,const char *distdir,FILE *out,int force);
retvalue target_printmd5sums(const struct target *target,const char *distdir,FILE *out,int force);
/* This opens up the database, if db != NULL, *db will be set to it.. */
retvalue target_initpackagesdb(target target, const char *dbdir, packagesdb *db);
retvalue target_initpackagesdb(struct target *target, const char *dbdir, packagesdb *db);
/* The following calls can only be called if target_initpackagesdb was called before: */
retvalue target_addpackage(target target,DB *references,filesdb files,const char *name,const char *version,const char *control,const struct strlist *filekeys,const struct strlist *md5sums,int force,int downgrade);
retvalue target_export(target target,const char *distdir, int force);
retvalue target_check(target target,filesdb filesdb,DB *referencesdb,int force);
retvalue target_rereference(target target,DB *referencesdb,int force);
retvalue target_addpackage(struct target *target,DB *references,filesdb files,const char *name,const char *version,const char *control,const struct strlist *filekeys,const struct strlist *md5sums,int force,int downgrade);
retvalue target_export(struct target *target,const char *distdir, int force);
retvalue target_check(struct target *target,filesdb filesdb,DB *referencesdb,int force);
retvalue target_rereference(struct target *target,DB *referencesdb,int force);
#endif
......@@ -58,7 +58,7 @@ typedef struct s_package_data {
struct s_upgradelist {
upgrade_decide_function *decide;
target target;
struct target *target;
package_data *list;
/* NULL or the last/next thing to test in alphabetical order */
package_data *current,*last;
......@@ -126,7 +126,7 @@ static retvalue save_package_version(void *d,const char *packagename,const char
}
retvalue upgradelist_initialize(upgradelist *ul,target t,const char *dbdir,upgrade_decide_function *decide) {
retvalue upgradelist_initialize(upgradelist *ul,struct target *t,const char *dbdir,upgrade_decide_function *decide) {
upgradelist upgrade;
packagesdb packages;
retvalue r;
......
......@@ -20,7 +20,7 @@ upgrade_decision ud_always(const char *p,const char *ov,const char *nv);
typedef struct s_upgradelist *upgradelist;
retvalue upgradelist_initialize(upgradelist *ul,target target,const char *dbdir,upgrade_decide_function *decide);
retvalue upgradelist_initialize(upgradelist *ul,struct target *target,const char *dbdir,upgrade_decide_function *decide);
retvalue upgradelist_done(upgradelist upgrade);
retvalue upgradelist_dump(upgradelist upgrade);
......
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