tools/librpm-tizen.git
12 years agoSplit the actual file records into a struct of their own
Panu Matilainen [Mon, 28 May 2012 06:39:48 +0000 (09:39 +0300)]
Split the actual file records into a struct of their own

- No functional changes, just straightforward dumb conversion. Various
  places look fairly dumb with this, leaving sanitizing to other commits.

12 years agoUse vfaMatch() for %config attributes as well
Panu Matilainen [Mon, 28 May 2012 05:57:09 +0000 (08:57 +0300)]
Use vfaMatch() for %config attributes as well

12 years agoUnify %verify and virtual file attribute handling
Panu Matilainen [Mon, 28 May 2012 05:54:30 +0000 (08:54 +0300)]
Unify %verify and virtual file attribute handling

12 years agoEliminate unused negate field of VFA struct
Panu Matilainen [Mon, 28 May 2012 05:50:55 +0000 (08:50 +0300)]
Eliminate unused negate field of VFA struct

- The negate field has never been used nor does it seem very useful
  either: %verify negation can't be handled by it anyway, and
  for others it hardly makes sense.
- While at it, make virtualFileAttributes const and fix the
  indentation

12 years agoPush special %doc handling details out of processPackageFiles()
Panu Matilainen [Fri, 25 May 2012 12:01:19 +0000 (15:01 +0300)]
Push special %doc handling details out of processPackageFiles()

- Add a new struct to hold the necessary bits and pieces about
  these special directories with functions to create & free for
  easy management for callers, move the remaining processing into
  processSpecialDocs() to make that part one-stop shop for the
  caller as well.
- Should not change functionality in any way.

12 years agoRefactor getSpecialDocDir() so it cannot fail
Panu Matilainen [Fri, 25 May 2012 11:14:42 +0000 (14:14 +0300)]
Refactor getSpecialDocDir() so it cannot fail

- Spit a warning on illegal _docdir_fmt and fall back to the default
  format (which cannot fail). This just isn't worth dying for and
  avoids having to deal with such a petty error elsewhere.

12 years agoAdd support for 7zip compressed tarballs
Christophe Fergeau [Thu, 10 May 2012 21:27:56 +0000 (23:27 +0200)]
Add support for 7zip compressed tarballs

Teach %prep and %uncompress how to handle 7zip tarballs, with
the mingw toolchain landing in fedora, this may be useful when
crossbuilding Windows sources compressed using 7zip (CxImage is
one such project).

12 years agoSplit prelink checking into a helper function
Panu Matilainen [Mon, 21 May 2012 11:52:19 +0000 (14:52 +0300)]
Split prelink checking into a helper function

- No functional changes, just makes the thing a little bit more readable
  as the ELF details are buried out of sight in the helper

12 years agoRestore basic debug output for fsm operations
Panu Matilainen [Mon, 21 May 2012 10:17:39 +0000 (13:17 +0300)]
Restore basic debug output for fsm operations

- This is close to what we had in the stage-machine days, just to allow
  easily viewing whats going on inside the fsm (create/skip/etc)

12 years agoPush special doc directory generation next to other special doc foobar
Panu Matilainen [Wed, 16 May 2012 14:01:29 +0000 (17:01 +0300)]
Push special doc directory generation next to other special doc foobar

- There's no need to carry the special doc directory in the
  package struct, the directory is only a fleeting thing deep down
  in the filelist parsing. Handle local-only needs locally.
- No behavior/semantic changes intended or expected.

12 years agoRefactor special doc handling out of parseForSimple()
Panu Matilainen [Wed, 16 May 2012 12:07:53 +0000 (15:07 +0300)]
Refactor special doc handling out of parseForSimple()

- Change parseForSimple() to return all filenames it finds, moving
  most sanity checking and decision making of what goes where to
  processPackageFiles() which has a better overall view of things.
  This also means we could trivially handle more than one file per
  %files line, but keeping the (now artificial) limitation for now
  at least.
- Collect special %doc arguments individually to a local ARGV,
  split the script generation and execution to a separate helper
  function.
- Actual semantics / behavior is not supposed to change (other than
  'cp' now getting called once per %doc arg, not per %doc line), but
  knock wood, this is a larger at-once change than I care for.

12 years agoparseForSimple() doesn't need the entire file list anymore
Panu Matilainen [Wed, 16 May 2012 09:03:56 +0000 (12:03 +0300)]
parseForSimple() doesn't need the entire file list anymore

12 years agoNegation doesn't make sense for any of the virtual file attributes
Panu Matilainen [Wed, 16 May 2012 08:36:53 +0000 (11:36 +0300)]
Negation doesn't make sense for any of the virtual file attributes

