Commit Graph

12662 Commits

Author SHA1 Message Date
Panu Matilainen 9c4bf14e29 Move newlines from error message strings to rpmlog() calls
- While the newlines are needed in rpm cli usage, other users
  might have other needs
2014-02-01 17:24:37 +02:00
Panu Matilainen 2fb3bace9a Eliminate filename argument from rpmpkgRead()
- Better done in upper level callers...
2014-02-01 17:16:22 +02:00
Panu Matilainen 338801ec4a Eliminate filename argument from parsePGPSig()
- This is better done centrally in upper level callers...
2014-02-01 17:14:49 +02:00
Panu Matilainen 8cbc1bd929 Return error message instead of logging from parsePGPSig()
- rpmlog() messages might be appropriate for rpm cli, but not
  necessarily for other users/contexts
2014-02-01 17:02:21 +02:00
Panu Matilainen c0c3f3f7b5 Handle error logging centrally in rpmpkgVerifySigs() 2014-02-01 17:01:13 +02:00
Panu Matilainen 567b544f34 Move logging out of rpmpkgRead()
- Return error messages via retval argument, leave logging to caller.
  Actually simplifies things somewhat, and paves way for saner API
  wrt error messages - not all callers want rpmlog() spew.
2014-02-01 16:00:25 +02:00
Panu Matilainen 6309d27ae6 Grab and optionally return keyid from rpmpkgRead()
- No functional change here, but we'll need this in next steps as
  with a simple integer passed around we dont need to worry about
  freeing resources.
2014-02-01 15:58:52 +02:00
Panu Matilainen 3e9d8b6d36 Eliminate bogus switch-cases from rpmReadSignature() returns
- rpmReadSignature() returns failure on NULL header anyway, so the
  "No signature available" message is not only misleading but also
  can never happen.
2014-02-01 14:51:09 +02:00
Panu Matilainen 2498f1caa0 Add python bindings + a testcase for the archive API
- Wouldn't be surprised in the slightest if various details here
  changed before an actual release, but its a start.
- Simple testcase showing spec file extraction from an src.rpm.
  Which also goes to show just how low-level our APIs are...
2014-01-31 12:49:54 +02:00
Panu Matilainen ee237ffdd9 Add internal rpmfiFound() helper function to match rpmfiSetFound()
- Makes the if that little bit more obvious and since we have
  a function for setting...
2014-01-31 10:26:33 +02:00
Florian Festi 8e5864a406 Move the check for missing files to iterReadArchiveNext() 2014-01-31 09:53:30 +02:00
Florian Festi 78dcf9d0cb Move archive handling functions into rpmarchive.h 2014-01-31 09:49:43 +02:00
Florian Festi 2092a11014 Rename rpmcpioStrerror to rpmfileStrerror and move it to rpmarchive.h and rpmfi.c
This makes the error codes part of the public API and allows using the new archive API.
2014-01-31 09:49:43 +02:00
Florian Festi 9dbd72ac72 Remove fsm->fflags 2014-01-31 09:49:43 +02:00
Florian Festi 51e8b94e95 Move RPMERR_* inst new rpmarchive.h 2014-01-31 09:49:43 +02:00
Florian Festi e13753421a Rename CPIOERR_* to RPMERR_* as they are not all related to cpio or the archive 2014-01-31 09:49:43 +02:00
Panu Matilainen 51cc2ec3b1 Support macro file load from Lua too (similar in rpm5.org as well) 2014-01-30 15:22:29 +02:00
Panu Matilainen 784dfb4219 Port %{load:<path>} macro from rpm5.org
- Allow loading custom macro files from eg specs. This is quite different
  from %include which inlines arbitrary content into a spec, but which
  cannot be used for including macro files as their syntax is entirely
  different. Both have their uses.
- rpm5.org also supports %load within macro files, we dont as I find the
  imperative %load very alien in what's otherwise an entirely declarative
  file "format"
2014-01-30 14:57:52 +02:00
Stanislav Ochotnicky 3f69897743 Use git index in %autosetup (RhBug:1059285)
- Without --index in apply, any file additions will not be committed and
  in case the patch contains *only* file addition the macro can fail
  completely (empty commit). With --index there's no need for -a in
  commit either.
2014-01-30 11:21:18 +02:00
Panu Matilainen f6481343d4 Check for duplicate %description sections too
- Similarly to Group, Summary etc, this is complicated by possible
  presence of language-specific versions, but now that we have a
  function to handle it...
