Commit Graph

331 Commits

Author SHA1 Message Date
Alexey Tourbin
47bd8eff65 shebang.req: don't read the whole script
$ (echo '#!/usr/bin/perl'; cat /dev/zero) |sed -n '1s|^#![[:space:]]*/|/|p;q'
/usr/bin/perl
$
2008-04-01 15:33:19 +04:00
Alexey Tourbin
eb301af2f4 lib.req: do not optimize dependencies on standard ELF interpreter 2008-03-17 21:07:06 +03:00
f1ed4d2bdd scripts: Replace paths to basic programs with their names
Absolute pathnames in shell scripts are redundant, $PATH is enough.
2008-02-29 12:30:29 +00:00
10a67f5ef4 Revert "find-package (FindByPath): optimize out /bin/sh /bin/cat etc."
This reverts commit 54e8a1cff1.
2008-02-27 15:08:12 +00:00
86452d3194 Revert "find-package (FindByName): optimize out sh cat etc."
This reverts commit a93f78c60a.
2008-02-27 15:06:08 +00:00
63003fbeb9 Fix typos 2008-02-25 20:07:05 +00:00
816b34cd86 verify-elf.in: PIE executables on ARM always has TEXTREL, do not check them 2008-02-24 23:10:38 +00:00
Alexey Tourbin
3b998b2e3c Merge branch 'master' of git.alt:/people/ldv/packages/rpm 2008-02-23 08:23:37 +03:00
c20d7af1d2 pam.req.in: Add substack support 2008-02-22 22:38:08 +00:00
Alexey Tourbin
810f4045ed find-package: removed findpackage_xbroot stuff 2008-02-19 06:29:30 +03:00
Alexey Tourbin
e0598b6fe3 functions (ValidateBuildRoot): require canonical RPM_BUILD_ROOT
Some scripts like lib.req rely on the fact that RPM_BUILD_ROOT
should not end with trailing slashes or something.  Other
scripts like find-package explicitly assume that RPM_BUILD_ROOT
can be relocated within filesystem; they use something like
"real_buildroot" variables.  The code gets complicated,
fragile, and error-prone.

Therefore, guys, hereby I FORBID non-canonical RPM_BUILD_ROOT path.
Note that RPM_BUILD_ROOT actually does not have to exist.
This is another problem...
2008-02-19 06:28:14 +03:00
Alexey Tourbin
17b1c6b296 lib.req: return early if there is no dynamic section, to stop ldd failures with klibc executables
(before this commit)
$ ./scripts/lib.req.in /lib/mkinitrd/udev/lib/udev/usb_id
/lib/klibc-LqkyBjjvuUwwxYg5B9IteGNsWsI.so
ldd: ERROR: /lib/mkinitrd/udev/lib/udev/usb_id: trace failed
$

