Commit Graph

207 Commits

Author SHA1 Message Date
Panu Matilainen 928386a317 Report config and missinok flags in deptype format extension too 2012-07-11 15:10:08 +03:00
Panu Matilainen ead20c495c Oops, newlines dont belong in format extension output
- Thinko in commit 6acef96d9e, duh
2011-12-15 15:21:57 +02:00
Panu Matilainen 1e0e3e01d2 Doh, somehow managed to miss the warnings from these missing includes :(
- Should've been in commit 70f063cb77
2011-11-10 08:46:59 +02:00
Panu Matilainen 70f063cb77 Make base64 encoding/decoding part of rpmio public API
- Base64 is present in headers and all, it's only reasonable that
  our API users have access to this functionality without having
  to link to other libraries. Even if we didn't want to carry the
  implementation forever in our codebase, we should provide a wrapping
  for this (much like the other crypto stuff) for the reason stated above.
- A bigger issue is that our dirty little (badly hidden) secret was using
  non-namespaced function names, clashing with at least beecrypt. And we
  couldn't have made these internal-only symbols even on platforms that
  support it, because they are used all over the place outside rpmio.
  So... rename the b64 functions to rpmLikeNamingStyle and make 'em public.
  No functional changes, just trivial renaming despite touching numerous
  places.
2011-11-09 15:16:28 +02:00
Panu Matilainen 5722245dd8 Take advantage of pgpPrtParams() directly in pgpsigFormat() extension
- No functional changes, just bypassing an unnecessary round-trip to
  a function really intended for other purposes, now that we can.
2011-11-09 13:29:42 +02:00
Panu Matilainen cde47f5945 Use pgpDigParamsAlgo() throughout the codebase
- Tedious but straightforward conversion to use the API instead
  of going to the struct directly.
- Remove digest.h includes where no longer necessary
2011-11-07 14:47:03 +02:00
Panu Matilainen f3a8970e73 Take advantage of parsePGPSig() in pgpsigFormat() too
- Doesn't make for less lines in this case but unifying the accesses
  is good anyway.
2011-11-07 11:21:31 +02:00
Panu Matilainen 97a452f732 Sanitize pgpsigFormat()
- Eliminate bogus size calculations: we have a buffer of td->count size
  that may or may not contain legal OpenPGP signature. Leave it up to
  pgpPrtPkts() to validate & figure it out and check its return code instead,
  eliminating need to repeat a bunch of tedious calculations here.
- Use non-zero signature version is used as a hint for valid signature,
  should be "close enough" for the rest of the code.
2011-10-24 12:34:07 +03:00
Panu Matilainen 1f1e5e88a1 Handle query format field width centrally in formatValue()
- Eliminate the quirky formatPrefix buffer argument to formatter functions,
  deal with the width at formatValue() if specified.
- This not only simplifies things a great deal, removes a nasty
  unbounded buffer writing from formatter functions and speeds things
  up somewhat by removing extra rasprintf()'s in many cases, it also
  gives us width formatting of everything including "error messages"
  like "(none)" and "(not a number)" which previously got dumped without
  any formatting.
- The cost of this is the loss of zero padding support for numeric
  data but that's hardly a big deal.
2011-08-17 10:59:49 +03:00
Panu Matilainen 6acef96d9e Clean up + simplify pgpsigFormat()
- Don't do manually what the computer can do for you, let rasprintf()
  calculate the string sizes
- Handle possible date conversion errors: if we can't format the
  date correctly then at least show the integer value along with
  a complaint
2011-06-01 11:31:55 +03:00
Panu Matilainen 738d05bb1b Eliminate dead NULL-assignments at scope-end in librpm, part I
- Remove NULL-assignments of local variables at the end of scope
  in header + tag- and format-extension code. While this
  NULL-on-free idiom of rpm codebase is harmless as such, these
  unnecessary NULL-assignments have the effect of hiding real problems
  in the amount of noise they generate on code analysis.
- While the changes are supposedly trivial, doing this in smaller parts
  to make bisecting easier in case a some regression slips through.
2011-05-28 22:24:20 +03:00
Panu Matilainen d7e2a04d68 Teach rpm about post-transaction dependencies
- %posttrans dependencies have their own peculiar semantics, they're
  install-only dependencies which have no implications on ordering.
2011-01-25 15:27:28 +02: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 d4879f3e6e Move format extension table a bit to avoid unnecessary forward declaration 2010-09-21 12:45:53 +03:00
Panu Matilainen b0d62148a9 Use proper types for tag and format extension functions
- Stuff the tag prototypes into misc.h in lack of better place
- Actually use the headerTagFooFunction prototypes instead of void *
2010-09-21 12:23:18 +03:00
Panu Matilainen 1dd5b084bd Add internal helper for formatting file attribute strings
- Eliminates some copy-paste slopping. Verify code traditionally only
  shows the first attribute, take care to keep that format to avoid
  breaking scripts unnecessarily
2010-05-28 12:57:59 +03:00
Panu Matilainen 00f1a6e0b1 Add header extension tag RPMTAG_FILESTATUS for file verification
- Permits basic file verification with just a headerGet(), with some
  caveats: there's no way to control which attributes get verified,
  and there's no filtering of mtime differences of shared files. Those
  aside, rpm -q --qf "[%{filestates:vflags} %{filenames}\n] <args>" now
  performs the same as "rpm -V --nodeps --noscripts <args>"
2010-05-28 12:21:34 +03:00
Panu Matilainen ac0ab016a5 Add internal helper for formatting verify flags 2010-05-28 12:18:26 +03:00
Panu Matilainen e63293b0ea Use pgpValString() for :pgpsig header formatting (RhBug:587755)
- instead of copy-slopping (and forgetting to do so whenever something
  changes) just use the values we know from pgpVals..
2010-05-19 15:33:52 +03:00
Panu Matilainen c0eb82dd1f Teach rpm about pre-transaction dependencies
- A pre-transaction dependency is generally anything that must be
  available at the start of the transaction, and cannot be resolved
  by packages *in* the transaction. This lets %pretrans scriptlet
  dependencies be expressed correctly, and could be also used for
  other kinds of pre-conditions.
- rpmlib() dependencies are a special case of pre-trans dependencies
  but leaving them handled separately as they cannot be provided by
  anything in rpmdb either, whereas pretrans dependencies can.
2010-03-29 08:58:27 +03:00
Panu Matilainen 750b534942 Report all enabled dependency bits in deptype format extension
- dont make assumptions about which bits can be enabled simultaneously,
  just dump 'em all
2010-03-29 07:20:33 +03:00
Panu Matilainen 18f0d305f0 Bah, missing include in commit 121f73bb49 2010-02-09 09:45:58 +02:00
Panu Matilainen 121f73bb49 Add macro expansion queryformat extension
- unused at the moment but doesn't hurt anything either...
2010-02-09 09:35:52 +02:00
Panu Matilainen 0dcf65119a Add file verifyflags format extension 2009-10-30 09:33:26 +02:00
Panu Matilainen 491cf5e344 Add file state format extension 2009-10-30 09:15:36 +02:00
Panu Matilainen 746070ebe1 Replace equal/not equal uses of str[n]cmp() with rstreq[n] in header code 2009-08-31 12:43:02 +03:00
Panu Matilainen 9c7bcba82a Deal with multiple scriptlet dependency bits in deptype format extension
- rpmbuild permits Requires(post,postun) style notation which gets lumped
  into single dependency, report them all
2009-06-01 12:53:08 +03:00
Panu Matilainen 7115b8257e Add "deptype" format extension 2008-12-09 10:06:39 +02:00
Panu Matilainen 74ed5372f6 Make depflagsFormat() accept any numeric type 2008-11-17 12:44:57 +02:00
Panu Matilainen 05a3d00162 Simplify xmlFormat() by taking advantage of rpmtdClass() 2008-11-17 12:42:53 +02:00
Panu Matilainen 8ef09ba46c Make fflagsFormat() accept any numeric type 2008-11-17 12:41:24 +02:00
Panu Matilainen 53dcad2f9d Make permsFormat() work with any numeric type 2008-11-17 12:39:13 +02:00
Panu Matilainen 5580fe23d5 Make triggertypeFormat() work for any numeric type 2008-11-17 12:37:42 +02:00
Panu Matilainen f31b790c31 Make shescapeFormat() to accept any numeric type 2008-11-17 12:34:22 +02:00
Panu Matilainen 2b3380aa34 Take advantage of rpmtdGetNumber() for date format specifiers
- dateFormat() and dayFormat() now work for any numeric type
2008-11-17 12:29:01 +02:00
Panu Matilainen ee6c147a23 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
2008-11-17 12:23:19 +02:00
Panu Matilainen d97e357560 Simplify stringFormat() by using rpmtdGetNumber() 2008-11-17 12:16:51 +02:00
Panu Matilainen 5e40a2eb77 Couple of more 64bit format types 2008-06-07 11:43:54 +03:00
Panu Matilainen be712bc960 Use inttypes.h formats in stringFormat()
- add 64bit type while at it
2008-06-07 11:29:16 +03:00
Panu Matilainen d2ef49038a Include rpmtypes.h first instead of rpmtag.h everywhere 2008-05-21 15:59:39 +03:00
Panu Matilainen 7d38c6e2d8 Split tag extensions out of formats.c
- they have practically nothing in common now..
2008-05-21 12:04:51 +03:00
Panu Matilainen a668b84c95 Minor fixes to triggercondsTag()
- lose unused variable
- remember to reset versions iterator too
2008-05-21 12:04:51 +03:00
Panu Matilainen bda56cc437 Resurrect triggercondsTag()
- convert to use new interfaces and simplify
2008-05-21 12:04:51 +03:00
Panu Matilainen 34151a9e35 Turn rpmtd freeData into flag bitfield, allowing more precise control
- headerGet() returns even array data in a single allocation block, but
  regular (string) arrays need to have the pointers in array freed too
- set immutable flag on header data
2008-05-21 12:04:51 +03:00
Panu Matilainen 7c3d5dc15d Add arraysize format
- it's a bit silly but avoids ugly special casing in formatting
2008-05-21 12:04:51 +03:00
Panu Matilainen fc38b84c01 Lose the useless rpmtdToString()
- either use rpmtdFormat() or xstrdup() on rpmtdGetString() as appropriate
2008-05-21 12:04:51 +03:00
Panu Matilainen fae1edeb93 Lose padding argument from formatters
- formatPrefix already contains the padding, just use rasprintf() on that
  to get properly allocated buffer without messing with it manually
- xml format doesn't honor padding anyway so don't bother with it
2008-05-21 12:04:50 +03:00
Panu Matilainen 86bd819cee Treat all integer types as unsigned in formatting 2008-05-21 12:04:50 +03:00
Panu Matilainen efa130cee8 Simplify xmlFormat()
- use rpmtdFormat() to convert all data, xmlFormat() only adds the
  xml markup now
2008-05-21 12:04:50 +03:00
Panu Matilainen 9b32e58e17 Add rpmtdFormat() method and enumeration of supported formats
- permits formatting any rpmtd data to our supported formats over
  iteration
2008-05-21 12:04:50 +03:00