Commit Graph

1143 Commits

Author SHA1 Message Date
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
8119ee01ac reqprov.c (addReqProv): eliminate dependencies on the package name
perl-base will no longer require 'perl-base >= 1:5.7.3'.
2007-11-23 10:59:39 +03:00
Alexey Tourbin
dee7e797ef reqprov.c (addReqProv): eliminate dependencies on packaged files
Note that this works only for automatic dependencies, because file list
is not ready when specfile dependencies are added.  This is okay.

Also note that this will optimize out directory-like dependencies
if the package owns the directory.  This is yet okay, but this is
a bit more subtle point.
2007-11-22 16:48:30 +03:00
Alexey Tourbin
92093bf1f0 reqprov.c (addReqProv): prepare for more self-requires elimination 2007-11-22 15:28:16 +03:00
Alexey Tourbin
9feeb5445e 4.0.4-alt81
- symlinks.req: do only one single step of symlink resolution;
  find-package (FindByPath): check each path component for alternatives;
  this fixes the case of e.g. dependency on /usr/share/libtool/config.sub,
  where '/usr/share/libtool -> libtool-1.5/' is an alternative;
  we now stop at alternative directory and simply yield the dependency
  on /usr/share/libtool, instead of libtool_1.5 (see also #13374)
- moved /usr/lib/rpm/functions and /usr/lib/rpm/find-package from rpm-build
  to rpm, to relax e.g. rpm-build-mono dependencies
- relative.c: various fixes by Alex V. Myltsev and Dmitry V. Levin
2007-11-21 17:49:23 +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
2cf4bcc171 spec: ignore functions and find-package dependencies 2007-11-21 14:53:30 +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
d9a787cd0f relative.c: Reindent 2007-11-18 16:16:42 +00:00
6eaed149a0 relative.c: Use heap for memory allocation
Stack allocation is unsafe:
$ ulimit -s 64; relative /b `perl -e 'print "/a" x 32768'`
2007-11-18 16:12:38 +00:00
f05f5239ad relative.c: Introduce xstrdup(), reindent 2007-11-18 15:52:46 +00:00
27a6987f4e relative.c: Fix normalize()
Testcase:
$ relative //a/. /
a/
2007-11-18 15:40:32 +00:00
3daca56db1 relative.c: Reindent 2007-11-18 15:38:34 +00:00
6da3cc2c31 relative.c: s/__progname/program_invocation_short_name/ 2007-11-18 15:26:46 +00:00
1b98cd3a7b relative.c: Reindent 2007-11-18 15:24:55 +00:00
Alex V. Myltsev
9b422d836d relative.c: fix an off-by-one (kind of) error.
Test:
 $ relative /a/b/ /ax/
should print "../a/b/".
2007-11-18 14:16:59 +03:00
Alexey Tourbin
d2eedf0fd3 functions: use $(dirname "$0") for /usr/lib/rpm 2007-11-18 08:02:31 +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
78a8d8e533 funcionts (CanonPath): use two-pass canonicalization
This removes the ambiguity with directories.  Note that before this change,
e.g. [ -L /etc/init.d ] and [ -L /etc/init.d/ ] would yield different
result, which required ad hock -d test to keep things consistent.
With first-pass "blind" (cleanup-only) canonicalization, ad hock
test for directories is no longer required, and things are yet more
consistent.

The things are now consistent with documented behaviour -- "canonicalize
each path component except for the last".  This actually changed previous
behaviour:
was:	/etc/init.d -> /etc/rc.d/init.d
now:	/etc/init.d -> /etc/init.d

Generally, if we have some path for which we should yield a dependency,
CanonPath is probably the best we can do before running e.g. contents_index
search.
2007-11-18 02:49:44 +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
Alexey Tourbin
347a9eb418 symlinks.req: do only one single step of symlink resolution 2007-11-17 10:52:57 +03:00
745b1ae3e0 4.0.4-alt80
- Merged ARM support changes made by Kirill Shutemov.
- Minor scripts/* cleanup.
2007-11-10 20:47:04 +00:00
b29c6e2b2d scripts/pam.*.files: Optimize filename check 2007-11-10 20:47:03 +00:00
5209355a19 scripts/*.req.files: Fix "not executable" wording 2007-11-10 20:47:02 +00:00
66ee80b813 scripts/*.files: Use single quotes for constant strings 2007-11-10 20:47:01 +00:00
5b9096b561 scripts/*.in: s|/usr/lib/rpm/|@RPMCONFIGDIR@/|g 2007-11-10 20:46:59 +00:00
5e023d62c1 scripts/functions: Minor code cleanup
Fatal, Verbose, Debug: Use Info().
ValidateBuildRoot: Use single quotes for constant string.
SetupMethods: Do not initialize loop variable. Use "tr -s".
RunMethods: Do not initialize loop variable. Use "echo ''" trick. Cleanup "$@" use.
ArgvFileAction: Do not initialize auto variable.
2007-11-10 20:46:29 +00:00
e6d18b0591 Merge branch 'altlinux-4.0' 2007-11-10 13:27:49 +00:00
Kirill A. Shutemov
629b4b18bc Add armv5tejl support 2007-11-10 13:26:47 +00:00
Kirill A. Shutemov
80426c365f rpmrc.in: remove -fsigned-char from optflags for arm* 2007-11-10 13:26:46 +00:00
Kirill A. Shutemov
f002179ab8 Refresh ARM support
Add arm and armb CANONARCH: common CANONARCH for general purpose distribution. It's armv4 without Thumb now.
Update %optflags for ARM
Add %arm macros: list of all ARM processors
2007-11-10 13:26:45 +00:00
Kirill A. Shutemov
06eb5ce9e7 Do not check STACK entry in ARM ELF files 2007-11-10 13:26:44 +00:00
a6f4e2a41e More %_target_platform tweaks: cleanup build_os filter; initialize %_gnueabi; replace %_gnu with %_gnueabi in %_target_platform 2007-11-10 13:26:21 +00:00
Kirill A. Shutemov
ddab849441 - %_gnu appended to %_target_platform
- %_gnu is -gnueabi for gnueabi targets
2007-11-10 15:45:30 +03:00
Alexey Tourbin
35ddf662d8 4.0.4-alt79
- shell.req: implemented strong self-requires elimination within
  a package; if ANY shell script defines function "foo", dependencies
  on "foo" are discarded in all shell scripts throughout the package;
  a warning is issued if e.g. /usr/bin/foo executable is available
- pkgconfiglib.req: new dependency generator for "Libs" field in *.pc
  files; maps e.g. "-lfoo" -> /usr/lib/libfoo.so -> libfoo-devel
2007-10-29 17:16:14 +03:00
Alexey Tourbin
488d03d395 pkgconfiglib.req: downgraded a few Verbose messages to Debug 2007-10-29 14:55:54 +03:00
Alexey Tourbin
e247bb88db enabled pkgconfiglib.req 2007-10-29 14:21:47 +03:00
Alexey Tourbin
68bf0157e9 shell.req (ShellReq): still check if executable candidates are available, even in the first pass
$ cat test.sh
rsync() { command rsync -vP "$@" ; }
$ scripts/shell.req.in test.sh
shell.req.in: /home/at/git.alt/rpm/test.sh: rsync() is possibly used before its definition
shell.req.in: /home/at/git.alt/rpm/test.sh: rsync() has execuatable candidate: rsync -> rsync (skip)
$
2007-10-29 13:36:36 +03:00
Alexey Tourbin
3f1e70716d pkgconfiglib.req: use "pkg-config --disable-recursion" to get libs and libdirs 2007-10-29 12:29:04 +03:00
Alexey Tourbin
2ae82b0a11 pkgconfiglib.req: also check *.a static libraries 2007-10-16 14:47:34 +04:00
Alexey Tourbin
02e9558ab6 pkgconfiglib.req: checking -rpath is wrong; back to --libs-only-l and --libs-only-L
Contrary to my quick ld(1) interpretation, -rpath option does not really
adjust search path directories.

$ gcc ldtest.c -Wl,-rpath,/usr/lib/gcj-4.1 -ljvm
/usr/bin/ld: cannot find -ljvm
$ gcc ldtest.c -L/usr/lib/gcj-4.1 -ljvm
$

Also note that checking for empty pkg-config output is not realiable:

$ echo "^$(pkg-config --libs-only-l /usr/share/pkgconfig/gtk-doc.pc)\$"
^ $
$
2007-10-16 14:39:28 +04:00
Alexey Tourbin
ae2da665dd pkgconfiglib.req: set up libs= and libdirs= from $pcLibs; consider -Wl,rpath,... 2007-10-16 13:17:39 +04:00
Alexey Tourbin
195dc1f785 pkgconfiglib.req: use 'gcc -print-search-dirs' to set up gcc_libdirs 2007-10-13 22:35:24 +04:00
Alexey Tourbin
a05a5f4f6b pkgconfiglib.req: restored 2007-10-13 21:08:29 +04:00
Alexey Tourbin
d601c3e625 shell.req (ShellReqEND): still check if executable candidates are available
$ cat test1.sh test2.sh
mail
mail() { :; }
$ scripts/shell.req.in test1.sh test2.sh
shell.req.in: /home/at/git.alt/rpm/test1.sh: mail() is possibly defined in /home/at/git.alt/rpm/test2.sh
shell.req.in: /home/at/git.alt/rpm/test1.sh: mail() has execuatable candidate: mail -> /bin/mail (skip)
$
2007-10-09 17:00:25 +04:00
Alexey Tourbin
3064082899 find-package (FindByName): better check for maybe_function 2007-10-09 12:30:05 +04:00