File build-remove-transitional-mechanism-for-old-releases.patch of Package pcp.23935
From 27f0a13934dc38cdd02402c920d069331c66059b Mon Sep 17 00:00:00 2001
From: Lukas Berk <lberk@redhat.com>
Date: Thu, 14 Dec 2017 15:44:43 -0500
Subject: [PATCH] build: remove transitional mechanism for old releases
Older versions of pcp stored data in different places, remove the
bits that are no longer needed with this functionality.
---
build/GNUmakefile | 2 +-
build/cleantmpdirs | 50 ----------------------------------------------
build/rpm/fedora.spec | 24 ----------------------
build/rpm/pcp.spec.in | 24 ----------------------
build/tar/GNUmakefile | 4 ++--
build/tar/postinstall.tail | 2 --
debian/GNUmakefile | 4 ++--
debian/pcp.postinst.tail | 9 ---------
8 files changed, 5 insertions(+), 114 deletions(-)
delete mode 100644 build/cleantmpdirs
diff --git a/build/GNUmakefile b/build/GNUmakefile
index 1cf1fec6d..16773c48e 100644
--- a/build/GNUmakefile
+++ b/build/GNUmakefile
@@ -17,7 +17,7 @@ TOPDIR = ..
include $(TOPDIR)/src/include/builddefs
-include ./GNUlocaldefs
-SCRIPTS = cleanconfigs cleantmpdirs
+SCRIPTS = cleanconfigs
LSRCFILES = $(SCRIPTS) GNUlocaldefs.in
LDIRT = pack_pcp.bin pack_pro.bin pro.src
LDIRDIRT = deb $(TOPDIR)/$(PACKAGE_NAME)-?.?.?
diff --git a/build/cleantmpdirs b/build/cleantmpdirs
deleted file mode 100644
index 547fa070e..000000000
--- a/build/cleantmpdirs
+++ /dev/null
@@ -1,50 +0,0 @@
-# Function to do all of the temporary dir/file migration work
-#
-_clean_tmpdirs()
-{
- #
- # Usage: _clean_tmpdirs [-v] new_dir old_dir ...
- #
- # Move temporary directories (which may be actively in use as
- # with pmdammv files) from one temporary directory to another
- # so as to transparently upgrade without loss of service.
- #
- # -v option is verbose mode for debugging
- #
-
- _verbose=false
- if [ $# -gt 0 -a X"$1" = "X-v" ]
- then
- _verbose=true
- shift
- fi
-
- if [ $# -lt 2 ]
- then
- echo >&2 "Usage: _clean_tmpdirs [-v] new_dir old_dir subdirs ..."
- return
- fi
-
- _new_tmp_dir="$1"
- _old_tmp_dir="$2"
-
- [ "$_new_tmp_dir" != "$old_tmp_dir" ] || return
-
- for _subdir
- do
- d="$_old_tmp_dir/$_subdir"
- test -d "$d" -a -k "$d" || continue
- cd "$d" || continue
- for f in * ; do
- [ "$f" != "*" ] || continue
- source="$d/$f"
- target="$_new_tmp_dir/$_subdir/$f"
- [ "$source" != "$target" ] || continue
- [ ! -f "$target" ] || continue
- $_verbose && echo + mv -fu "$source" "$target"
- mv -fu "$source" "$target" || true
- done
- $_verbose && echo + rmdir "$d"
- cd && rmdir "$d" 2>/dev/null || true
- done
-}
diff --git a/build/rpm/fedora.spec b/build/rpm/fedora.spec
index f85d995da..d4a8bfb5b 100644
--- a/build/rpm/fedora.spec
+++ b/build/rpm/fedora.spec
@@ -2704,30 +2704,6 @@ PCP_PMNS_DIR=%{_pmnsdir}
test -s "$PCP_LOG_DIR/configs.sh" && source "$PCP_LOG_DIR/configs.sh"
rm -f $PCP_LOG_DIR/configs.sh
-# migrate old to new temp dir locations (within the same filesystem)
-migrate_tempdirs()
-{
- _sub="$1"
- _new_tmp_dir=%{_tempsdir}
- _old_tmp_dir=%{_localstatedir}/tmp
-
- for d in "$_old_tmp_dir/$_sub" ; do
- test -d "$d" -a -k "$d" || continue
- cd "$d" || continue
- for f in * ; do
- [ "$f" != "*" ] || continue
- source="$d/$f"
- target="$_new_tmp_dir/$_sub/$f"
- [ "$source" != "$target" ] || continue
- [ -f "$target" ] || mv -fu "$source" "$target"
- done
- cd && rmdir "$d" 2>/dev/null
- done
-}
-for daemon in mmv pmdabash pmie pmlogger
-do
- migrate_tempdirs $daemon
-done
chown -R pcp:pcp %{_logsdir}/pmcd 2>/dev/null
chown -R pcp:pcp %{_logsdir}/pmlogger 2>/dev/null
chown -R pcp:pcp %{_logsdir}/pmie 2>/dev/null
diff --git a/build/rpm/pcp.spec.in b/build/rpm/pcp.spec.in
index 84f2ac827..c0d175a42 100755
--- a/build/rpm/pcp.spec.in
+++ b/build/rpm/pcp.spec.in
@@ -3076,30 +3076,6 @@ PCP_SYSCONFIG_DIR=@pcp_sysconfig_dir@
test -s "$PCP_LOG_DIR/configs.sh" && source "$PCP_LOG_DIR/configs.sh"
rm -f $PCP_LOG_DIR/configs.sh
-# migrate old to new temp dir locations within the same filesystem)
-migrate_tempdirs()
-{
- _sub="$1"
- _new_tmp_dir=%{_tmpdir}
- _old_tmp_dir=%{_localstatedir}/tmp
-
- for d in "$_old_tmp_dir/$_sub" ; do
- test -d "$d" -a -k "$d" || continue
- cd "$d" || continue
- for f in * ; do
- [ "$f" != "*" ] || continue
- source="$d/$f"
- target="$_new_tmp_dir/$_sub/$f"
- [ "$source" != "$target" ] || continue
- [ -f "$target" ] || mv -fu "$source" "$target"
- done
- cd && rmdir "$d" 2>/dev/null
- done
-}
-for daemon in mmv pmdabash pmie pmlogger
-do
- migrate_tempdirs $daemon
-done
chown -R pcp:pcp "$PCP_LOG_DIR/pmcd" 2>/dev/null
chown -R pcp:pcp "$PCP_LOG_DIR/pmlogger" 2>/dev/null
chown -R pcp:pcp "$PCP_LOG_DIR/pmie" 2>/dev/null
diff --git a/build/tar/GNUmakefile b/build/tar/GNUmakefile
index 19619dc82..f1685596e 100644
--- a/build/tar/GNUmakefile
+++ b/build/tar/GNUmakefile
@@ -31,9 +31,9 @@ preinstall: preinstall.head $(SCRIPTS)/cleanconfigs preinstall.tail
cat preinstall.head $(SCRIPTS)/cleanconfigs preinstall.tail > $@
chmod ugo+x $@
-postinstall: postinstall.head $(SCRIPTS)/cleantmpdirs postinstall.tail
+postinstall: postinstall.head postinstall.tail
rm -f $@
- cat postinstall.head $(SCRIPTS)/cleantmpdirs postinstall.tail > $@
+ cat postinstall.head postinstall.tail > $@
chmod ugo+x $@
pack_pcp :
diff --git a/build/tar/postinstall.tail b/build/tar/postinstall.tail
index d7999da61..b2bd795bf 100755
--- a/build/tar/postinstall.tail
+++ b/build/tar/postinstall.tail
@@ -51,8 +51,6 @@ do
fi
done
-_clean_tmpdirs $PCP_TMP_DIR /var/tmp mmv pmdabash pmie pmlogger
-
# set up pcp and pcpqa users
#
if [ -f /etc/passwd ]
diff --git a/debian/GNUmakefile b/debian/GNUmakefile
index d43fcdbaa..6cd71aff3 100644
--- a/debian/GNUmakefile
+++ b/debian/GNUmakefile
@@ -319,9 +319,9 @@ pcp.preinst: pcp.preinst.head $(SCRIPTS)/cleanconfigs configversions pcp.preinst
rm -f $@
cat pcp.preinst.head $(SCRIPTS)/cleanconfigs configversions pcp.preinst.tail > $@
-pcp.postinst: pcp.postinst.head $(SCRIPTS)/cleantmpdirs configversions pcp.postinst.tail
+pcp.postinst: pcp.postinst.head configversions pcp.postinst.tail
rm -f $@
- cat pcp.postinst.head $(SCRIPTS)/cleantmpdirs configversions pcp.postinst.tail > $@
+ cat pcp.postinst.head configversions pcp.postinst.tail > $@
pcp.postrm: pcp.postrm.head configversions pcp.postrm.tail
rm -f $@
diff --git a/debian/pcp.postinst.tail b/debian/pcp.postinst.tail
index bac67131f..befce107f 100644
--- a/debian/pcp.postinst.tail
+++ b/debian/pcp.postinst.tail
@@ -76,15 +76,6 @@ update-rc.d pmlogger defaults >/dev/null
update-rc.d pmie defaults >/dev/null
update-rc.d pmproxy defaults >/dev/null
-# migrate existing statistics files to their new (permanent!) home
-#
-for dir in /var/tmp/mmv /var/tmp/pmdabash
-do
- [ -d $dir ] || continue
- [ "$(LC_ALL=C stat -c '%u %g %F' $dir)" = "0 0 directory" ] && mv $dir /var/lib/pcp/tmp
-done
-_clean_tmpdirs $PCP_TMP_DIR /var/tmp pmie pmlogger
-
# transition pmdadmcache over to pmdadm (device mapper)
#
PCP_PMCDCONF_PATH=/etc/pcp/pmcd/pmcd.conf
--
2.16.4