Commit Graph

55 Commits

Author SHA1 Message Date
Panu Matilainen a8ec768950 Fix comment line handling in sysusers.d(8) files
sysusers.d(8) format permits empty lines and commits, and so must we.
Add some extra fluff to the test-case for this.

This is the second half of
https://bugzilla.redhat.com/show_bug.cgi?id=2246236

Fixes: #2741
2023-11-07 10:09:38 +02:00
Maxwell G 6867ef9f8b Add a Provides generator for rpm lua modules
Some packages in Fedora provide shared RPM lua code that's used by other
packages.
It would be nice to have automatic Provides for this code like we have
for rpm macros themselves.

Usecase:

Recently, forge.lua that's used by go-srpm-macros and fonts-srpm-macros
moved out of redhat-rpm-config.
I would like to be able to add `Requires: rpm_lua(fedora.srpm.forge)`
to those packages instead of having to rely on it being implicitly
pulled in by redhat-rpm-config or adding conditional dependencies on
forge-srpm-macros.
2023-09-15 12:32:52 +03:00
Panu Matilainen 08ae4ee23e Add multifile support to elf dependency generation
Multifile dependency generation is a huge performance boost when there
are multiple files of the same type. The Elf dependency generator is not
a particularly heavy in its startup so benefits less from this than
interpreted languages will. On my laptop coreutils requires generation
goes from circa 0.8s to 0.08s, something like Python/Perl interpreted
generators the difference would be much much bigger.

Of course, no reason not to improve performance when it comes this easy,
and serves as an example for other generators.
2023-09-05 14:31:17 +03:00
Panu Matilainen c7fd9fed99 Generate user() and group() provides from packaged sysusers.d files
Encode the actual sysusers.d line as base64 in the EVR string to be
passed to systemd-sysusers (or a compatibility script) by rpm during
installation. The source string is \0 padded as needed to avoid base64's
'=' padding in the output as this is not a welcome character in EVR
strings.

For example:

    u dnsmasq - "Dnsmasq DHCP and DNS server" /var/lib/dnsmasq

user(dnsmasq) = dSBkbnNtYXNxIC0gIkRuc21hc3EgREhDUCBhbmQgRE5TIHNlcnZlciIgL3Zhci9saWIvZG5zbWFzcQAA
group(dnsmasq)

The EVR string is omitted from the group as that gets created as a
side-effect of the user creation and does not require calling
systemd-sysusers.
2023-03-30 13:59:28 +03:00
Panu Matilainen 15b7025c00 Generate user/group provides from packaged /etc/passwd and /etc/group
These often come from a separate package that is installed early on
and form the basis of system users and groups, augmented by sysusers
from other packages. We don't want to create such users, but we need to
be aware of where they come from for dependency resolution and ordering.
2023-03-30 13:59:28 +03:00
Panu Matilainen 97c9d8903c Call RPM_CONFIGDIR just that consistently
For whatever historical reasons RPMCONFIGDIR was used in automake
whereas the environment variable is RPM_CONFIGDIR. Just call it that
everywhere.
2023-03-30 11:52:59 +03:00
Panu Matilainen 91467e7157 Exclude kernel modules from ELF dependency generation
The kernel modules are technically ELF DSO's but we only care about
library level dependencies which the kernel modules will never have, so
processing them is just waste of time.

This "regressed" when we dropped the "exeonly" flag from ELF in
commit 8901a6be16.
2023-02-16 12:45:33 +02:00
Panu Matilainen 91d8c1fb9f Avoid unnecessary variables for cmake target data, part 3
These don't really add any value over just passing them to install()
2022-11-28 13:55:07 +02:00
Panu Matilainen 6f1c67ffb1 Remove autotools build
There are some missing bits and pieces still to be done for cmake build,
but that is so much easier if you don't have to worry about keeping
compatibility with the system you're about to remove that it doesn't
make sense to drag this on any further. The sooner this is over, the
sooner it is over and we can start making use of cmake's advantages
instead of just trying to bend over backwards to maintain compatibility
with the autotools build.
2022-10-21 09:03:05 +03: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
Dan Čermák 709dab9f78 Add a rpm_macro() provides generator
This commit adds a very simple provides generator for rpm macros as suggested on
the Fedora packaging mailing list:
https://lists.fedoraproject.org/archives/list/packaging@lists.fedoraproject.org/thread/DUFER7QAFYIBYDANJQQ37FBNL5YISZQ2/
2022-01-25 08:07:01 +01:00
Olaf Hering 89d5bf13ce Update OCaml requires/provides to ignore cmxs
OCaml cmxs files are static libraries, which can be loaded at runtime
via the Dynlink module. They apparently do not provide any useful
runtime dependency information to be stored into the packages
Provides/Requires list. Therefore just skip them.

