Commit Graph

1581 Commits

Author SHA1 Message Date
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
1fde6a24b4 4.0.4-alt98.43
- depends.c: A better solution to dbProvCache dangling pointers without
  resorting to strdup (ALT#23811).
2010-08-18 15:12:31 +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
Alexey Tourbin
9a2de051e3 4.0.4-alt98.42
- Added .gitignore file, improved support for in-tree building.
- Removed %__ccache* macros (rpm will use default ccache settings).
2010-08-17 19:22:39 +04:00
Alexey Tourbin
19fdccc850 platform.in: removed %__ccache* macros
I enable ccache in my ~/.zshrc:
export GCC_USE_CCACHE=1
export CCACHE_DIR=$TMPDIR/.ccache
export CC=gcc CXX=g++

Now, under default rpm settings, ccache IS used with rpm, but the cache
directory is changed to ~/.ccache (since CCACHE_DIR is unset).

$ du -hs $TMPDIR/.ccache ~/.ccache
13M     /tmp/.private/at/.ccache
39M     /home/at/.ccache
$

These macros were added long ago.  Now we use hasher for final builds.
It's okay to use default ccache settings for local builds.
2010-08-17 19:22:28 +04:00
Alexey Tourbin
202244526d added .gitignore, improved support for in-tree building
Here is how to run configure within the source tree:
$ rpm -bE --enable debug *.spec |sed -n '/^%build$/,/^%install$/{/^%build$/d;/^%install$/d;p}' |sh -ex

There's still problem: po/Makefile.in is getting added to
configure.ac:AC_OUTPUT, and when running autoreconf for the second time,
it will die as follows.

    autoreconf-default: running: aclocal -I m4 --force -I m4
    configure.in:896: error: `po/Makefile.in' is already registered with AC_CONFIG_FILES.
    ../../lib/autoconf/status.m4:290: AC_CONFIG_FILES is expanded from...
    configure.in:896: the top level
    autom4te-2.60: /usr/bin/m4 failed with exit status: 1
2010-08-17 19:20:40 +04:00
c6b62ae933 4.0.4-alt98.41
- Migrated to beecrypt-4.2.1 (by Kirill A. Shutemov).
2010-08-12 21:01:34 +00: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
74183e0ce3 4.0.4-alt98.40
- build/files.c (parseForSimple): Fix potential NULL pointer dereference
  (Dmitry V. Levin, ALT#23813).
- depends.c (dbSatisfiesDepend): Use strdup for dbProvCache keys
  to avoid dangling pointers (ALT#23811).
2010-08-05 19:17:58 +04: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
cb105c88c8 build/files.c (parseForSimple): Fix potential NULL pointer dereference (ALT#23813) 2010-07-27 18:12:41 +00:00
Alexey Tourbin
0e7d2dcb99 4.0.4-alt98.39
- depends.c: Introduced ts->erasedPackages list of headers.
- depends.c: Replaced dbi-based dependes cache with rpmhash-based
  providename cache (based on rpm.org changes by Panu Matilainen).
2010-07-12 11:41:51 +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
7b541b7cf0 4.0.4-alt98.38
- shebang.req (ShebangReq): fixed the check for absolute pathname
  introduced in previous release (closes: #23716).
2010-07-03 00:24:42 +00:00
d44677b913 shebang.req (ShebangReq): fix the check for absolute pathname (ALT#23716) 2010-07-03 00:23:03 +00:00
76cd0e9f4d 4.0.4-alt98.37
- shebang.req (ShebangReq): Ensure that interpreter is specified
  as an absolute pathname (closes: #20096).
- platform.in: Enabled %check in buildreq mode (closes: #23030).
- pkgconfig.req (PkgconfigReqProv): Relaxed version check.
2010-07-01 16:21:02 +00:00
7b74686984 shebang.req (ShebangReq): ensure that interpreter is specified as an absolute pathname (ALT#20096) 2010-07-01 16:14:06 +00:00
069cea1c59 platform.in (%__spec_check_pre): do not turn off %check in buildreq mode (ALT#23030) 2010-07-01 16:00:12 +00:00
cd86fe2063 pkgconfig.req (PkgconfigReqProv): relax version check 2010-07-01 13:23:01 +00:00
Alexey Tourbin
e90c978e68 4.0.4-alt98.36
- rpmdb.c: Make rpmdb index list hard-wired, remove unused require-
  and provideversion indexes (Panu Matilainen).
2010-04-21 12:04:08 +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
09aefe4229 4.0.4-alt98.35
- brp-verify_elf: Disabled lint check on ARM.
2010-04-14 14:40:56 +00:00
8b818f6df4 brp-verify_elf: disable lint check on ARM 2010-04-14 14:38:27 +00:00
Alexey Tourbin
f5a5902d0c 4.0.4-alt98.34
- find-package: Introduced FINDPACKAGE-COMMANDS output.
2010-04-08 11:27:02 +04:00
Alexey Tourbin
16fc089388 find-requires, find-scriptlet-requires: enabled FINDPACKAGE-COMMANDS output 2010-04-08 11:24:58 +04: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
48c22c9ff9 shell.req: fixed English 2010-04-08 11:24:54 +04:00
Alexey Tourbin
4e9dcb1346 shell.req: removed $sh --rpm-requires test 2010-04-08 11:24:52 +04:00
Alexey Tourbin
859a56a738 shell.req: reverted extra "functions vs executable" diagnostics 2010-04-08 11:24:51 +04:00
Alexey Tourbin
f477104d48 4.0.4-alt98.33
- brp-strip: Speed up by optimizing file(1) invocations.
2010-03-27 01:55:29 +03:00
Alexey Tourbin
3223ba1c5d brp-strip: select ELF files and .a archives with single file(1) invocation
Tested with gnome-icon-themes-oxygen-refit2-2.3-alt1.src.rpm.
Old result: 25 seconds, new result: 3 seconds.
2010-03-27 00:00:28 +03:00
Alexey Tourbin
16955bc185 4.0.4-alt98.32
- build/files.c (checkHdrIntersect): Avoid quadratic behaviour.
2010-03-26 19:07:30 +03:00
Alexey Tourbin
58fdd159bc build/files.c (checkHdrIntersect): avoid quadratic behaviour
Since the list of files is sorted, it is possible to avoid quadratic
behaviour by implementing merge-like intersection.

However note that directory names are not sorted (this is why it is
needed to build full file name for strcmp).

Tested with gnome-icon-themes-oxygen-refit2-2.3-alt1.src.rpm,
3 subpackages each 13-16K files.  Old behaviour: 18 seconds,
new behaviour: less than 1 second.
2010-03-26 19:00:43 +03:00
Alexey Tourbin
111bf48e92 4.0.4-alt98.31
- rpmpopt.in: Do remove extra newline before %{CHANGELOGTEXT} (4.0.4-alt93).
2010-03-16 20:12:05 +03:00
Alexey Tourbin
ede46b7ef5 rpmpopt.in: do remove extra newline before %{CHANGELOGTEXT} (4.0.4-alt93)
'rpm -q' and 'rpmquery' should be consistent with each other.

[builder@solemn ~]$ rpm -q --lastchange rpm
* Tue Mar 16 2010 Alexey Tourbin <at@altlinux.ru> 4.0.4-alt98.30
- order.c: Factored from depends.c.
- order.c: Added missing error message.
[builder@solemn ~]$ rpmquery --lastchange rpm
* Tue Mar 16 2010 Alexey Tourbin <at@altlinux.ru> 4.0.4-alt98.30

- order.c: Factored from depends.c.
- order.c: Added missing error message.
[builder@solemn ~]$
2010-03-16 20:11:43 +03:00
Alexey Tourbin
4a406c1f73 4.0.4-alt98.30
- order.c: Factored from depends.c.
- order.c: Added missing error message.
2010-03-16 15:07:21 +03:00