- The negate field is unused in all the attributes anyway, but
  the whole concept doesn't make any sense for the virtual file
  attributes. Simplifies the thing another little bit.

12 years agoHandle %dir parsing with an internal file attribute
Panu Matilainen [Wed, 16 May 2012 08:29:09 +0000 (11:29 +0300)]
Handle %dir parsing with an internal file attribute

- Cleans things up a little bit by removing the special test
  for %dir in parseForSimple(). The separate isDir is still necessary
  for directory recursion tracking but that's separate from parsing
  the line.

12 years agoHandle %docdir with an internal file attribute
Panu Matilainen [Wed, 16 May 2012 08:05:44 +0000 (11:05 +0300)]
Handle %docdir with an internal file attribute

- Simplifies and cleans up things a bit as parseForSimple() now only
  parses this and processPackageFiles() acts on the result, and
  doesn't need specific argument checking now (only %doc is allowed
  to have more than one file per line)

12 years agoExplicitly differentate internal/exported file attributes
Panu Matilainen [Wed, 16 May 2012 07:40:01 +0000 (10:40 +0300)]
Explicitly differentate internal/exported file attributes

- RPMFILE_EXCLUDE only exists during spec parse, and doesn't "leak"
  into headers only because the file is, well, excluded to start with.
  Unexport the internal-only bit and explicitly strip out any excess
  bits from data going to header. The current 16/16 split is artificial
  of course, RPMTAG_FILEATTRS is 32bit so there's plenty of room
  for growing new file attributes, with internal-only adjustments
  required.
- Eliminate RPMFILE_UNPATCHED while at it, this is a leftover
  from Suse patch rpms which are no longer used anywhere.

12 years agoUnmask %license directive when parsing %files section
Panu Matilainen [Tue, 15 May 2012 11:23:35 +0000 (14:23 +0300)]
Unmask %license directive when parsing %files section

- This always was a rare creature, driven to extinction long time
  ago when Copyright: changed to License: which masks the %license
  directive of %files list with a macro holding the the textual
  description from License tag, causing errors.
- Override %license during %files parsing to bring back its original
  meaning, useless as it might be in its current form.

12 years agoEliminate unused argument to parseForSimple()
Panu Matilainen [Tue, 15 May 2012 08:39:24 +0000 (11:39 +0300)]
Eliminate unused argument to parseForSimple()

12 years agoOnly pass what's needed to parseForCaps()
Panu Matilainen [Mon, 14 May 2012 08:09:37 +0000 (11:09 +0300)]
Only pass what's needed to parseForCaps()

- It doesn't need the entire filelist, just the current file
  pointer (or actually just the caps string but for consistency...)
  That we need to track for capability presence overall is a different
  thing, that doesn't need to be in parseForCaps() at all.

12 years agoOnly pass what's needed to parseForLang()
Panu Matilainen [Mon, 14 May 2012 08:02:23 +0000 (11:02 +0300)]
Only pass what's needed to parseForLang()

- It doesn't need the entire filelist, just current file entry (actually
  just the lang pointer but for consistency with others...)
- We could (and perhaps should) now quite easily support %deflang as well,
  but leaving that to another time...

12 years agoOnly pass what's needed to parseForConfig()
Panu Matilainen [Mon, 14 May 2012 07:59:21 +0000 (10:59 +0300)]
Only pass what's needed to parseForConfig()

- It doesn't need the entire filelist, just current file entry.

12 years agoOnly pass what's needed to parseForDev()
Panu Matilainen [Mon, 14 May 2012 07:56:57 +0000 (10:56 +0300)]
Only pass what's needed to parseForDev()

- It dosn't need the entire filelist, just the buffer and current
  file entry

12 years agoOnly pass what's needed to parseForAttr()
Panu Matilainen [Mon, 14 May 2012 07:53:49 +0000 (10:53 +0300)]
Only pass what's needed to parseForAttr()

- It doesn't need the entire filelist, just the buffer and current
  or defaul file entry pointer

12 years agoOnly pass what's needed to parseForVerify()
Panu Matilainen [Mon, 14 May 2012 07:42:23 +0000 (10:42 +0300)]
Only pass what's needed to parseForVerify()

- It doesn't need the entire filelist, just the buffer and current
  or default file entry pointer
- Additionally initialize the local variables on declaration, cleaning
  things up that little bit

12 years agoCentralize fl.processingFailed setting for parseForFoo() calls
Panu Matilainen [Mon, 14 May 2012 07:31:45 +0000 (10:31 +0300)]
Centralize fl.processingFailed setting for parseForFoo() calls

- All the parseForFoo() functions return an error code already,
  on top of this they also set fl.processingFailed, which forces
  passing the whole damn filelist to them when they'd only really
  need the current buffer and (parts of) fl.cur / fl.def.
