platform/upstream/rpm.git
11 years agoPreparing for 4.11.0-beta1 rpm-4.11.0-beta1 upstream/4.10.91
Panu Matilainen [Mon, 10 Dec 2012 13:20:51 +0000 (15:20 +0200)]
Preparing for 4.11.0-beta1

11 years agoEnsure correct return code on malformed signature in packages
Panu Matilainen [Fri, 7 Dec 2012 11:54:23 +0000 (13:54 +0200)]
Ensure correct return code on malformed signature in packages

- rpmpkgRead() starts with assumed failure, but there are a number
  of places assigning the return code, and by the time we get
  to the parsePGPSig() calls its likely to be RPMRC_OK, so the
  jumps to exit result in "all is well" return code on a signature
  we couldn't even parse. Oops.
- Set the failure status explicitly to fix this fairly nasty regression
  introduced in commit e8bc3ff5d780f4ee6656c24464402723e5fb04f4, ie
  rpm >= 4.10.
(cherry picked from commit 96a616c6aed4c516789a154af188f005caf23f14)

11 years agoHandle allocation failure in NSS DSA signature initialization
Panu Matilainen [Tue, 4 Dec 2012 12:06:42 +0000 (14:06 +0200)]
Handle allocation failure in NSS DSA signature initialization
(cherry picked from commit 2d39f13064f6e6ff1a1633b708e7ba5622a7e8eb)

11 years agoFix build with older NSS versions that dont support SHA224
Panu Matilainen [Fri, 30 Nov 2012 10:23:42 +0000 (12:23 +0200)]
Fix build with older NSS versions that dont support SHA224

- SHA224-support was added around NSS 3.13, dont break compilation
  with older versions just for this rarely used hash.
- HASH_AlgSHA224 is an enum so test for SHA224_LENGTH define instead
(cherry picked from commit e15e29823451663e27a5bec6c865b37901f1c315)

11 years agoCondence NSS getHashType() a bit, handle SHA224 too
Panu Matilainen [Fri, 30 Nov 2012 10:20:05 +0000 (12:20 +0200)]
Condence NSS getHashType() a bit, handle SHA224 too

- Not much point in enumurating unsupported cases, or with switch-breaks
  after returns.
- Recognize SHA224 too
(cherry picked from commit 466a6b554e7f7ded9f1c59646e6b64243ce16812)

11 years agoUnbreak --setperms (RhBug:881835)
Panu Matilainen [Fri, 30 Nov 2012 06:15:24 +0000 (08:15 +0200)]
Unbreak --setperms (RhBug:881835)

- Fixes a regression introduced in rpm >= 4.10 caused by query format
  simplification (loss of zero padding support), in commit
  1f1e5e88a1f6c60cf2d11014d809000e97a63aad.
- 'chmod' command doesn't need zero padding, just remove the formatting.
  In fact we shouldn't be passing the entire mode to it but just the
  permission bits, but fortunately chmod isn't too picky here.
(cherry picked from commit 4c90c79e3f3c178189ad3bd89dfd87cd3a2290ab)

11 years agoGet rid of long since deprecated VFY_VerifyDigest() uses
Panu Matilainen [Thu, 29 Nov 2012 10:35:13 +0000 (12:35 +0200)]
Get rid of long since deprecated VFY_VerifyDigest() uses

- VFY_VerifyDigest() has been deprecated since NSS >= 3.12 and for
  a good reason too: with VFY_VerifyDigest() caller needs to painfully
  enumerate every possible supported enc + hash combination, only for
  NSS to revert the process. Use the saner VFY_VerifyDigestDirect()
  interface instead and test for its presence in configure.
- This means we now require NSS >= 3.12 but as that's already 4.5 years
  old and included in ancient beasts like RHEL-4, this doesn't seem
  exactly unreasonable requirement. And then there's always beecrypt...
(cherry picked from commit 9b995a7674adba08248fac79ae8b23ecbecc13de)

11 years agoRemove extra ',' in NSS configure checks, whoops
Panu Matilainen [Thu, 29 Nov 2012 10:31:52 +0000 (12:31 +0200)]
Remove extra ',' in NSS configure checks, whoops
(cherry picked from commit e1c67173d38016a88989f5b09e0934f90094fe85)

11 years agoUse NSS-defined constants for DSA q-bits and signature length too
Panu Matilainen [Thu, 29 Nov 2012 09:05:04 +0000 (11:05 +0200)]
Use NSS-defined constants for DSA q-bits and signature length too

- No functional changes here (either), but using the proper constants
  simply makes things that little bit clearer.
(cherry picked from commit 604da18bc267f89568081c1ab163c7fc45207220)

11 years agoAvoid deprecation warnings from NSS >= 3.14
Panu Matilainen [Thu, 29 Nov 2012 08:43:24 +0000 (10:43 +0200)]
Avoid deprecation warnings from NSS >= 3.14

- NSS >= 3.14 introduces support for DSA2 and marks DSA_SUBPRIME_LEN
  as deprecated. Use explicit DSA1_SUBPRIME_LEN (we only support DSA1
  for now) instead where available, add compatibility define for
  older versions.
- Also directly include <blapit.h> where its defined - blabit.h gets
  included via cryptohi.h but being explicit about it avoids having
  to redefine it again "just in case".
