Commit Graph

15032 Commits

Author SHA1 Message Date
Tomas Orsava 28c292ae29 scripts/pythondistdeps: "Fix" support of environment markers
Upstreaming from Fedora
2020-05-27 08:55:07 +03:00
Tomas Orsava 4c0ed11a30 scripts/pythondistdeps: Also provide pythonXdist() with PEP 503 normalized names
Upstreaming from Fedora (BZ#1791530)

That is, we add new provides that replace dots with a dash.

Package that used to provide python3dist(zope.component) and python3.8dist(zope.component)
now also provides python3dist(zope-component) and python3.8dist(zope-component).

Package that used to provide python3dist(a.-.-.-.a) now provides python3dist(a-a) as well.

This is consistent with pip behavior, `pip install zope-component` installs zope.component.

Historically, we have always used dist.key (safe_name) from setuptools,
but that is a non-standardized convention -- whether or not it replaces dots
with dashes is not even documented.
We say we use "canonical name" or "normalized name" everywhere, yet we didn't.

We really need to follow the standard (PEP 503):

https://www.python.org/dev/peps/pep-0503/#normalized-names

The proper function here would be packaging.utils.canonicalize_name
https://packaging.pypa.io/en/latest/utils/#packaging.utils.canonicalize_name
-- we reimplement it here to avoid an external dependency.

This is the first required step needed if we want to change our requirements later.
If we decide we don't, for whatever reason, this doesn't break anything.
2020-05-27 08:55:07 +03:00
Michael Schroeder 8734c1b97e Support ed25519 signatures in digest_libgcrypt.c 2020-05-26 17:03:11 +03:00
Michael Schroeder e3a78f6077 Support ed25519 signatures in digest_openssl.c 2020-05-26 17:03:11 +03:00
Michael Schroeder 92c87b9713 Support the EdDSA public key algorithm
The algorithm identifier and encoding format are taken from the
not yet accepted update to rfc4480:

https://datatracker.ietf.org/doc/draft-ietf-openpgp-rfc4880bis/

Gnupg supports EdDSA since version 2.1.0 (released in 2014).
2020-05-26 17:03:11 +03:00
Panu Matilainen 95df3dcb9d Add license to Python distutils module description
Fixes: #1236
2020-05-26 12:08:43 +03:00
Jes Sorensen f34030816d rpmfiArchiveRead() use signed return value to handle -1 on error
size_t is unsigned, so returning -1 is not going to have the expected
behavior. Fix it to return ssize_t.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2020-05-13 11:07:49 +03:00
Miro Hrončok 022b48d210 Don't define global Lua variables from Python generator 2020-04-28 16:25:10 +03:00
Thierry Vignaud 9a30bcdacc describe all rpmdeps options 2020-04-27 12:45:58 +03:00
Panu Matilainen ead227f2da Kick out leftover development-time assert checks from rpmal 2020-04-22 15:38:35 +03:00
Panu Matilainen a4afbb62c9 Don't look into source package provides in depsolving
Fixes regressions from commit 75ec16e660e784d7897b37cac1a2b9b135825f25:
the newly added provides of to-be-built packages were being used for
dependency resolution, such as spec satifying its own buildrequires,
and matched against conflicts in installed packages.

Source packages cannot obsolete anything or provide capabilities or files
to transactions, don't add them to rpmal at all. Explicitly skip checks
against source provides, similarly to what we already did with obsoletes.

Fixes: #1189
2020-04-22 15:36:29 +03:00
Igor Raits 5d8c6e537f Convert debuginfo generator to a parametric generator
Signed-off-by: Igor Raits <i.gnatenko.brain@gmail.com>
2020-04-21 14:49:19 +03:00
Igor Raits 232cb6fee6 Convert desktop generator to a parametric generator
Signed-off-by: Igor Raits <i.gnatenko.brain@gmail.com>
2020-04-21 14:49:19 +03:00
Igor Raits 9464926456 Convert metainfo generator to a parametric generator
Signed-off-by: Igor Raits <i.gnatenko.brain@gmail.com>
2020-04-21 14:49:19 +03:00
Michal Domonkos 6f6f5e70f1
build: prioritize large packages
Binary packages come in different sizes and so their build time can vary
greatly.  Dynamic scheduling, which we currently use for parallel
building, is a good strategy to combat such differences and load-balance
the available CPU cores.

That said, knowing that the build time of a package is proportional to
its size, we can reduce the overall time even further by cleverly
ordering the task queue.

As an example, consider a set of 5 packages, 4 of which take 1 unit of
time to build and one takes 4 units.  If we were to build these on a
dual-core system, one possible unit distribution would look like this:

            TIME --->
CPU 1       * * * * * *         # package 1, 3 and 5
CPU 2       * *                 # package 2 and 4

Now, compare that to a different distribution where the largest package
5 gets built early on:

            TIME --->
CPU 1       * * * *             # package 5
CPU 2       * * * *             # package 1, 2, 3 and 4

It's obvious that processing the largest packages first gives better
results when dealing with such a mix of small and large packages
(typically a regular package and its debuginfo counterpart,
respectively).

Now, with dynamic scheduling in OpenMP, we cannot directly control the
task queue; we can only generate the tasks and let the runtime system do
its work.  What we can do, however, is to provide a hint to the runtime
system for the desired ordering, using the "priority" clause.

So, in this commit, we use the clause to assign a priority value to each
build task based on the respective package size (the bigger the size,
the higher the priority), to help achieve an optimal execution order.

Indeed, in my testing, the priorities were followed to the letter (but
remember, that's not guaranteed by the specification).  Interestingly,
even without the use of priorities, simply generating the tasks in the
desired order resulted in the same execution order for me, but that's,
again, just an implementation detail.

Also note that OpenMP is allowed to stop the thread generating the tasks
at any time, and make it execute some of the tasks instead.  If the
chosen task happens to be a long-duration one, we might hit a starvation
scenario where the other threads have exhausted the task queue and
there's nobody to generate new tasks.  To counter that, this commit also
adds the "untied" clause which allows other threads to pick up where the
generating thread left off, and continue generating new tasks.

Resolves #1045.
2020-04-21 12:38:25 +03:00
Panu Matilainen 701736a18a Warn on undefined components in buildtree macros
Issue a warning if buildtree macros (%_sourcedir etc) contain undefined
macro(s) after expansion, such as things only defined during spec parse.
This always was a murky case that doesn't work in all scenarios, so
a warning seems appropriate. Actual behavior doesn't change here though.
2020-04-20 13:25:56 +03:00
Gordon Messmer d3470947a5 Handle all-zero versions without crashing. 2020-04-20 11:12:59 +02:00
Steve Kowalik 25a8dfae1a scripts/pythondistdeps: Deal with some flake8 warnings
flake8 is mostly unhappy with pythondistdeps.py, so clean up most of
them, which is whitespace changes.
2020-04-17 11:31:10 +03:00
Steve Kowalik 3f7b03af43 scripts/pythondistdeps: Switch to argparse
Stop using getopt, and switch to a modern solution for parsing
arguments.
2020-04-17 11:31:10 +03:00
Miro Hrončok 224c08a5e8 Adjust %__python_path
- sync with Fedora
 - only match direct Python sitedir, no /opt/.../lib/python3.7 stuff
 - prep for multiple digits Python major releases (e.g. 12.1)
 - use the value of %_prefix

See also:

8eef42cbaa
https://lists.fedoraproject.org/archives/list/packaging@lists.fedoraproject.org/thread/UFKUM5UKCTNGIT3KJVYEI5VXPI23QMBN/
https://github.com/rpm-software-management/rpm/pull/1153#discussion_r407997958
2020-04-17 11:26:08 +03:00
Neal Gompa 0b9efb93fb Deprecate NSS support
The NSS library often changes in ways that somehow breaks rpm,
and these days upstream does not care about consumers of NSS other
than itself. This inflicts untold amounts of suffering on users
of rpm in distributions where rpm is linked to NSS.

Now that we have a couple of good, well-supported options, there is
no reason to keep supporting NSS as an option.

So now, we are deprecating it for later removal.
2020-04-16 15:53:18 +03:00
Neal Gompa 0910e6aa9e Add a warning when beecrypt is selected for the crypto library
Let's make it absolutely clear that selecting beecrypt is deprecated
and those continuing to use it should be aware that the option will
go away soon.
2020-04-16 15:53:18 +03:00
Panu Matilainen c77df4cd1d Handle manually specified debuginfo package more gracefully
In todays' "look ma what crawled from under the bed" episode, we have
encounter a subpackage whose name is not derived from the main package
name, and a manually specified debuginfo package on that. This particular
combo manages to evade all our checks for duplicate package names, and
in the right phase of the moon actually creates corrupt packages due to
two threads end up writing to the same output file simultaneously. Which
is what happened in https://pagure.io/fedora-infrastructure/issue/8816

Catch the case and use the spec-defined variant (because getting rid
of it would be harder) but issue a warning because most likely this
is not what they really wanted.
2020-04-14 13:25:09 +03:00
Michael Schroeder de3f36acc9 Add an index sync call at the end of a database rebuild
This is normally unneeded because an index sync is already done
after each package is added to the database. But rebuilding an
empty database lead to no index sync being done and a mismatch
between the generation count. This in turn will trigger a
index regeneration.

Found by using ndb when running the test suite.
2020-04-14 13:22:12 +03:00
Michael Schroeder 6511823c97 ndb: make rpmxdbWriteHeader a void function
It's a static function and nobody tests the return code. It just
writes into mapped memory like rpmxdbUpdateSlot, which is also void.
2020-04-14 13:22:12 +03:00
Michael Schroeder 1187cf005a ndb: unmap xdb's header when closing the xdb database
Somehow I was under the impression that mapped regions are unmapped when
the corresponding file descriptor is closed, but that's not the case
for POSIX systems.
2020-04-14 13:22:12 +03:00
Michael Schroeder aea8c86ec8 ndb: do not map xdb's header read-write all the time
Instead just map it read-write if one of the functions request
exclusive access. We keep track of the number of exclusive
locks and fall back to read-only mapping if the count reaches
zero again.
2020-04-14 13:22:12 +03:00
Michael Schroeder 3cfd298e9d ndb: do not map the index databases read-write all the time
Pass the flags to rpmidxOpenXdb and use read only mode if the
user specified O_RDONLY. We already did that for rpmidxOpen in
the past but we always used read-write mode when using the Xdb.

We still open the Xdb itself in read-write mode so that we can
regenerate missing index databases.
2020-04-14 13:22:12 +03:00
Michael Schroeder 85b51e2dcf ndb: also copy the mapped pointer when keeping a slot
We forgot to copy the mapped pointer if a slot was kept when
re-syncing after a generation mismatch. This led to the mapped
pointer being zero even if the map callback was set.
Also add an extra test for the map callback before setting the
protection flag to PROT_READ.

Found by testing the code with different mapping protection flags.
See the next commits.
2020-04-14 13:22:12 +03:00
Miro Hrončok 813858cc89 Drop tabs from python.attr 2020-04-14 12:07:13 +03:00
Miro Hrončok 707c372f27 Reimplement pythondeps.sh as parametric macro generators
pythondeps.sh was written in shell and unlike the Python dist generators,
it uses no Python, it plainly determines the provide / requires from the path.
As the script was run for every Python file, we were potentially doing hundreds
of shelling outs to execute a script that calls grep and sed.

In Lua, this should be more efficient.

Fixes https://github.com/rpm-software-management/rpm/issues/1152
2020-04-14 12:07:13 +03:00
Gordon Messmer 87c64d65cf scripts/pythondistdeps: Improved python version and operator handling. 2020-04-10 07:34:16 +02:00
Michael Schroeder f1c06f5a99 Support DSA2 in digest_libgcrypt.c
For DSA2 we need to truncate the hash to the size of the pubkey's Q value.
2020-04-09 15:00:08 +03:00
Panu Matilainen aca34c7e91 Fix regression causing all ELF files classified as OCaml
Commit a6fe37c39b causes OCaml generators
to execute on all ELF files due to missing "magic_and_path" flag.

Fixes: #1173
2020-04-09 14:59:12 +03:00
Panu Matilainen 233ee5516f .gitignore cleanup
Lots of cruft here - the build-aux move related changes from commit
cd6e4eb9e0, and all manner of historical
cruft that hasn't existed in over a decade. While at it, consolidate
it all to the toplevel .gitignore.
2020-04-09 14:27:09 +03:00
Igor Raits 10127cdb23 rpmfc: Do not prepend buildroot to a path for parametric generator
'fn' already contains full path to a file, so no need to prepend it once
more. This is actually breaking things.

Before:
D: Calling %{__pythonname_provides %{?__pythonname_provides_opts}}() on /home/brain/rpmbuild/BUILDROOT/hello-1-1.fc33.x86_64//home/brain/rpmbuild/BUILDROOT/hello-1-1.fc33.x86_64/usr/share/applications/org.gnome.Terminal.desktop

After:
D: Calling %{__pythonname_provides %{?__pythonname_provides_opts}}() on /home/brain/rpmbuild/BUILDROOT/hello-1-1.fc33.x86_64/usr/share/applications/org.gnome.Terminal.desktop

Fixes: https://github.com/rpm-software-management/rpm/issues/1162
Signed-off-by: Igor Raits <i.gnatenko.brain@gmail.com>
2020-04-06 13:00:44 +03:00
Panu Matilainen 853c48ba64 Fix regression causing segfault on database autodetection
If configuration points to non-existent backend, tryBackend() will
segfault on the first call. Duh. Regression introduced in commit
3eb0eed380.
2020-04-02 13:53:49 +03:00
Panu Matilainen 8ed452dd86 Flush 1998 vintage fcntl-compatibility mess from system.h
fcntl.h is standard, include it from places that need it and drop
from system.h.
2020-04-02 13:53:38 +03:00
Panu Matilainen 7630389dcd Flush 1998 vintage dirent.h compatibility mess from system.h
dirent.h and struct dirent are actually standard on this millenium, the
only thing that isn't is d_type member for which we have and retain
a specific test in configure.ac. Include <dirent.h> where needed,
relatively few places do which makes it even a bigger insult to have
this included from system.h.
2020-04-02 13:53:38 +03:00
Panu Matilainen c24ff31461 Unset SOURCE_DATE_EPOCH for the test-suite
Fixes the reproducable build test failing in Fedora rpm builds due to
%source_date_epoch_from_changelog being set on the outside, which
leaks the SOURCE_DATE_EPOCH environment into the test-suite and
changes the expectation.
2020-04-01 15:32:48 +02:00
Panu Matilainen f8b8e86ae3 Flush 20+ year old statfs() jungle, always use standard statvfs()
Unlike that multiple statfs() variants, statvfs() is actually in
POSIX 1-2001 already and covers everything we need so there's little
point mucking with anything else. statvfs() is what Linux has been
using all along anyway this means no change on the primary platform.

If this actually regresses something, adding back OS-specific bits
is not a problem, but at least we'll get a clean start with that.
2020-03-30 10:28:41 +02:00
Thierry Vignaud 08750a929c also package rpm-plugins.8 2020-03-30 10:09:48 +02:00
Thierry Vignaud 0801c82454 fix phrasing 2020-03-30 10:09:48 +02:00
Thierry Vignaud 19f172a729 actually include the new man pages 2020-03-30 10:51:21 +03:00
Panu Matilainen dd08abdd12 Drop support for dmalloc
Last dmalloc release is from 2007, and these days there are plenty of
other, maintained tools for debugging memory issues.
2020-03-27 15:49:18 +02:00
Panu Matilainen 3017eae9a3 Drop unmaintained "hacking docs" doxygen docs
We only maintain API docs for public interfaces, this is just
unnecessary clutter that nobody builds anyway.
2020-03-27 15:49:18 +02:00
Panu Matilainen 8d628a138e Assume/require POSIX-compliant chmod(1)
The message about telling your OS vendor about GNU utilities that
gets removed here dates back to 1997. The X syntax to chmod goes back
to at least 2004 specification of POSIX 1003.1, I think we can safely
assume that capability in 2020. And that OS vendors know about GNU :)
2020-03-27 15:49:18 +02:00
Panu Matilainen 9318433c7f We don't use yacc for anything, don't bother testing for it 2020-03-27 15:49:18 +02:00
Panu Matilainen cd6e4eb9e0 Move the auxiliary build tool clutter to a subdirectory 2020-03-27 15:48:46 +02:00
Panu Matilainen 8a5078416d Drop config.sub and config.guess from dist-tarballs
These are not our file, so why should we distribute them?
2020-03-27 15:48:46 +02:00