[Pkg-debile-commits] [debile-slave] 03/100: meh. add piuparts.

Sylvestre Ledru sylvestre at alioth.debian.org
Mon Aug 19 14:52:58 UTC 2013


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

sylvestre pushed a commit to branch master
in repository debile-slave.

commit 9bc01081d02b249a976a9bd73215b91fdd5ce7a4
Author: Paul Tagliamonte <tag at pault.ag>
Date:   Wed May 22 10:37:41 2013 -0400

    meh. add piuparts.
---
 ethel/chroot.py            |    9 +++++++++
 ethel/commands/adequate.py |    1 +
 ethel/commands/piuparts.py |   33 +++++++++++++++++++++++++++++++++
 setup.py                   |    1 +
 4 files changed, 44 insertions(+)

diff --git a/ethel/chroot.py b/ethel/chroot.py
index 74975de..d85a705 100644
--- a/ethel/chroot.py
+++ b/ethel/chroot.py
@@ -15,6 +15,15 @@ def get_mount_point(session):
     return obj['mount-location']
 
 
+def get_tarball(chroot):
+    cfg = configparser.ConfigParser()
+    fil = '/etc/schroot/chroot.d/%s' % (chroot)
+    if cfg.read(fil) == []:
+        raise KeyError("No such session: `%s' - %s" % (session, fil))
+    obj = cfg[chroot]
+    return obj['file']
+
+
 def safe_run(cmd, expected=0):
     out, err, ret = run_command(cmd)
     out, err = (x.decode('utf-8') for x in (out, err))
diff --git a/ethel/commands/adequate.py b/ethel/commands/adequate.py
index b2f01d6..c62721c 100644
--- a/ethel/commands/adequate.py
+++ b/ethel/commands/adequate.py
@@ -60,6 +60,7 @@ def adequate(chroot, package):
             analysis.results.append(issue)
         return analysis
 
+
 def main():
     import sys
     output = open(sys.argv[3], 'wb')
diff --git a/ethel/commands/piuparts.py b/ethel/commands/piuparts.py
new file mode 100644
index 0000000..8b646d4
--- /dev/null
+++ b/ethel/commands/piuparts.py
@@ -0,0 +1,33 @@
+from ethel.chroot import schroot, copy, scmd, get_tarball
+import os
+
+
+def piuparts(chroot, package):
+    tarball = get_tarball(chroot)
+
+    name = os.path.basename(tarball)
+    internal_path = "/tmp/%s" % (name)
+
+    package_name = os.path.basename(package)
+    internal_package = "/tmp/%s" % (package_name)
+
+    with schroot(chroot) as session:
+
+        copy(session, tarball, internal_path)
+        copy(session, package, internal_package)
+
+        print("Installing...")
+        scmd(session, [
+            'apt-get', 'install', '-y', 'piuparts'
+        ], user='root')
+
+        print("Piuparts installed.")
+        out, ret = scmd(session, [
+            'piuparts', '-b', internal_path, internal_package
+        ], user='root')
+        print(out)
+
+
+def main():
+    import sys
+    piuparts(*sys.argv[1:])
diff --git a/setup.py b/setup.py
index bf3b3f9..c5476f5 100755
--- a/setup.py
+++ b/setup.py
@@ -24,6 +24,7 @@ setup(
             'ethel-next = ethel.cli:next',
             'ethel-close = ethel.cli:close',
             'ethel-adequate = ethel.commands.adequate:main',
+            'ethel-piuparts = ethel.commands.piuparts:main',
         ],
     }
 )

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-slave.git



More information about the Pkg-debile-commits mailing list