Commit 531cf25d authored by Bernhard Link's avatar Bernhard Link

add predelete action

parent 954bf792
2006-06-19 Bernhard R. Link <brlink@debian.org>
* add predelete action to remove packages from
a distribution that would be deleted or replaced
by a command.
2006-06-18 Bernhard R. Link <brlink@debian.org>
* check for file conflicts and missing files when including
.changes files before copying/moving files into the pool
......
......@@ -4,6 +4,8 @@ Updates since 0.9.1:
- handle some signals (TERM, ABRT, INT and QUIT) a bit
more gracefully
- some little fixes in the documentation
- add predelete action to delete packages that would be
deleted or replaced in an update
Updates since 0.9.0:
- fix bug in post-export script handling.
......
......@@ -9,7 +9,6 @@ TODO:
switch to only include if source is present
action to redownload missing pool/ files from some update-rules (looking for md5sum)
rewrite error handling, caching error messages and handling Ctrl-C gracefully.
ways to minimize disk space when doing large scale updates. (#371197)
far goals:
check for source of package,
......
reprepro (0.9.1-2) UNRELEASED; urgency=low
reprepro (1.0.0-0) UNRELEASED; urgency=low
* fixed typos in --help output (Closes: 372024)
* catch Ctrl-C (Closes: 315162)
-- Bernhard R. Link <brlink@debian.org> Thu, 8 Jun 2006 10:40:53 +0200
* new release
- fixed typos in --help output (Closes: 372024)
- catch Ctrl-C (Closes: 315162)
- adding a .changes files will copy files later
and delete the copies in the pool again if
an error is found before including any package (Closes: 359644)
- add predelete action (Closes: 371197)
-- Bernhard R. Link <brlink@debian.org> Sun, 18 Jun 2006 18:43:25 +0200
reprepro (0.9.1-1) unstable; urgency=low
......
......@@ -759,6 +759,59 @@ ACTION_D(update) {
return result;
}
ACTION_D(predelete) {
retvalue result,r;
struct update_pattern *patterns;
struct distribution *distributions;
struct update_distribution *u_distributions;
if( argc < 1 ) {
fprintf(stderr,"reprepro predelete [<distributions>]\n");
return RET_ERROR;
}
result = dirs_make_recursive(listdir);
if( RET_WAS_ERROR(result) ) {
return result;
}
result = distribution_getmatched(confdir,argc-1,argv+1,&distributions);
assert( result != RET_NOTHING );
if( RET_WAS_ERROR(result) )
return result;
result = updates_getpatterns(confdir,&patterns);
if( RET_WAS_ERROR(result) ) {
r = distribution_freelist(distributions);
RET_ENDUPDATE(result,r);
return result;
}
assert( RET_IS_OK(result) );
result = updates_calcindices(listdir,patterns,distributions,&u_distributions);
if( RET_WAS_ERROR(result) ) {
updates_freepatterns(patterns);
r = distribution_freelist(distributions);
RET_ENDUPDATE(result,r);
return result;
}
assert( RET_IS_OK(result) );
if( !keepunneededlists ) {
result = updates_clearlists(listdir,u_distributions);
}
if( !RET_WAS_ERROR(result) )
result = updates_predelete(dbdir,methoddir,references,u_distributions,nolistsdownload,skipold,dereferenced);
updates_freeupdatedistributions(u_distributions);
updates_freepatterns(patterns);
r = distribution_exportandfreelist(export,distributions,
confdir,dbdir,distdir,filesdb);
RET_ENDUPDATE(result,r);
return result;
}
ACTION_D(iteratedupdate) {
retvalue result,r;
struct update_pattern *patterns;
......@@ -1764,6 +1817,7 @@ static const struct action {
{"update", A_D(update)},
{"iteratedupdate", A_D(iteratedupdate)},
{"checkupdate", A_N(checkupdate)},
{"predelete", A_D(predelete)},
{"pull", A_D(pull)},
{"checkpull", A_N(checkpull)},
{"includedeb", A_D(includedeb)},
......
......@@ -572,8 +572,31 @@ test ! -f ab_3-1.dsc
test -f pool/all/a/ab/ab-addons_3-1_all.deb
test -f pool/all/a/ab/ab_3-1_abacus.deb
test -f pool/all/a/ab/ab_3-1.dsc
DISTRI=b PACKAGE=ac EPOCH="" VERSION=1 REVISION="-1" SECTION="stupid/base" genpackage.sh
$HELPER "$REPREPRO" -b . -A abacus --delete --delete --ignore=missingfile include b test.changes
grep -q '^Package: aa$' dists/b/all/binary-abacus/Packages
grep -q '^Package: aa-addons$' dists/b/all/binary-abacus/Packages
grep -q '^Package: ab$' dists/b/all/binary-abacus/Packages
grep -q '^Package: ab-addons$' dists/b/all/binary-abacus/Packages
grep -q '^Package: ac$' dists/b/all/binary-abacus/Packages
grep -q '^Package: ac-addons$' dists/b/all/binary-abacus/Packages
echo "Update: - froma" >> conf/distributions
cat >conf/updates <<END
Name: froma
Method: copy:$WORKDIR
Suite: a
ListHook: /bin/cp
END
$HELPER "$REPREPRO" -VVVb . predelete b
grep -q '^Package: aa$' dists/b/all/binary-abacus/Packages
grep -q '^Package: aa-addons$' dists/b/all/binary-abacus/Packages
! grep -q '^Package: ab$' dists/b/all/binary-abacus/Packages
! grep -q '^Package: ab-addons$' dists/b/all/binary-abacus/Packages
! grep -q '^Package: ac$' dists/b/all/binary-abacus/Packages
! grep -q '^Package: ac-addons$' dists/b/all/binary-abacus/Packages
test ! -f pool/all/a/ac/ac-addons_1-1_all.deb
test ! -f pool/all/a/ab/ab_2-1_abacus.deb
test -f pool/all/a/aa/aa_1-3_abacus.deb
set +v
echo
echo "If the script is still running to show this,"
......
......@@ -1691,6 +1691,102 @@ retvalue updates_checkupdate(const char *dbdir,const char *methoddir,struct upda
return result;
}
retvalue updates_predelete(const char *dbdir,const char *methoddir,references refs,struct update_distribution *distributions,bool_t nolistsdownload,bool_t skipold,struct strlist *dereferencedfilekeys) {
retvalue result,r;
struct update_distribution *d;
struct aptmethodrun *run;
r = aptmethod_initialize_run(&run);
if( RET_WAS_ERROR(r) )
return r;
if( nolistsdownload ) {
if( skipold && verbose >= 0 ) {
fprintf(stderr,"Ignoring --skipold because of --nolistsdownload\n");
}
skipold = FALSE;
}
/* preperations */
result = updates_startup(run,distributions);
if( RET_WAS_ERROR(result) ) {
aptmethod_shutdown(run);
return result;
}
if( nolistsdownload ) {
if( verbose >= 0 )
fprintf(stderr,"Warning: As --nolistsdownload is given, index files are NOT checked.\n");
} else {
bool_t anythingtodo = !skipold;
r = updates_downloadlists(methoddir,run,distributions,skipold,&anythingtodo);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(result) ) {
aptmethod_shutdown(run);
return result;
}
/* TODO:
* add a check if some of the upstreams without Release files
* are unchanged and if this changes anything? */
if( !anythingtodo ) {
fprintf(stderr,"Nothing to do found. (Use --noskipold to force processing)\n");
aptmethod_shutdown(run);
if( RET_IS_OK(result) )
return RET_NOTHING;
else
return result;
}
}
/* Call ListHooks (if given) on the downloaded index files.
* (This is done even when nolistsdownload is given, as otherwise
* the filename to look in is not changed) */
r = updates_calllisthooks(distributions);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(result) ) {
aptmethod_shutdown(run);
return result;
}
if( verbose > 0 )
fprintf(stderr,"Shutting down aptmethods...\n");
r = aptmethod_shutdown(run);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(result) ) {
return result;
}
if( verbose >= 0 )
fprintf(stderr,"Removing obsolete or to be replaced packages...\n");
for( d=distributions ; d != NULL ; d=d->next) {
struct update_target *u;
for( u=d->targets ; u != NULL ; u=u->next ) {
r = searchformissing(dbdir,u);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(r) ) {
u->incomplete = TRUE;
continue;
}
if( u->nothingnew || u->ignoredelete ) {
upgradelist_free(u->upgradelist);
u->upgradelist = NULL;
continue;
}
r = upgradelist_predelete(u->upgradelist,dbdir,refs,dereferencedfilekeys);
RET_UPDATE(d->distribution->status, r);
if( RET_WAS_ERROR(r) )
u->incomplete = TRUE;
RET_UPDATE(result,r);
upgradelist_free(u->upgradelist);
u->upgradelist = NULL;
if( RET_WAS_ERROR(r) )
return r;
}
}
return result;
}
static retvalue singledistributionupdate(const char *dbdir,const char *methoddir,filesdb filesdb,references refs,struct update_distribution *d,bool_t nolistsdownload,bool_t skipold, struct strlist *dereferencedfilekeys) {
struct aptmethodrun *run;
struct downloadcache *cache;
......
......@@ -36,5 +36,6 @@ retvalue updates_clearlists(const char *listdir,struct update_distribution *dist
retvalue updates_update(const char *dbdir,const char *methoddir,filesdb filesdb,references refs,struct update_distribution *distributions,bool_t nolistsdownload,bool_t skipold,struct strlist *dereferencedfilekeys);
retvalue updates_iteratedupdate(const char *confdir,const char *dbdir,const char *distdir,const char *methoddir,filesdb filesdb,references refs,struct update_distribution *distributions,bool_t nolistsdownload,bool_t skipold,struct strlist *dereferencedfilekeys, enum exportwhen export);
retvalue updates_checkupdate(const char *dbdir,const char *methoddir,struct update_distribution *distributions,bool_t nolistsdownload,bool_t skipold);
retvalue updates_predelete(const char *dbdir,const char *methoddir,references refs,struct update_distribution *distributions,bool_t nolistsdownload,bool_t skipold,struct strlist *dereferencedfilekeys);
#endif
......@@ -518,7 +518,10 @@ retvalue upgradelist_predelete(struct upgradelist *upgrade,const char *dbdir,ref
for( pkg = upgrade->list ; pkg != NULL ; pkg = pkg->next ) {
if( pkg->version_in_use != NULL &&
(pkg->version == pkg->new_version || pkg->deleted)) {
r = target_removepackage(upgrade->target,refs,pkg->name,dereferencedfilekeys,NULL);
if( interupted() )
r = RET_ERROR_INTERUPTED;
else
r = target_removepackage(upgrade->target,refs,pkg->name,dereferencedfilekeys,NULL);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(r))
break;
......
......@@ -48,4 +48,7 @@ retvalue upgradelist_enqueue(struct upgradelist *upgrade,struct downloadcache *c
retvalue upgradelist_install(struct upgradelist *upgrade,const char *dbdir,filesdb files,references refs, bool_t ignoredelete, struct strlist *dereferencedfilekeys);
/* remove all packages that would either be removed or upgraded by an upgrade */
retvalue upgradelist_predelete(struct upgradelist *upgrade,const char *dbdir,references refs,struct strlist *dereferencedfilekeys);
#endif
......@@ -2,11 +2,13 @@
stupid-db3
Memcheck:Param
pwrite64(buf)
obj:/lib/libc-2.3.2.so
fun:pwrite64
fun:__os_io
fun:__memp_pgwrite
obj:/usr/lib/libdb3.so.3.0.2
fun:memp_fsync
obj:/usr/lib/libdb-4.3.so
fun:__memp_bhwrite
fun:__memp_sync_int
fun:__memp_fsync
fun:__db_sync
}
{
libz-looking-far
......
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