(cherry picked from commit 73be0fc7d9faab9f1120e2979f2ca1feed522195)

11 years agoAdd missing <errno.h> include
Panu Matilainen [Mon, 26 Nov 2012 11:34:06 +0000 (13:34 +0200)]
Add missing <errno.h> include

- Should've been in commit cbd6ef58bbc122e6adf2138679915bd3845d6756,
  this breaks build when selinux-support is not compiled in
(cherry picked from commit ebba1c7b58ba089bb9e1ded147c789d9ca067b6c)

11 years agoAvoid locale issues in rpm2cpio.sh (RhBug:878363)
Panu Matilainen [Thu, 22 Nov 2012 10:22:06 +0000 (12:22 +0200)]
Avoid locale issues in rpm2cpio.sh (RhBug:878363)

- In gawk >= 4.0.x printf() "adjusts" things according to current locale,
  but we need the data as it is. Forcing C locale prevents gawk from
  getting funny ideas about character conversions...
(cherry picked from commit c0e95f1cedefd6d7522ef2cf7a2ada7c83821596)

11 years agoFix double-free on %caps in spec (RhBug:877512)
Panu Matilainen [Sat, 17 Nov 2012 15:57:59 +0000 (17:57 +0200)]
Fix double-free on %caps in spec (RhBug:877512)

- Fixes regression caused by dumb refactoring mistake in commit
  807ba93a6cf168410e3801347898949f356fcd6c
(cherry picked from commit 6bdd34c451dbf69792c59704e06f1ccb045ae743)

11 years agoAdd --undefine cli switch for undefining macros (related to RhBug:876308)
Panu Matilainen [Fri, 16 Nov 2012 11:21:15 +0000 (13:21 +0200)]
Add --undefine cli switch for undefining macros (related to RhBug:876308)
(cherry picked from commit 644f080a4868208bf61f28103b7b676c094129a0)

11 years agoAccount for temporary disk-space requirement on forced replace too
Panu Matilainen [Wed, 14 Nov 2012 10:19:49 +0000 (12:19 +0200)]
Account for temporary disk-space requirement on forced replace too

- Similar to commit 85df102165fdbe64978f2019d757d400e7448218, but
  for forced file replacements.
(cherry picked from commit b1d3f21a54eb1f23a08e9e2d943a6438502b0e47)

11 years agoRemove ancient, no longer relevant comment
Panu Matilainen [Wed, 14 Nov 2012 08:54:38 +0000 (10:54 +0200)]
Remove ancient, no longer relevant comment

- Since commit f7f5f88f9f3d6587e747b034ccb64a3f00ff4e1e, only the first
  instance of shared files is created, the rest are FA_SKIP which
  consume no disk space and are not counted either.
(cherry picked from commit f8da4f613680b4da4ee191f8b7451de9b36bfcbd)

