[rpm/f15] add temporary rpmlib patch to support filesystem transition

Harald Hoyer harald at fedoraproject.org
Tue Jan 24 18:20:23 UTC 2012


commit 38c77c6f68889586c0ea0b6cc90570db63d7adb4
Author: Kay Sievers <kay at redhat.com>
Date:   Tue Dec 20 14:39:21 2011 +0100

    add temporary rpmlib patch to support filesystem transition
    
    https://fedorahosted.org/fpc/ticket/118#comment:14

 rpm-4.9.1.2-rpmlib-filesystem-check.patch |  127 +++++++++++++++++++++++++++++
 rpm.spec                                  |   11 +++-
 2 files changed, 137 insertions(+), 1 deletions(-)
---
diff --git a/rpm-4.9.1.2-rpmlib-filesystem-check.patch b/rpm-4.9.1.2-rpmlib-filesystem-check.patch
new file mode 100644
index 0000000..d9286ee
--- /dev/null
+++ b/rpm-4.9.1.2-rpmlib-filesystem-check.patch
@@ -0,0 +1,127 @@
+diff --git a/lib/depends.c b/lib/depends.c
+index 69aecbb..5101d32 100644
+--- a/lib/depends.c
++++ b/lib/depends.c
+@@ -386,6 +386,108 @@ static int rpmdbProvides(rpmts ts, depCache dcache, rpmds dep)
+     return rc;
+ }
+ 
++/*
++ * Temporary support for live-conversion of the filesystem hierarchy
++ *   mailto: kay at redhat.com, harald at redhat.com
++ *   https://fedoraproject.org/wiki/Features/UsrMove
++ *
++ *   X-CheckUnifiedSystemdir:
++ *     /bin, /sbin, /lib, /lib64 --> /usr
++ *
++ *   X-CheckUnifiedBindir:
++ *     /usr/sbin -> /usr/bin
++ *
++ *   X-CheckMultiArchLibdir:
++ *     /usr/lib64 /usr/lib/<platform tuple> (e.g. x86_64-linux-gnu)
++ *
++ * This code is not needed for new installations, it can be removed after
++ * updates from older systems are no longer supported: Fedora 19 / RHEL 8.
++ */
++
++static int CheckLink(const char *dir, const char *root)
++{
++    char *d = NULL;
++    struct stat sbuf;
++    int rc = 0;
++
++    if (!root)
++	root = "/";
++
++    rasprintf(&d, "%s%s", root, dir);
++    if (!d) {
++	rc = -1;
++	goto exit;
++    }
++
++    /* directory or symlink does not exist, all is fine */
++    if (lstat(d, &sbuf) < 0) {
++	rc = 1;
++	goto exit;
++    }
++
++    /* if it is a symlink, all is fine */
++    if (S_ISLNK(sbuf.st_mode))
++	rc = 1;
++
++exit:
++    free(d);
++    return rc;
++}
++
++static int CheckFilesystemHierarchy(rpmds * dsp, const char *root)
++{
++    static const char *dirs[] = { "bin", "sbin", "lib", "lib64" };
++    int check;
++    int i;
++    rpmds ds;
++    int rc = 0;
++
++    for (i = 0; i < sizeof(dirs) / sizeof(dirs[0]); i++) {
++	check = CheckLink(dirs[i], root);
++	if (check < 0) {
++	    rc = -1;
++	    goto exit;
++	}
++
++	if (check == 0)
++	    goto exit;
++    }
++    ds = rpmdsSingle(RPMTAG_PROVIDENAME,
++		     "rpmlib(X-CheckUnifiedSystemdir)", "1",
++		     RPMSENSE_EQUAL);
++    rpmdsMerge(dsp, ds);
++    rpmdsFree(ds);
++
++    check = CheckLink("usr/lib64", root);
++    if (check < 0) {
++        rc = -1;
++        goto exit;
++    }
++    if (check > 0) {
++	ds = rpmdsSingle(RPMTAG_PROVIDENAME,
++			 "rpmlib(X-CheckMultiArchLibdir)", "1",
++			 RPMSENSE_EQUAL);
++	rpmdsMerge(dsp, ds);
++	rpmdsFree(ds);
++    }
++
++    check = CheckLink("usr/sbin", root);
++    if (check < 0) {
++	rc = -1;
++	goto exit;
++    }
++    if (check > 0) {
++	ds = rpmdsSingle(RPMTAG_PROVIDENAME,
++			 "rpmlib(X-CheckUnifiedBindir)", "1",
++			 RPMSENSE_EQUAL);
++	rpmdsMerge(dsp, ds);
++	rpmdsFree(ds);
++    }
++
++exit:
++    return rc;
++}
++
+ /**
+  * Check dep for an unsatisfied dependency.
+  * @param ts		transaction set
+@@ -410,9 +512,11 @@ retry:
+      */
+     if (dsflags & RPMSENSE_RPMLIB) {
+ 	static int oneshot = -1;
+-	if (oneshot) 
++	if (oneshot) {
+ 	    oneshot = rpmdsRpmlib(&rpmlibP, NULL);
+-	
++	    CheckFilesystemHierarchy(&rpmlibP, rpmtsRootDir(ts));
++	}
++
+ 	if (rpmlibP != NULL && rpmdsSearch(rpmlibP, dep) >= 0) {
+ 	    rpmdsNotify(dep, "(rpmlib provides)", rc);
+ 	    goto exit;
diff --git a/rpm.spec b/rpm.spec
index 4e6bde6..a1c8a41 100644
--- a/rpm.spec
+++ b/rpm.spec
@@ -21,7 +21,7 @@
 Summary: The RPM package management system
 Name: rpm
 Version: %{rpmver}
-Release: %{?snapver:0.%{snapver}.}3%{?dist}.2
+Release: %{?snapver:0.%{snapver}.}3%{?dist}.3
 Group: System Environment/Base
 Url: http://www.rpm.org/
 Source0: http://rpm.org/releases/rpm-4.9.x/%{name}-%{srcver}.tar.bz2
@@ -49,6 +49,8 @@ Patch301: rpm-4.6.0-niagara.patch
 Patch302: rpm-4.7.1-geode-i686.patch
 # To be upstreamed after rawhide-testdrive (#641377)
 Patch303: rpm-4.9.0-debuginfo-allnames.patch
+# Temporary Patch to provide support for updates
+Patch400: rpm-4.9.1.2-rpmlib-filesystem-check.patch
 
 # Partially GPL/LGPL dual-licensed and some bits with BSD
 # SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD 
@@ -215,6 +217,9 @@ packages on a system.
 %patch303 -p1 -b .debuginfo-allnames
 
 %patch5 -p1 -b .armhfp
+
+%patch400 -p1 -b .rpmlib-filesystem-check
+
 # this patch cant be applied on softfp builds
 %ifnarch armv3l armv4b armv4l armv4tl armv5tel armv5tejl armv6l armv7l
 %patch6 -p1 -b .armhfp-logic
@@ -432,6 +437,10 @@ exit 0
 %doc COPYING doc/librpm/html/*
 
 %changelog
+* Tue Jan 24 2012 Harald Hoyer <harald at redhat.com> 4.9.1.2-3.3
+- add temporary rpmlib patch to support filesystem transition
+  https://fedoraproject.org/wiki/Features/UsrMove
+
 * Wed Dec 21 2011 Dennis Gilmore <dennis at ausil.us> - 4.9.1.2-3.2
 - only conditionally apply the armhfp logic code we do need the hfp macros everywhere
 


More information about the scm-commits mailing list