- don't attempt to remove dbenv on --rebuilddb.
authorjbj <devnull@localhost>
Wed, 2 Jul 2003 19:26:04 +0000 (19:26 +0000)
committerjbj <devnull@localhost>
Wed, 2 Jul 2003 19:26:04 +0000 (19:26 +0000)
- autorelocate ix86 package file paths on ia64.

CVS patchset: 6925
CVS date: 2003/07/02 19:26:04

configure.ac
lib/rpmfi.c
lib/rpmfi.h
lib/rpmte.c
lib/rpmte.h
macros.in
rpm.spec.in
rpmdb/rpmdb.c
rpmrc.in

index b6e2291..56b01ad 100644 (file)
@@ -1154,12 +1154,14 @@ esac
 AC_SUBST(MARK64)
 
 dnl Determine the canonical arch-vendor-os for the build machine
+autorelocate_path='%{nil}'
 case "${build_cpu}" in
 *86)           RPMCANONCOLOR=0; RPMCANONARCH=i386 ;;
 x86_64*)       RPMCANONCOLOR=3; RPMCANONARCH=x86_64 ;;
 alpha*)                RPMCANONCOLOR=0; RPMCANONARCH=alpha ;;
 sparc*)                RPMCANONCOLOR=0; RPMCANONARCH=sparc ;;
-ia64*)         RPMCANONCOLOR=0; RPMCANONARCH=ia64 ;;
+ia64*)         RPMCANONCOLOR=2; RPMCANONARCH=ia64;
+               autorelocate_path='/emul/%%{ARCH}-%%{OS}' ;;
 s390x*)                RPMCANONCOLOR=3; RPMCANONARCH=s390x ;;
 s390*)         RPMCANONCOLOR=0; RPMCANONARCH=s390 ;;
 powerpc64*|ppc64*)     RPMCANONCOLOR=3; RPMCANONARCH=ppc64 ;;
@@ -1189,6 +1191,7 @@ unknown|pc|ibm|redhat|pld|mandrake|conectiva|lvr|yellowdog)
 esac
 RPMCANONOS="$build_os_noversion"
 AC_SUBST(RPMCANONCOLOR)
+AC_SUBST(autorelocate_path)
 AC_SUBST(RPMCANONARCH)
 AC_SUBST(RPMCANONVENDOR)
 AC_SUBST(RPMCANONOS)
index 54522a8..5f2130d 100644 (file)
@@ -266,9 +266,19 @@ int_32 rpmfiFInode(rpmfi fi)
     return finode;
 }
 
