Commit Graph

299 Commits

Author SHA1 Message Date
56e441c403 rpmio+pack: Update rpmio_flags 'T' with actual threads used
Useful information for debugging liblzma memory issues.

Reviewed-by: Arseny Maslennikov <arseny@altlinux.org>
Reviewed-by: Dmitry V. Levin <ldv@altlinux.org>
2021-01-16 03:16:55 +03:00
b6d1778c72 pack.c: print payload compression string
Given that downgradeLzmaLevel can change the payload compression,
it's useful to have this diagnostics in the output produced by rpmbuild.
2020-12-19 22:43:47 +00:00
Alexey Tourbin
b295de5893 pack.c: downgrade XZ->LZMA automatically for small payloads
Recent changes left downgradeLzmaLevel dysfunctional (because it does
not recognize 'T').  In my view, the only advantage of XZ over LZMA is
that XZ can can split input into blocks and compress them in parallel
(resulting in a speed-up).  Other advantages, such as a checksum, are
immaterial for our purpose (because the package manager must verify the
integrity of a package beforehand).  Therefore, downgradeLzmaLevel will
also downgrade XZ->LZMA automatically, for payloads smaller than
5*dictSize (the default blockSize being 3*dictSize, so that there are
at least two blocks, the second block not too small).
2020-12-19 22:43:47 +00:00
128d160548 addReqProv: ignore self-provides
providePackageNVR already does the right thing.
2020-11-11 08:00:00 +00:00
62037838a4 build: canonicalise symlink destinations
The canonicalization is based on the code lifted from tools/debugedit.c

The new behaviour is enabled by default and controlled by
%_canonicalize_symlinks macro.
2020-08-24 19:38:47 +00:00
Panu Matilainen
5f7fe6577f Warn on absolute symlinks at build-time
While supported of course, absolute symlinks are nasty in many ways
so issue a warning to packagers. Update two affected test-cases.
Related to #668.

(cherry picked from rpm.org commit 8359ded6784579b9f2527a09888132034783e1de)
2020-08-24 19:38:47 +00:00
Bernhard M. Wiedemann
7dba4f2bba Do not store digests of ghost files
when the files exist during build time.
The hash will never be used for verification anyway.

This helps making packages build more reproducibly.

(cherry picked from rpm.org commit 8cda485e1150dc6be990a7aa4496da848154cf55)
2020-08-24 19:38:47 +00:00
Panu Matilainen
308bc34ea9 Handle readlink() failure in genCpioListAndHeader() correctly
It might be a rare condition but it /can/ happen, and previously that would cause '\0' written out of bounds (at negative array offset). Also leave room for the terminating '\0' at the end of buffer when calling readlink(), previously a link exactly the size of buffer would've been silently truncated.

(cherry picked from rpm.org commit c499a0b912629eeeabc3554d3e3a95c088e96422)
2020-08-24 19:38:47 +00:00
d304554617 packageSources: override RPMTAG_BUILDTIME with $SOURCE_DATE_EPOCH
When hasher generates an src.rpm from pkg.tar, it sets $SOURCE_DATE_EPOCH
according to pkg.tar's specfile modification time which in turn is set to
the corresponding commit time.

When hasher builds from an src.rpm, it sets $SOURCE_DATE_EPOCH according
to the src.rpm's RPMTAG_BUILDTIME.

This changes helps to connect these two stages, setting the
RPMTAG_BUILDTIME of the generated src.rpm to $SOURCE_DATE_EPOCH.

Co-Authored-by: Gleb Fotengauer-Malinovskiy <glebfm@altlinux.org>
2020-04-21 15:54:47 +00:00
252df9b61a Fix %patch and %autopatch
* build/parsePrep.c (doPatch): Do not pass null pointer to sprintf.
(doAutopatchMacro): Do not pass null pointer to strcmp.

Fixes: 9c18a402 ("Make %autopatch and %patch accept -pg")
2020-01-04 10:43:44 +00:00
9c18a40269 Make %autopatch and %patch accept -pg
* parsePrep.c (doPatch): Change strip argument type to const char *.
(doPatchMacro, doAutopatchMacro): Change opt_p variable type to char *,
change checking of opt_p: it can be either a number or a 'g' symbol
assuming that -pg is a valid option for patch command.
2019-12-15 21:57:32 +00:00
Colin Walters
8e0d85c61e Add 'VCS' key
Spec files have a lot of metadata about a project.  However one of the
most key components is the upstream version control system which was
notably lacking.

Resolve this by adding a "VCS" key.  There is no specification
for contents of this key, given that the set of version control
systems (and features thereof) are not well-defined.  However,
recommendations are:

 * git: This URL should be in a form that can be passed to "git clone",
   with the additional feature that an optional fragment identifier "#foo"
   denotes a branch or tag.