- Preserve former behavior of continuing parsing despite errors,
  dunno whether it makes much sense though.

12 years agoAdd a helper function for freeing/resetting a file entry, use it
Panu Matilainen [Mon, 14 May 2012 07:16:31 +0000 (10:16 +0300)]
Add a helper function for freeing/resetting a file entry, use it

- Now with all the per file-entry data in a struct of its own this
  becomes sane and should plug up a couple of leaks as well.

12 years agoEliminate redundant filelist initializiation
Panu Matilainen [Mon, 14 May 2012 07:00:13 +0000 (10:00 +0300)]
Eliminate redundant filelist initializiation

- The file list gets zeroed out with memset(), eliminating all this
  noise lets the actually necessary initialization tasks more obvious.

12 years agoSplit out the remaining "current file" state out of global filelist
Panu Matilainen [Mon, 14 May 2012 06:20:37 +0000 (09:20 +0300)]
Split out the remaining "current file" state out of global filelist

- We're unlikely to ever want default counterparts for directories
  and devices, but moving these out of the global state tracking
  will allow for saner handling of this constantly changing
  state nevertheless.

12 years agoSplit file languages and capabilities out of the global filelist
Panu Matilainen [Mon, 14 May 2012 06:14:52 +0000 (09:14 +0300)]
Split file languages and capabilities out of the global filelist

- These are only releavant for "current" entry but it wouldn't seem
  unreasonable (if not terribly useful mayhap) to be able to have defaults
  for these as well. No functional changes yet though.

12 years agoSplit the file attribute recs (permissions) out of the global filelist
Panu Matilainen [Mon, 14 May 2012 06:10:10 +0000 (09:10 +0300)]
Split the file attribute recs (permissions) out of the global filelist

- Same as previous commit: moving these to a common struct will
  allow various benefits like more shared code. For now just
  moving things, no other changes.

12 years agoSplit the various file flags out of the global filelist struct
Panu Matilainen [Mon, 14 May 2012 05:55:20 +0000 (08:55 +0300)]
Split the various file flags out of the global filelist struct

- Active defaults and current values share several properties, moving
  them to a common struct will allow more code to be shared when
  manipulating them. For now just splitting things piece by piece
  though, no functional changes.

12 years agoShuffle FileList members around for a more logical grouping
Panu Matilainen [Mon, 14 May 2012 05:42:05 +0000 (08:42 +0300)]
Shuffle FileList members around for a more logical grouping

12 years agoImprove spec %include error detection and message
Panu Matilainen [Fri, 11 May 2012 08:57:09 +0000 (11:57 +0300)]
Improve spec %include error detection and message

- Besides excess arguments, catch missing argument too
- Log filename and line number like with other error messages

12 years agoUnify pops from spec file stack to a function
Panu Matilainen [Fri, 11 May 2012 08:30:26 +0000 (11:30 +0300)]
Unify pops from spec file stack to a function

- Previously done in two different places, calls for a function eh?

12 years agoSimplify / sanitize pushing new files on spec file stack
Panu Matilainen [Fri, 11 May 2012 08:04:42 +0000 (11:04 +0300)]
Simplify / sanitize pushing new files on spec file stack

- Replace the rather useless newOpenFileInfo() "constructor" with
  a function to push a new filename on spec stack, creating the
  OFI struct as we go. forceIncludeFile() becomes so simple its
  no longer necessary at all.

12 years agoKeep the macro buffer terminated on append
Panu Matilainen [Thu, 10 May 2012 08:49:24 +0000 (11:49 +0300)]
Keep the macro buffer terminated on append

- This isn't strictly needed as we're terminating the buffers "just in
  case" all over the place but handling this centrally might allow
  some day eliminating the other fluff...

12 years agoFix off-by-ones in mbAppend() and mbAppendStr()
Panu Matilainen [Thu, 10 May 2012 08:28:39 +0000 (11:28 +0300)]
Fix off-by-ones in mbAppend() and mbAppendStr()

- Oops, remember to reserve space for the trailing \0 when appending.
  mb->nb holds the number of actual characters left in the buffer,
  not the terminator. Fixes a regression introduced in rpm 4.9.x
  dynamic macro realloction work (RhBug:431009 reprise)

12 years agoSimplify mono file magic regex
Panu Matilainen [Mon, 7 May 2012 12:29:14 +0000 (15:29 +0300)]
Simplify mono file magic regex

- Begin/end restrictions with wildcards on both ends dont make much
  sense, just match on the plain (sub)string

