tools/librpm-tizen.git
12 years agoAdd rpmfiFooIndex() variants for the conflict handling methods
Panu Matilainen [Thu, 12 Apr 2012 14:39:32 +0000 (17:39 +0300)]
Add rpmfiFooIndex() variants for the conflict handling methods

- Preliminaries for handling file conflicts within a package:
  Using rpmfi's self-iterator limits access to the file info to
  one caller at a time, in order to self-file conflicts we'll need
  to be able to access the same rpmfi at different indexes simultaneously.
- As these are public API's, add compat wrappers for the self-iterator
  use (although AFAIK nothing except rpm itself uses these)

12 years agoFurther tweak the config file removal/backup logic to make it clearer
Panu Matilainen [Thu, 12 Apr 2012 14:27:24 +0000 (17:27 +0300)]
Further tweak the config file removal/backup logic to make it clearer

- Turn the strange negated condition around: when dealing with
  config files test for it directly. This way, all the special
  cases are handled first and normal cases fall through the if-jungle
  to exactly one case of rpmfsSetAction(fs, i, FA_ERASE). Makes
  the logic more obvious, at least to me.

12 years agoAvoid unnecessary calls to rpmfiFN()
Panu Matilainen [Thu, 12 Apr 2012 13:59:07 +0000 (16:59 +0300)]
Avoid unnecessary calls to rpmfiFN()

- handleOverlappedFiles() only needs the file name in a couple
  of relatively rare special cases. Constructing the fn more
  expensive than other rpmfi-calls, dont bother unless actually needed.

12 years agoMake config file modification detection a bit more readable
Panu Matilainen [Thu, 12 Apr 2012 13:27:08 +0000 (16:27 +0300)]
Make config file modification detection a bit more readable

12 years agoMake rpmfiFNIndex() safe for callers on different indexes
Panu Matilainen [Thu, 12 Apr 2012 12:15:26 +0000 (15:15 +0300)]
Make rpmfiFNIndex() safe for callers on different indexes

- Previously this would return a pointer to an internal per-rpmfi buffer
  whose contents get silently overwritten on each call to rpmfiFNIndex(),
  making it unsafe for unsafe for random access for more than one
  active caller (such code does not currently exist in rpm though)
- Make rpmfiFNIndex() always return freshly allocated memory, and adjust
  the rpmfiFN() iteration wrapper to free and realloc the internal
  "buffer" on each call. It's a wee bit slower than before but it's
  not called *that* much, and if needed there are ways to optimize it.

12 years agoOops, automake isn't happy with comment here...
Panu Matilainen [Thu, 5 Apr 2012 13:57:29 +0000 (16:57 +0300)]
Oops, automake isn't happy with comment here...

12 years agoArrange unified /bin <-> $(bindir) in test-suite root
Panu Matilainen [Thu, 5 Apr 2012 11:21:27 +0000 (14:21 +0300)]
Arrange unified /bin <-> $(bindir) in test-suite root

- Rpm traditionally insists on putting itself into /bin and expects
  to find various things, especially /bin/sh there as well. This
  is normally the case, but on systems where the host /bin is symlink
  to eg /usr/bin, the test-suite /bin will be empty except for rpm
  itself causing a big number of bogus test-suite failures. Making
  test-suite root bin/ always a symlink to $(bindir) avoids this issue
  and works whether the host /bin is a real directory or not.

12 years agoFix test-suite root population wrt "optional" directories
Panu Matilainen [Thu, 5 Apr 2012 10:27:51 +0000 (13:27 +0300)]
Fix test-suite root population wrt "optional" directories

- /proc, /sys and especially selinux directories are mostly Linux
  creatures and even those vary between versions. Use if to avoid
  the error code "leaking" in case the last directory is not present.

12 years agoHandle obsolete matches (more) correctly in rpmal
Panu Matilainen [Thu, 5 Apr 2012 08:32:38 +0000 (11:32 +0300)]
Handle obsolete matches (more) correctly in rpmal

- Similar to commit 9fb81eac0bcd239e46459f72916099f1adfc5cb9 but
  on the to-be-installed set: obsoletes should only be matched against
  package names, not any provide or file names. Hasn't really mattered
  previously due to the way its called, but since commit
  05487d9a3f763cfed5f5ca75b4fbadb62f38dfd6 I guess it started to matter.
  It's more correct this way anyhow, and should fix RhBug:810077.
- Since rpmal only knows about provides, we need to handle obsoletes
  as a special case and filter out matches on provide names different
  than the matching package name.

12 years agoRemove unused scareFlags member from rpmfi struct
Panu Matilainen [Wed, 4 Apr 2012 14:30:04 +0000 (17:30 +0300)]
Remove unused scareFlags member from rpmfi struct

- This is just a leftover from rpm < 4.7.x days

12 years agoValidate negated offsets too in headerVerifyInfo()
Panu Matilainen [Tue, 14 Feb 2012 09:27:46 +0000 (11:27 +0200)]
Validate negated offsets too in headerVerifyInfo()

- Undo the ancient broken fix for RhBug:71996 from commit
  9e06e3b8ca76ae55eaf2c4e37ba9cac729789014: instead of disabling
  the check, pass in the correct upper range which is entirely
  different from everything else for the region trailer tag.
- Fixes CVE-2012-0815

12 years agoDifferentiate between non-existent and invalid region tag
Panu Matilainen [Wed, 18 Jan 2012 08:56:35 +0000 (10:56 +0200)]
Differentiate between non-existent and invalid region tag

