[master 6/7] Make make-addon-pkgs easier to use from within a test

dashea installerbot-noreply at redhat.com
Thu Sep 3 22:08:50 UTC 2015


From: David Shea <dshea at redhat.com>

Take the directory in which repos should be created as an optional
argument, and don't print a bunch of rpmbuild and createrepo crud on
stdout.
---
 tests/kickstart_tests/scripts/make-addon-pkgs.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/tests/kickstart_tests/scripts/make-addon-pkgs.py b/tests/kickstart_tests/scripts/make-addon-pkgs.py
index e38cb7a..e288073 100755
--- a/tests/kickstart_tests/scripts/make-addon-pkgs.py
+++ b/tests/kickstart_tests/scripts/make-addon-pkgs.py
@@ -23,20 +23,33 @@
 # are made just copy everything to the locations set in $KSTEST_ADDON_HTTP_REPO
 # and $KSTEST_ADDON_NFS_REPO.
 #
+# If a directory argument is given on the command line, the script will change
+# to that directory and create the repos there.
+#
 # This script imports things from tests/lib/mkdud.py, so tests/lib needs to be
 # in $PYTHONPATH.
 
 # Ignore interuptible calls
-# pylint: disable=interruptible-system-call
+# pylint: disable=interruptible-system-call, ignorable-system-call
 
 import os
 from subprocess import check_call
 from mkdud import make_rpm
 import rpmfluff
+import sys
+
+if len(sys.argv) > 1:
+    os.chdir(sys.argv[1])
 
 # Start with http
 os.mkdir('http')
 
+# Everything in this script is super-noisy, which is bad for callers trying
+# to keep a sensible stdout. dup stdout to /dev/null to shut up the parts
+# that break kickstart test prepare(), and leave stderr so we can maybe see
+# what went wrong if something goes wrong
+os.dup2(os.open(os.devnull, os.O_WRONLY), 1)
+
 # Empty package to be added to @core
 pkg = rpmfluff.SimpleRpmBuild('testpkg-http-core', '1.0', '1')
 make_rpm(pkg, 'http')


-- 
To view this commit on github, visit https://github.com/rhinstaller/anaconda/commit/90446167944ec58cc7e30a52276834c9e4d0be9f


More information about the anaconda-patches mailing list