11 years agoAccount for temporary disk-space requirements on updates (ticket #175)
Panu Matilainen [Wed, 14 Nov 2012 08:31:15 +0000 (10:31 +0200)]
Account for temporary disk-space requirements on updates (ticket #175)

- When updating packages, we first create them with a temporary names
  and only after all files from payload have been created this way,
  the files are renamed to the final target. This means that performing
  an update temporarily requires roughly twice the disk space (and inodes)
  compared to the final result on per-package level. Which matters
  when space is tight, such as presumably in RhBug:872314.
- Simulate what happens on upgrades by adding block and inode delta
  to the equation: installing a file always consumes an inode and
  the specified amount of disk space. But when replacing files,
  reduce the size-delta from disk consumption *after* checking for
  problems in a given DSI.
- Also fixes inode accounting which has been broken for forever (since
  commit a9a1fd866c573f41287e6ad256ce64b3970a1eaa more exactly)
(cherry picked from commit 85df102165fdbe64978f2019d757d400e7448218)

11 years agoAdd $RPM_CONFIGDIR/macros.d/ directory to default macro path (RhBug:846679)
Panu Matilainen [Fri, 9 Nov 2012 06:21:51 +0000 (08:21 +0200)]
Add $RPM_CONFIGDIR/macros.d/ directory to default macro path (RhBug:846679)

- There of course already is a drop-in directory for macro config bits
  in $(sysconfdir)/rpm/ but as /etc is supposed to be per-host admin
  territory, having another place for system package provided rpm config
  doesn't seem unreasonable.
- Whether this early in the path is the best possible or even reasonable
  position for this remains to be seen... but this way it could be used
  for "factory default" config bits by rpm itself as well, while still
  permitting vendor/host/user override.
(cherry picked from commit dcd261b9fe1e61e8ac3e99dbb443145bbf896886)

11 years agoAdd cli-switch to query for license files
Panu Matilainen [Thu, 8 Nov 2012 08:26:18 +0000 (10:26 +0200)]
Add cli-switch to query for license files
(cherry picked from commit 4b19c17f53f56c841903e5d6a09efdb10b2ca400)

11 years agoErm, actually mark the special %license files as RPMFILE_LICENSE
Panu Matilainen [Thu, 8 Nov 2012 08:20:24 +0000 (10:20 +0200)]
Erm, actually mark the special %license files as RPMFILE_LICENSE

- Somehow I thought this already got done somewhere... the new special
  %license files need to be marked as RPMFILE_LICENSE for easy querying.
(cherry picked from commit 5998b02665c30a5b560f8fe899c19235f9299bd0)

11 years agoDocument --define in rpmbuild manual as well (RhBug:665536) rpm-4.11.0-alpha upstream/4.10.90
Panu Matilainen [Tue, 6 Nov 2012 11:29:11 +0000 (13:29 +0200)]
Document --define in rpmbuild manual as well (RhBug:665536)

11 years agoDont complain about non-colored arch-specific packages
Panu Matilainen [Mon, 5 Nov 2012 15:15:23 +0000 (17:15 +0200)]
Dont complain about non-colored arch-specific packages

- Non-colored arch-specific packages are very common, for example
  -devel and -debuginfo packages among several other cases for which
  we cant do much about.  Dont whine without a good reason.

11 years agoWork around Fedora-specific patch to libselinux causing warnings
Panu Matilainen [Mon, 5 Nov 2012 14:00:39 +0000 (16:00 +0200)]
Work around Fedora-specific patch to libselinux causing warnings

- In recent Fedora, struct selinux_opt value member is changed to an
  anonymous union of char * and char **. Initialize the members by name
  to avoid warnings in both (patched and unpatched) cases.

11 years agoFix strncat() boundaries in Fdopen()
Dominique Leuenberger [Mon, 5 Nov 2012 13:45:29 +0000 (15:45 +0200)]
Fix strncat() boundaries in Fdopen()

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
11 years agoUpdate contact address in COPYING (RhBug:742362)
Panu Matilainen [Mon, 5 Nov 2012 13:08:28 +0000 (15:08 +0200)]
Update contact address in COPYING (RhBug:742362)

- marc and ewt haven't been valid email addresses in the last 10+
  years, cough...

11 years agoUpdate library current + age (ie libs are now 3.1.0)
Panu Matilainen [Mon, 5 Nov 2012 08:22:50 +0000 (10:22 +0200)]
Update library current + age (ie libs are now 3.1.0)

- We haven't removed or changed any interfaces in a way that would
  require full soname bump, only a handful of new interfaces have
  been added.
- There aren't actually any new interfaces in librpmbuild or librpmsign
  but for sanity and consistency's sake they're all updated...

11 years agoUpdate translations from Transifex
Panu Matilainen [Mon, 5 Nov 2012 08:09:18 +0000 (10:09 +0200)]
Update translations from Transifex

11 years agoEnable built-in %dirname macro
Panu Matilainen [Thu, 1 Nov 2012 10:09:30 +0000 (12:09 +0200)]
Enable built-in %dirname macro

- This might've clashed with %dir in spec %files at some point as
  indicated by the comments, but that should no longer be the case.

11 years agoRename -debug to -debuginfo to match what everybody uses anyway
Panu Matilainen [Thu, 1 Nov 2012 09:45:44 +0000 (11:45 +0200)]
Rename -debug to -debuginfo to match what everybody uses anyway

- Practically everybody renames the debug information sub-packages
  from -debug to -debuginfo, might as well do so upstream already.
  Intended to do this like five years ago but kept forgetting...

11 years agomake "canonicalization(...)shrank by one character" error message more usefull
thierry.vignaud@gmail.com [Fri, 19 Oct 2012 08:08:35 +0000 (10:08 +0200)]
make "canonicalization(...)shrank by one character" error message more usefull

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
11 years agoDon't call "rpm --addsign" if rpmbuild didn't create RPMs.
Tim Landscheidt [Wed, 24 Oct 2012 23:18:57 +0000 (23:18 +0000)]
Don't call "rpm --addsign" if rpmbuild didn't create RPMs.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
11 years agoHide the strpool-related rpmts/rpmfi/rpmds interfaces out of sight for now
Panu Matilainen [Thu, 1 Nov 2012 07:45:15 +0000 (09:45 +0200)]
Hide the strpool-related rpmts/rpmfi/rpmds interfaces out of sight for now

- In the package/transaction related things the strpool is more of
  an internal implementation detail than an end-goal in itself, move
  string pool related interfaces of rpmts, rpmfi and rpmds to
  internal-only APIs for now. The kind interfaces we'll want to eventually
  export a) dont exist yet and b) are likely to be something very different.
- The string pool itself remains exported however, its a handy data
  structure for all sorts of things and both librpm and librpmbuild
  heavily use it already.

11 years agoUse private NSS context if NSS supports it (RhBug:871485)
Panu Matilainen [Wed, 31 Oct 2012 07:43:38 +0000 (09:43 +0200)]
Use private NSS context if NSS supports it (RhBug:871485)

- Older NSS versions operate on global context, which can cause
  all sorts of trouble when an API user tries to use NSS for their
  own purposes: eg they might want to use NSS databases which is not
  possible once we've initialized NSS with NSS_NoDB_Init(). Further
  background on the subject at https://wiki.mozilla.org/NSS_Library_Init
- Use private private NSS context when possible (NSS >= 3.12.5) to
  avoid such clashes, but keep support for older versions for now.

11 years agoHandle EINTR in Fread() and Fwrite()
Panu Matilainen [Tue, 30 Oct 2012 10:38:20 +0000 (12:38 +0200)]
Handle EINTR in Fread() and Fwrite()