Adjust attr, remove extension and ELF magic
Adjust ocamldeps, do nothing with cmxs files.

Fixes: a6fe37c39b

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2021-11-10 12:26:42 +02:00
Panu Matilainen 992a4f9035 Kick out libtool dependency generator
People mostly only care about removing any .la files present in their
packages, I've yet to see a single use of a desired/used libtool()
dependency during its 14 year existence in rpm. There are enough
provides in the world without creating unused ones just because.
2021-06-10 09:29:07 +03:00
Panu Matilainen bc4829771c Remove remaining Python helpers and scripts from the repo
These are far better maintained by the Python community, in a
repository of their own:

    https://github.com/rpm-software-management/python-rpm-packaging/
2021-05-27 13:03:20 +03:00
Panu Matilainen 8901a6be16 Generate requires for "pure" ELF DSO's regardless of executable bit
ELF ET_DYN files can be shared libraries, executable files or both.
Requiring shared libraries that cannot actually be executed (or segfault
when you do so) is dumb, but rpm has traditionally required executable
bit to be set for requires to be generated.

Refine the definition of "executable" to mean files that actually *can*
be executed, ie those with PT_INTERP and whose actual behavior depends
on whether the executable bit is set or not.

In other words, pure shared libraries will have requires generated
regardless of their permission, but executable files can still disable
that by disabling the on-disk executable bit because unlike shared
libraries, they only require anything when being executed.

Also add rudimentary testcases for the scenarios involving a shared
library, traditional binary and a PIE binary. The test material needs
to be pre-built as we cannot predict what dependencies building on an
arbitrary compiler on arbitrary platform may have, but source is
included for manually regenerating as needed.
2020-11-24 14:47:12 +02:00
Panu Matilainen a527ffdf84 Remove support for redundant %_filter_GLIBC_PRIVATE mechanism
This was kinda ugly-but-necessary when added back in 2003 (commit
752cac72e2) but entirely redundant
since the "new" dependency generator in rpm >= 4.9.x with arbitrary
filtering support. The handful of packages using it can just as well
achieve the same (and more) without special hacks in rpm with:

	%global __requires_exclude GLIBC_PRIVATE
	%global __provides_exclude GLIBC_PRIVATE
2020-08-19 10:34:13 +03:00
Miro Hrončok 8c45b8d80a Fix python(abi) requires generator, it picked files from almost good directories
The %__python_magic filter suddenly got actually working with file 5.39:

Before:

    file.cpython-38.opt-1.pyc: data

After:

    file.cpython-38.opt-1.pyc: python 3.8 byte-compiled

Hence, the filter started to pick all Python files regardless of their location.
Later, in the actual generator, paths like this were considered:

    /opt/usr/lib/python3.X/...

And generated requirements on python(abi).

We don't actually need to filter the files by file magic,
so we drop it to get the previously accidentally working behavior.

We could choose if the path and magic filters are applied as OR or AND.
However, we don't want either.

We actually want to mach any files in Python directories regardless of their magic.
We *could* filter by file type (and executable bit) for provides,
but that would require us to split the attr files into two.
2020-07-10 15:55:24 +02:00
Igor Raits 2ac60753c9 metainfo.attr: Fix execution of the generator
Somehow it wasn't noticed before.

