Commit Graph

90 Commits

Author SHA1 Message Date
Alexey Tourbin
7247ecbda7 rpmdb.c: do not exclude Requires(pre) dependencies from rpmdb index
It can be observed that, while packages require their dependencies,
the dependencies in turn are not always required by their packages:

$ rpm -qa --requires |awk '{print$1}' |sort -u |xargs rpm -q --whatrequires >/dev/null
warning: no package requires /bin/chgrp
warning: no package requires /bin/chmod
warning: no package requires /bin/mv
warning: no package requires /etc/rc.d/init.d/postfix
warning: no package requires /sbin/pidof
warning: no package requires /sbin/post_ldconfig
warning: no package requires /usr/bin/alt-docs-genextras
warning: no package requires /usr/bin/gpasswd
warning: no package requires /usr/bin/gtk-query-immodules-2.0
warning: no package requires /usr/bin/mkfontdir
warning: no package requires /usr/sbin/alternatives-update
warning: no package requires /usr/sbin/control-dump
warning: no package requires /usr/sbin/control-restore
warning: no package requires /usr/sbin/gconf_install_schema
warning: no package requires /usr/sbin/groupadd
warning: no package requires /usr/sbin/indexhtml-update
warning: no package requires /usr/sbin/post_service
warning: no package requires /usr/sbin/useradd
warning: no package requires /usr/sbin/usermod
warning: no package requires /usr/share/php/scripts/php_postin.sh
warning: no package requires dvdrwtools-control
warning: no package requires libguile-vhttpd
warning: no package requires php5-suhosin
warning: no package requires rpmlib(CompressedFileNames)
warning: no package requires rpmlib(PartialHardlinkSets)
warning: no package requires rpmlib(PayloadFilesHavePrefix)
warning: no package requires rpmlib(PayloadIsLzma)
warning: no package requires rpmlib(SetVersions)
warning: no package requires rpmlib(VersionedDependencies)
warning: no package requires x11presetdrv
$

This is because rpm removes "install prerequisites" from rpmdb index.
As a consequence, rpm will allow (but apt will not) to remove packages
with "not required" dependencies:

$ rpm -e --test x11presetdrv
$

