Commit Graph

126 Commits

Author SHA1 Message Date
Panu Matilainen 591f95a849 Export file verification as a rpmfiles/rpmfi method
Turn rpmVerifyFile() into indexed rpmfilesVerify() method but
drop the unnecessary double return code which also "fixes" the
oddball argument order where return value is not last, add
thin wrapper for rpmfi iteration. Mark rpmVerifyFile() deprecated
due to the strange calling conventions and unused arguments.
Leaving the code in verify.c to make it clearer what changed, looks
a bit out of place but doesn't matter as it doesn't need access
to rpmfi(les) internals.

Verification functionality as such is supposed to be unchanged by this.
2016-10-27 15:38:09 +03:00
Panu Matilainen ee9c572962 Eliminate deprecated rpmfi functions
rpmfiDecideFate() and rpmfiConfigConflict() should've never been
public in the first place, they're only meaningful to the transaction
internals really. rpmfiMD5() hasn't been adequate for the task
since 2008 or so, enough is enough.
2016-10-24 12:40:00 +03:00
fin@linux.vnet.ibm.com ab5c6243a6 Add support for file signatures to rpmfi and rpmfiles
This patch adds file signatures and file signature length to rpmfiles.
These new members are set in rpmfilesPopulate, and they can be accessed
with rpmfiFSignature.

Changelog:
- simplified logic in rpmfilesPopulate
- removed empty line

Signed-off-by: Lubos Kardos <lkardos@redhat.com>
2015-08-12 13:58:27 +02:00
Florian Festi b151b5297b Fix doxygen warnings
Make shure parameter descriptions in doc strings match the functions
2015-02-17 15:31:22 +01: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
Florian Festi 51e8b94e95 Move RPMERR_* inst new rpmarchive.h 2014-01-31 09:49:43 +02:00
Panu Matilainen 6c165f507d Document rpmfiles API, tweak rpmfi docs a bit to differentiate
- rpmfiles API is mostly a copy-paste of rpmfi with index argument
  added
- clarify rpmfi.h docs to speak about "file info set iterator",
  rpmfiles.h is the "file info set" thing now
2013-12-11 17:21:37 +02:00
Panu Matilainen c61c2e00f7 Make the relevant rpmfiles accessor functions public
- All the public rpmfiFoo() accessors have an indexed rpmfilesFoo()
  counterpart, make the rpmfiles-versions public too.
- The noteworty exceptions are rpmfiDecideFate() and rpmfiConfigConflict()
  which shouldn't have been public in the first place, and are to be
  removed from the API in the next API break. So we're not adding
  new rpmfiles-counterparts for functions that are to be removed
  from the (public) API. Actually document the issue by deprecating
  both rpmfi-functions.
- The iterator types need to be in rpmfiles.h as the iterator
  constructor is there (otherwise there'd be a cyclic include
  between rpmfiles.h and rpmfi.h, which wont do...)
2013-12-11 16:47:35 +02:00
Panu Matilainen 05eeece43a Move file related defines and typedefs to a new public rpmfiles.h header
- Preparation for making the indexed rpmfiles API public, API users
  are not affected as rpmfiles.h is included from rpmfi.h now. rpmfi.h
  is for the iterator part only.
2013-12-11 16:00:34 +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
Florian Festi 7ffa843dd0 Implement rpmfiFindFN() 2013-10-29 15:11:59 +01:00
Florian Festi 85f42455eb Implement rpmfiFLinks and reimplement rpmfiFNlink
using header data. This will replace the hard link handling in the fsm.
2013-10-29 15:03:45 +01:00
Panu Matilainen 5e89283259 Export the pool-aware rpmfi constructor
- Similar as commit 541234b02e for rpmds,
  but speed is less of an issue with the complex rpmfi's than single
  rpmds'es where private pool construct+teardown can be very expensive.
  With rpmfi's the bigger gain from shared pools is memory savings,
  permit taking advantage of this outside librpm internals.
2013-06-07 11:38:07 +03:00
Panu Matilainen fdb9b9e902 Preliminaries for turning fsm file actions into more of a bitfield
- Introduce rpmFileActionFlags enumeration for carrying additional
  flags associated with a rpmFileAction. For now the only flag
  is "unowned", more are to follow later.
- Add new rpmFsmOp type which is a combination of rpmFileAction
  and rpmFileActionFlags + macros to get the action and flags halfs.
