Commit Graph

198 Commits

Author SHA1 Message Date
Panu Matilainen fef72734dc Don't spew out usage message just because rpm is in verbose mode
The rpm "major mode" could legitimately be "unknown" here for several
reasons like --eval and usage message is inappropriate in that case
regardless of verbosity setting.
2017-10-09 14:59:52 +03:00
Neal Gompa 553a06af1a Change output text to 'Exit status' 2017-07-20 15:10:30 +02:00
Jeff Johnson 72cbdc876d Print exit code with rpm -vv
This trivial patch helps diagnose rpm behavior while developing or testing.
2017-07-20 15:10:30 +02:00
Lubos Kardos 00ebe2e59b Make --noplugins work with "rpm --verify"
This caused problems in rpm test suite.
2016-03-07 13:26:35 +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
Panu Matilainen 80dee39fb1 Add --reinstall command to rpm cli
- 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
2014-03-04 13:43:01 +02:00
Panu Matilainen fbb44eb66d And finally, permit --hash and --percent cli-switches on erasures too 2012-01-05 16:28:18 +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 306c23ee49 Fix the sanity check on number of query/verify sources (RhBug:691930)
- 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.
2011-07-13 13:56:15 +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 5bd382f3a3 Remove no longer relevant references to build from arg sanity checks 2010-11-15 10:48:33 +02:00
Panu Matilainen ac0c2cd71f Eliminate pointless argument sanity 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)
2010-11-15 10:05:18 +02:00
Panu Matilainen 3ce48d0306 Remove unnecessary includes 2010-11-15 09:17:25 +02:00
Panu Matilainen 26125015e4 Further split the cli-tools to rpminstall, rpmquery and rpmverify
- 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.
2010-10-08 12:29:59 +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
Panu Matilainen 9f68c7958f Rip IAM_RPMDB, ie --initdb, --rebuilddb etc modes out of rpmqv.c and librpm
- 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...
2010-09-03 17:13:10 +03:00
Panu Matilainen 3cbda9c03f Rip IAM_RPMK, ie --import and --checksig modes out of rpmqv.c + librpm
- Add popt exec aliases to rpmkeys for backwards compatibility
2010-09-03 16:32:43 +03:00
Panu Matilainen b195048bbb Further simplify rpmcliVerifySignatures()
- 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.
2010-09-03 15:57:14 +03:00
Panu Matilainen c382cd5373 Rrrriiip the addsign/resign/delsign bits out of rpmqv.c + friends
- Add popt exec aliases to rpmsign for backwards compatibility (dejavu...)
2010-09-03 15:12:12 +03:00
Panu Matilainen 8f75ac30fb Lookup signature type from cli utility already
- 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
2010-09-03 14:23:55 +03:00
Panu Matilainen 00c72fda89 rpmcliSign() only creates or deletes signatures
- 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
2010-09-03 12:30:57 +03:00
Panu Matilainen e95e558ad2 Use rpmcliVerifySignatures() directly from rpmqv.c main 2010-09-03 10:54:09 +03:00
Panu Matilainen fe57228ce1 Use rpmcliImportPubkeys() for importing instead of rpmcliSign()
- Add some more IamYourDaddy modes to rpmqv.c for now. We'll need to
  add junk to get rid of others, sigh...
