Commit Graph

105 Commits

Author SHA1 Message Date
Panu Matilainen 819c6c8a3e Flag build-time rpmlib() dependencies in src.rpm as missingok
rpmlib() dependencies are an install-time barrier, but dependencies
in src.rpm are considered build-time dependencies. This paradox
is the crux of the problem in https://pagure.io/copr/copr/issue/1038.

We could move the rpmlib(DynamicBuildRequires) someplace else
(eg buildrecommends) to avoid the issue, but then the dependency has
technically every right to be there, and changing it would break
existing software (mock) relying on what we already released.
Adding MISSINGOK flag allows rpm to legitimately skip it while
installing, the build-side does its own checking independently.

This is not ideal as it requires backporting of commit
1ac16611f0 to older releases to fix,
but this is the least-worst compromise we were able to come up with.
2019-10-28 15:29:50 +02:00
Florian Festi 58dcfddc37 Add support for dynamic BuildRequires
Supports new %generate_buildrequires section in the spec file which is executed
after %prep. Stdout is captured and turned into BuildRequires. These are then
checked. If they cannot be fulfilled a source package is created with all
BuildRequires and the build is terminated after that.

rpmbuild has now the following new build modes -br, -tr, -rr and exits with 11
if build requirements are not met.

That means for users:
* No %generate_buildrequires
  * rpmbuild -br is equivalent to rpmbuild -bs
  * rpmbuild -br --nodeps is equivalent to rpmbuild -bs
* %generate_buildrequires
  * rpmbuild -br will check dynamic BuildRequires
    * Satisfied → src.rpm
    * Unsatisfied → buildreqs.nosrc.rpm
  * rpmbuild -br --nodeps will always generate buildreqs.nosrc.rpm

Source packages contain
Requires: rpmlib(DynamicBuildRequires) <= 4.15.0-1
if the spec contains a %generate_buildrequires section and
Provide: rpmlib(DynamicBuildRequires) = 4.15.0-1
if the results been added to the source package.

Co-authored-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2019-05-28 09:24:01 +03:00
Igor Gnatenko 8f509d669b add support for rich dependencies from dependency generators
Mostly achieved by replacing custom parser with the parseRCPOT().

Closes: https://github.com/rpm-software-management/rpm/issues/167
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2017-03-08 10:57:12 +01:00
Florian Festi a357c99c58 Do not write the dependencies to the header instantly.
Add the dependencies generated from the files to the package and write them to the header at the end.
2014-07-08 15:42:54 +02:00
Florian Festi 400834a731 Redo addReqProv to no longer deal with all tags explictly 2014-07-08 15:42:42 +02:00
Lubos Kardos 899d602616 addReqProv() and handleOneTrigger() now use rpmds with trigger indices. 2014-07-08 11:49:46 +02:00
Florian Festi 87fccc631b Add support for Recommends:, Suggests:, Supplements: and Enhances: 2014-02-19 12:11:27 +01:00
Panu Matilainen 304924b100 Utilize the shared string pool for manually specified dependencies
- Brings the texlive.spec parse time down from 4.8s to 3.6s on my
  laptop. Not bad for a one-liner.
2013-04-16 07:59:26 +03:00
Panu Matilainen 0dd6e4491b Avoid umphteen arguments to isNewDep() by creating the new ds earlier 2013-04-16 07:38:57 +03:00
Panu Matilainen d642df2a5c 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.
2013-04-15 18:14:02 +03:00
Panu Matilainen 42b2f78e72 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.
2013-04-15 15:23:37 +03:00
Panu Matilainen 0252fdf048 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.
2013-04-15 14:14:51 +03:00
Panu Matilainen 6d361d55d6 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...
2013-04-15 12:42:34 +03:00
Panu Matilainen 5c43095e1d Implement transaction ordering hinting
- Add support for new "OrderWithRequires: foo" spec syntax
  which has "if and only if foo is present in transaction, order
  the transaction as if this package required foo" semantics.
  While it looks, and in some ways is, a soft dependency, this
  is not the same as recommends/suggests etc: those have unknown
  depsolver policy dependent semantics attached to them, whereas
  ordering hints have a clear definition and is only relevant for rpm
  itself, depsolvers should not even look at the data.
- This allows packages to express correct ordering for optional
  functionality, such as

      %post
      if [ -x %{_bindir}/register-component ]; then
          %{_bindir}/register-component %{name}
      fi

  If the package containing %{_bindir}/register-component is included
  in the same transaction, it makes sense to have it installed before the
  package(s) that use it. But as it is fully optional, Requires would
  not be appropriate. Using OrderWithRequires allows this to be expressed
  without dragging in extraneous dependencies for optional functionality.