- Non-existent region tag is very different from existing but invalid
  one - the former is not an error but the latter one is, and needs
  to be handled as such. Previously an invalid region tag would cause
  us to treat it like rpm v3 package on entry, skipping all the region
  sanity checks and then crashing and burning later on when the immutable
  tag is fetched.
- Refer to REGION_TAG_TYPE instead of RPM_BIN_TYPE wrt the expected
  type of region tag for consistency and clarity, they are the same
  exact thing though.
- Should unify these damn copy-slop check one of these days, sigh...
  For now, settling for the easily backportable approach.
- Fixes the other half of CVE-2012-0060

12 years agoSpecifically validate region tag on header import
Panu Matilainen [Thu, 19 Jan 2012 06:25:15 +0000 (08:25 +0200)]
Specifically validate region tag on header import

- Region tags need to have very specific content, the generic
  header tag checks are not sufficient to ensure sanity. Verify
  the tag is one of the known region tags and that the entry has
  expected type and count.
- Fixes the first half of CVE-2012-0060

12 years agoFix gpg-pubkey typos in Japanese manual (RhBug:760552)
Panu Matilainen [Tue, 3 Apr 2012 03:58:30 +0000 (06:58 +0300)]
Fix gpg-pubkey typos in Japanese manual (RhBug:760552)

12 years agoMove internal stuff from fsm.h to fsm.c
Florian Festi [Fri, 30 Mar 2012 12:56:33 +0000 (14:56 +0200)]
Move internal stuff from fsm.h to fsm.c
Reduce fileStage to the three "goal" stages

12 years agoReplace fileStageString() with the __func__ macros in the debugging code
Florian Festi [Fri, 30 Mar 2012 12:51:52 +0000 (14:51 +0200)]
Replace fileStageString() with the __func__ macros in the debugging code
Remove fileStageString()

12 years agoRemove checks for FSM_SYSCALL as FSM_* is going to go away
Florian Festi [Fri, 30 Mar 2012 12:43:43 +0000 (14:43 +0200)]
Remove checks for FSM_SYSCALL as FSM_* is going to go away

12 years agoDrop no longer needed include of fsm.h
Florian Festi [Fri, 30 Mar 2012 12:27:51 +0000 (14:27 +0200)]
Drop no longer needed include of fsm.h

12 years agoKill FSM: Remove remains
Florian Festi [Thu, 29 Mar 2012 13:49:51 +0000 (15:49 +0200)]
Kill FSM: Remove remains

12 years agoKill FSM: Make FSM_PKGBUILD a function
Florian Festi [Thu, 29 Mar 2012 13:49:11 +0000 (15:49 +0200)]
Kill FSM: Make FSM_PKGBUILD a function

12 years agoKill FSM: Make FSM_PKGERASE a function
Florian Festi [Thu, 29 Mar 2012 13:47:41 +0000 (15:47 +0200)]
Kill FSM: Make FSM_PKGERASE a function

12 years agoKill FSM: Make FSM_PKGINSTALL a function
Florian Festi [Thu, 29 Mar 2012 13:44:40 +0000 (15:44 +0200)]
Kill FSM: Make FSM_PKGINSTALL a function

12 years agoPrepare for killing the fsm: Move initial call to FSM from fsmSetup to rpmfsmRun...
Florian Festi [Thu, 29 Mar 2012 12:15:16 +0000 (14:15 +0200)]
Prepare for killing the fsm: Move initial call to FSM from fsmSetup to rpmfsmRun. Make fsm FSM_t.

12 years agoPrepare for killing the fsm: Inline FSM_UNDO; Remove FSM_UNDO calls were fsm->postpon...
Florian Festi [Wed, 28 Mar 2012 10:43:13 +0000 (12:43 +0200)]
Prepare for killing the fsm: Inline FSM_UNDO; Remove FSM_UNDO calls were fsm->postpone is set and FSM_UNDO doesn't do anything.

12 years agoPrepare for killing the fsm: Inline remaining FSM_PROCESS code in FSM_PKGINSTALL
Florian Festi [Wed, 28 Mar 2012 10:30:01 +0000 (12:30 +0200)]
Prepare for killing the fsm: Inline remaining FSM_PROCESS code in FSM_PKGINSTALL

12 years agoPrepare for killing the fsm: Remove superfluous check for being in FSM_PROCESS to...
Florian Festi [Wed, 28 Mar 2012 10:12:42 +0000 (12:12 +0200)]
Prepare for killing the fsm: Remove superfluous check for being in FSM_PROCESS to allow killing FSM_PROCESS. fsmVerify is only called while being in FSM_PROCESS.

12 years agoPrepare for killing the fsm: Make FSM_COMMIT a function
Florian Festi [Wed, 28 Mar 2012 08:05:21 +0000 (10:05 +0200)]
Prepare for killing the fsm: Make FSM_COMMIT a function

12 years agoPrepare for killing the fsm: Move build code from PSM_PROCESS to FSM_PKGBUILD
Florian Festi [Wed, 28 Mar 2012 07:34:05 +0000 (09:34 +0200)]
Prepare for killing the fsm: Move build code from PSM_PROCESS to FSM_PKGBUILD

