Commit ab558ddd authored by Bernhard Link's avatar Bernhard Link

add dumpupdate and dumppull (like check*, but more easily parseable)

parent efb0c330
2008-11-13
* add dumpupdate and dumppull actions that are like checkupdate and
checkpull but with less information but that more easily parseable.
2008-11-04
* fix parsing error of contents of very big .deb files.
Thanks to Aramian Wasielak and Alexander Perlis.
......
......@@ -402,6 +402,11 @@ Same like
.BR update ,
but will show what it will change instead of actually changing it.
.TP
.BR dumpupdate " [ " \fIcodenames\fP " ]"
Same like
.BR checkupdate ,
but less suiteable for humans and more suitable for computers.
.TP
.BR predelete " [ " \fIcodenames\fP " ]"
This will determine which packages a \fBupdate\fP would delete or
replace and remove those packages.
......@@ -437,6 +442,11 @@ Same like
.BR pull ,
but will show what it will change instead of actually changing it.
.TP
.BR dumppull " [ " \fIcodenames\fP " ]"
Same like
.BR checkpull ,
but less suiteable for humans and more suitable for computers.
.TP
.B includedeb \fIcodename\fP \fI.deb-filename\fP
Include the given binary Debian package (.deb) in the specified
distribution, applying override information and guessing all
......
......@@ -1216,6 +1216,48 @@ ACTION_B(n, n, y, checkupdate) {
return result;
}
ACTION_B(n, n, y, dumpupdate) {
retvalue result;
struct update_pattern *patterns;
struct update_distribution *u_distributions;
result = dirs_make_recursive(global.listdir);
if( RET_WAS_ERROR(result) ) {
return result;
}
result = distribution_match(alldistributions, argc-1, argv+1, false);
assert( result != RET_NOTHING);
if( RET_WAS_ERROR(result) )
return result;
result = updates_getpatterns(&patterns);
if( RET_WAS_ERROR(result) ) {
return result;
}
result = updates_calcindices(patterns, alldistributions, fast,
&u_distributions);
if( !RET_IS_OK(result) ) {
if( result == RET_NOTHING ) {
if( argc == 1 )
fputs("Nothing to do, because no distribution has an Updates: field.\n", stderr);
else
fputs("Nothing to do, because none of the selected distributions has an Update: field.\n", stderr);
}
updates_freepatterns(patterns);
return result;
}
result = updates_dumpupdate(database, u_distributions,
nolistsdownload, skipold);
updates_freeupdatedistributions(u_distributions);
updates_freepatterns(patterns);
return result;
}
ACTION_C(n, n, cleanlists) {
#warning TODO: do not forget to implement this...
// TODO: when this is implemented, also log the database?
......@@ -1287,6 +1329,35 @@ ACTION_B(n, n, y, checkpull) {
return result;
}
ACTION_B(n, n, y, dumppull) {
retvalue result;
struct pull_rule *rules;
struct pull_distribution *p;
result = distribution_match(alldistributions, argc-1, argv+1, false);
assert( result != RET_NOTHING );
if( RET_WAS_ERROR(result) )
return result;
result = pull_getrules(&rules);
if( RET_WAS_ERROR(result) ) {
return result;
}
assert( RET_IS_OK(result) );
result = pull_prepare(alldistributions, rules, fast, &p);
if( RET_WAS_ERROR(result) ) {
pull_freerules(rules);
return result;
}
result = pull_dumpupdate(database, p);
pull_freerules(rules);
pull_freedistributions(p);
return result;
}
ACTION_D(y, n, y, copy) {
struct distribution *destination, *source;
retvalue result, r;
......@@ -2603,6 +2674,8 @@ static const struct action {
0, -1, "update [<distributions>]"},
{"checkupdate", A_B(checkupdate),
0, -1, "checkupdate [<distributions>]"},
{"dumpupdate", A_B(dumpupdate),
0, -1, "dumpupdate [<distributions>]"},
{"predelete", A_D(predelete),
0, -1, "predelete [<distributions>]"},
{"pull", A_D(pull),
......@@ -2619,6 +2692,8 @@ static const struct action {
3, -1, "[-C <component> ] [-A <architecture>] [-T <packagetype>] restoresrc <distribution> <snapshot-name> <source-package-name> [<source versions>]"},
{"restorefilter", A_Dact(restorefilter),
3, 3, "[-C <component> ] [-A <architecture>] [-T <packagetype>] restorefilter <distribution> <snapshot-name> <formula>"},
{"dumppull", A_B(dumppull),
0, -1, "dumppull [<distributions>]"},
{"checkpull", A_B(checkpull),
0, -1, "checkpull [<distributions>]"},
{"includedeb", A_Dactsp(includedeb)|NEED_DELNEW,
......
......@@ -676,11 +676,11 @@ static upgrade_decision ud_decide_by_rule(void *privdata, const char *package,UN
return UD_UPGRADE;
}
static inline retvalue pull_searchformissing(FILE *out,struct database *database,struct pull_target *p) {
static inline retvalue pull_searchformissing(/*@null@*/FILE *out,struct database *database,struct pull_target *p) {
struct pull_source *source;
retvalue result,r;
if( verbose > 2 )
if( verbose > 2 && out != NULL )
fprintf(out," pulling into '%s'\n",p->target->identifier);
assert(p->upgradelist == NULL);
r = upgradelist_initialize(&p->upgradelist, p->target, database);
......@@ -692,7 +692,7 @@ static inline retvalue pull_searchformissing(FILE *out,struct database *database
for( source=p->sources ; source != NULL ; source=source->next ) {
if( source->rule == NULL ) {
if( verbose > 4 )
if( verbose > 4 && out != NULL )
fprintf(out," marking everything to be deleted\n");
r = upgradelist_deleteall(p->upgradelist);
RET_UPDATE(result,r);
......@@ -702,13 +702,13 @@ static inline retvalue pull_searchformissing(FILE *out,struct database *database
continue;
}
if( verbose > 4 )
if( verbose > 4 && out != NULL )
fprintf(out," looking what to get from '%s'\n",
source->source->identifier);
r = upgradelist_pull(p->upgradelist,
source->source,
ud_decide_by_rule, source->rule,
database);
database, source);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(r) )
return result;
......@@ -717,7 +717,7 @@ static inline retvalue pull_searchformissing(FILE *out,struct database *database
return result;
}
static retvalue pull_search(FILE *out,struct database *database,struct pull_distribution *d) {
static retvalue pull_search(/*@null@*/FILE *out,struct database *database,struct pull_distribution *d) {
retvalue result,r;
struct pull_target *u;
......@@ -766,14 +766,108 @@ static retvalue pull_install(struct database *database, struct pull_distribution
return result;
}
static void pull_dumppackage(const char *packagename, /*@null@*/const char *oldversion, /*@null@*/const char *newversion, /*@null@*/const char *bestcandidate, /*@null@*/const struct strlist *newfilekeys, /*@null@*/const char *newcontrol, void *privdata) {
struct pull_source *source = privdata;
if( newversion == NULL ) {
if( oldversion != NULL && bestcandidate != NULL ) {
printf("'%s': '%s' will be deleted"
" (best new: '%s')\n",
packagename, oldversion, bestcandidate);
} else if( oldversion != NULL ) {
printf("'%s': '%s' will be deleted"
" (no longer available)\n",
packagename, oldversion);
} else {
printf("'%s': will NOT be added as '%s'\n",
packagename, bestcandidate);
}
} else if( newversion == oldversion ) {
if( bestcandidate != NULL ) {
if( verbose > 1 )
printf("'%s': '%s' will be kept"
" (best new: '%s')\n",
packagename, oldversion,
bestcandidate);
} else {
if( verbose > 0 )
printf("'%s': '%s' will be kept"
" (unavailable for reload)\n",
packagename, oldversion);
}
} else {
const char *via = source->rule->name;
assert( newfilekeys != NULL );
assert( newcontrol != NULL );
if( oldversion != NULL )
(void)printf("'%s': '%s' will be upgraded"
" to '%s' (from '%s'):\n files needed: ",
packagename, oldversion,
newversion, via);
else
(void)printf("'%s': newly installed"
" as '%s' (from '%s'):\n files needed: ",
packagename, newversion, via);
(void)strlist_fprint(stdout, newfilekeys);
if( verbose > 2)
(void)printf("\n installing as: '%s'\n",
newcontrol);
else
(void)putchar('\n');
}
}
static void pull_dump(struct pull_distribution *distribution) {
struct pull_target *u;
for( u=distribution->targets ; u != NULL ; u=u->next ) {
if( u->upgradelist == NULL )
continue;
printf("Updates needed for '%s':\n",u->target->identifier);
upgradelist_dump(u->upgradelist);
printf("Updates needed for '%s':\n", u->target->identifier);
upgradelist_dump(u->upgradelist, pull_dumppackage);
upgradelist_free(u->upgradelist);
u->upgradelist = NULL;
}
}
static void pull_dumplistpackage(const char *packagename, /*@null@*/const char *oldversion, /*@null@*/const char *newversion, /*@null@*/const char *bestcandidate, /*@null@*/const struct strlist *newfilekeys, /*@null@*/const char *newcontrol, void *privdata) {
struct pull_source *source = privdata;
if( newversion == NULL ) {
if( oldversion == NULL )
return;
printf("delete '%s' '%s'\n", packagename, oldversion);
} else if( newversion == oldversion ) {
if( bestcandidate != NULL )
printf("keep '%s' '%s' '%s'\n", packagename,
oldversion, bestcandidate);
else
printf("keep '%s' '%s' unavailable\n", packagename,
oldversion);
} else {
const char *via = source->rule->name;
assert( newfilekeys != NULL );
assert( newcontrol != NULL );
if( oldversion != NULL )
(void)printf("update '%s' '%s' '%s' '%s'\n",
packagename, oldversion,
newversion, via);
else
(void)printf("add '%s' - '%s' '%s'\n",
packagename, newversion, via);
}
}
static void pull_dumplist(struct pull_distribution *distribution) {
struct pull_target *u;
for( u=distribution->targets ; u != NULL ; u=u->next ) {
if( u->upgradelist == NULL )
continue;
printf("Updates needed for '%s':\n", u->target->identifier);
upgradelist_dump(u->upgradelist, pull_dumplistpackage);
upgradelist_free(u->upgradelist);
u->upgradelist = NULL;
}
......@@ -845,3 +939,19 @@ retvalue pull_checkupdate(struct database *database, struct pull_distribution *d
return result;
}
retvalue pull_dumpupdate(struct database *database, struct pull_distribution *distributions) {
struct pull_distribution *d;
retvalue result,r;
result = RET_NOTHING;
for( d=distributions ; d != NULL ; d=d->next) {
r = pull_search(NULL, database, d);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(r) )
break;
pull_dumplist(d);
}
return result;
}
......@@ -25,6 +25,7 @@ void pull_freedistributions(/*@only@*/struct pull_distribution *p);
retvalue pull_prepare(struct distribution *, struct pull_rule *, bool fast, /*@out@*/struct pull_distribution **);
retvalue pull_update(struct database *, struct pull_distribution *);
retvalue pull_checkupdate(struct database *,struct pull_distribution *);
retvalue pull_checkupdate(struct database *, struct pull_distribution *);
retvalue pull_dumpupdate(struct database *, struct pull_distribution *);
#endif
......@@ -239,6 +239,15 @@ EOF
checknolog logab
dogrep "Version: 1-1" dists/a/all/binary-${FAKEARCHITECTURE}/Packages
rm -r dists/a
testout - -b . dumppull b 3<<EOF
stderr
EOF
cat > results.expected <<EOF
Updates needed for 'b|all|abacus':
add 'aa' - '1-1' 'froma'
add 'aa-addons' - '1-1' 'froma'
EOF
dodiff results results.expected
testrun - -b . --export=changed pull a b 3<<EOF
stdout
-v0*=Calculating packages to pull...
......@@ -326,6 +335,15 @@ Files:
END
if $tracking; then dodiff results.expected results ; else dodiff results.empty results ; fi
rm -r dists/a dists/b
testout - -b . dumppull b 3<<EOF
stderr
EOF
cat > results.expected <<EOF
Updates needed for 'b|all|abacus':
update 'aa' '1-1' '1-2' 'froma'
update 'aa-addons' '1-1' '1-2' 'froma'
EOF
dodiff results results.expected
testrun - -b . --export=changed pull a b 3<<EOF
stderr
stdout
......@@ -444,6 +462,18 @@ DATESTR add a deb all ${FAKEARCHITECTURE} ab-addons 2-1
DATESTR add a deb all ${FAKEARCHITECTURE} ab 2-1
DATESTR add a dsc all source ab 2-1
EOF
testout - -b . dumppull b 3<<EOF
stderr
EOF
cat > results.expected <<EOF
Updates needed for 'b|all|abacus':
update 'aa' '1-2' '1-3' 'froma'
update 'aa-addons' '1-2' '1-3' 'froma'
add 'ab' - '2-1' 'froma'
add 'ab-addons' - '2-1' 'froma'
EOF
dodiff results results.expected
testrun - -b . --export=changed pull b 3<<EOF
stderr
stdout
......@@ -474,6 +504,17 @@ DATESTR replace b deb all ${FAKEARCHITECTURE} aa-addons 1-3 1-2
DATESTR add b deb all ${FAKEARCHITECTURE} ab 2-1
DATESTR add b deb all ${FAKEARCHITECTURE} ab-addons 2-1
EOF
testout - -b . dumppull b 3<<EOF
stderr
EOF
cat > results.expected <<EOF
Updates needed for 'b|all|abacus':
keep 'aa' '1-3' '1-3'
keep 'aa-addons' '1-3' '1-3'
keep 'ab' '2-1' '2-1'
keep 'ab-addons' '2-1' '2-1'
EOF
dodiff results results.expected
dogrep "Version: 1-3" dists/b/all/binary-${FAKEARCHITECTURE}/Packages
dogrep "Version: 2-1" dists/b/all/binary-${FAKEARCHITECTURE}/Packages
test ! -f pool/all/a/aa/aa_1-2_${FAKEARCHITECTURE}.deb
......@@ -696,8 +737,7 @@ VerifyRelease: blindtrust
Suite: a
ListHook: /bin/cp
END
testrun - -b . predelete b 3<<EOF
=WARNING: Single-Instance not yet supported!
testout - -b . dumpupdate b 3<<EOF
-v6*=aptmethod start 'copy:$WORKDIR/dists/a/Release'
-v1*=aptmethod got 'copy:$WORKDIR/dists/a/Release'
-v6*=aptmethod start 'copy:$WORKDIR/dists/a/all/binary-${FAKEARCHITECTURE}/Packages.gz'
......@@ -705,6 +745,23 @@ testrun - -b . predelete b 3<<EOF
-v2*=Uncompress './lists/froma_a_all_${FAKEARCHITECTURE}_Packages.gz' into './lists/froma_a_all_${FAKEARCHITECTURE}_Packages' using '/bin/gunzip'...
-v6*=Called /bin/cp './lists/froma_a_all_${FAKEARCHITECTURE}_Packages' './lists/_b_all_${FAKEARCHITECTURE}_froma_froma_a_all_${FAKEARCHITECTURE}_Packages'
-v6*=Listhook successfully returned!
EOF
cat > results.expected <<EOF
Updates needed for 'b|all|abacus':
keep 'aa' '1-3' '1-3'
keep 'aa-addons' '1-3' '1-3'
update 'ab' '2-1' '3-1' 'froma'
update 'ab-addons' '2-1' '3-1' 'froma'
delete 'ac' '1-1'
delete 'ac-addons' '1-1'
EOF
dodiff results.expected results
testrun - -b . predelete b 3<<EOF
=WARNING: Single-Instance not yet supported!
-v6*=aptmethod start 'copy:$WORKDIR/dists/a/Release'
-v1*=aptmethod got 'copy:$WORKDIR/dists/a/Release'
-v6*=Called /bin/cp './lists/froma_a_all_${FAKEARCHITECTURE}_Packages' './lists/_b_all_${FAKEARCHITECTURE}_froma_froma_a_all_${FAKEARCHITECTURE}_Packages'
-v6*=Listhook successfully returned!
stdout
-v0*=Removing obsolete or to be replaced packages...
-v3*= processing updates for 'b|all|${FAKEARCHITECTURE}'
......@@ -737,6 +794,20 @@ stdout
-d1*=db: 'pool/all/a/ac/ac-addons_1-1_all.deb' removed from checksums.db(pool).
-v2*=removed now empty directory ./pool/all/a/ac
EOF
testout - -b . dumpupdate b 3<<EOF
-v6*=aptmethod start 'copy:$WORKDIR/dists/a/Release'
-v1*=aptmethod got 'copy:$WORKDIR/dists/a/Release'
-v6*=Called /bin/cp './lists/froma_a_all_${FAKEARCHITECTURE}_Packages' './lists/_b_all_${FAKEARCHITECTURE}_froma_froma_a_all_${FAKEARCHITECTURE}_Packages'
-v6*=Listhook successfully returned!
EOF
cat > results.expected <<EOF
Updates needed for 'b|all|abacus':
keep 'aa' '1-3' '1-3'
keep 'aa-addons' '1-3' '1-3'
add 'ab' - '3-1' 'froma'
add 'ab-addons' - '3-1' 'froma'
EOF
dodiff results.expected results
checklog logab <<EOF
DATESTR remove b deb all ${FAKEARCHITECTURE} ab 2-1
DATESTR remove b deb all ${FAKEARCHITECTURE} ab-addons 2-1
......@@ -888,6 +959,14 @@ DATESTR remove a deb all ${FAKEARCHITECTURE} ab-addons 3-1
DATESTR remove a dsc all source ab 3-1
EOF
fi
testout "" --keepunreferenced --dbdir db2 dumppull
cat > results.expected <<EOF
Updates needed for 'b|all|abacus':
keep 'aa' '1-3' '1-3'
keep 'aa-addons' '1-3' '1-3'
keep 'ab' '3-1' unavailable
EOF
dodiff results.expected results
testrun - --keepunreferenced --dbdir db2 -b . removefilter b "Version (== 1-3), Package (>> aa)" 3<<EOF
stdout
-v1*=removing 'aa-addons' from 'b|all|${FAKEARCHITECTURE}'...
......@@ -899,6 +978,14 @@ EOF
checklog logab <<EOF
DATESTR remove b deb all ${FAKEARCHITECTURE} aa-addons 1-3
EOF
testout "" --keepunreferenced --dbdir db2 dumppull
cat > results.expected <<EOF
Updates needed for 'b|all|abacus':
keep 'aa' '1-3' '1-3'
add 'aa-addons' - '1-3' 'froma'
keep 'ab' '3-1' unavailable
EOF
dodiff results.expected results
if $tracking ; then
testrun - -b . --delete removealltracks a 3<<EOF
stdout
......
......@@ -1346,22 +1346,22 @@ static upgrade_decision ud_decide_by_pattern(void *privdata, const char *package
}
static inline retvalue searchformissing(FILE *out,struct database *database,struct update_target *u) {
static inline retvalue searchformissing(/*@null@*/FILE *out,struct database *database,struct update_target *u) {
struct update_index_connector *uindex;
retvalue result,r;
if( u->nothingnew ) {
if( u->indices == NULL && verbose >= 4 )
if( u->indices == NULL && verbose >= 4 && out != NULL)
fprintf(out,
" nothing to do for '%s'\n",
u->target->identifier);
else if( u->indices != NULL && verbose >= 0 )
else if( u->indices != NULL && verbose >= 0 && out != NULL)
fprintf(out,
" nothing new for '%s' (use --noskipold to process anyway)\n",
u->target->identifier);
return RET_NOTHING;
}
if( verbose > 2 )
if( verbose > 2 && out != NULL)
fprintf(out," processing updates for '%s'\n",u->target->identifier);
r = upgradelist_initialize(&u->upgradelist, u->target, database);
if( RET_WAS_ERROR(r) )
......@@ -1373,7 +1373,7 @@ static inline retvalue searchformissing(FILE *out,struct database *database,stru
const char *filename;
if( uindex->origin == NULL ) {
if( verbose > 4 )
if( verbose > 4 && out != NULL)
fprintf(out," marking everything to be deleted\n");
r = upgradelist_deleteall(u->upgradelist);
if( RET_WAS_ERROR(r) )
......@@ -1398,7 +1398,7 @@ static inline retvalue searchformissing(FILE *out,struct database *database,stru
continue;
}
if( verbose > 4 )
if( verbose > 4 && out != NULL)
fprintf(out," reading '%s'\n", filename);
r = upgradelist_update(u->upgradelist, uindex,
filename,
......@@ -1417,7 +1417,7 @@ static inline retvalue searchformissing(FILE *out,struct database *database,stru
return result;
}
static retvalue updates_readindices(FILE *out,struct database *database,struct update_distribution *d) {
static retvalue updates_readindices(/*@null@*/FILE *out,struct database *database,struct update_distribution *d) {
retvalue result,r;
struct update_target *u;
......@@ -1761,6 +1761,58 @@ retvalue updates_update(struct database *database, struct update_distribution *d
* done. (For the checkupdate command) *
****************************************************************************/
static void upgrade_dumppackage(const char *packagename, /*@null@*/const char *oldversion, /*@null@*/const char *newversion, /*@null@*/const char *bestcandidate, /*@null@*/const struct strlist *newfilekeys, /*@null@*/const char *newcontrol, void *privdata) {
struct update_index_connector *uindex = privdata;
if( newversion == NULL ) {
if( oldversion != NULL && bestcandidate != NULL ) {
printf("'%s': '%s' will be deleted"
" (best new: '%s')\n",
packagename, oldversion, bestcandidate);
} else if( oldversion != NULL ) {
printf("'%s': '%s' will be deleted"
" (no longer available)\n",
packagename, oldversion);
} else {
printf("'%s': will NOT be added as '%s'\n",
packagename, bestcandidate);
}
} else if( newversion == oldversion ) {
if( bestcandidate != NULL ) {
if( verbose > 1 )
printf("'%s': '%s' will be kept"
" (best new: '%s')\n",
packagename, oldversion,
bestcandidate);
} else {
if( verbose > 0 )
printf("'%s': '%s' will be kept"
" (unavailable for reload)\n",
packagename, oldversion);
}
} else {
const char *via = uindex->origin->pattern->name;
assert( newfilekeys != NULL );
assert( newcontrol != NULL );
if( oldversion != NULL )
(void)printf("'%s': '%s' will be upgraded"
" to '%s' (from '%s'):\n files needed: ",
packagename, oldversion,
newversion, via);
else
(void)printf("'%s': newly installed"
" as '%s' (from '%s'):\n files needed: ",
packagename, newversion, via);
(void)strlist_fprint(stdout, newfilekeys);
if( verbose > 2)
(void)printf("\n installing as: '%s'\n",
newcontrol);
else
(void)putchar('\n');
}
}
static void updates_dump(struct update_distribution *distribution) {
struct update_target *u;
......@@ -1768,7 +1820,49 @@ static void updates_dump(struct update_distribution *distribution) {
if( u->nothingnew )
continue;
printf("Updates needed for '%s':\n",u->target->identifier);
upgradelist_dump(u->upgradelist);
upgradelist_dump(u->upgradelist, upgrade_dumppackage);
upgradelist_free(u->upgradelist);
u->upgradelist = NULL;
}
}
static void upgrade_dumplistpackage(const char *packagename, /*@null@*/const char *oldversion, /*@null@*/const char *newversion, /*@null@*/const char *bestcandidate, /*@null@*/const struct strlist *newfilekeys, /*@null@*/const char *newcontrol, void *privdata) {
struct update_index_connector *uindex = privdata;
if( newversion == NULL ) {
if( oldversion == NULL )
return;
printf("delete '%s' '%s'\n", packagename, oldversion);
} else if( newversion == oldversion ) {
if( bestcandidate != NULL )
printf("keep '%s' '%s' '%s'\n", packagename,
oldversion, bestcandidate);
else
printf("keep '%s' '%s' unavailable\n", packagename,
oldversion);
} else {
const char *via = uindex->origin->pattern->name;
assert( newfilekeys != NULL );
assert( newcontrol != NULL );
if( oldversion != NULL )
(void)printf("update '%s' '%s' '%s' '%s'\n",
packagename, oldversion,
newversion, via);
else
(void)printf("add '%s' - '%s' '%s'\n",
packagename, newversion, via);
}
}
static void updates_dumplist(struct update_distribution *distribution) {
struct update_target *u;
for( u=distribution->targets ; u != NULL ; u=u->next ) {
if( u->nothingnew )
continue;
printf("Updates needed for '%s':\n", u->target->identifier);
upgradelist_dump(u->upgradelist, upgrade_dumplistpackage);
upgradelist_free(u->upgradelist);
u->upgradelist = NULL;
}
......@@ -1806,6 +1900,32 @@ retvalue updates_checkupdate(struct database *database, struct update_distributi
return result;
}
retvalue updates_dumpupdate(struct database *database, struct update_distribution *distributions, bool nolistsdownload, bool skipold) {
struct update_distribution *d;
retvalue result,r;
struct aptmethodrun *run IFSTUPIDCC(=NULL);
result = updates_prepare(distributions, false, nolistsdownload, skipold, &run);
if( !RET_IS_OK(result) )
return result;
r = aptmethod_shutdown(run);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(result) ) {
return result;
}
for( d=distributions ; d != NULL ; d=d->next) {
r = updates_readindices(NULL, database, d);
RET_UPDATE(result,r);
if( RET_WAS_ERROR(r) )
break;
updates_dumplist(d);
}
return result;
}
/******************************************************************************
* For the predelete command: delete everything a following update run would *
* delete. (Assuming no unexpected errors occur, like a file missing upstream.*
......
......@@ -33,6 +33,7 @@ retvalue updates_calcindices(struct update_pattern *, struct distribution *, boo
retvalue updates_update(struct database *, struct update_distribution *, bool nolistsdownload, bool skipold, enum spacecheckmode mode, off_t reserveddb, off_t reservedother);
retvalue updates_checkupdate(struct database *, struct update_distribution *, bool nolistsdownload, bool skipold);
retvalue updates_dumpupdate(struct database *, struct update_distribution *, bool nolistsdownload, bool skipold);
retvalue updates_predelete(struct database *, struct update_distribution *, bool nolistsdownload, bool skipold);
#endif
......@@ -467,7 +467,7 @@ retvalue upgradelist_update(struct upgradelist *upgrade, void *privdata, const c
return result;
}
retvalue upgradelist_pull(struct upgradelist *upgrade,struct target *source,upgrade_decide_function *predecide,void *decide_data,struct database *database) {
retvalue upgradelist_pull(struct upgradelist *upgrade, struct target *source, upgrade_decide_function *predecide, void *decide_data, struct database *database, void *privdata) {
retvalue result, r;
const char *package, *control;
struct target_cursor iterator;
......@@ -492,7 +492,7 @@ retvalue upgradelist_pull(struct upgradelist *upgrade,struct target *source,upgr
RET_UPDATE(result, r);
break;
}
r = upgradelist_trypackage(upgrade, NULL,
r = upgradelist_trypackage(upgrade, privdata,
predecide, decide_data,
package, NULL, version,
package_architecture, control);
......@@ -638,7 +638,7 @@ retvalue upgradelist_install(struct upgradelist *upgrade, struct logger *logger,
return result;
}
void upgradelist_dump(struct upgradelist *upgrade){
void upgradelist_dump(struct upgradelist *upgrade, dumpaction action){
struct package_data *pkg;
assert(upgrade != NULL);
......@@ -646,56 +646,19 @@ void upgradelist_dump(struct upgradelist *upgrade){
for( pkg = upgrade->list ; pkg != NULL ; pkg = pkg->next ) {
if( interrupted() )
return;
if( pkg->deleted ) {
if( pkg->version_in_use != NULL &&
pkg->new_version != NULL ) {
printf("'%s': '%s' will be deleted"
" (best new: '%s')\n",
pkg->name,pkg->version_in_use,
pkg->new_version);
} else if( pkg->version_in_use != NULL ) {
printf("'%s': '%s' will be deleted"
" (no longer available)\n",
pkg->name,pkg->version_in_use);
} else {
printf("'%s': will NOT be added as '%s'\n",
pkg->name,pkg->new_version);
}
} else {
if( pkg->version == pkg->version_in_use ) {
if( pkg->new_version != NULL ) {
if( verbose > 1 )
printf("'%s': '%s' will be kept"
" (best new: '%s')\n",
pkg->name,pkg->version_in_use,
pkg->new_version);
} else {
if( verbose > 0 )
printf("'%s': '%s' will be kept"
" (unavailable for reload)\n",
pkg->name,pkg->version_in_use);
}
} else {
if( pkg->version_in_use != NULL )
(void)printf("'%s': '%s' will be upgraded"
" to '%s':\n files needed: ",
pkg->name,pkg->version_in_use,
pkg->new_version);
else