Commit Graph

15 Commits

Author SHA1 Message Date
Panu Matilainen a0e24f2caf Reset global macro state after each spec query/parse
Parsing a spec, even unsuccessfully, will affect the global macro
state in any number of ways that may affect the following operations
in unpredictable ways. Lacking any saner way to do this, reset the
entire global macro state after each spec parse in rpmspec and spec
query code (rpmbuild already does this) while maintaining possible
cli-specified target and rcfile.
2020-02-12 10:23:23 +01:00
Howard Johnson 733babe7cb Remove unused target variable from rpmspec.c
Commit d2f48e93d3 moved the --target
argument to be global, but didn't completely remove the local target
variable from rpmspec.c, or the code that used it to trigger re-loading
the rpm configuration files (which is now handled by the global argument
callback in poptALL.c).
2019-06-05 09:46:19 +03:00
Per Øyvind Karlsen d2f48e93d3 Add --target as global option
As specifying target will load & set macro definitions according to
target specified, it's still useful to provide it anywhere where ie.
--eval may be used, as by specifying --target first, it'll change the
target specific macros to load which is perfectly sane and useful for
checking macro specific definitions.

Remove now redundant --target= argument for rpmspec as it's now global.
2017-04-04 10:32:09 +03:00
Lubos Kardos 5490887c3a Add option the select option --builtrpms to rpmspec(rhbz:961833)
When --builtrpms is used then rpmspec operates only on the binary
package headers of packages which would be built from spec. That means
ignoring package headers of packages that won't be built from spec
i. e. ignoring package headers of packages without file section.
2016-03-09 14:51:27 +01:00
Kamil Rytarowski 61109446ac Reimplement setprogname() and getprogname() to be generic and portable
The RPM code contains setprogname()/getprogname() support implemented through compatiblity layer with very old GLIBC (internals supported back to '95 and earlier), before stabilization of the GNU C library. This compatiblity layer (__progname, __assert_progname, setprogname()) is supposed to support well archaic GLIBC, but on the other hand it pollutes the library namespace and introduces unpredicable compillation errors on BSD systems.

The functions setprogname() and getprogname() are natively supported in NetBSD and work the same way as __progname from the GNU C library (they are even implemented in the same way - but with a slightly changed logic). The support for very old (20 years and older) GNU C Library is obfuscating the code, because it uses defines over defines without a word of explaination why to do so.

It's important to note that the setprogname()/getprogname() was inconstiently implemented in the codebase, duplicating the code and/or functionality.

Add new generic functions getprogname() and setprogname() and bind it to:
- the current and for two decades stable GNU LIB C implementation,
- the current NetBSD implementation (introduces to NetBSD in 2002),
- fallback reimplementation functions of the setprogname() and getprogname() functionality for other systems.

Don't support anymore old GNU Lib C internals and don't support older NetBSD systems, as they aren't supported for many years.

Add to the codebase comments explaining the relevant codeparts.
2016-02-11 14:05:25 +01:00
Alexey Tourbin 4eb824937c Adjust rpmspec -P to invoke non-build parse
In the query mode, rpmspecQuery puts the parser into non-build mode
by invoking rpmSpecParse with (RPMSPEC_ANYARCH|RPMSPEC_FORCE) flags.
The same flags should be applied in the parse mode, so that it is
possible to preprocess specfiles separately, i.e. without also
installing sources and patches.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-01-22 13:34:14 +02:00
Panu Matilainen 75cea7a534 Make --pipe command failures reflect our exit codes (RhBug:735481) 2011-09-05 08:38:31 +03:00
Panu Matilainen c881ee9e81 Add --parse option to rpmspec tool to dump parsed spec contents
- This is somewhat like 'gcc -E', useful for analyzing/troubleshooting
  what happens inside the preprocessing.
2011-06-17 13:53:43 +03:00
Panu Matilainen 5b2c322887 Eliminate dead NULL-assignments at scope-end in main cli utils 2011-05-30 09:36:03 +03:00
Panu Matilainen 0600287d5d Rearrange new cli utilities' popt tables for nicer output
- Use a separate table for the tool-specific options, include that from
  the "master" option table to get option group summary in --help.
2010-11-15 09:07:10 +02:00
Panu Matilainen b611e57e66 Rpm option descriptions begin with lowercase letters, follow suit in rpmspec 2010-10-12 15:10:26 +03:00
Panu Matilainen 6f8125c9fd Only queryformat is relevant for specfiles
- Instead of including the entire rpmQueryPoptTable in rpmspec and
  showing several bogus options, support --qf/--queryformat "manually"
2010-10-12 15:07:38 +03:00
Panu Matilainen 999431a4ab Support overriding target for rpmspec queries too 2010-10-12 14:56:18 +03:00
Panu Matilainen fb369ee0cc Support both binary/source queries in rpmspec tool (RhBug:540807, ticket #89) 2010-10-12 14:46:39 +03:00
Panu Matilainen e8a1f5da3e Lift specfile query out of main rpm(query) into separate binary
- Avoids having to link /bin/rpm with librpmbuild and everything it
  might bring in (eg libmagic) which are not needed for core operation.
- Minimally preserve backwards compatibility with popt exec alias
2010-10-04 14:31:55 +03:00