Commit Graph

399 Commits

Author SHA1 Message Date
Panu Matilainen eaf359f35c Merge Lua posix extension into librpmio
Once upon a time there may have been a point to having the extension in a
separate convenience library, but nowdays with Lua being mandatory there's
not a whole lot of point in complicating the build with all this fubar.
As a nice little bonus, we can now hide luaopen_posix() symbol.
2022-04-08 14:11:44 +03:00
Panu Matilainen cd5d667e99 Move source uncompress logic from spec parse to build time
Traditionally, %setup processing has figured out the commands needed
to extract the source in question. The problem with this is that it
happens at spec parse time, requiring access to sources that may not
even be there in plain spec queries.

Move the unpack logic from %setup internals to an `rpmuncompress` helper
executable which is now the only command %setup needs to know. This way,
spec parsing never needs to look at the actual source files, their
presence is only required for an actual build. Another advantage is
that the extraction machinery is now available to packagers without having
to call %setup with its side-effects on %buildsubdir and such.

Split the rpmbuild -ba test on missing sources into separate -bb and -bs
tests as these are now rather different: binary build only tests for
source presence if %prep is actually executed, and missing files
at source build stage are discovered at a later stage as well.
2022-04-04 10:04:25 +03:00
Panu Matilainen fda4aacd88 Fix includes not getting pulled into dist tarballs regression
Remove include preinstall machinery leftovers preventing them from
getting pulled to dist tarballs. Regression introduced in commit
650ba79f22.

Strange that this wasn't caught by distcheck.
2022-03-14 11:07:45 +02:00
Panu Matilainen 650ba79f22 Eliminate the strange include pre-build install machinery
Introduced back in 2007 in 5831404601 the
point was to fake up a sane public header structure with minimal
internal disruption, TEMPORARILY. I think 15 years is temporary enough.

The machinery has worked rather well for what it is, but having the
headers appear in multiple locations is weird and confusing to people,
plus this "physical" separation makes it far more clearer what is
a public header and what isn't.
2022-03-10 08:40:07 +02:00
Panu Matilainen ca822ed6d2 Split off rpmDigest*() APIs from rpmpgp.h to a new rpmcrypto.h header
These APIs never belonged to rpmpgp.h anyway, it was only used for
being the least-worst fit within rpm. As if it was so hard to just
add a new header...
2022-02-25 11:08:25 +01:00
Panu Matilainen da3f141656 Fix rpmspec build issue introduced in 03b3df0ce0 2021-12-20 15:52:01 +02:00
Panu Matilainen 03b3df0ce0 Add an interactive macro shell mode to rpmspec
Handy for debugging and experimenting with macros, in and out of
spec context.

Placed in rpmspec because we don't want readline dependency on main rpm
executable, this is more of a packager tool anyway.
2021-12-20 13:26:23 +02:00
Panu Matilainen 298bb60a9f Add optional readline history support in rpmlua interactive mode
We don't want readline dependency in librpmio so need to do this the
hard way: add an optional callback through which rpmlua can supply
it's own readline-aware callback function.
2021-12-20 12:19:07 +02:00
Panu Matilainen bf58cfd08f Add rpmlua wrapper command for running our Lua interpreter standalone
Being able to run stuff easily in rpm context helps developing and debugging
scriptlets and macros too. Supports running one-liner statements from
the cli, regular scripts and an interactive session.