12 years agoRelax python file magic regex somewhat
Panu Matilainen [Mon, 7 May 2012 12:17:45 +0000 (15:17 +0300)]
Relax python file magic regex somewhat

- libmagic sometimes adds trailing descriptions about encodings, line
  terminators and whatnot, we dont want to care about those (RhBug:796218)
- not all python-related strings start with [pP]ython either, sometimes
  libmagic says "a python script" or "a /usr/bin/python script" and
  whatnot, so loose the start-of-line restriction as well

12 years agoTweak font magic regex a bit (yet again)
Panu Matilainen [Mon, 7 May 2012 11:51:32 +0000 (14:51 +0300)]
Tweak font magic regex a bit (yet again)

- Lose the pointless begin/end restrictions, take the optional
  space into account for both optional parts (one of the later issues
  in RhBug:757105)

12 years agoSmall patch to reverse hardlink ordering
Michael Schroeder [Thu, 3 May 2012 09:49:56 +0000 (11:49 +0200)]
Small patch to reverse hardlink ordering

Hi Panu et al,

Here's a small patch that changes the ordering used for putting
hardlinked files into the cpio archive back to lexicographical.

You might wonder what this is about. Well, old rpm-3 (and
also old versions of rpm-4, I think) already used lexicographical
ordering for files and hardlinks. When deltarpm was created,
it made use of this fact when "compressing" the file order
of the cpio archive into the so-called "sequence". Deltarpm
can deal with "out of order" files, but in that case it needs
to reset the compression, which leads to really long sequence
strings.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years agoFall back to private db environment on system level EINVAL
Panu Matilainen [Thu, 3 May 2012 13:15:59 +0000 (16:15 +0300)]
Fall back to private db environment on system level EINVAL

- BDB wants to use mmap() for its environment by default, but not
  all (file)systems support this, as pointed out by Daniel Drak.
  However env->open() can return EINVAL for a number of reasons,
  require all the fallback reasons to be system level errors to
  differentiate from "logical" errors such as incompatible flags
  to (possibly pre-existing) db environment, in which case we better
  just error out.

12 years agoEliminate unused selinux file context path macros
Panu Matilainen [Wed, 2 May 2012 12:17:01 +0000 (15:17 +0300)]
Eliminate unused selinux file context path macros

- These haven't been used by anything since rpm 4.8.x days,
  nowadays we just use selinux_file_context_path() instead

12 years agoEliminate rpmts usage from lower levels of fsm machinery
Panu Matilainen [Tue, 24 Apr 2012 12:52:41 +0000 (15:52 +0300)]
Eliminate rpmts usage from lower levels of fsm machinery

- The only remaining use for rpmts here was grabbing NODIGESTS
  from rpmtsFlags(). Pass the tiny little piece of information
  as an argument for the one place needing it and rip all the
  now unused related goo.

12 years agoOnly install needs selabel handle, dont bother elsewhere
Panu Matilainen [Tue, 24 Apr 2012 12:45:24 +0000 (15:45 +0300)]
Only install needs selabel handle, dont bother elsewhere

12 years agoDont bother with fsm-level digest statistics
Panu Matilainen [Tue, 24 Apr 2012 12:33:40 +0000 (15:33 +0300)]
Dont bother with fsm-level digest statistics

- Most of fsm doesnt need the actual transaction set for anything "real"
  and dragging it around as a mere statistics collector seems
  pretty dumb. If we want better statistics, we better come up with
  a saner way to gather them.

12 years agoEliminate rpmts and rpmte kludgery from package building
Panu Matilainen [Tue, 24 Apr 2012 11:28:03 +0000 (14:28 +0300)]
Eliminate rpmts and rpmte kludgery from package building

- Package building has no associated transaction or ts members,
  this was all just fake-up kludgery to work around the way how
  fsm used to work. None of it relevant now, kill kill kill.

12 years agoEliminate rpmte usage from lower levels of fsm machinery
Panu Matilainen [Tue, 24 Apr 2012 11:16:21 +0000 (14:16 +0300)]
Eliminate rpmte usage from lower levels of fsm machinery

- Determine the need for reverse iteration based on fsm goal
- Everything else was just using rpmte to get to its file states,
  eliminate the intermediate ping-pong by passign the file states
  around directly. Makes the thing that little bit less silly.

12 years agoMove mode-specific flag setting out of fsmNew()
Panu Matilainen [Tue, 24 Apr 2012 11:01:46 +0000 (14:01 +0300)]
Move mode-specific flag setting out of fsmNew()

12 years agoClean up file backup logic a bit
Panu Matilainen [Tue, 24 Apr 2012 10:48:11 +0000 (13:48 +0300)]
Clean up file backup logic a bit