- Creating new types instead of just sticking them at the upper half of
  rpmFileAction to allow indicating the type of data to be expected
  in the API. For now this stuff is solely for the benefit of plugins so
  hiding them in the non-public rpmplugins.h header until the
  situation clears up and stabilizes: rpmFileAction is a funky mix of
  what should be separate enumerations (eg state and action) + flags,
  but to avoid having to change all that at once...
2013-03-21 12:48:08 +02:00
Panu Matilainen f1d14db46d Explicitly enumerate our file actions
- Makes it easier to see how many bits the current stuff is using,
  no functional changes.
- Document FA_COPYIN and FA_COPYOUT as obsolete and unused
2013-03-21 12:09:15 +02:00
Ville Skyttä 8002b3f985 Spelling fixes.
Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-02-19 21:35:40 +02:00
Panu Matilainen 3ff6fdd688 Hide the strpool-related rpmts/rpmfi/rpmds interfaces out of sight for now
- In the package/transaction related things the strpool is more of
  an internal implementation detail than an end-goal in itself, move
  string pool related interfaces of rpmts, rpmfi and rpmds to
  internal-only APIs for now. The kind interfaces we'll want to eventually
  export a) dont exist yet and b) are likely to be something very different.
- The string pool itself remains exported however, its a handy data
  structure for all sorts of things and both librpm and librpmbuild
  heavily use it already.
2012-11-01 09:59:57 +02:00
Panu Matilainen bfde7c4d0a Add getters for rpmfi base- and directory name pool id's 2012-09-12 19:12:56 +03:00
Panu Matilainen 00b6d69a7a Add getter methods for rpmds and rpmfi string pool handle 2012-09-12 12:53:56 +03:00
Panu Matilainen f0a9d2577b Add an alternative rpmfi constructor to allow shared pool usage
- rpmfiNewPool() allows specifying shared/private pool, and
  rpmfiNew() is now just a wrapper to always call it with a private pool.
2012-09-07 15:48:45 +03:00
Panu Matilainen 8d277bbba6 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.
2012-05-16 10:58:00 +03:00
Panu Matilainen 8e609fc55b Eliminate no longer needed RPMFI_ISBUILD and RPMFI_ISSOURCE internal flags 2012-01-11 15:47:12 +02:00
Panu Matilainen 172af97d77 Add + use helper macro for testing for installed file state 2011-09-01 12:07:30 +03:00
Panu Matilainen ea951fca34 Eliminate pgpHashAlgo uses in librpm side
- In all these cases the value comes from a non-enum source so
  just use an int instead
2010-10-22 13:06:36 +03:00
Panu Matilainen 327ad093ef Change rpmfiNew() tag argument to rpmTagVal
- The argument is actually unused, but that only makes it even more
  stupid to require C++ callers to potentially having to cast.
2010-10-22 11:33:32 +03:00
Panu Matilainen adbd484372 Make RPMFILE_STATE_MISSING part of the rpmfileState enum
- Shuts up couple of "not in enum" complaints from gcc, and actually
  "no state" is a perfectly valid state for one case: non-installed
  packages (so remove the "not valid" comment from formats.c)
- OTOH, this created a new complaint for not handled case in a switch.
  Oh well, fix it up too...
2010-09-28 23:06:29 +03:00
Panu Matilainen 2fb15a5443 Stop abusing enum typedefs for bitfield types
- Enums are fine for defining the bitfield flags, but the bitfield
  itself is not an enumeration. Add a separate typedef on "rpmFlags"
  type (presenting a bitfield of flags) for all of these. Compilers
  hardly care, but the typedefs give a nice visual clue for
  us humans using these flags far away from ho^H^H definitions.
2010-09-21 11:10:14 +03:00
Panu Matilainen 92c12d1a8e Eliminate all fooUnlink() functions out of the API
- These are internal helpers only, all refcount users need to use
  fooFree() or similar for correct operation. Add fwd declarations
  where necessary to avoid moving code around unnecessarily.
- We could add these back later as aliases to fooFree() but for now,
  just get them out of the way.
2010-09-13 13:08:33 +03:00
Steve Lawrence 5779fb12e2 Remove the existing %policy directive
Remove the existing %policy directive, to be replaced with a new
%sepolicy section with more configurable options.
2010-09-01 09:04:15 +03:00
Panu Matilainen c586c9955c Lose the useless rpmfi refcounting etc debug messages + debug switches
- get the debug messages out of API, this is what should've been in commit
  dbdbe8010c
