implent tilde support

OBS-URL: https://build.opensuse.org/package/show/Base:System/rpm?expand=0&rev=196
This commit is contained in:
Michael Schröder 2012-04-20 15:01:48 +00:00 committed by Git OBS Bridge
parent 3808a8e29c
commit 444a43896d
11 changed files with 350 additions and 12 deletions

View File

@ -37,9 +37,9 @@ Index: fileattrs/ksyms.attr
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ fileattrs/ksyms.attr 2011-12-15 13:47:26.787456907 +0100
@@ -0,0 +1,4 @@
+%__ksyms_provides %{__set_helper_env}%{_rpmconfigdir}/find-provides.ksyms %name
+%__ksyms_requires %{__set_helper_env}%{_rpmconfigdir}/find-requires.ksyms %name
+%__ksyms_supplements %{__set_helper_env}%{_rpmconfigdir}/find-supplements.ksyms %name
+%__ksyms_provides %{_rpmconfigdir}/find-provides.ksyms %name
+%__ksyms_requires %{_rpmconfigdir}/find-requires.ksyms %name
+%__ksyms_supplements %{_rpmconfigdir}/find-supplements.ksyms %name
+%__ksyms_path (/lib/modules/.*\.ko(\.gz)?)|(/boot/vmlinu[xz].*)$
Index: fileattrs/Makefile.am
===================================================================

147
headerchk2.diff Normal file
View File