12 years agoPrepare for killing the fsm: Move code for erasing files from FSM_COMMIT to FSM_ERASE
Florian Festi [Wed, 28 Mar 2012 07:19:15 +0000 (09:19 +0200)]
Prepare for killing the fsm: Move code for erasing files from FSM_COMMIT to FSM_ERASE

12 years agoPrepare for killing the fsm: Inline FSM_DESTROY in fsmTeardown()
Florian Festi [Tue, 27 Mar 2012 15:52:13 +0000 (17:52 +0200)]
Prepare for killing the fsm: Inline FSM_DESTROY in fsmTeardown()

12 years agoPrepare for killing the fsm: Inline FSM_FINI code.
Florian Festi [Tue, 27 Mar 2012 15:26:49 +0000 (17:26 +0200)]
Prepare for killing the fsm:  Inline FSM_FINI code.
Move cleaning the stat_s structs to fsmInit() (beginning of the loop instead of the end)
Drop freeing fsm->path as this is done in fsmInit() and fsmTeardown()

12 years agoPrepare for killing the fsm: Inline the FSM_NOTIFY code
Florian Festi [Tue, 27 Mar 2012 15:03:04 +0000 (17:03 +0200)]
Prepare for killing the fsm: Inline the FSM_NOTIFY code

12 years agorpmbuild: warn if header color differs from color of the package architecture.
Ales Kozumplik [Tue, 3 Jan 2012 15:04:18 +0000 (16:04 +0100)]
rpmbuild: warn if header color differs from color of the package architecture.

- For example, warn when building an x86_64 package that only contains 32
  bit binaries.
- This should indicate to the maintainers that they might have gotten the
  architecture wrong.
- Introduces 'archcolor' in rpmrc so we can map architectures to colors.
- Related: RhBug:713323

12 years agoAxe leftover CANONARCH assignment messing up our "base" archs (RhBug:808250)
Panu Matilainen [Fri, 30 Mar 2012 06:56:43 +0000 (09:56 +0300)]
Axe leftover CANONARCH assignment messing up our "base" archs (RhBug:808250)

- This should've been in commit 2a8d03669732f68f02fa7b21ec87ee3f65d11e5b,
  the leftover CANONARCH resets the "base arch" we just set to a wrong
  value.

12 years agoAccept files as command line arguments again in rpmdeps (RhBug:807767)
Panu Matilainen [Thu, 29 Mar 2012 08:26:57 +0000 (11:26 +0300)]
Accept files as command line arguments again in rpmdeps (RhBug:807767)

- Commit a25c3c7bac95ab7eb55f0ecf0b8793d8da341611 removed what was
  supposedly a non-supported method of passing files as arguments
  (instead of the normal stdin method) to rpmdeps. Turns out
  rpmdeps is even documented to take files as cli args, and that's
  how Fedora's %filter_setup macros are calling it...
- Allow files as arguments again, but in a way that doesn't cause
  argvFoo() vs popt crash-n-burn.

12 years agoInline FSM_NEXT
Florian Festi [Tue, 27 Mar 2012 12:22:46 +0000 (14:22 +0200)]
Inline FSM_NEXT

12 years agoRemove left over debugging code
Florian Festi [Tue, 27 Mar 2012 12:31:50 +0000 (14:31 +0200)]
Remove left over debugging code

12 years agoMove fsm_s to fsm.c and remove fsmNext() from fsm.h
Florian Festi [Tue, 27 Mar 2012 09:25:49 +0000 (11:25 +0200)]
Move fsm_s to fsm.c and remove fsmNext() from fsm.h

12 years agoRemove Fseek() code from rpmcpioHeaderRead for now
Florian Festi [Tue, 27 Mar 2012 09:09:45 +0000 (11:09 +0200)]
Remove Fseek() code from rpmcpioHeaderRead for now
Fseek() does not return a proper error code. This needs to be fixed before we can use it as most comprssed files do not support seeking and we need to be able to detect this reliably

12 years agoUntangle lib/fsm.c and lib/cpio.c
Florian Festi [Thu, 22 Mar 2012 12:58:02 +0000 (13:58 +0100)]
Untangle lib/fsm.c and lib/cpio.c

Create cpio_t data type that holds the underlaying FD_t instance
Move padding and position handling and trailer generation into cpio.c
Use only one buffer in the fsm (merging the read and write buffer)
Replace the FSM_EAT, FSM_POS, FSM_PAD, FSM_DREAD, FSM_DWRITE states with cpio functions
Prepend "rpm" to the cpio function names

12 years agoDont bother building internal versions of db utilities we dont need
Panu Matilainen [Mon, 26 Mar 2012 10:03:03 +0000 (13:03 +0300)]
Dont bother building internal versions of db utilities we dont need

- rpmdb_dump, load, recover, verify, stat etc are useful at times,
  but these are not. This also fixes build with internal db for
  more recent versions of Berkeley DB.

12 years agoEliminate broken data end calculation in dataLength()
Panu Matilainen [Fri, 23 Mar 2012 12:17:47 +0000 (14:17 +0200)]
Eliminate broken data end calculation in dataLength()

- If the caller doesn't know the end pointer, we dont have a whole lot
  of chance to come up with a reasonable one either. Just assume
  the terminating \0's are there when end boundary is not specified:
  when this happens we're dealing with relatively "trusted" data
  anyway, the more critical case of reading in unknown headers does
  always pass end pointers.