- Ghosts are never backed up, and the whole business is irrelevant
  for package building. Use fsm goal instead of rpmte mode to
  determine what to do, rpmte in build code is nothing but an ugly hack.

12 years agoEliminate header and rpmte knowledge from rpmfs
Panu Matilainen [Tue, 24 Apr 2012 10:36:38 +0000 (13:36 +0300)]
Eliminate header and rpmte knowledge from rpmfs

- rpmfs is such a low-level construct it doesn't need to know anything
  about the upper layers. Gather the necessary bits of info in the
  sole caller instead and pass only whats needed to rpmfsNew() to
  enable creating a filestate item without having rpmte/header at hand,
  which we'll be needing in the fsm shortly.

12 years agoBury build filestate setting inside fsm remains
Panu Matilainen [Tue, 24 Apr 2012 09:36:26 +0000 (12:36 +0300)]
Bury build filestate setting inside fsm remains

- This whole thing probably isn't needed anymore, but for now just
  lift the FA_SKIP/FA_COPYOUT setting to rpmPackageFilesArchive(),
  allowing rpmfsSetAction() to become properly internal-only function.
- Trim out unnecessary now unnecessary librpm internal includes
  from librpmbuild code

12 years agoSplit out file state recording out of fsmMapPath()
Panu Matilainen [Tue, 24 Apr 2012 08:55:37 +0000 (11:55 +0300)]
Split out file state recording out of fsmMapPath()

- The file state that gets stored in the rpmdb has nothing to do with
  path and is only relevant for installs.

12 years agoFix quoting in brp-python-hardlink (patch from Jon Nelson)
Panu Matilainen [Mon, 23 Apr 2012 12:35:29 +0000 (15:35 +0300)]
Fix quoting in brp-python-hardlink (patch from Jon Nelson)

12 years agoAdd a few basic test-cases for tilde in version comparison
Panu Matilainen [Mon, 23 Apr 2012 08:16:04 +0000 (11:16 +0300)]
Add a few basic test-cases for tilde in version comparison

12 years agoAdd support for dpkg-style sorting of tilde in version/release
Michael Schroeder [Mon, 23 Apr 2012 08:04:02 +0000 (11:04 +0300)]
Add support for dpkg-style sorting of tilde in version/release

- This allows much nicer handling some common scenarios such as
  upstream pre-releases where the pre-release version would normally
  appear newer than final release, eg 1.0-rc1 vs 1.0. Previously this
  required mapping the pre-release tag into the release tag to achieve
  desired sorting, with tild this becomes simply 1.0~rc1 < 1.0.
- Add a rpmlib() tracking dependency to prevent older rpm versions
  from getting confused with packages relying on the new behavior.

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years agoAdd further version comparison test-cases
Panu Matilainen [Fri, 20 Apr 2012 10:29:21 +0000 (13:29 +0300)]
Add further version comparison test-cases

- Add pile of further tests for the more common constructs,
  collect various (old and new) corner cases from bugzilla.

12 years agorpmdsMatchesDep() isn't correct on obsoletes
Panu Matilainen [Fri, 20 Apr 2012 06:31:17 +0000 (09:31 +0300)]
rpmdsMatchesDep() isn't correct on obsoletes

- Fix oversight in commit 9fb81eac0bcd239e46459f72916099f1adfc5cb9:
  rpmdsMatchesDep() works on provides, but obsoletes are matched on
  package name so we want rpmdsNVRMatchesDep(). rpmdsMatchesDep()
  "worked" as the implicit self-provide is always at the 0 index
  on packages created by modern rpmbuild, but this isn't really
  guaranteed: very old V3 rpms can have something else at the
  first index, and ditto for non-rpmbuild created packages.
- Thanks to Michael Schroeder for pointing this out.

12 years agoPay attention to NULL returns from rpmcpioOpen()
Panu Matilainen [Wed, 18 Apr 2012 09:48:58 +0000 (12:48 +0300)]
Pay attention to NULL returns from rpmcpioOpen()

- The archive interface might actually want separate new + open,
  but for now just flag an internal error on NULL return on archive open.

12 years agoSanitize fsm creation/initialization and destruction
Panu Matilainen [Wed, 18 Apr 2012 09:34:45 +0000 (12:34 +0300)]
Sanitize fsm creation/initialization and destruction

- Now that there are no more failing parts requiring return codes,
  change + rename fsmSetup() into a more regular fsmNew() construct,
  returning newly "instance" of fsm and similarly fsmTeardown() ->
  fsmFree() to free the thing.
- There's no real need to allocate this stuff on heap, but doing
  so makes life actually simpler for the three callers and makes the
  whole thing more consistent with common practises in the codebase.

