Commit Graph

294 Commits

Author SHA1 Message Date
Panu Matilainen df22e4aaa7 Reorganize the ancient spec tag blurb into a new beginning
Remove long since obsoleted tags and such, at least mention all
spec sections by name. Obviously mountains of information is missing,
and what is there is totally chaotic and inconsistent, but at least
there's a place to add more now.
2020-10-28 12:48:51 +02:00
Panu Matilainen 5032470056 Document (however briefly) all our actively used header tags 2020-10-28 12:48:51 +02:00
Panu Matilainen 831461f36d Fix some Doxygen grouping artifacts (aka bugs) 2020-10-28 10:40:41 +02:00
Panu Matilainen f9516434dd Allow parametric macros to opt out of option processing (#547)
Macros might want to pass along options meant for others while perhaps
modifying some of them, without exposing it all to users.

Have "-" as the parametric macro opts string disable all options processing
in rpm, allowing the macro to handle the raw argument list as they place.

Fixes: #547
2020-10-19 11:27:35 +03:00
Panu Matilainen ad1cad7e6a Supply tag numbers for special/signature/digest tags where missing
Drop internal-only special tags (header region types) from the list
2020-10-13 14:36:34 +02:00
Panu Matilainen 27f5ab73c2 Organize tag documentation to rough tag groups for some sanity 2020-10-13 14:36:34 +02:00
Panu Matilainen 6163c6cfd9 Add Lua binding for rpmMacroIsDefined() and ..IsParametric()
Since Lua can easily return multiple values, combine test for definition
and parametric into one rpm.isdefined() API, always returning two booleans.
This also kinda ensures correct API usage as both are needed to positively
identify a defined, non-parametric macro.
2020-10-09 12:53:14 +03:00
Panu Matilainen 67abf72ef5 Pass parametric macro options and arguments to Lua natively (#1092)
We already have the macro arguments in an ARGV that's suitable for
passing to Lua, just store it in the macro buffer for passing around.
As macros can nest arbitrarily, we need to store and restore the mb
args which is a bit hacky, but much less trouble than changing all the
related functions to pass argound an argv which only one function
ever uses. Ditto with the macro entry itself, which is needed to pass
around the options (and name, and maybe something else too later).

Besides all the normal rpm defined macros for arguments and options,
parametric Lua macros now get pre-processed options and arguments
in native local tables "opt" and "arg" for much more pleasant access.
"opt" and "arg" tables are always there even if no options or arguments
were passed, this avoids having to deal with multiple cases and test
for nil's all over the place.

Fixes: #1092
2020-10-09 12:52:47 +03:00
Panu Matilainen bb8dea1f84 Add list of rpm tags to the manual
Actually describing them all is a whole other matter...
2020-10-07 17:41:21 +03:00
Panu Matilainen 148d763338 Merge conditional builds and dependencies docs from rpm-web 2020-10-07 17:41:21 +03:00
Panu Matilainen 2a242b8249 Merge / sync with rpm-web macro documentation, pooh...
Hopefully catching all the relevant differences, and add a link
to Lua docs while at it.
2020-10-07 17:41:21 +03:00
Panu Matilainen b72e4905cb Pull relevant content from rpm-web wiki 2020-10-07 17:41:21 +03:00
Panu Matilainen 45917fd609 Bring over a couple of relevant "developer docs" from rpm.org 2020-10-07 17:41:21 +03:00
Panu Matilainen f5b24da36d Bring most of "user documentation" from rpm.org to our reference manual
The rest need more massaging and/or delicate merging to avoid losing
content added in one place but not the other.
2020-10-07 17:41:21 +03:00
Panu Matilainen 0a91e77ef7 Add a preliminary index page to our reference manual
The idea here is to start building a comprehensive RPM reference manual
where all features are eventually covered. Tutorials belong elsewhere.

The doc/manual contents are woefully inadequate and horribly out of date,
but even the longest journey starts with the first step.
2020-10-07 17:41:21 +03:00
Panu Matilainen e6bc734d36 Rename manual contents to .md for GH rendering and to signify format 2020-10-07 17:41:21 +03:00
Panu Matilainen e9b0230a9f Convert our "manual" to Markdown
For rough reproduction steps (yeah I know, this isn't my cup of tea):

	perl -pi -e 's:\\verbatim:```:g' *
	perl -pi -e 's:\\endverbatim:```:g' *
	perl -pi -e 's:\\section .*? :## :g' *
	perl -pi -e 's:\\page .*? :# :g' *
	# plus clean up doxygen /* .. */ markings manually.

Some of the content is painfully out of sync with stuff on rpm.org but
now we can at least meaningfully diff.
2020-10-07 17:41:21 +03:00
Panu Matilainen 4212dbdc17 Update Doxygen config to get on with times
Our config was spitting all manner of obsoletion warnings
2020-10-07 17:41:21 +03:00
Jes Sorensen ae4b1b1fe8 rpmsign: Add argument to specify algorithm for fsverity signatures
The argument --verity-algo can be used to specify the algorithm for
the fsverity signatures. If nothing is specified, this will default to
sha256. The available algorithms depend on libfsverity, currently
sha256 and sha512 are supported.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2020-09-04 13:22:38 +03:00
Jes Sorensen 32e94048a3 Update man page for rpmsign
This documents the new arguments --signverity and --certpath required
to sign a package with fsverity signatures.

Signed-off-by: Jes Sorensen <jsorensen@fb.com>
2020-09-04 13:22:38 +03:00
Michal Domonkos 28b3704034 Docs: Add DYNAMIC BUILD DEPENDENCIES section
Fixes: #963
2020-07-30 14:30:58 +02:00
Michal Domonkos aa5bcb0a4e Docs: Revamp BUILD OPTIONS section in rpmbuild(8)
With the recent addition of the dynamic build requirements and the
accompanying -br option, it isn't entirely obvious that it's just an
additional build stage which may be executed with other build options as
well.  Let's make it clear by rewording the section and incorporating
the %generate_buildrequires stage.

Fixes: #1304
2020-07-30 14:30:58 +02:00
Panu Matilainen 07ed169da3 Add --excludeartifacts install option
Like docs, configs etc, excluding artifacts from installation might
sometimes be desireable to eg save space. Inspired by
https://bugzilla.redhat.com/show_bug.cgi?id=1848199
2020-06-23 13:05:24 +03:00
Panu Matilainen 1870f4df16 Don't install man pages for disabled features
Doesn't make much sense to install manuals for features that are not
enabled in a build. Conditionalize our man page installation where
necessary, taking care to include the manuals in tarballs regardless
of configured status.

Inspired by PR (#1247) from Thierry Vignaud
2020-06-23 13:02:00 +03:00
Panu Matilainen 145b5f8740 Support rpm version comparison in expressions
Adds rpm version as a new expression value type, denoted by v"" (similar
to Python u"", b"" etc), which are compared using rpm version comparison
algorithm rather than regular string comparison.

For example in specs:

    %if v"%{python_version}" < v"3.9"
    %endif

...but also command lines, arbitrary macros etc:

    rpm --eval '%[v"1:1.2" < v"2.0"]'

Fixes: #1217
2020-05-27 14:42:50 +02:00
Panu Matilainen be0c4b5dce Add (beginnings of) a rpm version API (parsing, comparison)
It's more than a little hysterical that rpm hasn't had a meaningful
public API for parsing and comparing version strings. The API may seem
kinda overkill for some things but then this does give us a place to
check for invalid version strings, which is a thing we never had before
(although the current code doesn't do much in the way of checking)

Fixes: #561
2020-05-27 14:14:00 +02:00
Thierry Vignaud 9a30bcdacc describe all rpmdeps options 2020-04-27 12:45:58 +03: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 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 b1aeafef49 Stop adding rpm v3 header+payload signatures by default where not needed
On packages where a separate payload digest exists (ie those built with
rpm >= 4.14), rpm v3 header+payload signatures are nothing but expensive
legacy baggage, as the payload digest will be signed by a header-only
signature already, without having to recalculate the entire file.

Automatically detect the payload digest presence and only add V3
signatures on packages that need it, but also add an override switch
to force their addition if needed for compatibility or so. A particular
use-case would be ability to signature-level verify the entire package
on rpm older than 4.14.

Fixes: #863
2020-03-10 12:11:17 +02:00
Panu Matilainen 1d624239c4 Implement %{macrobody:...} built-in for retrieving the literal macro body
Fixes: #582
2020-02-19 13:09:21 +01:00
Florian Festi daec7a9e2e Add man pages for plugins
* rpm-plugins for plugins in general
* selinux plugin
* syslog plugin
* audit plugin
* prioreset plugin
* ima plugin
2020-01-30 17:23:45 +02:00
Florian Festi fb54f5c0a2 Add man page for rpm2archive
Resolves: #1016
2020-01-30 17:23:45 +02:00
Panu Matilainen da94ee8195 Drop useless %{F:..} built-in macro
I fail to see how this is useful functionality to anybody:

	$ rpm --eval "%{F:foo}"
	filefoo.file
2020-01-29 12:51:26 +01:00
Pavlina Moravcova Varekova 8b224d3737 Correct description of %verbose and %getconfdir in the macro manual 2019-09-24 14:25:03 +03:00
Panu Matilainen d47ab71851 Replace hardwired man page references to "redhat" in paths with "<vendor>"
The politically correct version would be changing these all to .in files
with autoconf substituting the correct value during the build process
but that is such a PITA for what is at best a neglible benefit in this case,
it's just not worth it.

Fixes #779
2019-09-23 14:29:48 +03:00
Michael Schroeder cb4e5e755a Add support for primary expansion to the expression parser
And also wire it to %[ ... ] as new syntax to expand expressions.

We'll add short-circuit support in the next commit.
2019-09-23 12:49:21 +03:00
Pavlina Moravcova Varekova cead442ecf Add 'string' into query format extensions in man-pages 2019-09-20 11:26:45 +03:00
Michael Schroeder 8bc90aa797 Support ternary operator in expression parser 2019-09-18 15:06:23 +03:00
Pavlina Moravcova Varekova 22c26c7444 Add description of comments in spec documentation 2019-09-10 14:25:26 +03:00
Pavlina Moravcova Varekova 07be45f202 Improve description of conditionals in spec documentation 2019-09-10 14:25:26 +03:00
Pavlina Moravcova Varekova 0cb0e69eaf Correct and update Query formats documentation
- in a majority of examples in the manual the text after the
  --queryformat argument is in  double quotes - thus it does not
  look good to wrote that "A query format is passed to RPM after
  the --queryformat argument, and normally should be enclosed
  in single quotes".

- in the case of:
  rpm -qa -i --queryformat "%{NAME} %{SIZE}\n"
  -i is not ignored, so this is omitted in the text.

- language correction

- added a link to a formatting tags documentation

- added an explicit example of a query expression

- removed example of "viewing the verify flags', that does
  not have any purpose here
2019-09-09 16:41:29 +03:00
Panu Matilainen 3a6a7cf691 Add %{expr:...} macro for parsing expressions
Supports the same expressions as spec %if conditions because, well,
it's the same expression parser. Only this returns the result as
a string instead of a boolean.
2019-08-21 15:39:40 +03:00
Pavlina Moravcova Varekova 0d75ef1e0a Describe conditionally expanded macros in manual 2019-07-22 14:13:41 +02:00
Florian Festi be3347b5bf rpmsign man page: Add line about rpmsign requiring a valid checksum
and the limitations in FIPS mode
2019-07-18 07:45:53 +02:00
Panu Matilainen 44180fc740 Implement %dnl (discard to next line) macro primitive for comment use
There has been no way to add comments to multiline macros, and while
spec files technically support #-commenting at beginning of lines, it
does not apply to all sections and causes generation after generation
of packagers to stumble on the same items over and over: macros
are expanded within spec comment lines, which makes commenting multiline
macros such as %configure annoying, comments inteded for scriptlets
end up being in the previous scriptlets body, and numerous other quirks.

This implements the M4-inspired %dnl macro primitive which literally
discards everything until the next newline (or end of string), without
expanding the contents. This allows comments to be used inside multiline
macros and everywhere in spec.

Caveat: in some places such as %description the newline doesn't actually
get discarded but this is a a spec parser issue, not on the macro side.

Closes: #158
2019-06-19 14:22:11 +02: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
Florian Festi 58dcfddc37 Add support for dynamic BuildRequires
Supports new %generate_buildrequires section in the spec file which is executed
after %prep. Stdout is captured and turned into BuildRequires. These are then
checked. If they cannot be fulfilled a source package is created with all
BuildRequires and the build is terminated after that.

rpmbuild has now the following new build modes -br, -tr, -rr and exits with 11
if build requirements are not met.

That means for users:
* No %generate_buildrequires
  * rpmbuild -br is equivalent to rpmbuild -bs
  * rpmbuild -br --nodeps is equivalent to rpmbuild -bs
* %generate_buildrequires
  * rpmbuild -br will check dynamic BuildRequires
    * Satisfied → src.rpm
    * Unsatisfied → buildreqs.nosrc.rpm
  * rpmbuild -br --nodeps will always generate buildreqs.nosrc.rpm

Source packages contain
Requires: rpmlib(DynamicBuildRequires) <= 4.15.0-1
if the spec contains a %generate_buildrequires section and
Provide: rpmlib(DynamicBuildRequires) = 4.15.0-1
if the results been added to the source package.

Co-authored-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2019-05-28 09:24:01 +03:00