- While capping the end pointer to HEADER_DATA_MAX seems like a
  reasonable thing to do (as was done in commit
  f79909d04e43cbfbbcdc588530a8c8033c5e0a7c), it doesn't really help
  (bad data would likely run past bounds anyway), and it's not right
  either: the pointer can be to a stack address, and the stack can be
  near the top of addressable range, and ptr + HEADER_DATA_MAX can
  cause pointer wraparound. Notably that's exactly what happens
  when running 32bit personality process on 64bit system on Linux,
  at least in case of i386 process on x86_64, causing all sorts of
  breakage..

12 years agoOops, "magic eight" is necessary here afterall
Panu Matilainen [Thu, 22 Mar 2012 10:24:55 +0000 (12:24 +0200)]
Oops, "magic eight" is necessary here afterall

- Fix regression from commit 807b402d95702f3f91e9e2bfbd2b5ca8c9964ed9,
  the array gets passed as a pointer (how else would it work at all),
  so despite having seemingly correct type, sizeof(keyid) depends
  on the pointer size. This happens to be 8 on x86_64 and friends
  but breaks pgp fingerprint calculation on eg i386.
- Also return the explicit size from pgpExtractPubkeyFingerprint(),
  this has been "broken" for much longer but then all callers should
  really care about is -1 for error.

12 years agoAdd test case for scriptlet behavior
Panu Matilainen [Wed, 21 Mar 2012 08:04:14 +0000 (10:04 +0200)]
Add test case for scriptlet behavior

- The test-root has a shell but rpm doesn't know about it, add a
  fakeshell metapackage that provides it. Should come in handy for
  other cases as well, up to now we've been limited to lua scripts only.
- Test that all the "normal" scripts get executed, in expected order
  and with expected arguments, on install, upgrade and erase.
- This would've saved the rather embarrassing breakage with commit
  274dbf557d1cac90f7c278f9b6d6af05997d92df at least, but better
  late than never as they say... It also serves to highlight and
  document  the arguably broken arguments to %pre- and %posttrans
  scripts (ie always 0)

12 years agoTransaction element file info can be legally NULL in some cases
Panu Matilainen [Wed, 21 Mar 2012 07:07:21 +0000 (09:07 +0200)]
Transaction element file info can be legally NULL in some cases

- rpmteClose() will wipe out the file info to free memory, we only
  should care whether we failed to (re)load the file info. This
  thinko in commit 06a2f1269b035a3a76464149834f2a5a8c4e89f2
  broke %posttrans scriptlets (and without commit
  274dbf557d1cac90f7c278f9b6d6af05997d92df, %pretrans in other
  circumstances), whoopsie *blush*. Now, off to write a test-case
  for our scriptlet behavior...

12 years agoDon't free up file info sets on transaction test-runs, take II
Panu Matilainen [Tue, 20 Mar 2012 14:32:54 +0000 (16:32 +0200)]
Don't free up file info sets on transaction test-runs, take II

- Despite commit cef18c94807af0935b7796c462aab8ed39f0f376, we'd still
  end up freeing the file info sets via rpmteClose() while going
  through the test-transaction packages. This together with commit
  06a2f1269b035a3a76464149834f2a5a8c4e89f2 caused install failures
  on packages which have %pretrans scriptlets, if a test-transaction
  was first performed on the same transaction set that gets used
  for the "real" transaction as well. How wonderfully obscure...

12 years agoBump version to appear newer than 4.10.x branch
Panu Matilainen [Tue, 20 Mar 2012 08:05:49 +0000 (10:05 +0200)]
Bump version to appear newer than 4.10.x branch

12 years agoUpdate translations from Transifex
Panu Matilainen [Tue, 20 Mar 2012 08:00:06 +0000 (10:00 +0200)]
Update translations from Transifex

12 years agoBump library sonames in preparation for new release
Panu Matilainen [Tue, 20 Mar 2012 07:46:42 +0000 (09:46 +0200)]
Bump library sonames in preparation for new release

- This is stupid... only librpm and librpmio actually need the bump due
  to ABI breakage, librpmbuild and librpmsign are unchanged and could
  use just a revision bump. But just incrementing the revision (or age)
  would set us on collision course with maintenance updates to 4.9.x.
  Then again its not like you can actually use librpmbuild or librpmsign
  without also linking to librpm(io) so from everything needs rebuilding
  anyway. This all also pretty much makes the whole libtool library
  versioning a bit moot. Bah.

12 years agoLook up obsoletes both ways on dependency checking (RhBug:804069)
Panu Matilainen [Mon, 19 Mar 2012 14:54:34 +0000 (16:54 +0200)]
Look up obsoletes both ways on dependency checking (RhBug:804069)

- "pure install" like 'rpm -i' never removes anything (long-standing
  behavior that we dont want to change), but that causes us to allow
  installing obsoleting packages without removing what they obsolete,
  which in turn causes errors on verify. Not good.
- This (together with commit 9fb81eac0bcd239e46459f72916099f1adfc5cb9)
  makes obsoletes behave like conflicts in such a case, preventing
  the inconsistency from taking place. Also verify will now whine
  on all the involved packages on inconsistencies.

12 years agoHandle obsoletes (more) correctly in rpmdbProvides()
Panu Matilainen [Mon, 19 Mar 2012 14:51:11 +0000 (16:51 +0200)]
Handle obsoletes (more) correctly in rpmdbProvides()

- Obsoletes should only be matched against package names, not provides,
  or file names for that matter. This hasn't really mattered so far
  due to the way rpmdbProvides() gets called currently, but there's
  a missing case that requires this...

