Commit Graph

222 Commits

Author SHA1 Message Date
Alexey Tourbin
6684fd8ee5 verify.c: updated verifyDependencies() for self-conflicting packages
To check the dependencies of an installed package, a "transaction" is
created, and the package is added to the transaction.  The transaction
is then checked with rpmdepCheck().  However, since the installed
package has not been marked for removal, a conflict can be triggered
between the installed and that of transaction copies of the package.
The right thing to do is to mark package for removal, re-add it to
the transaction, and then to check the dependencies.
2010-08-22 02:30:13 +04:00
Alexey Tourbin
de60ab01a3 header.c: backported headerSetInstance() and headerGetInstance() from rpm.org
Header instance is its number in /var/lib/rpm/Packages database.
When a header comes from the database, it is sometimes useful to know
its instance (I need this to adjust verify.c:verifyDependencies() for
self-conflicting packages).  On the contrary, setting instance numbers
should happen only within librpmdb, which is why headerSetInstance()
comes with hidden visibility.
2010-08-22 02:16:02 +04:00
Alexey Tourbin
e8c5b7ad21 depends.c: permit self-conflicting packages
Only for the last two weeks or so, the issues has been raised twice.
By specifying "Provides: foo, Conflicts: foo", people expect that
other packages which provide "foo" will not be installed along with
the package.  What people don't anticipate is that the package will
conflict with itself, and will not be installed at all.  This is where
apt and rpm differ.  In apt, "conflicts may never self match".  In rpm,
Requires and Conflicts are handled in exactly the same way, except that
Requires should match, and Conflicts should not match (I call this
a symmetry).  Both can match against the package they come from.

So, to permit self-conflicting packages, I have to break the symmetry
and pass additional argument which indicates the type of dependency
being processed (either Requires or Conflicts).  The code is then
adjusted to discard self-matching Conflicts.

Obsoletes should be handled specially, too.  In tsSatisfiesDepend(),
I attempt to handle the Obsoletes case as well.  It is rather
unfortunate that, in rpmdepCheck(), Obsoletes are simply not checked
just yet.
2010-08-22 01:04:41 +04:00
Alexey Tourbin
682646a657 depends.c: made dbProvCache global (static __thread)
Passing this "implicit" argument from a toplevel API function
down to dbSatisfiesDepends() looks too ugly.
2010-08-19 00:37:23 +04:00
Alexey Tourbin
adce826c53 depends.c: better solution for dbProvCache dangling pointers without resorting to strdup 2010-08-18 14:28:08 +04:00
Alexey Tourbin
da0408ae20 Revert "depends.c (dbSatisfiesDepend): strdup dbProvCache keys (ALT#23811)"
This reverts commit c9b1f0e2ec.
2010-08-18 11:56:59 +04:00
Kirill A. Shutemov
0ed9eed845 Migrate to new libbeecrypt
Let's try to use recent libbeectypt in our World Best RPM.

Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
Signed-off-by: Dmitry V. Levin <ldv@altlinux.org>
2010-08-12 20:41:06 +00:00
Alexey Tourbin
c9b1f0e2ec depends.c (dbSatisfiesDepend): strdup dbProvCache keys (ALT#23811)
My previous assumption that strdup() was not needed for dbProvCache keys
was wrong.  The keys point to header memory, which is right.  However,
those are not only ts->addedPackages and ts->erasedPackages headers.
In checkDependent(), headers come from rpmdb and are disposed immediately
after the check.
2010-08-05 18:27:02 +04:00
Alexey Tourbin
b08133537b al.c: lazy creation of al->dirIndex and al->provIndex
For erasedPackages, the dirIndex and provIndex are unused, and
thus should not be created at all.  There is arguably a better
option - to provide explicit alMakeIndex and alFreeIndex API.
2010-07-12 11:39:28 +04:00
Alexey Tourbin
7a1f3ed06d depends.c: provided actual dbProvCache implementation
Based on rpm.org 2e76d0e6 by Panu Matilainen:
> Add in-memory hash for caching rpmdb dependency lookups
> - worst case behavior for uncached dependency lookups can be disastrous,
>   eg > 35s vs < 1s on my laptop for trying to remove /bin/sh provider
> - we only bother caching rpmdb lookups, the other cases plenty fast already
> - using in-memory cache avoids nasty in vs out of chroot issues with
>   temporary db files, which otherwise were about as fast

However, we do not use full-blown printDepend-based caching (i.e.
we no longer cache depends with versions).  This is because, well,
dependency versions are likely to differ.  This is especially true
if we consider upcoming set-versions for soname symbols - hashing
symbol sets here will be just a waste of time and memory.  And so
now we cache satisfied/unsatisfied depends by just name.  Thus,
"yes" hit can be used immediately only for unversioned dependences.

Top 10 dependencies which will be handled by the cache:
$ rpm -qaR |grep -v rpmlib |grep -v = |sort |uniq -c |sort -n |tail
    245 /usr/lib/perl5/vendor_perl
    311 libm.so.6(GLIBC_2.2.5)(64bit)
    386 libpthread.so.0(GLIBC_2.2.5)(64bit)
    454 /lib64/ld-linux-x86-64.so.2
    548 libc.so.6(GLIBC_2.3)(64bit)
    587 /bin/sh
    828 libc.so.6(GLIBC_2.3.4)(64bit)
    906 libc.so.6(GLIBC_2.4)(64bit)
   1128 rtld(GNU_HASH)
   1140 libc.so.6(GLIBC_2.2.5)(64bit)
$

Top 10 dependencies which will not be handled by the cache:
$ rpm -qaR |grep -v rpmlib |grep -e = |sort |uniq -c |sort -n |tail
     13 python-base = 2.6.5-alt2
     14 mono(mscorlib) = 1.0
     15 qt4-common = 4.6.2-alt6
     16 mono(mscorlib) = 2.0
     18 mktemp >= 1:1.3.1
     20 koffice-common = 4:2.2.0-alt2
     20 perl-base >= 1:5.8.0
     23 alternatives >= 0:0.4
     49 libqt4-core >= 4.6.2
     54 perl-base >= 1:5.6.0
$

Here's a simple test to see if the cache works (using Panu's example -
trying to remove /bin/sh).