2019-11-01 16:16:23 +00:00
efe5536cfe build: add %autopatch support
%autopatch is a directive to apply all patches, it supports -p<num> and
-F<num> options

%autopatch was initially introduced in rpm.org with version 4.11 but with
different implementation.
2019-10-03 21:14:18 +03:00
1b6d0ed4c2 parseBits: fix regression introduced by the latest fix 2019-04-19 05:08:33 +00:00
988b7b0106 parseBits: disallow syntax errors and unknown qualifiers
The previous attempt to fail build in case of syntax errors
and unknown dependency qualifiers made in commit
rpm-4.8.0-beta1-385-gbf2bc18ebb325f081ade65adc2fbb6858f0b8396
missed the following classes of erroneous dependencies:

Requires(,) -- erroneously treated as Requires(),
Requires(;) -- erroneously treated as Requires(),
Requires(,pre) -- erroneously treated as Requires(),
Requires(;pre) -- erroneously treated as Requires(),
Requires(pre,) -- erroneously treated as Requires(pre),
Requires(pre,,postun) -- erroneously treated as Requires(pre),
Requires(pre,,junk) -- erroneously treated as Requires(pre),
Requires(pre;postun) -- erroneously treated as Requires(pre),
Requires(pre;junk) -- erroneously treated as Requires(pre).

Found by code inspection.

Fixes: bf2bc18ebb32 ("Always fail build on unknown dependency qualifiers")

(cherry picked from rpm.org commit aafb861846db97d78964e98d603b4e6cd88ed3ae)

The two last cases listed above have already been fixed by commit
f7280d8302.
2019-04-16 18:46:34 +00:00
a765b58010 parseRCPOT: reject Provides containing logical operator < or >
Disallow those types of Provides that specify version ranges
because Provides are not compatible with version ranges.
2019-04-16 18:46:34 +00:00
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
3cec7c6d8c reqprov.c: fix a comment (after the disttag handling was inserted) 2019-02-27 07:30:19 +03:00
Ivan Zakharyaschev
5bc7c3086d build/reqprov.c: made addReqProv() aware of the disttag of the package 2019-02-26 23:19:51 +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
Ivan Zakharyaschev
eddfb9267b don't touch unrealistic deps, when filling insignificant disttags for compatibility
Not touched:

Requires: x < E:V-R[:D]
Obsoletes: x > E:V-R[:D]
Requires: x > E:V-R:D (with a disttag)

There are actually no such dependencies in Sisyphus now.
2019-02-22 15:59:27 +03:00
a5bed9a6e4 Rewrite "x < E:V-R[:D]" and "x > E:V-R[:D]" deps for compatibility with disttag-unaware tools
With this change, there are not so many failing tests from
rpminstall-tests-1.0-alt4 (or equivalently from the predisttag branch
there) when run in a system with an "old" rpm and the "new" rpm-build

$ rpm -q rpm --lastchange
* Пт окт 05 2018 Gleb F-Malinovskiy <glebfm@> 4.13.0.1-alt4
- Add _allow_deps_with_beginning_dot macro to allow dependencies
  beginning with a dot character in spec file (vseleznv@).
$ ./makeme.sh -j4 SHORT=1
...
XFailed tests:
installable_dummyDisttag_with_reqEqualEpoch (external/strict-old-old dep & future pkg)
noninstallable_dummyDisttag_with_conflEqualEpoch (external/strict-old-old dep & future pkg)
installable_virtDummyDisttag_with_reqEqualEpoch (external/strict-old-old dep & future pkg)
noninstallable_virtDummyDisttag_with_conflEqualEpoch (external/strict-old-old dep & future pkg)
installable_dummyDisttag_with_reqEqual (elusive external/strict-old-old dep & future pkg)
noninstallable_dummyDisttag_with_conflEqual (elusive external/strict-old-old dep & future pkg)
installable_virtDummyDisttag_with_reqEqual (elusive external/strict-old-old dep & future pkg)
noninstallable_virtDummyDisttag_with_conflEqual (elusive external/strict-old-old dep & future pkg)
obsoleted_dummyDisttag_with_obsolEqualEpochDisttag (unrealistic obsoleting disttag)
obsoleted_dummyDisttag_with_obsolEqualDisttag (unrealistic obsoleting disttag)
installable_provVR3Disttag_with_reqEq_VR3 (elusive external/strict-old-old dep & future pkg)
Failed tests:
noninstallable_provOnlyV_with_reqVR
noninstallable_provOnlyV_before_reqVR
installable_provOnlyV_with_conflVR
installable_provOnlyV_before_conflVR

Except for the underspecified Provides problem, the insteresting cases
are the cases of a = dependency.

