Commit Graph

39 Commits

Author SHA1 Message Date
Ivan Zakharyaschev
4bf78baf6c interdep.c: fix the optimization ("due to repentancy") of a non-identical dep
compare_deps() was simply called with a wrong argument (an illegal value
for this parameter); so it returned a meaningful result only if
the compared deps were identical. (Always, since the inception in f5ed7f870a .)

Example where the dep was not optimized out:

Name: test-epoch-repentancy
Version: 1
Release: alt1

Summary: test-epoch-repentancy

License: public domain
Group: Other

Requires: %name-sub = %EVR
Requires: foo = 1-alt1

BuildArch: noarch

%description
%summary

%package sub
Summary: sub
Group: Other

Requires: foo = 0:1-alt1

%description sub
%summary

%files
%files sub

%changelog
* Wed Feb 27 2019 Ivan Zakharyaschev <imz@altlinux.org> 1-alt1
- initial build for ALT Linux Sisyphus.

(cherry picked from commit 492396b532660f4debc46e96eb306f07a3261d66)

# Conflicts:
#	build/interdep.c
2019-02-27 07:30:19 +03:00
Ivan Zakharyaschev
6be20da468 headerNVR() replaced by the new header{NVRD,Name{,Version}}() in trivial cases
These are the cases where even the release was not needed (so, the
disttag is not needed, too), or one case where the filename is
contructed (and it doesn't include the disttag).

Now grep -Ee 'headerNVR[^D]' will show the remaining non-trivial
cases, where adapting to disttags may be needed.
2019-02-26 23:16:13 +03:00
Ivan Zakharyaschev
ee2e436b00 Merge branch 'predisttag-fixes' into _BUILD/alt
# Conflicts:
#	rpm-4_0.spec
2019-02-26 22:17:43 +03:00
Ivan Zakharyaschev
83ebf31ee5 build/interdep.c: always fix interpackage deps that need Epoch or Disttag
This completes the intention of de77ec4556
"build/interdep.c: fix interpackage dependencies automatically":

> ...This change also downgrades "dependency needs Epoch" error to warning
> because it automatically adds strict dependencies.

However, the dependency pkg1->pkg2 was not fixed (if it needed an epoch
or disttag) if pkg1 was already considered to have a strict transitive
dependency on pkg2 (perhaps, via another pkg3: if pkg1->pkg3 and
pkg3->pkg2 deps have already been fixed and added as strict ones).

Then, if pkg3 was a part of a cycle, the pkg1->pkg2 dep wasn't
optimized out. So, it was left untouched, not in the nice format of a
strict dep (i.e., missing an epoch or a disttag).

This was not dangerous, because the strictness was guaranteed by the
transitive dependency, but it was not nice, and was inconvenient for
tools which happen to compare the dep versions as whole strings (say,
for rpm and apt optimizations, or for disttag-unaware old rpm or apt).
2019-02-26 22:15:18 +03:00
95e1c533d9 build/interdep.c (fix_weak_deps): ignore packages without cpioList 2013-04-03 01:33:38 +00:00
0fc2559b49 build/interdep.c (pruneSrc1): enhance wording 2013-01-28 22:48:10 +00:00
59fa5d7825 build/interdep.c (makeRequires): ignore packages without cpioList 2013-01-28 22:28:42 +00:00
b238cfc321 build/interdep.c (pruneSrc1): avoid adding duplicate deps 2013-01-28 16:22:44 +00:00
cc191758d3 build/interdep.c: use rpmMessage 2013-01-26 22:32:10 +00:00
ed9fc6b550 build/interdep.c (fix_weak_deps): further interdep enhancements
Ignore requirements with RPMSENSE_SENSEMASK containing ~RPMSENSE_EQUAL.
Add strict requirements for requirements on subpackages regardless of
number of alternative providers.
2013-01-26 20:51:10 +00:00
de77ec4556 build/interdep.c: fix interpackage dependencies automatically
Non-strict interpackage dependencies are now converted to strict when
appropriate.
The %_allowed_nonstrict_interdeps macro support is therefore gone.

This change also downgrades "dependency needs Epoch" error to warning
because it automatically adds strict dependencies.
2013-01-26 18:29:21 +00:00
acb0164adf build/interdep.c: optimize code related to addRequires() 2013-01-25 01:31:40 +00:00
2f8008125d build/interdep.c: upgrade "dependency needs Epoch" warning to error 2013-01-24 07:09:44 +00:00
37a24f69a3 build/interdep.c: implement an interdep error check control
There is a macro now that can list pairs of allowed non-strict deps.
By default, the macro is not defined so the list is empty and therefore
non-strict deps are not allowed.
2013-01-24 05:52:49 +00:00
0358825884 pruneRDeps1: fix check for cycles
The check for cycles introduced in 4.0.4-alt100.17-6-ga71e004 appeared
to be incomplete.  For example, it fails to recognize a cycle in the
following example:

%package -n test
Requires: libtest = %version-%release

%package -n libtest
Requires: libtest-common = %version-%release

%package -n libtest-common
Requires: libtest = %version-%release
2011-03-14 02:27:17 +00:00
Alexey Tourbin
d5b1a5e2f2 build/interdep.c: missing alFree 2011-02-08 08:28:24 +03:00
Alexey Tourbin
7891bc3a46 build/interdep.c: diagnose non-strict dependencies between subpackages
warning: util-linux: non-strict dependency on libblkid
warning: util-linux: non-strict dependency on libuuid
warning: util-linux: non-strict dependency on libmount
warning: mount: non-strict dependency on libblkid
warning: cfdisk: non-strict dependency on libblkid
warning: fdisk: non-strict dependency on libblkid
warning: libblkid: non-strict dependency on libuuid
warning: libblkid-devel: non-strict dependency on libuuid-devel
warning: libmount-devel: non-strict dependency on libblkid-devel
warning: util-linux-debuginfo: non-strict dependency on libblkid-debuginfo
warning: util-linux-debuginfo: non-strict dependency on libuuid-debuginfo
warning: util-linux-debuginfo: non-strict dependency on libmount-debuginfo
warning: mount-debuginfo: non-strict dependency on libblkid-debuginfo
warning: cfdisk-debuginfo: non-strict dependency on libblkid-debuginfo
warning: fdisk-debuginfo: non-strict dependency on libblkid-debuginfo
warning: libblkid-debuginfo: non-strict dependency on libuuid-debuginfo

Note that the right time for this check is after strict dependencies
are propagated, and also after debuginfo dependencies have been lifted.
2011-02-08 07:19:01 +03:00
Alexey Tourbin
d92517ed56 build/interdep.c: diagnose mssing Epoch in subpackage dependencies
warning: libX11-devel: dependency on libX11 needs Epoch
warning: libX11: dependency on libX11-locales needs Epoch
2011-02-08 05:21:38 +03:00
Alexey Tourbin
a71e004bdf build/interdep.c: cycles must not be pruned completely
%package -n test
Requires: libtest = %version-%release
Requires: libtest-common = %version-%release

%package -n libtest
Requires: libtest-common = %version-%release

%package -n libtest-common
Requires: libtest = %version-%release

Here libtest and libtest-common make a cycle, and the "test" package
requires a cycle.  Naiive optimization against a cycle can simply
wipe out all dependencies: the dependency on libtest-common will be
optimized out, because libtest-common is already required by libtest;
likewise, the dependency on libtest will be optimized out, because
libtest is already required required by libtest-common.
2011-02-07 07:38:04 +03:00
Alexey Tourbin
e9d4612abe build/interdep.c: recognize %_deps_optimization
%_deps_optimization is now treated as optimization level 0, 1, or 2
(the default is 2).  Level 1 will make single-package optimizations.
Level 2 will additionally optimize dependencies between subpackages.
2011-02-07 06:26:02 +03:00
Alexey Tourbin
f5ed7f870a build/interdep.c: prune already required deps between dependent subpackages 2011-02-07 06:03:02 +03:00
Alexey Tourbin
8d0056fd39 build/interdep.c: also prune rpmlib(SetVersions) dependency 2011-02-05 07:25:46 +03:00
Alexey Tourbin
e061586385 build/files.c (finalizePkg): calculate RPMTAG_SIZE after optimizations
Note that checkHardLinks function is now removed.  It was unclear
whether it was supposed to verify %lang attributes (returning non-zero
on error) or indicate if all hardlinks are packaged within the package.

It turns out that only a single package in our repo has
PartialHardlinkSets dependency:

$ cd /ALT/Sisyphus/files/x86_64/RPMS/
$ rpm -qp --qf '[%{NAME}\t%{REQUIRENAME}\n]' *.rpm |fgrep 'PartialHardlinkSets'
$ cd /ALT/Sisyphus/files/noarch/RPMS/
$ rpm -qp --qf '[%{NAME}\t%{REQUIRENAME}\n]' *.rpm |fgrep 'PartialHardlinkSets'
freeciv-common  rpmlib(PartialHardlinkSets)
$

This probably means that freeciv-common has hardlinks with different
%lang attributes (which probably was supposed to be an error).  So
the whole issue should be reconsidered.  A leave XXX marks in the
code and suggest new PartialHardlinkSets implementation (however,
the dependency is not being added yet).
2011-02-05 03:49:54 +03:00
Alexey Tourbin
a6c78a83c9 build/interdep.c: prune extra deps between dependent subpackages
When pkg1 has strict dependency on pkg2, all other non-strict/virtual
dependencies on pkg2 will be reaped off pkg1.  Note that the are subtle
cases: though I try to make something about merging dependency flags,
it is not always possible, as the dependency on pkg2 can be obtained
via a transitive chain.  I see this being a non-critical issue which
is worthwhile to be mentioned.
2011-02-05 01:26:16 +03:00
Alexey Tourbin
e81ad7e376 build/interdep.c (liftDebuginfoDeps): social lift for debuginfo
Basically, if pkg1 has strict dependency on pkg2, the question
is whether pkg1-debuginfo should possess a strict dependency on
pkg2-debuginfo.  The answer is "yes" provided that pkg1-debuginfo
is already dependent on pkg2-debuginfo (i.e. has new soname-based
debuginfo dependencies resolved to pkg2-debuginfo).  This provides
an opportunity for dependency optimization between dependend
debuginfo subpackages.
2011-02-04 23:45:01 +03:00
Alexey Tourbin
43261c6111 build/interdep.c (processDependentDebuginfo): factored from pruneDebuginfoSrc 2011-02-04 02:56:14 +03:00
Alexey Tourbin
140d6de605 build/interdep.c: do not propagate self-Requires 2011-02-03 23:10:49 +03:00
Alexey Tourbin
2e38d0ef4c build/interdep.c: prune debuginfo src dups, Vierter und letzter Theil 2011-01-31 06:22:29 +03:00
Alexey Tourbin
31fc3dcd6f build/interdep.c: prune debuginfo src dups, part 3 - directories 2011-01-31 06:22:28 +03:00
Alexey Tourbin
c7567ffb9a build/interdep.c: prune debuginfo src dups, part 2
The output now is like this:
removing 12 sources from rpm-debuginfo and adding dependency on librpm-debuginfo
removing 11 sources from rpm-debuginfo and adding dependency on librpmbuild-debuginfo
removing 13 sources from rpm-build-debuginfo and adding dependency on rpm-debuginfo
removing 14 sources from rpm-static-debuginfo and adding dependency on rpm-debuginfo
removing 20 sources from librpmbuild-debuginfo and adding dependency on librpm-debuginfo
removing 13 sources from rpm-build-debuginfo and adding dependency on librpm-debuginfo
removing 80 sources from rpm-static-debuginfo and adding dependency on librpm-debuginfo
removing 12 sources from python-module-rpm-debuginfo and adding dependency on librpm-debuginfo
removing 12 sources from rpm-build-debuginfo and adding dependency on librpmbuild-debuginfo
removing 35 sources from rpm-static-debuginfo and adding dependency on librpmbuild-debuginfo
2011-01-31 06:22:25 +03:00
Alexey Tourbin
e00c43536c build/interdep.c: prune debuginfo src dups, part 1
The output is like this:
remove sources from rpm-debuginfo because it requires librpm-debuginfo
remove sources from rpm-debuginfo because it requires librpmbuild-debuginfo
remove sources from rpm-build-debuginfo because it requires rpm-debuginfo
remove sources from rpm-static-debuginfo because it requires rpm-debuginfo
remove sources from librpmbuild-debuginfo because it requires librpm-debuginfo
remove sources from rpm-build-debuginfo because it requires librpm-debuginfo
remove sources from rpm-static-debuginfo because it requires librpm-debuginfo
remove sources from python-module-rpm-debuginfo because it requires librpm-debuginfo
remove sources from rpm-build-debuginfo because it requires librpmbuild-debuginfo
remove sources from rpm-static-debuginfo because it requires librpmbuild-debuginfo
2011-01-31 06:22:11 +03:00
Alexey Tourbin
2213cb3f56 build/interdep.c: propagate dependencies 2011-01-31 04:54:22 +03:00
Alexey Tourbin
2c673900ce build/interdep.c: initial revision 2011-01-31 04:53:26 +03:00
dfa67f87c4 Generate strict intersubpackage dependencies in [E:]V-R[:D] format
* build/interdep.c: Generate new strict intersubpackage dependencies.
* build/reqprov.c (compare_deps): Make EVRs with DistTag stronger.
* rpmdb/legacy.c (providePackageNVR): Package provides [E]V-R[:D],
refactor and clean code up.

[ldv: Rewritten]
2019-01-10 23:20:03 +00:00
fa25b864cd Revert "build/interdep.c: add upgradeInterdep function"
This kind of interpackage dependencies appeared to be problematic.

This reverts commit f4d876f935.
2019-01-10 23:20:03 +00:00
e048944ef8 Use xasprintf 2019-01-10 23:20:03 +00:00
f4d876f935 build/interdep.c: add upgradeInterdep function
If RPM_STRICT_INTERDEPS environment variable is set and not empty, this
function replaces every strict requirement on NEVR with
".${RPM_STRICT_INTERDEPS}-NEVR", and adds to every package which
provides NEVR ".${RPM_STRICT_INTERDEPS}-NEVR" provide if some other
package requires this ".${RPM_STRICT_INTERDEPS}-NEVR".

This is needed to able to build a source package to different repo
branches with the same NEVR, and to rebuild the source package as well
with same NEVR within one branch and avoid interdep collisions.
2018-04-18 22:51:40 +03:00
1ccc182f71 build: rewrite without using nested functions
gcc generates trampolines for pointers to nested functions.
This implies executable stack - the thing we want to avoid.
2015-01-28 17:04:30 +00:00
Igor Vlasenko
83f32e64e2 Finer control for %_deps_optimization (ALT#30476)
0: disabled
1: old behaviour with %_deps_optimization=0
2: old behaviour with %_deps_optimization=1
3: old behaviour with %_deps_optimization=2
2014-11-19 17:22:58 +00:00