12 years agoSplit out hardlink checking from fsmTeardown()
Panu Matilainen [Wed, 18 Apr 2012 09:18:35 +0000 (12:18 +0300)]
Split out hardlink checking from fsmTeardown()

- Checking missing links is only relevant for install, lift the
  code to separate function and call from the install-case only.
- Freeing data while checking seems like a dubious "optimization"
  but to keep changes minimal, leaving that as it is now.

12 years agoEliminate unused leftover rc member from fsm struct
Panu Matilainen [Wed, 18 Apr 2012 09:09:06 +0000 (12:09 +0300)]
Eliminate unused leftover rc member from fsm struct

12 years agoMove cpio end trailer detection to the cpio code
Panu Matilainen [Wed, 18 Apr 2012 08:38:29 +0000 (11:38 +0300)]
Move cpio end trailer detection to the cpio code

- The fsm shouldn't know any archive format specifics, detect the trailer
  from rpmcpioHeaderRead() and signal EOF through CPIOERR_HDR_TRAILER
  instead.

12 years agoSeparate payload archive close and free
Panu Matilainen [Wed, 18 Apr 2012 07:30:11 +0000 (10:30 +0300)]
Separate payload archive close and free

- When writing, archive finalization can write further data into
  the payload (eg cpio trailer). We need to be able to fish the
  final archive size *after* closing it, otherwise archive size
  will be off by trailer size.
- Add new rpmcpioFree() function which simpy frees the archive struct,
  calling rpmcpioClose() in the process if it wasn't already done.
- This also simplifies the error code gymnastics in fsm: we need to
  free the resources whether error or not, which rpmcpioFree() allows
  us to do. And for writers, calling rpmcpioClose() only needs to
  be done if earlier parts were successfull, so we dont need to worry
  about masking a former error code when calling it.

12 years agoAlways return NULL from fdFree()
Panu Matilainen [Wed, 18 Apr 2012 07:09:01 +0000 (10:09 +0300)]
Always return NULL from fdFree()

- Up to now, if the fd had remaining references fdFree() would return
  the supposedly free'd fd back to us, which is unlike anything else
  in rpm. Make this consistent with the rest of rpm finally as the
  last remaining caller requiring the old semantics is gone from
  the codebase (somewhere between 4.9 and 4.10): always return NULL,
  as the referenced instance is now gone as far as the caller is concerned.

12 years agoEliminate payload archive member from fsm struct
Panu Matilainen [Tue, 17 Apr 2012 17:10:10 +0000 (20:10 +0300)]
Eliminate payload archive member from fsm struct

- Only install and build have an associated archive, and this can
  be just as well handled as a local variable, passing down as
  argument to the handful of places needing it.
- Error handling looks a bit fishy but that's not exactly new issue...

12 years agoPush fsm archive size down to the only caller who cares
Panu Matilainen [Tue, 17 Apr 2012 16:18:28 +0000 (19:18 +0300)]
Push fsm archive size down to the only caller who cares

- Archive size is only relevant for build code, no need for tracking
  this in the big struct. Just return the archiveSize at end of
  build process.

12 years agoLose unnecessary cfd member from fsm, refcount through payload instead
Panu Matilainen [Tue, 17 Apr 2012 15:03:29 +0000 (18:03 +0300)]
Lose unnecessary cfd member from fsm, refcount through payload instead

12 years agoKill couple of useless "helper" functions
Panu Matilainen [Tue, 17 Apr 2012 14:36:47 +0000 (17:36 +0300)]
Kill couple of useless "helper" functions

- Both are only ever called once and are so trivial that they're
  not helping anything at all

12 years agoRemove now unused psm argument to fsmSetup()
Panu Matilainen [Tue, 17 Apr 2012 14:21:02 +0000 (17:21 +0300)]
Remove now unused psm argument to fsmSetup()

- Bah, should've been in commit 4ef540d25bab77b46cbf4467c8f6bc22cdd0e419

12 years agoMove mapping index + and related loop exits out of fsmInit()
Panu Matilainen [Tue, 17 Apr 2012 14:08:49 +0000 (17:08 +0300)]
Move mapping index + and related loop exits out of fsmInit()

- The mapping index is the same for build + erase, but different
  for install and so is the return code mapping. By doing this
  inline where the action is we avoid having to fiddle with
  mapped return codes for the exit case.

12 years agoMove the install-only payload reading to the install-only code
Panu Matilainen [Tue, 17 Apr 2012 13:53:12 +0000 (16:53 +0300)]
Move the install-only payload reading to the install-only code

- Besides simplifying the common path everything takes, this removes
  the need to map error returns back and forth when we can just
  detect the end of payload directly in the loop and break out.

