Hi, currently the same hook scripts are run in several contexts but they can't really distinguish where they are being run. Adding a few more environment variables should help and could eventually reduce the number of possible (and duplicate) script locations
I propose the following: add two new environment variables PIUPARTS_TEST=install|upgrade|distupgrade PIUPARTS_PHASE=install|upgrade|distupgrade that can be evaluated by the scripts. PIUPARTS_TEST denotes one of the three tests PIUPARTS_PHASE changes over time: * install is the first installation: - the only one (using the packages-under-test) for TEST=install, - first time (using packages from the distribution) for TEST=upgrade and TEST=distupgrade * upgrade is used for TEST=upgrade for the second installation (packages-under-test) (and also for the distupgrade test where I'd like to add something like -d NEW that finally upgrades to the packages-under-test * distupgrade is used for the "reinstallation" after a distupgrade in the distupgrade test Eventually some more environment variables may be useful: PIUPARTS_DISTRIBUTION (always) PIUPARTS_DISTRIBUTION_NEXT (pre_distupgrade_) PIUPARTS_DISTRIBUTION_PREV (post_distupgrade_) This effectively obsoletes pre/post_upgrade_ scripts. Example trace for TEST=upgrade: post_setup_* (already there) record the system state that is expected to be restored afterwards export PIUPARTS_TEST=install|upgrade|distupgrade pre_test_* (new hook) export PIUPARTS_PHASE=install pre_install_* install packages post_install_* export PIUPARTS_PHASE=upgrade pre_install_* upgrade packages post_install_* remove,post_remove,purge,post_purge,... post_test_* (new hook) check that the system state is as expected better names for pre/post_test_* welcome - these are for global changes that are to be reverted before the state comparision, e.g. installation of unrelated (as in depends) but possibliy interacting packages (diversions, alternatives, ...) that don't neccessarily fit into post_setup_. Also the distupgrade test (first do nothing round) needs some hook scripts to be executed afterwards: _post_setup_* _pre_test_* do _pre_distupgrade_* _post_distupgrade_* while ... _post_test_* record state restart for second round and do package installations and run install/remove/purge scripts compare state With these thoughts, I'd like to put this patch on hold: [PATCH 2/2] add more locations for hook scripts Andreas PS: do you have a term for the "packages under test", i.e. those passed as .deb (or .changes) and that are the "final target" of an installation/upgrade? (compared to their package names and predecessor versions taken from the distribution archive) -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org