Commit Graph

12662 Commits

Author SHA1 Message Date
Florian Festi 47e879d550 Remove no longer needed rpmfi_internal.h include 2014-03-05 10:47:57 +01:00
Panu Matilainen ca5f075ecb Add a basic test-case for reinstall 2014-03-04 14:36:51 +02:00
Panu Matilainen c5200145fa Dumb dumb typo in commit bf856744f2 2014-03-04 13:53:26 +02: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 bf856744f2 Add python bindings for reinstall
- Again, this could've quite easily been done by accepting "r"
  as "how" argument to addInstall(), but this makes testing for
  rpm support much easier. Otherwise not much to see here...
- Related to RhBug:966715 / RhBug:1071854 ... etc
2014-03-04 13:42:22 +02:00
Panu Matilainen 6665503ec6 Add support for proper package reinstallation to in the API
- Add new public rpmtsAddReinstallElement() function for properly
  reinstalling packages within a single transaction, ie one that
  behaves like it was upgrade to the same version, removing files
  on changed policies (excludedocs etc).
- This could've been done by redefining the "upgrade" argument of
  rpmtsAddInstallElement() to an "operation", but as the upgrade
  argument accepted values are not clearly defined this could
  have unwanted side-effects, plus this way its also easier to test
  whether reinstall is supported by rpm.
- Related to RhBug:966715
2014-03-04 12:48:56 +02:00
Panu Matilainen bfa7652986 Refactor to make room for other operations besides install/upgrade
- Add enumeration for install-style operations
- Refactor the guts of rpmtsAddInstallElement() into an internal
  helper operatins around the new enums
- Any functional change by this commit would be a bug...
2014-03-04 12:19:25 +02:00
Panu Matilainen fd40d58efa Legalize proper reinstall within transaction
- Account for packages removed in transaction when checking whether
  package is already installed. This permits install + erasure of the
  same package within a single transaction, aka reinstall, with
  changing file policies (excludedocs, installangs etc) properly
  taken into account. Related to RhBug:966715.
- This differs from --replacepkgs which is just a strange hack really
  but one that's difficult to change because of how its presented
  in the API. --replacepkgs behavior does not change here, and a proper
  reinstall is NOT possible when replacepkg problem filter is active.
- Testing this is not possible with rpm cli :(
2014-03-04 11:14:37 +02:00
Panu Matilainen 1f3164ae69 Make rpmtsPrunedIterator() internally available 2014-03-04 10:50:46 +02:00
Panu Matilainen a4214256ce Relax duplicate i18n tag check into a warning as well
- Because the check has been missing, these flaws are all over the
  place. Duplicates are not really worth breaking existing specs, so just
  warn for now, and preserve last one wins-behavior.
2014-02-28 17:22:44 +02:00
Panu Matilainen 7f3b6643ee Relax multiple %files sections for a package into a warning
- Because of the missing check, multiple empty %files sections could
  be abused for the effect of multiple -f arguments back when that
  was not supported. The weird corners people find...
- Turn it into a warning and preserve former behavior, except avoid
  leaking memory in this case.
2014-02-28 17:11:53 +02:00
Panu Matilainen b19348342b And finally, actually enable the unused macro warning.
- Reword the message to something hopefully little more understandable,
  change from error to a warning (only matters for output)
- Check unused macros at end of every scope, but unlike with parametrized
  macros, dont actually delete
- Only whine once per unused macro due to the above to avoid spurious
  output due to above
- This catches the common error in specs where %define is used in a scope
  unintentionally, eg "%{!?foo: %define foo 1}" where the just defined
  macro should actually fall out of scope upon the closing }, but
  only gets erased if any parametrized macro is "called" and causes
  insane behavior such as described in RhBug:552944. So at least we'll
  warn on these situations.
2014-02-28 16:45:33 +02:00
Panu Matilainen f9a6855faa Consider macro used if we've so much as looked it up 2014-02-28 16:38:56 +02:00
Panu Matilainen e65e27ab25 Make macro deletion in freeArgs() optional
- Not used yet, but using this for issuing warnings only
2014-02-28 16:12:33 +02:00
Panu Matilainen ae58c96248 Move macro usage tracking to flags
- We dont really care how many times a macro has been used, just
  whether it has been used or not...
2014-02-28 16:10:14 +02:00
Panu Matilainen fae7325f8d Add + use a flag for identifying automatic macros
- In practise doesn't change anything visible as the "macro not used"
  message is disabled, but tracking a flag bit is saner than
  strlen() + strchr() + bunch of other stuff which isn't even correct:
  prior to this %## would've triggered "unused" errors which is plain
  wrong, and complaining about unused %1 %2 ... isn't really right
  either.
