Commit Graph

12491 Commits

Author SHA1 Message Date
Panu Matilainen a30acf9d01 Grab file count on entry to rpmpsmStage()
- This is used in several places (although at different times), and
  is the only use psm itself has for psm->fi...
2013-11-14 09:44:00 +02:00
Panu Matilainen 6ea86cc34b Remove leftovers, cpioStrCmp is unused since previous commit 2013-11-14 08:31:11 +02:00
Florian Festi 3c28dcdb65 No longer use apath for installing packages
* Set ORIGBASENAMES for source rpms
 * Use ORIGBASENAMES for for finding files from the archive
 * Get rid of the code setting apath for the installation use case
2013-11-13 17:30:02 +02:00
Panu Matilainen 4ab11d140b Add a bit of API for accessing the original paths
- Especially rpmfiOFN() and its underlying buffer is more than a bit
  dubious, but can't really help it as people are going to expect
  it behaving identically to rpmfiFN(). And they can't share the
  same buffer as somebody is going to be tempted to do eg
      if (strcmp(rpmfiFN(fi), rpmfiOFN(fi)))
          /* file has been relocated */
- Based on ffesti's original work on the subject
2013-11-13 17:29:06 +02:00
Panu Matilainen 77423af798 Store original path data in rpmfi for relocated packages
- Relocation is relatively rare, so instead of storing the data within
  rpmfiles, we allocate it separately if needed. This also allows
  nicely handling the normal case where ORIG paths are the same
  as actual paths, ie we simply point it to the same data (and take
  care not to free twice...)
2013-11-13 17:24:35 +02:00
Panu Matilainen dbed855cb3 Allow specifying the tag from which path data is created
- Relocated packages store the original data in RPMTAG_ORIG* tags,
  we'll need to be able to access those as well.
2013-11-13 16:47:41 +02:00
Panu Matilainen 9bf578376d Split file path "tuple" into its own datatype from rpmfiles
- Add a new datatype and a bit of API for path data from headers,
  adjust callers within rpmfi to use it.
- The file name data is used all over the place within rpm, mostly
  with ad-hoc manner and missing validations etc. While the newly
  added API is rpmfi-internal for now, this should prove useful
  later on for other purposes as well. For now we're only interested
  in being able to handle two different sets of paths alongside
  each other.
2013-11-13 16:46:12 +02:00
Panu Matilainen 2b48d1aa83 Use accessor functions for file and directory names and id's
- No functional changes, just making next steps easier (and eliminating
  redundant code as well)
2013-11-13 16:03:02 +02:00
Panu Matilainen ac0d3a284c Add a helper function for pool<->fn comparisons in rpmfilesFindFN()
- The comparison is the same whether doing bsearch or liner lookup...
- Use accessor functions instead of direct struct accesses, primarily
  to make next steps easier
2013-11-13 16:02:34 +02:00
Panu Matilainen 7cfaf34d74 Use accessor functions for file and directory count throughout rpmfi
- No functional changes, just making next steps easier
2013-11-13 16:01:50 +02:00
Panu Matilainen 05f2e99e51 Eliminate some build remnants from fsm 2013-11-12 12:32:00 +02:00
Panu Matilainen b1d35a9959 Lift rpmPackageFilesArchive() over to librpmbuild
- No code/functional changes here, just straightforward move
  and make rpmPackageFilesArchive() static
2013-11-12 12:23:20 +02:00
Panu Matilainen fa9be7339d Separate package building from fsm struct entirely
- We have everything we need in rpmfi[les], eliminate the fsm
  foobar out of the picture entirely. Also use a separate iterator
  (instead of an external index variable) for walking the files
  when looking for symlinks, now that we can.
2013-11-12 12:18:30 +02:00
Panu Matilainen 1a4706b0f0 Fix callback thinkos from commit 72bd2de21e
- Issuing RPMCALLBACK_UNKNOWN callbacks doesn't seem like that bright
  an idea... looks like just a typo/thinko from the changed arguments
  and all. Not that it seems to make much of a difference in practise.