(after this commit)
$ ./scripts/lib.req.in /lib/mkinitrd/udev/lib/udev/usb_id
/lib/klibc-LqkyBjjvuUwwxYg5B9IteGNsWsI.so
$
2008-02-19 00:43:21 +03:00
Alexey Tourbin
e1bb17d070 lib.req.files: check "uses shared libs" as well as "dynamically linked", for klibc binaries 2008-02-19 00:22:23 +03:00
Alexey Tourbin
903c1810f3 lib.req: enabled ELF interp dependencies except for standard glibc's /lib*/ld-linux*.so.2 2008-02-18 22:31:29 +03:00
Alexey Tourbin
bf4a93fd36 s/\.packaged-files:/.files:/g 2008-02-18 18:26:21 +03:00
Alexey Tourbin
cb01bdf610 find-package (FindByName): buildroot topdir goes sbin-ish, for scriptlets 2008-02-02 01:21:10 +03:00
Alexey Tourbin
b523e1fd5c find-package (FindByPath): paths already required are safe enough, too 2008-02-02 00:57:33 +03:00
Alexey Tourbin
d2f98fca79 find-package (FindByPath): do raw dependencies for explicitly provided paths 2008-02-02 00:49:40 +03:00
Alexey Tourbin
c9bdf97976 find-package (FindByPath): added comment about file-level dependencies and APT semi-unmets 2008-02-01 23:59:28 +03:00
Alexey Tourbin
b3c6a8452e implemented /usr/lib/rpm/find-scriptlet-requires 2008-01-25 22:01:51 +03:00
Alexey Tourbin
c21526400d find-package: updated copyright years 2008-01-24 22:28:01 +03:00
Alexey Tourbin
a93f78c60a find-package (FindByName): optimize out sh cat etc. 2008-01-24 17:45:45 +03:00
Alexey Tourbin
54e8a1cff1 find-package (FindByPath): optimize out /bin/sh /bin/cat etc. 2008-01-24 15:50:52 +03:00
Alexey Tourbin
fb695a0022 find-package (FindByPath): emit raw dependencies for */bin/* */sbin/* */etc/* 2008-01-24 03:59:33 +03:00
Alexey Tourbin
5179962b46 find-package (FindByPathUnderBuildroot): refactored, added host-aided canonicalization case 2008-01-24 02:54:48 +03:00
Alexey Tourbin
c8ccb0da6c find-package: enhanced path lookups under buildroot, added special case for dir dependencies
$ less alterator-install-common-desktop-0.11-alt1.i586.rpm |grep help
-rwxr-xr-x    1 root    root              972 Oct 30 18:38 /usr/share/alterator/help/ru_RU/basesystem.html
-rwxr-xr-x    1 root    root              340 Oct 30 18:38 /usr/share/alterator/help/ru_RU/kbd.html
-rwxr-xr-x    1 root    root             2233 Oct 30 18:38 /usr/share/alterator/help/ru_RU/license.html
-rwxr-xr-x    1 root    root             1280 Oct 30 18:38 /usr/share/alterator/help/ru_RU/lilo.html
-rwxr-xr-x    1 root    root             3032 Oct 30 18:38 /usr/share/alterator/help/ru_RU/network.html
-rwxr-xr-x    1 root    root             4840 Oct 30 18:38 /usr/share/alterator/help/ru_RU/packages.html
-rwxr-xr-x    1 root    root             1928 Oct 30 18:38 /usr/share/alterator/help/ru_RU/root.html
-rwxr-xr-x    1 root    root             1387 Oct 30 18:38 /usr/share/alterator/help/ru_RU/time.html
-rwxr-xr-x    1 root    root             1223 Oct 30 18:38 /usr/share/alterator/help/ru_RU/user.html
-rwxr-xr-x    1 root    root            11024 Oct 30 18:38 /usr/share/alterator/help/ru_RU/vm.html
-rwxr-xr-x    1 root    root             1789 Oct 30 18:38 /usr/share/alterator/help/ru_RU/x11.html
lrwxrwxrwx    1 root    root               31 Oct 30 18:38 /usr/share/alterator/help/ru_UA -> /usr/share/alterator/help/ru_RU
$

%files ...
%_datadir/alterator/help/ru_RU/*
%_datadir/alterator/help/ru_UA

The package referes ru_RU directory but does not own the directory.
Old behaviour: unmet dependency.

>  alterator-icons-lite-0.4.0-alt1      Requires(rpmlib)        rpmlib(PayloadFilesHavePrefix) <= 4.0-1
> +alterator-install-common-desktop-0.11-alt1   Requires        /usr/share/alterator/help/ru_RU
>  alterator-install-common-desktop-0.11-alt1   Requires        alterator-autoinstall

New behaviour: though the package does not explicitly own the directory,
it has some files packaged under the directory.  Because of this, ru_UA
symlink will not be broken after install.  We chose to be forgiving:

symlinks.req: WARNING: /usr/src/tmp/alterator-install2-desktop-buildroot/usr/share/alterator/help/ru_UA: directory /usr/share/alterator/help/ru_RU not owned by the package
2008-01-23 02:42:02 +03:00
Alexey Tourbin
4c187ca387 functions: added new function PackagedFiles() 2008-01-23 01:22:45 +03:00
Alexey Tourbin
58e433c8be check-files: ignore -wholename "$RPM_BUILD_ROOT/.*" paths 2008-01-22 21:11:41 +03:00
Alexey Tourbin
11c666284f functions (Fatal): added "ERROR:" prefix 2008-01-22 19:51:11 +03:00
Alexey Tourbin
0585689562 lib.req: added a copyright holder 2008-01-16 02:42:11 +03:00
Alexey Tourbin
ea2fa9a0b1 lib.req: fixed file-level dependencies output
$ gcc test.c /usr/lib/perl5/vendor_perl/i386-linux/auto/Glib/Glib.so
$ objdump -p a.out |grep Glib
  NEEDED      /usr/lib/perl5/vendor_perl/i386-linux/auto/Glib/Glib.so
$ ldd a.out |grep Glib
        /usr/lib/perl5/vendor_perl/i386-linux/auto/Glib/Glib.so (0xb7ec0000)
$

(before previous commit)
$ /usr/lib/rpm/lib.req a.out
rtld(GNU_HASH)
libc.so.6(GLIBC_2.0)
lib.req: WARNING: /home/at/a.out: library /usr/lib/perl5/vendor_perl/i386-linux/auto/Glib/Glib.so not found
$

(before this commit)
$ ./scripts/lib.req.in a.out
rtld(GNU_HASH)
libc.so.6(GLIBC_2.0)
/usr/lib/perl5/vendor_perl/i386-linux/auto/Glib//usr/lib/perl5/vendor_perl/i386-linux/auto/Glib/Glib.so
$

(after this commit)
$ ./scripts/lib.req.in a.out
rtld(GNU_HASH)
libc.so.6(GLIBC_2.0)
/usr/lib/perl5/vendor_perl/i386-linux/auto/Glib/Glib.so
$
2008-01-16 02:42:01 +03:00
Alexey Tourbin
af1ce1840d lib.req: fixed awk script for ldd output
This now handles the case of relocated ld-linux.so.2:
	/lib/ld-linux.so.2 => /tmp/buildroot/lib/ld-linux.so.2

$ cd /tmp/buildroot
$ ii() {install -v -pD $1 .$1; }
$ ii /lib/ld-linux.so.2
$ ii /usr/lib/libmemusage.so
$

(old)
$ RPM_BUILD_ROOT=$PWD /usr/lib/rpm/lib.req ./usr/lib/libmemusage.so
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.0)
lib.req: WARNING: /usr/lib/libmemusage.so: library ld-linux.so.2 not found
libdl.so.2(GLIBC_2.0)
$

(new)
$ RPM_BUILD_ROOT=$PWD ~/git.alt/rpm/scripts/lib.req.in ./usr/lib/libmemusage.so
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.0)
ld-linux.so.2(GLIBC_2.3)
libdl.so.2(GLIBC_2.0)
$
2008-01-16 02:27:21 +03:00
Alexey Tourbin
b2aec52d0e symlinks.req.files: do all symbolic links (will emit file-level dependencies for targets under RPM_BUILD_ROOT) 2007-12-03 14:22:54 +03:00
Alexey Tourbin
b2b7954938 pkgconfiglib.req: use FindPackage to emit file-level dependencies on RPM_BUILD_ROOT libraries 2007-12-03 14:13:50 +03:00
Alexey Tourbin
cf62e1c09f pkgconfiglib.req: use plain "readlink -ve" for gcc_libdirs 2007-12-03 14:00:05 +03:00
Alexey Tourbin
6bc8c52298 shell.req: manage "has execuatable candidate" verbosity for files under RPM_BUILD_ROOT 2007-12-03 12:32:11 +03:00
Alexey Tourbin
49e00608a0 find-package (FindByName): emit file-level dependencies for files under RPM_BUILD_ROOT 2007-12-03 12:06:58 +03:00
Alexey Tourbin
34974c9e88 pkgconfiglib.req: use Warning() 2007-12-03 11:40:22 +03:00
Alexey Tourbin
b630a6cd57 find-package (FindByPath): use Warning() for paths that cannot be canonicalized under RPM_BUILD_ROOT 2007-12-03 11:40:21 +03:00
Alexey Tourbin
9ad1babe6a functions: new function: Warning() 2007-12-03 11:39:48 +03:00
Alexey Tourbin
3cb16e8f3f shell.req: set empty PATH= for 'type -t' check, to avoid filesystem lookups 2007-11-30 13:45:03 +03:00
Alexey Tourbin
3abcad0533 lib.req: do file-level dependencies for private libraries
Private libraries are the ones which have non-standard prefix.
We choose to produce file-level dependency (without braces) on
such private libraries in two cases: 1) either the library was
found under RPM_BUILD_ROOT; or 2) no versioned symbols are used
from the library (no versioned references).
2007-11-25 18:34:41 +03:00
Alexey Tourbin
6e73a89c9b find-package (FindByPath): emit file-level dependencies for paths that are under RPM_BUILD_ROOT 2007-11-23 12:54:37 +03:00
Alexey Tourbin
22854f6e29 find-package (FindPackage): extra check for valid pathname, excludes "/" 2007-11-23 11:51:32 +03:00
Alexey Tourbin
e56761c95f functions (CanonPath): fixed `CanonPath "/"'
was:
$ sh -c '. /usr/lib/rpm/functions; CanonPath /'
readlink: : No such file or directory
$

now:
$ sh -c '. scripts/functions; CanonPath /'
/
$
2007-11-23 11:47:47 +03:00
Alexey Tourbin
822eb84f3d Revert "find-package (FindByPath): new function LinkIsAlternative()"
Things suck.

$ rpm -q --whatprovides /usr/bin/python
python-base-2.4.4-alt13
$ rpm -q --whatprovides /usr/bin/../bin/python
warning: no package provides /usr/bin/python
$

This reverts commit 56a9571e4a.
2007-11-21 17:12:03 +03:00
Alexey Tourbin
56a9571e4a find-package (FindByPath): new function LinkIsAlternative()
This will also check if the link is not owned by any package,
but the path is provided by some package.

$ rpm -qf /usr/bin/python
warning: file /usr/bin/python is not owned by any package
$ rpm -q --whatprovides /usr/bin/python
python-base-2.4.4-alt13
$

This looks very much like an alternative, ESPECIALLY if an intermediate
path component, which is a link to directory (python is not the case).

This new condition is disabled, only a warning is issued.
We'll see if it should be enabled.
2007-11-21 15:32:20 +03:00
Alexey Tourbin
c9d79d6f16 moved functions and find-package from rpm-build to rpm, added .provides.sh
This will allow to relax rpm-build-* dependencies, hopefully without adding
new essential dependencies to rpm (note that rpm already depends on sh and
coreutils; now this also includes grep, and possibly should include sed,
awk, and gzip).

Consider mono-mcs package, which is mono C# compiler.  Recently I added
dependency on rpm-build-mono to this package, to enable automatic support
for mono dependencies whenever mono compiler is used.  Now the problem
is that rpm-build-mono depends on rpm-build (via /usr/lib/rpm/functions),
and rpm-build in turn requires a lot of packages, e.g. gcc and autotools,
for the purpose of populating base build environment.

To put it another way, the problem is that it is impossible to install
mono compiler (with automatic support for mono dependencies) without also
installing gcc and stuff, which is roughly 100M of unrelated packages.

This seems like a minor problem to me, since every "devel" package (including
compilers) can conventionally require base build environment.  However,
Alexander Bokovoy argues that school kids desperately need mono-mcs compiler
on their desktops without gcc and another stuff from the base build environment!

The upshot is that possibly we want to relax rpm-build-* dependencies,
so that those "support for dependencies" packages do not require
full-fledged rpm-build.  The easiest way to accomplish this is to
move /usr/lib/rpm/functions from rpm-build to rpm package.  I also
choose to move /usr/lib/rpm/find-package as well, along with making
/usr/lib/rpm/.provides.sh, so that rpm-build-* packages depend on
something like /usr/lib/rpm(Fatal), not just rpm.
2007-11-21 14:14:55 +03:00
Alexey Tourbin
6c5142c792 shell.req: removed "function" from "alias|keyword|builtin" check
It seems that our /bin/bash interpreter does not have any "built-in"
functions by default.

$ bash -c 'foo() { :; }; set' |grep ' ()'
foo ()
$ bash -c 'set' |grep ' ()'
$

Thus funcions can be user-defined only.  Generally, what was wrong
with this "function" check is that it was executed in shell.req context.
That is, since e.g. "Info" and "Fatal" are functions within shell.req,
all other dependencies on "Info" and "Fatal" were simply ignored.
This was wrong and this has now been fixed.

Another possibility to ignore current shell.req context while checking
for built-in things is to spawn "clean" shell instance:

-	case "$(type -t -- "$2")" in
+	case "$($sh -c 'type -t "$1"' "$0" "$2")" in

But this can be rather expensive at this early "cleanup" stage.
2007-11-21 14:14:54 +03:00
Alexey Tourbin
d2eedf0fd3 functions: use $(dirname "$0") for /usr/lib/rpm 2007-11-18 08:02:31 +03:00