12 years agoFixup couple of md5/digest references regarding verify in the manual
Panu Matilainen [Mon, 19 Mar 2012 10:41:12 +0000 (12:41 +0200)]
Fixup couple of md5/digest references regarding verify in the manual

- '5' in verify stands for digest nowadays, keep the md5 reference to
  explain why 5 is for digest though (related to RhBug:804049)
- In --dump query everything relates to files, refer to the attribute
  in question ie 'digest' instead of 'filedigest'

12 years agoFix find-lang to correctly detect all translations for new gnome help
Vincent Untz [Tue, 13 Mar 2012 15:27:01 +0000 (16:27 +0100)]
Fix find-lang to correctly detect all translations for new gnome help

This was not working for locales with a territory (fr_FR, for instance).

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years agoInclude more package information in the progress output
Panu Matilainen [Mon, 19 Mar 2012 06:43:58 +0000 (08:43 +0200)]
Include more package information in the progress output

- For non-hashed mode, dump the full NEVRA string. This might break
  programs that are parsing the --percent format, but such programs
  almost certainly need adjusting for the added erasure progress anyway.
- For hashed mode, show package NEVR instead of just name. Otherwise
  somebody will sooner or later file a bug on "confusing output"
  as it might seem it's removing what it just installed in upgrade-mode.
  Full NEVRA would be better still but screen estate is tight as it is...
- Also get rid of headerFormat() call here, use RPMTAG_NEVR(A) extensions
  instead.

12 years agoMake a bit more room for names in progress output (cosmetics)
Panu Matilainen [Mon, 19 Mar 2012 06:21:17 +0000 (08:21 +0200)]
Make a bit more room for names in progress output (cosmetics)

12 years agoFix rpm2cpio.sh error exit on unrecognized compression
Panu Matilainen [Thu, 15 Mar 2012 09:41:40 +0000 (11:41 +0200)]
Fix rpm2cpio.sh error exit on unrecognized compression

- This is not a function so it needs to be exit, not return.
  Reported as a side-note in RhBug:803421.

12 years agoUnbreak lua's base64 encode/decode extensions
Panu Matilainen [Wed, 14 Mar 2012 09:30:34 +0000 (11:30 +0200)]
Unbreak lua's base64 encode/decode extensions

- Commit 70f063cb773bedb7d336429d9bc8ed1d4e5d18f4 accidentally
  changed lua's base64 encode/decode interface too, ugh. Dangers of
  search-and-replace... Only the function name string exported to
  lua matters but renaming the internal functions back as well
  for naming consistency.

12 years agoMake rpm2cpio exit code accurate for large packages and partial copy
Panu Matilainen [Wed, 14 Mar 2012 08:09:35 +0000 (10:09 +0200)]
Make rpm2cpio exit code accurate for large packages and partial copy

- Grab the uncompressed payload size from header and compare number
  of bytes copied to that for exit code. Previously, truncated
  payloads could have returned with success. This also fixes the
  exit code for large payloads (RhBug:790396)

12 years agoFix ufdCopy() for large (> 2GB) files
Panu Matilainen [Wed, 14 Mar 2012 08:05:32 +0000 (10:05 +0200)]
Fix ufdCopy() for large (> 2GB) files

- Files can be (much) larger than INT32_MAX, change the return
  type to off_t and fix + simplify the calculations. Fixes the other
  half of RhBug:790396 and makes ufdCopy() usable for other purposes too.

12 years agoTeach rpm2cpio.sh about xz compression (RhBug:674348 & others)
Panu Matilainen [Mon, 12 Mar 2012 13:25:12 +0000 (15:25 +0200)]
Teach rpm2cpio.sh about xz compression (RhBug:674348 & others)

12 years agoEliminate rpmSetTable() from the API
Panu Matilainen [Fri, 9 Mar 2012 11:13:25 +0000 (13:13 +0200)]
Eliminate rpmSetTable() from the API

- Presumably the rpmrc internals still need the magic table tennis
  but nobody else should want to mess with this, reconfiguration
  for another (build) arch is done through rpmReadConfigFiles().

12 years agorpmSetTables() call in rpmbuild has been dying long enough by now
Panu Matilainen [Fri, 9 Mar 2012 11:05:38 +0000 (13:05 +0200)]
rpmSetTables() call in rpmbuild has been dying long enough by now

- The call to rpmSetTables() from rpmbuild is simply redundant for
  all I can tell, it gets called from inside rpmrc/config processing
  with the same values and the extra call here never changes anything
  as the tables have already been set through rpmReadConfigFiles()
  whether building for several targets or not.

12 years agoAllow silent build on automake versions that support it
Panu Matilainen [Fri, 9 Mar 2012 10:16:11 +0000 (12:16 +0200)]
Allow silent build on automake versions that support it

12 years agoWhoops, dont make install progress callbacks on erasure
Panu Matilainen [Thu, 8 Mar 2012 13:12:33 +0000 (15:12 +0200)]
Whoops, dont make install progress callbacks on erasure

12 years agoOptimize python db index instances list generation and fix related leak
Panu Matilainen [Thu, 8 Mar 2012 08:17:47 +0000 (10:17 +0200)]
Optimize python db index instances list generation and fix related leak

