Panu Matilainen [Fri, 21 Nov 2008 21:59:25 +0000 (23:59 +0200)]
Add some basic tests for file conflict behavior
Panu Matilainen [Fri, 21 Nov 2008 21:29:54 +0000 (23:29 +0200)]
Add basic version comparison testing for install/upgrade
Panu Matilainen [Fri, 21 Nov 2008 21:28:21 +0000 (23:28 +0200)]
Simplify the run functions, fix --define behavior
Panu Matilainen [Fri, 21 Nov 2008 15:48:27 +0000 (17:48 +0200)]
Hackery to get rpm install tests to "work" with fakechroot
- fakechroot throws it's own curveballs into the already mixed up thing,
copy things to the test dir and set chroot base to that to avoid
confusion with cwd and such
- klunky and ugly but at least the tests pass now when running non-root
Panu Matilainen [Fri, 21 Nov 2008 15:39:39 +0000 (17:39 +0200)]
Add + use wrapper function for calling rpm commands in tests
- avoids having to define --rcfile etc over and over again
Panu Matilainen [Fri, 21 Nov 2008 14:13:03 +0000 (16:13 +0200)]
Kill the last remaining varprefix
- we're just mangling varprefix to localstatedir anyway, might as well
just avoid that little extra trouble...
Panu Matilainen [Fri, 21 Nov 2008 11:28:35 +0000 (13:28 +0200)]
Define TOPDIR once in atlocal.in
Panu Matilainen [Fri, 21 Nov 2008 10:02:17 +0000 (12:02 +0200)]
These tests are expected to succeed
Panu Matilainen [Fri, 21 Nov 2008 15:59:03 +0000 (17:59 +0200)]
Rpm is supposed to create build tree by itself, don't help it
Panu Matilainen [Fri, 21 Nov 2008 08:04:41 +0000 (10:04 +0200)]
Fix build tree creation with relative paths for %_topdir and friends
- rpmtsRootDir() gives "/" even if root not actually set which makes sense
for most operations but not when we're creating build directories
Panu Matilainen [Fri, 21 Nov 2008 07:50:53 +0000 (09:50 +0200)]
Permit relative paths in rpmioMkpath() and rpmMkdirs()
Panu Matilainen [Fri, 21 Nov 2008 06:57:12 +0000 (08:57 +0200)]
Update --querytags test vrt FILECAPS
Panu Matilainen [Thu, 20 Nov 2008 09:47:52 +0000 (11:47 +0200)]
fpCacheCreate() already doubles the size-hint, dont do it twice
Panu Matilainen [Thu, 20 Nov 2008 08:26:22 +0000 (10:26 +0200)]
Use per-rpmfi string cache for symlink targets
- few files are actually symlinks so this is very sparse data
- per-rpmfi instead of global as link target names are not that likely
to be shared across packages
- another few megs saved...
Panu Matilainen [Thu, 20 Nov 2008 08:15:08 +0000 (10:15 +0200)]
Add functions to create and free string cache(s)
Panu Matilainen [Thu, 20 Nov 2008 07:53:27 +0000 (09:53 +0200)]
Use global cache for file languages too
- there's only a very limited number of language names ever present,
and most files don't have languages attached at all
- another few megs saved on memory
Panu Matilainen [Thu, 20 Nov 2008 07:40:46 +0000 (09:40 +0200)]
Use rpmfiFLangs() instead of direct access to structure in skipFiles()
Panu Matilainen [Thu, 20 Nov 2008 07:36:47 +0000 (09:36 +0200)]
Add rpmfiFLang() method for retrieving file language(s)
- hardly anything needs outside install internals but it's harmless too...
Panu Matilainen [Thu, 20 Nov 2008 07:26:12 +0000 (09:26 +0200)]
Generalize the user+group string cache + helpers
Panu Matilainen [Wed, 19 Nov 2008 16:17:56 +0000 (18:17 +0200)]
Be more intelligent about storing file user and group names
- User and group names contain an enormous amount of redundancy: typically
most files and directories are owned by root:root. Store the each unique
name just once into global cache and store indexes to the cache into
rpmfi user + group arrays. This saves several megabytes of memory on
a transaction of non-trivial size...
- The cache implementation is dumb, but it's not noticeably slower than
uncached version, copying megs of strings around is not cheap either.
Easy enough to replace with a hash-table or such if performace becomes
and issue...
Panu Matilainen [Wed, 19 Nov 2008 14:07:15 +0000 (16:07 +0200)]
Make fsmMapAttrs() use rpmfi methods instead of directly accessing
- Save rpmfi iteration index on entry, restore on exit to avoid clashing
with other users of the given file info set. For now...
- Remove unnecessary re-initialization of uid and gid in case not found
Panu Matilainen [Wed, 19 Nov 2008 13:52:03 +0000 (15:52 +0200)]
Oops, file modes are needed on erase too to avoid suffixes on directories
Panu Matilainen [Wed, 19 Nov 2008 13:46:02 +0000 (15:46 +0200)]
Use matching type for fsm->digest to avoid unnecessary cast
Panu Matilainen [Wed, 19 Nov 2008 12:06:37 +0000 (14:06 +0200)]
Erm erm, really use the rpmfi creation flags in rpmteNew()
- this part was missing from
763cbf05b57da940d2972e0b448548481be400c6
Panu Matilainen [Wed, 19 Nov 2008 11:04:07 +0000 (13:04 +0200)]
Erm, really do lazy allocation of fi->replacedSizes
- this part was missing from
9bde09b59969088c06eb6f5b8a2597b2e04bd306
Panu Matilainen [Tue, 18 Nov 2008 10:00:10 +0000 (12:00 +0200)]
Add + use internal helper function for getting+setting rpmfi replaced sizes
- lazy allocation on set, otherwise there's no replaced size - the getter
deals with this transparently
- saves a fair bit of memory, by no means everything has replaced files...
Panu Matilainen [Wed, 19 Nov 2008 09:59:53 +0000 (11:59 +0200)]
Eliminate unnecessary fi->record field
- transaction elements carry the db instance already and is available
where needed
Panu Matilainen [Wed, 19 Nov 2008 08:02:16 +0000 (10:02 +0200)]
Avoid unnecessary mucking with rpmfi internals
Panu Matilainen [Wed, 19 Nov 2008 07:45:05 +0000 (09:45 +0200)]
Refer to psm->te instead of fi->te in rpmpsmStage()
- transaction element is passed to psm, might as well use it
Panu Matilainen [Wed, 19 Nov 2008 06:16:03 +0000 (08:16 +0200)]
Restore SIGPIPE to default action for scriptlets (rhbz#471591)
Panu Matilainen [Wed, 19 Nov 2008 06:10:21 +0000 (08:10 +0200)]
Updated Brazilian Portugese translation from Igor Pires Soares
Panu Matilainen [Tue, 18 Nov 2008 16:54:26 +0000 (18:54 +0200)]
Use finer grained rpmfi creation flags for in rpmteNew()
- also call the erase flags erase, not remove...
Panu Matilainen [Tue, 18 Nov 2008 16:36:45 +0000 (18:36 +0200)]
Limit the data rpmfi loads in query
- makes queries a little bit faster, hardly makes a difference on
modern hardware but loading unused data seems silly anyhow...
Panu Matilainen [Tue, 18 Nov 2008 16:32:58 +0000 (18:32 +0200)]
Add preliminary rpmfi flag groupings for base operations
- just a start and probably not 100% accurate..
Panu Matilainen [Tue, 18 Nov 2008 15:38:53 +0000 (17:38 +0200)]
Add control bits for all (relevant) parts of rpmfi data
- permit fine grained control over what's loaded into fi for what operations,
non-trivial memory savings are possible
- future possibilities - these reflect closely to rpm verify control
bits, all we need is RPMFI_DISK or similar operation to pull the
information from disk instead of header and then verify can simply
compare two rpmfi's
Panu Matilainen [Tue, 18 Nov 2008 15:12:55 +0000 (17:12 +0200)]
Remove useless default flags and action fields from rpmfi
- fi->actions is always allocated so fi->action is never used for anything
- fi->flags is just as unused and unnecessary
Panu Matilainen [Tue, 18 Nov 2008 14:33:07 +0000 (16:33 +0200)]
Nuke useless rpmfiFContext()
- it only ever returns NULLs because there are no security contexts in
headers (and having them in headers make no sense as the context varies
based on whatever selinux policy happens to be active on the target
system)
Florian Festi [Mon, 17 Nov 2008 12:44:06 +0000 (13:44 +0100)]
Fix indentiation
Jindrich Novy [Tue, 18 Nov 2008 10:23:26 +0000 (11:23 +0100)]
Add AC_CONFIG_MACRO_DIR for the new libtool
Panu Matilainen [Tue, 18 Nov 2008 09:30:43 +0000 (11:30 +0200)]
Don't bother loading FILELANGS for installed packages
- only useful for anything when installing packages
Panu Matilainen [Tue, 18 Nov 2008 04:58:13 +0000 (06:58 +0200)]
Lazy allocation of FSM for file info sets
- new more or less internal rpmfiFSM() to create FSM on demand, move
mapflags calculation there
Panu Matilainen [Tue, 18 Nov 2008 04:28:23 +0000 (06:28 +0200)]
Remove now unnecessary fi->keep_header
Panu Matilainen [Tue, 18 Nov 2008 04:26:02 +0000 (06:26 +0200)]
Remember rpmfi creation flags
Panu Matilainen [Tue, 18 Nov 2008 09:22:26 +0000 (11:22 +0200)]
Generate and insert SOURCERPM tag earlier
- needed to make checking for source/binary package in rpmfiNew() reliable
at build time
Panu Matilainen [Mon, 17 Nov 2008 15:29:31 +0000 (17:29 +0200)]
Add + use internal helper function for setting rpmfi file states
- instead of directly accessing the array from fsm, use a helper function
which lazily allocates the state array as needed and sets state
- also fixes the silly case of non-installed packages showing their files
as "normal", ie installed (now it shows "no state" as it's not relevant)
Panu Matilainen [Mon, 17 Nov 2008 14:12:04 +0000 (16:12 +0200)]
Simplify rpmInstallLoadMacros()
- fi argument unused, remove
- no relevant return value, make it void
- handle any proper data type for per-header macros
Panu Matilainen [Mon, 17 Nov 2008 14:04:48 +0000 (16:04 +0200)]
Avoid reconstructing half of rpmfi manually in rpmInstallSourcePackage()
- similarly to commit
53ee682a491ceee4392815075cabbe58d0cc0c22, arrange
the header to contain necessary paths before calling rpmfiNew()
- avoid unnecessary accesses to rpmfi internals otherwise too
Panu Matilainen [Mon, 17 Nov 2008 12:21:38 +0000 (14:21 +0200)]
Unnecessary local variable, result only needed once
Panu Matilainen [Sat, 15 Nov 2008 16:44:00 +0000 (18:44 +0200)]
Assume failure in rpmInstallSourcePackage()
- avoids bunch of redundant assignments
Panu Matilainen [Mon, 17 Nov 2008 11:39:22 +0000 (13:39 +0200)]
Calculate total file size correctly in build (mdvbz#45820, rhbz#247374)
- delay total size calculation until the real file list is known, ie
in genCpioListAndHeaders() where duplicates and excludes have been
weeded out
Panu Matilainen [Mon, 17 Nov 2008 10:44:57 +0000 (12:44 +0200)]
Make depflagsFormat() accept any numeric type
Panu Matilainen [Mon, 17 Nov 2008 10:42:53 +0000 (12:42 +0200)]
Simplify xmlFormat() by taking advantage of rpmtdClass()
Panu Matilainen [Mon, 17 Nov 2008 10:41:24 +0000 (12:41 +0200)]
Make fflagsFormat() accept any numeric type
Panu Matilainen [Mon, 17 Nov 2008 10:39:13 +0000 (12:39 +0200)]
Make permsFormat() work with any numeric type
Panu Matilainen [Mon, 17 Nov 2008 10:37:42 +0000 (12:37 +0200)]
Make triggertypeFormat() work for any numeric type
Panu Matilainen [Mon, 17 Nov 2008 10:34:22 +0000 (12:34 +0200)]
Make shescapeFormat() to accept any numeric type
Panu Matilainen [Mon, 17 Nov 2008 10:29:01 +0000 (12:29 +0200)]
Take advantage of rpmtdGetNumber() for date format specifiers
- dateFormat() and dayFormat() now work for any numeric type
Panu Matilainen [Mon, 17 Nov 2008 10:23:19 +0000 (12:23 +0200)]
Take advantage of rpmtdGetNumber() for numeric format specifiers
- octalFormat() and hexFormat() now work for any number, not just int32,
fixing rhbz#471820
- use a common helper-function for both formats, they only differ by o/x
Panu Matilainen [Mon, 17 Nov 2008 10:16:51 +0000 (12:16 +0200)]
Simplify stringFormat() by using rpmtdGetNumber()
Panu Matilainen [Mon, 17 Nov 2008 10:04:08 +0000 (12:04 +0200)]
Add rpmtdGetNumber() for getting numeric values from tag container
- returns the value (as opposed to pointer to, like the rpmtdGetUint32()
and the like do) of any numeric type as uint64_t (largest supported
integer type so everything can be converted to it)
- handy when you don't really care what the internal presentation is
- there's no rpmtdGetNextNumber() as there's no meaningful way to return
end-of-iteration here
Panu Matilainen [Mon, 17 Nov 2008 09:31:00 +0000 (11:31 +0200)]
Introduce rpm tag "classes"
- rpm tag data can be either numeric, strings or binary data, each with
their own "subclasses" (different sized integers etc), add new
enumeration for these
- add rpmTagGetClass(), rpmtdClass() public functions for retrieving the
base class of tag and container
- useful for getting a basic idea how to handle tag/container data
Panu Matilainen [Sat, 15 Nov 2008 15:55:47 +0000 (17:55 +0200)]
Use rpmpsmNew() + rpmpsmFree() instead of manually doing the same
Panu Matilainen [Sat, 15 Nov 2008 15:20:13 +0000 (17:20 +0200)]
Eliminate bogus const from fi->apath
Panu Matilainen [Sat, 15 Nov 2008 14:00:36 +0000 (16:00 +0200)]
Eliminate match iterator from psm struct
- it's only needed in local scope anywhere, no point having it psm global
Panu Matilainen [Sat, 15 Nov 2008 12:22:47 +0000 (14:22 +0200)]
Avoid having to reconstruct half of rpmfi manually in genCpioListAndHeader()
- We need the on-disk paths for the cpio list in here, so instead of
creating an rpmfi with wrong paths (for build purposes) and then
painfully reconstructing half the fileinfo structures by hand, pass
the on-disk path into rpmfiNew() to begin with and then switch the
intended cpio path back into header.
- Duplicates and excludes are already filtered out from the header filelist
so walk that instead of spec filelist to avoid having to filter out
duplicates and excludes, again.
Panu Matilainen [Sat, 15 Nov 2008 11:22:19 +0000 (13:22 +0200)]
Lose useless fsm/rpmfi astriplen field
- only "used" for debugging output, duh...
Panu Matilainen [Sat, 15 Nov 2008 10:07:44 +0000 (12:07 +0200)]
Don't bother creating a dummy transaction element for rpmfi in build
- nothing in the build path requires fi->te to be present, so don't
muck with rpmte internals needlessly
Panu Matilainen [Sat, 15 Nov 2008 09:50:09 +0000 (11:50 +0200)]
Minor genCpioListAndHeader() cleanups
- rpmfiNew() only cares about ts for install-time relocations, nothing
to "fix" wrt that
- we know fip is never NULL (this is a static function with whopping two
callers), don't try to cover up for potential programmer errors
Panu Matilainen [Fri, 14 Nov 2008 20:45:42 +0000 (22:45 +0200)]
Don't have to free what's not allocated to begin with...
Panu Matilainen [Fri, 14 Nov 2008 20:44:07 +0000 (22:44 +0200)]
Add more flags to control rpmfi creation
- RPMFI_NOFILELANGS to avoid loading lang data (only useful on install)
- RPMFI_NOFILEOWNER to avoid loading of user+group data
Panu Matilainen [Fri, 14 Nov 2008 15:16:42 +0000 (17:16 +0200)]
Yank rpmfi state update out of rpmtsRun()
- stuff it into internal rpmfiUpdateState() function to get it out of
sight for now, the mechanism needs some...
Panu Matilainen [Fri, 14 Nov 2008 11:05:41 +0000 (13:05 +0200)]
Move open + close of files during install to separate functions
- internal rpmteOpen() and rpmteClose() functions replacing copy-paste
slop between rpmtsRun() and runTransScripts()
- eliminates bunch of rpmte privacy violations
- rpmtsRun() doesn't need the file descriptor for anything, might as well
keep it hidden
Jindrich Novy [Fri, 14 Nov 2008 14:16:08 +0000 (15:16 +0100)]
Allow setting custom parameters to patch (rhbz#471006)
- added new _default_patch_flags macro with the rpm default
"-s" parameter
Panu Matilainen [Fri, 14 Nov 2008 07:47:43 +0000 (09:47 +0200)]
Fix capability verification
- the previous implementation was pretty busted up, cap_size() is the
size of external representation, not sizeof(*cap_t) as pointed out by
Andrew Morgan
- check for cap_compare() in configure and use it if available (it's
a Linux-specific extension to the posix draft and only very recent
libcap has it)
- if cap_compare() isn't available, use internal variant that does it
the hard way by converting the capabilities to external presentation
and comparing those
Panu Matilainen [Thu, 13 Nov 2008 11:22:03 +0000 (13:22 +0200)]
Filter out mtime difference of shared files on verify (rhbz#426672, #444661)
- Since we permit shared files to differ by mtime on installation, it makes
no sense to consider them as verification failure either. This has been
especially bad on multilib where timestamp differences make verify warning
lights look like Las Vegas at night. If file mtime on disk and header
differs, check if it's owned by more than one package and if so, ignore
the timestamp difference.
Panu Matilainen [Thu, 13 Nov 2008 07:56:52 +0000 (09:56 +0200)]
Move ts and preferred color fetching out of the loop
- neither ts or preferred color changes per-file
Panu Matilainen [Wed, 12 Nov 2008 19:58:56 +0000 (21:58 +0200)]
Remove unused fsm subbuf field
Panu Matilainen [Wed, 12 Nov 2008 17:36:58 +0000 (19:36 +0200)]
Don't bother retrieving db offset for erase elements
- not needed anymore, use -1 to mean "unused" and document dboffset
to rpmtsAddEraseElement() as unused
Panu Matilainen [Wed, 12 Nov 2008 17:33:12 +0000 (19:33 +0200)]
Take advantage of headerGetInstance() in removePackage()
- avoids an extra argument, making dboffset argument to
rpmtsAddEraseElement() unused
Panu Matilainen [Wed, 12 Nov 2008 17:24:58 +0000 (19:24 +0200)]
Take advantage of headerGetInstance() in rpmte
- rpmte db_instance and dboffset are exactly the same thing, unify
- pull rpmte->db_instance from header directly, ignore dboffset argument
to rpmteNew() (removing the arg would just break api needlessly, otoh
it's unlikely that anything outside rpm actually uses rpmteNew())
- eliminate the now unnecessary added/removed union from te struct
- rpmteDBOffset() is now just an alias for rpmteDBInstance(), deprecate?
Panu Matilainen [Wed, 12 Nov 2008 16:29:51 +0000 (18:29 +0200)]
Grab rpmfi record from header on rpmfiNew()
- avoids having to muck with it from rpmtsRun()
Panu Matilainen [Wed, 12 Nov 2008 15:58:37 +0000 (17:58 +0200)]
Add rpmdb record number to headers retrieved from rpmdb
- set "instance" number on retrieval from rpmdb
- add public headerGetInstance() function for retrieving the value
- ported from rpm5.org, useful for number of things
Panu Matilainen [Tue, 11 Nov 2008 20:37:12 +0000 (22:37 +0200)]
Convert obvious bits of rpmtsRun() to use rpmfiFAction()
- remaining access to fi->actions is the nasty part of copying things
around to transfer state
Panu Matilainen [Tue, 11 Nov 2008 20:35:45 +0000 (22:35 +0200)]
Convert skipFiles() to rpmfi(Set)FAction()
Panu Matilainen [Tue, 11 Nov 2008 20:32:23 +0000 (22:32 +0200)]
Convert handleOverlappedFiles() to rpmfi(Set)Faction()
Panu Matilainen [Tue, 11 Nov 2008 20:19:29 +0000 (22:19 +0200)]
Convert handleRmvdInstalledFiles() to rpmfiSetFAction()
Panu Matilainen [Tue, 11 Nov 2008 20:17:10 +0000 (22:17 +0200)]
Convert handleInstInstalledFiles() to rpmfi(Set)Faction()
Panu Matilainen [Tue, 11 Nov 2008 20:09:48 +0000 (22:09 +0200)]
Add rpmfi get + set methods for file actions
Panu Matilainen [Tue, 11 Nov 2008 19:06:32 +0000 (21:06 +0200)]
Remove unnecessary initialization
- rpmfiNew() zeroes out everything, including striplen + astriplen
Panu Matilainen [Tue, 11 Nov 2008 19:01:02 +0000 (21:01 +0200)]
Move file action calculations to rpmfiNew() where possible
- for build operations and src.rpm install this is known
Panu Matilainen [Tue, 11 Nov 2008 18:48:35 +0000 (20:48 +0200)]
Cpio flags are only relevant for fsm, get them out of rpmfi
Panu Matilainen [Tue, 11 Nov 2008 12:50:53 +0000 (14:50 +0200)]
Figure out cpio mapflags in rpmfiNew()
- all the necessary info is there, no need to litter the logic all over
the place
Panu Matilainen [Tue, 11 Nov 2008 11:53:31 +0000 (13:53 +0200)]
Push archivePos from rpmfi to fsm
- archive position is only meaningful in fsm context anyway
Panu Matilainen [Tue, 11 Nov 2008 15:35:42 +0000 (17:35 +0200)]
Adjust rpmfi directory count while messing with it in build
- otherwise we can miss some entries in rpmfiFN() max calculation and
blow up in entertaining ways
Jindrich Novy [Mon, 10 Nov 2008 14:52:29 +0000 (15:52 +0100)]
Add the post-build package checker feature in rpmbuild (upstream ticket #2)
- allow to run helper programs to check:
- generated SRPM
- each generated RPM after it is successfully written
- whole successfully written binary package set
- it is possible to use it for sanity checks
Jindrich Novy [Mon, 10 Nov 2008 14:46:43 +0000 (15:46 +0100)]
Add macros for the post-build package checkers feature (upstream ticket #2)
- _build_pkgcheck: helper that is ran for every binary RPM successfully
written
- _build_pkgcheck_set: helper ran for the whole binary package set
- _build_pkgcheck_srpm: helper ran for SRPM
- _nonzero_exit_pkgcheck_terminate_build: indicates whether the build
should fail if helper returns non-zero exit status
Panu Matilainen [Fri, 7 Nov 2008 10:03:54 +0000 (12:03 +0200)]
Reset return values to zero + NULL's on not found in hash GetEntry()
- avoids having to separately check for return value in some cases and
accidents from not resetting the values in caller
- in line with headerGet() behavior
Florian Festi [Wed, 5 Nov 2008 14:23:19 +0000 (15:23 +0100)]
Rename doLookup to fpLookup to get rid of one function just calling the other
Florian Festi [Fri, 7 Nov 2008 09:53:55 +0000 (10:53 +0100)]
cleanup fpLookupSubdir
* rename end -> endsubdir
* fix assignment mess
* fix memory leak (no longer free current_fp.subDir which may be NULL)
* set endsubdir to NULL while not valid
Panu Matilainen [Fri, 7 Nov 2008 09:52:24 +0000 (11:52 +0200)]
Reverse hash GetEntry() return code vs found/not found
- be in line with hash HasEntry() and other similar functions
- internal-only function with just one place actually checking the return