[Piuparts-commits] rev 73 - trunk
Ana Beatriz Guerrero López
ana at alioth.debian.org
Tue Aug 28 10:54:52 UTC 2007
Author: ana
Date: 2007-08-28 10:54:52 +0000 (Tue, 28 Aug 2007)
New Revision: 73
Modified:
trunk/piuparts.py
Log:
Add pre-install and pre-upgrade to custom scripts.
Modified: trunk/piuparts.py
===================================================================
--- trunk/piuparts.py 2007-08-28 09:51:07 UTC (rev 72)
+++ trunk/piuparts.py 2007-08-28 10:54:52 UTC (rev 73)
@@ -590,6 +590,8 @@
tmp_files = [os.path.basename(a) for a in filenames]
tmp_files = [os.path.join("tmp", name) for name in tmp_files]
+ self.run_scripts("pre_install")
+
if settings.list_installed_files:
pre_info = self.save_meta_data()
@@ -603,7 +605,7 @@
self.run(["dpkg", "-i"] + tmp_files, ignore_errors=True)
self.run(["apt-get", "-yf", "--no-remove", "install"])
- self.run_scripts("install")
+ self.run_scripts("post_install")
self.run(["apt-get", "clean"])
remove_files([os.path.join(self.name, name)
@@ -650,7 +652,7 @@
self.remove_or_purge("remove", deps_to_remove + deps_to_purge +
nondeps_to_remove + nondeps_to_purge)
# Run custom scripts after remove all packages.
- self.run_scripts("remove")
+ self.run_scripts("post_remove")
if not settings.skip_cronfiles_test:
cronfiles, cronfiles_list = self.check_if_cronfiles(packages)
@@ -665,7 +667,7 @@
self.remove_or_purge("purge", nondeps_to_purge)
# Run custom scripts after purge all packages.
- self.run_scripts("purge")
+ self.run_scripts("post_purge")
# Now do a final run to see that everything worked.
self.run(["dpkg", "--purge", "--pending"])
@@ -815,7 +817,7 @@
list_scripts = os.listdir(basepath)
list_scripts.sort()
for file in list_scripts:
- if file.startswith("post_"+step):
+ if file.startswith(step):
script = os.path.join("tmp/scripts", file)
self.run([script])
@@ -994,6 +996,8 @@
# First install via apt-get.
chroot.install_packages_by_name(package_names)
+ chroot.run_scripts("pre_upgrade")
+
chroot.check_for_broken_symlinks()
# Then from the package files.
@@ -1351,7 +1355,7 @@
dest = chroot.relative("tmp/scripts/")
os.mkdir(dest)
for file in os.listdir(settings.scriptsdir):
- if file.startswith("post_") and os.path.isfile(os.path.join((settings.scriptsdir), file)):
+ if (file.startswith("post_") or file.startswith("pre_")) and os.path.isfile(os.path.join((settings.scriptsdir), file)):
shutil.copy(os.path.join((settings.scriptsdir), file), dest)
if not install_purge_test(chroot, root_info, selections,
More information about the Piuparts-commits
mailing list