Commit Graph

133 Commits

Author SHA1 Message Date
Michael Schroeder 87b8b19eba Add rpmalLookupTE helper
It returns the index of a transaction element in the available
packages list, or (unsigned int)-1 if not fould.
2017-08-10 09:46:13 +02:00
Michael Schroeder 4991766490 Do self-conflicts/obsoletes filtering in rpmalAllFileSatisfiesDepend
This is a bit cleaner, and it also fixes a bug when there is a
self-conflict in the file list and another packages provides the
conflicting file.
2014-08-21 11:43:54 +02:00
Michael Schroeder 23d7204248 Do not match obsoletes against provides in rpmal
Always match against the package NEVR. We still check the package
name so that we don't end up with too many duplicates.
2014-08-21 11:11:53 +02:00
Michael Schroeder 5e68ca62e0 Do not bother with separate notifications on multiple provides matches
In the spirit of commit 272eaae387.
2014-08-21 11:00:17 +02:00
Michael Schroeder 27086f8023 Use fingerprinting in rpmal file matching
The code in rpmdb already supports fingerprinting, which led to
file dependency problems being reported against installed packages,
but ignored for against new packages.

The use of the fingerprinting code does not seem to make the
dependency check slower in my tests.
2014-08-19 17:28:12 +02:00
Panu Matilainen 9b2810544c Introduce a simple score system for determining best providers in ordering
- Look at all providers and calculate a simple score for them:
  We want to prefer self-provides during ordering (RhBug:1111349)
  but only when other things are equal, coloring needs to prevail.
  Otherwise ordering can miss crucial dependencies to the preferred
  arch packages whose files are actually laid down: eg on x86_64
  Fedora, both glibc.i686 and glibc.x86_64 provide and require
  /sbin/ldconfig, but only installing glibc.x86_64 will actually
  get the file on disk for itself and others to use, so glibc.i686
  cannot satisfy its own /sbin/ldconfig provide, crazy as it is.
- Also fixes a memleak on self-provided dependencies introduced
  in commit 6b6f8e6ecb
2014-08-15 15:32:53 +03:00
Florian Festi 6b6f8e6ecb Modify rpmalSatisfiesDepend() to get the requesting TE as a param to be able to prefere self provides.
This way the ordering code can ignore self provides and avoid unnessecary dependency loops as in rhbz#1111349
2014-07-23 15:15:32 +02:00
Panu Matilainen 713914bde1 Drop the experimental collection support
- The basic concept is not without merit but what was implemented here
  has been stuck in experimental state in middle of two sorta conflicting
  goals for four years now, and world has moved onward in the meanwhile.
  The sepolicy part is better handled in the new selinux plugin, and other
  action business belongs to packages (in the form of some trigger-like
  scripts or such) rather than rpm plugins.
- Deleted here, but the sepolicy plugin functionality still needs
  merging into the new selinux plugin...
- RPMTAG_COLLECTIONS left in place but tagged unimplemented as per policy
  to never actually remove tags
2014-06-17 16:27:24 +03:00
Panu Matilainen 4140e6562d Make rpmteFiles() return refcounted rpmfiles, fixup callers 2013-11-08 13:50:20 +02:00
Panu Matilainen d9c0b07adb Mass-rename all rpmfiFooIndex() functions to rpmfilesFoo()
- These all operate on rpmfiles, not rpmfi, now so make the point
  clearer. All internal stuff so we're free to mess around.
- No functional changes, only a straightforward perl-assisted rename...
2013-11-07 15:58:10 +02:00
Panu Matilainen 6a5a0fa9ff rpmal wants a fileset handle, not somebody elses iterator... 2013-11-07 15:29:59 +02:00
Panu Matilainen 520c7266c8 rpmfi has no associated pool, the file set has
- should've been in previous commit really but since there's just
  one user... meh
2013-11-07 15:25:11 +02:00
Panu Matilainen c0cb2d86f9 Chainsaw rpmfi iteration apart from the actual file set
- The self-iterator in rpmfi prevents all sorts of sane uses of
  file set iteration. Split the actual data into a separate data
  type, changing the internal random-access functions to use the
  new rpmfiles datatype directly and update internal callers minimally.
  This should be entirely transparent to public API consumers who still
  only see the braindamaged self-iterating version.
- Internal consumers dont directly benefit (yet), this is just an
  early step on the road to rpmfi sanity. Much of the API and variables
  will need renaming etc but avoiding that here to keep the changes
  to minimum, this is a rather huge commit as it is.
2013-11-07 14:27:26 +02:00
Panu Matilainen 15f9f2d7f0 Add a hash + lookup function on obsoletes to rpmal
- Similar lazily created hash as provides for fast obsoletes lookups.
  This is so similar the provides that creation etc functions should
  be unified, but leaving that exercise till later.
