Commit Graph

12809 Commits

Author SHA1 Message Date
Panu Matilainen 31b99022fd Dont check for non-existent errors
- fsmMkdirs() is the first thing that actually returns an rc...
2014-03-19 13:58:07 +02:00
Panu Matilainen af5605f1a0 Get rid of silly pointer to local struct
- Leftover from commit e44d02a14e where
  the pointer was used to avoid excessive unrelated changes, this
  is just a trivial rename.
2014-03-19 13:14:53 +02:00
Panu Matilainen aacfef1307 Eliminate now useless fsmInit() 2014-03-19 12:40:26 +02:00
Panu Matilainen e44d02a14e Eliminate fsmStat() and related arg from fsmInit()
- Install and erase are radically different in when and what they
  stat, and what they do with the info. Let them do their own
  stating where most appropriate...
2014-03-19 12:32:54 +02:00
Panu Matilainen 1171741b9a Lift fsm debug foobar into its own helper function 2014-03-19 12:28:52 +02:00
Panu Matilainen 226579373f Eliminate unnecessary stat struct argument to fsmVerify()
- We have the same info available from rpmfi, use it...
2014-03-19 11:52:18 +02:00
Panu Matilainen 007f1a8763 Eliminate the last remains of fsm struct
- Might not even make a whole lot of sense, this is a matter of
  principle at this point.
2014-03-19 11:06:09 +02:00
Panu Matilainen aa290c010c Pass/return path from fsmCommit() via retval, avoiding fsm struct
- Ditto previous commit...
2014-03-19 10:59:17 +02:00
Panu Matilainen d2c28e0d70 Return path from fsmInit() via retval, avoiding fsm struct
- Doesn't maybe make much sense, but at this point its a matter
  of principle more than anything else...
2014-03-19 10:55:28 +02:00
Panu Matilainen f6823e55c5 fsmVerify() no longer needs the fsm, just the path 2014-03-19 10:47:22 +02:00
Panu Matilainen 3ee82dfb2b Eliminate "exists" member from fsm struct
- fsmStat() zeroes out the stat buf on error so we can just look
  at st_nlink to see whether something exists or not - no existing
  file can have zero nlink.
- fsmBackup() used to update exists on successful rename but it
  shouldn't make a difference, at least anymore...
2014-03-19 10:37:30 +02:00
Panu Matilainen 3880a2358f Fix up comments wrt stat buf zeroing 2014-03-19 10:13:13 +02:00
Panu Matilainen c19531ef8e Dont need no stinking goal no more... 2014-03-19 09:39:28 +02:00
Panu Matilainen 0ab17433ab Determine need to stat() based on suffix, not kludgy goal + mode 2014-03-19 09:36:31 +02:00
Panu Matilainen 35b5f0bdf8 Utilize rpmfiStat() in rpmfiArchiveWriteHeader() too
- Stripped payload doesn't need all the goo we look up via rpmfiStat()
  but it does need corrected size for symlinks, hardlinks and all...
  which we get from rpmfiStat(). For plain old cpio archives this
  eliminates the whole manual fi -> stat mapping, obviously.
2014-03-18 13:38:26 +02:00
Panu Matilainen 953463e90a Replace fsmMapAttrs() with rpmfiStat() 2014-03-18 13:33:54 +02:00
Panu Matilainen 86e07db8d5 Add rpmfilesStat() and iterator counterpart API
- Maps file info set data into struct stat as lstat() would return it.
- Needs sane flags to be defined...
2014-03-18 13:30:52 +02:00
Panu Matilainen 17a97aa5f7 Eliminate redundant rpmfiFLinks() call, cleanup 2014-03-18 10:41:30 +02:00
Panu Matilainen 9dcd3de9e5 Skip over symlink target data in payload automatically
- We have no use for the symlink target stored as file content, the
  data from header is used instead. With this change only regular
  files ever have non-zero expected payload size on return.
- There's now a possibility of IO-error after validating the mapping
  index, differentiate between rc / fx on return to avoid bad
  values to rpmfiSetFound()
2014-03-18 09:24:18 +02:00
Panu Matilainen dcf5fbd79b Create symlink based on header, not payload data 2014-03-18 09:02:01 +02:00
Panu Matilainen ce775be017 Only regular files can have hardlinks 2014-03-18 08:54:40 +02:00
Panu Matilainen f60c1d3eba Make cpio and stripped archive reading more similar
- For regular cpio archives we'll need to get a path, otherwise funny
  stuff might happen... so decide on path, not fx
- Validate fx is within bounds for both archive styles
- Explicitly set expected file size for cpio archives too
2014-03-18 08:45:00 +02:00
Panu Matilainen d45d5b8e7e Grab file count on entry to iterReadArchiveNext() 2014-03-18 08:34:03 +02:00
Panu Matilainen 6214c0eb4e Dont bother checking for NULL "self"
- iterReadArchiveNext() can only get called through fi->next which
  pretty much means fi is not NULL...
2014-03-18 08:31:59 +02:00
Panu Matilainen d082806089 Avoid using rpmfi methods inside fi->next, part 2
- fi->next() shouldn't need to call rpmfiSetFX(), it gets set on
  return from the iterator function and use rpmfilesFLinks() instead
  of the iterator version to provide random access to files, that's
  what its for.
