Commit Graph

71 Commits

Author SHA1 Message Date
61e11d51a2 s/fgrep/grep -F/ 2022-04-26 08:00:00 +00:00
Alexey Tourbin
75b044f2cb find-package, shebang.req: introduced RPM_FINDPACKAGE_MANDATORY=1 2020-04-07 11:05:34 +03:00
Ivan Zakharyaschev
e8c7bc4453 find-package.in: group the pruned packages nicer in the list 2018-05-15 17:26:10 +00:00
Gleb Fotengauer-Malinovskiy
39018f9f32 find-package: add support for newer naming of gcc and libstdc++-devel 2015-05-21 18:07:37 +03:00
Alexey Tourbin
91d73ac0ae find-package: prune generic devel deps like gcc4.x in HOST_PKG mode 2011-02-27 06:29:15 +03:00
Alexey Tourbin
843562f82b find-package: introduced RPM_FINDPACKAGE_COMMANDS_LOG 2010-04-08 11:24:57 +04:00
Alexey Tourbin
959c18fe5e find-package: renamed FindByPath -> FindByFile 2010-04-08 11:24:55 +04:00
Alexey Tourbin
70ab659464 find-package: changed "not found" diagnostics to "not installed" 2009-07-01 23:04:32 +04:00
Alexey Tourbin
a55bb554aa find-package: removed contents_index_all and APT-friendly stuff 2009-07-01 23:04:24 +04:00
Alexey Tourbin
b46be108bd find-package: updated check for file path components being alternatives 2008-08-19 23:58:39 +04:00
Alexey Tourbin
06bf496189 find-package (FindByName): set RPM_FINDPACKAGE_HOST_PKG_NAMES=1 for host-system lookup
This should affect dependencies only when no contents_index_bin is available.
After "APT-freindly" logic was introduced, host-system lookup always yields
file paths, but we want package names (except for alternatives etc.).

(old behaviour)
$ sh -c '. /usr/lib/rpm/find-package; FindPackage script perl'
/usr/bin/perl
$

(new behaviour)
$ sh -c '. ./scripts/find-package.in; FindPackage script perl'
perl-base
$
2008-06-14 22:34:43 +04:00
Alexey Tourbin
737b8a005b find-package: introduced RPM_FINDPACKAGE_HOST_PKG_NAMES 2008-06-14 22:15:05 +04: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
Alexey Tourbin
810f4045ed find-package: removed findpackage_xbroot stuff 2008-02-19 06:29:30 +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
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
49e00608a0 find-package (FindByName): emit file-level dependencies for files under RPM_BUILD_ROOT 2007-12-03 12:06:58 +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
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
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
377a8491df find-package (FindByPath): use CanonPath again
Note that alternative path may also require non-blind canonicalization (in
very pathological cases), for which I also use CanonPath.

(old behaviour, wrong)
$ sudo ln -s share /usr/bare
$ sh -efu -c '. scripts/find-package.in; FindPackage script /usr/bare/libtool/config.guess'
/usr/bare/libtool
sh: script: alternative /usr/bare/libtool prevents /usr/bare/libtool/config.guess dependency resolution
$

(new behaviour, good)
$ sh -efu -c '. scripts/find-package.in; FindPackage script /usr/bare/libtool/config.guess'
/usr/share/libtool
sh: script: alternative /usr/share/libtool prevents /usr/bare/libtool/config.guess dependency resolution
$
2007-11-18 06:56:52 +03:00
Alexey Tourbin
5b353de0eb find-package (FindByPath): rewrite without CanonPath, use two-pass canonicalization 2007-11-17 17:03:04 +03:00
Alexey Tourbin
2bf12baa21 find-package (FindByPath): implemented smart check for alternatives, cf. bug #13374
Some examples.

1)
$ sh -efu -c '. scripts/find-package.in; FindPackage script /usr/share/libtool'
/usr/share/libtool
$ sh -efu -c '. scripts/find-package.in; FindPackage script /usr/share/libtool/'
/usr/share/libtool
$

This shows that alterntaives check is no longer restricted to deficient
	readlink "$rep" |grep '^/etc/alternatives/'
logic.  Old behaviour was:

$ sh -efu -c '. /usr/lib/rpm/find-package; FindPackage script /usr/share/libtool'
/usr/share/libtool
$ sh -efu -c '. /usr/lib/rpm/find-package; FindPackage script /usr/share/libtool/'
sh: script: checking contents_index_all for /usr/share/libtool-1.5
sh: script: /usr/share/libtool-1.5 -> libtool_1.5 (via contents_index_all)
libtool_1.5
$

2)
$ sh -efu -c '. scripts/find-package.in; FindPackage script /usr/share/libtool/../autoconf'
/usr/share/autoconf
/usr/share/libtool
$

This shows that any number of alternatives can be resolved within a single path.