2013-11-11 13:03:52 +02:00
Panu Matilainen d044e08ccb Eliminate rpmteFI() use in rpmteColorDS()
- Use a local iterator on te->files instead
2013-11-11 12:52:46 +02:00
Panu Matilainen 3a858ad5b0 Eliminate rpmteFI() use from rpmFindBaseNamesInDB()
- Use local iterator on rpmteFiles() instead
2013-11-11 12:19:24 +02:00
Panu Matilainen e58ea201a0 Eliminate rpmteFI() uses from rpmtsCheck(), part 2
- Use local iterator on rpmteFiles() for removed files checking
2013-11-11 12:17:10 +02:00
Panu Matilainen e378c00f63 Eliminate rpmteFI() uses from rpmtsCheck(), part 1
- Use local iterator on rpmteFiles() for installed file conflicts
  checking.
2013-11-11 12:15:18 +02:00
Panu Matilainen d093a58f34 Eliminate rpmteFI() uses from transaction skip policy calculations
- Grab files and file states from the main loop and pass as arguments
  to skipInstallFiles() and skipEraseFiles(), neither actually
  needs the transaction element otherwise.
- Use local iterators in both skip*Files(), not that it actually
  matters here other than eliminating rpmteFI() uses
2013-11-11 12:06:28 +02:00
Panu Matilainen f9f93714c5 Switch fingerprinting main loop from rpmfi to rpmfiles
- The internals already use rpmfiles random access anyway, rpmfi
  only gets in the way there
2013-11-11 11:55:16 +02:00
Panu Matilainen b1c31b9632 Switch countFiles() from rpmfi to rpmfiles
- Need to do more work to get the same silly number, this particular
  case doesn't really look like progress :)
2013-11-11 11:20:49 +02:00
Panu Matilainen 8c1c4df8c0 Begin rpmte transition from rpmfi to rpmfiles
- What rpmte wants is the file set, not an iterator, so that's what
  we grab on rpmteNew(). However rpmteFI() is a public API whose
  semantics we need to preserve for the time being so lazily
  create an persistent iterator on first rpmteFI() call.
- rpmteSetFI() is now rather backwards, it should be rpmteSetFiles()
  instead but fi->apath stands in the way ATM. Sigh.
2013-11-11 11:13:16 +02:00
Panu Matilainen 4140e6562d Make rpmteFiles() return refcounted rpmfiles, fixup callers 2013-11-08 13:50:20 +02:00
Panu Matilainen 68d5024bc6 Fix off-by-some indentation + other whitespace issues in fpLookupSubdir()
- Plain whitespace surgery, no code changes
2013-11-08 13:06:12 +02:00
Panu Matilainen afb89d072d Only fetch otherFi when it'll actually be needed
- Shouldn't change anything as is, just rearranging this to allow
  refcount on rpmteFiles() return
2013-11-08 13:04:21 +02:00
Panu Matilainen 19577025c2 Implement selectable iterator mode for rpmfi
- Forward (the default) and (a new) backwards iteration modes for now
- Internal iterator function just returns the next iteration index,
  bounds checking and actual advancing in rpmfiNext() to avoid having
  to duplicate that code in every single iterator function.
2013-11-08 12:04:30 +02:00
Panu Matilainen 0a9c199bc2 Bunch of forgotten rpmfi -> rpmfiles (internal) function renames 2013-11-08 11:03:33 +02:00
Panu Matilainen 4640e833da Add (and use) rpmfiles counterpart for rpmfiFindFN() 2013-11-08 10:18:06 +02:00
Panu Matilainen 2dda4fd863 Eliminate bunch of unnecessary direct rpmfiles struct accesses 2013-11-08 10:03:21 +02:00
Panu Matilainen dbc2ed980a Add (and use) rpmfiles counterpart for rpmfiColor() 2013-11-08 09:43:22 +02:00
Panu Matilainen c29ce0dcc0 Plug memleak on non-zero exits in archive reads
- Only return malloced path when there is an actual path to return
  (cpio trailer is not one) and there are no errors.
2013-11-08 09:06:47 +02:00
Panu Matilainen bb7ad2f1f1 Switch checkInstalledFiles() from rpmfi to rpmfiles
- All the called functions expect rpmfiles anyway so might as well
  grab that from the start. We could probably do some of this with
  iterators now but as everything here is done with the random-access
  functions, switching would take quite a bit of work...
