Commit Graph

1139 Commits

Author SHA1 Message Date
Alexey Tourbin
9175b4190a find-requires, find-provides: removed the reset of unused code, specifically for mono and java
rpm-build-mono has been adapted.
Updated rpm-build dependencies:
	Conflicts: rpm-build-mono <= 1.0

rpm-build-java does NOT include java.req in current sisyphus release
1.0.0-alt1.  I have done some major development for rpm-build-java,
but there is still no consensus about it.
Not updated rpm-build dependencies: nothing to do.
2007-08-11 00:48:49 +04:00
Alexey Tourbin
71c3d7908d find-package (FindByName): in ambigous case, first check if [ path = pkg ] 2007-08-10 16:10:58 +04:00
Alexey Tourbin
bd368155cd find-package (FindByPath): discard rpmquery stderr 2007-08-08 02:54:04 +04:00
Alexey Tourbin
968016ffdc find-package: added description atop 2007-08-08 00:49:48 +04:00
Alexey Tourbin
7c7eccde32 find-package (FindByName): added more comments, for casual readers 2007-08-08 00:28:55 +04:00
Alexey Tourbin
706ff5d5ec find-package: more comments for RPM_FINDPACKAGE_PATH processing 2007-08-07 22:59:50 +04:00
Alexey Tourbin
91b7ebe4c6 find-package: added comments to RPM_FINDPACKAGE_PATH awk script 2007-08-07 22:41:19 +04:00
Alexey Tourbin
c9dbb383f6 find-package: manage verbosity with 'local Verbose' variable
When something goes not as good as we would like, we should
be able to increase verbosity locally for this particular case.

Old behaviour:

$ sh -efu -c '. /usr/lib/rpm/find-package; RPM_PKG_CONTENTS_INDEX_ALL=/etc/passwd FindPackage myscript /bin/cat'
sh: myscript: checking contents_index_all for /bin/cat
coreutils
$

In this example I pretend that /bin/cat lookup failed against
contents_index_all.  The problem here is that, once we know about
a "strange thing" happening, we also want to know the end of the story.
Where does coreutils come from?  That is the question.

New behaviour:

$ sh -efu -c '. /usr/lib/rpm/find-package; RPM_PKG_CONTENTS_INDEX_ALL=/etc/passwd FindPackage myscript /bin/cat'
sh: myscript: checking contents_index_all for /bin/cat
sh: myscript: /bin/cat -> coreutils (via rpmdb)
coreutils
$

When "strange things" happen, I increase verbosity locally,
until the "strange thing" is resolved.  I use 'local Verbose=Info'
approach to increase verbosity.  Since shell has dynamic variables
(with visibility bound to function-call stack), this is just what
we need.

Strange things are:
- in FindByPath:
  + contents_index_all search
- in FindByName:
  + ambiguous contents_index_bin search
    (the same command under e.g. /sbin and /usr/bin)
  + ambiguous /usr/bin/which search (ditto)
2007-08-07 22:17:58 +04:00
Alexey Tourbin
a2090d8dd9 find-package (FindPackage): enhanced path vs. command validation
Also increased verbosity for invalid pathnames and/or commands.
2007-08-07 20:43:02 +04:00
Alexey Tourbin
3f764319ec find-package (FindByPath): enhanced contents_index search
In FindByPath, we should always check contents_index_bin first.
It is not quite expensive, and we make no assumptions which path
entries it may contain (our contents_index_bin, in addition
to standard *bin/ paths, also has /etc entries).

However, if contents_index_bin lookup fails, we may or may
not want to proceed with very expensive contents_index_all
search.  We assume that, if contents_index_bin lookup actually
has take place for some standard *bin/ path, then there is simply
no need to proceed with contents_index_all.

Now we also assume that contents_index_all file can be possibly
gzipped (I use "gzip -cdfq" for "zcat or cat", found in zgrep).

Also increased verbosity (Verbose to Info) for contents_index_all
messages, since it is expensive and it is a means of "last resort"
to finding something strange before giving up, which is quite worth
to note about.

Also increased verbosity for "raw, not found" dependencies,
since they are likely to become unmet.
2007-08-07 19:58:35 +04:00
Alexey Tourbin
60ca916d3b shell.req.in: quote grep arguments with "--"
There's a bug in "sh --rpm-requires" mode:

$ sh --rpm-requires /dev/stdin <<<'exec -a PERL /usr/bin/perl'
executable(-a)
$

Then "-a" is passed to grep as its first argument (search pattern).
2007-08-03 19:04:29 +04:00
Alexey Tourbin
3ed0194c90 find-requires, find-provides: removed ulimit and LD_PRELOAD code 2007-08-03 12:07:58 +04:00
Alexey Tourbin
c1c04912cc Merge 4.0.4-alt77 into mod 2007-08-02 18:56:55 +04:00
Alexey Tourbin
abce94e210 platform.in: removed tcl stuff from %___build_pre (moved to tcl.env in rpm-build-tcl) 2007-08-01 16:49:44 +04:00
Alexey Tourbin
198276caed platform.in: removed tcl macros (moved them into rpm-build-tcl) 2007-08-01 16:45:44 +04:00
Alexey Tourbin
f139f95028 spec: updated dependency on rpm-build-tcl 2007-08-01 16:05:54 +04:00
Alexey Tourbin
e4ac5eca65 find-requires, find-provides: removed perl, python, and tcl stuff 2007-08-01 16:05:26 +04:00
3dfa753c83 rpmdb/header.c (guess_category_value): Allow overriding locale using $RPM_LANGUAGE_I18NSTRING for headerFindI18NString
We want to abuse I18NSTRING for storing arbitrary data, e.g. GIT commit identifiers.
To achieve this, we have to bypass setlocale(3) check.
2007-06-22 11:14:39 +00:00
1105a961ca 4.0.4-alt77
- rpmio/macro.c (doFoo):
  Fixed potential buffer overflow in %%homedir macro processing.