Fixes: 9464926456
Signed-off-by: Igor Raits <i.gnatenko.brain@gmail.com>
2020-06-08 10:47:12 +03:00
Miro Hrončok 022b48d210 Don't define global Lua variables from Python generator 2020-04-28 16:25:10 +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
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
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
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
Olaf Hering a6fe37c39b update OCaml requires/provides to cover also cmx
Dependencies between OCaml files containing native code are also tracked
by hashes, just like their bytecode counter parts.

OCaml native code files end with cmx, the relevent info is in cmx, cmxa
and cmxs files. Unlike all other OCaml files, cmxs files have ELF format.

OCaml has two variants of dependency tracking:
  Interfaces, which are already tracked via "ocaml(MODULE) = HASH"
  They are included in cmi, cma, cmo, cmx, cmxa and cmxs files.

  Implementations, which are now tracked via "ocamlx(MODULE) = HASH"
  They are included in cmx, cmxa and cmxs files.

Just like Interfaces can be excluded from the dependency list with the
option -i MODULE, Implementations are excluded with the option -x MODULE.

Previously the final rpm package also got an extra dependency to the
used ocaml runtime version. This is not strictly required because the
hashes are unique. Therefore this dependency is no longer created. The
option -c, which excluded this dependency, is still recognized.

Fixes #913

Signed-off-by: Olaf Hering <olaf@aepfle.de>
2020-03-10 12:03:42 +02:00
Panu Matilainen 32055d7946 Drop outdated and unmaintained Mono dependency generators
Upstream Mono is being a good citizen and maintains their own
dependency generators nowadays, so let them.

Closes: #673
2019-04-24 13:43:01 +03:00
Neal Gompa 5ddda1a7d6 fileattrs: Prepare python attr path for Python versions greater than 3.9 2018-10-03 14:19:01 +03:00
Neal Gompa 83bf933b7e fileattrs: Tighten pythondist path regex for metadata (RhBug:1618949)
The current regular expression for matching on Python metadata files was
too greedy, leading to generating dependency information for Python modules
that were actually bundled in another module rather than actually being
installed in a way that is usable and accessible from any Python code
using the system interpreter.

This change tightens the regular expression so that we only match on
modules that are installed in a way that they'll register with
distutils/setuptools based tools (such as pip) and usable as
dependencies for other Python module packages.
2018-10-03 14:19:01 +03:00
Neal Gompa 7bc95b616b fileattrs: Add attr for pythondistdeps
Rather than having the pythondistdeps dependency generator run on
all Python code, this separate attr will activate it only if the
package includes Python dist metadata (such as egg-info or dist-info
for Python Eggs and Python Wheels, respectively).

This is much more efficient, too, since the generator is only run
in circumstances where it will provide useful information.

This is based on the dependency generator attr used in Mageia,
OpenMandriva, and other systems that use the generator.
2018-08-02 12:10:38 +02:00
Florian Festi 5ac4305bdd Do not require the Python library dir to be at a particular place
RPM should not make any assumption about where Python libs are installed.
Resolves #346
2018-02-19 14:50:49 +01:00
Michael Schroeder c69cfdf901 Fix classification of ELF binaries with both setuid/setgid set
There is a ',' between multiple entries.
2017-08-31 12:01:24 +02:00
Mark Wielaard 3d4db6f99f Define AM_CFLAGS inside the Makefile.am files themselves.
Trying to include AM_CFLAGS through a configure generated rpm.am file
doesn't really work because at the time automake runs configure doesn't
exist yet to process rpm.am.in. Just define the AM_CFLAGS substitution
inside the Makefile.am files themselves.

Rename rpm.am.in back to rpm.am.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-12-09 11:35:38 +02:00
Neal Gompa 036829b859 appdata -> metainfo, add support for metainfo files
These provides are specifically for packages providing
AppStream files, which are either going to be *.appdata.xml
or *.metainfo.xml files in /usr/share/appdata or /usr/share/metainfo.

The upstream AppStream specification mandates *.metainfo.xml files
installed into /usr/share/metainfo, but there's still a large body
of legacy AppStream files installed in the legacy location.