3)
$ sh -efu -c '. scripts/find-package.in; FindPackage script /usr/share/libtool/config.guess'
/usr/share/libtool
sh: script: alternative /usr/share/libtool prevents /usr/share/libtool/config.guess resolution
$

This shows that we cannot resolve paths under alternatives directory.

4)
$ sh -efu -c '. scripts/find-package.in; FindPackage script /usr/share/libtool/../../bin/perl'
/usr/share/libtool
perl-base
$

This shows that we actually CAN resolve paths which are not under alternatives directory.
2007-11-17 15:04:06 +03:00
5b9096b561 scripts/*.in: s|/usr/lib/rpm/|@RPMCONFIGDIR@/|g 2007-11-10 20:46:59 +00:00
Alexey Tourbin
3064082899 find-package (FindByName): better check for maybe_function 2007-10-09 12:30:05 +04:00
Alexey Tourbin
7d68978688 find-package (FindByPath): ignore /dev/* /proc/* /sys/* dependencies 2007-09-23 01:23:34 +04:00
Alexey Tourbin
d9b38d645f find-package (FindByPath): render $RPM_BUILD_DIR* dependencies invalid 2007-09-21 15:58:05 +04:00
Alexey Tourbin
8dd5a961e8 find-package (FindByPath): consider (not-so-) broken symbolic links inside RPM_BUILD_ROOT 2007-09-19 14:16:01 +04:00
Alexey Tourbin
d74f8d9a69 find-package (findByName): replaced /usr/bin/which with custom shell code
This is to address a few problems:

1) When checking RPM_BUILD_ROOT, st_mode test performed by /usr/bin/which
is not quite reliable.  Files can be packaged with different %attr mode.

2) When checking RPM_BUILD_ROOT, there could be symbolic links there
which are (not-so-) broken.

3) When checking host system, files like /sbin/init (which is 0700)
are effectively bypassed by /usr/bin/which.

4) There's an ongoing practice of placing shell function libraries
under /usr/bin, e.g. /usr/bin/git-sh-setup.  These files are sourced
from within shell scripts and need not be executable at all.

This leads me to the point that permission check, which is performed by
/usr/bin/which, is not needed at all.  Note that things are getting more like
contents_index_bin search.  And for RPM_BUILD_ROOT, we do not even require
strong stat-wise file existence.

I like this new term: "strong stat-wise file existence".
It's awesome.
2007-09-19 12:57:08 +04:00
Alexey Tourbin
3925c4c392 find-package (FindByName): manage "not found" verbosity 2007-09-19 11:08:53 +04:00
Alexey Tourbin
a1e07a6d21 find-package (FindByName): added sbin-ish paths under /etc 2007-09-19 10:33:12 +04:00
Alexey Tourbin
d03deaf0fa find-package: implemented different PATHs for user and root code (the */sbin scripts)
also appended /usr/games to both user and root PATHs
2007-09-19 00:17:53 +04:00
Alexey Tourbin
7ece64adc3 find-package (FindPackage): unquoted $valid case paterns 2007-09-12 20:07:43 +04:00
Alexey Tourbin
e5f015d831 find-package (FindPackage): fixed shell syntax (D'oh!) 2007-09-12 19:34:01 +04:00
Alexey Tourbin
4eb4ccf490 find-package: fixed Verbose message for contents_index_bin 2007-09-12 19:28:46 +04:00
Alexey Tourbin
2b1c36538f find-package: implemented protection against shell metacharacters and evil paths
There are two possibilities for protection:
1) we should protect at least from very evil shell metacharacters,
like [$*], and also from [:cntrl:] (e.g. newline).
2) we can provide an exhaustive list of characters that are valid
for non-evil pathnames and commands, and issue mandatory warning
if the command or path appears to be evil.

I chose the latter approach.
Valid character range is 'A-Za-z0-9/@=.,:_+-'.

Note that (almost) all files from our base build system
are valid paths:

$ valid='A-Za-z0-9/@=.,:_+-'
$ hsh-run -- rpm -qal |grep "[^$valid]"
/usr/bin/[
/usr/share/man/man1/[.1.bz2
(contains no files)
(contains no files)
$

Later we'll see if the range of valid characters needs to be extended.
2007-09-10 13:32:26 +04:00
Alexey Tourbin
650b0fc0c1 find-package (FindByPath): use CanonPath before contens_index search
I see that this can add SOME problems if e.g. /usr is relocated
to /storage/usr in the build environment.  This is because CanonPath
follows symlinks for dirname.

But I argue that it is safe for hasher, and it fixes some problems
with contents_index search which is used only in the hasher (by default).

I also argue that, even if /usr is relocated, this is not going to be a BIG
problem, because it is not going to produce unmet dependencies (well, most
of the time).  This is because 'rpm -qf' will work as expected in that screwed
build environment.
2007-08-27 21:27:05 +04:00
Alexey Tourbin
71c3d7908d find-package (FindByName): in ambigous case, first check if [ path = pkg ] 2007-08-10 16:10:58 +04:00