RPM Community Forums

Mailing List Message of <rpm-cvs>

[CVS] RPM: rpm-5_1: rpm/ CHANGES rpm/lib/ depends.c

From: Jeff Johnson <jbj@rpm5.org>
Date: Sun 17 Aug 2008 - 18:17:00 CEST
Message-Id: <20080817161700.01CB870F78@rpm5.org>
  RPM Package Manager, CVS Repository
  http://rpm5.org/cvs/
  ____________________________________________________________________________

  Server: rpm5.org                         Name:   Jeff Johnson
  Root:   /v/rpm/cvs                       Email:  jbj@rpm5.org
  Module: rpm                              Date:   17-Aug-2008 18:16:59
  Branch: rpm-5_1                          Handle: 2008081716165900

  Modified files:           (Branch: rpm-5_1)
    rpm                     CHANGES
    rpm/lib                 depends.c

  Log:
    - jbj: WR: Color/arch affinity while upgrading on multilib platforms.

  Summary:
    Revision    Changes     Path
    1.2288.2.83 +1  -0      rpm/CHANGES
    1.394.2.7   +66 -1      rpm/lib/depends.c
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2288.2.82 -r1.2288.2.83 CHANGES
  --- rpm/CHANGES	17 Aug 2008 16:06:51 -0000	1.2288.2.82
  +++ rpm/CHANGES	17 Aug 2008 16:16:59 -0000	1.2288.2.83
  @@ -1,4 +1,5 @@
   5.1.4 -> 5.1.5:
  +    - jbj: WR: Color/arch affinity while upgrading on multilib platforms.
       - jbj: WR: Permit configurable arch strings.
       - jbj: WR: Use %{_host_vendor} and %{_host_os} for platform.
       - jbj: WR: fakeroot maps devices to files. avoid /dev/* in checkfiles.
  @@ .
  patch -p0 <<'@@ .'
  Index: rpm/lib/depends.c
  ============================================================================
  $ cvs diff -u -r1.394.2.6 -r1.394.2.7 depends.c
  --- rpm/lib/depends.c	29 Jul 2008 20:10:25 -0000	1.394.2.6
  +++ rpm/lib/depends.c	17 Aug 2008 16:16:59 -0000	1.394.2.7
  @@ -244,6 +244,28 @@
   	    he->p.ptr = _free(he->p.ptr);
   	}
   
  +#if defined(RPM_VENDOR_WINDRIVER)
  +	/*
  +	 * If we're capable of installing multiple colors
  +	 * but at least one of the packages are white (0), we
  +	 * further verify the arch is the same (or compatible) to trigger an upgrade
  +	 * we do have a special case to allow upgrades of noarch w/ a arch package
  +	 */
  +	if (tscolor && (!hcolor || !ohcolor)) {
  +	    he->tag = RPMTAG_ARCH;
  +	    xx = headerGet(oh, he, 0);
  +	    if (arch != NULL && he->p.str != NULL) {
  +	        if (strcmp("noarch", arch) || strcmp("noarch", he->p.str)) {
  +		    if (!_isCompatibleArch(arch, he->p.str)) {
  +			he->p.ptr = _free(he->p.ptr);
  +			continue;
  +		    }
  +		}
  +	    }
  +	    he->p.ptr = _free(he->p.ptr);
  +	}
  +#endif
  +
   	/* Skip identical packages. */
   	if (rpmHeadersIdentical(h, oh))
   	    continue;
  @@ -467,6 +489,42 @@
       return 0;
   }
   
  +#if defined(RPM_VENDOR_WINDRIVER)
  +/* Is "compat" compatible w/ arch? */
  +int _isCompatibleArch(const char * arch, const char * compat)
  +{
  +    const char * compatArch = rpmExpand(compat, " %{?_", compat, "_compat_arch}", NULL);
  +    const char * p, * pe, * t;
  +    int match = 0;
  +
  +    /* Hack to ensure iX86 being automatically compatible */
  +    if (arch[0] == 'i' && arch[2] == '8' && arch[3] == '6') {
  +	if ((arch[0] == compat[0]) &&
  +	    (arch[2] == compat[2]) &&
  +	    (arch[3] == compat[3]))
  +	    match = 1;
  +
  +        if (!strcmp(compat, "x86_32"))
  +	    match = 1;
  +    }
  +
  +    for ( p = pe = compatArch ; *pe && match == 0 ; ) {
  +	while (*p && xisspace(*p)) p++;
  +	pe = p ; while (*pe && !xisspace(*pe)) pe++;
  +	if (p == pe)
  +	    break;
  +	t = strndup(p, (pe - p));
  +	p = pe; /* Advance to next chunk */
  +rpmMessage(RPMMESS_DEBUG, _("   Comparing compat archs %s ? %s\n"), arch, t);
  +	if (!strcmp(arch, t))
  +	    match = 1;
  +	t = _free(t);
  +    }
  +    compatArch = _free(compatArch);
  +    return match;
  +}
  +#endif
  +
   int rpmtsAddInstallElement(rpmts ts, Header h,
   			fnpyKey key, int upgrade, rpmRelocation relocs)
   {
  @@ -566,12 +624,19 @@
   
   	    if (arch == NULL || (parch = rpmteA(p)) == NULL)
   		continue;
  +#if defined(RPM_VENDOR_WINDRIVER)
  +	    /* XXX hackery for alias matching. */
  +	    if (!_isCompatibleArch(arch, parch))
  +		continue;
  +#else
   	    /* XXX hackery for i[3456]86 alias matching. */
   	    if (arch[0] == 'i' && arch[2] == '8' && arch[3] == '6') {
   		if (arch[0] != parch[0]) continue;
   		if (arch[2] != parch[2]) continue;
   		if (arch[3] != parch[3]) continue;
  -	    } else if (strcmp(arch, parch))
  +	    }
  +#endif
  +	    else if (strcmp(arch, parch))
   		continue;
   	    if (os == NULL || (pos = rpmteO(p)) == NULL)
   		continue;
  @@ .
Received on Sun Aug 17 18:17:00 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.