[NEW PATCH] Fix make distcheck (via gerrit-bot)

Federico Simoncelli fsimonce at redhat.com
Tue Aug 16 14:36:19 UTC 2011


New patch submitted by Federico Simoncelli (fsimonce at redhat.com)

You can review this change at: http://gerrit.usersys.redhat.com/805

commit 0f84b2bcdc3fbc4ad37500bcdcc9b8df5b004053
Author: Federico Simoncelli <fsimonce at redhat.com>
Date:   Tue Aug 9 15:36:26 2011 +0000

    Fix make distcheck
    
    It's now possible to run "make distcheck" to verify that we are
    properly shipping, installing and removing the relevant files.
    
    Change-ID: I0ea26d65baf633265e201094e1c2c40859276203

diff --git a/Makefile.am b/Makefile.am
index 70c42be..6f0267a 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -13,12 +13,11 @@ rpmversion = @PACKAGE_VERSION@
 rpmrelease = @PACKAGE_RELEASE@
 RPMTOP = $(PWD)/rpmtop
 
-TESTS = pyflakes
-
 test: pyflakes exceptions
 	echo $(rpmrelease) $(rpmversion)
 
-.PHONY: pyflakes exceptions
+.PHONY: exceptions pyflakes srpm rpm
+
 exceptions:
 	python vdsm/storage/storage_exception.py | grep Collision && exit 1 || true
 
@@ -26,7 +25,6 @@ pyflakes:
 	@git ls-files '*.py' | xargs pyflakes \
 	    || (echo "Pyflakes errors or pyflakes not found"; exit 1)
 
-.PHONY: srpm rpm
 srpm: dist
 	$(MKDIR_P) $(RPMTOP)/{RPMS,SRPMS,SOURCES,BUILD}
 	rpmbuild -ts \
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 25bedd2..8fd4bd2 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -54,26 +54,26 @@ dist_vdsm_SCRIPTS = \
 dist_man8_MANS = \
 	vdsmd.8
 
-noinst_DATA = \
+vdsm_SUBST = \
+	constants.py \
 	logger.conf \
 	sudoers.vdsm \
 	vdsm.conf.sample \
 	vdsmd \
-	vdsm-sosplugin.py
-
-vdsm_SUBST = \
-	$(noinst_DATA) \
-	constants.py \
 	vdsm-restore-net-config \
+	vdsm-sosplugin.py \
 	vdsm-store-net-config
 
+noinst_DATA = \
+	$(vdsm_SUBST)
+
 CLEANFILES = \
 	$(vdsm_SUBST)
 
 EXTRA_DIST = \
 	constants.py.in \
 	logger.conf.in \
-	mk_vdsm.conf.sample.py \
+	mk-vdsm-conf-sample.py \
 	sudoers.vdsm.in \
 	vdsmd.in \
 	vdsm-logrotate \
@@ -98,10 +98,12 @@ do_subst = sed -e "s,[@]CONFDIR[@],$(vdsmconfdir),g" \
 	    -e "s,[@]TRUSTSTORE[@],$(vdsmtsdir),g"
 
 $(vdsm_SUBST): Makefile