- Not all systems automatically restart signal-interrupted operations,
  handle this centrally since its so easy to do. Also related to
  RhBug:580974.

11 years agoHandle partial reads and errors in package IO (RhBug:802839, RhBug:580974)
Panu Matilainen [Tue, 30 Oct 2012 09:36:56 +0000 (11:36 +0200)]
Handle partial reads and errors in package IO (RhBug:802839, RhBug:580974)

- There are no guarantees Fread() will return all of the requested size:
  it can return partial data eg on signals and pipe descriptors. Introduce
  a helper function to handle this centrally for all package read IO,
  effectively reintroducing timedRead() but without the caveats:
  timedRead() did not work on compressed streams, did not handle
  eg EINTR correctly and while really being an internal helper,
  was exported in the API.

11 years agoFix missing error on --import on bogus key file (RhBug:869667)
Panu Matilainen [Tue, 30 Oct 2012 07:29:46 +0000 (09:29 +0200)]
Fix missing error on --import on bogus key file (RhBug:869667)

- When the "BEGIN PGP" marker is not found at all, we would silently
  exit with success when trying to import utter garbage, such as
  rpmkeys --import /bin/bash (not that I consider bash as gargabe ;)

11 years agoRemove transition-time leftover pool unfreezing
Panu Matilainen [Fri, 26 Oct 2012 09:15:07 +0000 (12:15 +0300)]
Remove transition-time leftover pool unfreezing

- Nobody is freezing our pool so there's no need to unfreeze it either...

11 years agoEliminate static "misc stuff pool" from rpmfi
Panu Matilainen [Fri, 26 Oct 2012 08:47:31 +0000 (11:47 +0300)]
Eliminate static "misc stuff pool" from rpmfi

- Prior to string pool existence, the static "caches" were kinda
  necessary for sharing the relatively static content of user/group
  names and file languages, but this is nothing but an unfreeable
  block of memory at this point. Just use the same pool as everything
  else - whether private or shared.

11 years agoEliminate copy-paste nibble(), use rnibble() instead
Panu Matilainen [Fri, 19 Oct 2012 13:20:02 +0000 (16:20 +0300)]
Eliminate copy-paste nibble(), use rnibble() instead

11 years agoDefault to NSS crypto though...
Panu Matilainen [Fri, 19 Oct 2012 12:45:14 +0000 (15:45 +0300)]
Default to NSS crypto though...

- NSS is a big and quirky monster for our needs but that's what we've
  been defaulting to for the last years, and then there are those
  certifications...
- Also default to external beecrypt even if --with-beecrypt is used

11 years agoAdd support for beecrypt as an alternative crypto implementation
Michael Schroeder [Fri, 19 Oct 2012 12:43:09 +0000 (15:43 +0300)]
Add support for beecrypt as an alternative crypto implementation

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
11 years agoDont bother with digest and link comparisons if size differs, part II
Panu Matilainen [Fri, 19 Oct 2012 10:54:11 +0000 (13:54 +0300)]
Dont bother with digest and link comparisons if size differs, part II

- If link or regular file sizes differ, they cannot possibly be
  identical. Saves us from doing bunch of pointless string and
  memory comparisons on what's a very busy path - not exactly a huge
  with but measurable nevertheless.

11 years agoDont bother with %config digests on conflicts if size differs
Panu Matilainen [Fri, 19 Oct 2012 10:45:04 +0000 (13:45 +0300)]
Dont bother with %config digests on conflicts if size differs

- Files of different size cannot possibly be identical, dont bother
  with expensive digest calculation.

11 years agoFix noarch __isa_* macro filter in installplatform (RhBug:865436)
Panu Matilainen [Thu, 11 Oct 2012 14:57:10 +0000 (17:57 +0300)]
Fix noarch __isa_* macro filter in installplatform (RhBug:865436)

- The filter wasn't doing what it was supposed to due to extra single
  quotes getting inserted, causing "rpmbuild --target noarch foo.spec"
  to whine about empty macro bodies. This is a regression introduced
  in rpm 4.10, commit 07ec480c180e4005a629242b8f9f8ab640e3e950 to be
  precise.

11 years agoEliminate now unnecessary WITH_SELINUX conditionals in sepolicy plugin
Panu Matilainen [Thu, 11 Oct 2012 12:14:04 +0000 (15:14 +0300)]
Eliminate now unnecessary WITH_SELINUX conditionals in sepolicy plugin

11 years agoOnly try compiling sepolicy plugin if selinux is enabled
Panu Matilainen [Thu, 11 Oct 2012 12:09:15 +0000 (15:09 +0300)]
Only try compiling sepolicy plugin if selinux is enabled

11 years agoMissing include in string pool
Panu Matilainen [Thu, 11 Oct 2012 12:04:54 +0000 (15:04 +0300)]
Missing include in string pool

- When compiled without selinux support, stdlib.h doesn't get
  included here. Wtf?

11 years agoRevert "Update man page to reflect that rpm no longer uses MD5 as a default digest...
Florian Festi [Thu, 11 Oct 2012 10:20:06 +0000 (12:20 +0200)]
Revert "Update man page to reflect that rpm no longer uses MD5 as a default digest algorithm"

This reverts commit b040b323d6fac32f7f4fa77fd5cb60c7967fc53f.

