Commit Graph

10 Commits

Author SHA1 Message Date
Panu Matilainen f60eaa1e0f Set program name centrally from rpmcliInit()
Most of our tools go through rpmcliInit() so take the opportunity
lessen the clutter wrt xsetprogname() calls. No functional changes.
2022-03-25 10:23:37 +02:00
Michael Schroeder 243041f5fb Add a --salvagedb option to the rpmdb tool 2020-02-26 12:50:22 +02:00
Panu Matilainen 8fae14f4df Remove bunch of redundant environ declarations
rpmsign.c used to actually use "environ" to pass to execve(), but
that call moved to librpmsign a long, long time ago. rpmdb.c and
rpmkeys.c never used it at all but guess it was copy-paste inherited
from rpmsign.c back in the day (dfbaa77152)

rpmgensig.c actually refers to environ, but this is a POSIX required
variable and while Apple has managed to screw it up, it's handled
in system.h and that must be sufficient for all relevant systems
as we also refer to environ in rpmfileutil.c open_dso() and there's
no fake environ definition there. So drop the one in rpmgensig.c too.
2017-06-09 11:37:03 +03: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
Panu Matilainen 656459ba44 Add crude --exportdb and --importdb operations to rpmdb utility
- Exportdb simply dumps all the headers from rpmdb into simple header
  list which is about as rpm-native and backwards and forwards compatible
  format as they come. Importdb obviously, well, imports such a
  list into rpmdb.
- Both require transaction handle: we dont want anybody running
  transactions while exporting, and importing obviously requires
  write-locking.
2013-03-11 15:37:56 +02:00
Panu Matilainen f67c47b856 Eliminate bunch of dead assignments on ts vsflags
- The common pattern here is grabbing current flags to a local
  variable, modifying them for an operation and then restoring,
  which is fine... but we dont care about the previous flags
  when we're restoring them.
2011-05-30 15:50:29 +03:00
Panu Matilainen 599094e258 Hide --verifydb switch again
- It got exposed in the rpmdb tool splitup, but the functionality in
  it's current form is still just as dubious as it always was, hide
  it out of sight again.
2011-01-05 15:22:45 +02: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 b0433ea8de Oops, dumb copy-paste error causing --verifydb to --rebuilddb instead 2010-10-19 10:58:25 +03:00
Panu Matilainen ada4dd18d5 Add a brand new rpmdb utility for rpmdb maintenance (dejavu again)
- rpmdb maintenance only requires privileges on the rpmdb directory,
  not elsewhere on the system. Splitting to separate tool allows
  finer grained SELinux policies and makes adding new db-specific
  switches saner.
2010-09-03 16:59:51 +03:00