2014-02-28 15:57:09 +02:00
Michael Schroeder 66a46b0e8d Support old SuSE style weak dependencies in --recommands, --suggests, --supplements and --enhances
and the underlaying extension tags (RPMTAG_RECOMMENDNEVRS, ...)
2014-02-26 11:36:41 +01:00
Panu Matilainen 7226525b53 Fix duplicate i18n tag checking in spec parse
- The checking from commit 89ed8009eb was
  woefully broken and inadequate, due to the way these puppies are
  storen in the header. We need to actually look up language presence
  in i18ntable and work from there.
2014-02-25 16:27:44 +02:00
Panu Matilainen 647f0d488f Revert stricter macro substitution syntax entirely, for now
- Revert back to pre commit c22d5b1299
  state wrt macro substitution. The commit does have fixes we want
  but it also breaks valid cases which is not okay. We really need
  a far more thorough macro test suite before these kind of changes,
  and also need to do the changes in more controlled pieces.
2014-02-25 16:17:37 +02:00
Panu Matilainen df686992d7 Perform as-is substitution for %{name} form too, again
- Commit c22d5b1299 changed the parsing
  to require a valid name in %{name} macro, but this outlaws existing
  uses such as %{foo_%{bar}_something}. Relaxing the %{name} form
  to use as-is substitution as well allows these to work again.
2014-02-20 10:42:09 +02:00
Panu Matilainen 1bdcd05008 Dont eat newlines on parametrized macro invocations (RhBug:1045723)
- Makes the testcase from commit f082b5baa4
  succeed. While the old behavior is non-sensical and most likely entirely
  unintentional, we're changing a very long-standing behavior here (tested
  back to rpm 4.4.x and almost certainly much much older than that) so
  its entirely possible people are actually relying on the old
  behavior. Lets see what breaks...
2014-02-19 14:24:54 +02:00
Panu Matilainen f082b5baa4 Add a testcase for RhBug:1045723
- All the %bar macro invocations here should "obviously" behave the
  same, but they dont... in two cases a newline gets eaten out so
  this FAILS atm.
2014-02-19 14:16:09 +02:00
Florian Festi b60a26585f Use --recommends, --suggests, --supplements and --enhances in test case 2014-02-19 12:11:27 +01:00
Florian Festi 9eb9581d3c Add --recommends, --suggests, --supplements and --enhances aliases to rpm -q 2014-02-19 12:11:27 +01:00
Florian Festi 4360e7e131 Add RPMTAG_RECOMMENDNEVRS, RPMTAG_SUGGESTNEVRS, RPMTAG_SUPPLEMENTNEVRS and RPMTAG_ENHANCENEVRS extension tags 2014-02-19 12:11:27 +01:00
Florian Festi 87fccc631b Add support for Recommends:, Suggests:, Supplements: and Enhances: 2014-02-19 12:11:27 +01:00
Florian Festi 2283152413 Add tags for a new implementation of weak requirements 2014-02-19 12:11:27 +01:00
Florian Festi d6ecdb33c5 Rename RPMTAG_SUGGESTS, RPMTAG_ENHANCES and friends to RPMTAG_OLD*
This allows keeping this tags in use by distributions already using them while we add new ones for the upstream implementation of weak dependencies
2014-02-19 12:11:27 +01:00
Panu Matilainen 85b62554d2 Make room for SHA224 in digest bundles. Doh.
- Should've really been in commit 20cfa7d2b4
  but at the time NSS didn't even support SHA-224 so it was untestable.
  Now that it does, and somebody actually bothered to test...
  Fixes RhBug:1066494.
2014-02-18 18:26:38 +02:00
Brian Elliott Finley 0d5929ba5e Don't match use or requires within a multi-line print statement
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2014-02-18 15:27:04 +02:00
Panu Matilainen e7a6088093 Warn on empty %files -f manifest files
- While there's nothing wrong with packages with no files, a manifest
  file with no files is likely to be an error or mistake of some
  sort and seems worth issuing a warning at least.
- Related to / inspired by ticket #870.
2014-02-18 12:49:39 +02:00
Panu Matilainen 2bcdeae52e Add return code to handleComments() 2014-02-18 12:38:41 +02:00
Panu Matilainen 1197c9d3eb Build python 3 compatibile module names
- Python 2 accepts foomodule.so as an alias for foo.so, Python 3 does
  not. Build foo.so names which works with both...