@ -0,0 +1,147 @@
--- lib/header.c.orig 2012-04-17 16:16:29.000000000 +0000
+++ lib/header.c 2012-04-17 16:53:32.000000000 +0000
@@ -197,7 +197,7 @@ int headerVerifyInfo(int il, int dl, con
return i;
if (hdrchkAlign(info->type, info->offset))
return i;
- if (!negate && hdrchkRange(dl, info->offset))
+ if (hdrchkRange(dl, info->offset))
return i;
if (hdrchkData(info->count))
return i;
@@ -837,10 +837,13 @@ Header headerLoad(void * uh)
entry->info.type = htonl(pe->type);
entry->info.count = htonl(pe->count);
+ entry->info.tag = htonl(pe->tag);
- if (hdrchkType(entry->info.type))
+ if (!ENTRY_IS_REGION(entry))
goto errxit;
- if (hdrchkTags(entry->info.count))
+ if (entry->info.type != REGION_TAG_TYPE)
+ goto errxit;
+ if (entry->info.count != REGION_TAG_COUNT)
goto errxit;
{ int off = ntohl(pe->offset);
@@ -856,7 +859,6 @@ Header headerLoad(void * uh)
ril = rdl/sizeof(*pe);
if (hdrchkTags(ril) || hdrchkData(rdl))
goto errxit;
- entry->info.tag = htonl(pe->tag);
} else {
ril = il;
rdl = (ril * sizeof(struct entryInfo_s));
@@ -876,13 +878,12 @@ Header headerLoad(void * uh)
indexEntry newEntry = entry + ril;
int ne = (h->indexUsed - ril);
int rid = entry->info.offset+1;
- int rc;
/* Load dribble entries from region. */
- rc = regionSwab(newEntry, ne, 0, pe+ril, dataStart, dataEnd, rid);
- if (rc < 0)
+ rdlen = regionSwab(newEntry, ne, rdlen, pe+ril,
+ dataStart, dataEnd, rid);
+ if (rdlen < 0)
goto errxit;
- rdlen += rc;
{ indexEntry firstEntry = newEntry;
int save = h->indexUsed;
@@ -905,7 +906,7 @@ Header headerLoad(void * uh)
}
}
rdlen += REGION_TAG_COUNT;
- /* XXX should be equality test, but dribbles are sometimes a bit off? */
+ /* should be equality test, but can be off if entries are not perfectly aligned */
if (rdlen > dl)
goto errxit;
}
--- lib/package.c.orig 2012-04-17 16:26:00.000000000 +0000
+++ lib/package.c 2012-04-17 16:26:05.000000000 +0000
@@ -241,16 +241,23 @@ static rpmRC headerVerify(rpmKeyring key
}
/* Is there an immutable header region tag? */
- if (!(entry.info.tag == RPMTAG_HEADERIMMUTABLE
- && entry.info.type == RPM_BIN_TYPE
- && entry.info.count == REGION_TAG_COUNT))
- {
+ if (!(entry.info.tag == RPMTAG_HEADERIMMUTABLE)) {
rc = RPMRC_NOTFOUND;
goto exit;
}
- /* Is the offset within the data area? */
- if (entry.info.offset >= dl) {
+ /* Is the region tag sane? */
+ if (!(entry.info.type == REGION_TAG_TYPE &&
+ entry.info.count == REGION_TAG_COUNT)) {
+ rasprintf(&buf,
+ _("region tag: BAD, tag %d type %d offset %d count %d\n"),
+ entry.info.tag, entry.info.type,
+ entry.info.offset, entry.info.count);
+ goto exit;
+ }
+
+ /* Is the trailer within the data area? */
+ if (entry.info.offset + REGION_TAG_COUNT > dl) {
rasprintf(&buf,
_("region offset: BAD, tag %d type %d offset %d count %d\n"),
entry.info.tag, entry.info.type,
@@ -263,10 +270,10 @@ static rpmRC headerVerify(rpmKeyring key
(void) memcpy(&info, regionEnd, REGION_TAG_COUNT);
regionEnd += REGION_TAG_COUNT;
- xx = headerVerifyInfo(1, dl, &info, &entry.info, 1);
+ xx = headerVerifyInfo(1, il * sizeof(*pe), &info, &entry.info, 1);
if (xx != -1 ||
!(entry.info.tag == RPMTAG_HEADERIMMUTABLE
- && entry.info.type == RPM_BIN_TYPE
+ && entry.info.type == REGION_TAG_TYPE
&& entry.info.count == REGION_TAG_COUNT))
{
rasprintf(&buf,
--- lib/signature.c.orig 2012-04-17 16:25:52.000000000 +0000
+++ lib/signature.c 2012-04-17 16:26:05.000000000 +0000
@@ -133,12 +133,19 @@ rpmRC rpmReadSignature(FD_t fd, Header *
}
/* Is there an immutable header region tag? */
- if (entry.info.tag == RPMTAG_HEADERSIGNATURES
- && entry.info.type == RPM_BIN_TYPE
- && entry.info.count == REGION_TAG_COUNT)
- {
-
- if (entry.info.offset >= dl) {
+ if (entry.info.tag == RPMTAG_HEADERSIGNATURES) {
+ /* Is the region tag sane? */
+ if (!(entry.info.type == REGION_TAG_TYPE &&
+ entry.info.count == REGION_TAG_COUNT)) {
+ rasprintf(&buf,
+ _("region tag: BAD, tag %d type %d offset %d count %d\n"),
+ entry.info.tag, entry.info.type,
+ entry.info.offset, entry.info.count);
+ goto exit;
+ }
+
+ /* Is the trailer within the data area? */
+ if (entry.info.offset + REGION_TAG_COUNT > dl) {
rasprintf(&buf,
_("region offset: BAD, tag %d type %d offset %d count %d\n"),
entry.info.tag, entry.info.type,
@@ -157,10 +164,10 @@ rpmRC rpmReadSignature(FD_t fd, Header *
}
dataEnd += REGION_TAG_COUNT;
- xx = headerVerifyInfo(1, dl, &info, &entry.info, 1);
+ xx = headerVerifyInfo(1, il * sizeof(*pe), &info, &entry.info, 1);
if (xx != -1 ||
!((entry.info.tag == RPMTAG_HEADERSIGNATURES || entry.info.tag == RPMTAG_HEADERIMAGE)
- && entry.info.type == RPM_BIN_TYPE
+ && entry.info.type == REGION_TAG_TYPE
&& entry.info.count == REGION_TAG_COUNT))
{
rasprintf(&buf,

11
helperenv.diff Normal file
View File

@ -0,0 +1,11 @@
--- macros.in.orig 2012-04-18 13:48:07.000000000 +0000
+++ macros.in 2012-04-18 13:47:41.000000000 +0000
@@ -515,7 +515,7 @@ posix.setenv("RPMBUILD_SOURCEDIR",rpm.ex
# %__myattr_exclude_magic exclude by magic regex
# %__myattr_exclude_path exclude by path regex
#
-%_fileattrsdir %{_rpmconfigdir}/fileattrs
+%_fileattrsdir %{__set_helper_env}%{_rpmconfigdir}/fileattrs
#==============================================================================
# ---- Database configuration macros.

39
instobscheck.diff Normal file
View File

@ -0,0 +1,39 @@
--- lib/depends.c.orig 2012-04-18 14:46:10.000000000 +0000
+++ lib/depends.c 2012-04-18 14:46:15.000000000 +0000
@@ -355,6 +355,7 @@ static int rpmdbProvides(rpmts ts, depCa
rpmdbMatchIterator mi = NULL;
Header h = NULL;
int rc = 0;
+ int matchnvr = rpmdsTagN(dep) == RPMTAG_OBSOLETENAME;
/* See if we already looked this up */
if (depCacheGetEntry(dcache, DNEVR, &cachedrc, NULL, NULL)) {
@@ -368,7 +369,7 @@ static int rpmdbProvides(rpmts ts, depCa
* taking file state into account: replaced, wrong colored and
* not installed files can not satisfy a dependency.
*/
- if (Name[0] == '/') {
+ if (Name[0] == '/' && !matchnvr) {
mi = rpmtsPrunedIterator(ts, RPMDBI_BASENAMES, Name);
while ((h = rpmdbNextIterator(mi)) != NULL) {
int fs = RPMFILE_STATE_MISSING;
@@ -390,9 +391,16 @@ static int rpmdbProvides(rpmts ts, depCa
if (h == NULL) {
mi = rpmtsPrunedIterator(ts, RPMDBI_PROVIDENAME, Name);
while ((h = rpmdbNextIterator(mi)) != NULL) {
- if (rpmdsAnyMatchesDep(h, dep, _rpmds_nopromote)) {
- rpmdsNotify(dep, "(db provides)", rc);
- break;
+ if (matchnvr) {
+ if (rpmdsNVRMatchesDep(h, dep , _rpmds_nopromote)) {
+ rpmdsNotify(dep, "(db provides)", rc);
+ break;
+ }
+ } else {
+ if (rpmdsAnyMatchesDep(h, dep, _rpmds_nopromote)) {
+ rpmdsNotify(dep, "(db provides)", rc);
+ break;
+ }
}
}
rpmdbFreeIterator(mi);

View File

@ -29,9 +29,9 @@ Index: platform.in
+@SuSE@#---------------------------------------------------------------------
+@SuSE@# Expanded at end of %prep
+@SuSE@#
+@SuSE@%__id_u @__ID_U@
+@SuSE@%__chown_Rhf @__CHOWN_RHF@
+@SuSE@%__chgrp_Rhf @__CHGRP_RHF@
+@SuSE@%__id_u %{__id} -u
+@SuSE@%__chown_Rhf %{__chown} -Rhf
+@SuSE@%__chgrp_Rhf %{__chgrp} -Rhf
+@SuSE@%_fixowner [ `%{__id_u}` = '0' ] && %{__chown_Rhf} root
+@SuSE@%_fixgroup [ `%{__id_u}` = '0' ] && %{__chgrp_Rhf} root
+@SuSE@%_fixperms %{__chmod} -Rf @FIXPERMS@

View File

@ -15,7 +15,6 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: python3-rpm
Version: 4.9.1.2
Release: 0

13
pythonhardlink.diff Normal file
View File

@ -0,0 +1,13 @@
--- scripts/brp-python-hardlink.orig 2012-04-18 13:33:39.000000000 +0000
+++ scripts/brp-python-hardlink 2012-04-18 13:34:52.000000000 +0000
@@ -10,8 +10,8 @@ fi
find "$RPM_BUILD_ROOT" -type f -name "*.pyc" | while read pyc ; do
pyo="${pyc%c}o"
if [ -f "$pyo" ] ; then
- csha="$(sha1sum -b $pyc | cut -d' ' -f 1)" && \
- osha="$(sha1sum -b $pyo | cut -d' ' -f 1)" && \
+ csha="$(sha1sum -b "$pyc" | cut -d' ' -f 1)" && \
+ osha="$(sha1sum -b "$pyo" | cut -d' ' -f 1)" && \
if [ "$csha" = "$osha" ] ; then
ln -f "$pyc" "$pyo"
fi

View File

@ -15,7 +15,6 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: rpm-python
Version: 4.9.1.2
Release: 0

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Apr 20 14:40:50 CEST 2012 - mls@suse.de
- fix some more crashes on malformed header data
[bnc#754281] [bnc#754284] [bnc#754285]
- fix quoting in brp-python-hardlink [bnc#756087]
- change env handling for supplements [bnc#741543]
- fix _fix macros [bnc#728682]
- fix obsoletes handling of installed packages [bnc#714724]
- implent tilde support in version comparison [bnc#466994]
-------------------------------------------------------------------
Mon Mar 26 07:37:10 UTC 2012 - vuntz@opensuse.org

View File

@ -15,7 +15,6 @@
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: rpm
BuildRequires: binutils
BuildRequires: bzip2
@ -138,6 +137,11 @@ Patch82: perl-python-attr.patch
Patch83: findlang-new-help-fix.diff
Patch84: langnoc.diff
Patch85: rpm-gcc47.patch
Patch86: headerchk2.diff
Patch87: pythonhardlink.diff
Patch88: helperenv.diff
Patch89: instobscheck.diff
Patch90: tilde.diff
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#
# avoid bootstrapping problem
@ -154,7 +158,6 @@ all installed packages. RPM also supports database queries.
%package devel
Summary: Include Files and Libraries mandatory for Development
Group: System/Packages
Requires: rpm = %{version}
# for people confusing the one with the other
Recommends: rpm-build = %{version}
@ -169,7 +172,6 @@ need an intimate knowledge of RPM packages in order to function.
%package build
Summary: Tools and Scripts to create rpm packages
Group: System/Packages
Requires: rpm = %{version}
Provides: rpm:%_bindir/rpmbuild
Provides: rpmbuild
@ -211,7 +213,8 @@ rm -f rpmdb/db.h
%patch -P 50 -P 51 -P 52 -P 53 -P 54 -P 55 -P 56 -P 57 -P 58 -P 59
%patch -P 60 -P 61 -P 62 -P 63 -P 64 -P 65 -P 66 -P 67 -P 68 -P 69
%patch -P 70 -P 71 -P 72 -P 73 -P 74 -P 75 -P 76 -P 77 -P 78 -P 79
%patch -P 80 -P 81 -P 82 -P 83 -P 84 -P 85
%patch -P 80 -P 81 -P 82 -P 83 -P 84 -P 85 -P 86 -P 87 -P 88 -P 89
%patch -P 90
#chmod 755 scripts/find-supplements{,.ksyms}
#chmod 755 scripts/find-provides.ksyms scripts/find-requires.ksyms
#chmod 755 scripts/firmware.prov

116
tilde.diff Normal file
View File

@ -0,0 +1,116 @@
--- ./build/pack.c.orig 2012-04-20 13:43:49.000000000 +0000
+++ ./build/pack.c 2012-04-20 14:23:57.000000000 +0000
@@ -308,6 +308,44 @@ static rpmRC processScriptFiles(rpmSpec
return RPMRC_OK;
}
+/**
+ */
+static int depContainsTilde(Header *h, rpmTagVal tagEVR)
+{
+ struct rpmtd_s evrs;
+ const char *evr = NULL;
+
+ if (headerGet(h, tagEVR, &evrs, HEADERGET_MINMEM)) {
+ while ((evr = rpmtdNextString(&evrs)) != NULL)
+ if (strchr(evr, '~'))
+ break;
+ rpmtdFreeData(&evrs);
+ }
+ return evr != NULL;
+}
+
+static rpmTagVal depevrtags[] = {
+ RPMTAG_PROVIDEVERSION,
+ RPMTAG_REQUIREVERSION,
+ RPMTAG_OBSOLETEVERSION,
+ RPMTAG_CONFLICTVERSION,
+ RPMTAG_ORDERVERSION,
+ RPMTAG_TRIGGERVERSION,
+ RPMTAG_SUGGESTSVERSION,
+ RPMTAG_ENHANCESVERSION,
+ 0
+};
+
+static int haveTildeDep(Header *h)
+{
+ int i;
+
+ for (i = 0; depevrtags[i] != 0; i++)
+ if (depContainsTilde(h, depevrtags[i]))
+ return 1;
+ return 0;
+}
+
static rpmRC writeRPM(Header *hdrp, unsigned char ** pkgidp, const char *fileName,
CSA_t csa, char **cookie)
{
@@ -382,6 +420,10 @@ static rpmRC writeRPM(Header *hdrp, unsi
free(buf);
}
+ /* check if the package has a dependency with a '~' */
+ if (haveTildeDep(h))
+ (void) rpmlibNeedsFeature(h, "TildeInVersions", "4.10.0-1");
+
/* Create and add the cookie */
if (cookie) {
rasprintf(cookie, "%s %d", buildHost(), (int) (*getBuildTime()));
--- ./build/parsePreamble.c.orig 2012-04-20 14:29:26.000000000 +0000
+++ ./build/parsePreamble.c 2012-04-20 14:30:18.000000000 +0000
@@ -671,7 +671,7 @@ static int handlePreambleTag(rpmSpec spe
case RPMTAG_VERSION:
case RPMTAG_RELEASE:
SINGLE_TOKEN_ONLY;
- if (rpmCharCheck(spec, field, strlen(field), "._+%{}") != RPMRC_OK) return RPMRC_FAIL;
+ if (rpmCharCheck(spec, field, strlen(field), "._+%{}~") != RPMRC_OK) return RPMRC_FAIL;
headerPutString(pkg->header, tag, field);
break;
case RPMTAG_URL:
--- ./build/parseReqs.c.orig 2012-04-20 14:29:22.000000000 +0000
+++ ./build/parseReqs.c 2012-04-20 14:29:57.000000000 +0000
@@ -170,7 +170,7 @@ rpmRC parseRCPOT(rpmSpec spec, Package p
}
EVR = xmalloc((ve-v) + 1);
rstrlcpy(EVR, v, (ve-v) + 1);
- if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}")) goto exit;
+ if (rpmCharCheck(spec, EVR, ve-v, ".-_+:%{}~")) goto exit;
re = ve; /* ==> next token after EVR string starts here */
} else
EVR = NULL;
--- ./lib/rpmds.c.orig 2012-04-20 13:44:06.000000000 +0000
+++ ./lib/rpmds.c 2012-04-20 13:44:12.000000000 +0000
@@ -913,6 +913,9 @@ static const struct rpmlibProvides_s rpm
{ "rpmlib(ScriptletExpansion)", "4.9.0-1",
( RPMSENSE_EQUAL),
N_("package scriptlets can be expanded at install time.") },
+ { "rpmlib(TildeInVersions)", "4.10.0-1",
+ ( RPMSENSE_EQUAL),
+ N_("dependency comparison supports versions with tilde.") },
{ NULL, NULL, 0, NULL }
};
--- ./lib/rpmvercmp.c.orig 2012-04-20 13:44:06.000000000 +0000
+++ ./lib/rpmvercmp.c 2012-04-20 13:44:12.000000000 +0000
@@ -32,9 +32,18 @@ int rpmvercmp(const char * a, const char
two = str2;
/* loop through each version segment of str1 and str2 and compare them */
- while (*one && *two) {
- while (*one && !risalnum(*one)) one++;
- while (*two && !risalnum(*two)) two++;
+ while (*one || *two) {
+ while (*one && !risalnum(*one) && *one != '~') one++;
+ while (*two && !risalnum(*two) && *two != '~') two++;
+
+ /* handle the tilde separator, it sorts before everthing else */
+ if (*one == '~' || *two == '~') {
+ if (*one != '~') return 1;
+ if (*two != '~') return -1;
+ one++;
+ two++;
+ continue;
+ }
/* If we ran to the end of either, we are finished with the loop */
if (!(*one && *two)) break;