2014-03-18 08:01:34 +02:00
Panu Matilainen 2059f23bf4 Unbreak reading of the new stripped format payload
- Iterator points to previous file (or nothing at all) inside
  the iter next function, need to use the indexed rpmfiles interfaces.
  There used to be a rpmfiSetFX() call here at some point which would've
  made this work but the next function is not supposed to be setting
  the iterator, only figuring the next index.
2014-03-18 07:45:26 +02:00
Panu Matilainen fdab76c50a Eliminate unnecessary struct stat argument to fsmCommit() 2014-03-17 15:18:30 +02:00
Panu Matilainen c7d9ce8259 Determine backup/rename based on suffix, not mode
- This is ultimately the same thing, just eliminating unnecessary
  re-evaluation and logic duplication
2014-03-17 15:16:16 +02:00
Panu Matilainen cf7e1af291 Drop unused mode argument from fsmBackup() 2014-03-17 15:11:10 +02:00
Panu Matilainen 1c5577b526 Call fsmVerify() centrally for all file types 2014-03-17 13:20:14 +02:00
Panu Matilainen 203a8202bf Make symlink unpacking more like the other cases
- fsmVerify() first, then read, validate archive, create entry
  as necessary.
- We dont really need the payload content for anything as we have the
  target in rpmfi already, but since we have to skip over it somehow
  we might as well validate the content matches expectations.
2014-03-17 12:04:51 +02:00
Panu Matilainen 409fa83c94 Disable curl globbing for remote retrievals
- urlGetFile() can only handle one file at a time, so globbing does
  not make sense and only confuses us. Besides, useful things like
  'rpm -Uvh http://somewhere.org/foo-1.2-1.{i386,x86_64}.rpm'
  work just as well without curl-level globbing.
- Incidentally this is also the documented workaround for using
  IPv6 numerical addresses with curl (RhBug:1076277)
2014-03-17 10:34:10 +02:00
Florian Festi eeb1990860 .gitignore compiled Python files 2014-03-14 13:29:05 +01:00
Panu Matilainen 27e8d0dea9 Refactor fsm arg out of fsmBackup()
- Pass exists as a return value instead in the only case where it
  matters, ie early backup when directory replaces something.
2014-03-13 16:52:52 +02:00
Panu Matilainen 7c9e02d6a8 Move fsmBackup() out of fsmCommit()
- Having it there probably made sense at some point but now it
  just gets in the way...
2014-03-13 16:09:47 +02:00
Panu Matilainen 09984c4015 Eliminate isDir argument from fsmFsPath()
- Either we have a suffix or not, it doesn't need a third argument...
2014-03-13 15:38:52 +02:00
Panu Matilainen 4f30c7378d fsmSetmeta() no longer needs fsm struct, just pass the path as argument 2014-03-13 14:21:04 +02:00
Panu Matilainen 8e8e39991d Eliminate suffix from fsm struct
- Remove doesn't use it, handle locally / with arguments on install side
2014-03-13 14:21:04 +02:00
Panu Matilainen cf7fce2c6a Eliminate postpone from fsm struct
- Use local variable with more descriptive name. Doesn't really win
  much but then at the eve of FSM extinction I dont really care.
2014-03-13 14:21:04 +02:00
Panu Matilainen a45a9242fb Add + use internal remove(3) like helper 2014-03-13 14:21:04 +02:00
Panu Matilainen 7ff94f1407 Dont rely on fsm->postpone when erasing
- This actually makes the logic slightly easier to follow: only
  non-skipped files can require backups, and only erased files
  should be erased.
2014-03-13 14:21:04 +02:00
Panu Matilainen ff8214c333 fsmNew() no longer takes any arguments 2014-03-13 14:21:04 +02:00
Panu Matilainen 9b1494af28 Eliminate fi from fsm struct, pass as arguments etc etc 2014-03-13 14:21:04 +02:00
Panu Matilainen a417a54729 Eliminate fs from fsm struct, pass around as argument where needed 2014-03-13 14:21:04 +02:00
Florian Festi e308ddc917 Export RPMTAG_OLDSUGGESTS, OLDENHANCES and friends
This allows reading packages with SUSE's old style weak dependencies
2014-03-13 11:23:16 +01:00
Florian Festi 536075aaf6 Add generated files to .gitignore 2014-03-13 11:23:16 +01:00
Panu Matilainen 86ed39a5f0 Inline the remains of fsmMapPath() into fsmInit()
- We already free the path in fsmInit() so the free was redundant anyway,
  and everything else has been stripped down to the one fsmFsPath() call
  which we can just as well do from fsmInit()
2014-03-13 11:18:31 +02:00
Panu Matilainen 1509997576 Eliminate nsuffix from fsm struct
- Only commit cares, everything else deals with the temporary name
2014-03-13 11:09:14 +02:00
Panu Matilainen fd82d535e7 Avoid redundant rpmfsGetAction() calls
- The action value is needed in several places, grab it early in
  rpmPackageFilesInstall() loop and pass around in argument
2014-03-13 11:03:44 +02:00
Panu Matilainen a54b5d244f Pass file destination to fsm prepare hook without any suffixes
- The prepare hook is used for things like selinux label lookups
  which depend on exact filenames, and .rpmnew suffix will almost
  certainly mess up such a lookup, and could cause bad permissions
  (selabel or similar) if admin does 'mv foo.conf.rpmnew foo.conf'
2014-03-13 10:46:37 +02:00