2012-10-05 11:35:11 +03:00
Panu Matilainen 99d42b479a Rename rpmalProvidesHash to rpmalDepHash
- The same hash type is valid for any ds and we'll be adding more...
2012-10-05 11:34:22 +03:00
Panu Matilainen 2d62d5e5c5 Avoid changing the file info sets when adding to rpmal file hash
- Use indexed access to the file info sets so we're not mucking
  around with somebody elses rpmfi iterator index (currently not an
  issue but still...)
2012-10-05 11:25:49 +03:00
Panu Matilainen 7612b1684a Avoid changing the dependency sets when looking up from rpmal
- Use indexed access and comparison to avoid mucking around with
  eg transaction element dependency sets while the callers are walking
  over them.
2012-10-05 10:16:44 +03:00
Panu Matilainen f4bb2487d4 Avoid changing the dependency sets when adding to rpmal hash
- Use indexed access to the dependencies so we're not mucking with
  the rpmds iterator index behind anybodys back, this could affect
  all sorts of things but miraculously nothing is hitting it atm...
2012-10-05 10:13:09 +03:00
Panu Matilainen d5dd3abe09 Be as lazy as possible wrt rpmal hash creation
- Separate provides and files hash creation, delay both until the last
  moment before first valid lookup. In practise, this means the provides
  hash is created early due to lookups from rpmtsAddInstallElement(),
  but the big bad file hash creation is delayed until the entire
  transaction set has been more-or-less populated. Which means we have
  a better idea about the necessary hash table size, meaning fewer
  hash resizes, resulting in good deal faster execution with no
  downsides - if something happened to trigger an early file lookup
  it'll all still work, just slower.
2012-10-04 15:57:58 +03:00
Panu Matilainen 03b660c615 Only return non-NULL from rpmalAllSatisfiesDepends() on real matches
- The provides hash lookup can and does return hits that dont actually
  satisfy the dependency. Dont bother callers with apparent hits
  (ie non-NULL returns) when nothing actually matches the dependency.
2012-10-02 12:15:49 +03:00
Panu Matilainen b900c06b99 Export rpmalAllSatisfiesDepend() internally (again)
- For some uses, we need to be more selective about providers...
2012-10-02 10:50:10 +03:00
Panu Matilainen b8e5a448c5 Avoid redundant ds -> id -> string lookups in rpmalAllFileSatisfiesDepend()
- We need to grab the dependency string in rpmalAllSatisfiesDepend()
  already to see whether its a file dependency or not, just pass that
  to the file deps to avoid redundant work.
2012-09-18 06:30:59 +03:00
Panu Matilainen 272eaae387 Dont bother with separate notifications on multiple file dep matches 2012-09-18 06:27:57 +03:00
Panu Matilainen da9361f2d6 Avoid the string copy in rpmalAllFileSatisfiesDepend() now that we can 2012-09-18 06:26:34 +03:00
Panu Matilainen 86036abb97 Switch rpmal file hash to use pool id's instead of strings 2012-09-12 19:20:52 +03:00
Panu Matilainen d7749956a8 Switch rpmal provide hash to use pool id's instead of strings 2012-09-12 19:19:42 +03:00
Panu Matilainen a7c1334710 Add a some transition-period asserts to ensure pool-usage sanity 2012-09-12 19:19:31 +03:00
Panu Matilainen 8ef9afa77e Pass transaction pool to rpmal (but not used yet) 2012-09-12 19:12:48 +03:00
Panu Matilainen 154d21453f Shut up gcc whine about potentially uninitialized variable
- This is a false positive really, or at least a cant-happen case
2012-09-05 17:47:24 +03:00
Panu Matilainen ea3a8f1e42 Avoid rehashing directory name when it doesn't change in rpmal population
- Another modest improvement in redundant rehashing elimination, but in the
  big picture, this is really just another fart in the Sahara desert...
2012-09-05 17:09:40 +03:00
Panu Matilainen 8106e7e89c Handle obsolete matches (more) correctly in rpmal
- Similar to commit 9fb81eac0b but
  on the to-be-installed set: obsoletes should only be matched against
  package names, not any provide or file names. Hasn't really mattered
  previously due to the way its called, but since commit
  05487d9a3f I guess it started to matter.
  It's more correct this way anyhow, and should fix RhBug:810077.
- Since rpmal only knows about provides, we need to handle obsoletes
  as a special case and filter out matches on provide names different
  than the matching package name.
2012-04-05 11:43:58 +03:00
Panu Matilainen ff280b693e Don't add config() provides if config install is disabled
- Similarly to commit 40ee8e7427,
  take --noconfigs into account for the virtual config() provides too
2011-09-01 13:50:55 +03:00
Panu Matilainen 40ee8e7427 Don't add file provides for doc/config files if they wont be installed
- Files which dont get installed cannot very well satisfy dependencies,
  take this into account for docs and configs when --nodocs & --noconfigs
  flags are used.
2011-09-01 13:40:50 +03:00
Panu Matilainen a4dbd77551 Pass tsflags to rpmal and remember them
- No functional changes here, but we'll need to know some of these
  bits for accurately calculating various dependency bits later on.