2010-12-13 12:26:06 +02:00
Panu Matilainen 7c44f57977 Brute-force s/rpmTag/rpmTagVal/ in entire librpmbuild
- Many of these cases would be true enums from preambleList & similar,
  except for the list terminating sentinel. Just switch all the
  remaining rpmTag's to rpmTagVals to bring our enum-whacking to
  a grande finale.
2010-10-22 13:50:05 +03:00
Panu Matilainen c60bf8f766 Avoid stepping on toes of relatives, part 3
- Eliminate remaining (hopefully) C++ reserved keywords in librpmbuild
2010-09-21 15:07:08 +03:00
Panu Matilainen 555f699f11 Mass eviction of remaining internal helpers in librpmbuild API
- Yank everything qualifying as "internal helper function" into
  internal-only headers, loosely grouped as follows:
  1) Everything involving spec-manipulation goes into rpmbuild_internal.h
  2) All other miscellaneous helpers go into rpmbuild_misc.h
- This leaves us a rather minimal, and nearly useful API into librpmbuild:
  Users need to be able to parse a spec, query or build (parts of) it
  and free up the spec structure when done. This is what we have now,
  various still exposed structures not counting.
2010-08-25 15:41:09 +03:00
Panu Matilainen 94a58d3864 Eliminate unused spec argument from addReqProv()
- addReqProv() only operates on the header, not spec
2010-08-25 15:06:47 +03:00
Panu Matilainen 75cccc91f3 Free up three bits from rpmsenseFlags
- pass the wanted dependency type to addReqProv() as tagN argument
  (previously unused, eh...) instead of taking up three precious bits
  for internal-only purposes from a constrained bitfield
2010-03-29 05:59:54 +03:00
Panu Matilainen 9fbaedd1ac Ensure rpmlib() dependency sanity on build
- only requires on rpmlib(foo) are allowed
- make sure any rpmlib() foo dependencies have RPMSENSE_RPMLIB bit set,
  rpmdeps as external dependency generator can create rpmlib() dependencies
  without the bit set, and also any manual rpmlib() deps wont have it
2009-10-21 12:23:50 +03:00
Panu Matilainen 0c4e48de79 Replace equal/not equal uses of str[n]cmp() with rstreq[n] in build code 2009-08-31 11:08:05 +03:00
Panu Matilainen 3ae20cd53d We always add EVR and Flags to dependencies, remove bogus condition 2009-08-20 13:04:21 +03:00
Panu Matilainen 10772ac7df Fix duplicate dependency checking on build
- Broken by commit af8b41c64a which
  simplified too much.
- There's no guarantee that rpmdsNew() returns a sorted dependency set
  so rpmdsFind() doesn't work correctly here. Walk the ds manually instead.
- With multiple triggers of same type, identical trigger conditions on
  different trigger script were seen as duplicates (RhBug:490378)
- Split the duplicate checking to separate helper function for clarity
2009-08-20 13:02:05 +03:00
Panu Matilainen 6844c194cc use type-specific headerPut() on all of build/reqprov.c 2008-06-19 15:45:57 +03:00
Panu Matilainen f6a8d969de Convert build reqprov to headerPut()
- also changes index type to uint32_t instead of signed
2008-06-17 12:56:53 +03:00
Panu Matilainen af8b41c64a Use rpmds methods to check for duplicates in addReqProv()
- simplifies things quite a bit...
2008-05-26 16:24:07 +03:00
Jindrich Novy 641046e4da Use dynamic allocation in rpmlibNeedsFeature() 2008-04-11 15:52:56 +02:00
Panu Matilainen d718b12f5b Mass convert (back) to rpmTag as it's usable everywhere now
- cast away a few cases where the enum usage causes ridiculous amount
  of compiler warnings from unhandled switch-cases
2008-02-05 17:42:19 +02:00
Panu Matilainen 130118d594 Use rpmTagType always now that it's available everywhere
- RPM_MASK_TYPE is not a datatype, move it out of the enum
- add missing cases python header handling to shut up gcc
2008-02-05 16:14:34 +02:00
Panu Matilainen f53c323372 Make rpmtag.h standalone, include from rpmtypes.h
- permits header.h to use the tag types
- revert other includes back to header.h, more crazy #include churn...
- rpmTagTable etc in header.h for now, don't really belong there but...
2008-02-03 16:24:07 +02:00
Panu Matilainen 99faa2735b rpmlib.h mass eviction
- explicitly include what's really needed instead
- document remaining uses
2008-01-30 13:53:51 +02:00
Panu Matilainen addac6a86b Add rpm_data_t (and _constdata_t) for header data, use everywhere
- consistent, easy to grep for and change...
- bogus consts removed where spotted
2007-12-19 12:05:56 +02:00
Panu Matilainen 1e96ead466 Use rpm_tagtype_t everywhere for rpm (header) tagtype type
- typedef'ed as uint32_t, doesn't matter much but negative types dont exist
- easy to grep, easy to change...
- define RPM_FORCEFREE_TYPE instead of -1 "magic" for forcing
  headerFreeData (ugh), easier to grep for and change than "-1"