The change does only affect file digests.

11 years agoAdd rpm --setperms and rpm --setugids to the man page
Florian Festi [Wed, 10 Oct 2012 12:59:32 +0000 (14:59 +0200)]
Add rpm --setperms and rpm --setugids to the man page

11 years agoUpdate man page to reflect that rpm no longer uses MD5 as a default digest algorithm
Florian Festi [Wed, 10 Oct 2012 11:17:09 +0000 (13:17 +0200)]
Update man page to reflect that rpm no longer uses MD5 as a default digest algorithm

11 years agoAdd lua 5.2 support.
Anders F Bjorklund [Wed, 12 Sep 2012 21:26:38 +0000 (23:26 +0200)]
Add lua 5.2 support.

Add compatibility support for both lua-5.1 and lua-5.2,
assuming that the LUA_COMPAT might have been disabled.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
11 years agoDon't bother calculating digests of %ghost %config files
Panu Matilainen [Mon, 8 Oct 2012 06:27:18 +0000 (09:27 +0300)]
Don't bother calculating digests of %ghost %config files

- Calculating digest of %ghost config is useless as there's nothing
  to compare the result to. Also we never take backups of %ghost
  configuration anyway, so this is a total waste of time. One common
  case of %ghost %config is the rpmdb (environment and all) which
  can be rather large and calculating digests can take several seconds,
  only for the results to be thrown away unused.
- There are some cases where it might be reasonable to back up %ghost
  %config (eg if it gets replaced by non-config), but
  rpmfiConfigConflictIndex() doesn't have sufficient context to figure
  that out. For now, preserve the traditional simple rule: no backups
  for ghosts, ever.

11 years agoUse rpmal lookups for already added obsoletions too
Panu Matilainen [Fri, 5 Oct 2012 08:38:26 +0000 (11:38 +0300)]
Use rpmal lookups for already added obsoletions too

- Related to commit bee348b5d101a0ea6039b56c39e8ddc1cfc09a1a,
  use the newly added obsoletes hash to lookup already added
  obsoleters. Eliminates the dumb linear lookup and is unsurprisingly
  a whole lot faster on larger transactions.

11 years agoAdd a hash + lookup function on obsoletes to rpmal
Panu Matilainen [Fri, 5 Oct 2012 08:35:11 +0000 (11:35 +0300)]
Add a hash + lookup function on obsoletes to rpmal

- Similar lazily created hash as provides for fast obsoletes lookups.
  This is so similar the provides that creation etc functions should
  be unified, but leaving that exercise till later.

11 years agoRename rpmalProvidesHash to rpmalDepHash
Panu Matilainen [Fri, 5 Oct 2012 08:34:22 +0000 (11:34 +0300)]
Rename rpmalProvidesHash to rpmalDepHash

- The same hash type is valid for any ds and we'll be adding more...

11 years agoAvoid changing the file info sets when adding to rpmal file hash
Panu Matilainen [Fri, 5 Oct 2012 08:25:49 +0000 (11:25 +0300)]
Avoid changing the file info sets when adding to rpmal file hash

- Use indexed access to the file info sets so we're not mucking
  around with somebody elses rpmfi iterator index (currently not an
  issue but still...)

11 years agoAvoid changing the dependency sets when looking up from rpmal
Panu Matilainen [Fri, 5 Oct 2012 07:16:44 +0000 (10:16 +0300)]
Avoid changing the dependency sets when looking up from rpmal

- Use indexed access and comparison to avoid mucking around with
  eg transaction element dependency sets while the callers are walking
  over them.

11 years agoAvoid changing the dependency sets when adding to rpmal hash
Panu Matilainen [Fri, 5 Oct 2012 07:13:09 +0000 (10:13 +0300)]
Avoid changing the dependency sets when adding to rpmal hash

- Use indexed access to the dependencies so we're not mucking with
  the rpmds iterator index behind anybodys back, this could affect
  all sorts of things but miraculously nothing is hitting it atm...

11 years agoGuard against NULL ds in the rpmds indexed getters
Panu Matilainen [Fri, 5 Oct 2012 07:09:50 +0000 (10:09 +0300)]
Guard against NULL ds in the rpmds indexed getters

- NULL dependency sets are all over the place as NULL ds means
  "no dependencies of this kind", whereas for eg rpmfi NULL is an
  error.

11 years agoExport the indexed rpmds accessors internally
Panu Matilainen [Fri, 5 Oct 2012 07:07:52 +0000 (10:07 +0300)]
Export the indexed rpmds accessors internally

- Add an internal header for rpmds too to allow adding interfaces we
  dont necessarily want to export in the public API, make the indexed
  accessors available internally.

11 years agoAdd indexed access variants for rpmdsColor() and rpmdsCompare()
Panu Matilainen [Fri, 5 Oct 2012 07:04:04 +0000 (10:04 +0300)]
Add indexed access variants for rpmdsColor() and rpmdsCompare()

- Various places in rpm need random access to the dependency sets,
  save and restore on somebody elses "iterator index" just doesn't
  cut it. This is merely preliminaries for further changes.

11 years agoBe as lazy as possible wrt rpmal hash creation
Panu Matilainen [Thu, 4 Oct 2012 12:48:43 +0000 (15:48 +0300)]
Be as lazy as possible wrt rpmal hash creation