- Should *really* close out ticket #27
2014-01-29 15:19:31 +02:00
Panu Matilainen 86f6bdaa07 Make addLangTag() internally available
- Just realized there was (at least) one more dupe-check missing...
2014-01-29 15:18:28 +02:00
Panu Matilainen 89ed8009eb Check for duplicate i18n tags in specs
- Check for per-package duplicate Group, Summary, Distribution, Vendor,
  License and Packager tags in specs. This is slightly tricky as there
  can be any number of different language variants present - see whether
  the number of strings in the tag itself or header i18n tag grew
  by adding something. If not, then its a dupe.
- Should close out remaining issues in ticket #27
2014-01-29 15:02:28 +02:00
Panu Matilainen fe8c82549a Detect and fail build on more than one %changelog section in spec
- One of the items in ticket #27...
2014-01-29 14:02:48 +02:00
Panu Matilainen deed47a654 Detect and fail build on more than one %files section per package
- Kinda related to ticket #27, although this particular case is not
  even mentioned there...
2014-01-29 14:02:31 +02:00
Panu Matilainen abbf4897db Initialize all the name services we need
- A long time ago in a far away commit, "somebody" had this less than
  brilliant idea that calling gethostbyname() loads all the required
  name service libraries (commit 39b75d24cf).
  This is of course only true if hosts db happens to use the same
  database as passwd and group... which often is the case, but by
  no means guaranteed or always the case.
- Add an explicit initializer for rpmug to force loading the name service
  libraries early in initialization so we dont need to worry about going
  chroot later on. Of course, the "host" name service configuration might
  not actually make sense for the chroot, but this commit doesn't make
  that any worse than it already was.
