[reprotest] 03/04: ENH: lib: add the ability to select the system_interface being used

Ximin Luo infinity0 at debian.org
Thu Aug 17 18:05:58 UTC 2017


This is an automated email from the git hooks/post-receive script.

infinity0 pushed a commit to branch master
in repository reprotest.

commit 397fe780643da8e453a747043962dc3d78d8ced1
Author: Santiago Torres <torresariass at gmail.com>
Date:   Wed Jul 12 11:55:24 2017 -0400

    ENH: lib: add the ability to select the system_interface being used
    
    The distro toolchain was hardcoded for debian. Now that two modules
    provide an abstraction, add a keyword parameter to load the toolchain
    for a specific distro.
    
    Note that, at this point, this parameter is ignored by the reprotest
    script.
---
 reprotest/lib/adt_testbed.py | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/reprotest/lib/adt_testbed.py b/reprotest/lib/adt_testbed.py
index 2907ac9..2fa9763 100644
--- a/reprotest/lib/adt_testbed.py
+++ b/reprotest/lib/adt_testbed.py
@@ -37,9 +37,14 @@ import urllib.parse
 #from debian import debian_support
 
 from reprotest.lib.system_interface.debian import DebianInterface
+from reprotest.lib.system_interface.arch import ArchInterface
 from reprotest.lib import adtlog
 from reprotest.lib import VirtSubproc
 
+SYSTEM_INTERFACES = {
+        'debian': DebianInterface,
+        'arch': ArchInterface
+        }
 
 timeouts = {'short': 100, 'copy': 300, 'install': 3000, 'test': 10000,
             'build': 100000}
@@ -48,8 +53,7 @@ timeouts = {'short': 100, 'copy': 300, 'install': 3000, 'test': 10000,
 class Testbed:
     def __init__(self, vserver_argv, output_dir, user,
                  setup_commands=[], setup_commands_boot=[], add_apt_pockets=[],
-                 copy_files=[]):
-        self.system_interface = DebianInterface()
+                 copy_files=[], host_distro='debian'):
         self.sp = None
         self.lastsend = None
         self.scratch = None
@@ -84,6 +88,16 @@ class Testbed:
         except AttributeError:
             self.devnull = open(os.devnull, 'rb')
 
+
+        if host_distro in SYSTEM_INTERFACES:
+            self.system_interface = SYSTEM_INTERFACES[host_distro]()
+        else:
+            # The host_distro provided is not available.
+            # Let's play it cool
+            adtlog.warning("Could not load target distro keychain. "
+                "Falling back to Debian")
+            self.system_interface = DebianInterface()
+
         adtlog.debug('testbed init')
 
     def start(self):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/reprotest.git



More information about the Reproducible-commits mailing list