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.
- Handle reinstall as a new sub-mode of install, leaving all the
--replacepkgs etc insanity alone, at least for now. For rpm cli we
could probably remap --replacepkgs into proper reinstall, but handling
this in the API is much harder as problem filter flags, such as
RPMPROB_FILTER_REPLACEPKG, are not known at the time packages
are added to transaction, and also we can't very well go and
add new elements to the transaction from inside rpmtsRun()
- Fixes the use-case of RhBug:966715 but not the exact cli invocation
in that bug... that needs something different
- Prior to commit 2e672f3fae, the
callback would get called twice for every option so the expected
number of query/verify sources was doubled. Now the numbers
match with reality, adjust the check.
- --root is valid for all the remaining modes, no point checking for it
- MODES_FOR_DBPATH is completely unused (and dbpath is a common option
to all anyway)
- Installing/erasing packages, querying and verifying require different
amount of privileges on the system. Having separate binaries for
these functionalities permits limiting the capabilities through
SELinux and other similar security mechanisms: for example quering
needs much less privileges than installing.
- For now, leaving /bin/rpm to be the Swiss Army knife it
always was: capable of install/erase, query and verify. Eventually
it should be turned into just a dumb wrapper which just execs
the per-functionality binaries, but leaving that for later stage,
as popt exec/aliasing doesn't quite seem to up to par with the task.
Having the separate binaries available at least makes it possible
for callers to specify the amount of privileges they need.
- 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
- Add popt exec aliases to rpmdb for backwards compatibility
- Change test-suite to use 'rpmdb --initdb' instead of 'rpm --initdb'
as popt exec aliases with absolute paths dont play very well
with the test-suite, duh...
- Since this is a rpmcliFoo() function, we can assume rpmcliInit()
is used and the verify disabling bits are set through the common
rpmcliQueryFlags set, making qva argument unnecessary.
- Avoid relying on the murky rpmLookupSignatureType() foobar on
low API level, pass the wanted tag explicitly from caller
- rpmLookupSignature(), rpmGetPassPhrase() + the bits they rely on
are now free of users within librpm itself
- Lose the "this has got something to do with signatures and stuff"
dispatcher mode, rpmcliSign() now only does what it says. It also
doesn't need transaction set for anything. It doesn't need much
else than files to operate on, what to do and possibly a passphrase.
It probably will need more when rpmLookupSignatureType()
is put out of its misery, but this'll do for now.
- Lose the now unnecessary passPhrase member from QVA_t
- Technically this changes the rpmcliQuery() and rpmcliVerify() API
in the sense that we no longer honor the qva->qva_flags for the
--nosignature and others, but we assume anybody using these (as if
anybody was using the "cli" API) uses rpmcliInit() which takes
care of these common bits... shrug.
- Ditch ancient and hidden --nopgp --nogpg switches along with the
dishwater which are simply alias to --nosignature.
- Eliminate now unused qva_flags from rpmInstallArguments (along with
a double vsflags goo from rpmgraph)
- rpmcliInit() and rpmcliFini() do almost exactly the same as our
newborn cli-helpers, but they've been almost unused until now.
Use them and lose the new ones.. doh.
- The downside is that popt aliases are now broken when running commands
from the build tree due to lt-foo in argv[0], whereas initCli() took
and explicit popt context name argument. Oh well...
- rpmcliFini() was missing several necessary memory cleanup calls,
add them there while at it.
This patch allows short-circuiting of building binary packages. To
prevent accidental use of short-circuited rpms, they are marked with
an unsatisfiable dependency "rpmlib(ShortCircuited)". A developer using
this feature for local development and testing will use "--nodeps".
Should such a rpm leak into the world, users will quickly notice
it does not install by default.
(v3: avoids API change, suggested by Panu Matilainen.
v2: added poisoning with unsatisfiable dependency.)
Michal
- This hidden gem used "system hdlist", ie "/usr/share/comps/%{_arch}/hdlist
as the source for queries. Such "system hdlist" hasn't existed anywhere
since RHL 9/FC 1 times...
- the last freeware PGP version (6.5.8) is from year 2000 and doesn't
come close to compiling on modern distros, commercial versions we're
not interested in
- "PGP" signatures in rpm mean RSA, gpg can handle that just fine since
forever
- the code's been unused for years, unlikely to be functional anyway...
- add %verify(nofiledigest) as %verify(nomd5) file attribute alias
- reference digests as digests not checksums
- make old md5 related symbols obsolete and use newer reference
- update man page accordingly
- makes testsuite depend on local aliases but using default popt config
is widely documented and needs to work, testsuite needs a better method
of disabling it if necessary
- we want the same set of aliases to be seen no matter what name we're
invoked with, except for build which has it's own set of aliases
- this has a nice little side-effect of permitting popt aliases to work
from source tree on non-static builds despite libtool calling executables
lt-something instead of their real names
- it's all rolled into "rpm" itself, these are just clutter and complicate
things needlessly
- leave symlinks to rpmquery, rpmverify, rpmsign and rpmdb -> rpm to
preserve some compatibility (at least rpmquery is known to be used
in scripts)