Commit 92cad117 authored by Bernhard Link's avatar Bernhard Link

Encapsulated files.c a bit more

parent 863c213d
......@@ -547,7 +547,7 @@ static retvalue changes_check(const char *filename,struct changes *changes,int f
return r;
}
static retvalue changes_includefiles(const char *mirrordir,DB *filesdb,const char *component,const char *filename,struct changes *changes,int force) {
static retvalue changes_includefiles(filesdb filesdb,const char *component,const char *filename,struct changes *changes,int force) {
struct fileentry *e;
retvalue r;
char *sourcedir;
......@@ -566,7 +566,7 @@ static retvalue changes_includefiles(const char *mirrordir,DB *filesdb,const cha
free(sourcedir);
return RET_ERROR_OOM;
}
r = files_checkinfile(mirrordir,filesdb,sourcedir,e->basename,e->filekey,e->md5andsize);
r = files_checkinfile(filesdb,sourcedir,e->basename,e->filekey,e->md5andsize);
if( RET_WAS_ERROR(r) )
break;
e = e->next;
......@@ -576,7 +576,7 @@ static retvalue changes_includefiles(const char *mirrordir,DB *filesdb,const cha
return r;
}
static retvalue changes_includepkgs(const char *dbdir,DB *references,DB *filesdb,const char *mirrordir,struct distribution *distribution,struct changes *changes,int force) {
static retvalue changes_includepkgs(const char *dbdir,DB *references,filesdb filesdb,struct distribution *distribution,struct changes *changes,int force) {
struct fileentry *e;
retvalue r;
......@@ -589,19 +589,19 @@ static retvalue changes_includepkgs(const char *dbdir,DB *references,DB *filesdb
e = e->next;
continue;
}
fullfilename = calc_dirconcat(mirrordir,e->filekey);
fullfilename = calc_dirconcat(filesdb->mirrordir,e->filekey);
if( fullfilename == NULL )
return RET_ERROR_OOM;
// TODO: give directory and filekey, too, so that they
// do not have to be calculated again. (and the md5sums fit)
if( e->type == fe_DEB ) {
r = deb_add(dbdir,references,filesdb,mirrordir,
r = deb_add(dbdir,references,filesdb,
changes->component,e->section,e->priority,
distribution,fullfilename,
e->filekey,e->md5andsize,
force);
} else if( e->type == fe_DSC ) {
r = dsc_add(dbdir,references,filesdb,mirrordir,
r = dsc_add(dbdir,references,filesdb,
changes->component,e->section,e->priority,
distribution,fullfilename,
e->filekey,e->basename,
......@@ -621,7 +621,7 @@ static retvalue changes_includepkgs(const char *dbdir,DB *references,DB *filesdb
/* insert the given .changes into the mirror in the <distribution>
* if forcecomponent, forcesection or forcepriority is NULL
* get it from the files or try to guess it. */
retvalue changes_add(const char *dbdir,DB *references,DB *filesdb,const char *mirrordir,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *changesfilename,int force) {
retvalue changes_add(const char *dbdir,DB *references,filesdb filesdb,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *changesfilename,int force) {
retvalue r;
struct changes *changes;
......@@ -651,14 +651,14 @@ retvalue changes_add(const char *dbdir,DB *references,DB *filesdb,const char *mi
}
/* add files in the pool */
r = changes_includefiles(mirrordir,filesdb,changes->component,changesfilename,changes,force);
r = changes_includefiles(filesdb,changes->component,changesfilename,changes,force);
if( RET_WAS_ERROR(r) ) {
changes_free(changes);
return r;
}
/* add the source and binary packages in the given distribution */
r = changes_includepkgs(dbdir,references,filesdb,mirrordir,
r = changes_includepkgs(dbdir,references,filesdb,
distribution,changes,force);
if( RET_WAS_ERROR(r) ) {
changes_free(changes);
......
......@@ -12,7 +12,7 @@
/* insert the given .changes into the mirror in the <distribution>
* if forcecomponent, forcesection or forcepriority is NULL
* get it from the files or try to guess it. */
retvalue changes_add(const char *dbdir,DB *references,DB *filesdb,const char *mirrordir,const char *forcecomponent,const char *forcedsection,const char *forcepriority,struct distribution *distribution,const char *changesfilename,int force);
retvalue changes_add(const char *dbdir,DB *references,filesdb filesdb,const char *forcecomponent,const char *forcedsection,const char *forcepriority,struct distribution *distribution,const char *changesfilename,int force);
#endif
......@@ -259,14 +259,14 @@ static retvalue deb_calclocations(struct debpackage *pkg,const char *givenfileke
return r;
}
static retvalue deb_copyfiles(const char *mirrordir,DB *filesdb,struct debpackage *pkg,const char *debfilename) {
static retvalue deb_copyfiles(filesdb filesdb,struct debpackage *pkg,const char *debfilename) {
retvalue r;
r = files_checkin(mirrordir,filesdb,pkg->filekey,debfilename,&pkg->md5sum);
r = files_checkin(filesdb,pkg->filekey,debfilename,&pkg->md5sum);
return r;
}
static retvalue deb_checkfiles(const char *mirrordir,DB *filesdb,struct debpackage *pkg,const char *md5sum) {
static retvalue deb_checkfiles(filesdb filesdb,struct debpackage *pkg,const char *md5sum) {
/* Not much to do here, as anything should already be done... */
pkg->md5sum = strdup(md5sum);
......@@ -280,7 +280,7 @@ static retvalue deb_checkfiles(const char *mirrordir,DB *filesdb,struct debpacka
* causing error, if it is not one of them otherwise)
* if component is NULL, guessing it from the section. */
retvalue deb_add(const char *dbdir,DB *references,DB *filesdb,const char *mirrordir,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *debfilename,const char *givenfilekey,const char *givenmd5sum,int force){
retvalue deb_add(const char *dbdir,DB *references,filesdb filesdb,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *debfilename,const char *givenfilekey,const char *givenmd5sum,int force){
retvalue r,result;
struct debpackage *pkg;
int i;
......@@ -360,9 +360,9 @@ retvalue deb_add(const char *dbdir,DB *references,DB *filesdb,const char *mirror
/* then looking if we already have this, or copy it in */
if( givenfilekey && givenmd5sum )
r = deb_checkfiles(mirrordir,filesdb,pkg,givenmd5sum);
r = deb_checkfiles(filesdb,pkg,givenmd5sum);
else
r = deb_copyfiles(mirrordir,filesdb,pkg,debfilename);
r = deb_copyfiles(filesdb,pkg,debfilename);
if( RET_WAS_ERROR(r) ) {
deb_free(pkg);
return r;
......
......@@ -8,10 +8,13 @@
#ifndef __MIRRORER_DISTRIBUTION_H
#include "distribution.h"
#endif
#ifndef __MIRRORER_FILES_H
#include "files.h"
#endif
/* insert the given .deb into the mirror in <component> in the <distribution>
* putting things with architecture of "all" into <architectures> (and also
* causing error, if it is not one of them otherwise)
* ([todo:]using overwrite-database <overwrite>)*/
retvalue deb_add(const char *dbdir,DB *references,DB *filesdb,const char *mirrordir,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *debfilename,const char *givenfilekey,const char *givenmd5sum,int force);
retvalue deb_add(const char *dbdir,DB *references,filesdb filesdb,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *debfilename,const char *givenfilekey,const char *givenmd5sum,int force);
#endif
......@@ -327,12 +327,12 @@ static retvalue dsc_complete(struct dscpackage *pkg) {
/* Get the files from the directory dscfilename is residing it, and copy
* them into the pool, also setting pkg->dscmd5sum */
static retvalue dsc_copyfiles(const char *mirrordir,DB *filesdb,
static retvalue dsc_copyfiles(filesdb filesdb,
struct dscpackage *pkg,const char *dscfilename) {
char *sourcedir;
retvalue r;
r = files_checkin(mirrordir,filesdb,pkg->dscfilekey,dscfilename,&pkg->dscmd5sum);
r = files_checkin(filesdb,pkg->dscfilekey,dscfilename,&pkg->dscmd5sum);
if( RET_WAS_ERROR(r) )
return r;
......@@ -340,7 +340,7 @@ static retvalue dsc_copyfiles(const char *mirrordir,DB *filesdb,
if( RET_WAS_ERROR(r) )
return r;
r = files_checkinfiles(mirrordir,filesdb,sourcedir,&pkg->basenames,&pkg->filekeys,&pkg->md5sums);
r = files_checkinfiles(filesdb,sourcedir,&pkg->basenames,&pkg->filekeys,&pkg->md5sums);
free(sourcedir);
......@@ -348,7 +348,7 @@ static retvalue dsc_copyfiles(const char *mirrordir,DB *filesdb,
}
/* Check the files needed and set the required fields */
static retvalue dsc_checkfiles(const char *mirrordir,DB *filesdb,
static retvalue dsc_checkfiles(filesdb filesdb,
struct dscpackage *pkg,const char *dscmd5sum) {
retvalue r;
......@@ -358,7 +358,7 @@ static retvalue dsc_checkfiles(const char *mirrordir,DB *filesdb,
if( pkg->dscmd5sum == NULL )
return RET_ERROR_OOM;
r = files_expectfiles(mirrordir,filesdb,&pkg->filekeys,&pkg->md5sums);
r = files_expectfiles(filesdb,&pkg->filekeys,&pkg->md5sums);
return r;
}
......@@ -369,7 +369,7 @@ static retvalue dsc_checkfiles(const char *mirrordir,DB *filesdb,
* of beeing newly calculated.
* (And all files are expected to already be in the pool). */
retvalue dsc_add(const char *dbdir,DB *references,DB *filesdb,const char *mirrordir,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *dscfilename,const char *filekey,const char *basename,const char *directory,const char *md5sum,int force){
retvalue dsc_add(const char *dbdir,DB *references,filesdb filesdb,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *dscfilename,const char *filekey,const char *basename,const char *directory,const char *md5sum,int force){
retvalue r;
struct dscpackage *pkg;
......@@ -431,9 +431,9 @@ retvalue dsc_add(const char *dbdir,DB *references,DB *filesdb,const char *mirror
if( !RET_WAS_ERROR(r) ) {
if( filekey && basename && directory && md5sum)
r = dsc_checkfiles(mirrordir,filesdb,pkg,md5sum);
r = dsc_checkfiles(filesdb,pkg,md5sum);
else
r = dsc_copyfiles(mirrordir,filesdb,pkg,dscfilename);
r = dsc_copyfiles(filesdb,pkg,dscfilename);
}
/* Calculate the chunk to include: */
......
......@@ -8,12 +8,15 @@
#ifndef __MIRRORER_DISTRIBUTION_H
#include "distribution.h"
#endif
#ifndef __MIRRORER_FILES_H
#include "files.h"
#endif
/* insert the given .dsc into the mirror in <component> in the <distribution>
* if component is NULL, guess it from the section.
* If basename, filekey and directory are != NULL, then they are used instead
* of beeing newly calculated.
* (And all files are expected to already be in the pool). */
retvalue dsc_add(const char *dbdir,DB *references,DB *filesdb,const char *mirrordir,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *dscfilename,const char *filekey,const char *basename,const char *directory,const char *md5sum,int force);
retvalue dsc_add(const char *dbdir,DB *references,filesdb filesdb,const char *forcecomponent,const char *forcesection,const char *forcepriority,struct distribution *distribution,const char *dscfilename,const char *filekey,const char *basename,const char *directory,const char *md5sum,int force);
#endif
This diff is collapsed.
......@@ -7,32 +7,37 @@
#warning "What's hapening here?"
#endif
typedef struct s_filesdb {
DB *database;
char *mirrordir;
} *filesdb;
/* initalize "md5sum and size"-database */
DB *files_initialize(const char *dbpath);
retvalue files_initialize(filesdb *filesdb,const char *dbpath,const char *mirrordir);
/* release the files-database initialized got be files_initialize */
retvalue files_done( DB *db);
retvalue files_done(filesdb db);
/* Add file's md5sum to database */
retvalue files_add(DB *filesdb,const char *filekey,const char *md5sum_and_size);
retvalue files_add(filesdb filesdb,const char *filekey,const char *md5sum);
/* remove file's md5sum from database */
retvalue files_remove(DB *filesdb,const char *filekey);
retvalue files_remove(filesdb filesdb,const char *filekey);
/* look for file in database
* returns: -2 wrong md5sum, -1: error, 0 not existant, 1 exists*/
retvalue files_check(DB *filesdb,const char *filekey,const char *md5sum_and_size);
retvalue files_check(filesdb filesdb,const char *filekey,const char *md5sum);
/* look for file, calculate its md5sum and add it */
retvalue files_detect(DB *filesdb,const char *mirrordir,const char *filekey);
retvalue files_detect(filesdb filesdb,const char *filekey);
/* check for file in the database and if not found there, if it can be detected */
retvalue files_expect(DB *filesdb,const char *mirrordir,const char *filekey,const char *md5andsize);
retvalue files_expect(filesdb filesdb,const char *filekey,const char *md5sum);
/* print missing files */
retvalue files_printmissing(const char *mirrordir,DB *filesdb,const struct strlist *filekeys,const struct strlist *md5sums,const struct strlist *origfiles);
retvalue files_printmissing(filesdb filesdb,const struct strlist *filekeys,const struct strlist *md5sums,const struct strlist *origfiles);
/* check for several files in the database and in the pool if missing */
retvalue files_expectfiles(const char *mirrordir,DB *filesdb,const struct strlist *filekeys,const struct strlist *md5sums);
retvalue files_expectfiles(filesdb filesdb,const struct strlist *filekeys,const struct strlist *md5sums);
/* Copy file <origfilename> to <mirrordir>/<filekey> and add it to
* the database <filesdb>. Return RET_ERROR_WRONG_MD5 if already there
......@@ -40,21 +45,21 @@ retvalue files_expectfiles(const char *mirrordir,DB *filesdb,const struct strlis
* or the database had an error. return RET_NOTHING, if already there
* with correct md5sum. Return <md5andsize> with the data of this file,
* if no error (that is if RET_OK or RET_NOTHING) */
retvalue files_checkin(const char *mirrordir,DB *filesdb,const char *filekey,
retvalue files_checkin(filesdb filesdb,const char *filekey,
const char *origfilename, char **md5andsize);
/* Make sure filekeys with md5sums are in the pool. If not copy from
* sourcedir/file where file is the entry from files */
retvalue files_checkinfiles(const char *mirrordir,DB *filesdb,const char *sourcedir,const struct strlist *basefilenames,const struct strlist *filekeys,const struct strlist *md5sums);
retvalue files_checkinfiles(filesdb filesdb,const char *sourcedir,const struct strlist *basefilenames,const struct strlist *filekeys,const struct strlist *md5sums);
/* The same for a single file: */
retvalue files_checkinfile(const char *mirrordir,DB *filesdb,const char *sourcedir,const char *basename,const char *filekey,const char *md5sum);
retvalue files_checkinfile(filesdb filesdb,const char *sourcedir,const char *basename,const char *filekey,const char *md5sum);
typedef retvalue per_file_action(void *data,const char *filekey,const char *md5andsize);
/* callback for each registered file */
retvalue files_foreach(DB* filesdb,per_file_action action,void *data);
retvalue files_foreach(filesdb filesdb,per_file_action action,void *data);
/* dump out all information */
retvalue files_printmd5sums(DB* filesdb);
retvalue files_printmd5sums(filesdb filesdb);
#endif
......@@ -94,7 +94,7 @@ static int extract_control(int argc,char *argv[]) {
static int addmd5sums(int argc,char *argv[]) {
char buffer[2000],*c,*m;
DB *files;
filesdb files;
retvalue result,r;
if( argc != 1 ) {
......@@ -102,9 +102,9 @@ static int addmd5sums(int argc,char *argv[]) {
return 1;
}
files = files_initialize(dbdir);
if( !files )
return 1;
r = files_initialize(&files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) )
return EXIT_RET(r);
result = RET_NOTHING;
......@@ -168,7 +168,7 @@ static int dumpreferences(int argc,char *argv[]) {
return EXIT_RET(result);
}
struct fileref { DB *files,*refs; };
struct fileref { filesdb files; DB *refs; };
static retvalue checkifreferenced(void *data,const char *filekey,const char *md5andsize) {
struct fileref *dist = data;
......@@ -195,10 +195,10 @@ static int dumpunreferenced(int argc,char *argv[]) {
dist.refs = references_initialize(dbdir);
if( ! dist.refs )
return 1;
dist.files = files_initialize(dbdir);
if( ! dist.files ) {
r = files_initialize(&dist.files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) ) {
(void)references_done(dist.refs);
return 1;
return EXIT_RET(r);
}
result = files_foreach(dist.files,checkifreferenced,&dist);
r = files_done(dist.files);
......@@ -248,10 +248,10 @@ static int deleteunreferenced(int argc,char *argv[]) {
dist.refs = references_initialize(dbdir);
if( ! dist.refs )
return 1;
dist.files = files_initialize(dbdir);
if( ! dist.files ) {
r = files_initialize(&dist.files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) ) {
(void)references_done(dist.refs);
return 1;
return EXIT_RET(r);
}
result = files_foreach(dist.files,deleteifunreferenced,&dist);
r = files_done(dist.files);
......@@ -403,7 +403,7 @@ struct referee {
/****** common for [prepare]add{sources,packages} *****/
struct distributionhandles {
DB *files;packagesdb pkgs;DB *refs;
filesdb files;packagesdb pkgs;DB *refs;
const char *referee,*component;
};
......@@ -415,7 +415,7 @@ static retvalue add(void *data,const char *chunk,const char *package,const char
/* Add package to distribution's database */
result = files_expectfiles(mirrordir,dist->files,filekeys,md5sums);
result = files_expectfiles(dist->files,filekeys,md5sums);
if( RET_WAS_ERROR(result) )
return result;
......@@ -437,9 +437,9 @@ static int addsources(int argc,char *argv[]) {
dist.referee = argv[1];
dist.component = argv[2];
dist.files = files_initialize(dbdir);
if( ! dist.files ) {
return 1;
r = files_initialize(&dist.files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) ) {
return EXIT_RET(r);
}
r = packages_initialize(&dist.pkgs,dbdir,dist.referee);
if( RET_WAS_ERROR(r) ) {
......@@ -477,7 +477,7 @@ static retvalue showmissing(void *data,const char *chunk,const char *package,con
r = dirs_make_parents(mirrordir,filekeys);
if( RET_WAS_ERROR(r) )
return r;
ret = files_printmissing(mirrordir,dist->files,filekeys,md5sums,origfiles);
ret = files_printmissing(dist->files,filekeys,md5sums,origfiles);
return ret;
}
......@@ -495,9 +495,9 @@ static int prepareaddsources(int argc,char *argv[]) {
dist.component = argv[2];
dist.refs = NULL;
dist.files = files_initialize(dbdir);
if( ! dist.files ) {
return 1;
r = files_initialize(&dist.files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) ) {
return EXIT_RET(r);
}
r = packages_initialize(&dist.pkgs,dbdir,dist.referee);
if( RET_WAS_ERROR(r) ) {
......@@ -532,9 +532,9 @@ static int prepareaddpackages(int argc,char *argv[]) {
dist.referee = argv[1];
dist.component = argv[2];
dist.files = files_initialize(dbdir);
if( ! dist.files ) {
return 1;
r = files_initialize(&dist.files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) ) {
return EXIT_RET(r);
}
r = packages_initialize(&dist.pkgs,dbdir,dist.referee);
if( RET_WAS_ERROR(r) ) {
......@@ -567,9 +567,9 @@ static int addpackages(int argc,char *argv[]) {
fprintf(stderr,"mirrorer addpackages <identifier> <component> <Packages-files>\n");
return 1;
}
dist.files = files_initialize(dbdir);
if( ! dist.files ) {
return 1;
r = files_initialize(&dist.files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) ) {
return EXIT_RET(r);
}
r = packages_initialize(&dist.pkgs,dbdir,argv[1]);
if( RET_WAS_ERROR(r) ) {
......@@ -599,18 +599,18 @@ static int addpackages(int argc,char *argv[]) {
}
static int detect(int argc,char *argv[]) {
DB *files;
filesdb files;
char buffer[5000],*nl;
int i;
retvalue r,ret;
ret = RET_NOTHING;
files = files_initialize(dbdir);
if( !files )
return 1;
r = files_initialize(&files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) )
return EXIT_RET(r);
if( argc > 1 ) {
for( i = 1 ; i < argc ; i++ ) {
r = files_detect(files,mirrordir,argv[i]);
r = files_detect(files,argv[i]);
RET_UPDATE(ret,r);
}
......@@ -622,7 +622,7 @@ static int detect(int argc,char *argv[]) {
return 1;
}
*nl = '\0';
r = files_detect(files,mirrordir,buffer);
r = files_detect(files,buffer);
RET_UPDATE(ret,r);
}
r = files_done(files);
......@@ -631,14 +631,14 @@ static int detect(int argc,char *argv[]) {
}
static int forget(int argc,char *argv[]) {
DB *files;
filesdb files;
char buffer[5000],*nl;
int i;
retvalue r,ret;
files = files_initialize(dbdir);
if( !files )
return 1;
r = files_initialize(&files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) )
return EXIT_RET(r);
ret = RET_NOTHING;
if( argc > 1 ) {
for( i = 1 ; i < argc ; i++ ) {
......@@ -663,7 +663,7 @@ static int forget(int argc,char *argv[]) {
}
static int md5sums(int argc,char *argv[]) {
DB *files;
filesdb files;
char *filename,*md;
retvalue ret,r;
int i;
......@@ -687,9 +687,9 @@ static int md5sums(int argc,char *argv[]) {
}
return EXIT_RET(ret);
} else {
files = files_initialize(dbdir);
if( !files )
return 1;
r = files_initialize(&files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) )
return EXIT_RET(r);
ret = files_printmd5sums(files);
r = files_done(files);
RET_ENDUPDATE(ret,r);
......@@ -945,7 +945,7 @@ static int rereference(int argc,char *argv[]) {
return EXIT_RET(result);
}
/***********************checking*************************/
struct data_binsrccheck { const struct distribution *distribution; DB *references; DB *files;};
struct data_binsrccheck { const struct distribution *distribution; DB *references; filesdb files;};
static retvalue checkbin(void *data,const char *component,const char *architecture) {
......@@ -991,15 +991,15 @@ static int check(int argc,char *argv[]) {
if( ! dat.references )
return 1;
dat.files = files_initialize(dbdir);
r = files_initialize(&dat.files,dbdir,mirrordir);
if( ! dat.files ) {
if( RET_WAS_ERROR(r) ) {
(void)references_done(dat.references);
return 1;
return EXIT_RET(r);
}
result = distribution_foreach(confdir,argc-1,argv+1,check_dist,&dat,force);
r = references_done(dat.files);
r = files_done(dat.files);
RET_ENDUPDATE(result,r);
r = references_done(dat.references);
RET_ENDUPDATE(result,r);
......@@ -1011,7 +1011,7 @@ static int check(int argc,char *argv[]) {
static int includedeb(int argc,char *argv[]) {
retvalue result,r;
DB *files,*references;
filesdb files;DB *references;
struct distribution *distribution;
if( argc < 3 ) {
......@@ -1025,14 +1025,14 @@ static int includedeb(int argc,char *argv[]) {
return 2;
}
files = files_initialize(dbdir);
if( !files )
return 1;
r = files_initialize(&files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) )
return EXIT_RET(r);
references = references_initialize(dbdir);
if( !files )
if( !references )
return 1;
result =deb_add(dbdir,references,files,mirrordir,component,section,priority,distribution,argv[2],NULL,NULL,force);
result = deb_add(dbdir,references,files,component,section,priority,distribution,argv[2],NULL,NULL,force);
distribution_free(distribution);
r = files_done(files);
......@@ -1046,7 +1046,7 @@ static int includedeb(int argc,char *argv[]) {
static int includedsc(int argc,char *argv[]) {
retvalue result,r;
DB *files,*references;
filesdb files; DB *references;
struct distribution *distribution;
if( argc < 3 ) {
......@@ -1060,14 +1060,14 @@ static int includedsc(int argc,char *argv[]) {
return 2;
}
files = files_initialize(dbdir);
r = files_initialize(&files,dbdir,mirrordir);
if( !files )
return 1;
references = references_initialize(dbdir);
if( !files )
return 1;
result =dsc_add(dbdir,references,files,mirrordir,component,section,priority,distribution,argv[2],NULL,NULL,NULL,NULL,force);
result = dsc_add(dbdir,references,files,component,section,priority,distribution,argv[2],NULL,NULL,NULL,NULL,force);
distribution_free(distribution);
r = files_done(files);
......@@ -1080,7 +1080,7 @@ static int includedsc(int argc,char *argv[]) {
static int includechanges(int argc,char *argv[]) {
retvalue result,r;
DB *files,*references;
filesdb files;DB *references;
struct distribution *distribution;
if( argc < 3 ) {
......@@ -1094,14 +1094,14 @@ static int includechanges(int argc,char *argv[]) {
return 2;
}
files = files_initialize(dbdir);
if( !files )
return 1;
r = files_initialize(&files,dbdir,mirrordir);
if( RET_WAS_ERROR(r) )
return EXIT_RET(r);
references = references_initialize(dbdir);
if( !files )
return 1;
result =changes_add(dbdir,references,files,mirrordir,component,section,priority,distribution,argv[2],force);
result = changes_add(dbdir,references,files,component,section,priority,distribution,argv[2],force);
distribution_free(distribution);
r = files_done(files);
......
......@@ -446,7 +446,7 @@ retvalue packages_rereference(const char *dbdir,DB *referencesdb,extractfilekeys
struct data_check {
packagesdb packagesdb;
DB *referencesdb;
DB *filesdb;
filesdb filesdb;
extractfilekeys *extractfilekeys;
};
......@@ -473,7 +473,7 @@ static retvalue checkpkg(void *data,const char *package,const char *chunk) {
return r;
}
retvalue packages_check(const char *dbdir,DB *filesdb,DB *referencesdb,extractfilekeys *extractfilekeys,const char *codename,const char *component,const char *architecture,int force) {
retvalue packages_check(const char *dbdir,filesdb filesdb,DB *referencesdb,extractfilekeys *extractfilekeys,const char *codename,const char *component,const char *architecture,int force) {
retvalue result,r;
struct data_check data;
packagesdb pkgs;
......
......@@ -10,6 +10,9 @@
#include "strlist.h"
#warning "What's hapening here?"
#endif
#ifndef __MIRRORER_FILES_H
#include "files.h"
#endif
typedef struct s_packagesdb {
char *identifier;
......@@ -38,7 +41,7 @@ retvalue packages_get(packagesdb db,const char *package,char **chunk);
/* rereference a full database */
typedef retvalue extractfilekeys(const char *,struct strlist *);
retvalue packages_rereference(const char *dbdir,DB *referencesdb,extractfilekeys *extractfilekeys,const char *codename,const char *component,const char *architecture,int force);
retvalue packages_check(const char *dbdir,DB *filesdb,DB *referencesdb,extractfilekeys *extractfilekeys,const char *codename,const char *component,const char *architecture,int force);
retvalue packages_check(const char *dbdir,filesdb filesdb,DB *referencesdb,extractfilekeys *extractfilekeys,const char *codename,const char *component,const char *architecture,int force);
/* insert a chunk in the packages database, adding and deleting
* references and insert files while that. */
......
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