2007-12-13 20:35:33 +02:00
Panu Matilainen 7e56c6355b Use rpm_tag_t everywhere for rpm (header) tag type
- typedef'ed as int32_t for now, negative values used in some places for
  error cases
- easy to grep, easy to change...
- add RPMTAG_NOT_FOUND define, used in place of -1 "magic",
2007-12-13 19:32:37 +02:00
Panu Matilainen c8f2927227 Use rpm_count_t everywhere for header data count
- typedef'ed as uint32_t as that's the key size limit imposed by BDB,
  relevant for RPM_BIN_TYPE
- easy to change to whatever later on as it's now consistent everywhere
2007-12-13 09:25:10 +02:00
Panu Matilainen 9ce13e09ef Switch to <rpm/foo.h> style for public headers
- adjust include paths accordingly
2007-12-08 14:02:32 +02:00
Ralf Corsépius abeea80a38 Use #include <x.h> syntax to include public headers. 2007-11-23 06:46:19 +01:00
Panu Matilainen 2c2538d726 Rename Spec -> rpmSpec for namespacing 2007-09-21 15:23:02 +03:00
Ralf Corsépius 32419bbba5 Remove splint tags. 2007-09-11 23:03:27 +02:00
jbj dfcc573288 Splint fiddles.
CVS patchset: 7438
CVS date: 2004/10/09 18:23:00
2004-10-09 18:23:00 +00:00
jbj 86f5190567 Dump multilib code, colored depndencies instead.
CVS patchset: 5990
CVS date: 2002/12/31 02:12:02
2002-12-31 02:12:02 +00:00
jbj e5fb770e7d Add boundsread annotations throughout, enable +bounds checking.
Start narrowing the scope of bounds annotations by adding more annotations.

CVS patchset: 5537
CVS date: 2002/07/02 23:54:35
2002-07-02 23:54:35 +00:00
jbj 13d177beb2 Add boundswrite annotations everywhere.
CVS patchset: 5522
CVS date: 2002/06/23 19:47:08
2002-06-23 19:47:08 +00:00
jbj 9f45bcd3ec More lclint annotations.
CVS patchset: 5116
CVS date: 2001/10/16 14:58:57
2001-10-16 14:58:57 +00:00
jbj 72471f2e54 Explicit branchstate annotations.
CVS patchset: 5113
CVS date: 2001/10/15 17:53:34
2001-10-15 17:53:34 +00:00
jbj 1b87bd9ef7 - remove dead code frpm popt table reorg.
- more CLI typedefs/prototypes moved from rpmlib.h to rpmcli.h.
- rpm --verify skips files in non-installed states.
- rpm --verify skips content checks for %ghost files.
- rpm --verify displays config/doc/gnost/license/readme atrrs for files.
- rpm --verify checks immutable header region digest if available.
- rpmbuild adds header region digest (SHA1 as string).
- use rpmTag* typedefs in new hge/hae/hme/hre header vectors.

CVS patchset: 4854
CVS date: 2001/06/12 04:10:21
2001-06-12 04:10:21 +00:00
jbj 0ecdbba935 - yet more boring lclint annotations and fiddles.
CVS patchset: 4732
CVS date: 2001/04/30 22:32:22
2001-04-30 22:32:22 +00:00
jbj 3b5820c420 - globalize _free(3) wrapper in rpmlib.h, consistent usage throughout.
- internalize locale insensitive ctype(3) in rpmio.h
- boring lclint annotations and fiddles.

CVS patchset: 4721
CVS date: 2001/04/29 01:05:43
2001-04-29 01:05:43 +00:00
jbj 2e13767946 doxygen annotations for build/*.
- fix: don't hang on build error.
- fix: remove "error: " prefix from signature verification message.

CVS patchset: 4426
CVS date: 2001/01/11 14:13:04
2001-01-11 14:13:04 +00:00
jbj db32ab6bea Sync with rpm-4_0 branch.
CVS patchset: 4338
CVS date: 2000/12/12 20:03:45
2000-12-12 20:03:45 +00:00