12 years agoSplit fsm state reset to a separate function
Panu Matilainen [Tue, 17 Apr 2012 13:40:54 +0000 (16:40 +0300)]
Split fsm state reset to a separate function

- No functional changes as such, but moving this out of fsmInit()
  permits other goal-specific items to be moved out of fsmInit()

12 years agoZeroing out the fsm is common to all modes, move it to fsmSetup()
Panu Matilainen [Tue, 17 Apr 2012 13:30:43 +0000 (16:30 +0300)]
Zeroing out the fsm is common to all modes, move it to fsmSetup()

12 years agoPush dnl iterator init + free to the sole caller fsmMkdirs()
Panu Matilainen [Tue, 17 Apr 2012 13:27:27 +0000 (16:27 +0300)]
Push dnl iterator init + free to the sole caller fsmMkdirs()

- There's zero need for the rest of the code to know or care about
  dnl iterator, just pass the file info- and state sets to
  fsmMkdirs() directly and hide the otherwise unused iterator
  business there.

12 years agoInline what little is left of fsmCreate() into fsmSetup()
Panu Matilainen [Tue, 17 Apr 2012 13:15:33 +0000 (16:15 +0300)]
Inline what little is left of fsmCreate() into fsmSetup()

- Besides being a bizarre name for "some extra initialization" work,
  fsmCreate() was full of redundant goo, including a rather complex
  way of mapping a zero return back to zero in case it really was
  zero .. or something.

12 years agoMove temporary install suffix creation to more logical place
Panu Matilainen [Tue, 17 Apr 2012 13:01:52 +0000 (16:01 +0300)]
Move temporary install suffix creation to more logical place

- Only installation needs, so move it to rpmPackageFilesInstall()

12 years agoMove unowned directory creation to more logical place
Panu Matilainen [Tue, 17 Apr 2012 12:47:20 +0000 (15:47 +0300)]
Move unowned directory creation to more logical place

- rpmPackageFilesInstall() is the only case where this needs to occur,
  move it there instead of yet-another goal-dependent piece where it has
  no business being in the strangely named fsmCreate()...

12 years agoEliminate the pointless fsm NULL checking in fsmFsPath()
Panu Matilainen [Tue, 17 Apr 2012 12:37:53 +0000 (15:37 +0300)]
Eliminate the pointless fsm NULL checking in fsmFsPath()

- There's just no damn way fsm can be NULL when this is called,
  a NULL fsm would've segfaulted miles earlier.

12 years agoEliminate unused subdir argument from fsmFsPath()
Panu Matilainen [Tue, 17 Apr 2012 12:04:39 +0000 (15:04 +0300)]
Eliminate unused subdir argument from fsmFsPath()

12 years agofsmFsPath() only needs directory/something else not entire struct stat
Panu Matilainen [Tue, 17 Apr 2012 11:09:07 +0000 (14:09 +0300)]
fsmFsPath() only needs directory/something else not entire struct stat

- The less places we pass all the junk around, the easier its to
  follow, and in most places we already know whether its dir or not anyway.

12 years agoRemove now unnecessary psm member from fsm struct
Panu Matilainen [Tue, 17 Apr 2012 10:28:55 +0000 (13:28 +0300)]
Remove now unnecessary psm member from fsm struct

- Except for expandRegular(), all notification occurs from the three
  main worker functions. Pass as an argument for the lone special
  case, the other noticy already have the psm as their own argument.

12 years agoRemove redundant progress notification from fsmCommit()
Panu Matilainen [Tue, 17 Apr 2012 10:25:59 +0000 (13:25 +0300)]
Remove redundant progress notification from fsmCommit()

- fsmCommit() does not advance the archive or anything else, so
  this was simply issuing the same exact notification that we
  just did from rpmPackageFilesInstall().

12 years agoClean up + improve file/directory removal error handling
Panu Matilainen [Tue, 17 Apr 2012 09:40:41 +0000 (12:40 +0300)]
Clean up + improve file/directory removal error handling

- Only handle %missingok in the cases where it actually applies,
  and additionally handle missing %ghost which is not an error
  either. Dont log anything for these non-errors.
- Unify the error handling for files and directories, makes life
  simpler as they dont differ by that much.
- Log real failures as warnings instead of silencing them to debug
  spew, users will want to know if something that was supposed to
  be removed was not (say, a file with immutable attr set).
- Add comments for further work on this area.

12 years agoMinimally fix file/directory removal
Panu Matilainen [Tue, 17 Apr 2012 07:49:26 +0000 (10:49 +0300)]
Minimally fix file/directory removal

- In their previous life these breaks applied to a switch-case but
  now they end up aborting the loop on first successful removal, causing
  everything but the first file/directory of a package to be left behind
  on erase. Fixes the previously unnoticed regression from commit
  1845c1d711b88723e596c88e8a7730a360029089.

