- 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.
- 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.
- 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.
- 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
- 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.
- 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...
- Eliminates some copy-paste slopping. Verify code traditionally only
shows the first attribute, take care to keep that format to avoid
breaking scripts unnecessarily
- 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>"
- 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.
- 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
- 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
- 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