Commit Graph

15924 Commits

Author SHA1 Message Date
Panu Matilainen a7c3886b35 Mop up leftovers from rpmteFI()
This should've been in commit 6fcdaefef5
2022-08-10 13:36:57 +03:00
Florian Festi 8f922eb38a rpm2cpio.sh: only read needed bytes of file magic
As we look at the first 4 bytes anyway there is no reason to read more.
Reading more also hits a bug in bash on aarch64 (rhbz#2115206).
2022-08-10 12:04:03 +02:00
Florian Festi 951f25bc84 Quote %sources and %patches for shell
Add testcase with special characters

Resolves: #1445
2022-08-02 12:55:35 +02:00
Florian Festi a3eac98460 Testcases: Queries to rpmdb including ^~+
Related: #2070
2022-07-21 16:47:19 +02:00
김인수 f5118bba73 Translated using Weblate (Korean)
Currently translated at 100.0% (910 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/ko/
2022-07-18 14:28:13 +02:00
Temuri Doghonadze ea537168d8 Translated using Weblate (Georgian)
Currently translated at 9.0% (82 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/ka/
2022-07-18 14:28:13 +02:00
Florian Festi 2b5b271b0e Add support for --oldpackage to --freshen
This allows to downgrade packages just as with --upgrade but limited to
already installed packages.

Also add basic tests for --freshen

Resolves: #652
2022-07-14 16:02:01 +02:00
Florian Festi 9ed9d3fce3 Add SourceLicense tag to spec syntax
to set a separate license to the source RPM. This can be useful if the
sources have code under additional licenses that do not end up in the
binary packeges.

Resolves: #2079
2022-07-14 15:04:02 +02:00
Florian Festi 85d92cab05 rpm2cpio.sh: Improve error message
for unknown payload compression format. At this point it is unlikely
this isn't an RPM file as we detected the headers but much more likely
the package is using a newer compression format.
2022-07-13 16:54:49 +02:00
Florian Festi f3b263610b rpm2cpio.sh: Deal with null byte in lzma magic
As the shell can't deal with null bytes only read two bytes and check
for proper match. This way we can match for the null byte even if it is
not part of the string.

This also silents the warning from the shell that there is a null byte
being ignored in the magic string for lzma.
2022-07-13 16:54:49 +02:00
Florian Festi d499887c92 rpm2cpio.sh: strip null bytes with tr
to avoid warnings
2022-07-13 16:54:49 +02:00
Florian Festi a18a11924a rpm2cpio.sh: Don't drop newlines from header sizes
This script converts binary header sizes to decimal numbers. Shell is
not that well suited for this task as it drops newlines at the end of
command substitutions. Add a . character at the end and strip it right
after that to avoid this problem.

Resolves: rhbz#1983015
2022-07-13 16:54:49 +02:00
Florian Festi ba31a14191 rpm2cpio.sh: Check for header magic
This make is much less likely to mistake a file as an RPM and will catch
errors in header size calculation.
2022-07-13 16:54:49 +02:00
yangchenguang 4420c78beb
Fix query arguments with ^ not working
when querying packages in the RPM database.

Rersolves: #2104
2022-07-13 10:52:07 +02:00
Florian Festi aa701a8f48 Exclude *.src.rpm from check-buildroot
With the SRPMs now containing the expanded spec file they are bound to
have the build root included in the header. Turns out some people
package SRPMs to rebuild them locally e.g. against the local kernel.

Resolves: rhbz#2104150
2022-07-11 14:50:48 +02:00
Michal Domonkos 8b9da98e4c Use explicit default branch in %autosetup -S git
Commit 3a6b1d8fbf assumed "master" as the
default git branch to track, however the name can be changed globally,
so make it explicit.

Given the choice now, go with "main" as the general trend, e.g:
https://fedoraproject.org/wiki/Changes/GitRepos-master-to-main
2022-07-11 14:09:45 +02:00
Panu Matilainen 8c3fb5eb01 Add an experimental CMake build system
This is an incomplete release-early version, NOT intended or
suitable for production use. It is intended to replace the autotools
based buildsystem in rpm 4.20, until then it'll be developed alongside
it. This causes some extra complications of course, but then we avoid
a huge flag-day, and that matters more.

To those wondering why cmake and not ${myfavorite}: the community around
us effectively made that choice for us. We've made a lot of noise about
bootstrap dependencies. When libsolv, dnf and all the related stack is
powered by cmake build, it'd be just foolish to go with anything else.
This way people working on the rpm stack have only one build system to
learn, there's peer support available nearby and bootstrap dependencies
are reduced, not increased. It also doesn't hurt that cmake is actually
and actively maintained.
2022-06-28 16:33:33 +03:00
Bernhard Rosenkränzer 5f8ac6d1ad Fix unterminated macros in rpmuncompress
Fix unterminated macros being called when rpmuncompress
tries to expand an lrzip, 7zip or zstd compressed file
2022-06-27 08:47:36 +03:00
Michal Domonkos c10e2310e4 Add shell-like escape support to %files
Make sure any quoted metacharacters in a pattern are unescaped before
it's passed to addFile() and subsequently lstat(2).  Do this by always
letting such patterns through rpmGlob() which now handles backslashes
properly since commit 4030062f2b.  Don't
expand globs twice in processSpecialDir(), though.

Axe the public rpmIsGlob() which is no longer needed, we'll be bumping
the soname in 4.19.

Construct absolute file names directly without going through
rpmGenPath() so that literal (double) percent signs are not expanded
twice and can be used the same way as in other parts of a spec file.
This means URLs are not handled anymore but we're dealing with local
files here so that should be fine.

Add the "cp" binary to the test environment, it's needed for the %doc
directives which copy stuff around.

Fixes: #1749
2022-06-27 08:42:36 +03:00
Michal Domonkos f1dc0287e3 Refactor rpmGlob()
Unindent the block touched in the previous commit and move declarations
to the beginning, dropping the now redundant gflags in the process.

Best served with "git show --ignore-all-space".

No functional change.
2022-06-27 08:42:36 +03:00
Michal Domonkos 9e541c6a7d Fix rpmGlob() escape support
We currently accept a space-separated list of patterns here so any
backslash, whether it belongs to a space char or not, gets consumed by
poptParseArgvString() before the string is passed to glob(3), requiring
callers to double-escape anything they wish to keep literal.

Fix that by only accepting one pattern.  Adapt the one caller which
relies on this actually being a list, in rpmReadPackageManifest(), and
those callers where we preserve spaces by escaping them which is no
longer needed.

Replace our own heuristic emulating GLOB_NOMAGIC with the actual flag to
glob(3) so that literal (double) backslashes are also handled properly.

Keep the indentation of the original for loop to make the diff easier to
read, next commit will fix that.

No immediate effect within RPM since we currently avoid passing escaped
patterns to rpmGlob(), this is just a prerequisite for the following
commits.  External users of rpmGlob(), as unlikely as they are, might,
in theory, notice this subtle change but we'll be bumping the soname in
4.19 so that's covered.
2022-06-27 08:42:36 +03:00
Michael Schroeder 321933f060 Fix short circuiting of version strings in expressions
We use an empty string when discarding a value due to short circuiting, but
an empty string is not allowed for versions. So use "0" in that case.

Fixes: #1883
2022-06-22 15:54:30 +03:00
Panu Matilainen 3cec59812c Prevent readelf internet access during rpaths checking (RhBug:2079600)
Recent binutils can do debug section lookups over the internet, but this
is something we never want during rpmbuild (everything else aside, we're
just building the thing so there wont be anything on the net anyhow).
Disable the lookups by setting DEBUGINFOD_URLS to empty rather than
using the specific option as this is compatible with any old version of
readelf.
2022-06-22 13:41:53 +03:00
Panu Matilainen 9b64dacd82 Use consistent WITH/ENABLE names between defines and conditionals
If it's enabled with --enable then the define should be ENABLE_FOO
not WITH_FOO, for sanity's sake. No functional changes.
2022-06-17 11:52:47 +03:00
Panu Matilainen 79f7699b31 Fix "make ci" in a VPATH build 2022-06-16 11:15:21 +03:00
Panu Matilainen 4e8ea80d8d Use AC_SEARCH_LIBS instead of manually doing the same 2022-06-16 10:57:24 +03:00
Panu Matilainen c75142b589 Sanitize our pthread library check, don't bother with OSF/1
Last OSF/1 release is older than rpm itself, supporting its pthread
libraries doesn't seem all that relevant now. Instead, use the space to
test whether we need to link to libpthread at all (with glibc we dont),
and test for a function we actually use.

This is equally far from being "correct" as the previous version was,
we should instead be passing -pthread to the compiler and let it worry
about the rest. But doing *that* in autoconf apperars to be a lifetime
study material - there exists a > 500 line long extension which attempts
to do that, but which is reputedly buggy. We'll live with what we got
now, thanks.
2022-06-16 10:56:37 +03:00
Panu Matilainen 9f62aba3bd Drop support for openssl < 1.1
openssl 1.1 was released in 2016, this is old enough plenty. We should
rather be worrying about openssl >= 3.0 at this point.
2022-06-16 10:07:11 +03:00
Panu Matilainen b7e71ffa47 Drop support for ancient libcap
cap_compare() is in libcap since 2008 or so, we really don't need to
bother with versions older than that. Another redundant configure check
and a piece of moldy code bites the dust.
2022-06-16 09:35:40 +03:00
Panu Matilainen b1fed31a99 Drop support for ancient libselinux
setexecfilecon() is in libselinux version 2.3 in 2014, we don't need to
worry about it's availability anymore. Instead, use it to determine
libselinux suitability in the configure check, eliminating another
redundant check and a bunch of unused code.
2022-06-16 09:17:34 +03:00
Panu Matilainen de7e2230be Drop checks for redundant selabel symbols
These have all been there for ages, ensuring that selabel_open is
there is quite adequate.
2022-06-16 09:12:26 +03:00
Panu Matilainen 7894a244f6 Drop checks for unused selinux functions 2022-06-16 09:04:13 +03:00
Panu Matilainen 48d0fa954c Test for preprocessor definition rather than value consistently everywhere
This is not supposed to actually change anything as such but
inconsistency is bad and causes other kinds of headaches.
2022-06-15 16:24:51 +03:00
Panu Matilainen 9ca1077c38 Drop unnecessary public header rpmpol.h
The couple of symbols defined here are only used by one source in
librpmbuild internals so they don't really need to be a in a header,
and in particular they don't need to be in a public header. Bury
the contents to the source that actually uses them.
2022-06-15 10:13:02 +03:00
Panu Matilainen fdcd486b43 Use python path from the build system instead of trying to reproduce it
Fedora >= 36 carries a downstream patch which causes distutils.sysconfig
and sysconfig to disagree on the prefix, and with autoconf up to 2.69
using distutils, 2.70 preferring sysconfig and other tools still using
distutils it gets a bit much to guess. So don't.

It's a much nicer solution to the mess that commit
4a0071c339 tried to address as it takes us
out of the equation entirely.
2022-06-14 12:34:32 +03:00
Panu Matilainen 5bac2b2ce3 Simplify current directory addressing in test-suite
The thing is really just asking for the current absolute directory, no
idea why it was written like that...
2022-06-14 12:34:32 +03:00
김인수 9528ef1a94 Translated using Weblate (Korean)
Currently translated at 100.0% (910 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/ko/
2022-06-13 14:50:47 +02:00
Göran Uddeborg 039c3ea646 Translated using Weblate (Swedish)
Currently translated at 100.0% (910 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/sv/
2022-06-13 14:50:47 +02:00
Jan Kuparinen 775edf2890 Translated using Weblate (Finnish)
Currently translated at 100.0% (910 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/fi/
2022-06-13 14:50:47 +02:00
Luna Jernberg 76328cde47 Translated using Weblate (Swedish)
Currently translated at 99.1% (902 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/sv/
2022-06-13 14:50:47 +02:00
Göran Uddeborg da8f5a96fa Translated using Weblate (Swedish)
Currently translated at 99.1% (902 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/sv/
2022-06-13 14:50:47 +02:00
Jiri Grönroos 1ae45b3779 Translated using Weblate (Finnish)
Currently translated at 98.1% (893 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/fi/
2022-06-13 14:50:47 +02:00
Luna Jernberg 3b1c1ed1c8 Translated using Weblate (Swedish)
Currently translated at 98.7% (899 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/sv/
2022-06-13 14:50:47 +02:00
Jan Kuparinen d015104778 Translated using Weblate (Finnish)
Currently translated at 98.1% (893 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/fi/

Translated using Weblate (Finnish)

Currently translated at 95.2% (867 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/fi/
2022-06-13 14:50:47 +02:00
Ferhat Gecdogan c03e6c9e28 Translated using Weblate (Turkish)
Currently translated at 52.8% (481 of 910 strings)

Translation: rpm/master
Translate-URL: https://translate.fedoraproject.org/projects/rpm/master/tr/
2022-06-13 14:50:47 +02:00
Panu Matilainen ada7e2af94 Differentiate autoconf processed replacements from our own
Some of the replacements in platform.in are expected to be processed
by the build system configuration file, whereas others are replaced
by installplatform at the time of install. Use =VAR= notation instead
of @VAR@ to differentiate the latter from the former.

No functional changes, just makes it easier to understand and handle.
2022-06-13 12:05:14 +03:00
Panu Matilainen f83ff17b62 Axe mkinstalldirs helper script and related fubar
Once upon time where the proprietary unixen roamed there were mkdir
versions which didn't know how to create intermediate directories,
and to provide compatibility automake provided a script to do that
if the host system didn't support it. And as rpm chose to re-export
the MKDIR_P thing as a macro, we were kinda forced to carry this
script to provide that compatibility. Enough is enough, -p has been
even in POSIX for ages.

Should've really gone together with the %__mkdir_p change, but whatever.
Nobody is going to notice.
2022-06-10 14:37:17 +03:00
Panu Matilainen 9c6c34f701 Simply some ancient utility compat cruft
In this day and age, in anything we'll care about, calling 'ln -s' is
going to work for creating symlinks and 'mkdir -p is going to create
missing intermediate directories.

OTOH, in order to use ln -s we need to find ln, so add a new macro
for that. It's useless, but then so is %{__ln_s} these days but still
people appear to be using it a lot. And having %{__ln_s} but no %{__ln}
seems even weirder.

A whole lotta babble for a change that wont affect anybody at all.
2022-06-10 14:19:05 +03:00
Stanislav Brabec c0b417f572 Add UpstreamReleases tag
Create a new optional UpstreamReleases tag that allows to specify an URL
of the location, where the source code could be downloaded. In
contrast to the URL part of the Source tag, this is intended for
the referrer of the sorce code, e. g. download top dir or the
sub-page of the web that contains references to the source files.
Third party tools or the package maintainer can use this tag and
find the latest version of the source code.

Co-authoredby: Florian Festi <ffesti@redhat.com>
2022-06-10 11:32:58 +03:00
Stanislav Brabec c10073d193 Add TranslationURL tag
Create a new optional TranslationURL tag that allows to specify URL
for translators. Third party tools can visualize it and motivate
people to translate.
2022-06-10 11:32:58 +03:00