For now, let's support both under the new metainfo() Provides.
2016-11-18 14:38:39 +01:00
Igor Gnatenko 9571218345 let debuginfo packages provide the build-id
This patch lets debuginfo packages provide build-id like follows:

 debuginfo(build-id) = c63cb23876c5fa85f36beaff58f8557e1bf22517

Originally this patch was written by Jan Blunck <jblunck@suse.de>.

Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-08-03 12:10:40 +02:00
Michael Schroeder e6cadc6d5a Add support for automatic appdata() provides
Appdata files contain application information used by the AppStream
project. We generate two provides: appdata() to support enumeration
of all application packages and appdata(filenname) to make it easy
to link installed packages with appdata files.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-10-14 09:56:48 +03:00
Panu Matilainen 9b734cee5d Only consider files with .pm suffix as perl modules (RhBug:927211)
- Newer file is more eager to flag files as Perl module source,
  causing false provides to be generated. Require both magic
  and path to match for perllib classification to reduce the pain.
2013-05-22 08:38:53 +03:00
Panu Matilainen 416fc709ab Simplify mono file magic regex
- Begin/end restrictions with wildcards on both ends dont make much
  sense, just match on the plain (sub)string
2012-05-07 15:29:14 +03:00
Panu Matilainen f2f4bfe9a5 Relax python file magic regex somewhat
- libmagic sometimes adds trailing descriptions about encodings, line
  terminators and whatnot, we dont want to care about those (RhBug:796218)
- not all python-related strings start with [pP]ython either, sometimes
  libmagic says "a python script" or "a /usr/bin/python script" and
  whatnot, so loose the start-of-line restriction as well
2012-05-07 15:21:47 +03:00
Panu Matilainen 49e398278f Tweak font magic regex a bit (yet again)
- Lose the pointless begin/end restrictions, take the optional
  space into account for both optional parts (one of the later issues
  in RhBug:757105)
2012-05-07 14:54:13 +03:00
Ville Skyttä 9ddcc23d2b Adapt perl and python fileattrs to file 5.10 magics
- file 5.10 has changed magics at least for perl and python scripts, samples:

  5.09: a /usr/bin/perl -w script, ASCII text executable, with very long lines
  5.10: Perl script, ASCII text executable, with very long lines

  5.09: a /usr/bin/python script, ASCII text executable
  5.10: Python script, ASCII text executable

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2012-01-10 10:48:13 +02:00
Panu Matilainen 87d9e3c4ad Fix classification of ELF binaries with setuid/setgid bit, oops... 2011-11-28 14:00:45 +02:00
Panu Matilainen fb30c0aac8 Identify "font collection" (data etc) as fonts also (RhBug:757105) 2011-11-25 16:07:38 +02:00
Panu Matilainen db4905f51e Adjust script detection rules to work with file >= 5.07 too (RhBug:712251)
- Somewhere between file 5.05 and 5.07 it started adding encoding
  to script descriptions, eg "<mumble> script text executable" became
  "<mumble> script, <encoding> text executable" breaking what had
  been working for 10+ years in the case of old find-requires.
- Permit either comma or space after "script", this works for both
  old and new file.
2011-06-10 12:11:55 +03:00
Panu Matilainen 6eba5dc468 Fix classification of ELF binaries with sticky bit (RhBug:689182) 2011-03-22 08:36:35 +02:00
Panu Matilainen 9fa3a6c99d Adjust OCaml detection rule for libmagic 5.04 -> 5.05 string change 2011-02-06 09:57:57 +02:00
Panu Matilainen e9cc4c0ba7 Argh, yet more mono dependency generation braindamage
- Unlike some other scripts, mono-find-foo do not have .sh suffix, meh
2011-01-31 10:14:57 +02:00
Panu Matilainen f0f5cb7127 Eww, mono rules both buggy AND missing from tarballs, doh. 2011-01-31 09:21:32 +02:00
Panu Matilainen a9bc1f51ae Rename pattern -> path for, duh, path patterns
- 4.9 alpha used "pattern" but better fix the stupid name now than
  have to live with the non-obvious name forever
2010-12-10 12:33:46 +02:00