Commit 6bf899bc authored by Bernhard Link's avatar Bernhard Link

add 'supersede' as FilterList keyword to remove the old package if the the new...

add 'supersede' as FilterList keyword to remove the old package if the the new would be installed otherwise.
parent 51d42dd9
2012-03-25
* changelogs.example can now also place changelogs in places
where apt-get changelog looks for "third party site" changelogs.
* add 'supersede' as FilterList keyword to remove the old package
if the the new would be installed otherwise.
2012-01-23
* reject "any" as Architecture part of a distribution
......
......@@ -1627,6 +1627,13 @@ will be installed. Things listed as
or
.B purge
will be ignored.
Packages having
.B supersede
will not be installed but instead cause the removal of packages with strictly
smaller version (i.e. if a package would be replaced by this package if this
was
.BR install ,
it will be removed instead and no new package being installed).
Things listed with
.B warning
are also ignored,
......
......@@ -130,6 +130,8 @@ static inline retvalue filterlistfile_parse(struct filterlistfile *n, const char
type = flt_purge;
} else if (strcmp(what, "hold") == 0) {
type = flt_hold;
} else if (strcmp(what, "supersede") == 0) {
type = flt_supersede;
} else if (strcmp(what, "upgradeonly") == 0) {
type = flt_upgradeonly;
} else if (strcmp(what, "warning") == 0) {
......@@ -327,6 +329,7 @@ void filterlist_release(struct filterlist *list) {
static const struct constant filterlisttype_listtypes[] = {
{"install", (int)flt_install},
{"hold", (int)flt_hold},
{"supersede", (int)flt_supersede},
{"deinstall", (int)flt_deinstall},
{"purge", (int)flt_purge},
{"upgradeonly", (int)flt_upgradeonly},
......
......@@ -10,6 +10,7 @@ enum filterlisttype {
flt_warning,
flt_deinstall,
flt_hold,
flt_supersede,
flt_upgradeonly,
flt_error
};
......
......@@ -681,6 +681,9 @@ static upgrade_decision ud_decide_by_rule(void *privdata, const struct target *t
return UD_NO;
case flt_warning:
return UD_LOUDNO;
case flt_supersede:
decision = UD_SUPERSEDE;
break;
case flt_hold:
decision = UD_HOLD;
break;
......@@ -716,6 +719,9 @@ static upgrade_decision ud_decide_by_rule(void *privdata, const struct target *t
case flt_hold:
decision = UD_HOLD;
break;
case flt_supersede:
decision = UD_SUPERSEDE;
break;
case flt_error:
/* cannot yet be handled! */
fprintf(stderr,
......@@ -745,6 +751,9 @@ static upgrade_decision ud_decide_by_rule(void *privdata, const struct target *t
case flt_hold:
decision = UD_HOLD;
break;
case flt_supersede:
decision = UD_SUPERSEDE;
break;
case flt_error:
/* cannot yet be handled! */
fprintf(stderr,
......@@ -896,7 +905,7 @@ static void pull_dumppackage(const char *packagename, /*@null@*/const char *oldv
packagename, oldversion, bestcandidate);
} else if (oldversion != NULL) {
printf("'%s': '%s' will be deleted"
" (no longer available)\n",
" (no longer available or superseded)\n",
packagename, oldversion);
} else {
printf("'%s': will NOT be added as '%s'\n",
......
......@@ -196,7 +196,7 @@ struct update_origin {
/*@null@*/struct remote_distribution *from;
/* cache for flat mode */
bool flat;
/* set when there was a error and it should no loner be used */
/* set when there was a error and it should no longer be used */
bool failed;
};
......@@ -1644,6 +1644,9 @@ static upgrade_decision ud_decide_by_pattern(void *privdata, const struct target
return UD_NO;
case flt_warning:
return UD_LOUDNO;
case flt_supersede:
decision = UD_SUPERSEDE;
break;
case flt_hold:
decision = UD_HOLD;
break;
......@@ -1677,6 +1680,9 @@ static upgrade_decision ud_decide_by_pattern(void *privdata, const struct target
case flt_hold:
decision = UD_HOLD;
break;
case flt_supersede:
decision = UD_SUPERSEDE;
break;
case flt_error:
/* cannot yet be handled! */
fprintf(stderr,
......@@ -1703,6 +1709,9 @@ static upgrade_decision ud_decide_by_pattern(void *privdata, const struct target
return UD_NO;
case flt_warning:
return UD_LOUDNO;
case flt_supersede:
decision = UD_SUPERSEDE;
break;
case flt_hold:
decision = UD_HOLD;
break;
......@@ -2240,7 +2249,7 @@ static void upgrade_dumppackage(const char *packagename, /*@null@*/const char *o
packagename, oldversion, bestcandidate);
} else if (oldversion != NULL) {
printf("'%s': '%s' will be deleted"
" (no longer available)\n",
" (no longer available or superseded)\n",
packagename, oldversion);
} else {
printf("'%s': will NOT be added as '%s'\n",
......
......@@ -403,6 +403,11 @@ static retvalue upgradelist_trypackage(struct upgradelist *upgrade, void *privda
current->deleted = false;
free(version);
free(packagename);
/* while supersede will remove the current package */
if (decision == UD_SUPERSEDE) {
current->deleted = true;
return RET_OK;
}
return (decision==UD_ERROR)?RET_ERROR:RET_NOTHING;
}
......
......@@ -3,7 +3,7 @@
/* Things for making decisions what to upgrade and what not */
typedef enum { UD_ERROR, UD_LOUDNO, UD_NO, UD_UPGRADE, UD_HOLD } upgrade_decision;
typedef enum { UD_ERROR, UD_LOUDNO, UD_NO, UD_UPGRADE, UD_HOLD, UD_SUPERSEDE } upgrade_decision;
typedef upgrade_decision upgrade_decide_function(void *privdata, const struct target *, const char *package, const char *source, const char *old_version, const char *new_version, const char *new_src_version, const char *newcontrolchunk);
......
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