- Separate provides and files hash creation, delay both until the last
  moment before first valid lookup. In practise, this means the provides
  hash is created early due to lookups from rpmtsAddInstallElement(),
  but the big bad file hash creation is delayed until the entire
  transaction set has been more-or-less populated. Which means we have
  a better idea about the necessary hash table size, meaning fewer
  hash resizes, resulting in good deal faster execution with no
  downsides - if something happened to trigger an early file lookup
  it'll all still work, just slower.

11 years agoUse rpmal lookups for finding redundancies in the added set
Panu Matilainen [Tue, 2 Oct 2012 13:40:45 +0000 (16:40 +0300)]
Use rpmal lookups for finding redundancies in the added set

- Replace the dumb linear search across all elements on each
  addition with (filtered) rpmal lookups where possible. rpmal
  doesn't (yet) have obsoletes information so for already added
  obsoletions we have no choice but to walk the walk.
- As a result, findPos() is hugely faster for large transactions
  but rpmal hashes are now generated on the fly for everything
  instead of doing it all at once before the actual dependency
  checks / ordering, which will cost us something in terms of
  hash table resizes.

11 years agoDont bother with rpmRelocateFileList() if relocations have been specified
Panu Matilainen [Tue, 2 Oct 2012 13:17:05 +0000 (16:17 +0300)]
Dont bother with rpmRelocateFileList() if relocations have been specified

- rpmRelocateFileList() doesn't modify anything when no relocations
  are to be done, but what it does is not exactly free, unnecessarily
  calling it is dumb.

11 years agoOnly return non-NULL from rpmalAllSatisfiesDepends() on real matches
Panu Matilainen [Tue, 2 Oct 2012 09:12:20 +0000 (12:12 +0300)]
Only return non-NULL from rpmalAllSatisfiesDepends() on real matches

- The provides hash lookup can and does return hits that dont actually
  satisfy the dependency. Dont bother callers with apparent hits
  (ie non-NULL returns) when nothing actually matches the dependency.

11 years agoExport rpmalAllSatisfiesDepend() internally (again)
Panu Matilainen [Tue, 2 Oct 2012 07:50:10 +0000 (10:50 +0300)]
Export rpmalAllSatisfiesDepend() internally (again)

- For some uses, we need to be more selective about providers...

11 years agoPass the newly create ts element instead of header to findPos()
Panu Matilainen [Tue, 2 Oct 2012 07:37:36 +0000 (10:37 +0300)]
Pass the newly create ts element instead of header to findPos()

- Avoids a little bit of extra work, we already have the relevant
  bits of information in the rpmte and grabbing them from there is
  cheaper than looking up stuff from headers. Also avoids creating
  another copy of the new elements obsoletes dependency set unnecessarily.

11 years agoEliminate all the now unnecessary fsm->ix save-and-restores
Panu Matilainen [Mon, 1 Oct 2012 10:19:59 +0000 (13:19 +0300)]
Eliminate all the now unnecessary fsm->ix save-and-restores

- Now that the relevant places are accepting file index as argument,
  we no longer need to save and restore fsm->ix in all the places
  dealing with hard links.

11 years agoPass file index as argument to fsm fsmMapPath()
Panu Matilainen [Mon, 1 Oct 2012 10:15:30 +0000 (13:15 +0300)]
Pass file index as argument to fsm fsmMapPath()

- Normally this is just the current index, but when writing links
  its something else and makes sense as an argument (so we dont
  need to save and restore fsm->ix when doing something different)

11 years agoPass file index as argument to fsm fsmCommit()
Panu Matilainen [Mon, 1 Oct 2012 10:01:33 +0000 (13:01 +0300)]
Pass file index as argument to fsm fsmCommit()

- Normally this is just the current index, but when writing links
  its something else and makes sense as an argument (so we dont
  need to save and restore fsm->ix when doing something different)

11 years agoPass file index as argument to fsm writeFile()
Panu Matilainen [Mon, 1 Oct 2012 09:54:15 +0000 (12:54 +0300)]
Pass file index as argument to fsm writeFile()

- Normally this is just the current index, but when writing links
  its something else and makes sense as an argument (so we dont
  need to save and restore fsm->ix when doing something different)

11 years agoEliminate current hardlink set from fsm struct
Panu Matilainen [Mon, 1 Oct 2012 09:30:28 +0000 (12:30 +0300)]
Eliminate current hardlink set from fsm struct

- Return the hard link set from saveHardLink() when ready into a local
  variable in the only place that cares: rpmPackageFilesInstall().
  Another pointless and hard-to-follow fsm-global state variable
  gone...

11 years agoPinpoint the one place where fsm->li is modified on real purpose
Panu Matilainen [Mon, 1 Oct 2012 09:16:18 +0000 (12:16 +0300)]
Pinpoint the one place where fsm->li is modified on real purpose

- saveHardLinks() is the only place where fsm->li value matters on
  return: during installation its used for "returning" the current
  link set when all the links in that set have been seen so they
  are ready for creating.

11 years agoAvoid using fsm->li directly when creating pending hard links
Panu Matilainen [Mon, 1 Oct 2012 09:04:29 +0000 (12:04 +0300)]
Avoid using fsm->li directly when creating pending hard links