12 years ago- Add support for ppc64p7 architecture using new auxv parsing info
Phil Knirsch [Mon, 16 Apr 2012 17:05:18 +0000 (19:05 +0200)]
- Add support for ppc64p7 architecture using new auxv parsing info

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years ago- Add general /proc/self/auxv parsing to rpmrc for better machine detection
Phil Knirsch [Mon, 16 Apr 2012 17:02:34 +0000 (19:02 +0200)]
- Add general /proc/self/auxv parsing to rpmrc for better machine detection

Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
12 years agoUse a bit more complicated test for the install/remove file verification
Panu Matilainen [Tue, 17 Apr 2012 05:25:26 +0000 (08:25 +0300)]
Use a bit more complicated test for the install/remove file verification

- Previous test only used a single file and no package-specific
  directories, now we have multiple files and multiple directories,
  some owned by the package and some not.
- This test fails right now due to previously unnoticed regression
  in commit 1845c1d711b88723e596c88e8a7730a360029089

12 years agoAxe unused leftover variable
Panu Matilainen [Mon, 16 Apr 2012 12:52:30 +0000 (15:52 +0300)]
Axe unused leftover variable

- Should've been in commit cf1095648194104a81a58abead05974a5bfa3b9a

12 years agoDocument --obsoletes in manual (RhBug:809402)
Panu Matilainen [Mon, 16 Apr 2012 12:50:27 +0000 (15:50 +0300)]
Document --obsoletes in manual (RhBug:809402)

12 years agoAdd test-cases for identical basenames within package
Panu Matilainen [Mon, 16 Apr 2012 11:14:37 +0000 (14:14 +0300)]
Add test-cases for identical basenames within package

- One test for the normal situation where identical basenames are
  not a problem, and another one where this causes a self-conflict
  because of a directory symlink.

12 years agoRaise file conflicts on differing device node numbers
Panu Matilainen [Fri, 13 Apr 2012 10:38:20 +0000 (13:38 +0300)]
Raise file conflicts on differing device node numbers

- For practical purposes, the "content" of a device node is its
  minor+major number, if those differ the files are very much
  not the same and thus cannot be shared.

12 years agoRaise file conflicts on differing permissions (user, group, mode)
Panu Matilainen [Fri, 13 Apr 2012 10:16:51 +0000 (13:16 +0300)]
Raise file conflicts on differing permissions (user, group, mode)

- Two files (or directories) cannot be correctly shared if their
  permissions differ, even if the content is identical: either
  file will end up having wrong permissions, depending on installation
  order. This means a package can among other things silently
  eg relax permissions of eg security sensitive directory (accidentally
  or intentionallY).
- We now require exact match of user, group and entire file mode
  (previously only the file type part of mode was tested)

12 years agoCheck for file conflicts within package (RhBug:808750)
Panu Matilainen [Thu, 12 Apr 2012 15:01:52 +0000 (18:01 +0300)]
Check for file conflicts within package (RhBug:808750)

- Packages having file conflicts with itself may seem absurd, but
  directory symlinks (such as /lib being a symlink to /usr/lib)
  make this entirely possible. This makes us catch and abort early
  on these cases instead of silently overwriting the self-conflicting
  files, potentially with disastrous results.

12 years agoCheck for file conflicts within package (RhBug:808750)
Panu Matilainen [Tue, 3 Apr 2012 03:11:11 +0000 (06:11 +0300)]
Check for file conflicts within package (RhBug:808750)

- Packages having file conflicts with itself may seem absurd, but
  directory symlinks (such as /lib being a symlink to /usr/lib)
  make this entirely possible. This makes us catch and abort early
  on these cases instead of silently overwriting the self-conflicting
  files, potentially with disastrous results.

12 years agoChange file disposition code to access rpmfi's by index
Panu Matilainen [Thu, 12 Apr 2012 14:50:54 +0000 (17:50 +0300)]
Change file disposition code to access rpmfi's by index

- The final pre-requisite to handling file conflicts within a package:
  with this we're no longer tied to the single index per rpmfi. This
  is not supposed to change anything yet unless I screwed something up.
  Also goes to show that a semi-iterator interface for something
  that really needs random access only gets in the way rather than
  helping...

12 years agoChange rpmfi replaced size functions to take index
Panu Matilainen [Thu, 12 Apr 2012 14:39:57 +0000 (17:39 +0300)]
Change rpmfi replaced size functions to take index

- Further preliminaries to handle file conflicts within a package.
- These are internal-only interfaces so we can just change without
  bothering with compat wrappers.

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.