aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAvatar David Leverton <levertond@googlemail.com> 2008-01-14 14:35:44 +0000
committerAvatar David Leverton <levertond@googlemail.com> 2008-01-14 14:35:44 +0000
commit8157c5241125541ba267d8d9fff1cc9a6ebe3d52 (patch)
tree2a302cd065d360fb651de1c36b7e4b5813ed9042
parentc2cac0da969db81c1a44bd751797b5c3477561fd (diff)
downloadpaludis-8157c5241125541ba267d8d9fff1cc9a6ebe3d52.tar.gz
paludis-8157c5241125541ba267d8d9fff1cc9a6ebe3d52.tar.xz
Add pretend_resume demo hook. Fixes: ticket:473
-rw-r--r--NEWS4
-rw-r--r--hooks/demos/Makefile.am9
-rwxr-xr-xhooks/demos/pretend_resume.bash.in38
3 files changed, 49 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 9cd4941..5db86f8 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,10 @@ News for Paludis
This file lists the major changes between versions. For a more detailed list
of every change, see the ChangeLog.
+TRUNK:
+ * New demo hook, pretend_resume.bash, to print the resume command
+ at the end of the --install --pretend display.
+
0.26.0_alpha6:
* Various merger bug fixes.
diff --git a/hooks/demos/Makefile.am b/hooks/demos/Makefile.am
index e8e1a9f..2397391 100644
--- a/hooks/demos/Makefile.am
+++ b/hooks/demos/Makefile.am
@@ -3,12 +3,14 @@ SUBDIRS = .
DEMOS = \
report.bash \
elog.bash \
- new_packages.bash
+ new_packages.bash \
+ pretend_resume.bash
EXTRA_DIST = \
report.bash.in \
elog.bash.in \
- new_packages.bash.in
+ new_packages.bash.in \
+ pretend_resume.bash.in
MAINTAINERCLEANFILES = Makefile.in
CLEANFILES = *~ gmon.out *.gcov *.gcno *.gcda *.o *.so $(DEMOS)
@@ -25,6 +27,9 @@ report.bash : $(srcdir)/report.bash.in
elog.bash : $(srcdir)/elog.bash.in
sed -e "s,@DATADIR@,$(datadir),g" < $(srcdir)/elog.bash.in > elog.bash
+pretend_resume.bash : $(srcdir)/pretend_resume.bash.in
+ sed -e "s,@DATADIR@,$(datadir),g" < $(srcdir)/pretend_resume.bash.in > pretend_resume.bash
+
built-sources : $(BUILT_SOURCES)
for s in `echo $(SUBDIRS) | tr -d .` ; do $(MAKE) -C $$s built-sources || exit 1 ; done
diff --git a/hooks/demos/pretend_resume.bash.in b/hooks/demos/pretend_resume.bash.in
new file mode 100755
index 0000000..5e544bf
--- /dev/null
+++ b/hooks/demos/pretend_resume.bash.in
@@ -0,0 +1,38 @@
+#!/bin/bash
+# vim: set et sw=4 sts=4 :
+
+# This hook makes Paludis display the resume command at the end of the
+# --install --pretend output, so the installation can be carried out
+# without recalculating dependencies, rescanning libraries, etc. To
+# enable this functionality, this script should be copied or symlinked
+# into:
+#
+# @DATADIR@/paludis/hooks/install_pretend_post/
+#
+# You should ensure that it has execute permissions.
+
+[[ ${RESUME_COMMAND} = *" '="* ]] || exit 0
+echo
+
+template_var=$(tr '[[:lower:]]' '[[:upper:]]' <<<"${PALUDIS_CLIENT}")_CMDLINE_resume_command_template
+template=${!template_var}
+
+if [[ -n ${template} ]]; then
+ if [[ ${template} = *XXXXXX* ]]; then
+ file="$(mktemp "${template}")"
+ else
+ file=${template}
+ fi
+
+ if echo "${RESUME_COMMAND}" >"${file}"; then
+ chmod 644 "${file}"
+ echo "Resume command saved to file: ${file}"
+ else
+ echo "Resume command NOT saved to file: ${file}"
+ echo "Resume command: ${RESUME_COMMAND}"
+ fi
+
+else
+ echo "Resume command: ${RESUME_COMMAND}"
+fi
+