(before this change)
$ time LD_LIBRARY_PATH=$PWD/1 rpm -e --test sh 2>&1 |tail
        /bin/sh   is needed by groff-base-1.20.1-alt0.20091013
        /bin/sh   is needed by groff-base-1.20.1-alt0.20091013
        /bin/sh   is needed by groff-base-1.20.1-alt0.20091013
        /bin/sh   is needed by libgnome-sharp-2.24.1-alt1
        /bin/sh   is needed by kernel-image-std-def-2.6.32-alt15
        /bin/sh   is needed by kernel-image-std-def-2.6.32-alt15
        /bin/sh   is needed by kde4libs-4.4.5-alt1
        /bin/sh   is needed by kde4base-runtime-core-4.4.5-alt1
        /bin/sh   is needed by kde4base-konqueror-4.4.5-alt1
        /usr/lib/bash is needed by bash-builtin-lockf-0.3.1-alt1
rpm -e --test sh 2>&1  6.18s user 3.44s system 94% cpu 10.182 total
$

(after this change)
$ time LD_LIBRARY_PATH=$PWD/2 rpm -e --test sh 2>&1 |tail
        /bin/sh   is needed by groff-base-1.20.1-alt0.20091013
        /bin/sh   is needed by groff-base-1.20.1-alt0.20091013
        /bin/sh   is needed by groff-base-1.20.1-alt0.20091013
        /bin/sh   is needed by libgnome-sharp-2.24.1-alt1
        /bin/sh   is needed by kernel-image-std-def-2.6.32-alt15
        /bin/sh   is needed by kernel-image-std-def-2.6.32-alt15
        /bin/sh   is needed by kde4libs-4.4.5-alt1
        /bin/sh   is needed by kde4base-runtime-core-4.4.5-alt1
        /bin/sh   is needed by kde4base-konqueror-4.4.5-alt1
        /usr/lib/bash is needed by bash-builtin-lockf-0.3.1-alt1