We can think of a Conflicts: subpkg = E:V-R, which wouldn't work,
but many such cases (if there are any) must be mitigated by the change
of the value of %%EVR to include the disttag (in another commit).

So, the "old" and "new" rpm behave much more similar w.r.t. to the
packages built by the new rpm-build. (This is what we wanted.)
2019-02-22 13:55:30 +03:00
Ivan Zakharyaschev
e3b9fe1253 files.c: more const qualifiers at appropriate places 2019-02-21 14:18:39 +03:00
c5d7a2ddf2 Remove isLegacyPreReq() checks from compare_deps() and addReqProv()
Since we no longer use legacy PreReq tags, all calls to isLegacyPreReq()
can be safely removed.
2019-01-14 20:56:55 +00:00
efc8d3637c Drop %__find_prereq support
It has never been used anyway, and now it stands in the way of replacing
deprecated PreReq with Requires(pre,postun).
2019-01-14 20:56:55 +00:00
e05c6cf019 Map deprecated PreReq tags to Requires
Convert PreReq tags without qualifiers into Requires(pre,postun)
and PreReq tags with qualifiers into Requires tags with those qualifiers.

This matches compare_deps() behaviour and opens the way
for additional optimizations of dependencies.
2019-01-14 20:56:55 +00:00
f7280d8302 parseBits: disallow unknown qualifiers, allow abbreviated qualifiers
Before this change unknown qualifiers were silently ignored if they
happened to be the last or the only qualifier, e.g. Requires(trash) or
Requires(pre,trash) were accepted but Requires(trash,post) were not.
Now all unknown qualifiers are treated as errors.

Before this change abbreviated qualifiers like BuildRequires(pre)
were silently ignored as unknown, now unambiguously abbreviated qualifiers
are handled like non-abbreviated.
2019-01-14 20:56:55 +00:00
e612cf937e handlePreambleTag: disallow extra qualifiers with BuildPreReq
Extra qualifiers (prep, build, install, clean) used to be allowed
but useless with BuildPreReq.
2019-01-14 20:56:55 +00:00
4134fc39ac Fix automake warnings
Makefile.am:13: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
build/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
lib/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
python/Makefile.am:7: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
rpmdb/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
rpmio/Makefile.am:9: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
tools/Makefile.am:5: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')
2014-02-15 22:19:47 +00:00
95e1c533d9 build/interdep.c (fix_weak_deps): ignore packages without cpioList 2013-04-03 01:33:38 +00:00
8239befdd2 build/reqprov.c (compare_deps): fix potential use after free
Fix potential use after free introduced in 4.0.4-alt31.
2013-01-29 16:14:54 +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
c6991af51a build/reqprov.c (compare_deps, compare_sense_flags): fix bugs in comparisons of releases
Before this change, thanks to rpmEVRcmp(), compare_deps() used to treat
EVRs with common EV as equal when one had a release and another hand't.

There were some reasons to use this approach, e.g. to decide that
	Requires: %name = %version
is weaker than
	Requires: %name = %version-%release
it had firstly to consider them as comparable deps.  But, as an
unfortunate consequence of that approach, it was deciding that such deps
are equal, so that addReqProv() was unable to replace former with the
latter.
2013-01-28 00:52:24 +00:00
525389d128 build/reqprov.c (compare_deps): promote Epoch by giving it special treatment
If one of deps has Epoch and another one hasn't,
we first compare them without Epoch, and if it happens
that they are equal, then the dep that has Epoch wins.
2013-01-27 23:51:55 +00:00
7b9d0f53d1 build/reqprov.c (compare_sense_flags): cleanup
This is essentially a noop change that makes the code more readable.
2013-01-27 23:51:47 +00:00
e97eca74be build/reqprov.c (compare_deps, compare_sense_flags): readability improvements
This is a noop change that hopefully makes the code a bit more readable.
2013-01-27 23:22:23 +00:00
cd742a2959 processBinaryFiles: check provides of generated binary packages 2013-01-26 22:32:11 +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
ffaf1f8baf build/reqprov.c (compare_deps): fix Epoch handling for deps with same senses
When comparing deps whose senses are identical, Epoch needs special
treatment: if one of deps has Epoch and another one hasn't, we first
compare them without Epoch, and if it happens that they are equal,
the dep that has Epoch wins.
2013-01-26 18:29:26 +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
Igor Vlasenko
8468c6fb06 build/parsePrep.c: add %patch -F<N> support (ALT#27662)
In modern rpms both %patch -F <N> and %patch -F<N> are valid option
calls whereas old -F implementation supported -F <N> syntax only.
This patch adds support for %patch -F<N> syntax.
2012-08-24 08:30:44 +00:00
c4a3fcd4ca Cleanup previous commit 2012-08-16 23:16:57 +00:00