2013-11-07 16:29:25 +02:00
Panu Matilainen 5053f931b1 Whoops, initIter() is supposed to be static 2013-11-07 15:59:48 +02:00
Panu Matilainen d9c0b07adb Mass-rename all rpmfiFooIndex() functions to rpmfilesFoo()
- These all operate on rpmfiles, not rpmfi, now so make the point
  clearer. All internal stuff so we're free to mess around.
- No functional changes, only a straightforward perl-assisted rename...
2013-11-07 15:58:10 +02:00
Panu Matilainen 02286c0d67 Fix up file iterator refcounts
- rpmfiNew() and rpmfiNewPool()-created rpmfi objects own the actual
  data too and must not take an extra refcount on it. However standalone
  iterators from rpmfilesIter() must take that reference... add a
  helper function to handle the difference + comment.
2013-11-07 15:54:30 +02:00
Panu Matilainen 6a5a0fa9ff rpmal wants a fileset handle, not somebody elses iterator... 2013-11-07 15:29:59 +02:00
Panu Matilainen dba7e99403 Make rpmfiles constructor, destructor and refcount internally accessible 2013-11-07 15:27:58 +02:00
Panu Matilainen 520c7266c8 rpmfi has no associated pool, the file set has
- should've been in previous commit really but since there's just
  one user... meh
2013-11-07 15:25:11 +02:00
Panu Matilainen c0cb2d86f9 Chainsaw rpmfi iteration apart from the actual file set
- The self-iterator in rpmfi prevents all sorts of sane uses of
  file set iteration. Split the actual data into a separate data
  type, changing the internal random-access functions to use the
  new rpmfiles datatype directly and update internal callers minimally.
  This should be entirely transparent to public API consumers who still
  only see the braindamaged self-iterating version.
- Internal consumers dont directly benefit (yet), this is just an
  early step on the road to rpmfi sanity. Much of the API and variables
  will need renaming etc but avoiding that here to keep the changes
  to minimum, this is a rather huge commit as it is.
2013-11-07 14:27:26 +02:00
Panu Matilainen ffda2460cd Make rpmfi struct opaque outside rpmfi.c
- Now that its possible (no matter how feebly), this makes changing
  rpmfi internals a bit easier
2013-11-07 14:10:43 +02:00
Panu Matilainen 9550e13978 Add & use temporary internal API to eliminate direct access to fi->apath
- Doesn't make the apath thingie any less ugly, but allows us to
  make rpmfi entirely opaque.
2013-11-07 14:10:01 +02:00
Panu Matilainen b66cac2125 More dead code removals...
- rpmPackageFilesArchive() doesn't need file states and actions
  for anything since the grand fsm breakup in 2012, remove the
  useless cruft.
2013-11-04 21:41:13 +02:00
Panu Matilainen d3169e486c writeFile() doesn't need entire fsm struct, only pass whats needed 2013-11-04 19:43:17 +02:00
Panu Matilainen 31a4cea18b Eliminate now unused index argument to writeFile() 2013-11-04 18:06:23 +02:00
Panu Matilainen 8c36e96f98 More dead code elimination, use data from rpmfi instead
- We have the symlink target in rpmfi already, no need to re-read
  it from the disk. Also all the fiddling with st_size is unnecessary
  here, its done on the archive side as necessary
2013-11-04 16:59:16 +02:00
Panu Matilainen 760abcf0b4 Buffer on archive write is not touched, make it const 2013-11-04 16:27:13 +02:00
Panu Matilainen 04baeb36fc Dead code removal
- rpmfiArchiveWriteHeader() handles the path now, the calculated
  fsm->path is unused here. Also CPIO_MAP_ABSOLUTE and friends haven't
  been used for anything since 4.4.x days...
2013-11-04 16:11:32 +02:00
Florian Festi 453c260aff Use rpmfiFLinks for hardlink handling 2013-11-04 13:21:07 +01:00
Florian Festi 5b66268d63 Replace checkHardLinks by a check for all files
to free the hardlink data structure from careing about this issue.
2013-11-04 13:21:07 +01:00
Florian Festi 7f84a126ab Use archive handling in rpmfi for package creation 2013-11-04 13:21:07 +01:00