This is possibly wrong, and it makes dependency optimization hard (e.g.
can't merge duplicate names with different flags).  Also, the code was
buggy: testing isInstallPreReq was not enough as it is not mutually
exclusive with isErasePreReq - e.g. Requries(pre,preun) dependencies
can be used in specfile.
2011-01-22 18:38:22 +03:00
Alexey Tourbin
42b139d1eb removed --fileid query selector and Filemd5s rpmdb index (rpm.org) 2011-01-22 17:35:13 +03:00
Alexey Tourbin
335d64cf5e header.c (headerFindI18NString): disable conversion when lang is "C" 2011-01-21 15:41:20 +03:00
Alexey Tourbin
0193cbf8b9 header.c (headerFindI18NString): avoid repeated getenv calls 2011-01-21 15:25:56 +03:00
Alexey Tourbin
a45456493b header.c (findEntry): replaced bsearch with custom routine
Headers normally have around 64 tags, which means bsearch will issue
6 callbacks, only to perform a single instruction (a->tag - b->tag).

This also removes a bogus piece of code.

Here is how these optimizations will impact apt.  I remove
/var/cache/apt/*.bin and run "apt-cache show rpm".

4.0.4-alt100.11:
3,630,479,716  PROGRAM TOTALS
399,285,303  ???:0x0000000000033150'2 [libc-2.11.3.so]
319,106,185  ???:strlen [ld-2.11.3.so]
242,215,488  ???:pkgCache::FindPackage(char const*) [libapt-pkg-libc6.9-6.so.2.1.0]
198,711,478  ???:memcpy [ld-2.11.3.so]
198,594,999  ???:0x0000000000071970 [libc-2.11.3.so]
195,473,223  header.c:regionSwab.clone.2 [librpmdb-4.0.4.so]
135,707,034  ???:strcmp [ld-2.11.3.so]
117,134,836  header.c:dataLength [librpmdb-4.0.4.so]
102,919,244  ???:0x00000000000710f0 [libc-2.11.3.so]
102,291,091  ???:stpcpy [libc-2.11.3.so]
 75,555,843  ???:bsearch [libc-2.11.3.so]
 68,014,424  ???:getenv [libc-2.11.3.so]

this commit:
3,093,300,624  PROGRAM TOTALS
319,106,185  ???:strlen [ld-2.11.3.so]
242,215,488  ???:pkgCache::FindPackage(char const*) [libapt-pkg-libc6.9-6.so.2.1.0]
197,663,758  ???:0x0000000000071970 [libc-2.11.3.so]
185,771,577  header.c:regionSwab.clone.2 [librpmdb-4.0.4.so]
136,263,419  ???:strcmp [ld-2.11.3.so]
111,934,199  ???:memcpy [ld-2.11.3.so]
102,399,027  ???:0x00000000000710f0 [libc-2.11.3.so]
102,291,091  ???:stpcpy [libc-2.11.3.so]
 95,231,406  header.c:dataLength [librpmdb-4.0.4.so]
 76,706,744  ???:0x0000000000033150'2 [libc-2.11.3.so]
 68,359,227  header.c:findEntry [librpmdb-4.0.4.so]
 68,014,424  ???:getenv [libc-2.11.3.so]
2011-01-21 15:24:54 +03:00
Alexey Tourbin
bb9e8fbede header.c (headerLoad): check if the header is already sorted 2011-01-21 03:28:12 +03:00
Alexey Tourbin
1c87e9b34f header.c (dataLength): optimize string array loops 2011-01-21 02:08:49 +03:00
Alexey Tourbin
dfd33329ab header.c (regionSwab): optimize htons and htonl loops 2011-01-21 01:24:06 +03:00
Mikhail Efremov
f92be4b40e Added SELinux support
Mostly backported from rpm-4.8
2010-08-24 16:59:07 +00: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
994c5675a8 further removed RPMDBI_DEPENDS 2010-07-12 10:02:00 +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
Panu Matilainen
afe7a56661 Remove ancient, unused code to filter duplicates on rpmdb rebuild
- enabling this as-is would be murderous to multilib systems
- getting duplicates in the db would be a bug elsewhere
2009-10-01 04:38:10 +04:00
Alexey Tourbin
6795a36bb1 great removal 2009-09-29 15:29:52 +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
c57d3c753b fprint.h: turned entry.dirName into flexible array 2009-06-13 08:56:04 +04:00
Alexey Tourbin
d68195b463 fprint.c: renamed "ht" member to "dn2de" 2009-06-13 08:55:41 +04:00
Alexey Tourbin
1d7007eae4 fprint.h: moved struct fprintCache_s to fprint.c 2009-06-13 08:55:20 +04:00
Alexey Tourbin
d141414717 db3.c (db3close): removed dobule close code (rpm5.org, RH#138589) 2009-04-23 16:48:19 +04:00
Alexey Tourbin
37bfe52994 rpmdb: include <db.h> and link with -ldb without configure check for now 2009-04-23 14:46:46 +04:00
Alexey Tourbin
2ec0a7bf9f rpmdb.c (rpmdbNextIterator): removed db1-related part 2009-04-23 13:57:36 +04:00
Alexey Tourbin
4657ef7c57 rpmdb.c (openDatabase): removed db1-related part 2009-04-23 13:57:15 +04:00
Alexey Tourbin
af4053bfa0 rpmdb: removed db1 support 2009-04-23 13:49:52 +04:00
Alexey Tourbin
1ea6ca8d22 rpmhash.c (hashEqualityString): bare strcmp call 2009-03-26 11:20:50 +03:00
Alexey Tourbin
6652e778ca rpmhash.c (hashBucket_s): added const and unsigned 2009-03-26 11:20:41 +03:00
Alexey Tourbin
34d8d48726 rpmhash.c: renamed findEntry to findBucket and made it inline 2009-03-26 11:20:34 +03:00
Alexey Tourbin
c204d6ad7a rpmhash.c: allocate hash table and its buckets in single chunk 2009-03-26 11:20:23 +03:00
Alexey Tourbin
732a880e8c fprint.h (fprintCacheEntry_s): removed isFake (unused) 2009-03-26 11:20:17 +03:00
Alexey Tourbin
6a2cc38410 fprint.c: fpCacheFree returns NULL 2009-03-26 11:20:07 +03:00
Alexey Tourbin
dba96abac5 deal with fpCacheCreate() size parameter 2009-03-26 11:19:53 +03:00
Alexey Tourbin
02104ae61f Use only one, global fingerPrintCache to save a lot of stat calls
[Based on rpm.org af80c3de by Florian Festi.]
2009-03-26 11:19:43 +03:00
Alexey Tourbin
a443927f78 fprint.c (fpHashFunction): use Jenkins hash 2009-03-26 11:19:30 +03:00
Alexey Tourbin
6d4fea769d jhash.h, rpmhash.c: switch to Jenkins One-at-a-time hash 2009-03-26 11:19:01 +03:00
Alexey Tourbin
6a9eae99c7 fprint.c: removed fpLookupHeader(), unused 2009-03-26 11:18:11 +03:00
Alexey Tourbin
d1539cd25c fprint.c: clarify malloc confusion 2009-03-26 11:18:01 +03:00
Alexey Tourbin
c4170e6003 rpmhash.c: htFree() takes freeKey and freeData fns and returns NULL 2009-03-26 11:17:46 +03:00
Alexey Tourbin
97e48a2da9 rpmhash.c: Make the data array part of the hash bucket to save one pointer per bucket
[Based on rpm.org 0ba387b4 by Florian Festi.]
2009-03-26 11:17:33 +03:00
Alexey Tourbin
d4b7714b36 rpmhash.c: removed keySize arg from htCreate() 2009-03-26 11:17:14 +03: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
df61ee0b9e Include local headers. 2006-05-15 03:26:57 +04:00
8787ee5d55 Fixed "type qualifiers ignored on function return type" issue. 2006-05-15 02:48:59 +04:00
5ccf95cd08 Link librpmdb with -lpopt. 2006-01-14 21:58:13 +00:00
a2310ac49c reverted rpmTagTable changes 2005-10-19 17:45:39 +00:00
887cff9d84 link with libelf by default 2005-10-15 19:16:25 +00:00
fc89dbda03 relocated _noDirTokens, compressFilelist, expandFilelist, providePackageNVR from lib to rpmdb 2005-10-15 18:43:13 +00:00
eaef1aad45 relocated _noDirTokens, compressFilelist, expandFilelist, providePackageNVR from lib to rpmdb 2005-10-15 16:30:13 +00:00
22a3b64b23 relocated tagtable.c from lib to rpmdb 2005-10-15 16:07:06 +00:00
d9535b693f relocated headerNVR() from lib to rpmdb; added headerNEVRA() to rpmdb 2005-10-15 15:25:41 +00:00
e1e85a6d51 relocated tagtable.c from lib to rpmdb 2005-10-15 15:22:28 +00:00
857446207e relocated tagtable.c from lib to rpmdb 2005-10-15 15:13:29 +00:00