tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

PROVIDES/REQUIRES detection incomplete



(iMil reminded me of this.)

pkgsrc/mk/flavor/pkg/metadata.mk attempts to figure out libraries provides 
and required by packages to define PROVIDES and REQUIRES.

                libs=`${AWK} '/(^|\/)lib\/lib.*\.so\.[0-9]+$$/ { print 
"${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS}`; \

This assumes library naming ends with a digit.

Here are some examples of some that do not:

/usr/pkg/lib/libpulsedsp.so

/usr/pkg/lib/libEterm-0.9.4.so

/usr/pkg/lib/libboost_wserialization-mt.so

/usr/pkg/lib/libdb4_cxx-4.7.so

(I have over 500 examples on one of my systems.)

These aren't registered as PROVIDES.

So here is my WRONG patch (which has only a little testing):

Index: mk/flavor/pkg/metadata.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/metadata.mk,v
retrieving revision 1.30
diff -u -r1.30 metadata.mk
--- mk/flavor/pkg/metadata.mk   21 May 2008 20:39:52 -0000      1.30
+++ mk/flavor/pkg/metadata.mk   16 Apr 2009 00:08:47 -0000
@@ -58,7 +58,7 @@
        bins=`${AWK} '/(^|\/)(bin|sbin|libexec)\// { print 
"${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS}`; \
        case ${OBJECT_FMT:Q}"" in                                       \
        ELF)                                                            \
-               libs=`${AWK} '/(^|\/)lib\/lib.*\.so\.[0-9]+$$/ { print 
"${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS}`; \
+               libs=`${AWK} '/(^|\/)lib\/lib.*\.so.*$$/ { print 
"${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS} | while read 
i ; do if ${TEST} ! -h $$i; then echo $$i ; fi ; done`; \
                if ${TEST} -n "$$bins" -o -n "$$libs"; then             \
                        requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) 
| ${AWK} '$$2 == "=>" && $$3 ~ "/" { print $$3 }' | ${SORT} -u`; \
                fi;                                                     \

Note that this will change results for packages that worked before, for 
example libXv before had:

-PROVIDES=/usr/pkg/lib/libXv.so.1
(which is a symlink)

But now has:

+PROVIDES=/usr/pkg/lib/libXv.so.1.0.0
(not a symlink)

But on my system now that doesn't match the REQUIRES.

So my patch is WRONG because it loses the symlinks. Should it just record 
all PROVIDES even if they are multiple symlinks for same shared library?

So here is a simpler patch which may now shows more.

Index: mk/flavor/pkg/metadata.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/flavor/pkg/metadata.mk,v
retrieving revision 1.30
diff -u -r1.30 metadata.mk
--- mk/flavor/pkg/metadata.mk   21 May 2008 20:39:52 -0000      1.30
+++ mk/flavor/pkg/metadata.mk   16 Apr 2009 00:25:47 -0000
@@ -58,7 +58,7 @@
        bins=`${AWK} '/(^|\/)(bin|sbin|libexec)\// { print 
"${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS}`; \
        case ${OBJECT_FMT:Q}"" in                                       \
        ELF)                                                            \
-               libs=`${AWK} '/(^|\/)lib\/lib.*\.so\.[0-9]+$$/ { print 
"${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS}`; \
+               libs=`${AWK} '/(^|\/)lib\/lib.*\.so.*$$/ { print 
"${DESTDIR}${PREFIX}/" $$0 } END { exit 0 }' ${_PLIST_NOKEYWORDS}`; \
                if ${TEST} -n "$$bins" -o -n "$$libs"; then             \
                        requires=`($$ldd $$bins $$libs 2>/dev/null || ${TRUE}) 
| ${AWK} '$$2 == "=>" && $$3 ~ "/" { print $$3 }' | ${SORT} -u`; \
                fi;                                                     \

Note that this patch was for ELF and tested on NetBSD only.

For example, libXv adds too more entries:

+PROVIDES=/usr/pkg/lib/libXv.so
 PROVIDES=/usr/pkg/lib/libXv.so.1
+PROVIDES=/usr/pkg/lib/libXv.so.1.0.0

By the way, before that patch on my system I have 272 different REQUIRES. 
There are 20 files listed as REQUIRES that don't have a corresponding 
PROVIDES because of wrong test (shown at top of this email):

/usr/pkg/lib/OpenOffice.org3.0.0/openoffice.org3/basis-link/program/../ure-link/lib/libreg.so.3
/usr/pkg/lib/OpenOffice.org3.0.0/openoffice.org3/basis-link/program/../ure-link/lib/libstlport_gcc.so
/usr/pkg/lib/OpenOffice.org3.0.0/openoffice.org3/basis-link/program/../ure-link/lib/libstore.so.3
/usr/pkg/lib/OpenOffice.org3.0.0/openoffice.org3/basis-link/program/../ure-link/lib/libuno_cppu.so.3
/usr/pkg/lib/OpenOffice.org3.0.0/openoffice.org3/basis-link/program/../ure-link/lib/libuno_cppuhelpergcc3.so.3
/usr/pkg/lib/OpenOffice.org3.0.0/openoffice.org3/basis-link/program/../ure-link/lib/libuno_sal.so.3
/usr/pkg/lib/OpenOffice.org3.0.0/openoffice.org3/basis-link/program/../ure-link/lib/libuno_salhelpergcc3.so.3
/usr/pkg/lib/gnash/libgnashamf-0.8.5.so
/usr/pkg/lib/gnash/libgnashbase-0.8.5.so
/usr/pkg/lib/gnash/libgnashcore-0.8.5.so
/usr/pkg/lib/gnash/libgnashmedia-0.8.5.so
/usr/pkg/lib/gnash/libgnashnet.so.0
/usr/pkg/lib/gnash/libgnashsound-0.8.5.so
/usr/pkg/lib/libXv.so.1   (that was from my broken test per this email)
/usr/pkg/lib/libboost_date_time-mt-d.so
/usr/pkg/lib/libboost_thread-mt-d.so
/usr/pkg/lib/libpython2.4.so.1.0
/usr/pkg/lib/libpython2.5.so.1.0
/usr/pkg/lib/perl5/5.10.0/x86_64-netbsd-thread-multi/CORE/libperl.so
/usr/pkg/lib/xorg/modules/libscanpci.so


Any comments on this?


(On a related note, this all assumes the "ldd" output is the same 
everywhere. I had noted it was different on some systems and had provided 
some code to fix it. I know others have too. I will look to see if I have 
it to commit.)


Home | Main Index | Thread Index | Old Index