rpm -e --test sh 2>&1  0.11s user 0.09s system 91% cpu 0.218 total
$
2010-07-12 11:39:27 +04:00
Alexey Tourbin
d35a165dc3 depends.c: pass dbProvCache parameter down to dbSatisfiesDepend
This is a bit ugly but this is probably still a bit better than
extending the ts structure.
2010-07-12 11:39:26 +04:00
Alexey Tourbin
945417c34f depends.c: updated for ts->erasedPackages 2010-07-12 11:39:25 +04:00
Alexey Tourbin
17a1de0d63 transaction.c: updated for ts->erasedPackages 2010-07-12 11:39:24 +04:00
Alexey Tourbin
d392376ed7 depends.c: added initial support for ts->erasedPackages list
Before this change, only rpm headers for addedPackages were loaded
during transaction; for removedPackages, we only stored the list
of rpmdb header numbers (numeric instances).  With this change,
removedPackages' headers are getting loaded, too (the list is called
erasedPackages).  The reason is that, when a header is loaded,
it is possible to use pointers to point e.g. into header strings
without using strdup.  This might come useful as we try to reimplement
the depends cache.
2010-07-12 11:37:40 +04:00
Alexey Tourbin
83a71d080d depends.c: merged check{PackageSet,Dependent{Packages,Conflicts}} into checkDependent 2010-07-12 10:04:41 +04:00
Alexey Tourbin
fc5bc9b582 depends.c: renamed unsatisfiedDepend -> tsSatisfiesDepends, factored dbSatisfiesDepends
Based on rpm.org ccb545f0 "Refactor rpmdb lookups..." by Panu Matilainen.
2010-07-12 10:03:19 +04:00
Alexey Tourbin
994c5675a8 further removed RPMDBI_DEPENDS 2010-07-12 10:02:00 +04:00
Alexey Tourbin
c6943fb0f2 depends.c: further removed dying code 2010-07-12 10:01:55 +04:00
Alexey Tourbin
cf70d66c4e depends.c: disabled dbi-based dependency caching
Based on rpm.org 6bc5d870 by Panu Matilainen:
> Rip out dependency caching
> - it doesn't speed up things that much, is broken in some chroot
>   scenarios and is ugly ugly hardwired BDB hackery where it doesn't belong
2010-07-12 10:01:29 +04:00
Alexey Tourbin
63da9b7043 rpmdb.c: make rpmdb index list hard-wired, remove unused require- and provideversion indexes
based rpm.org changes by Panu Matilainen:
fb2a6cb Make rpmdb index list hard-wired
e23a2bf Remove unused require- and provideversion indexes
2a52cc8 Remove unused _DBI defines
2010-04-21 11:52:25 +04:00
Alexey Tourbin
f2d8576dae order.c: added missing error message 2010-03-16 15:06:10 +03:00
Alexey Tourbin
a8e1fe9fa1 order.c: identify Requires(auto) as plain Requires 2010-03-16 15:04:09 +03:00
Alexey Tourbin
a599f8f9c1 order.c: explain why things work properly 2010-03-16 15:04:05 +03:00
Alexey Tourbin
3d98659409 depends.c: need to export printDepend() 2010-03-16 15:03:27 +03:00
Alexey Tourbin
797f0ff2a5 order.c: factored from depends.c 2010-03-16 15:03:23 +03:00
Alexey Tourbin
df4147a97c al.c: introduced "fasthash" to improve bsearch performance 2010-03-12 11:20:56 +03:00
f2e4129237 rpmrc.c (is_pentiumN): Add models with nonzero extended model
http://www.intel.com/assets/pdf/appnote/241618.pdf table 2-3.
Reported by Alexander Sharapov.
2009-12-20 15:06:21 +00:00
Alexey Tourbin
2534a73873 4.0.4-alt97.M50.20
- depends.c: avoid expression dependent on evaluation order
- depends.c: implemented automatic realloc
- al.c: factored from depends.c
- al.c: reimplemented alProvIndex and alDirIndex/alFileIndex routines
2009-10-04 12:55:45 +04:00
Alexey Tourbin
7f0aa5d96d al.c: optimize out rpmRangesOverlap call for unversioned dependencies 2009-10-04 12:44:40 +04:00
Alexey Tourbin
09751027bf al.c: removed extra arguments in alAllSatisfiesDepend 2009-10-04 12:44:38 +04:00
Alexey Tourbin
ffeac246e1 al.c: merged FileSatisfiesDepend into alAllSatisfiesDepend, full unique list 2009-10-04 12:44:37 +04:00
Alexey Tourbin
f49976fd21 al.c: reimplemented alDirIndex and alFileIndex 2009-10-04 12:44:36 +04:00
Alexey Tourbin
216526577b al.c: reimplemented alProvIndex, removed alMakeIndex() 2009-10-04 12:44:35 +04:00
Alexey Tourbin
aee6223979 al.c: implemented generic alIndex routines 2009-10-04 12:44:34 +04:00
Alexey Tourbin
5c8817985a al.c: factored from depends.c 2009-10-04 12:44:33 +04:00
Alexey Tourbin
d9e8ab64f5 depends.c: turned availableIndex.index into flexible array 2009-10-04 12:44:32 +04:00
Alexey Tourbin
f14e4a1fd9 depends.c: implemented automatic realloc 2009-10-04 12:44:30 +04:00
Alexey Tourbin
f9e7f3e6e0 depends.c: avoid expression dependent on evaluation order
In alAddPackage(), ts->addedPackages.list can be reallocated with
realloc().  So it is not safe to use ts->addedPackages.list in the
same expression.
2009-10-04 12:44:28 +04:00
Alexey Tourbin
4ad3f315dc 4.0.4-alt97.M50.19
- Removed support for availablePackages/suggestedPackages.
- Removed rebuilddb db_filter_dups code (Panu Matilainen).
2009-10-01 04:44:10 +04:00
Alexey Tourbin
55ef8cfed5 removed support for availablePackages/suggestedPackages 2009-10-01 04:38:09 +04:00
Alexey Tourbin
f68c71a2d5 4.0.4-alt97.M50.18
- rpmio, rpmbuild: Added support for .xz/.lzma compressed sources and patches.
- Removed old scripts in /usr/lib/rpm.
2009-09-29 16:30:39 +04:00
Alexey Tourbin
6795a36bb1 great removal 2009-09-29 15:29:52 +04:00
Alexey Tourbin
79be480d0e 4.0.4-alt97.M50.16
- rpmio: Updated lzma compression routines for xz-5.0 API.
- Packaged /usr/bin/rpm2cpio.static.
2009-09-24 12:48:17 +04:00
Alexey Tourbin
7407fd6de4 pack.c, rpmlibprov.c: updated for xz compression 2009-09-24 12:35:43 +04:00
Alexey Tourbin
0b739a3a9f psm.c, rpm2cpio.c: updated for xz decompression 2009-09-24 12:35:37 +04:00
04d5860a7b lib/header_internal.c (headerGetLangs): Fix stupid X<=Y<=Z comparison
(cherry picked from commit 4ce1b4bead)
2009-09-24 11:36:29 +04:00
Alexey Tourbin
31dc64497c 4.0.4-alt97.M50.12
- Removed _noDirTokens support (producing legacy filelist format).
- Disabled rpmlib(PayloadFilesHavePrefix), rpmlib(CompressedFileNames),
  and rpmlib(VersionedDependencies) dependencies.
- Disabled versioning for rpmlib(PayloadIsBzip2) and rpmlib(PayloadIsLzma)
  dependencies.
2009-06-17 06:43:27 +04:00
Alexey Tourbin
23317f11b7 removed _noDirTokens (producing legacy filelist format)
Some code (e.g. apt/genpkglist) explicitly relies on the fact that
header file list is represented with baseNames+dirNames+dirIndexes
arrays.  Thus, generating legacy headers might have issues, and should
be disabled.
2009-06-17 06:32:18 +04:00
Alexey Tourbin
a15d548dec lib/depends.c: adjust provides check for versioned paths
(cherry picked from commit fb5f3e4c88)
2009-06-17 06:30:53 +04:00
Alexey Tourbin
4a6b102862 4.0.4-alt97.M50.11
- Remove artificial limit in dependency loop elimination attempts (Panu Matilainen).
2009-06-14 05:39:30 +04:00