2014-01-28 09:45:55 +02:00
Panu Matilainen ee5a500fee Filter out garbage sonames from dependencies (ticket #158)
- The original case of empty string ending up in a dependency is already
  taken care of by commit 66a01c977e and
  soname filtering. However if filtering is disabled, an an empty
  (or all-whitespace) soname will produce gems like "()(64bit)" on
  multilib arches, so we need to sanity check the soname itself in
  elfdeps.
- The linker doesn't seem to care what kind of junk the soname contains,
  we care just a little bit more as eg empty strings and whitespace
  messes up other things.
2014-01-24 15:02:39 +02:00
Panu Matilainen 89df36524b Add %make_build macro for hiding parallel-build magic from specs (ticket #115)
- This allows simplifying the make invokations from specs. In particular
  the parallel build options no longer need to be messed with from specs,
  and %__make can be overridden to force a different make implementation
  to be used throughout the spec.
- While a lot of software builds correctly in parallel, there are always
  exceptions... together with _smp_ncpus_max macro this can now be
  expressed with a separate "%global _smp_ncpus_max 1" (or any other
  arbitrary value beyond which parallel build is buggy) line which
  is easy to grep for and experiment with.
2014-01-22 11:12:49 +02:00
Panu Matilainen 356fd73a7b Make CPU limit for building configurable through _smp_ncpus_max macro
- Makes the max number of cpu's used by %{_smp_mflags} configurable
  on spec, user or system level.
- Originally reported as RhBug:669638 and included in redhat-rpm-config
  in RHEL/Fedora, but makes sense to have generally available.
2014-01-22 11:11:05 +02:00
Panu Matilainen bdee597417 Include ppc64le in %power64 macro (RhBug:1052930)
- Should've really been in commit cf07feda05
- This kinda points out stupid these manually maintained %fooarch
  macros are, nobody remembers to update them.
2014-01-15 12:55:47 +02:00
Panu Matilainen 7ec2bbfce1 Sanity check sub-package name identically to main pkg name (RhBug:1039520) 2014-01-08 13:43:36 +02:00
Panu Matilainen bcba176fbf Ignore already removed links on fingerprint symlink correction
- For to-be-removed packages, we should only "correct" symlink fingerprints
  if the packaged link actually exists on disk, otherwise eg %pretrans hacks
  to do symlink -> directory replacement wont work as expected,
  as shown here with a reproducer and all:
  https://lists.fedoraproject.org/pipermail/devel/2013-December/193266.html

  In the old package, "hello" is in /usr/share/javadoc/test-1/ directory,
  to which the "test" symlink points to. In the new package,
  /usr/share/javadoc/test/ is a directory with "hello" file in it.
  Symlink correction causes the "hello" fingerprint to match between
  old and new, leading to erase of the old package not removing the
  "hello" file of the old package. Which is correct, except when
  the symlink has been removed, as is done here by %pretrans of the
  new package.
2014-01-08 09:49:33 +02:00
Panu Matilainen 209cd9f04a Use correct conversion format for python strpool id's
- We need an unsigned int, not unsigned long. Funnily enough "k"
  worked with gcc -O0 and -O1 but blows up when built with -O2.
2013-12-20 15:11:56 +02:00
Panu Matilainen d5e4ef4d05 Dup the file descriptor when reopening an rpm.fd in python
- Avoids a segfault on closing in some circumstances
2013-12-20 12:52:51 +02:00
Panu Matilainen 6bd4a7475f Add .open() class method to rpm.fd
- This is simply equivalent of calling rpm.fd constructor, but
  might be somewhat more natural way of opening files
2013-12-19 15:44:47 +02:00
Panu Matilainen d02d053ebe Remember open-mode and flags in python rpm.fd's as properties 2013-12-19 12:58:52 +02:00
Panu Matilainen 2dbfc7834d Add couple of missing RPMFILE_* symbols to python bindings 2013-12-19 12:33:17 +02:00
Panu Matilainen feafc9262e Support reopening an rpm.fd descriptor as well 2013-12-18 13:50:02 +02:00
Panu Matilainen ea89615cbc Honor mode and flags also when reopening an fd in python rpm.fd 2013-12-18 13:48:35 +02:00
Panu Matilainen f220f627f6 Construct mode as understood by librpmio in rpmfd constructor already
- No functional change here, but we'll need this for the next step
2013-12-18 13:42:43 +02:00
Panu Matilainen b272d61b1e Add python binding for rpmteFiles(), update docs 2013-12-18 10:59:16 +02:00
Panu Matilainen dacb51e2ba Export rpmteFiles(), deprecate rpmteFI()
- rpmteFiles() is the saner interface of the two, rpmteFI() is only
  kept around for backward API compatibility, for now
2013-12-18 10:56:54 +02:00
Panu Matilainen 3b086277b5 New rpmfile[s] python bindings
- rpmfiles is represented as a sequence of individual files, thus
  its iterable as-is
- Individual files are handled internally as index on rpmfiles handle,
  all data made available as read-only properties
- We can now consider the old, bizarre rpm.fi bindings as deprecated
2013-12-18 09:07:10 +02:00
Panu Matilainen 8a461bae4f Remove bogus __find_requires|provides macro definitions (RhBug:1043149)
- The paths defined in macros.perl have never even existed in rpm,
  would've always been suspect and nowadays mostly just plain useless
  as they'd only be used by the deprecated external dependency
  generator.
2013-12-16 10:46:09 +02:00
Panu Matilainen 8da9919885 Python 3 compatibility wrt python fi.FindFN()
- Strings from rpm are byte arrays from python 3 perspective
2013-12-13 16:20:30 +02:00
Panu Matilainen 2bb9b21cf5 Add a couple of basic tests for python stringpool 2013-12-13 16:07:16 +02:00
Panu Matilainen 56c8977e18 Allow a shared pool with python rpmds and rpmfi objects
- Add an optional pool argument to python rpmds and rpmfi constructors
  to allow using a shared string pool from python too
2013-12-13 15:47:50 +02:00
Panu Matilainen 68a24e72b0 Use the pool-aware constructors for rpmfi and all rpmds types
- Doesn't actually change anything yet as pool is always NULL
2013-12-13 15:43:39 +02:00
Panu Matilainen f720f23588 Add basic python bindings for rpm string pool
- Python users are unlikely to have much use for this thing as such,
  python has plenty enough native datatypes to not bother with rpm
  specialties. The primary reason for adding it is to allow utilizing
  a shared string pool for various rpm objects from python side as
  well. That'd only require being able to pass the pointer around
  for which we wouldn't need a full-blown object, but otoh creating
  test-suitet cases in python is nicer than in C so having at least
  the base methods available wont hurt...
2013-12-13 15:35:20 +02:00
Panu Matilainen d26511005f Clarify + document rpmfiles directory vs file index
- Rename the file index argument for rpmfnDI(), rpmfilesDI() and
  rpmfilesODI() to ix for consistency with other file index arguments
- Document rpmfilesDI() and rpmfilesODI() and its usage with rpmfilesDN()
  and rpmfilesODN()
2013-12-12 11:21:02 +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