+uint_32 rpmfiColor(rpmfi fi)
+{
+    uint_32 color = 0;
+
+    if (fi != NULL)
+       /* XXX ignore all but lsnibble for now. */
+       color = fi->color & 0xf;
+    return color;
+}
+
 uint_32 rpmfiFColor(rpmfi fi)
 {
-    int_32 fcolor = 0;
+    uint_32 fcolor = 0;
 
     if (fi != NULL && fi->i >= 0 && fi->i < fi->fc) {
 /*@-boundsread@*/
@@ -1102,6 +1112,10 @@ rpmfi rpmfiNew(rpmts ts, Header h, rpmTag tagN, int scareMem)
     xx = hge(h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL);
 
     xx = hge(h, RPMTAG_FILECOLORS, NULL, (void **) &fi->fcolors, NULL);
+    fi->color = 0;
+    if (fi->fcolors != NULL)
+    for (i = 0; i < fi->fc; i++)
+       fi->color |= fi->fcolors[i];
     xx = hge(h, RPMTAG_CLASSDICT, NULL, (void **) &fi->cdict, &fi->ncdict);
     xx = hge(h, RPMTAG_FILECLASS, NULL, (void **) &fi->fcdictx, NULL);
 
@@ -1168,7 +1182,47 @@ if (fi->actions == NULL)
     if (ts != NULL)
     if (fi != NULL)
     if ((p = rpmtsRelocateElement(ts)) != NULL && rpmteType(p) == TR_ADDED) {
+       const char * fmt = rpmGetPath("%{?_autorelocate_path}", NULL);
+       const char * errstr;
+       char * newPath;
+       const char * march = NULL;
+       const char * harch = NULL;
        Header foo;
+
+       /* XXX add os (or platform) checks. */
+       rpmGetArchInfo(&march, NULL);
+
+       /* XXX error handling. */
+       newPath = headerSprintf(h, fmt, rpmTagTable, rpmHeaderFormats, &errstr);
+       fmt = _free(fmt);
+
+       if (newPath != NULL && *newPath != '\0'
+        && hge(h, RPMTAG_ARCH, NULL, (void **) &harch, NULL)
+        && harch != NULL && !rpmMachineScore(RPM_MACHTABLE_INSTARCH, harch) )
+       {
+
+#if __ia64__
+           /* XXX On ia64, change leading /emul/ix86 -> /emul/ia32, ick. */
+           if (strlen(newPath) >= (sizeof("/emul/i386")-1)
+            && newPath[0] == '/' && newPath[1] == 'e' && newPath[2] == 'm'
+            && newPath[3] == 'u' && newPath[4] == 'l' && newPath[5] == '/'
+            && newPath[6] == 'i' && newPath[8] == '8' && newPath[9] == '6')
+           {
+               newPath[7] = 'a';
+               newPath[8] = '3';
+               newPath[9] = '2';
+           }
+#endif
+           p->relocs =
+               xrealloc(p->relocs, (p->nrelocs + 2) * sizeof(*p->relocs));
+           p->relocs[p->nrelocs].oldPath = xstrdup("/");
+           p->relocs[p->nrelocs].newPath = xstrdup(newPath);
+           p->nrelocs++;
+           p->relocs[p->nrelocs].oldPath = NULL;
+           p->relocs[p->nrelocs].newPath = NULL;
+       }
+       newPath = _free(newPath);
+
 /* XXX DYING */
 if (fi->actions == NULL)
        fi->actions = xcalloc(fi->fc, sizeof(*fi->actions));
index 666c6d2..1913c51 100644 (file)
@@ -147,6 +147,7 @@ struct rpmfi_s {
 /*@owned@*/
     FSM_t fsm;                 /*!< File state machine data. */
     int keep_header;           /*!< Keep header? */
+    uint_32 color;             /*!< Color bit(s) from file color union. */
 /*@owned@*/
     sharedFileInfo replaced;   /*!< (TR_ADDED) */
 /*@owned@*/
@@ -368,9 +369,17 @@ int_32 rpmfiFInode(/*@null@*/ rpmfi fi)
        /*@*/;
 
 /**
+ * Return union of all file color bits from file info set.
+ * @param fi           file info set
+ * @return             current color
+ */
+uint_32 rpmfiColor(/*@null@*/ rpmfi fi)
+       /*@*/;
+
+/**
  * Return current file color bits from file info set.
  * @param fi           file info set
- * @return             current file color, 0 on invalid
+ * @return             current file color
  */
 uint_32 rpmfiFColor(/*@null@*/ rpmfi fi)
        /*@*/;
index de3ce5c..fc9f9bb 100644 (file)
@@ -131,13 +131,15 @@ static void addTE(rpmts ts, rpmte p, Header h,
        p->epoch = NULL;
 /*@=branchstate@*/
 
+    p->nrelocs = 0;
+    p->relocs = NULL;
     if (relocs != NULL) {
        rpmRelocation * r;
        int i;
 
-       for (i = 0, r = relocs; r->oldPath || r->newPath; i++, r++)
-           {};
-       p->relocs = xmalloc((i + 1) * sizeof(*p->relocs));
+       for (r = relocs; r->oldPath || r->newPath; r++)
+           p->nrelocs++;
+       p->relocs = xmalloc((p->nrelocs + 1) * sizeof(*p->relocs));
 
        for (i = 0, r = relocs; r->oldPath || r->newPath; i++, r++) {
            p->relocs[i].oldPath = r->oldPath ? xstrdup(r->oldPath) : NULL;
@@ -145,8 +147,6 @@ static void addTE(rpmts ts, rpmte p, Header h,
        }
        p->relocs[i].oldPath = NULL;
        p->relocs[i].newPath = NULL;
-    } else {
-       p->relocs = NULL;
     }
 
     p->key = key;
index 6e1c78d..50bbcb2 100644 (file)
@@ -106,6 +106,7 @@ struct rpmte_s {
     fnpyKey key;               /*!< (TR_ADDED) Retrieval key. */
 /*@owned@*/ /*@null@*/
     rpmRelocation * relocs;    /*!< (TR_ADDED) Payload file relocations. */
+    int nrelocs;               /*!< (TR_ADDED) No. of relocations. */
 /*@refcounted@*/ /*@null@*/    
     FD_t fd;                   /*!< (TR_ADDED) Payload file descriptor. */
 
index 6740b88..c8093a8 100644 (file)
--- a/macros.in
+++ b/macros.in
@@ -1,7 +1,7 @@
 #/*! \page config_macros Default configuration: @RPMCONFIGDIR@/macros
 # \verbatim
 #
-# $Id: macros.in,v 1.138 2003/03/05 00:13:11 jbj Exp $
+# $Id: macros.in,v 1.139 2003/07/02 19:26:04 jbj Exp $
 #
 # This is a global RPM configuration file. All changes made here will
 # be lost when the rpm package is upgraded. Any per-system configuration
@@ -579,6 +579,13 @@ package or when debugging this package.\
 #              2       Elf64 permitted
 %_transaction_color    @RPMCANONCOLOR@
 
+#      A default autorelocation path prefixed to file paths of packages
+#      that have an incompatible arch. This is used on ia64 to prefix
+#      /emul/ia32 to i386 file paths, and nowhere else (yet).
+#
+# XXX  Note: escaped %% for use in headerSprintf()
+%_autorelocate_path    @autorelocate_path@
+
 #      The path to the dependency universe database. The default value
 #      is the rpmdb-redhat location. The macro is usually defined in
 #      /etc/rpm/macros.solve, installed with the rpmdb-redhat package.
index 6b59da8..587cd7d 100644 (file)
@@ -203,10 +203,10 @@ Please install rpm-4.0.4 first, and do
        rpm --rebuilddb
 to convert your database from db1 to db3 format.
 "
-#    exit 1
+    exit 1
 fi
 /usr/sbin/groupadd -g 37 @RPMGROUP@                            > /dev/null 2>&1
-/usr/sbin/useradd  -r -d /var/lib/rpm -u 37 -g 37 @RPMUSER@    > /dev/null 2>&1
+/usr/sbin/useradd  -r -d /var/lib/rpm -u 37 -g 37 @RPMUSER@ -s /sbin/nologin   > /dev/null 2>&1
 %endif
 exit 0
 
@@ -221,8 +221,8 @@ exit 0
 %postun
 /sbin/ldconfig
 if [ $1 = 0 ]; then
-    /usr/sbin/userdel rpm
-    /usr/sbin/groupdel rpm
+    /usr/sbin/userdel @RPMUSER@
+    /usr/sbin/groupdel @RPMGROUP@
 fi
 exit 0
 
index 486becf..da948da 100644 (file)
@@ -3759,10 +3759,6 @@ int rpmdbRebuild(const char * prefix, rpmts ts,
 
     }
 
-    if (!nocleanup) {
-       olddb->db_remove_env = 1;
-       newdb->db_remove_env = 1;
-    }
     xx = rpmdbClose(olddb);
     xx = rpmdbClose(newdb);
 
index bc71c2e..b49b7bf 100644 (file)
--- a/rpmrc.in
+++ b/rpmrc.in
@@ -1,7 +1,7 @@
 #/*! \page config_rpmrc Default configuration: /usr/lib/rpm/rpmrc
 # \verbatim
 #
-# $Id: rpmrc.in,v 2.55 2003/05/30 16:58:13 jbj Exp $
+# $Id: rpmrc.in,v 2.56 2003/07/02 19:26:04 jbj Exp $
 #
 # This is a global RPM configuration file. All changes made here will
 # be lost when the rpm package is upgraded. Any per-system configuration
@@ -266,7 +266,7 @@ arch_compat: i370: noarch
 arch_compat: s390: noarch
 arch_compat: s390x: s390 noarch
 
-arch_compat: ia64: i686 noarch
+arch_compat: ia64: noarch
 
 arch_compat: x86_64: athlon noarch