Skip to content

Commit

Permalink
Drop self-provide retrofitting on v3 packages
Browse files Browse the repository at this point in the history
Packages built with rpm <= 3.0.4 or so did not explicitly provide their
own name = version-release, so newer versions retrofitted that to
be able to assume it in the general operation (makes things simple as
you only need to look at provides). Since we no longer support
installing such packages, satisfying their dependencies is not relevant.
  • Loading branch information
pmatilai committed Sep 17, 2024
1 parent 3e24b09 commit a15d9b6
Showing 1 changed file with 0 additions and 65 deletions.
65 changes: 0 additions & 65 deletions lib/headerutil.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,66 +326,6 @@ static void expandFilelist(Header h)
(void) headerDel(h, RPMTAG_DIRINDEXES);
}

/*
* Up to rpm 3.0.4, packages implicitly provided their own name-version-release.
* Retrofit an explicit "Provides: name = epoch:version-release.
*/
static void providePackageNVR(Header h)
{
const char *name = headerGetString(h, RPMTAG_NAME);
char *pEVR = headerGetAsString(h, RPMTAG_EVR);
rpmsenseFlags pFlags = RPMSENSE_EQUAL;
int bingo = 1;
struct rpmtd_s pnames;
rpmds hds, nvrds;

/* Generate provides for this package name-version-release. */
if (!(name && pEVR)) {
free(pEVR);
return;
}

/*
* Rpm prior to 3.0.3 does not have versioned provides.
* If no provides at all are available, we can just add.
*/
if (!headerGet(h, RPMTAG_PROVIDENAME, &pnames, HEADERGET_MINMEM)) {
goto exit;
}

/*
* Otherwise, fill in entries on legacy packages.
*/
if (!headerIsEntry(h, RPMTAG_PROVIDEVERSION)) {
while (rpmtdNext(&pnames) >= 0) {
rpmsenseFlags fdummy = RPMSENSE_ANY;

headerPutString(h, RPMTAG_PROVIDEVERSION, "");
headerPutUint32(h, RPMTAG_PROVIDEFLAGS, &fdummy, 1);
}
goto exit;
}

/* see if we already have this provide */
hds = rpmdsNew(h, RPMTAG_PROVIDENAME, 0);
nvrds = rpmdsSingle(RPMTAG_PROVIDENAME, name, pEVR, pFlags);
if (rpmdsFind(hds, nvrds) >= 0) {
bingo = 0;
}
rpmdsFree(hds);
rpmdsFree(nvrds);


exit:
if (bingo) {
headerPutString(h, RPMTAG_PROVIDENAME, name);
headerPutString(h, RPMTAG_PROVIDEVERSION, pEVR);
headerPutUint32(h, RPMTAG_PROVIDEFLAGS, &pFlags, 1);
}
rpmtdFreeData(&pnames);
free(pEVR);
}

static void legacyRetrofit(Header h)
{
/*
Expand All @@ -395,11 +335,6 @@ static void legacyRetrofit(Header h)
* the new style (this is a noop for new headers).
*/
compressFilelist(h);

/* Retrofit "Provide: name = EVR" for binary packages. */
if (!headerIsSource(h)) {
providePackageNVR(h);
}
}

int headerConvert(Header h, int op)
Expand Down

0 comments on commit a15d9b6

Please sign in to comment.