Control: tags 1022365 + patch
Control: tags 1022365 + pending
diff -Nru pdsh-2.34/debian/changelog pdsh-2.34/debian/changelog
--- pdsh-2.34/debian/changelog	2022-10-11 08:24:01.000000000 -0600
+++ pdsh-2.34/debian/changelog	2022-11-27 15:07:39.000000000 -0700
@@ -1,3 +1,11 @@
+pdsh (2.34-0.2) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Workaround test failures by using modules symlinked into a temp dir.
+    (Closes: #1022365).
+
+ -- dann frazier <da...@debian.org>  Sun, 27 Nov 2022 15:07:39 -0700
+
 pdsh (2.34-0.1) unstable; urgency=medium
 
   * Non-maintainer upload.
diff -Nru pdsh-2.34/debian/rules pdsh-2.34/debian/rules
--- pdsh-2.34/debian/rules	2022-10-11 08:24:01.000000000 -0600
+++ pdsh-2.34/debian/rules	2022-11-27 14:56:56.000000000 -0700
@@ -34,6 +34,36 @@
                         --infodir=\$${prefix}/share/info \
                         $(CONFIG_FLAGS)
 
+MODULE_DIRS := src/modules/.libs tests/test-modules/.libs
+override_dh_auto_test:
+	# pdsh will refuse to load modules in subdirs not owned by either
+	# the building user or root, which causes many tests to fail on
+	# the builders (see #1022365). We workaround that by copying
+	# the module dirs to a temp directory and symlinking them into
+	# the build tree.
+
+	# dh_auto_test will do this, but we need to build them first
+	# so we can copy them to the tempdir
+	$(MAKE) -C tests/test-modules check
+
+	# Save a copy of the module dirs to restore later
+	tar -c $(MODULE_DIRS) > debian/module-dirs.tar
+
+	# Now replace module dirs with symlinks to tempdir counterparts
+	# and run the tests.
+	set -e; \
+	tmpdir=`mktemp -d`; \
+	(cd $$tmpdir && tar xv) < debian/module-dirs.tar; \
+	rm -rf $(MODULE_DIRS); \
+	for dir in $(MODULE_DIRS); do \
+		ln -s $$tmpdir/$$dir $$dir; \
+	done; \
+	dh_auto_test; \
+	rm -rf $$tmpdir
+
+	# Restore the module directories (replacing the symlinks)
+	tar xv < debian/module-dirs.tar
+
 override_dh_auto_install:
 	dh_auto_install
 	# Clean up directory
@@ -50,3 +80,8 @@
 	rm -f $(CURDIR)/debian/pdsh/usr/bin/rpdcp
 	cp $(CURDIR)/debian/rpdcp.script $(CURDIR)/debian/pdsh/usr/bin/rpdcp
 	chmod 755 $(CURDIR)/debian/pdsh/usr/bin/rpdcp
+
+override_dh_auto_clean:
+	rm -f debian/module-dirs.tar
+	find . -name .libs -type l -exec rm {} \;
+	dh_auto_clean

Reply via email to