summaryrefslogtreecommitdiff
path: root/lib/rpmte.c
AgeCommit message (Collapse)AuthorFilesLines
2013-02-02Extending rpm plugin interface, part 1Elena Reshetova1-1/+1
This change adds a new type of the rpm plugin, called transaction plugin and a set of initial hooks for this plugin. The hooks are: PLUGINHOOK_TSM_PRE Pre-transaction hook that is called before an rpm transaction begins PLUGINHOOK_TSM_POST Post-transaction hook that is called after an rpm transaction ends PLUGINHOOK_PSM_PRE Pre-transaction-element hook that is called before an rpm transaction-element is processed PLUGINHOOK_PSM_POST Post-transaction-element hook that is called after an rpm transaction-element is processed PLUGINHOOK_SCRIPT_SETUP Per-script hook that is called once for each rpm mainainers script that is present in the package Each hook is called for every plugin that have this hook registered. The avaliable transaction plugins can be specified in macros.in via transaction_plugins element. Signed-off-by: Panu Matilainen <pmatilai@redhat.com>
2013-02-02remove patch from suseAnas Nashif1-2/+0
2013-02-02add packaging filesAnas Nashif1-0/+2
2012-11-01Hide the strpool-related rpmts/rpmfi/rpmds interfaces out of sight for nowPanu Matilainen1-0/+4
- In the package/transaction related things the strpool is more of an internal implementation detail than an end-goal in itself, move string pool related interfaces of rpmts, rpmfi and rpmds to internal-only APIs for now. The kind interfaces we'll want to eventually export a) dont exist yet and b) are likely to be something very different. - The string pool itself remains exported however, its a handy data structure for all sorts of things and both librpm and librpmbuild heavily use it already.
2012-10-02Dont bother with rpmRelocateFileList() if relocations have been specifiedPanu Matilainen1-1/+1
- rpmRelocateFileList() doesn't modify anything when no relocations are to be done, but what it does is not exactly free, unnecessarily calling it is dumb.
2012-09-27Remove leftover, no longer valid commentPanu Matilainen1-1/+0
2012-09-13Put transaction element "self" dependency set into global pool tooPanu Matilainen1-1/+1
2012-09-12Add infastructure for global transaction set string poolPanu Matilainen1-6/+8
- Add a pool pointer to to ts members struct and a getter function - Grab the global pool for rpmte dependency- and file info creation, if its NULL then the sets will use private pools of their own. - Add the (currently) required magic voodoo rain-dance to freeze and unfreeze the pool as necessary wrt new element additions: for current rpmal and fingerprinting to work, the string pointers must be immovable. - This is infrastructure only: nothing creates the global pool yet, so everything is still using private pools.
2012-08-24Make rpmteHaveTransScript() available internallyPanu Matilainen1-1/+1
2012-08-07Fix RPMPROB_FILTER_FORCERELOCATE aka --badreloc (RhBug:828784)Panu Matilainen1-2/+18
- As noted (but since then blissfully forgotten) in the commit message, commit e696b409fe836bf39cbf639bac4321d658d0952d broke --badreloc so its been broken since rpm >= 4.9.x :-/ - Transaction problem filter is only available during rpmtsRun() so we have no clue whether bad relocations should be filtered or not during rpmte creation. Instead of creating the problems at rpmteNew() time, remember any bad relocations that were found and check + create the actual problems (unless filtered) along with other problems during rpmtsRun(). - Passing an "allow bad relocations" flag to rpmtsAddInstallElement() would be a saner option but this is a back-portable way of handling it.
2012-04-24Eliminate header and rpmte knowledge from rpmfsPanu Matilainen1-2/+6
- rpmfs is such a low-level construct it doesn't need to know anything about the upper layers. Gather the necessary bits of info in the sole caller instead and pass only whats needed to rpmfsNew() to enable creating a filestate item without having rpmte/header at hand, which we'll be needing in the fsm shortly.
2012-03-21Transaction element file info can be legally NULL in some casesPanu Matilainen1-3/+4
- rpmteClose() will wipe out the file info to free memory, we only should care whether we failed to (re)load the file info. This thinko in commit 06a2f1269b035a3a76464149834f2a5a8c4e89f2 broke %posttrans scriptlets (and without commit 274dbf557d1cac90f7c278f9b6d6af05997d92df, %pretrans in other circumstances), whoopsie *blush*. Now, off to write a test-case for our scriptlet behavior...
2012-03-20Don't free up file info sets on transaction test-runs, take IIPanu Matilainen1-1/+2
- Despite commit cef18c94807af0935b7796c462aab8ed39f0f376, we'd still end up freeing the file info sets via rpmteClose() while going through the test-transaction packages. This together with commit 06a2f1269b035a3a76464149834f2a5a8c4e89f2 caused install failures on packages which have %pretrans scriptlets, if a test-transaction was first performed on the same transaction set that gets used for the "real" transaction as well. How wonderfully obscure...
2012-01-28Don't assume rpmfiNew() always succeedsPanu Matilainen1-1/+5
- Add NULL checks and add/adjust comments where appropriate. - The remaining callers should handle NULL fi gracefully if not entirely correctly: rpmfiFC() returns 0 on NULL fi, so these callers just see the erronous file info set as "no files" case. Something to fine-tune later...
2012-01-28Add some basic sanity checks to rpmte creation, allow rpmteNew() to failPanu Matilainen1-3/+23
- Verify that a header at least has the very basic elements like name, version, release, os and arch (except for gpg-pubkeys which dont have the latter two, sigh), fail if not. - rpmfiNew() cannot currently fail but handling this error will allow sanity checking the file metadata which can be inconsistent even if a header is "physically" consistent. - We'll eventually want to have sanity checks on dependency sets too, but unlike rpmfiNew(), rpmdsNew() currently returns NULL for non-existent dependencies (eg most packages do not have conflicts or obsoletes) to save memory. Either that needs to change or we'll need to check for tag existence for the meaning of a returned NULL here.
2012-01-28Move TR_ADDED file size init into addTE()Panu Matilainen1-8/+4
- No functional changes, just stuffing it there along with most other rpmte init work and remove the pointless switch-case while at it
2011-12-01Allow pre- and posttrans to omit interpreter or body (again)Panu Matilainen1-2/+2
- While most scriptlets have both an interpreter and a body, neither is strictly required: body can be omitted in cases like special purpose executables (eg -p /sbin/ldconfig) and for interpreter, /bin/sh is used if missing. This has been "broken" from somewhere around rpm 4.7.x and nobody noticed :)
2011-11-22Ehm, %pretrans failure shouldn't abort the entire transactionPanu Matilainen1-2/+1
- Brainfart in previous commit (71c6b06b3f240021f2ece46f9cf7aa891f716710): %pretrans failure should only cause that package to fail, not abort the entire transaction. Doh. - Failures are tracked via transaction elements but pre/posttrans were specifically filtered out. All we need is removing that filtering and the warn-only vs error logic in psm takes care of the rest. The transaction.c changes in previous commit were just unnecessary.
2011-09-01Source formatting cosmetics: function blocks start on the next linePanu Matilainen1-3/+6
2011-05-28Eliminate dead NULL-assignments at scope-end in librpm, part IVPanu Matilainen1-1/+1
- Remove NULL-assignments of local variables at the end of scope in the higher level package-related "objects": rpmds, rpmfi, rpmte
2011-05-25Don't run collections on script stages like %pre/posttrans, ugh.Panu Matilainen1-3/+7
2011-04-05Dont reference transaction set from transaction elementsPanu Matilainen1-2/+1
- Elements referencing ts prevents rpmtsFree() from freeing anything unless the caller does rpmtsEmpty() first. Oops. Undo the braindamage from commit 8f7c2d7063df6d1057425d014ce4168d46c5e7d9.
2010-12-22Make rpmplugins.h private for nowPanu Matilainen1-1/+1
- We'll probably want to make some changes to the plugin type system before considered "ready", the current plugin slots are limited to 32 and Meego folks apparently want to use a largish number of slots. So we might want something like separate plugin type (collection, security... etc) and then have 32 slots per each type. Making this private for now to avoid having to potentially break the API shortly after introduction.
2010-12-13Implement transaction ordering hintingPanu Matilainen1-0/+4
- 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-10-26Bury stripTrailingChar() inside the only remaining userPanu Matilainen1-0/+8
- There used to be some other callers too but seems they've passed away, leaving just the relocation code in rpmte.c. Which means we can get this ugly bit out of the API.
2010-10-22Switch rpmte API and internals to use rpmTagVal instead of rpmTagPanu Matilainen1-2/+2
- Except for rpmteColorDS(), these can get called with intergral value instead of the actual enumeration
2010-09-21Avoid stepping on toes of relatives, part 1Panu Matilainen1-4/+4
- Eliminate uses of "this" which is a reserved keyword in C++
2010-09-13Fix some broken fooUnlink() usagesPanu Matilainen1-1/+1
- unreferencing should always go through fooFree() which does the real refcounting and frees when references go out
2010-09-01Update the plugin architecture to allow for remembering stateSteve Lawrence1-98/+38
This moves most of the plugin logic to a new rpmplugins file with a struct and functions for managing plugins, allowing for plugins to carry state. This also adds init and cleanup hooks for plugins to initialize and cleanup their state, and a new 'open te' hook allowing plugins to read and save information from transaction elements. This also generalizes the plugin architecture a bit so it isn't so specific to collections.
2010-06-23Use rpmlog() instead of fprintf() for collection error messagesPanu Matilainen1-4/+5
2010-06-22Determine when to perform Collection actionsSteve Lawrence1-0/+65
There are three times during a transaction when Collection actions can be performed: 1) After the last time a member of a collection is either installed or removed 2) After the last time a member of a collection is installed only 3) Before the first time a member of a collection is removed only This patch adds three lists to the rpmte structure to mark which transaction elements fall into each of these groups, and the collections that caused that. A new function is added to the TSM to scan through all the transaction elements and update these lists. When a collection is added to one of these lists, it signifies that when that transaction element is installed, the appropriate action should be performed for that collection.
2010-06-22Add plugin calling supportSteve Lawrence1-0/+130
This patch adds a simple plugin system that makes simple problems easy to solve, and difficult problems, such as SELinux, possible. When the transaction gets to the point where a collection action should occur, it expands a macro of the form %__collection_<collection name> to get the path to a plugin and any additional options. The plugin is dlopen'ed, and the appropriate function is called in the plugin, with the additional arguments passed in. This also adds a --nocollections option to disable performing Collection actions.
2010-05-07Convert rpmte internals to use the transaction pointer from element itselfPanu Matilainen1-25/+25
2010-05-07Store pointer to transaction set in transaction elementsPanu Matilainen1-6/+5
- unused now but allows various new things and more element "independency" - eliminate the unused dboffset argument while at it
2010-05-06Move header filecount retrieve from addTE() to rpmfsNew()Panu Matilainen1-9/+1
2010-05-06Move delTE() inline to rpmteFree()Panu Matilainen1-41/+26
- no point splitting this up, its just straightforward freeing of stuff - dont bother with tonne of assigning everything to NULL, it gets zeroed out by memset() anyway
2010-03-29Hide rpmte open/close/error etc logic inside rpmteProcess()Panu Matilainen1-5/+33
- make a bunch of helper functions static now that they're not needed elsewhere, rpmte is slowly becoming self-aware ;)
2010-03-29Remove unused dependency set file reference countPanu Matilainen1-12/+2
- this has never been used for anything at all, there are better things to use our memory for than unused arrays
2010-03-26Take advantage of rpmdsInstance() in dependency problem reportingPanu Matilainen1-2/+2
- Other than having less arguments to pass here and there, doesn't give any immediate advantage, but with the origin of installed dependency stored in problem sets, it'd be possible to track back a dependency problem back to the originating header
2010-03-26Avoid unnecessary argument now that problem pkgNEVRA is always te NEVRAPanu Matilainen1-5/+4
2010-03-26Change the problem data arrangement for dependency problemsPanu Matilainen1-2/+2
- pkgNEVR in problems is now always the NEVR of the transaction element triggering the problem, and altNEVR is the other affected package, dependency string is stored in the problem string attribute - no user visible changed, except for somebody crazy enough to try to do something other than print the problem message strings - we wouldn't really need to strdup() the pkgNEVR in problems now, but leaving that alone for the moment...
2010-03-26Filter out duplicate problems when adding to element problem setsPanu Matilainen1-4/+15
- Problems associated with a transaction element are necessarily unique to that element, so when filtered there we don't have to worry about skipping dupes elsewhere like in merged sets. This can actually lead to apparent duplicates in the current problem report output (eg in cases where multiple packages provide the same dependency which would be removed, like multilib packages), but this is only an artifact of they way the problems are currently printed out. - While this is still a dumb linear search, it can be several seconds faster than the previous filtering in rpmpsPrint(), which is now just a dumb convenience function.
2010-03-26Eliminate rpmpsAppend() from the APIPanu Matilainen1-7/+14
- This was only a convenience function that shouldn't really have been exported to begin with, and is not necessary at all - bury it inside rpmte.c for now to hide lazy problem set allocation - In the other news of the day... According to git, this happens to be the 10000th commit to the master branch of this codebase. Happy anniversary to rpm :P
2010-03-26Push problem creation argument sanitation to the level belowPanu Matilainen1-2/+2
- rpmpsAppend() and rpmProblemCreate() have no use for fn/dn either, its just stored in one string internally - this is kinda unnecessary API break but these aren't used outside rpm so it doesn't make much difference
2010-03-26Sanitize rpmteAddProblem() argumentsPanu Matilainen1-5/+4
- lump fn/dn into one, in no case both are needed - move altNEVR earlier to lump the generic attribute foo last
2010-03-24Remove rpmteColorDS() from the API/ABIPanu Matilainen1-1/+2
- this gets called on transaction element initialization anyway, there's no reason why anybody should need to call it from outside
2010-03-22Lose completely unused rpmte_debug junkPanu Matilainen1-2/+0
2010-03-22Lose the useless rpmio refcounting debug junkPanu Matilainen1-3/+3
- the rpmio API always had this goo, should've gotten rid of it back in commit dbdbe8010cd944f026a5a4e5d071eb31d29d81c4 but .. oh well
2010-03-22Lose the useless rpmps refcounting debug junkPanu Matilainen1-1/+1
- get the debug messages out of API, this is what should've been in commit dbdbe8010cd944f026a5a4e5d071eb31d29d81c4
2010-03-22Lose the useless rpmfi refcounting etc debug messages + debug switchesPanu Matilainen1-1/+1
- get the debug messages out of API, this is what should've been in commit dbdbe8010cd944f026a5a4e5d071eb31d29d81c4