- lib/formats.c (i18nTag):
  Fixed potential null dereference on header without RPMTAG_NAME (RH#239557).
- lib/package.c (readPackageHeaders):
  Removed insecure legacy providePackageNVR() call.
- lib/query.c (showQueryPackage):
  Fixed potential null dereference in QUERY_FOR_DEFAULT mode.
2007-05-18 12:47:58 +00:00
8440b43b3c lib/query.c (showQueryPackage): Fix potential null dereference in QUERY_FOR_DEFAULT mode 2007-05-18 00:54:19 +00:00
4c4920e2d8 lib/query.c (showQueryPackage): Check all header strings to resize buffer (CVE-2006-5466, RH#212833)
Backported from rpm-4.4.8
2007-05-18 00:33:44 +00:00
6e81fe8727 lib/package.c (readPackageHeaders): Remove insecure legacy providePackageNVR() call 2007-05-18 00:20:42 +00:00
8a189d448b lib/formats.c (i18nTag): Avoid segfault on header without RPMTAG_NAME (RH#239557)
https://lists.dulug.duke.edu/pipermail/rpm-devel/2007-May/002653.html
2007-05-16 13:20:45 +00:00
20400c24b8 rpmio/macro.c (doFoo): Fix potential buffer overflow in %homedir macro processing 2007-04-11 18:18:01 +00:00
6719c93a11 Merge branch 'master' into mod 2007-04-09 21:17:16 +00:00
36d31bbf3c 4.0.4-alt76
- rpmRunTransactions:
  Ignore unavailable mount points instead of bailing out.
2007-04-09 21:13:58 +00:00
0da910fb46 lib/transaction.c (rpmRunTransactions): Ignore unavailable mount points instead of bailing out 2007-03-29 16:03:42 +00:00
Alexey Tourbin
2635799cae spec: updated dependencies on rpm-build-perl and rpm-build-python 2007-03-28 16:53:56 +04:00
Alexey Tourbin
d55243bd02 platform.in: removed perl macros 2007-03-28 16:52:33 +04:00
a78e49bdb2 Merge branch 'master' into mod 2007-03-27 23:15:44 +00:00
9eb6e27e8a 4.0.4-alt75
- Changed /mnt/* mountpoints handling to behave the same way
  as other mountpoints.
- Fixed support of filesystems with f_bsize==0.
- files.req.list: Added /etc/hooks directory.
2007-03-27 22:43:15 +00:00
94bc3f23e1 scripts/files.req.list: Add /etc/hooks 2007-03-27 22:36:28 +00:00
2aea31a78f lib/transaction.c (rpmRunTransactions): Drop "/mnt" support 2007-03-27 15:41:57 +00:00
8708708cac lib/fs.c (getFilesystemList): Drop "/mnt" support 2007-03-27 15:41:38 +00:00
Alexey Tourbin
85b13554f1 platform.in: moved the reset of python macros to rpm-build-python/python,
except for %__python_version, which is used in rpm-build-python.spec
2007-03-19 14:15:39 +03:00
Alexey Tourbin
0551d4e07e platform.in: removed python from %___build_pre, will be re-added in rpm-build-python/python.env 2007-03-19 13:36:52 +03:00
Alexey Tourbin
da04721ca4 platform.in: made %___build_pre modular, by sourcing /etc/rpm/macros.d/*.env
A few notes.

RPM uses only ^/etc/rpm/macros.d/[[:alnum:]_-]*[[:alnum:]]$
files to load macros.  The dot is not possible here, so there
will be no conflict between *.env and non-env files.

/etc/rpm/macros.d is now possibly misused, since the name implies
there must be macros.  However, *.env files can have macros, too.
The difference is that the macros from *.env files are expanded
and placed into %___build_pre, i.e. some rpm-tmp.* shell scripts.
Totally different semantics, but that's still about macros.

At least one *.env file is required to make 'cat *.env' happy.
I think I will updated the dependency on rpm-build-python,
which whill provide python.env file.
2007-03-19 13:01:04 +03:00
Alexey Tourbin
4d8a11acb6 rpmio/macro.c (rpmInitMacrofileGlob): require last character to be alnum
Rationale: I use 'set patchmode=-' in my ~/.vimrc.
2007-03-19 12:41:26 +03:00
Alexey Tourbin
434d4daed5 Merge branch 'master' of git.alt:/people/ldv/packages/rpm into mod
Conflicts:

	autodeps/linux.prov.in
	autodeps/linux.req.in
2007-03-18 12:16:52 +03:00
af0adf575e 4.0.4-alt74
- find-provides, find-requires:
  + Added support for files of type "Mono/.Net assembly" to repair
    Mono support when new file(1) is installed (#11088, ildar@).
2007-03-17 20:09:40 +00:00
c226f12904 autodeps/linux.{prov,req}.in: Handle files of type "Mono/.Net assembly" (#11088, ildar@) 2007-03-17 19:59:55 +00:00
Alexey Tourbin
3ba849e8f4 rpm-build.buildreq: added *.req.files and *.prov.files patterns 2007-03-17 15:23:06 +03:00
Alexey Tourbin
5909f93e30 find-package (FindByName): optimized awk script
It looks like that, unlike in perl, pattern matching in awk is very slow.
Perhaps they just don't have regexp engine hackers like Larry Wall or
Ilya Zakharevich (or, most recently, Yves Orton aka demerphq).

That's okay, since I can rewrite the script without pattern matching at all.
That is, I don't have to split each index line into dir+basename, because
I can prepare all valid absolute pathnames in advance.

Old speed:

$ time /usr/lib/rpm/shell.req -v /dev/stdin <<<`rpm -ql rpm-utils |sed -n 's|/usr/bin/||p'`
shell.req: add_changelog -> /usr/bin/add_changelog -> rpm-utils (via content index)
shell.req: buildreq -> /usr/bin/buildreq -> rpm-utils (via content index)
shell.req: cleanup_spec -> /usr/bin/cleanup_spec -> rpm-utils (via content index)
shell.req: compare_packages -> /usr/bin/compare_packages -> rpm-utils (via content index)
shell.req: filereq -> /usr/bin/filereq -> rpm-utils (via content index)
shell.req: packageof -> /usr/bin/packageof -> rpm-utils (via content index)
shell.req: packagereq -> /usr/bin/packagereq -> rpm-utils (via content index)
shell.req: rebuild_package -> /usr/bin/rebuild_package -> rpm-utils (via content index)
shell.req: rebuild_packages -> /usr/bin/rebuild_packages -> rpm-utils (via content index)
shell.req: rpmdups -> /usr/bin/rpmdups -> rpm-utils (via content index)
shell.req: rpmevrcmp -> /usr/bin/rpmevrcmp -> rpm-utils (via content index)
shell.req: rpmrdups -> /usr/bin/rpmrdups -> rpm-utils (via content index)
shell.req: rpmvercmp -> /usr/bin/rpmvercmp -> rpm-utils (via content index)
shell.req: stamp_spec -> /usr/bin/stamp_spec -> rpm-utils (via content index)
rpm-utils
/usr/lib/rpm/shell.req -v /dev/stdin <<<   5.37s user 0.11s system 96% cpu 5.683 total
$

New speed:

$ time /usr/lib/rpm/shell.req -v /dev/stdin <<<`rpm -ql rpm-utils |sed -n 's|/usr/bin/||p'`
shell.req: add_changelog -> /usr/bin/add_changelog -> rpm-utils (via content index)
shell.req: buildreq -> /usr/bin/buildreq -> rpm-utils (via content index)
shell.req: cleanup_spec -> /usr/bin/cleanup_spec -> rpm-utils (via content index)
shell.req: compare_packages -> /usr/bin/compare_packages -> rpm-utils (via content index)
shell.req: filereq -> /usr/bin/filereq -> rpm-utils (via content index)
shell.req: packageof -> /usr/bin/packageof -> rpm-utils (via content index)
shell.req: packagereq -> /usr/bin/packagereq -> rpm-utils (via content index)
shell.req: rebuild_package -> /usr/bin/rebuild_package -> rpm-utils (via content index)
shell.req: rebuild_packages -> /usr/bin/rebuild_packages -> rpm-utils (via content index)
shell.req: rpmdups -> /usr/bin/rpmdups -> rpm-utils (via content index)
shell.req: rpmevrcmp -> /usr/bin/rpmevrcmp -> rpm-utils (via content index)
shell.req: rpmrdups -> /usr/bin/rpmrdups -> rpm-utils (via content index)
shell.req: rpmvercmp -> /usr/bin/rpmvercmp -> rpm-utils (via content index)
shell.req: stamp_spec -> /usr/bin/stamp_spec -> rpm-utils (via content index)
rpm-utils
/usr/lib/rpm/shell.req -v /dev/stdin <<<   0.34s user 0.10s system 88% cpu 0.499 total
$

More than ten times faster, wow!
I didn't know regexp engine could be that slow, really.
2007-03-12 15:06:11 +03:00
Alexey Tourbin
b1b2fab77c find-package (FindPackage): require either absolute path or no slashes 2007-03-12 15:06:10 +03:00
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
Alexey Tourbin
ae6059ee04 lib.req.files: added "executable not executable" warning 2007-03-12 15:06:08 +03:00
Alexey Tourbin
371f6d1527 adapted pam.req and pam.prov 2007-03-12 15:06:07 +03:00
Alexey Tourbin
53b2853dff find-provides: deal with absolute and broken symbolic links 2007-03-12 15:06:06 +03:00
Alexey Tourbin
47fe2b2b3f find-package (FindByName): if the index search detects real conflict, try /usr/bin/which first
E.g. if the content index search detected something like

	/usr/bin/arpsend -> arpsend
	/usr/sbin/arpsend -> vzctl

then we should consult the host system first.  There's a good chance
that the right package, either arpsend or vzctl, IS installed, and
other candidate packages are NOT installed.  However, if /usr/bin/which
cannot find any candidate, we should reconsult the index again.
2007-03-12 15:06:05 +03:00
Alexey Tourbin
83e2b0cfe7 find-package: introduced RPM_FINDPACKAGE_PATH, which makes PATH search fully configurable
$ RPM_FINDPACKAGE_PATH=/usr/bin /usr/lib/rpm/shell.req -v /dev/stdin <<<arpsend
shell.req: /dev/stdin: arpsend indexed by: /usr/bin/arpsend -> arpsend, /usr/sbin/arpsend -> vzctl
shell.req: /dev/stdin: arpsend -> /usr/bin/arpsend -> arpsend (via content index)
arpsend
$ RPM_FINDPACKAGE_PATH=/usr/sbin /usr/lib/rpm/shell.req -v /dev/stdin <<<arpsend
shell.req: /dev/stdin: arpsend indexed by: /usr/sbin/arpsend -> vzctl, /usr/bin/arpsend -> arpsend
shell.req: /dev/stdin: arpsend -> /usr/sbin/arpsend -> vzctl (via content index)
vzctl
$

Also added %add_findpackage_path() and %set_findpackage_path() to platform.in.
2007-03-12 15:06:04 +03:00