2011-09-01 13:21:45 +03:00
Panu Matilainen 9dcc737432 Source formatting cosmetics: function blocks start on the next line 2011-09-01 12:55:30 +03:00
Panu Matilainen 805f7fd5af Move string hash function to librpmio and rename for namespacing
- There are places in rpmio and build that would benefit from hashing, but
  hashFunctionString() being internal to librpm has prevented that. Rename
  to rstrhash() to resemble the other foo in rpmstring.h for
  minimal namespacing as its now public function and update callers.
- Also mark the function as "pure" - it only looks at its arguments.
  This is one of the busiest functions in entire rpm so any optimization
  no matter how minor is well worth it.
- Hereby awarding hashFunctionString() with the grand prize for
  the Most Moved Around Function in rpm ;)
2011-03-10 10:17:39 +02:00
Panu Matilainen f7e058a01e Eliminate separate fileIndexEntry from rpmal
- This is exactly the same structure as availableIndexEntry, no need
  for a different struct for it.
2010-09-22 16:37:12 +03:00
Steve Lawrence 2fd0913a6a Add common Collection requirements
This patch adds the install-time feature that if a package requires a package
in a collection, then it also requires all other packages in that collection.
This has the effect that collections will be roughly grouped together during a
transaction.

Although this is not absolutely necessary for the majority of collections, it
is required for the SELinux collection. This is because all SELinux policies
must be installed before the applications they secure to ensure correct labels.
This means we must ensure packages in the selinux collection are ordered
earlier in the transaction than all applications they protect. Adding this
implicit runtime requirements achieves this in a general manner, without major
modifications to dependency ordering.

To accomplish this, this patch splits the addRelation function into two parts:
one that determines which relations to add, and one that actually adds them.
After the usual relation is added between two packages, it then determines if
the required package contains any collections. If so, it finds all other
packages that are in the same collections and creates additional relations.
2010-06-22 11:12:43 +03:00
Panu Matilainen 0e04c09d48 Move the lone hashFunctionString() into misc.[ch], eliminate rpmhash.[ch]
- Besides there not being much point in having a separate source + header
  for a small single function, this fixes build on case-insensitive
  systems such as Mac OS X.
2010-05-21 15:36:03 +03:00
Panu Matilainen 09363b8c79 Dont bother translators with dependency lookup debug messages 2010-03-29 06:48:23 +03:00
Panu Matilainen 19498b426f Lose the useless rpmds refcounting debug junk + switches
- get the debug messages out of API, this is what should've been in commit
  dbdbe8010c
2010-03-22 13:04:26 +02:00
Panu Matilainen c586c9955c Lose the useless rpmfi refcounting etc debug messages + debug switches
- get the debug messages out of API, this is what should've been in commit
  dbdbe8010c
2010-03-22 12:49:45 +02:00
Panu Matilainen 03576e6f9f Lose leftovers from former rpmal implementation 2010-03-18 23:21:01 +02:00
Panu Matilainen c1a677e839 Lazy rpmal hash creation on first lookup, make rpmalMakeIndex() static
- the "new" hash-based rpmal only uses rpmalMakeIndex() for initial
  creation of the hash tables as late as possible for better estimate
  of needed hash size, but doesn't require any index regeneration if something
  is added
- first call to rpmalSatisfiedDepend() now initializes the hashes, if
  significant amount of entries are added after the first call hash
  table might get full ... so dont do that ;) (this was already true
  with rpmalMakeIndex(), now its just hidden out of sight)
2010-03-18 19:58:39 +02:00
Panu Matilainen ec1e622307 Make rpmalAllFileSatisfiesDepend() and rpmalAllSatisfiesDepend() static
- rpmtsCheck() only wants yes/no answers from rpmal, and ordering
  wants the best provider, rpmalSatisfiesDepend() works for both
- update comments
2010-03-18 19:49:25 +02:00
Panu Matilainen 7cd005ce7f Clean up rpmalAllFileSatisfiesDepend() a bit
- avoid multiple strrchr() calls
- avoid _constfree(), the string size is known from strrchr() so we dont
  need to allocate on heap at all
2009-09-14 13:23:34 +03:00
Panu Matilainen 5f57e21251 Eliminate now unnecessary artifacts of rpmdsNext() side-effects 2009-06-16 18:19:40 +03:00
Panu Matilainen af0ea37a91 Make rpmalSatisfiesDepend() smarter
- Instead of blindly picking the first match, try to pick the best provider
  for the dependency: for colored dependencies, try to find a provider of
  matching color. For non-colored dependencies, prefer providers of
  transaction preferred color.
- This avoids creating bogus and loopy relations between 32- and 64-bit packages
  where they dont exist, and makes behavior with things like /sbin/ldconfig
  consistent by returning the preferred colored element.
2009-06-11 17:22:59 +03:00
Panu Matilainen 31f0d94df1 Add preferred color to rpmal 2009-06-11 17:16:03 +03:00
Panu Matilainen 26ac9b3d94 Make rpmal header & all internal
- rpmal is hardly useful outside rpm itself, avoid exporting stuff
  unnecessarily
2009-04-03 13:07:42 +03:00