Handle fork(), pipe() and dup2() failures in prelink helper launch

- Actually check the return codes from the stuff that matters and
  deal with failures. Incidentally also eliminates a compiler warning
  from set-but-not-used variable...
Handle fork(), pipe() etc failures in signing passphrase check

- Actually check the return codes from various things and handle
  the failures. This is nowhere near 100% correct still, but
  at least within spitting distance from the ballpark.
- Incidentally this eliminates the last compiler warning on the rpm
  codebase with current gcc (4.8.0), wohoo.
Report replaced files in verification

- Unlike other file states, replaced state is always a forced one
  and thus a likely problem. Always report replaced files in verify
  output by appending the state to the verify line, similar to
  strerror() for unexpected errors. In verbose mode, report all
  non-normal file states.
- Like any output change, this can potentially break user scripts but
  at least this way the breakage should be minimal as regular output
  does not change, and similarly appended error strings have been
  present since 4.4.x days.
Move rpmlibNeedsFeature() and addReqProv() prototypes

- rpmbuild_misc.h is just internal misc helpers whereas the
  dependency stuff has very much to  do with packages and the
  like. No functional changes, just clearing up stuff...
Use struct Package for source package too

- Makes the src.rpm that little bit more like other packages.
  Doesn't make things any saner here but we'll want to pass around
  package structs instead of headers later on.
Pass the entire package struct to writeRPM()

- Simplifies things a little bit, but mostly this is just paving
  way for next steps. Shouldn't change anything in practise.
Pass the entire package struct to cpio_doio() too

- The CSA thing is nearly useless now...
Eliminate the cpioSourceArchive struct

- Store archive size in the package struct, and now we can just
  axe the kinda hysterical CSA foobar, much simpler and saner this way
Pass the entire package struct to genCpioListAndHeader()

- Again simplifies things by having less junk to pass around,
  but more importantly paving way for next steps...
Pass the entire package struct to rpmlibNeedsFeature()

- Doesn't make much difference as it is, but pre-requisites for
  sanitizing the way dependencies are carried around.
Only pass the target package list, not entire spec, to newPackage()

- Its mildly hysterical either way, but it doesn't actually need
  the whole damn spec. More importantly allow passing NULL for
  "independent" package entities.
Use newPackage() to initialize source package too

- As newPackage() initializes the pkg header too, we now need
  a different way of checking whether initSourceHeader() has
  already been called. Checking RPMTAG_NAME should suffice for the job...
Pass the entire package struct to addReqProv()

- Still doesn't make much difference as it is, but further pre-requisites
  for sanitizing the way dependencies are carried around.
- Change rpmSpecDS() to return the ds based on the actual source package
  header, not buildRestrictions. Using buildRestrictions was probably
  kinda wrong to begin with but its more so now as the actual
  requires and conflicts go to the "real" header, not buildRestrictions.
Handle source vs binary pkg dependency difference in handlePreambleTag()

- We know perfectly well at handlePreambleTag() already whether something
  should go to binary or source package, pass the right pkg to
  parseRCPOT() so we dont need to fiddle with it there.
Fix ages old bug in rpmdsFind() wrt flags

- EVRs are pointers which in theory could be NULL so checking them
  is appropriate, but 0 is a perfectly legal value for flags and
  the bogus "NULL check" causes it to get things wrong if either or both
  flags are RPMSENSE_ANY
Make rpmdsMerge() return something meaningful

- The API documentation was always incorrect and meaningless, as
  rpmdsMerge() can merge any number of entries so there's no single
  index to return. Instead return the number of merged entries
  and adjust the docs to match the new behavior.
- This is of course an incompatible API change in a strict sense,
  but then since the documentation was always wrong to begin with
  anybody looking at rpmdsMerge() return is relying on undocumented
  behavior really. The compatible way to use this is to check
  for < 0 for errors and assume success otherwise.
Sanitize duplicate dependency checking at build

- Creating a new rpmds from header each time isNewDep() gets hideously
  expensive when the number of manual dependencies is high.
  Add prco etc rpmds structs to each package and use those to determine
  whether a dependency has already been seen: this way the ds'es remain
  sorted so rpmdsMerge() will do the right thing for regular
  dependencies. Triggers are somewhat different beasts with their
  index tags so at least for now just do a linear search like we
  always did for correctness.
- Makes worlds of difference for complex specs... the time to parse
  texlive.spec from Fedora goes down from ~27s to ~10s on my laptop
  with this change.
Optimize lookupPackage() a bit

- Remember the name of sub-packages in the Package struct, avoiding
  the need for headerGetString() in a loop, and also avoid unnecessary
  strdup() in the case name is not a partial one.
- Somewhat hysterically, this more than halves the time to parse the
  infamous texlive.spec on my laptop: the parse time is down from
  10.2s to 4.9s.
Avoid umphteen arguments to isNewDep() by creating the new ds earlier
Export the pool-aware rpmds constructors

- Private pools can be very expensive when constructing and tearing
  down dependency sets by the masses. Permit taking advantage of
  shared pool outside librpm internals.