2010-09-03 10:52:13 +03:00
Panu Matilainen 9d2ad1e4f4 Remove hysterically useless RPMSIGN_NONE + --sign popt leftovers 2010-09-03 10:51:52 +03:00
Panu Matilainen a68bcb383e Use the common rpmcliQueryFlags for signature verify options in rpm cli too
- 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)
2010-09-03 10:50:37 +03:00
Panu Matilainen 1d7f4dd6ed Remove ancient autohelp-handling related leftovers 2010-08-24 11:40:25 +03:00
Panu Matilainen fbd92df754 Argh. Realize we already have equivalents of initCli() and finishCli()
- 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.
2010-08-20 15:23:48 +03:00
Panu Matilainen 3c5c19747b Kludge to get rid of ugly lone --quiet on usage message 2010-08-20 14:31:16 +03:00
Panu Matilainen 2c2faa299e Move --pipe handling to cliutils helpers 2010-08-20 13:52:47 +03:00
Panu Matilainen d391d5ec60 Oops, fallout from commit 5fe63cd8e0 2010-08-20 13:50:53 +03:00
Panu Matilainen 03a8511e3b Lump much of the common cli-init + finish tasks into cliutils helpers 2010-08-20 13:50:48 +03:00
Panu Matilainen b217529967 Add a convenience library for stuff common cli-bits into 2010-08-20 13:49:18 +03:00
Panu Matilainen 04b1816f00 If MiNT can't cope, frankly my dear, I dont give a damn 2010-08-20 13:48:42 +03:00
Panu Matilainen a3795d0dc2 Simplify --root argument checking
- We haven't accepted url's in as root since ages, wipe out the goo
2010-08-20 10:57:35 +03:00
Panu Matilainen 5fe63cd8e0 Chainsaw the now unused #ifdef'ed parts out of rpmqv.c and rpmbuild.c 2010-08-20 10:57:20 +03:00
Michal Schmidt 7583fcc341 Allow '--short-circuit' for '-bb'
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
2010-06-23 16:06:43 +03:00
Panu Matilainen 367c0d7014 Eliminate hysterical --hdlist query option and everything implementing it
- 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...
2010-03-19 16:54:00 +02:00
Panu Matilainen d87d831cdf Eliminate --wtfwalk .. err, --ftswalk and everything implementing it
- that's what find + xargs are for, this is just useless cruft
2010-03-19 16:52:19 +02:00
Florian Festi 51c96db046 Kill RPMTAG_FSNAMES and RPMTAG_FSSIZES and everything implementing them 2010-02-03 16:27:00 +01:00
Panu Matilainen e10e807ce9 Move <mcheck.h> include out of system.h to the couple of places that care
- only two real users inside rpm
- remove mcheck foo from rpminject and rpmsort, we're not interested...
2010-01-05 12:36:37 +02:00
Panu Matilainen 2c6120755c Unconditionally include <sys/wait.h> where needed
- no point conditionalizing what we cant live without
2010-01-05 12:35:54 +02:00
Panu Matilainen 475ba2111f Add noreturn annotations to argerror() helper functions 2009-09-07 15:52:36 +03:00
Panu Matilainen 555af4eadb Replace equal/not equal uses of str[n]cmp() with rstreq[n] in binaries 2009-08-31 13:04:17 +03:00
Panu Matilainen 64280efc1e Put the PGP foobar signature generation out of its misery
- 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...
2009-03-26 09:59:01 +02:00
Panu Matilainen 2e672f3fae Show query/verify selection options just once in --help 2009-03-19 16:07:18 +02:00
Jindrich Novy 7acdfded4a Add md5->filedigest aliases (rhbz#487597)
- 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
2009-02-27 14:34:39 +01:00
Rakesh Pandit 430b8cc377 -Use installInterfaceFlags in place of eraseInterfaceFlags. -Moved transaction part from rpmInstall and rpmErase to rpmcliTransaction. 2009-02-16 09:27:58 +02:00
Panu Matilainen e0f57801c0 Permit --noscripts on verify (to disable %verifyscript execution)
- this used to work but got broken by the rpmi/rpmq/... unification
2008-12-18 09:51:37 +02:00
Panu Matilainen 0372f7d8b4 Read default popt aliases again (rhbz#473167)
- 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
2008-11-29 14:34:01 +02:00
Panu Matilainen 43b08986a8 Use rpmConfigDir() for finding our popt alias file
- this allows popt aliases to be reliably available in tests
- why do we have the popt initialization done twice?
2008-11-22 18:08:40 +02:00