This is placed into a separate executable for, well, separation and
simplicity, but it'll also give us means to link to readline without
dragging that to main rpm dependencies (but that's left for later).
2021-12-17 14:57:14 +02:00
Panu Matilainen 04b0805a75 Use external debuginfo tooling
There's been an increasing interest in the wider community to use
the debuginfo tooling outside rpm context, and deep ELF format
internals are not rpm's core business anyhow, the reasons for it
being here are entirely historical. So without further ado, remove
the debuginfo tooling from rpm and rely on the external debugedit
project from now on.

Update INSTALL to document the new dependency, and add conditionals
to relevant debuginfo build tests. The lower-level debugedit and
sepdebugcrcfix tools are tested in the external project, no need
to duplicate that here.
2021-06-21 12:52:39 +03:00
Florian Festi 3417219932 Rename doc/ to docs/ to work with GitHub Pages 2021-05-18 15:02:54 +02:00
Panu Matilainen 7f3fdf6868 Make Lua a hard requirement for rpm
More and more macros, scriptlets and other functionality has been getting
built around Lua, to the point that it has in practice been required for
several years now.

Maintaining the pretense of being optional comes at a cost in holding
back developments and having to check for that theoretical special
case. Lets make it a hard requirement and embrace it some more!
2021-02-09 13:57:27 +02:00
Panu Matilainen 4290300e24 Remove support for Berkeley Database backend
Back in 2013, the Berkeley DB license was changed in a way that prevented
most of open-source world to go along, rpm was no different. We now have
other options and a standalone migration path from BDB for those that
haven't yet done so.

Whatever else might be said about this partnership, it has been a long one.
Now's the time to part ways.
2021-02-03 14:41:48 +01:00
Radovan Sroka 39595ccee3 Added fapolicyd rpm plugin
Fapolicyd (File Access Policy Daemon) implements application whitelisting
to decide file access rights. Applications that are known via a reputation
source are allowed access while unknown applications are not.

The rpm plugin allows us to use rpm database as a source of trust.
We used dnf plugin since the beggining but it only provides notification
when transaction ends. With "integrity checking" requirement we need
a continual addition of files which are installed during the system
update. With fapolicyd rpm plugin we can allow using of recently
added/updated files in scriptlets during rpm transaction.

The fapolicyd plugin gathers metadata of currently installed files.
It sends the information about files and about ongoing rpm transaction
to the fapolicyd daemon. The information is written to Linux pipe which
is placed in /var/run/fapolicyd/fapolicyd.fifo.

The data format is "%s %lu %64s\n". [path, size, sha256]

The fapolicyd rpm plugin can be enabled with "--with-fapolicyd"
configure option.

Related PRs:
https://github.com/linux-application-whitelisting/fapolicyd/pull/105
https://github.com/linux-application-whitelisting/fapolicyd/pull/106

Signed-off-by: Radovan Sroka <rsroka@redhat.com>
2021-01-28 16:35:35 +02:00
Jes Sorensen c77b0d2f37 Enable fsverity in CI
Add fsverity-utils and fsverity-utils-devel as dependencies.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2020-09-04 13:22:38 +03:00
Panu Matilainen d009ac4828 Remove support for NSS
NSS is a behemoth of a library which drags in a whole runtime subsystem
of its own which is often at odds with normal Unix system behavior
(hello SIGPIPE). Now that we have nicer alternatives available there's
little reason to lug this baggage along. NSS was deprecated in rpm 4.16
(commit 0b9efb93fb).
2020-05-29 08:54:56 +03:00
Panu Matilainen cf967331d3 Remove support for beecrypt
Beecrypt whose upstream is dead for more than ten years now, was deprecated
in rpm 4.16 (in commit 0910e6aa9e).
2020-05-29 08:54:56 +03:00
Panu Matilainen 501fb4ef62 Move rpmvercmp() to librpmio
Adding a new header just for this seems a bit much but we'll be adding
stuff there shortly.

No functional changes as such, this is prerequisite for supporting
version comparison in expressions.
2020-05-27 14:14:00 +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 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
Panu Matilainen 78bced4bcd Fix "make distcheck" failing right after ./configure
distcheck target depends on having the html docs present, but the paths
in make targets disagree. Hook it on the directory instead to allow
distcheck to work without requiring an extra compilation step before it.
2020-03-25 15:39:54 +02:00
Panu Matilainen b50ed03bf0 Add a "ci" make target for easy local running 2020-03-24 13:48:15 +01:00
Daniel Mach cf846fd33d Nuke leftover LMDB references in Makefile.am and Dockerfile
Should've been in commit 7de982ac09
2020-03-24 09:40:22 +02:00
Panu Matilainen 5c0801a1a3 Change the default crypto implementation to libgcrypt (from NSS)
libgcrypt is a much more straightforward and lightweight as a library,
doesn't come with a massive runtime library of its own, runtime which
messes with SIGPIPE and all, has a nice clearly compatible license (LGPL)
and is somewhat faster than NSS. What's not to like?

Change the default and add relevant documentation to INSTALL. Drop
the hopefully now unnecessary override from distcheck flags, and
switch CI over too. Note that in CI, openssl-devel is still needed
for ima-evm (missing dep in ima-evm-utils-devel?)
2019-09-11 09:58:00 +03:00
Howard Johnson 4c2b3f25f6 Rename rpmqv.c to rpm.c, as it's the main source for the rpm command 2019-06-03 15:10:46 +03:00
Howard Johnson ddb8d7b3cf Remove IAM_ macros left over from the "helper" rpm binaries 2019-06-03 15:10:46 +03:00
Panu Matilainen a03350c8f7 Enable all our configure options during distcheck for maximum coverage
Additionally run distcheck with --disable-dependency-tracking to speed
it up a little.
2019-06-03 13:47:40 +03:00
Panu Matilainen e1d3811883 Support building rpm without Berkeley DB, simplify the configuration
Replace the --with-external-db switch with the following simple logic:
if internal copy of BDB is detected, use it, otherwise look for an
external one. By default BDB is still required, but it's now possible
to build without it by using --disable-bdb argument to configure.
If no database is built in, we'll segfault for now, to be dealt with
in coming commits.

This is a rather historical moment, BTW.
2019-02-01 15:21:08 +02:00
Panu Matilainen dd6c65044c Resurrect long since broken Lua library path
LUA_PATH global variable is not consulted when loading libraries in
Lua >= 5.1, package.path has replaced it. Rpm's Lua library path
was always supposed to be /usr/lib/rpm/lua/ but this has been broken
for the last ten years or so, oops. Make the directory a first-class
citizen: create it on install, add a macro for it, make it actually
work and ensure it stays that way by adding a test for it.
2018-10-16 11:34:07 +03:00
Panu Matilainen 10a6fbd2c0 Move macros.debug to test-suite data directory
macros.debug is only used by the test-suite so the test-suite data
section is the more appropriate place for it.
2018-04-13 12:18:45 +03:00
Panu Matilainen 3fe0beeb07 Move cli verify flags to rpmcli.h where they belong, lose rpmvf.h
rpmVerifyFlags are only relevant for the cli-oriented API's,
it makes no sense to have a separate header file just for these.
Back then the idea was to create additional APIs around verify
which would've kinda warranted a header of its own but that never
happened (for our purposes circa 10 years is close enough to forever)
2017-11-13 16:39:28 +02:00
Panu Matilainen 7a263645f8 Remove excessive linking from our cli tools
The cli tools certainly are not directly invoking any crypto or
zlib operations, thus they shouldn't be linking to them either.
2017-10-09 10:01:05 +03:00
Panu Matilainen 7cf3c78678 Create $(prefix)/rpm/macros.d directory on make install
We read it so might as well create it too...
2017-09-22 13:09:30 +03:00
Panu Matilainen 5b3781c686 Fix excessive dependencies for elfdeps and sepdebugcrcfix
These only need libelf, debugedit needs libdw and libdwarf too.
Add comments to the endif's to make it easier to parse for us mortals.
2017-09-20 11:24:28 +03:00
Panu Matilainen 5763f40c21 Enable python build during dist-check
The test-suite fails if python is not enabled. An alternative solution
could be disabling python tests when not enabled, but the python
tests cover things that are not covered elsewhere so especially
for dist cutting the tests are quite important.
2017-09-06 17:33:30 +03:00
Mark Wielaard 88989572ff debugedit: Support String/Line table rewriting for larger/smaller paths.
debugedit --base to --dest rewriting of debug source file paths only
supported dest paths that were smaller or equal than the base path
(and the size should differ more than 1 character for correct debug lines).
All paths were changed "in place". Which could in theory mess up debug str
sharing.

This rewrite supports base and dest strings of any size (some limitations,
see below). This is done by reconstructing the debug_str and debug_line
tables and updating the references in the debug_info attributes pointing
to these tables. Plus, if necessary (only for ET_REL kernel modules),
updating any relocations for the debug_info and debug_line sections.

This has the nice benefit of merging any duplicate strings in the
debug_str table which might resulting on slightly smaller files.
kernel modules are ET_REL files that often contain a lot of duplicate
strings.

The rewrite uses elfutils (either libebl or libdw) to reconstruct the
debug_str table. Since we are changing some section sizes now we cannot
just use mmap and rawdata to poke the values, but need to read in and
write out the changed sections. This does take a bit more memory because
we now also need to keep track of all string/line references.

There are still some limitations (already in the original debugedit)
not fixed by this rewrite:
- DW_AT_comp_dir in .debug_info using DW_FORM_string can not be made
  larger. We only warn about that now instead of failing. The only
  producer of DW_FORM_string comp_dirs is binutils gas. It seems simpler
  to fix gas than to try to support resizing the debug_info section.
- A DW_AT_name on a DW_TAG_compile_unit is only rewritten for DW_FORM_strp
  not for DW_FORM_string. Probably no problem in practice since this
  wasn't supported originally either.
- The debug_line program isn't scanned for DW_LNE_define_file which
  could in theory define an absolute path that might need rewriting.
  Again probably not a problem because this wasn't supported before
  and there are no know producers for this construct.

To support the upcoming DWARFv5 in gcc 7 (not on by default), we will
need to add support for the new debug_line format and scan the new
debug_macro section that can have references to the debug_str table.

Signed-off-by: Mark Wielaard <mark@klomp.org>
2017-03-06 15:17:20 +02:00
Stephen Gallagher 64028f9a1c Add OpenSSL support for digest and signatures
Autotools: add --with-crypto=openssl
This enables RPM to locate the appropriate flags for compiling
against OpenSSL for digest and hash functions.

This implementation changes the old behavior of
--with[out]-beecrypt toggling between beecrypt and nss. It will
now throw an error if attempting to use --with-beecrypt
indicating that the user should instead use --with-crypto=

See also:
https://github.com/rpm-software-management/rpm/issues/119
2017-02-16 11:26:55 +01:00
Panu Matilainen e843855527 Make peach with doxygen >= 1.8.8 (#131)
Doxygen >= 1.8.8 skips files with unknown (or missing) extension,
whereas previously they were assumed C-like. Rename the Doxyheader
files to Doxyheader.h to keep the C-association, adjust makefiles.

Thanks to Pavlina Varekova for chasing this down!
2017-02-06 13:07:00 +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
Panu Matilainen 3cac383bb8 Drop special hackery to force rpm into /bin/rpm
Let rpm go into $(bindir) along with everything else, it just isn't
that special. Many distros are nowadays symlinkingbin to usr/bin anyway
which makes the special casing of /bin/rpm even more silly.
Somebody wants to put it someplace else, 'mv' is your friend and
I'm not going to stop you.
2016-11-04 13:16:02 +02:00
Panu Matilainen 77bf115632 Tweak up distclean-local to appease distcheck 2016-11-04 11:47:18 +02:00
Panu Matilainen c896a481f2 Fix "make dist" work out of the box again
ChangeLog is listed as EXTRA_DIST but there's no rule to create it
so dist target is broken except when invoked with Makefile.maint. Which
nobody finds because its such a strange thing to have.

Move back ChangeLog generation into main Makefile.am but do not
require git to create it. Instead have a rule to create an empty
file to appease EXTRA_DIST no matter what, and only create the
real thing if we're in a git checkout and git command is present.
2016-11-04 11:02:50 +02:00
Panu Matilainen 84efd17423 Fix internal headers getting pulled into API docs
The issue is probably as old as the librpm API docs in itself...
2016-11-02 13:27:10 +02:00
Panu Matilainen e6639abf33 Drop CHANGES out of dist tarballs
It's almost 10 years out of date, people are better off looking
at git changelog now.
2016-11-02 12:10:30 +02:00
Panu Matilainen c68fa9ab0b Rip rpm 4.4.x API compatibility
It's been deprecated and hidden behind compat defines for eight
years now, more than enough time for folks to port their stuff
to new APIs. If they ain't done by now ... well its time now.
2016-10-24 12:38:21 +03:00
Mark Wielaard 4ec7c396fb Add sepdebugcrcfix to fixup old style gnu_debuglink CRC checksum.
Some old tools might still use the .gnu_debuglink section to find
separate debuginfo files instead of build-id style lookups. When
dwz has compresses the .debug files the original CRC in the main
ELF file will no longer match. Make sure to run sepdebugcrcfix
after dwz to recalculate the CRC.

The original fix was created by Jan Kratochvil based on code
from GNU binutils BFD. https://bugzilla.redhat.com/show_bug.cgi?id=971119
I added a testcase to make sure the CRCs were all correctly
updated after dwz has run to compress a debuginfo package.
And a change (plus testcase) to make sure implicit suid binaries
didn't accidentially got their suid flag bit.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Mark Wielaard b33a41da36 Add find-debuginfo.sh -m minisymtab support.
Support for minisymtab (a minimal function symbol table in a compressed
section in the main binary) has been in gdb and elfutils based tools
since some years. Fedora has had this as rpm-4.10.0-minidebuginfo.patch
since 2012.

The patch adjusts macros to pass -m to find-debuginfo.sh when
_include_minidebuginfo has been set. find-debuginfo.sh now takes -m
as argument to generate the .gnu_debugdata ELF section to be added
to the main executable.

To support the testcases a new macros.debug is added that is used to
generate debuginfo packages in the rpmbuild.at testsuite.

The original support was added to Fedora rpm by Alexander Larsson.
Lubos Kardos fixed a bug in it when strip -g was used. I added some
configuration macros and two testcases to check the basic support works
and for the strip -g bug.

Signed-off-by: Mark Wielaard <mjw@redhat.com>
2016-07-29 18:28:53 +02:00
Peter Eisentraut 4749a08a9e Fix symlinks for installations outside /usr/bin
rpmquery and rpmverify are symlinks to rpm.  The former are usually
installed in /usr/bin, the latter in /bin, so the symlink points to
../../bin/rpm.  But for installations into other prefixes, the synlimk
should just point to the same directory.
2016-02-24 17:59:48 +01:00
Neal Gompa (ニール・ゴンパ) c67aeced99 Properly support BeeCrypt option in build system 2016-02-24 17:45:55 +01:00