- fsmMakeLinks() operates on the current link at hand, doesn't walk
  the links or anything... pass the link as an argument from the sole
  caller and operate on that.

11 years agoAvoid using/modifying fsm->li when committing hardlinks
Panu Matilainen [Mon, 1 Oct 2012 08:53:48 +0000 (11:53 +0300)]
Avoid using/modifying fsm->li when committing hardlinks

- Using a "global" variable for local... more of the same:
  fsmCommitLinks() gets called at the end of each round of the install
  loop if there are links, it does the actual link discovery on its
  own and fsm->li state will get rewritten by saveHardLink() at the
  start of the next round.

11 years agoAvoid using/modifying fsm->li when writing links to payload
Panu Matilainen [Mon, 1 Oct 2012 08:47:29 +0000 (11:47 +0300)]
Avoid using/modifying fsm->li when writing links to payload

- Using a "global" variable for local iteration is just... this gets
  called once at the end of package build, fsm->li carries no
  global state here.

11 years agoAvoid using/modifying fsm->li when freeing hard link sets
Panu Matilainen [Mon, 1 Oct 2012 08:39:47 +0000 (11:39 +0300)]
Avoid using/modifying fsm->li when freeing hard link sets

- Using a "global" variable for local iteration is...

11 years agoAvoid using/modifying fsm->li on hard link checking
Panu Matilainen [Mon, 1 Oct 2012 08:37:01 +0000 (11:37 +0300)]
Avoid using/modifying fsm->li on hard link checking

- Using a "global" variable for local iteration is just dumb...

11 years agoMove hardlink saving out of fsmInit()
Panu Matilainen [Mon, 1 Oct 2012 08:33:08 +0000 (11:33 +0300)]
Move hardlink saving out of fsmInit()

- Now that we have separate functions for install, erase and build,
  handle the hardlink saving locally where it matters.

11 years agoFree hardlink sets centrally in fsmFree()
Panu Matilainen [Mon, 1 Oct 2012 06:54:35 +0000 (09:54 +0300)]
Free hardlink sets centrally in fsmFree()

- Having three places doing the same thing doesn't make a whole
  lotta sense...

11 years agoFilter out skipped files on hardlink checking
Panu Matilainen [Mon, 1 Oct 2012 06:23:29 +0000 (09:23 +0300)]
Filter out skipped files on hardlink checking

- Legitimately skipped files (links) must not cause install-errors.
  This has always been broken, but the errors were completely ignored
  on install prior to rpm 4.10, and now that we're only creating the
  first instance of a shared file, secondary arch multilib packages
  with hardlinks were causing install failures because of the "missing"
  hardlinks here.
- The relevant part here is obviously the XFA_SKIPPING() test, for
  which we need the file states. To keep the lines short, grab the
  index to a helper variable and replace other fsm->li->filex[i] uses
  with that too.

11 years agoSimplify fpLookupSubdir() a bit
Panu Matilainen [Fri, 28 Sep 2012 09:43:39 +0000 (12:43 +0300)]
Simplify fpLookupSubdir() a bit

- Use string offsets for basename start and end to track the progress,
  avoiding +1/-1 adjustments in every damn calculation.
- Reduce the places where new basename is calculated to just one
  at the start of the main loop, just adjust the basename start
  and end accordingly beforehand.
- This shouldn't change any functionality, just simplify the code
  a little bit.

11 years agoMake string pool strings static in memory
Florian Festi [Fri, 28 Sep 2012 07:23:03 +0000 (10:23 +0300)]
Make string pool strings static in memory

- Use multiple chunks that get allocated as old ones get filled up
  instead of reallocating, store direct pointers to the strings in
  the id array.
- This prevents nasty surprises when previously retrieved pointer
  to a pool string goes invalid underneath us due to somebody
  adding a new string, and restores former rpm API behavior:
  string pointers retrieved from eg rpmds and rpmfi are valid for
  the entire lifetime of those objects.

11 years agoMinimally resurrect fpLookupSubdir() functionality
Panu Matilainen [Thu, 27 Sep 2012 12:56:56 +0000 (15:56 +0300)]
Minimally resurrect fpLookupSubdir() functionality

- fpLookupSubdir() has been broken for a long, long time, probably
  because some subtle extra/missing slash issue. It got totally
  wrecked by the pool changes though: there are heading and trailing
  slashes everywhere and the calculations were off-by-one to every
  possible direction because of that. And the previous attempts
  (eg commit 566a332c6907a0969ea8f79a4c7a62bca2d1f1b4) makes
  even a bigger mess of it.
- This is far messier than it needs to be, but for now going for
  minimal resurrection rather than rewrite it all at once. It's also
  not quite right either, but it does now actually detect at the conflicts
  it was always supposed to.

11 years agoAdd doxygen documentation to string pool API
Panu Matilainen [Thu, 27 Sep 2012 10:11:03 +0000 (13:11 +0300)]
Add doxygen documentation to string pool API

11 years agoFixup a copy-paste error in rpmdsPool() doxygen markup
Panu Matilainen [Thu, 27 Sep 2012 10:09:39 +0000 (13:09 +0300)]
Fixup a copy-paste error in rpmdsPool() doxygen markup