2014-02-13 13:25:03 +02:00
Panu Matilainen bf023b87f5 PySlice_GetIndicesEx() argument type differs between python 2 and 3, pooh 2014-02-13 13:24:30 +02:00
Panu Matilainen 05740e1d67 Python 3 doesn't have nb_divide in PyNumberMethods 2014-02-13 13:08:36 +02:00
Panu Matilainen a021aca8fd Fix signing module methods missing on python3, duh 2014-02-13 13:07:40 +02:00
Panu Matilainen 42d502d018 Python 2/3 compat define for PyInt_AsSsize_t, used by rpmfiles 2014-02-13 12:59:03 +02:00
Panu Matilainen 0073376965 Fix build and sign module initialization in python3 (RhBug:1064758)
- PyInit_foo() name needs to match the module name. Doh.
2014-02-13 12:57:16 +02:00
Panu Matilainen 37903d7572 Bah, --ignorearch is required for the upgrade too
- Should've been in commit 3e0d09aac7
2014-02-10 16:47:45 +02:00
Panu Matilainen 3e0d09aac7 Add --replace testcase involving changing file policies
- We end up with owned files getting left behind as orphans in such
  situations (RhBug:966715), that's a FAIL but an expected one atm.
2014-02-10 16:40:45 +02:00
Panu Matilainen 1dbb0da2ff Add a testcase for the header export sort issue (aka RhBug:953719) 2014-02-06 14:08:40 +02:00
Panu Matilainen 67ccf8d996 Clarify the dependency version sanity check error message
- Introduced in commit b2cf1471bb, the
  original message appeared hard to decipher in real-world testing...
2014-02-05 14:52:43 +02:00
Panu Matilainen 902ecd6fd6 Of EACCES, EROFS and EINVAL, only EINVAL is amiguous on env open
- commit 58c5eb28d5 added the errno
  match check, but its only relevant for EINVAL which can be
  returned for non-system errors too, the others are always system
  errors regardless of what errno might hold at the point we get
  to check it.
2014-02-05 14:41:44 +02:00
Panu Matilainen da3a3a14e7 A boolean flag is not sufficient to cover three different states...
- HEADERFLAG_SORTED flag bit has been used to track the header
  sort state since beginning of times, but the header sort actually
  has three different states: truly unsorted (such as after additions),
  sorted by index achieved with headerSort(), or sorted by offset which
  is creatively called headerUnsort() in the API.

  There's exactly one place that requires offset sorting, namely
  headerExport(). It does call headerUnsort() explicitly, but
  headerUnsort() would not do anything unless the header was in
  index-sorted state. This is quite often the case, but data addition
  would unset the sorted-flag, and causing headerUnsort() not to
  do anything at all when it most certainly should have. That incorrect
  sorting caused headerExport() calculations to be wildly off.

  This ancient bug was unearthed by the innocent looking
  commit eae671556470136c37951f53ca966cd1bd09aac4: prior to that,
  in half the cases headerSizeof() used to be called first, causing
  index-sorting to take place, after which the headerUnsort() in
  headerExport() did the right thing. In the other two cases
  headerSizeof() was called afterwards, and the headerExport() would
  be garbage in cases where new data had been just added, such as package
  installation. With headerExport() eliminating the need to call
  headerSizeof() all the cases became broken as the header would
  seem much bigger than it is due to the bad sort order and cause
  cases like RhBug:953719 where a largish header suddenly appears
  to be oversized, causing mysterious install failure. Prior to the
  commit (which in itself IS innocent) the issue would've mainly
  manifested in cases where the header needs to be rewritten, which
  only happens when files are replaced and the header is rewritten for that.
2014-02-05 14:09:14 +02:00
Panu Matilainen 2bfcce5655 Only bother with keyid if caller asked for it and there was no failure 2014-02-03 12:13:00 +02:00
Panu Matilainen 459b2df0e1 Fix silly little memleak introduced in refactoring
- Should've been in commit 567b544f34
2014-02-03 12:07:36 +02:00
Panu Matilainen 85a5b00430 Use headerVerifyRegion() for signature headers too. Die copy-slop, die!
- This isn't supposed to change any behavior, so if something changes
  its likely a bug...
2014-02-03 12:02:07 +02:00
Panu Matilainen 28131c7f71 Refactor header region sanity checking into a separate function
- The region checks for signature header and "regular" header are
  identical except for the tag used, this is an obvious pre-requisite
  for unifying those.
- This isn't supposed to change any behavior, so if something changes
  its likely a bug...
2014-02-03 11:59:45 +02:00
Panu Matilainen 7c703e1269 Drop signature header region trailer tag quirk
- AFAICT rpm never actually created signature headers with HEADER_IMAGE
  as region trailer tag, except when trying to sign V3 packages with
  old rpm 4.x versions (newer ones refuse to do so). This region trailer
  quirk doesn't actually make such packages work any better, they just
  fail in a different way (such as RhBug:517818)
2014-02-03 11:59:38 +02:00
Panu Matilainen aa9591edd3 Couple of missed newline conversions
- Should've been in commit 9c4bf14e29
2014-02-03 11:58:42 +02:00