- The number of entries is well know, allocate the entire list at
  once and set instead of appending one by one. Also cures a leak from
  created tuples not being decref'ed before - list set steals the
  reference whereas append requires an additional decref to transfer
  the ownership to the list.

12 years agoOptimize header data python conversion for array tags a bit
Panu Matilainen [Thu, 8 Mar 2012 08:02:51 +0000 (10:02 +0200)]
Optimize header data python conversion for array tags a bit

- We know the array size beforehand, allocate the entire array
  at once and set the elements instead of appending one by one.
  This is (an obvious) and well-measurable, if not a huge, win.

12 years agoPull updated translations from Transifex
Panu Matilainen [Wed, 7 Mar 2012 13:02:54 +0000 (15:02 +0200)]
Pull updated translations from Transifex

12 years agoRevert to former spec query behavior + comment
Panu Matilainen [Wed, 7 Mar 2012 12:31:42 +0000 (14:31 +0200)]
Revert to former spec query behavior + comment

- Various tools expect to get the full package list, not just those
  that would actually be built. There are of just as valid reasons
  for only wanting the packages that would be built, but we need
  to make this caller specifiable, just changing the behavior breaks
  existing tools unnecessarily. Add reminder comment why the thing
  is the way it is...

12 years agoAdd --disable-dependency-tracking to %configure options.
Ville Skyttä [Sun, 19 Apr 2009 20:51:19 +0000 (23:51 +0300)]
Add --disable-dependency-tracking to %configure options.

autotools dependency tracking isn't generally useful in rpm builds;
disabling it results in cleaner build logs and possibly slight build
speedups.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years agoWarn but dont fail the build on STABS debuginfo (RhBug:725378, others)
Panu Matilainen [Wed, 7 Mar 2012 11:47:09 +0000 (13:47 +0200)]
Warn but dont fail the build on STABS debuginfo (RhBug:725378, others)

- debugedit doesn't support STABS but there are some crazy cases
  like PPC Linux kernel which contains both STABS and DWARF debuginfo
  sections, manually added. A better fix would be erroring out
  if we didn't find any usable debuginfo and warning otherwise but
  this at least folks get their kernels built.

12 years agoDisable source fetch on build by default (for now) + comment
Panu Matilainen [Wed, 7 Mar 2012 11:40:08 +0000 (13:40 +0200)]
Disable source fetch on build by default (for now) + comment

- We need to grow some digest (and why not external signature as well)
  validation mechanism before we can let rpmbuild download + execute
  arbitrary content from the internet, at least by default.

12 years agoTeach find-lang about the new gnome help layout (RhBug:736523)
Panu Matilainen [Wed, 7 Mar 2012 09:31:15 +0000 (11:31 +0200)]
Teach find-lang about the new gnome help layout (RhBug:736523)

12 years agoGenerate debug symlinks for all filenames sharing a build-id (RhBug:641377)
Jan Kratochvil [Wed, 7 Mar 2012 09:30:19 +0000 (11:30 +0200)]
Generate debug symlinks for all filenames sharing a build-id (RhBug:641377)

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years agoCorrectly quote tr [:blank:] in OCaml dependency scripts.
Richard W.M. Jones [Wed, 22 Feb 2012 11:46:16 +0000 (11:46 +0000)]
Correctly quote tr [:blank:] in OCaml dependency scripts.

This fixes: https://bugzilla.redhat.com/show_bug.cgi?id=796149

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years agoExplicitly remap device numbers along with inodes at build
Panu Matilainen [Wed, 29 Feb 2012 09:04:25 +0000 (11:04 +0200)]
Explicitly remap device numbers along with inodes at build

- Buildroot cannot cross filesystem boundaries without evil tricks,
  which is what the fs boundary sanity check from commit
  7a9a5505667c681044bacb21c9b84ac66c062fe7 was intended to catch.
  However in the case of source rpms, spec and sources can legitimately
  reside on different filesystems (one case of this is rpmbuild -ts
  from cwd on different fs than the %_topdir) and needs to be permitted.
- Since we flatten the inodes to appear from a single filesystem,
  we need to also flatten the device numbers to match this. Turns
  out handling this is simpler than trying to prevent it :) Oh well...
  As we use the actual fs values for build-time hardlink discovery
  this should correctly handle hardlinks even if packaging crosses
  fs boundaries.
- Device number 1 which we use is probably equally bogus on all
  platforms, but this is irrelevant as the device and inode numbers
  are only used for hardlink discovery.

12 years agoOnly consider rpmdb growth for added packages
Panu Matilainen [Tue, 28 Feb 2012 13:22:32 +0000 (15:22 +0200)]
Only consider rpmdb growth for added packages

- Blargh, dumb thinko in previous commit: removed packages wont
  necessarily decrease the rpmdb size, but they dont increase it
  either.

12 years agoFix invalid memory access from rpmdb growth estimation (RhBug:766260)
Panu Matilainen [Tue, 28 Feb 2012 12:53:29 +0000 (14:53 +0200)]
Fix invalid memory access from rpmdb growth estimation (RhBug:766260)

- The dsi retrieved from rpmtsDbDSI() would become invalid whenever
  ts->dsi structure got realloced, ie anytime when disk space is
  calculated for a different fs than where the rpmdb resides. This
  is likely to be the real issue behind RhBug:766260 and also RhBug:671056.
  Just call rpmtsUpdateDSI() directly with suitable arguments for the
  rpmdb to avoid the special (re)alloc paths.
- In addition, consider the db growth for packages with no files too.