2010-03-22 12:49:45 +02:00
Panu Matilainen 74a4f639e2 Lose unused/useless Type and tagN fields from rpmfi struct 2009-03-27 16:12:25 +02:00
Panu Matilainen 1698771182 Perform relocations from rpmte instead of rpmfi
- rpmte has all the necessary bits at hand, rpmfi does not
- avoids silly ping-pong through transaction set to get to the ts element
- avoids recalculating number of relocations
- avoids accessing rpmte struct outside rpmte.c
2008-12-22 15:29:52 +02:00
Panu Matilainen 7d371fdaa3 Add public rpmfi function for retrieving digest algorithm of the set
- the information is already available through rpmfiFDigest() but that
  requires valid iteration index to be active, whereas the digest algo
  is per info set, not per file
2008-12-11 10:17:48 +02:00
Florian Festi 395b5cffd5 Move ->actions from rpmfi to rpmfs
and adjust all code using it
also "revert" a4e345455d
 "Move file action calculations to rpmfiNew() where possible"
2008-12-10 13:40:53 +01:00
Panu Matilainen 01739ef5d6 Eliminate silly rpmfiTypeString()
- Transaction elements are install/erase type, not file info sets,
  rename to rpmteTypeString(). It's only "useful" for fsm internal
  debugging messages, hide it there.
2008-11-27 09:39:40 +02:00
Panu Matilainen 0c4aa20a0a Add rpmfiFLang() method for retrieving file language(s)
- hardly anything needs outside install internals but it's harmless too...
2008-11-20 09:36:47 +02:00
Panu Matilainen 3b8ebf377b Oops, file modes are needed on erase too to avoid suffixes on directories 2008-11-19 15:52:03 +02:00
Panu Matilainen 763cbf05b5 Use finer grained rpmfi creation flags for in rpmteNew()
- also call the erase flags erase, not remove...
2008-11-18 18:54:26 +02:00
Panu Matilainen 0e65e6e92c Add preliminary rpmfi flag groupings for base operations
- just a start and probably not 100% accurate..
2008-11-18 18:32:58 +02:00
Panu Matilainen 219ba34736 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
2008-11-18 17:38:53 +02:00
Panu Matilainen f41bd90c2a 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)
2008-11-18 16:33:07 +02:00
Panu Matilainen 341aaa6515 Remember rpmfi creation flags 2008-11-18 11:26:56 +02:00
Panu Matilainen 79225b7487 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
2008-11-14 22:44:07 +02:00
Panu Matilainen 78df129248 Add rpmfi get + set methods for file actions 2008-11-11 22:09:48 +02:00
Panu Matilainen 0cf0a7bb68 Add couple of new rpmfi flags for file classes and file depends 2008-10-30 13:47:40 +02:00
Panu Matilainen 8f41e940ab Turn rpmfiNew() scareMem argument into bitfield of flags
- preserve behavior with 0/1
- more room for controlling what gets loaded into file info set, not
  everything is needed at all times
2008-10-30 13:47:40 +02:00
Panu Matilainen 97ab15cc9e Add fsm and rpmfi machinery for file capabilities
- new rpmfiFCaps() API to retrieve the info from rpmfi set
- fsm internals quite similar to selinux handling
- plenty of #ifdef's, another possibility would be adding cap_foo dummies to
  system.h like for selinux
2008-10-29 11:49:38 +02:00
Panu Matilainen 7dc709b517 Make rpmfiFSize() return rpm_loff_t type, fixup callers
- Internally file sizes are still stored as 32bit, going to 64bit wouldn't
  make much sense (would only waste memory for nothing) as long as we're
  bound by cpio's 32bit per-file limit. Being "64bit ready" for filesizes
  doesn't hurt anything though...
2008-06-12 16:41:31 +03:00
Panu Matilainen 6b3e0cc97b Eliminate rpmfiBuildFNames() from the API
- headerGet() with extensions enabled provides a nicer interface to
  the data, no need to expose it
2008-06-10 14:36:12 +03:00
Panu Matilainen 29bdb49f16 Add rpmfiFDigestHex() for converting the binary digest to hex
- conversion (back to) hex presentation is done manually in several places,
  might as well have a function to do it...
2008-06-02 09:50:48 +03:00