11 years agoFixup string pool prototype argument names to match implementation
Panu Matilainen [Thu, 27 Sep 2012 09:18:39 +0000 (12:18 +0300)]
Fixup string pool prototype argument names to match implementation

- Just a simple s/sidpool/pool/ to match the implementation, "sidpool"
  is a leftover from early draft version that somehow made its way
  to the master tree.

11 years agoRemove leftover, no longer valid comment
Panu Matilainen [Thu, 27 Sep 2012 08:43:17 +0000 (11:43 +0300)]
Remove leftover, no longer valid comment

11 years agoFreeze the rpmfc string pools once all additions are done
Panu Matilainen [Wed, 26 Sep 2012 09:52:13 +0000 (12:52 +0300)]
Freeze the rpmfc string pools once all additions are done

- Memory use isn't typically that critical during build, but saving
  a little bit of it doesn't hurt anyway...

11 years agoDont waste time with argi for rpmfc file class indexes
Panu Matilainen [Wed, 26 Sep 2012 09:32:32 +0000 (12:32 +0300)]
Dont waste time with argi for rpmfc file class indexes

- argiAdd() isn't as costly as argvAdd(), but it still involves unnecessary
  reallocation on every addition as the number of files is predetermined,
  and each file has an associated class index.
- Additionally fixes a mostly harmless glitch introduced in commit
  65e616cc9fdd00f523939088fab1070021b9f742: the pool id's are one larger
  than the indexes we store in headers, take this into account in the
  debug output.

11 years agoDont waste time with argi for rpmfc file colors
Panu Matilainen [Wed, 26 Sep 2012 09:02:27 +0000 (12:02 +0300)]
Dont waste time with argi for rpmfc file colors

- argiAdd() isn't as costly as argvAdd(), but it still involves unnecessary
  reallocation on every addition as the number of files is predetermined,
  and each file has an associated color (whether its zero or something else)

11 years agoDont waste time with argv for rpmfc file names
Panu Matilainen [Wed, 26 Sep 2012 08:31:41 +0000 (11:31 +0300)]
Dont waste time with argv for rpmfc file names

- argvAdd() gets more and more costly as the number of files increase,
  use a plain old string array where one is called for: the size
  is predetermined (from another argv) and we're just copying the
  strings for internal storage here. We do need to pay a little bit
  more attention to details now though.

11 years agoUse a string pool for the build-time file dependency string storage
Panu Matilainen [Wed, 26 Sep 2012 07:26:53 +0000 (10:26 +0300)]
Use a string pool for the build-time file dependency string storage

- The pool is mostly just a dumb storage space for this case, but
  insertion to pool is far more efficient than argv search, add,
  sort operation. The order does not matter as the actual information
  is encoded in the string and then painfully parsed out again. This
  could really use a special-purpose data structure for sanity but...

11 years agoUse a string pool to build file class dictionary and indexes
Panu Matilainen [Wed, 26 Sep 2012 06:56:18 +0000 (09:56 +0300)]
Use a string pool to build file class dictionary and indexes

- The string pool is a natural fit for this and much more efficient
  when the number of files (and classes) is large.
- This does have an effect on the generated classdict array: it's no
  longer sorted, and we no longer always (possibly unnecessarily)
  insert an empty string and "directory" in it, but only when they
  actually exist. Neither change makes any difference for usage,
  unless some 3rd party software is making assumptions about the
  classdict contents they shouldn't be making (very unlikely anyway)

11 years agoCosmetics: properly indent the rpmfc debug foobar
Panu Matilainen [Wed, 26 Sep 2012 06:41:30 +0000 (09:41 +0300)]
Cosmetics: properly indent the rpmfc debug foobar

11 years agoAdd function to get number of unique strings in the pool
Panu Matilainen [Wed, 26 Sep 2012 05:34:40 +0000 (08:34 +0300)]
Add function to get number of unique strings in the pool

11 years agoSwitch back to early added packages rpmal populating
Panu Matilainen [Mon, 24 Sep 2012 08:57:55 +0000 (11:57 +0300)]
Switch back to early added packages rpmal populating

- Basically reverts commit d10a9941326f7d397428c8ab0b4ba571cfc6c184
  which was just a temporary transition-period thing. Moving pointers
  dont bother us anymore...

11 years agoTest obsoletions within the transaction set, both ways
Panu Matilainen [Mon, 24 Sep 2012 08:56:34 +0000 (11:56 +0300)]
Test obsoletions within the transaction set, both ways

- Similar to commit f7c1eb5ef041b9b06cbb81dac7d7972a602cad44 but
  on obsoletions

11 years agoTest different versions in same transaction both ways
Panu Matilainen [Mon, 24 Sep 2012 08:51:49 +0000 (11:51 +0300)]
Test different versions in same transaction both ways

- Different versions can happen two ways: older first or older last,
  test both cases
- Add verbose output for install to get the warning messages too and
  require that matches as well

11 years agoTake advantage of rpmstrPoolStreq() in rpmdsCompare()
Panu Matilainen [Fri, 21 Sep 2012 12:49:11 +0000 (15:49 +0300)]
Take advantage of rpmstrPoolStreq() in rpmdsCompare()

- This gives quite a speedup for dependency checking as within
  transaction, all the dependency sets come from the same pool
  and making this just an integer comparison.