12 years agoDon't process spec %include in false branch of %if clauses (RhBug:782970)
Panu Matilainen [Tue, 28 Feb 2012 10:18:10 +0000 (12:18 +0200)]
Don't process spec %include in false branch of %if clauses (RhBug:782970)

12 years agoUnbreak rpm -V output (RhBug:797964)
Panu Matilainen [Tue, 28 Feb 2012 08:31:28 +0000 (10:31 +0200)]
Unbreak rpm -V output (RhBug:797964)

- Commit ac0ab016a5ec31e65eb0c0910a5a6f1199aae3e7 unintentionally
  changed the order of the problems shown in verify strings due to
  a dumb oversight (greetings to self, duh). In other words, this
  fixes a verify output regression in rpm >= 4.9.x by restoring
  the long-standing (and documented) order of the verify output chars.
- Also fix the testcase which unfortunately was only added after
  the output-changing commit so it didn't catch the breakage either :-/

12 years agoAdd a testcase for tag extension bad file name triplet detection
Panu Matilainen [Tue, 21 Feb 2012 14:51:08 +0000 (16:51 +0200)]
Add a testcase for tag extension bad file name triplet detection

12 years agoRaise exception in python on headerGet() invalid data failure
Panu Matilainen [Tue, 21 Feb 2012 14:49:51 +0000 (16:49 +0200)]
Raise exception in python on headerGet() invalid data failure

12 years agoTest for file data tag sanity in fnTag() extensions
Panu Matilainen [Tue, 21 Feb 2012 14:24:18 +0000 (16:24 +0200)]
Test for file data tag sanity in fnTag() extensions

- Basename and dirindex counts must be equal, dirnames count must be
  larger than zero and no larger than number of basenames. Check
  that directory indexes are within range. Additionally file states
  array size, if used, must equal to the genaral file count.

12 years agoFix crash on INSTFILENAMES extension on non-installed package
Panu Matilainen [Tue, 21 Feb 2012 13:59:34 +0000 (15:59 +0200)]
Fix crash on INSTFILENAMES extension on non-installed package

- Packages with no RPMTAG_FILESTATES cannot have installed files
  from our POV, just exit early in that case.
- Rerrange the exit path a bit and only call rpmtdFreeData() on
  file states if the corresponding headerGet() call was actually
  made. Wont make any difference yet, but once we have other jumps
  to exit it will.

12 years agoSanitize filename tag extension handling
Panu Matilainen [Tue, 21 Feb 2012 12:34:57 +0000 (14:34 +0200)]
Sanitize filename tag extension handling

- Rename rpmfiBuildFNames() to fnTag() and push all the td manipulation
  there, making all the various different fn-related tags differ by
  just the arguments to fnTag() and allowing central error etc
  handling. No functional changes (yet) though.

12 years agoFlag error in tag container for non-extension tag retrieval
Panu Matilainen [Tue, 21 Feb 2012 12:14:09 +0000 (14:14 +0200)]
Flag error in tag container for non-extension tag retrieval

- This should mostly be a can't happen case, but at least in theory
  region retrieval could fail. So could unknown data type, but a header
  with unknown data types shouldn't even load... Anyway, there could
  be further error cases we might be able to flag here.

12 years agoAdd error indicator flag for tag data containers
Panu Matilainen [Tue, 21 Feb 2012 11:52:18 +0000 (13:52 +0200)]
Add error indicator flag for tag data containers

- Tag retrieval can in some cases fail, especially so for tag
  extensions. The headerGet() interface doesn't directly allow
  distinguishing between non-existent tag and existent but invalid,
  but we can sneak in that information through in the tag data flags.

12 years agoAdd getter for rpmtd flags
Panu Matilainen [Tue, 21 Feb 2012 11:50:34 +0000 (13:50 +0200)]
Add getter for rpmtd flags

- While these are mostly of rpmtd-internal interest only, there are
  cases when caller might want to know...

12 years agoRemap inode numbers to fit into 32bit integer space on build (RhBug:714678)
Panu Matilainen [Fri, 10 Feb 2012 08:40:45 +0000 (10:40 +0200)]
Remap inode numbers to fit into 32bit integer space on build (RhBug:714678)

- 64bit inode numbers lose their uniquity when brutally truncated
  to 32bit integers as we've done so far. This can and will cause rpm
  (and cpio) to mix up arbitrary file entries as hardlinks and vice versa.
- As the only interesting aspect of inode numbers is whether they're
  equal to something else or not, we dont have to carry the "physical"
  on-disk value to preserve semantics. So we can just remap the
  inode numbers to something that fits our 32bit integer tags
  without causing compatibility complexies with older rpms and
  cpio (and since we can't handle more than INT32_MAX files in a package
  anyway, breaking compatibility for this would be just braindead dumb).
  An extremely simple way to achieve this is to use our
  build-time file list index as the basis of stored inode number.
- In theory this breaks inode-device pairing, but as the buildroot
  cannot span across filesystems in any remotely normal conditions,
  just add a sanity check to catch the dirty tricksters...
- Based on a patch by Zdenek Pavlas, just further simplified and
  buildroot fs boundary sanity check added.

12 years agoAlso test that total size is calculated correctly wrt hardlinks
Panu Matilainen [Thu, 9 Feb 2012 12:16:29 +0000 (14:16 +0200)]
Also test that total size is calculated correctly wrt hardlinks

