Commit Graph

14460 Commits

Author SHA1 Message Date
Panu Matilainen 672c9e378b Convert %{load:...} to work via the macro lookup table
Annoyingly the amount of other boilerplate makes this slightly more code
than the original, but then saner code isn't always smaller, and it does
make expandMacros() smaller, which can only be a good thing.
No functional changes.
2019-01-15 15:31:19 +02:00
Panu Matilainen 311c5fdb0b Convert %{echo:...}, %{warn:...} and %{error:...} to work via lookup table
Handle log level determination inside doOutput() to make the interface
match with the others and as a bonus, make expandMacros() that little
bit smaller again. Empty argument needs to be handled differently
but shouldn't affect functionality.
2019-01-15 15:30:44 +02:00
Panu Matilainen 60327e1865 Convert %{lua:...} to work via builtin lookup table
No functional changes. chkexist and negate arguments are unused for
now, but they could perhaps be used for error condition handling later
(similar to %load)
2019-01-15 15:17:24 +02:00
Panu Matilainen ad0cf2cfa9 Start using the builtin macro table for looking up macro primitives, step 1
Replace the "necessary but clunky" string comparisons in expandMacro()
with a lookup on the builtins. For starters, only the primitives
handled in doFoo() are converted, others will require varying amount
of further changes. chkexist argument is unused by doFoo() but will be
needed later for others, add now to avoid having to change more later.

