rpm-build/scripts
Alexey Tourbin 9693c85f52 implemented symlinks.req
Consider R-devel package, which has its own private bin/ directory,
where it keeps certain scripts.

$ rpm -ql R-devel |grep libtool
/usr/lib/R/bin/libtool
$ rpm -ql R-devel |grep texi2dvi
/usr/lib/R/bin/texi2dvi
$

I replace some scripts, such as libtool, with wrappers:

$ tail -1 /usr/lib/R/bin/libtool
exec /usr/bin/libtool "$@"
$

R-devel now has a libtool dependency, generated by shell.req:

$ rpm -qR R-devel |grep libtool
libtool-common
$ rpm -qf /usr/bin/libtool
libtool-common-0.2-alt1
$

However, I want the very same dependency SIMPLY BY PLACING SYMBOLIC LINK
to /usr/bin/libtool.  My new script symlinks.req implements this idea.

It works as follows:

1) We check all absolute symbolic links, e.g. -> /usr/bin/libtool.
If symbolic link is absolute, we fetch its value and feed to FindPackage.
Note that FindPackage will first check whether e.g. /usr/bin/libtool is
available under RPM_BUILD_ROOT.

2) We also check all broken symbolic links, e.g. -> ../../../bin/libtool.
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 package
is installed, which is the dependency on where it would point to after install.

This means we must canonicalize the link value, strip RPM_BUILD_ROOT,
and then call FindPackage.  Here is what happens:

$ cd `mktemp -d`
$ RPM_BUILD_ROOT=$PWD
$ mkdir -p ./usr/lib/R/bin/
$ ln -s `relative /usr/bin/libtool /usr/lib/R/bin/libtool` $RPM_BUILD_ROOT/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=`!!`; echo ${to#$RPM_BUILD_ROOT}
/usr/bin/libtool
$

And then FindPackage is called with "/usr/bin/libtool".

Now note that if FindPackage is not able to associate e.g. /usr/bin/libtool
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 protection
from packages with really broken symbolic links.

If you are frightened with this brand new and dangerous type of dependencies,
please also note that this new type of dependencies is not much more dangerous
than absolute paths to executables in plain shell scripts.

$ /usr/lib/rpm/shell.req -v /dev/stdin <<</i/am/unmet
error: file /i/am/unmet: No such file or directory
shell.req: /dev/stdin: /i/am/unmet -> /i/am/unmet (raw, not found)
/i/am/unmet
$
2007-03-12 15:06:09 +03:00
..
.cvsignore re-added .lclintrc and .cvsignore files from CVS 2002-03-25 20:27:37 +00:00
brp-adjust_libraries.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
brp-alt.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
brp-bytecompile_python.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
brp-cleanup.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
brp-compress.in scripts/brp-compress.in: 2006-09-16 22:20:03 +00:00
brp-fix-perms.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
brp-fixup.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
brp-strip.in scripts/brp-compress.in: 2006-09-16 22:20:03 +00:00
brp-verify_elf.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
check-files.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
compress_files.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
convertrpmrc.sh added cvsid 2003-11-08 19:52:04 +00:00
cpanflute sync with rpm4 branch: s/redhat/altlinux/g 2002-03-25 21:48:59 +00:00
cpanflute2 sync with rpm4 branch: s/redhat/altlinux/g 2002-03-25 21:48:59 +00:00
cross-build sync with rpm4 branch: s/redhat/RPM/g 2002-03-25 21:50:17 +00:00
delayed_rebuilddb sync with rpm4 branch: added new files 2002-03-25 20:37:46 +00:00
files.req.files.in factored files.req 2007-03-12 15:05:18 +03:00
files.req.in factored files.req 2007-03-12 15:05:18 +03:00
files.req.list scripts/files.req.list: Add /etc/udev/rules.d 2007-02-11 21:26:45 +00:00
find-lang.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
find-package.in find-package (FindByName): if the index search detects real conflict, try /usr/bin/which first 2007-03-12 15:06:05 +03:00
find-prov.pl Initial revision 2002-03-25 20:16:26 +00:00
find-provides.perl Initial revision 2002-03-25 20:16:26 +00:00
find-req.pl Initial revision 2002-03-25 20:16:26 +00:00
find-requires.perl Initial revision 2002-03-25 20:16:26 +00:00
fixup-binconfig.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
fixup-libraries Removed cvsid tags. 2006-05-14 17:05:34 +04:00
fixup-libtool.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
fixup-pkgconfig.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
functions scripts/functions: implemented ArgvFileAction() 2007-03-11 15:00:21 +03:00
get_magic.pl Initial revision 2002-03-25 20:16:26 +00:00
getpo.sh Initial revision 2002-03-25 20:16:26 +00:00
http.req Initial revision 2002-03-25 20:16:26 +00:00
javadeps.c sync with rpm4 branch: added new files 2002-03-25 20:37:46 +00:00
ldd.in scripts/ldd.in: adapted for empty RPM_BUILD_ROOT 2007-03-11 15:00:32 +03:00
lib.prov.files factored lib.req and lib.prov 2007-03-11 15:00:33 +03:00
lib.prov.in factored lib.req and lib.prov 2007-03-11 15:00:33 +03:00
lib.req.files lib.req.files: added "executable not executable" warning 2007-03-12 15:06:08 +03:00
lib.req.in factored lib.req and lib.prov 2007-03-11 15:00:33 +03:00
magic.prov Initial revision 2002-03-25 20:16:26 +00:00
magic.req Initial revision 2002-03-25 20:16:26 +00:00
Makefile.am implemented symlinks.req 2007-03-12 15:06:09 +03:00
pam.prov.files adapted pam.req and pam.prov 2007-03-12 15:06:07 +03:00
pam.prov.in adapted pam.req and pam.prov 2007-03-12 15:06:07 +03:00
pam.req.files adapted pam.req and pam.prov 2007-03-12 15:06:07 +03:00
pam.req.in adapted pam.req and pam.prov 2007-03-12 15:06:07 +03:00
perl.prov updated version from at@ 2003-09-12 16:27:18 +00:00
perl.req fix parser from perl maintainer 2003-09-22 13:56:20 +00:00
pkgconfig.prov.files adapted pkgconfig.req and pkgconfig.prov 2007-03-11 15:00:29 +03:00
pkgconfig.prov.in adapted pkgconfig.req and pkgconfig.prov 2007-03-11 15:00:29 +03:00
pkgconfig.req.files adapted pkgconfig.req and pkgconfig.prov 2007-03-11 15:00:29 +03:00
pkgconfig.req.in adapted pkgconfig.req and pkgconfig.prov 2007-03-11 15:00:29 +03:00
rpm2cpio.sh Initial revision 2002-03-25 20:16:26 +00:00
rpm.daily sync with rpm4 branch 2002-03-25 21:51:30 +00:00
rpm.log Initial revision 2002-03-25 20:16:26 +00:00
rpm.xinetd Initial revision 2002-03-25 20:16:26 +00:00
rpmdiff Initial revision 2002-03-25 20:16:26 +00:00
rpmdiff.cgi Initial revision 2002-03-25 20:16:26 +00:00
shebang.req.files factored shebang.req 2007-03-11 15:00:24 +03:00
shebang.req.in factored shebang.req 2007-03-11 15:00:24 +03:00
shell.prov.files adapted shell.req and shell.prov 2007-03-11 15:00:23 +03:00
shell.prov.in adapted shell.req and shell.prov 2007-03-11 15:00:23 +03:00
shell.req.files adapted shell.req and shell.prov 2007-03-11 15:00:23 +03:00
shell.req.in shell.req: better error diagnostics 2007-03-12 15:05:57 +03:00
shlib.req.awk Add shlib.req.awk 2006-01-11 00:39:39 +00:00
Specfile.pm Initial revision 2002-03-25 20:16:26 +00:00
sql.prov Initial revision 2002-03-25 20:16:26 +00:00
sql.req Initial revision 2002-03-25 20:16:26 +00:00
static.req.files factored static.req 2007-03-11 15:00:35 +03:00
static.req.in factored static.req 2007-03-11 15:00:35 +03:00
strip_files.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
symlinks.req.files implemented symlinks.req 2007-03-12 15:06:09 +03:00
symlinks.req.in implemented symlinks.req 2007-03-12 15:06:09 +03:00
tcl.req fixed perl syntax 2003-09-22 13:54:41 +00:00
trpm Initial revision 2002-03-25 20:16:26 +00:00
u_pkg.sh Initial revision 2002-03-25 20:16:26 +00:00
verify-elf.in Removed cvsid tags. 2006-05-14 17:05:34 +04:00
vpkg-provides2.sh Initial revision 2002-03-25 20:16:26 +00:00
vpkg-provides.sh Initial revision 2002-03-25 20:16:26 +00:00