Commit d09c4f93 authored by Bernhard Link's avatar Bernhard Link

first experimental tracking code

parent 0ba745a0
......@@ -6,7 +6,7 @@ bin_PROGRAMS = reprepro
AM_CPPFLAGS = -D_GNU_SOURCE=1 -DPKGDATADIR=\"$(pkgdatadir)\" -Wall
reprepro_SOURCES = guesscomponent.c files.c md5.c md5sum.c dirs.c chunks.c reference.c packages.c binaries.c sources.c names.c dpkgversions.c release.c mprintf.c updates.c strlist.c signature.c distribution.c extractcontrol.c checkindeb.c checkindsc.c checkin.c copyfile.c upgradelist.c target.c aptmethod.c downloadcache.c main.c override.c terms.c ignore.c filterlist.c exports.c
noinst_HEADERS = guesscomponent.h md5.h md5sum.h dirs.h files.h chunks.h reference.h packages.h binaries.h sources.h names.h release.h error.h mprintf.h updates.h strlist.h signature.h distribution.h extractcontrol.h checkindeb.h checkindsc.h copyfile.h upgradelist.h target.h aptmethod.h downloadcache.h override.h terms.h ignore.h filterlist.h dpkgversions.h checkin.h exports.h globals.h
reprepro_SOURCES = guesscomponent.c files.c md5.c md5sum.c dirs.c chunks.c reference.c packages.c binaries.c sources.c names.c dpkgversions.c release.c mprintf.c updates.c strlist.c signature.c distribution.c extractcontrol.c checkindeb.c checkindsc.c checkin.c copyfile.c upgradelist.c target.c aptmethod.c downloadcache.c main.c override.c terms.c ignore.c filterlist.c exports.c tracking.c
noinst_HEADERS = guesscomponent.h md5.h md5sum.h dirs.h files.h chunks.h reference.h packages.h binaries.h sources.h names.h release.h error.h mprintf.h updates.h strlist.h signature.h distribution.h extractcontrol.h checkindeb.h checkindsc.h copyfile.h upgradelist.h target.h aptmethod.h downloadcache.h override.h terms.h ignore.h filterlist.h dpkgversions.h checkin.h exports.h globals.h tracking.h
MAINTAINERCLEANFILES = Makefile.in configure install-sh stamp-h.in aclocal.m4 config.h.in mkinstalldirs
......@@ -172,7 +172,7 @@ retvalue binaries_getname(UNUSED(struct target *t),const char *control,char **pa
if( RET_WAS_ERROR(r) )
return r;
if( r == RET_NOTHING ) {
fprintf(stderr,"Did not found Package name in chunk:'%s'\n",control);
fprintf(stderr,"Did not find Package name in chunk:'%s'\n",control);
return RET_ERROR;
}
return r;
......@@ -184,7 +184,7 @@ retvalue binaries_getversion(UNUSED(struct target *t),const char *control,char *
if( RET_WAS_ERROR(r) )
return r;
if( r == RET_NOTHING ) {
fprintf(stderr,"Did not found Version in chunk:'%s'\n",control);
fprintf(stderr,"Did not find Version in chunk:'%s'\n",control);
return RET_ERROR;
}
return r;
......@@ -282,3 +282,101 @@ retvalue ubinaries_doreoverride(const struct alloverrides *ao,const char *packag
*newcontrolchunk = newchunk;
return RET_OK;
}
retvalue binaries_retrack(struct target *t,const char *packagename,const char *chunk, trackingdb tracks,references refs) {
retvalue r;
const char *sourcename;
char *fsourcename,*sourceversion,*arch,*filekey;
enum filetype filetype;
struct trackedpackage *pkg;
//TODO: elliminate duplicate code!
assert(packagename!=NULL);
/* is there a sourcename */
r = chunk_getnameandversion(chunk,"Source",&fsourcename,&sourceversion);
if( RET_WAS_ERROR(r) )
return r;
if( r == RET_NOTHING ) {
sourceversion = NULL;
sourcename = packagename;
fsourcename = NULL;
} else {
sourcename = fsourcename;
}
if( sourceversion == NULL ) {
// Think about binNMUs, can something be done here?
r = chunk_getvalue(chunk,"Version",&sourceversion);
if( RET_WAS_ERROR(r) ) {
free(fsourcename);
return r;
}
if( r == RET_NOTHING ) {
free(fsourcename);
fprintf(stderr,"Did not find Version in chunk:'%s'\n",chunk);
return RET_ERROR;
}
}
r = chunk_getvalue(chunk,"Architecture",&arch);
if( r == RET_NOTHING ) {
fprintf(stderr,"Did not find Architecture in chunk:'%s'\n",chunk);
r = RET_ERROR;
}
if( RET_WAS_ERROR(r) ) {
free(sourceversion);
free(fsourcename);
return r;
}
if( strcmp(arch,"all") == 0 ) {
filetype = ft_ALL_BINARY;
} else {
filetype = ft_ARCH_BINARY;
}
free(arch);
r = chunk_getvalue(chunk,"Filename",&filekey);
if( !RET_IS_OK(r) ) {
if( r == RET_NOTHING ) {
fprintf(stderr,"Did not find a Filename in chunk: '%s'\n",chunk);
r = RET_ERROR;
}
free(sourceversion);
free(fsourcename);
return r;
}
r = tracking_get(tracks,sourcename,sourceversion,&pkg);
if( RET_WAS_ERROR(r) ) {
free(fsourcename);
free(sourceversion);
free(filekey);
return r;
}
if( r == RET_NOTHING ) {
r = tracking_new(tracks,sourcename,sourceversion,&pkg);
free(fsourcename);
free(sourceversion);
if( RET_WAS_ERROR(r) ) {
free(filekey);
return r;
}
r = trackedpackage_addfilekey(tracks,pkg,filetype,filekey,refs);
free(filekey);
if( RET_WAS_ERROR(r) )
return r;
r = tracking_put(tracks,pkg);
trackedpackage_free(pkg);
return r;
}
free(fsourcename);
free(sourceversion);
r = trackedpackage_addfilekey(tracks,pkg,filetype,filekey,refs);
free(filekey);
if( RET_WAS_ERROR(r) )
return r;
r = tracking_replace(tracks,pkg);
trackedpackage_free(pkg);
return r;
}
......@@ -22,6 +22,7 @@ char *ubinaries_getupstreamindex(struct target *target,const char *suite_from,
const char *component_from,const char *architecture);
retvalue binaries_doreoverride(const struct alloverrides *alloverrides,const char *packagename,const char *controlchunk,/*@out@*/char **newcontrolchunk);
retvalue ubinaries_doreoverride(const struct alloverrides *alloverrides,const char *packagename,const char *controlchunk,/*@out@*/char **newcontrolchunk);
retvalue binaries_retrack(struct target *t,const char *packagename,const char *chunk, trackingdb tracks,references refs);
......
......@@ -37,6 +37,7 @@
#include "signature.h"
#include "sources.h"
#include "files.h"
#include "tracking.h"
#include "guesscomponent.h"
#include "override.h"
#include "checkindsc.h"
......@@ -102,6 +103,8 @@ struct changes {
char *srcdirectory;
/* (only to warn if multiple are used) */
const char *firstcomponent;
/* if tracks != NULL, the package to track, otherwise NULL*/
struct trackedpackage *trackedpkg;
};
static void freeentries(/*@only@*/struct fileentry *entry) {
......@@ -132,6 +135,7 @@ static void changes_free(/*@only@*/struct changes *changes) {
strlist_done(&changes->distributions);
free(changes->control);
free(changes->srcdirectory);
trackedpackage_free(changes->trackedpkg);
}
free(changes);
}
......@@ -537,6 +541,23 @@ static retvalue changes_fixfields(const struct distribution *distribution,const
changes->srcdirectory = calc_sourcedir(changes->srccomponent,changes->source);
if( changes->srcdirectory == NULL )
return RET_ERROR_OOM;
} else if( distribution->trackingoptions.includechanges ) {
const char *component = forcecomponent;
if( forcecomponent == NULL ) {
for( e = changes->files ; e != NULL ; e = e->next ) {
if( FE_BINARY(e->type) ){
component = e->component;
break;
}
}
}
if( component == NULL ) {
fprintf(stderr,"No component found to place .changes or byhand files in. Aborting.\n");
return RET_ERROR;
}
changes->srcdirectory = calc_sourcedir(component,changes->source);
if( changes->srcdirectory == NULL )
return RET_ERROR_OOM;
}
return RET_OK;
......@@ -756,23 +777,37 @@ static retvalue changes_includepkgs(const char *dbdir,references refs,filesdb fi
/* 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,references refs,filesdb filesdb,const char *packagetypeonly,const char *forcecomponent,const char *forcearchitecture,const char *forcesection,const char *forcepriority,struct distribution *distribution,const struct alloverrides *ao,const char *changesfilename,int force,int delete,struct strlist *dereferencedfilekeys,bool_t onlysigned) {
retvalue r;
retvalue changes_add(const char *dbdir,trackingdb const tracks,references refs,filesdb filesdb,const char *packagetypeonly,const char *forcecomponent,const char *forcearchitecture,const char *forcesection,const char *forcepriority,struct distribution *distribution,const struct alloverrides *ao,const char *changesfilename,int force,int delete,struct strlist *dereferencedfilekeys,bool_t onlysigned) {
retvalue result,r;
struct changes *changes;
bool_t newtrack;
r = changes_read(changesfilename,&changes,packagetypeonly,forcearchitecture,force,onlysigned);
if( RET_WAS_ERROR(r) )
return r;
// if( changes->distributions.count != 1 ) {
// fprintf(stderr,"There is not exactly one distribution given!\n");
// changes_free(changes);
// return RET_ERROR;
// }
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");
}
if( tracks != NULL ) {
newtrack = FALSE;
r = tracking_get(tracks,changes->source,changes->version,&changes->trackedpkg);
if( r == RET_NOTHING ) {
newtrack = TRUE;
r = tracking_new(tracks,changes->source,changes->version,&changes->trackedpkg);
}
if( RET_WAS_ERROR(r) ) {
changes_free(changes);
return r;
}
}
#ifndef GCCHASLEARNEDIT
else newtrack = FALSE;
#endif
/* look for component, section and priority to be correct or guess them*/
r = changes_fixfields(distribution,changesfilename,changes,forcecomponent,forcesection,forcepriority,ao);
if( RET_WAS_ERROR(r) ) {
......@@ -795,7 +830,7 @@ retvalue changes_add(const char *dbdir,references refs,filesdb filesdb,const cha
}
/* add the source and binary packages in the given distribution */
r = changes_includepkgs(dbdir,refs,filesdb,
result = changes_includepkgs(dbdir,refs,filesdb,
distribution,changes,ao,force,
dereferencedfilekeys, onlysigned);
if( RET_WAS_ERROR(r) ) {
......@@ -803,8 +838,40 @@ retvalue changes_add(const char *dbdir,references refs,filesdb filesdb,const cha
return r;
}
if( delete >= D_MOVE ) {
if( r == RET_NOTHING && delete < D_DELETE ) {
if( tracks != NULL ) {
if( distribution->trackingoptions.includechanges ) {
char *filekey;const char *basename;
assert( changes->srcdirectory != NULL );
basename = dirs_basename(changesfilename);
filekey = calc_dirconcat(changes->srcdirectory,basename);
if( filekey == NULL ) {
changes_free(changes);
return RET_ERROR_OOM;
}
r = files_include(filesdb,changesfilename,filekey,
NULL,NULL,
(result==RET_NOTHING)?D_COPY:delete);
if( !RET_WAS_ERROR(r) ) {
r = trackedpackage_addfilekey(tracks,changes->trackedpkg,ft_CHANGES,filekey,refs);
}
free(filekey);
changesfilename = NULL;
RET_ENDUPDATE(result,r);
}
if( newtrack ) {
r = tracking_put(tracks,changes->trackedpkg);
} else {
r = tracking_replace(tracks,changes->trackedpkg);
}
if( RET_WAS_ERROR(r) ) {
changes_free(changes);
return r;
}
}
if( delete >= D_MOVE && changesfilename != NULL ) {
if( result == RET_NOTHING && delete < D_DELETE ) {
if( verbose >= 0 ) {
fprintf(stderr,"Not deleting '%s' as no package was added or some package was missed.\n(Use --delete --delete to delete anyway in such cases)\n",changesfilename);
}
......@@ -817,6 +884,7 @@ retvalue changes_add(const char *dbdir,references refs,filesdb filesdb,const cha
}
}
}
//TODO: why is here no changes_free?
return RET_OK;
}
......@@ -15,8 +15,9 @@
/* 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.
* if dereferencedfilekeys is != NULL, add filekeys that lost reference */
retvalue changes_add(const char *dbdir,references refs,filesdb filesdb,/*@null@*/const char *packagetypeonly,/*@null@*/const char *forcecomponent,/*@null@*/const char *forcearchitecture,/*@null@*/const char *forcesection,/*@null@*/const char *forcepriority,struct distribution *distribution,const struct alloverrides *ao,const char *changesfilename,int force,int delete,/*@null@*/struct strlist *dereferencedfilekeys,bool_t onlysigned);
* if dereferencedfilekeys is != NULL, add filekeys that lost reference,
* if tracks != NULL, update/add tracking information there... */
retvalue changes_add(const char *dbdir,/*@null@*/trackingdb tracks,references refs,filesdb filesdb,/*@null@*/const char *packagetypeonly,/*@null@*/const char *forcecomponent,/*@null@*/const char *forcearchitecture,/*@null@*/const char *forcesection,/*@null@*/const char *forcepriority,struct distribution *distribution,const struct alloverrides *ao,const char *changesfilename,int force,int delete,/*@null@*/struct strlist *dereferencedfilekeys,bool_t onlysigned);
#endif
......@@ -447,6 +447,81 @@ retvalue chunk_getname(const char *chunk,const char *name,
}
/* Parse a package/source-field: ' *value( ?\(version\))? *' */
retvalue chunk_getnameandversion(const char *chunk,const char *name,
char **pkgname,char **version) {
const char *field,*name_end,*p;
char *v;
field = chunk_getfield(name,chunk);
if( field == NULL )
return RET_NOTHING;
while( *field != '\0' && *field != '\n' && xisspace(*field) )
field++;
name_end = field;
/* this has now checked somewhere else for correctness and
* is only a pure seperation process:
* (as package(version) is possible, '(' must be checked) */
while( *name_end != '\0' && *name_end != '\n' && *name_end != '(' && !xisspace(*name_end) )
name_end++;
p = name_end;
while( *p != '\0' && *p != '\n' && xisspace(*p) )
p++;
if( name_end == field ||
( *p != '\0' && *p != '\n' &&
*p != '(')) {
if( *field == '\n' || *field == '\0' ) {
fprintf(stderr,"Error: Field '%s' is empty!\n",name);
} else {
fprintf(stderr,"Error: Field '%s' contains unexpected character '%c'!\n",name,*p);
}
return RET_ERROR;
}
if( *p == '(' ) {
const char *version_begin;
p++;
while( *p != '\0' && *p != '\n' && xisspace(*p) )
p++;
version_begin = p;
while( *p != '\0' && *p != '\n' && *p != ')' && !xisspace(*p) )
// TODO: perhaps check for wellformed version
p++;
v = strndup(version_begin,p-version_begin);
if( v == NULL )
return RET_ERROR_OOM;
while( *p != '\0' && *p != '\n' && *p != ')' && xisspace(*p) )
p++;
if( *p != ')' ) {
free(v);
if( *p == '\0' || *p == '\n' )
fprintf(stderr,"Error: Field '%s' misses closing parathesis!\n",name);
else
fprintf(stderr,"Error: Field '%s' has multipe words after '('!\n",name);
return RET_ERROR;
}
p++;
} else {
v = NULL;
}
while( *p != '\0' && *p != '\n' && xisspace(*p) )
p++;
if( *p != '\0' && *p != '\n' ) {
free(v);
fprintf(stderr,"Error: Field '%s' contains trailing junk starting with '%c'!\n",name,*p);
return RET_ERROR;
}
*pkgname = strndup(field,name_end-field);
if( *pkgname == NULL ) {
free(v);
return RET_ERROR_OOM;
}
*version = v;
return RET_OK;
}
/* Add this the <fields to add> to <chunk> before <beforethis> field,
* replacing older fields of this name, if they are already there. */
......
......@@ -23,6 +23,7 @@ retvalue chunk_getwholedata(const char *chunk,const char *name,/*@out@*/char **v
/* Parse a package/source-field: ' *value( ?\(version\))? *' */
retvalue chunk_getname(const char *chunk,const char *name,/*@out@*/char **pkgname,bool_t allowversion);
retvalue chunk_getnameandversion(const char *chunk,const char *name,/*@out@*/char **pkgname,/*@out@*/char **version);
/* return RET_OK, if field is found, RET_NOTHING, if not (or value indicates false in future variants) */
retvalue chunk_gettruth(const char *chunk,const char *name);
......
......@@ -4,7 +4,7 @@ dnl
AC_INIT(main.c)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(reprepro,0.4)
AM_INIT_AUTOMAKE(reprepro,0.4-cvs)
AM_MAINTAINER_MODE
......
......@@ -103,3 +103,13 @@ retvalue dirs_getdirectory(const char *filename,char **directory) {
return RET_OK;
}
const char *dirs_basename(const char *filename) {
const char *bn;
bn = strrchr(filename,'/');
if( bn == NULL )
return filename;
// not really suited for the basename of directories,
// things like /bla/blub/ will give emtpy string...
return bn+1;
}
......@@ -17,4 +17,6 @@ retvalue dirs_make_recursive(const char *directory);
/* Behave like dirname(3) */
retvalue dirs_getdirectory(const char *filename,/*@out@*/char **directory);
const char *dirs_basename(const char *filename);
#endif
......@@ -163,7 +163,7 @@ static retvalue distribution_parse_and_filter(struct distribution **distribution
static const char * const allowedfields[] = {
"Codename", "Suite", "Version", "Origin", "Label", "Description",
"Architectures", "Components", "Update", "SignWith", "DebOverride",
"UDebOverride", "DscOverride",
"UDebOverride", "DscOverride", "Tracking",
"UDebComponents", "DebIndices", "DscIndices", "UDebIndices",
NULL};
......@@ -292,6 +292,19 @@ NULL};
return ret;
}
ret = chunk_getvalue(chunk,"Tracking",&option);
if(RET_WAS_ERROR(ret)) {
(void)distribution_free(r);
return ret;
} else if( ret == RET_NOTHING)
option = NULL;
ret = tracking_parse(option,r);
if(RET_WAS_ERROR(ret)) {
(void)distribution_free(r);
return ret;
}
ret = createtargets(r);
if( RET_WAS_ERROR(ret) ) {
(void)distribution_free(r);
......
#ifndef REPREPRO_DISTRIBUTION_H
#define REPREPRO_DISTRIBUTION_H
struct distribution;
#ifndef REPREPRO_ERROR_H
#include "error.h"
#warning "What's hapening here?"
......@@ -11,6 +13,9 @@
#ifndef REPREPRO_TARGET_H
#include "target.h"
#endif
#ifndef REPREPRO_EXPORTS_H
#include "exports.h"
#endif
struct distribution {
struct distribution *next;
......@@ -33,6 +38,11 @@ struct distribution {
struct strlist udebcomponents;
/* what kind of index files to generate */
struct exportmode dsc,deb,udeb;
/* is tracking enabled for this distribution? */
enum trackingtype { dt_NONE=0, dt_KEEP, dt_NEEDED } tracking;
struct { bool_t includechanges:1;
bool_t needsources:1;
bool_t inlcudebyhand:1;} trackingoptions;
/* A list of all targets contained in the distribution*/
struct target *targets;
};
......
......@@ -52,6 +52,7 @@
#include "checkin.h"
#include "downloadcache.h"
#include "terms.h"
#include "tracking.h"
#ifndef STD_BASE_DIR
......@@ -830,6 +831,180 @@ ACTION_R(rereference) {
return result;
}
/***************************retrack****************************/
struct data_binsrctrack { /*@temp@*/const struct distribution *distribution; /*@temp@*/references refs; trackingdb tracks;};
static retvalue retrack(void *data,struct target *target) {
retvalue result,r;
struct data_binsrctrack *d = data;
result = target_initpackagesdb(target,dbdir);
if( !RET_WAS_ERROR(result) ) {
result = target_retrack(target,d->tracks,d->refs,force);
r = target_closepackagesdb(target);
RET_ENDUPDATE(result,r);
}
return result;
}
ACTION_R(retrack) {
retvalue result,r;
struct distribution *distributions,*d;
if( argc < 1 ) {
fprintf(stderr,"reprepro retrack [<distributions>]\n");
return RET_ERROR;
}
result = distribution_getmatched(confdir,argc-1,argv+1,&distributions);
assert( result != RET_NOTHING );
if( RET_WAS_ERROR(result) ) {
return result;
}
result = RET_NOTHING;
for( d = distributions ; d != NULL ; d = d->next ) {
struct data_binsrctrack dat;
if( verbose > 0 ) {
fprintf(stderr,"Chasing %s...\n",d->codename);
}
dat.distribution = d;
dat.refs = references;
r = tracking_initialize(&dat.tracks,dbdir,d);
if( RET_WAS_ERROR(r) ) {
RET_UPDATE(result,r);
if( RET_WAS_ERROR(r) && force <= 0 )
break;
continue;
}
r = tracking_clearall(dat.tracks);
RET_UPDATE(result,r);
r = references_remove(references,d->codename);
RET_UPDATE(result,r);
r = distribution_foreach_part(d,component,architecture,packagetype,
retrack,&dat,force);
RET_UPDATE(result,r);
dat.refs = NULL;
dat.distribution = NULL;
r = tracking_done(dat.tracks);
RET_ENDUPDATE(result,r);
if( RET_WAS_ERROR(result) && force <= 0 )
break;
}
r = distribution_freelist(distributions);
RET_ENDUPDATE(result,r);
return result;
}
ACTION_D(removetrack) {
retvalue result,r;
struct distribution *distribution;
trackingdb tracks;
if( argc != 4 ) {
fprintf(stderr,"reprepro removetrack <distribution> <sourcename> <version>\n");
return RET_ERROR;
}
result = distribution_get(&distribution,confdir,argv[1]);
assert( result != RET_NOTHING );
if( RET_WAS_ERROR(result) )
return result;
r = tracking_initialize(&tracks,dbdir,distribution);
if( RET_WAS_ERROR(r) ) {
distribution_free(distribution);
return r;
}
result = tracking_remove(tracks,argv[2],argv[3],references,dereferenced);
r = tracking_done(tracks);
RET_ENDUPDATE(result,r);
r = distribution_free(distribution);
RET_ENDUPDATE(result,r);
return result;
}
ACTION_R(cleartracks) {
retvalue result,r;
struct distribution *distributions,*d;
if( argc < 1 ) {
fprintf(stderr,"reprepro cleartracks [<distributions>]\n");
return RET_ERROR;
}
result = distribution_getmatched(confdir,argc-1,argv+1,&distributions);
assert( result != RET_NOTHING );
if( RET_WAS_ERROR(result) ) {
return result;
}
result = RET_NOTHING;
for( d = distributions ; d != NULL ; d = d->next ) {
trackingdb tracks;
if( verbose > 0 ) {
fprintf(stderr,"Deleting all tracks for %s...\n",d->codename);
}
r = tracking_initialize(&tracks,dbdir,d);
if( RET_WAS_ERROR(r) ) {
RET_UPDATE(result,r);
if( RET_WAS_ERROR(r) && force <= 0 )
break;
continue;
}
r = tracking_clearall(tracks);
RET_UPDATE(result,r);
r = references_remove(references,d->codename);
RET_UPDATE(result,r);
r = tracking_done(tracks);
RET_ENDUPDATE(result,r);
if( RET_WAS_ERROR(result) && force <= 0 )
break;
}
r = distribution_freelist(distributions);
RET_ENDUPDATE(result,r);
return result;
}
ACTION_N(printtracks) {
retvalue result,r;
struct distribution *distributions,*d;
if( argc < 1 ) {
fprintf(stderr,"reprepro printtracks [<distributions>]\n");
return RET_ERROR;
}
result = distribution_getmatched(confdir,argc-1,argv+1,&distributions);
assert( result != RET_NOTHING );
if( RET_WAS_ERROR(result) ) {
return result;
}
result = RET_NOTHING;
for( d = distributions ; d != NULL ; d = d->next ) {
trackingdb tracks;
r = tracking_initialize(&tracks,dbdir,d);
if( RET_WAS_ERROR(r) ) {
RET_UPDATE(result,r);
if( RET_WAS_ERROR(r) && force <= 0 )
break;
continue;
}
r = tracking_printall(tracks);
RET_UPDATE(result,r);
r = tracking_done(tracks);
RET_ENDUPDATE(result,r);
if( RET_WAS_ERROR(result) && force <= 0 )
break;
}
r = distribution_freelist(distributions);
RET_ENDUPDATE(result,r);
return result;
}
/***********************checking*************************/
struct data_check { /*@temp@*/const struct distribution *distribution; /*@temp@*/references references; /*@temp@*/filesdb filesdb;};
......@@ -1079,6 +1254,7 @@ ACTION_D(include) {
retvalue result,r;
struct distribution *distribution;
struct alloverrides ao;
trackingdb tracks;
if( argc != 3 ) {
fprintf(stderr,"reprepro [--delete] include <distribution> <.changes-file>\n");
......@@ -1097,10 +1273,24 @@ ACTION_D(include) {
return result;
}
result = changes_add(dbdir,references,filesdb,packagetype,component,architecture,section,priority,distribution,&ao,argv[2],force,delete,dereferenced,onlyacceptsigned);
if( distribution->tracking != dt_NONE ) {
result = tracking_initialize(&tracks,dbdir,distribution);
if( RET_WAS_ERROR(result) ) {
r = distribution_free(distribution);
RET_ENDUPDATE(result,r);
override_free(ao.deb);override_free(ao.udeb);override_free(ao.dsc);
return result;
}
} else {
tracks = NULL;
}
result = changes_add(dbdir,tracks,references,filesdb,packagetype,component,architecture,section,priority,distribution,&ao,argv[2],force,delete,dereferenced,onlyacceptsigned);
override_free(ao.deb);override_free(ao.udeb);override_free(ao.dsc);
r = tracking_done(tracks);
RET_ENDUPDATE(result,r);
r = distribution_export(distribution,confdir,dbdir,distdir,force,TRUE);
RET_ENDUPDATE(result,r);
r = distribution_free(distribution);
......@@ -1208,6 +1398,10 @@ static const struct action {
{"dumpreferences", A_R(dumpreferences)},
{"dumpunreferenced", A_RF(dumpunreferenced)},
{"deleteunreferenced", A_RF(deleteunreferenced)},
{"retrack", A_R(retrack)},
{"printtracks", A_N(printtracks)},
{"cleartracks", A_R(cleartracks)},
{"removetrack", A_D(removetrack)},
{"update", A_D(update)},
{"iteratedupdate", A_D(iteratedupdate)},
{"checkupdate", A_N(checkupdate)},
......
......@@ -708,3 +708,7 @@ retvalue calc_parsefileline(const char *fileline,char **filename,char **md5sum)
return RET_OK;
}
char *calc_trackreferee(const char *codename,const char *sourcename,const char *sourceversion) {
return mprintf("%s %s %s",codename,sourcename,sourceversion);
}
#ifndef REPREPRO_NAMES_H
#define REPREPRO_NAMES_H
#ifndef REPREPRO_STRLIST_H
#include "strlist.h"
#endif
char *calc_addsuffix(const char *str1,const char *str2);
char *calc_dirconcat(const char *str1,const char *str2);