RPM Community Forums

Mailing List Message of <rpm-devel>

Re: [CVS] RPM: rpm-5_4: rpm/lib/ rpmds.c

From: Hatle, Mark <mark.hatle@windriver.com>
Date: Sun 10 Apr 2011 - 16:30:10 CEST
Message-ID: <557A179F-68B7-4127-BBB3-EAA1FBCA2972@windriver.com>
See below inline



On Apr 9, 2011, at 11:57 PM, "Per √ėyvind Karlsen" <pkarlsen@rpm5.org> wrote:

>  RPM Package Manager, CVS Repository
>  http://rpm5.org/cvs/

>  ____________________________________________________________________________
> 
>  Server: rpm5.org                         Name:   Per √ėyvind Karlsen
>  Root:   /v/rpm/cvs                       Email:  pkarlsen@rpm5.org
>  Module: rpm                              Date:   10-Apr-2011 08:57:24
>  Branch: rpm-5_4                          Handle: 2011041006572300
> 
>  Modified files:           (Branch: rpm-5_4)
>    rpm/lib                 rpmds.c
> 
>  Log:
>    filter out some redundant devel(...) dependencies
> 
>  Summary:
>    Revision    Changes     Path
>    2.170.2.7   +23 -10     rpm/lib/rpmds.c
>  ____________________________________________________________________________
> 
>  patch -p0 <<'@@ .'
>  Index: rpm/lib/rpmds.c
>  ============================================================================
>  $ cvs diff -u -r2.170.2.6 -r2.170.2.7 rpmds.c
>  --- rpm/lib/rpmds.c    10 Apr 2011 06:05:58 -0000    2.170.2.6
>  +++ rpm/lib/rpmds.c    10 Apr 2011 06:57:23 -0000    2.170.2.7
>  @@ -2904,21 +2904,19 @@
>       if (!devel && s[strlen(s)-1] != ')')
>       (void) stpcpy( stpcpy(tmp, s), "()(64bit)");
>       else {
>  -        char *suffix;
>           tmp = stpcpy(tmp, s);
>  -        if (devel && (suffix = strstr(t, ".so")))
>  -        tmp = suffix;
>  +        if (devel)
>  +        tmp = strstr(t, ".so");
>           tmp = stpcpy(tmp, "(64bit)");
>           }
>       }else
>   #endif
>       tmp = stpcpy(tmp, s);
>       if (devel) {
>  -    char *suffix;
>  -    tmp = stpcpy(tmp, s);
>  -    if (devel && (suffix = strstr(t, ".so")))
>  +    char *suffix = strstr(t, ".so");
>  +    if (suffix)
>           tmp = suffix;
>  -    (void) stpcpy(tmp, ")");
>  +    tmp = stpcpy(tmp, ")");
>       }
> 
>       return t;
>  @@ -3282,8 +3280,16 @@
>       int skipR = (flags & RPMELF_FLAG_SKIPREQUIRES);
>       int lnklen;
>       char path[MAXPATHLEN];
>  +    /*
>  +     * We filter out these as they come with glibc, making dependencies on
>  +     * them rather redundant.
>  +     */
>  +    const char *filterRequires[] = {"ld-linux", "ld64-linux" "libBrokenLocale.so",
>  +    "libanl.so", "libc.so", "libcidn.so", "libcrypt.so", "libdl.so", "libm.so",
>  +    "libnsl.so", "libnss_compat.so", "libnss_dns.so", "libnss_files.so",
>  +    "libnss_hesiod.so", "libnss_nis.so", "libnss_nisplus.so", "libpthread.so",
>  +    "libresolv.so", "librt.so", "libutil.so", "libthread_db.so"};
>       ARGV_t deps = NULL;
>  -    size_t nb = strlen(fn);
> 

Filtering out the items below on embedded systems can break things (if I'm understanding the code right)...  In many embedded systems we use eglibc which is configurable, we also some times break up the libc package into many small sub packages so that we can only bring in the libraries that are actually being used.

This type of filtering should be done in a distribution specific way, or at a minimum contain a way to disable it.

>       /* Filename must end with ".so" to be devel(...) dependency. */
>       s = rindex(fn, '.');
>  @@ -3357,7 +3363,13 @@
>               s = elf_strptr(elf, shdr->sh_link, dyn->d_un.d_val);
>   assert(s != NULL);
>               buf[0] = '\0';
>  -            argvAdd(&deps, s);
>  +
>  +            for (i = 0; i < (int)(sizeof(filterRequires)/sizeof(filterRequires[0])); i++)
>  +                if (!strncmp(s, filterRequires[i], strlen(filterRequires[i])))
>  +                break;
>  +
>  +            if (sizeof(filterRequires)/sizeof(filterRequires[0]) == i)
>  +                argvAdd(&deps, s);
>               /*@switchbreak@*/ break;
>               case DT_SONAME:
>               gotSONAME = 1;
>  @@ -3365,6 +3377,7 @@
>   assert(s != NULL);
>               /* Add next provide dependency. */
>               buf[0] = '\0';
>  +
>               if (!skipP) {
>                   ds = rpmdsSingle(RPMTAG_PROVIDENAME,
>                       sonameDep(buf, s, isElf64, 1),
>  @@ -3383,7 +3396,7 @@
>       /*@=uniondef @*/
> 
>   exit:
>  -    if (gotSONAME)
>  +    if (gotSONAME && !skipR)
>       for (i = 0, cnt = argvCount(deps); i < cnt; i++) {
>           ds = rpmdsSingle(RPMTAG_REQUIRENAME,
>               sonameDep(buf, deps[i], isElf64, 1),
>  @@ .
> ______________________________________________________________________
> RPM Package Manager                                    http://rpm5.org

> CVS Sources Repository                                rpm-cvs@rpm5.org
Received on Sun Apr 10 17:00:06 2011
Driven by Jeff Johnson and the RPM project team.
Hosted by OpenPKG and Ralf S. Engelschall.
Powered by FreeBSD and OpenPKG.