summaryrefslogtreecommitdiff
path: root/lib/psm.c
AgeCommit message (Collapse)AuthorFilesLines
2011-09-02Make rpmScript opaquePanu Matilainen1-4/+5
- Add accessor for fetching the script tag, the final piece that psm needs (and will continue to do so) from script internals. This allows the script type to become opaque for real.
2011-09-02Add an API for creating real rpmScript items out of triggers, use itPanu Matilainen1-33/+17
- Bury rpmScriptNew() into being internal helper in rpmscript - triggers and other scripts differ quite a bit in how their data is laid out in the header, especially args need "special attention". - Besides cleaning up things in the psm side, this technically makes trigger scripts runnable without having a header at hand. Of course currently trigger scripts are currently created and destroyed on the spot from headers so this is of academic interest...
2011-09-02First step towards unifying triggers into rpmScript APIPanu Matilainen1-23/+13
- Add a lower level script creation function to deal with the body expansions and such, use it for triggers as well. - This is still fairly ugly but its something that can be reasonably backported to 4.9.x which needs this too, as currently triggers are forgetting to set script->descr, causing "(null) failure" messages on glibc and on others, in would just crash on trigger failure and/or in debug verbosity level.
2011-08-29Use correct file state for colored file replacementsPanu Matilainen1-3/+4
- On colored file conflict resolution, the non-preferred colored file state would depend on installation order: if non-preferred arch is installed first, and the preferred arch in another transaction, the non-preferred color would get marked "replaced" indicating a forced install when none was used. This fixes the file state in such cases to "wrong color" to be consistent of the other installation scenarios.
2011-07-07Take advantage of Fdescr() in rpmReadPackageFile()Panu Matilainen1-1/+1
- If fn to rpmReadPackageFile() is NULL, use Fdescr() value to give more meaningful errors - Change a couple of places where we haven't got a clue of the file name to take advantage of the above
2011-06-01Split the --replacepkgs hack to a helper function and document itPanu Matilainen1-23/+29
- Makes the huge rpmpsmStage() that little bit smaller, this special-case code does not belong inline there. Also gets rid of couple of dead assignments and unnecessary variable. - Don't bother unless RPMPROB_FILTER_REPLACEPKG is set, it's not terribly expensive but its also wholly unnecessary in the normal case - Document how the dang thing "works"
2011-05-31Cleanup rpmpsmNew() and rpmpsmFree()Panu Matilainen1-25/+10
- Remove redundant checks and other fluff, including dead NULL-assignments on free
2011-05-28Eliminate dead NULL-assignments at scope-end in librpm, part IIIPanu Matilainen1-8/+8
- Remove NULL-assignments of local variables at the end of scope from the low-level helper machinery: fsm, psm, rpmscript and rpmrc
2011-04-19Improve fsm error code handling in psmPanu Matilainen1-13/+25
- Move the fsm execution to separate helper function, returning the most relevant exit code: if fsmSetup() failed then teardown return doesn't matter, but fsmTeardown() can report errors from missing hardlinks which we haven't checked until now. - This also fixes enum vs int abuse on the exit code: fsm return codes are cpio error codes whereas psm codes are simple ok/fails.
2011-03-23Remove libio support to suppress timedRead()Jindrich Novy1-3/+0
2011-03-04Remove unused return code variablePanu Matilainen1-4/+4
- The return codes from these iteratator functions aren't interesting in this context, don't bother saving them either.
2011-03-04Don't bother storing irrelevant return codesPanu Matilainen1-11/+11
- PSM_NOTIFY doesn't return anything of interest, rpmdbSetIteratorRE() doesn't return errors for RPMMIRE_STRCMP and Fclose() errors we just can't do anything about (and we were throwing all these away anyhow)
2011-03-04Eliminate unused variablesPanu Matilainen1-10/+6
- We're not expecting anything in return from rpmtsNotify() in psm, so just ignore the returns...
2010-12-20Rip the stillborn, broken apply/commit transaction gooPanu Matilainen1-25/+3
- This was beginnings of something ten years ago, and that something was long since abandoned. These never did anything useful that --justdb/--noscripts wouldn't do.
2010-10-22Change all internal uses of rpmtsInitIterator() to use DBI tagsPanu Matilainen1-3/+3
2010-10-22Switch psm and rpmscript to use rpmTagVal where appropriatePanu Matilainen1-3/+3
- There are a few true rpmTag uses though, leaving them as they are...
2010-09-28Wrong enum type used for psm goal, gcc 4.5 complains (which is nice)Panu Matilainen1-1/+1
2010-09-21Fix rpmRC/int return mismatch by counting errors from handleOneTriggerPanu Matilainen1-6/+6
2010-09-21Use rpmTag as psm scriptTag for type correctnessPanu Matilainen1-1/+1
2010-09-21Fix up bunch of silly int vs rpmRC return code mismatchesPanu Matilainen1-3/+4
2010-09-07Fix error code on verify scriptlet failurePanu Matilainen1-1/+3
- Verify scriptlet failures were only logged but didn't reflect error codes as they were considered "warn only" along with most others
2010-08-13Conditionalize rpm_execcon() usage on per-transaction flagsPanu Matilainen1-1/+2
- If we aren't laying down file contexts, executing scriptlets in contexts doesn't make much sense either as its just likely to fail. - System-wide settings, such as is_selinux_enabled() value, are very ambiguous when it comes to chroots, using per-transaction controllable flags instead lets callers decide.
2010-05-31Use the new chroot API everywhere, eliminate old related gooPanu Matilainen1-35/+5
2010-05-26Handle test-transaction centrally on entry to psmPanu Matilainen1-15/+9
- psm in test-mode is a no-op anyway, so dont bother at all with it - also removes the need to check for test mode on pre/posttrans scripts, these are now fully covered by psm too
2010-05-26Eliminate rpmts from the scriptlet machineryPanu Matilainen1-1/+2
- pass scriptFd and selinux enabled status as arguments from psm level - selinux status could be queried directly with is_selinux_enabled() but that's a fairly expensive call which does all sorts of funny things and probably doesn't work at all in the average chroot - Lua-scripts dont currently honor scriptFd and have no use for selinux but pass the info there too as an early step towards supporting scriptFd with Lua - makes rpmScriptRun() even more of an argument monster, some of this should probably go into rpmScript struct...
2010-05-26Simplify chroot handling wrt scriptletsPanu Matilainen1-11/+2
- switch root if necessary on entry and exit to psm already, nothing inside the psm needs access to outside chroot - eliminate chroot handling from scriptlet machinery, dealing with chroot is a job for higher levels - Lua scriptlets can change our cwd, always ensure we return to previous cwd after executing by saving and restoring the cwd
2010-05-25Move scriptlet statistics collection (back) inside psmPanu Matilainen1-1/+4
- removes one rpmts dependency from scriptlets
2010-05-07Revert back to rpmdbRemove() taking instance number instead of actual headerPanu Matilainen1-11/+6
- On package reinstall (ie --replacepkgs) we only know the old header by the instance number, and grabbing the header from the db in psm as a special case for that is more trouble than just doing what we always did. - Reverts commit e16695e932e294ec600e673d38c41bde20931204 and unbreaks the --replacepkgs test case
2010-04-07Make rpmdbAdd() and rpmdbRemove() internal-onlyPanu Matilainen1-0/+1
- all additions and removals to the rpmdb need to go through the transaction machinery, these are very low-level functions that API users have no business messing with
2010-04-07Unify rpmdbAdd/Remove() interfacesPanu Matilainen1-6/+11
- rpmdbRemove() takes now a header as argument too - we need both the header number and the header itself there anyway, so might as well use the header we already have instead of flipping through backwards hoops to get to it
2010-04-07Eliminate the headerCheck() foo from rpmdbAdd/Remove()Panu Matilainen1-6/+2
- for rpmdbRemove() these have been completely unused, and for rpmdbAdd() the higher levels have had more than one chance of verifying the header if checking is enabled in the transaction set
2010-04-07Move header INSTALLTID manipulation out of rpmdbAdd()Panu Matilainen1-4/+10
2010-03-29Move the little thats left of psm.h into rpmte_internal.hPanu Matilainen1-1/+0
- no functional changes, just shuffling declares around
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
2010-03-22Lose the useless rpmts refcounting debug messages + debug switchesPanu Matilainen1-1/+1
- get the debug messages out of API, this is what should've been in commit dbdbe8010cd944f026a5a4e5d071eb31d29d81c4 - just wtf have I been thinking? - also tolerate NULL passed to rpmtsLink() and rpmtsUnlink()
2010-03-12Turn PSM into a complete blackboxPanu Matilainen1-34/+10
- The psm structures aren't stored or passed around by any users, so there's no need for them to separately allocate and free the struct, bury this all inside rpmpsmRun() which takes care of initialization, actual actions and freeing. - There's also no need for refcounting now as allocations are completely contained within the rpmpsmRun() blackbox. Lose psm-debug foo which was only used for refcount debugging. - No functional changes
2010-03-11Not all scriptlets have bodies (eg -p /sbin/ldconfig), dont expand NULLsPanu Matilainen1-2/+2
2010-03-11Dumb segfault on trigger scripts with no flags, dohPanu Matilainen1-1/+1
2010-03-11Support run-time macro and queryformat expansion on scriptletsPanu Matilainen1-3/+21
- Add per-scriptlet type flag tags to control special behavior. - Add rpmlib dependency on scriptlet expansion - if a package relies on scriptlet expansion it cannot be correctly installed with a version of rpm that doesn't support it. - Expansion is always an opt-in behavior, enabled with -q and/or -e argument in spec. We can't just blindly expand even macros as there's no telling %{} constructs might mean in whatever language is used for the script. - Queryformat expansion requires great care with strange and ugly escapes when writing scriptlets, but OTOH it permits access arbitrary header data at runtime, which has previously been completely impossible. - The handling of these expansions needs unifying for all scriptlet types, the trigger scriptlet handling is uuugly. Macro expansion could be transparently done from rpmScriptRun(), but because of their similar syntax, macro expansion needs to happen before query format expansion, and we dont have the header available in rpmScriptrun()
2010-03-06Minor cleanup to PSM_INIT stage, no functional changesPanu Matilainen1-5/+2
- lose redundant RPMRC_OK assignment + cosmetics
2010-03-01Rip out more rpm 2.x era relocation leftoversPanu Matilainen1-8/+0
- we can't even read packages from that timeframe, much less relocate them
2010-02-26Hide install/erase statistics collection inside psmPanu Matilainen1-0/+6
2010-02-25Remove unnecessary fiddling with ts element headerPanu Matilainen1-4/+0
- rpmteClose() takes care of freeing the header already
2010-02-25Lose some long since unnecessary includesPanu Matilainen1-2/+0
2010-02-25Duh, yet more leftover io flag stuff in psmPanu Matilainen1-2/+0
- should've been in commit 6193da9cad40dbbc1d7ce974ab9df96986a52183
2010-02-25Implement pretrans, posttrans and verifyscript as psm goalsPanu Matilainen1-14/+40
- Loose rpmpsmScriptStage() hack and bury the psm details inside the psm implementation - Map the script-only goal enums to the corresponding script tag to avoid having to re-re-re-map stuff unnecessarily - pretrans and posttrans should really be handled as a part of PKG_INSTALL process, but as these stages are disconnected from the main install part we can't remember the state in the psm - it would need to be stashed into transaction elements in the meanwhile
2010-02-25Separate PSM goals from individual stagesPanu Matilainen1-60/+48
- no functional changes - supposedly - nothing outside the PSM should need to know anything about its internals, the general goals need to be sufficient (not the case yet) - define goals to match rpmteType so there's no need to re-re-re-map the operations - loose the big unused individual stage string switch
2010-02-25Lose now unnecessary progTag from psmPanu Matilainen1-7/+1
- our scriptlet thingie knows which progtag to use for a given script tag already, no need to baby-feed the psm
2010-02-25First rough-cut version of scriptlet abstractionPanu Matilainen1-386/+31
- Split the low-level scriptlet machinery out of psm - New struct to hold the necessary information about scriptlets so we can execute them without having a header at hand. - Trigger handling is hackish and needs more love...
2010-02-25Kick out stillborn codePanu Matilainen1-11/+0
- psm aint the place to fiddle with db internals anyway