From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Sun, 16 Sep 2007 20:35:11 +0400 From: Alexey Tourbin To: devel@lists.altlinux.org Message-ID: <20070916163511.GM5297@solemn.turbinal> Mail-Followup-To: devel@lists.altlinux.org References: <20070916162305.GA4381@hint1.office.altlinux.org> <20070916162415.GW22022@osdn.org.ua> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="ptFpZ2xYd+337/mr" Content-Disposition: inline In-Reply-To: <20070916162415.GW22022@osdn.org.ua> Subject: [devel] lomoco#1.0-alt1 X-BeenThere: devel@lists.altlinux.org X-Mailman-Version: 2.1.9 Precedence: list Reply-To: ALT Linux Team development discussions List-Id: ALT Linux Team development discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Sep 2007 16:37:17 -0000 Archived-At: List-Archive: List-Post: --ptFpZ2xYd+337/mr Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Sep 16, 2007 at 07:24:15PM +0300, Michael Shigorin wrote: > On Sun, Sep 16, 2007 at 08:23:06PM +0400, QA Team Robot wrote: > > 2 NEW unmet dependencies detected: > > lomoco#1.0-alt1 /bin/logger > > lomoco#1.0-alt1 /etc/sysconfig/logitech_mouse >=20 > =FC=D4=CF =D5=D6=C5 =D0=CF =D3=C9=CD=CC=C9=CE=CB=C1=CD =C9=CC=C9 =D1 =D0= =D2=CF=D3=D4=CF =C8=CC=CF=D0=CE=D5=CC =D5=DB=C1=CD=C9? :) > =F7=D2=CF=C4=C5 =D0=D2=CF=D7=C5=D2=D1=CC, =CE=C5 =DA=CE=C1=C0 -- =DA=C1= =C2=D9=CC =D0=C1=CB=C5=D4 =DA=C1=CC=C9=D4=D8 =D4=CF=C7=C4=C1 > =C9=CC=C9 =D0=D2=CF=D3=D4=CF =D3=CF=C5=C4=C9=CE=C5=CE=C9=C5 =D5=D0=C1=CC= =CF... $ rpmfile lomoco-1.0-alt1.i586.rpm=20 /etc/udev/rules.d/40-lomoco.rules 100644 ASCII text /lib/udev/lomoco 100755 Bourne-Again shell script text executable ^^^^^^^^^^^^^^^^ =C9=D3=D0=CF=CC=CE=D1=C5=CD=D9=CA =DB=C5=CC=CC-=D3=CB=D2= =C9=D0=D4 /usr/bin/lomoco 100755 ELF 32-bit LSB executable, Intel 80386, version 1 (= SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped /usr/share/doc/lomoco-1.0 40755 directory /usr/share/doc/lomoco-1.0/AUTHORS 100644 ASCII text /usr/share/doc/lomoco-1.0/ChangeLog 100644 ASCII English text /usr/share/doc/lomoco-1.0/NEWS 100644 empty /usr/share/doc/lomoco-1.0/README 100644 ASCII English text /usr/share/man/man1/lomoco.1.gz 100644 gzip compressed data, from Unix, ma= x compression $ rpmpeek lomoco-1.0-alt1.i586.rpm grep -rw logger . =2E/lib/udev/lomoco:esac 2>&1 | /bin/logger -t lomoco $ rpmpeek lomoco-1.0-alt1.i586.rpm grep -rw logitech_mouse . =2E/lib/udev/lomoco: . /etc/sysconfig/logitech_mouse $ =F0=D2=CF=C2=CC=C5=CD=D9, =CB=CF=D4=CF=D2=D9=C5 =D0=D2=CF=D1=D7=CC=D1=C0=D4= =D3=D1 =D0=D2=C9 =D0=CF=C9=D3=CB=C5 =DA=C1=D7=C9=D3=C9=CD=CF=D3=D4=C5=CA = =DE=C5=D2=C5=DA =D3=C9=CD=CC=C9=CE=CB=C9 (=D7 =CE=CF=D7=CF=CD rpm-build), =CE=C1 =D3=C1=CD=CF=CD =C4=C5=CC=C5 =CE=C5= =D1=D7=CC=D1=C0=D4=D3=D1 =D3=D0=C5=C3=C9=C6=C9=DE=C5=D3=CB=C9=CD=C9 =C4=CC= =D1 =D3=C9=CD=CC=C9=CE=CB=CF=D7. =F0=CF=C8=CF=D6=C9=C5 "=D0=D2=CF=C2=CC=C5=CD= =D9" =CD=CF=C7=D5=D4 =D7=CF=DA=CE=C9=CB=C1=D4=D8 =C9 =D3=CF "=D3=D4=C1=D2= =D9=CD" rpm-build. =F2=CF=D7=CE=CF =DC=D4=CF =D1 =CE=C1=D0=C9=D3=C1=CC =D7 =CB=CF=CD=CD=C9=D4= =C5 =CB symlinks.req, =C9 =D7 =CF=C2=DD=C5=CD-=D4=CF =DC=D4=CF =CF=D4=DE=C1= =D3=D4=C9 =D5=C2=C5=C4=C9=CC=CF =CD=C5=CE=D1 =D7 =D4=CF=CD, =DE=D4=CF =D3=C1=CD=C1 = =C9=C4=C5=D1 symlinks.req =D7 =C3=C5=CC=CF=CD =D0=D2=C1=D7=C9=CC=D8=CE=C1= =D1. =F3=CD. =CD=CF=CA rpm.git 9693c85f5291d527db6828f29221324028f05aa8 =EC=C1=C4=CE=CF, =D7=CF=D4 =CF=CE =D7=C5=D3=D8 =DC=D4=CF=D4 =CF=D0=D5=D3. commit 9693c85f5291d527db6828f29221324028f05aa8 Author: Alexey Tourbin Date: Fri Mar 9 21:11:03 2007 +0300 implemented symlinks.req =20 Consider R-devel package, which has its own private bin/ directory, where it keeps certain scripts. =20 $ rpm -ql R-devel |grep libtool /usr/lib/R/bin/libtool $ rpm -ql R-devel |grep texi2dvi /usr/lib/R/bin/texi2dvi $ =20 I replace some scripts, such as libtool, with wrappers: =20 $ tail -1 /usr/lib/R/bin/libtool exec /usr/bin/libtool "$@" $ =20 R-devel now has a libtool dependency, generated by shell.req: =20 $ rpm -qR R-devel |grep libtool libtool-common $ rpm -qf /usr/bin/libtool libtool-common-0.2-alt1 $ =20 However, I want the very same dependency SIMPLY BY PLACING SYMBOLIC LINK to /usr/bin/libtool. My new script symlinks.req implements this idea. =20 It works as follows: =20 1) We check all absolute symbolic links, e.g. -> /usr/bin/libtool. If symbolic link is absolute, we fetch its value and feed to FindPackag= e. Note that FindPackage will first check whether e.g. /usr/bin/libtool is available under RPM_BUILD_ROOT. =20 2) We also check all broken symbolic links, e.g. -> ../../../bin/libtoo= l. The fact that symbolic link is broken means that it cannot be resolved = into buildroot and otherwise must be resolved in the host system after the p= ackage is installed, which is the dependency on where it would point to after = install. =20 This means we must canonicalize the link value, strip RPM_BUILD_ROOT, and then call FindPackage. Here is what happens: =20 $ cd `mktemp -d` $ RPM_BUILD_ROOT=3D$PWD $ mkdir -p ./usr/lib/R/bin/ $ ln -s `relative /usr/bin/libtool /usr/lib/R/bin/libtool` $RPM_BUILD_R= OOT/usr/lib/R/bin/libtool $ l $RPM_BUILD_ROOT/usr/lib/R/bin/libtool lrwxrwxrwx 1 at at 20 Mar 9 22:14 /tmp/.private/at/tmp.AHnBX26473/usr/= lib/R/bin/libtool -> ../../../bin/libtool $ [ -e $RPM_BUILD_ROOT/usr/lib/R/bin/libtool ] || echo broken broken $ readlink -vm $RPM_BUILD_ROOT/usr/lib/R/bin/libtool /tmp/.private/at/tmp.AHnBX26473/usr/bin/libtool $ to=3D`!!`; echo ${to#$RPM_BUILD_ROOT} /usr/bin/libtool $ =20 And then FindPackage is called with "/usr/bin/libtool". =20 Now note that if FindPackage is not able to associate e.g. /usr/bin/lib= tool with any particular rpm package, it will just place raw dependency on /usr/bin/libtool. So, this new type of dependencies is a bit dangerous: basically for each really broken symbolic link there will be an unmet dependency. On the other hand, this can be viewed as a means of protec= tion from packages with really broken symbolic links. =20 If you are frightened with this brand new and dangerous type of depende= ncies, please also note that this new type of dependencies is not much more da= ngerous than absolute paths to executables in plain shell scripts. =20 $ /usr/lib/rpm/shell.req -v /dev/stdin << /i/am/unmet (raw, not found) /i/am/unmet $ diff --git a/configure.in b/configure.in index 1ed61cc..ce8b41b 100644 --- a/configure.in +++ b/configure.in @@ -1009,6 +1009,7 @@ AC_OUTPUT([ Doxyfile Makefile rpmrc macros platform r= pmpopt rpm.spec scripts/shell.req scripts/static.req scripts/strip_files + scripts/symlinks.req scripts/verify-elf tests/Makefile tests/rpmrc tests/macros tests/hello-test/Makefile po/Makefile.in diff --git a/rpm-4_0.spec b/rpm-4_0.spec index 7fb8cde..38232be 100644 --- a/rpm-4_0.spec +++ b/rpm-4_0.spec @@ -476,6 +476,7 @@ fi %rpmattr %_rpmlibdir/shell.* %rpmattr %_rpmlibdir/shebang.* %rpmattr %_rpmlibdir/static.* +%rpmattr %_rpmlibdir/symlinks.* %rpmattr %_rpmlibdir/verify-elf %rpmattr %_rpmlibdir/Specfile.pm %rpmattr %_rpmlibdir/*.awk diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 0045d99..1e1e27c 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -20,6 +20,7 @@ EXTRA_DIST =3D \ shell.req shell.req.files shell.prov shell.prov.files \ sql.prov sql.req strip_files \ static.req static.req.files \ + symlinks.req symlinks.req.files \ tcl.req trpm u_pkg.sh verify-elf vpkg-provides.sh vpkg-provides2.sh =20 installprefix =3D $(DESTDIR) @@ -45,4 +46,5 @@ config_SCRIPTS =3D \ shell.req shell.req.files shell.prov shell.prov.files \ sql.prov sql.req strip_files \ static.req static.req.files \ + symlinks.req symlinks.req.files \ tcl.req trpm u_pkg.sh verify-elf vpkg-provides.sh vpkg-provides2.sh diff --git a/scripts/symlinks.req.files b/scripts/symlinks.req.files new file mode 100755 index 0000000..84167a8 --- /dev/null +++ b/scripts/symlinks.req.files @@ -0,0 +1,9 @@ +#!/bin/sh -efu +while IFS=3D$'\t' read -r f t; do + case "$t" in + *'symbolic link to `/'*) + echo "$f"; continue ;; + *'broken symbolic link to '*) + echo "$f"; continue ;; + esac +done diff --git a/scripts/symlinks.req.in b/scripts/symlinks.req.in new file mode 100644 index 0000000..03dfcc8 --- /dev/null +++ b/scripts/symlinks.req.in @@ -0,0 +1,22 @@ +#!/bin/sh -efu + +. @RPMCONFIGDIR@/functions +. @RPMCONFIGDIR@/find-package +[ -n "${RPM_BUILD_ROOT-}" ] || Fatal "I do need RPM_BUILD_ROOT" +real_buildroot=3D$(cd "$RPM_BUILD_ROOT" && /bin/pwd) || exit 1 + +SymlinkReq() +{ + local f=3D"$1"; shift + [ -L "$f" ] || return 0 + local to=3D; to=3D$(readlink -v "$f") + if [ -n "$to" -a -z "${to##/*}" ]; then + FindPackage "$f" "$to" + elif ! [ -e "$f" ]; then + to=3D$(readlink -vm "$f") + to=3D${to#$real_buildroot} + FindPackage "$f" "$to" + fi +} + +ArgvFileAction SymlinkReq "$@" --ptFpZ2xYd+337/mr Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) iD8DBQFG7Vs/fBKgtDjnu0YRAu/0AKCG40CZE0r9pXH54D2K8+FqkqwvxgCdHURu VIeYbZB/fKYOWLgKvzdUG1c= =dNyg -----END PGP SIGNATURE----- --ptFpZ2xYd+337/mr--