RPM Community Forums

Mailing List Message of <rpm-cvs>

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

From: Jeff Johnson <jbj@rpm5.org>
Date: Sun 17 Aug 2008 - 18:16:31 CEST
Message-Id: <20080817161631.4975970F25@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:31
  Branch: HEAD                             Handle: 2008081716163001

  Modified files:
    rpm                     CHANGES
    rpm/lib                 depends.c

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

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

  patch -p0 <<'@@ .'
  Index: rpm/CHANGES
  ============================================================================
  $ cvs diff -u -r1.2517 -r1.2518 CHANGES
  --- rpm/CHANGES	17 Aug 2008 16:06:13 -0000	1.2517
  +++ rpm/CHANGES	17 Aug 2008 16:16:30 -0000	1.2518
  @@ -1,5 +1,6 @@
   
   5.1.0 -> 5.2a0:
  +    - 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.414 -r1.415 depends.c
  --- rpm/lib/depends.c	2 Aug 2008 17:56:46 -0000	1.414
  +++ rpm/lib/depends.c	17 Aug 2008 16:16:31 -0000	1.415
  @@ -247,6 +247,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;
  @@ -473,6 +495,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)
   {
  @@ -572,12 +630,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:16:31 2008
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.