No functional changes intended, anything like that would simply be a bug.
2019-01-15 15:16:17 +02:00
Panu Matilainen 1c069fe246 Add two missing builtin macros (u2p and F) to the builtins table 2019-01-15 14:21:08 +02:00
Panu Matilainen 858e8c58f6 Make macro lookupBuiltin() work with non-terminated strings
For current uses this shouldn't make any difference, but much of the
macro engine works with string lengths so to avoid having to create
\0-terminated versions of all strings we might look at...
2019-01-15 13:36:46 +02:00
Panu Matilainen 9b6fdc65ef Drop double-quotes from %_smp_mflags and %_lto_cflags
The double-quotes got added in e811c7ec0b
and 2bb7b0cf06 but traditionally there have
been no quotes around %_smp_mflags output, to avoid risking any breakage
due to such a simple thing, lets go back to how it used to be.
2019-01-15 11:47:29 +02:00
Panu Matilainen 4732701c2e Use %getncpus for %_smp_mflags and %_lto_cflags to make them affinity-aware
Making %_smp_mflags affinity-aware was requested long, long ago in
https://bugzilla.redhat.com/show_bug.cgi?id=891588 but somewhere along
it fell in the cracks between distro versions...
2019-01-15 11:40:56 +02:00
Panu Matilainen e11068a484 Use %getncpus for number of parallel XZ compression threads 2019-01-15 11:19:56 +02:00
Panu Matilainen 69e8b91dcc Add a built-in macro for fetching number of CPUs, affinity aware and all
There's an increasing number of placing wanting to know the number of
CPU's for parallel processing, and increasingly these things are running
in containers and such where the total host CPU count is not meaningful.
2019-01-15 11:16:04 +02:00
marxin 2bb7b0cf06 Introduce smp-aware LTO enablement macro %_lto_cflags.
%_lto_cflags can be used to enable LTO (link-time optimization) either
on per-package basis in specs or per-distro basis via %optflags.
Parallel jobs are used automatically where system and configuration
(shared with %_smp_mflags) support it.
2019-01-15 10:40:32 +02:00
marxin e811c7ec0b Isolate %_smp_build_ncpus and use it for %_smp_mflags.
Refactor _smp_build_ncpus and use it in %_smp_mflags. Note that now
having a single CPU, %_smp_mflags is expanded to '-j1'.
2019-01-15 10:39:42 +02:00
marxin 8655493bdf Make %make_build to provide verbose output of make command. 2019-01-10 11:29:06 +02:00
Panu Matilainen 7a2f891d25 Fix regression reading some old v4.0 era packages (#610)
Some old v4.0 era packages have RPMTAG_HEADERIMAGE in the signature
header region trailer, instead of the expected RPMTAG_HEADERSIGNATURES.
This was fixed in 4.4.x in commit 21818c6c8f
but regressed in the commit 85a5b00430
refactoring / cleanup.

Reported at https://bugzilla.altlinux.org/show_bug.cgi?id=33710, original
patch by Vladimir D. Seleznev.
2019-01-07 14:58:16 +02:00
Panu Matilainen 017d0b8846 rpm2cpio cannot handle files over 4GB, error out cleanly (RhBug:1662481) 2019-01-02 11:36:50 +02:00
Andreas Scherer b50f00f80d Simplify Lua backwards compatibility. 2018-12-19 13:42:27 +02:00
Andreas Scherer bcb4781fd8 Fix rpmlib lua extension build with Lua < 5.3.4 (#608)
It seems that "_LOADED" was replaced by macro LUA_LOADED_TABLE in lua 5.3.4.
Re-establish string "_LOADED" for pre-5.3.4 Lua.

Fixes regression with Lua < 5.3.4 introduced by commit f13de84.
2018-12-19 13:42:27 +02:00
Panu Matilainen 362c440197 Only read through payload on verify if actually needed
If none of our verify items ranges over the payload, then why bother?

To do this, add an internal rpmvs API to get it's range, and use
that to decide whether trip over the payload is needed or not.
In addition, the payload digest tag needs to be grabbed outside of the
condition to avoid depending on other values. The details including
RPMVSF_NEEDPAYLOAD will be handled internally to rpmvs which makes it
actually nicer code-wise too.
2018-12-11 13:48:18 +02:00
Pavlina Moravcova Varekova 45465504bd Do not use $PYTHON or variables based on $PYTHON without setting it
If rpm is configured without Python bindings, the varible $PYTHON is
not set and thus it does not make sense to use $PYTHON.
2018-12-11 12:06:13 +01:00
Panu Matilainen fc51fc39cf Fix headerCheck() return code mismatch & regression in 4.14.x
In commit 763d3e44a6 (probably),
headerCheck() started returning rpmvsVerify() return code directly.
But rpmvsVerify() returns 0/1 for success/failure, whereas headerCheck()
is supposed to return an rpmRC where 1 means NOTFOUND, which is
quite a different thing than FAIL. That nobody notices under normal
circumatsnaces

Making headerCheck() return OK/FAIL would be simple, but it's a public
API that used to return NOKEY etc, so perhaps we should try to preserve
that although the only user of headerCheck() I know of is our own rpmdb
code.

So... take the opportunity to do something good and fix it by unifying
the two callbacks which in the end only differ by what they output, so
handle that with a function pointer in the callback data. It's all that
little bit saner this way.
2018-12-05 16:02:16 +02:00
Florian Festi 8390fa8515 Add RPMTAG_MODULARITYLABEL to distinguish packages build for modularity
Tag can be set with a ModularityLabel: statement in the spec file preamble or
via the modularitylabel macro
2018-11-30 12:55:36 +01:00
Pavlina Moravcova Varekova ad8c12c5d9 Distinguish empty and no capabilities in RPM verification
The original file capability verification in rpm incorrectly assumed
empty capabilities equals no capabilities, now we differentiate
between the two and report it in verification. Related to #585.
2018-11-29 13:01:29 +01:00
Pavlina Moravcova Varekova 4ebce1eed2 Do not create a file in /tmp by rpmbuild archive sanity test
If a user runs "make check" and then a second user (not root)
runs "make check" the test "FAILED". It is because the test is not
able to create file /tmp/attrtest.cpio because the file is
already there creted by the first user.
2018-11-28 14:07:31 +01:00
Panu Matilainen 15b296c324 Actually permit caret in version, release and evr strings
Should've been in commit c7e711bba5 really.
2018-11-27 13:50:14 +02:00
Panu Matilainen e8fce62467 Consolidate allowed version/release/evr allowed characters to macros
Maintaining multiple variants of the same thing, that always worked
soooooo well... No functional changes here. Unless I truly messed up.
2018-11-27 13:41:31 +02:00
Andreas Scherer 76c429c317 Handle %setup archive unpack exit code centrally and consistently
Previously the exit code handling was missing from uncompressed tar-case.
2018-11-27 13:00:53 +02:00
Panu Matilainen a22b5973bd Handle whitespace in uncompressed tar archive names, duh
Now here's an oldie but goodie, all these years and those whitespace fixes
and yet vanilla tarballs were not handled.
2018-11-27 13:00:25 +02:00
Igor Gnatenko c7e711bba5 Add support for sorting caret ('^') higher than base version
1.1^20160101 means 1.1 version (base) and patches which were applied at
that date on top of it.

* 1.1^201601 > 1.1
* 1.1^201601 < 1.1.1

Having symmetry is also good.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-11-26 12:32:10 +02:00
Igor Gnatenko e7fa1f1c1c build: check rich dependencies for special characters
Reported-by: Michael Schroeder <mls@suse.de
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-11-26 12:32:10 +02:00
Igor Gnatenko 871065ddd4 build: make haveRichDep aware of other fields allowed to have them
Recommends/Suggests/Supplements/Enhances can also have rich deps,
so we need to extend the check. Or remove it.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-11-26 12:32:10 +02:00
Panu Matilainen 74766d30b9 Handle unsupported digests the same as disabled ones (RhBug:1652529)
A digest type unsupported by the underlying crypto library (whether
technically or by configuration) does not mean the digest is invalid,
it just cannot be used. Which for the purposes of verification is the
same as if that digest didn't exist at all, and that's exactly how we
handle digests and signatures disabled by configuration.

One particular case is FIPS mode which globally disables the use of MD5,
which we mishandled prior to this by showing it as OK in verification
despite actually not verifying it at all.

The exact place for handling this case is a bit subtle: the "obvious"
place for checking for supported type is in rpmvsInitRange() but this
doesn't work because of rpmDigestBundleAddID() return code semantics.
The other "obvious" place would be rpmvsVerify(), but by that point
we have even more funny cases to consider. So for now, it's actually
easiest to check for this in rpmvsFiniRange() even if it's not the
most obvious place for doing so. Might want to change the
rpmDigestBundleAddID() semantics later, but this makes for a nicer
backport (we'll need this in 4.14.x too).
2018-11-23 13:05:26 +02:00
Panu Matilainen 323d3e7962 Update POTFILES for the parseBuildInstallClean -> parseSimpleScript rename
Should've been in commit d6c4fff202
2018-11-20 10:57:55 +02:00
Panu Matilainen b5077933da %verify scriptlet dependencies are not supposed to affect ordering 2018-11-16 14:18:44 +02:00
Panu Matilainen a75fc903e9 Add + use a bitmask for order-agnostic dependency types
No functional changes but makes the information available to API users,
and is more in line with the other IsFooPreReq() macros.
2018-11-16 14:17:07 +02:00
Florian Festi ca8ff08e4f Fix copy in paste error in d6c4fff202
Thanks to Jeff Johnson for pointing this out!
2018-11-06 17:06:04 +01:00
Florian Festi d6c4fff202 Rename parseBuildInstallClean() to something more generic 2018-11-06 12:21:44 +01:00
Panu Matilainen c4f285cff8 Document --noverify in the man page (RhBug:1646458)
Should've been in commit 765e2c72ae
2018-11-06 12:23:18 +02:00
Andreas Scherer 3d8a29a9d9 Add --scm option for %autosetup SCM selection
Allow selecting %autosetup SCM backend from cli in case it's not
hardwired in the spec, handy for eg rediffing patches.
2018-11-05 14:52:26 +02:00
Johan Heikkilä 2c2cacc8e1 Fix typo in sv.po 2018-11-05 13:17:35 +02:00
Vladimir D. Seleznev a427785734 rpmpopt: make query info command display DistTag if it is non-null
In ALT there can be different builds of the same NEVR which only
differ in DistTag, so it is useful to print its value as part of
package information.

Signed-off-by: Vladimir D. Seleznev <vseleznv@altlinux.org>
2018-11-05 12:05:48 +01:00
Markus Linnala b4178c979f Remove capabilities instead of setting empty caps via. --setcaps
If a file in a package does not have any capabilities rpm --setcaps should
remove capabilities of the file. Prior to this patch capabilities of the file
were set as empty.

Empty capabilities mean more than no capabilities. A file with no capabilities
can inherit capabilities, but file with empty capabilities can not.

When ever package does not have any capabilities set %|FILECAPS? is false.
If some files have capabilities, %|FILECAPS? is true but %{FILECAPS} is ''
when the file does not have capabilities and '= <capstring>' when there is some.

Reported and patch created by Markus Linnala
Commit message edited by Pavlina Moravcova Varekova and Florian Festi.

Fixes #585
Fixes #586
2018-11-05 11:52:03 +01:00
Markus Linnala 70dd462243 Fix manual typos/formatting 2018-10-30 15:26:21 +01:00
Panu Matilainen 090ce7a75d Drop support for patch < 2.1
The oldest patch version available from http://ftp.gnu.org/gnu/patch/
is patch 2.5 from August 1997, the same year when commit
636fc4bec9 added support for
"modern patch programs", 21 years ago almost to date. A bit of digging
around reveals that GNU patch 2.1 released in 1993 and patch 2.2 earlier
in 1997. Makes me think perhaps we can risk dropping support for 2.1
without a huge uproar from the community... RIP old fella.
2018-10-25 16:10:13 +03:00
Panu Matilainen 236c44707b Pull translations from Zanata
...now that there's something to pull
2018-10-24 12:41:07 +03:00
Panu Matilainen 0d83637769 Fix nasty --setperms/--setugids regression in 4.14.2 (RhBug: 1640470)
Commit 38c2f6e160 causes --setperms and
--setugids follow symlinks instead of skipping them.

In case of --setperms, all encountered symlinks will have their
target file/directory permissions set to the 0777 of the link itself
(so world writable etc but suid/sgid stripped), temporarily or permanently,
depending on whether the symlink occurs before or after it's target in the
package file list. When the link occurs before its target, there's a short
window where the target is world writable before having it's permissions
reset to original, making it particularly bad for suid/sgid binaries.

--setugids is similarly affected with link targets owner/group changing
to that of the symlink.

Add missing parentheses to the conditions introduced in commit
38c2f6e160 to fix.
Reported by Karel Srot, patch by Pavlina Moravcova Varekova.
2018-10-22 12:08:46 +03:00
Igor Gnatenko 0d2176c9a3
rpmfc: push name/epoch/version/release macro before invoking depgens
Fixes: https://github.com/rpm-software-management/rpm/issues/502
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2018-10-17 11:22:54 +02:00
daurnimator c2c5798534 Use lua_rawlen() instead of deprecated luaL_getn() 2018-10-16 12:51:09 +03:00
daurnimator 1507a30ca9 Remove useless Lua userconfig file 2018-10-16 12:50:55 +03:00
daurnimator f13de84bab Don't use deprecated luaL_pushmodule() function 2018-10-16 12:50:50 +03:00
daurnimator be1ef2d80f Remove unreachable linit module 2018-10-16 12:50:45 +03:00