12 years agoAdd a rough-cut testcase for hardlink handling
Panu Matilainen [Wed, 8 Feb 2012 15:45:34 +0000 (17:45 +0200)]
Add a rough-cut testcase for hardlink handling

- Check that we get expected number of links in package generation,
  that all the files got installed and that the linked files are
  actually hardlinks (for our purposes, plain inode suffices)

12 years agoAdd tag extension to calculate hardlink count for files
Panu Matilainen [Wed, 8 Feb 2012 13:40:02 +0000 (15:40 +0200)]
Add tag extension to calculate hardlink count for files

12 years agoSwitch back to former, much smaller BDB memory pool size (RhBug:752897)
Panu Matilainen [Wed, 8 Feb 2012 08:56:09 +0000 (10:56 +0200)]
Switch back to former, much smaller BDB memory pool size (RhBug:752897)

- A larger cache is beneficial in various scenarios, but triggers
  horrible worst-case performance under memory pressure (or so my
  current theory goes, there might be other factors too). The
  worst-case degration is orders of magnitude bigger than the best-case
  improvements from the larger cache and for many use-cases doesn't
  make a whole lot difference.  We could/should tune the cache with
  priorizing indexes and all, and perhaps dynamically select the
  cache size but for now, the 1Mb cache size is known to "just work".

12 years agoAdd --test option to rpmkeys
Panu Matilainen [Fri, 3 Feb 2012 10:46:22 +0000 (12:46 +0200)]
Add --test option to rpmkeys

- Allows, well, testing whether a key could be imported before actually
  doing it

12 years agoHonor RPMTRANS_FLAG_TEST in rpmtsImportPubkey()
Panu Matilainen [Fri, 3 Feb 2012 10:23:31 +0000 (12:23 +0200)]
Honor RPMTRANS_FLAG_TEST in rpmtsImportPubkey()

12 years agoRemove the arbitrary limitation on transaction keyring change
Panu Matilainen [Thu, 2 Feb 2012 17:13:03 +0000 (19:13 +0200)]
Remove the arbitrary limitation on transaction keyring change

- There are some situations where switching keyrings might be wanted,
  especially as long as we dont export a way to pass keyring as
  an argument to package reading/verification functions. Since thereäs
  no technical reason to disallow it, might as well allow it...

12 years agoDisable signature checking during database rebuild by default
Panu Matilainen [Thu, 2 Feb 2012 12:36:41 +0000 (14:36 +0200)]
Disable signature checking during database rebuild by default

- While it would be perfectly reasonable to perform signature
  checking during db rebuild, this is problematic as long as our
  keys live in the same database we're rebuilding: the environment
  might be paniced, the indexes required for key lookups might be
  corrupt or non-existent etc - one would assume there's a reason for
  the db is getting rebuilt in the first place. When signature checking
  is enabled, we're forced to generate missing indexes on the potentially
  borked database we're just about to rebuild, which might not go very
  well, and since they keyring loading has no clue its getting called
  from middle of db rebuild it'll try to use a shared environment
  which might be broken ... etc.

12 years agoUse private environment for database rebuilds too, document
Panu Matilainen [Thu, 2 Feb 2012 12:31:17 +0000 (14:31 +0200)]
Use private environment for database rebuilds too, document

- One of the more common reasons for users to do --rebuilddb is
  a paniced environment. Throwing DB_RUNRECOVER errors at the user
  who is trying to recover by rebuilding the db isn't terribly
  productive (RhBug:590710). Use a private environment while
  rebuilding for both the original and new database, and dont bother
  with CDB which only slows things down when there are no other
  players present.
- Verify wants the same flags but for different reasons...

12 years agoNever load ts keyring if signature checking is disabled
Panu Matilainen [Thu, 2 Feb 2012 11:53:38 +0000 (13:53 +0200)]
Never load ts keyring if signature checking is disabled

- Loading the pubkeys from database numerous often unwanted side-effects,
  if signature checking is disabled then there's no point loading
  the keys either.
- Commit cad147070e5513312d851f44998012e8f0cdf1e3 did this for
  rpmReadPackageFile() specifically but we really want it honored
  for all operations including headerCheck() and friends, handle
  it centrally in loadKeys() for simplicity.

12 years agoDon't free up file info sets on transaction test-runs
Panu Matilainen [Wed, 1 Feb 2012 15:48:20 +0000 (17:48 +0200)]
Don't free up file info sets on transaction test-runs

- We'd like to get rid of the potentially huge amounts of memory
  eaten by file info sets as early as possible, but when there's a
  chance that we'll get called again with either added transacation
  elements or on-disk changes, such as %pretrans changing something
  underneath us, we need to (be able to) recalculate everything
  from scratch. Only free up the memory when we know we dont need
  it anymore, ie on an actual transaction run.
- This doesn't change anything for rpm itself, for yum and others
  which do a separate test-transaction first, it means %pretrans
  directory<->symlink replacement hacks and the like have a chance
  of working again. I'm sure there's a bug filed on this somewhere but...

12 years agoUse rpmReadHeader() on signature checking path too
Panu Matilainen [Mon, 30 Jan 2012 08:23:51 +0000 (10:23 +0200)]
Use rpmReadHeader() on signature checking path too

- rpmReadHeader() performs far more initial sanity checks on the header
  than headerRead() does, and makes behavior consistent with eg query
  and install paths. As an added bonus we'll get more detailed
  error messages too.