-	$(do_subst) < $@.in > $@
-
-vdsm.conf.sample: config.py
-	python mk_vdsm.conf.sample.py > vdsm.conf.sample
+	if test "$@" = "vdsm.conf.sample"; then \
+		python $(srcdir)/mk-vdsm-conf-sample.py \
+			$(srcdir)/config.py > vdsm.conf.sample; \
+	else \
+		$(do_subst) < $(srcdir)/$@.in > $@; \
+	fi
 
 install-data-hook:
 	chmod 440 $(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm
@@ -119,35 +121,60 @@ install-data-local: install-data-init install-data-logger \
 	$(MKDIR_P) $(DESTDIR)$(vdsmbackupdir)
 	$(MKDIR_P) $(DESTDIR)$(localstatedir)/lib/libvirt/qemu/channels
 
-install-data-init: $(vdsm_SUBST)
+uninstall-local: uninstall-data-init uninstall-data-logger \
+		uninstall-data-rwtab uninstall-data-logrotate \
+		uninstall-data-sudoers uninstall-data-sosplugin
+
+install-data-init:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/init.d
 	$(INSTALL_SCRIPT) vdsmd $(DESTDIR)$(sysconfdir)/init.d/vdsmd
 
-install-data-logger: $(vdsm_SUBST)
+uninstall-data-init:
+	$(RM) $(DESTDIR)$(sysconfdir)/init.d/vdsmd
+
+install-data-logger:
 	$(MKDIR_P) $(DESTDIR)$(vdsmconfdir)
 	$(INSTALL_DATA) logger.conf $(DESTDIR)$(vdsmconfdir)/logger.conf
 
-install-data-rwtab: $(vdsm_SUBST)
+uninstall-data-logger:
+	$(RM) $(DESTDIR)$(vdsmconfdir)/logger.conf
+
+install-data-rwtab:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/rwtab.d
-	$(INSTALL_DATA) vdsm.rwtab $(DESTDIR)$(sysconfdir)/rwtab.d/vdsm
+	$(INSTALL_DATA) $(srcdir)/vdsm.rwtab \
+		$(DESTDIR)$(sysconfdir)/rwtab.d/vdsm
 
-install-data-logrotate: $(vdsm_SUBST)
+uninstall-data-rwtab:
+	$(RM) $(DESTDIR)$(sysconfdir)/rwtab.d/vdsm
+
+install-data-logrotate:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/logrotate.d
-	$(INSTALL_DATA) vdsm-logrotate.conf \
+	$(INSTALL_DATA) $(srcdir)/vdsm-logrotate.conf \
 		$(DESTDIR)$(sysconfdir)/logrotate.d/vdsm
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/cron.hourly
-	$(INSTALL_SCRIPT) vdsm-logrotate \
+	$(INSTALL_SCRIPT) $(srcdir)/vdsm-logrotate \
 		$(DESTDIR)$(sysconfdir)/cron.hourly/vdsm-logrotate
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/cron.d
-	$(INSTALL_SCRIPT) vdsm-libvirt-logrotate \
+	$(INSTALL_SCRIPT) $(srcdir)/vdsm-libvirt-logrotate \
 		$(DESTDIR)$(sysconfdir)/cron.d/vdsm-libvirt-logrotate
 
-install-data-sudoers: $(vdsm_SUBST)
+uninstall-data-logrotate:
+	$(RM) $(DESTDIR)$(sysconfdir)/logrotate.d/vdsm
+	$(RM) $(DESTDIR)$(sysconfdir)/cron.hourly/vdsm-logrotate
+	$(RM) $(DESTDIR)$(sysconfdir)/cron.d/vdsm-libvirt-logrotate
+
+install-data-sudoers:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sudoers.d
 	$(INSTALL_DATA) sudoers.vdsm \
 		$(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm
 
-install-data-sosplugin: $(vdsm_SUBST)
+uninstall-data-sudoers:
+	$(RM) $(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm
+
+install-data-sosplugin:
 	$(MKDIR_P) $(DESTDIR)$(pythondir)/sos/plugins
 	$(INSTALL_DATA) vdsm-sosplugin.py \
 		$(DESTDIR)$(pythondir)/sos/plugins/vdsm.py
+
+uninstall-data-sosplugin:
+	$(RM) $(DESTDIR)$(pythondir)/sos/plugins/vdsm.py
diff --git a/vdsm/mk-vdsm-conf-sample.py b/vdsm/mk-vdsm-conf-sample.py
new file mode 100644
index 0000000..86e6548
--- /dev/null
+++ b/vdsm/mk-vdsm-conf-sample.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python
+
+import re
+import sys
+
+if len(sys.argv) != 2:
+    sys.exit("usage: %s config.py" % sys.argv[0])
+
+p = re.compile("config.set\('(.*?)', '(.*?)', '(.*?)'")
+
+with file(sys.argv[1]) as f:
+    for line in f:
+        try:
+            if line.startswith('#'):
+                print line,
+            elif line.startswith('config.add_section'):
+                print "[%s]" % line[line.index("'")+1:line.rindex("'")]
+            elif line.startswith('config.set'):
+                section, key, val = p.match(line).groups()
+                print "%s = %s\n" % (key, val)
+        except:
+            print "# err converting %s" % line
diff --git a/vdsm/mk_vdsm.conf.sample.py b/vdsm/mk_vdsm.conf.sample.py
deleted file mode 100644
index 07b15f9..0000000
--- a/vdsm/mk_vdsm.conf.sample.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/python
-
-import re
-
-p = re.compile("config.set\('(.*?)', '(.*?)', '(.*?)'")
-
-for line in file('config.py').readlines():
-    try:
-        if line.startswith('#'):
-            print line,
-        elif line.startswith('config.add_section'):
-            print "[%s]" % line[line.index("'")+1:line.rindex("'")]
-        elif line.startswith('config.set'):
-            section, key, val = p.match(line).groups()
-            print "%s = %s\n" % (key, val)
-    except:
-        print "# err converting %s" % line
diff --git a/vdsm/storage/Makefile.am b/vdsm/storage/Makefile.am
index d8bd81d..8345390 100644
--- a/vdsm/storage/Makefile.am
+++ b/vdsm/storage/Makefile.am
@@ -53,5 +53,5 @@ EXTRA_DIST = \
 
 install-data-local:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/udev/rules.d
-	$(INSTALL_DATA) 12-vdsm-lvm.rules \
+	$(INSTALL_DATA) $(srcdir)/12-vdsm-lvm.rules \
 			$(DESTDIR)$(sysconfdir)/udev/rules.d/12-vdsm-lvm.rules
diff --git a/vdsm_cli/Makefile.am b/vdsm_cli/Makefile.am
index 6da1ac3..b9cf6a8 100644
--- a/vdsm_cli/Makefile.am
+++ b/vdsm_cli/Makefile.am
@@ -37,7 +37,10 @@ do_subst = sed -e "s,[@]VDSMDIR[@],$(vdsmdir),g" \
 $(vdsmcli_SUBST):
 	$(do_subst) < $@.in > $@
 
-install-data-local: $(vdsmcli_SUBST)
+install-data-local:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d
-	$(INSTALL_DATA) vdsClient.completion \
+	$(INSTALL_DATA) $(srcdir)/vdsClient.completion \
 		$(DESTDIR)$(sysconfdir)/bash_completion.d/vdsClient
+
+uninstall-local:
+	$(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/vdsClient
diff --git a/vdsm_hooks/faqemu/Makefile.am b/vdsm_hooks/faqemu/Makefile.am
index 0a04e25..213a6e7 100644
--- a/vdsm_hooks/faqemu/Makefile.am
+++ b/vdsm_hooks/faqemu/Makefile.am
@@ -15,5 +15,9 @@ EXTRA_DIST = \
 install-data-local:
 	$(LN_S) qemu $(DESTDIR)$(bindir)/qemu-system-x86_64
 	$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
-	$(INSTALL_SCRIPT) before_vm_start.py \
+	$(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
 		$(DESTDIR)$(vdsmhooksdir)/before_vm_start/10_faqemu
+
+uninstall-local:
+	$(RM) $(DESTDIR)$(bindir)/qemu-system-x86_64
+	$(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/10_faqemu
diff --git a/vdsm_hooks/vhostmd/Makefile.am b/vdsm_hooks/vhostmd/Makefile.am
index 2b9e499..0cab465 100644
--- a/vdsm_hooks/vhostmd/Makefile.am
+++ b/vdsm_hooks/vhostmd/Makefile.am
@@ -16,10 +16,10 @@ install-data-hook:
 
 install-data-local: install-data-sudoers
 	$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_start
-	$(INSTALL_SCRIPT) before_vm_start.py \
+	$(INSTALL_SCRIPT) $(srcdir)/before_vm_start.py \
 		$(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_vhostmd
 	$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/after_vm_destroy
-	$(INSTALL_SCRIPT) after_vm_destroy.py \
+	$(INSTALL_SCRIPT) $(srcdir)/after_vm_destroy.py \
 		$(DESTDIR)$(vdsmhooksdir)/after_vm_destroy/50_vhostmd
 	$(MKDIR_P) $(DESTDIR)$(vdsmhooksdir)/before_vm_migrate_destination
 	$(LN_S) ../before_vm_start/50_vhostmd \
@@ -28,7 +28,16 @@ install-data-local: install-data-sudoers
 	$(LN_S) ../before_vm_start/50_vhostmd \
 		$(DESTDIR)$(vdsmhooksdir)/before_vm_dehibernate/50_vhostmd
 
+uninstall-local: uninstall-data-sudoers
+	$(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_start/50_vhostmd
+	$(RM) $(DESTDIR)$(vdsmhooksdir)/after_vm_destroy/50_vhostmd
+	$(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_migrate_destination/50_vhostmd
+	$(RM) $(DESTDIR)$(vdsmhooksdir)/before_vm_dehibernate/50_vhostmd
+
 install-data-sudoers:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/sudoers.d
-	$(INSTALL_DATA) sudoers.vdsm_hook_vhostmd \
+	$(INSTALL_DATA) $(srcdir)/sudoers.vdsm_hook_vhostmd \
 		$(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm_hook_vhostmd
+
+uninstall-data-sudoers:
+	$(RM) $(DESTDIR)$(sysconfdir)/sudoers.d/50_vdsm_hook_vhostmd
diff --git a/vdsm_reg/Makefile.am b/vdsm_reg/Makefile.am
index fb66848..1a4c017 100644
--- a/vdsm_reg/Makefile.am
+++ b/vdsm_reg/Makefile.am
@@ -22,11 +22,11 @@ dist_vdsmreg_SCRIPTS = \
 dist_man8_MANS = \
 	vdsm-reg.8
 
-noinst_DATA = \
+vdsmreg_SUBST = \
 	vdsm-reg.conf
 
-vdsmreg_SUBST = \
-	$(noinst_DATA)
+noinst_DATA = \
+	$(vdsmreg_SUBST)
 
 CLEANFILES = \
 	$(vdsmreg_SUBST)
@@ -45,31 +45,54 @@ EXTRA_DIST = \
 do_subst = sed -e "s,[@]VDSMRUNDIR[@],$(vdsmrundir),g"
 
 $(vdsmreg_SUBST):
-	$(do_subst) < $@.in > $@
+	$(do_subst) < $(srcdir)/$@.in > $@
 
-install-data-local: install-data-init install-data-logger install-data-ovirt \
-		install-data-logrotate
+install-data-local: install-data-init install-data-logger \
+		install-data-ovirt install-data-logrotate
 	$(MKDIR_P)  $(DESTDIR)$(vdsmreglogdir)
 
-install-data-init: $(vdsmreg_SUBST)
+uninstall-local: uninstall-data-init uninstall-data-logger \
+		uninstall-data-ovirt uninstall-data-logrotate
+
+install-data-init:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/init.d
-	$(INSTALL_SCRIPT) vdsm-reg $(DESTDIR)$(sysconfdir)/init.d/vdsm-reg
+	$(INSTALL_SCRIPT) $(srcdir)/vdsm-reg \
+		$(DESTDIR)$(sysconfdir)/init.d/vdsm-reg
+
+uninstall-data-init:
+	$(RM) $(DESTDIR)$(sysconfdir)/init.d/vdsm-reg
 
-install-data-logger: $(vdsmreg_SUBST)
+install-data-logger:
 	$(MKDIR_P) $(DESTDIR)$(vdsmregconfdir)
-	$(INSTALL_DATA) logger.conf $(DESTDIR)$(vdsmregconfdir)/logger.conf
-	$(INSTALL_DATA) vdsm-reg.conf $(DESTDIR)$(vdsmregconfdir)/vdsm-reg.conf
+	$(INSTALL_DATA) $(srcdir)/logger.conf \
+		$(DESTDIR)$(vdsmregconfdir)/logger.conf
+	$(INSTALL_DATA) vdsm-reg.conf \
+		$(DESTDIR)$(vdsmregconfdir)/vdsm-reg.conf
+
+uninstall-data-logger:
+	$(RM) $(DESTDIR)$(vdsmregconfdir)/logger.conf
+	$(RM) $(DESTDIR)$(vdsmregconfdir)/vdsm-reg.conf
 
-install-data-ovirt: $(vdsmreg_SUBST)
+install-data-ovirt:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/ovirt-config-boot.d
-	$(INSTALL_SCRIPT) vdsm-config $(DESTDIR)$(sysconfdir)/ovirt-config-boot.d/vdsm-config
+	$(INSTALL_SCRIPT) $(srcdir)/vdsm-config \
+		$(DESTDIR)$(sysconfdir)/ovirt-config-boot.d/vdsm-config
 	$(MKDIR_P) $(DESTDIR)$(pythondir)/ovirt_config_setup
-	$(INSTALL_DATA) rhevm.py $(DESTDIR)$(pythondir)/ovirt_config_setup/rhevm.py
+	$(INSTALL_DATA) $(srcdir)/rhevm.py \
+		$(DESTDIR)$(pythondir)/ovirt_config_setup/rhevm.py
 
-install-data-logrotate: $(vdsmreg_SUBST)
+uninstall-data-ovirt:
+	$(RM) $(DESTDIR)$(sysconfdir)/ovirt-config-boot.d/vdsm-config
+	$(RM) $(DESTDIR)$(pythondir)/ovirt_config_setup/rhevm.py
+
+install-data-logrotate:
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/logrotate.d
-	$(INSTALL_DATA) vdsm-reg-logrotate.conf \
+	$(INSTALL_DATA) $(srcdir)/vdsm-reg-logrotate.conf \
 		$(DESTDIR)$(sysconfdir)/logrotate.d/vdsm-reg
 	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/cron.hourly
-	$(INSTALL_SCRIPT) vdsm-reg-logrotate \
+	$(INSTALL_SCRIPT) $(srcdir)/vdsm-reg-logrotate \
 		$(DESTDIR)$(sysconfdir)/cron.hourly/vdsm-reg-logrotate
+
+uninstall-data-logrotate:
+	$(RM) $(DESTDIR)$(sysconfdir)/logrotate.d/vdsm-reg
+	$(RM) $(DESTDIR)$(sysconfdir)/cron.hourly/vdsm-reg-logrotate




More information about the vdsm-patches mailing list