Browse Source

Python wrapper with Docker backend with profiles

refactoring/argument_validation
William Petit 2 years ago
parent
commit
9dc46f5665
10 changed files with 70 additions and 288 deletions
  1. 6
    10
      README.md
  2. 3
    23
      hooks/containerbuild/debian/install-build-essential
  3. 3
    7
      hooks/containerbuild/debian/install-git
  4. 1
    2
      lib/build.py
  5. 0
    38
      lib/rkt.py
  6. 0
    29
      lib/system.py
  7. 13
    35
      lib/tamarin.py
  8. 0
    33
      lib/web.py
  9. 43
    110
      package
  10. 1
    1
      profiles/debian.conf

+ 6
- 10
README.md View File

@@ -1,6 +1,10 @@
1 1
 # Tamarin
2 2
 
3
-Usine à paquets expérimentale basée sur rkt/acbuild.
3
+Usine à paquets GNU/Linux
4
+
5
+## Statut
6
+
7
+Expérimental
4 8
 
5 9
 ## Formats de paquets/distributions supportés
6 10
 
@@ -9,11 +13,7 @@ Usine à paquets expérimentale basée sur rkt/acbuild.
9 13
 ## Dépendances
10 14
 
11 15
 - [Python 3](https://www.python.org/downloads/)
12
-- Un noyau Linux > 2.6.24 (avec support des cgroups)
13
-
14
-**Optionnel mais conseillé**
15
-
16
-- [systemd](https://freedesktop.org/wiki/Software/systemd/)
16
+- [Docker](>= 17.03)
17 17
 
18 18
 ## Usage
19 19
 
@@ -30,10 +30,6 @@ TODO
30 30
 
31 31
 TODO
32 32
 
33
-### Répertoire de travail et mise en cache des images
34
-
35
-TODO
36
-
37 33
 ## Licence
38 34
 
39 35
 GPLv3

+ 3
- 23
hooks/containerbuild/debian/install-build-essential View File

@@ -2,26 +2,6 @@
2 2
 
3 3
 set -e
4 4
 
5
-${TAMARIN_ACBUILD} environment add DEBIAN_FRONTEND noninteractive
6
-
7
-if [ "${TAMARIN_ACBUILD_ENGINE}" == 'chroot' ]; then
8
-  # Ugly fix for Python installation in chrooted environment (require /dev/urandom)
9
-  head -c 65536 /dev/urandom > ./urandom
10
-  ${TAMARIN_ACBUILD} copy ./urandom /dev/urandom
11
-fi
12
-
13
-sudo -E /usr/bin/env bash - <<EOF
14
-export PATH=${PATH}
15
-${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- apt-get update
16
-${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- apt-get install --yes --no-install-recommends build-essential devscripts equivs python3
17
-EOF
18
-
19
-if [ "${TAMARIN_ACBUILD_ENGINE}" == 'chroot' ]; then
20
-  # Clean up Python fix (see above)
21
-  sudo -E /usr/bin/env bash - <<EOF
22
-  export PATH=${PATH}
23
-  ${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- rm -f /dev/urandom
24
-EOF
25
-fi
26
-
27
-${TAMARIN_ACBUILD} environment remove DEBIAN_FRONTEND
5
+echo 'ENV DEBIAN_FRONTEND=noninteractive' >> Dockerfile
6
+echo 'RUN apt-get update && apt-get install --yes --no-install-recommends build-essential devscripts equivs python3' >> Dockerfile
7
+echo 'ENV DEBIAN_FRONTEND=' >> Dockerfile

+ 3
- 7
hooks/containerbuild/debian/install-git View File

@@ -2,10 +2,6 @@
2 2
 
3 3
 set -e
4 4
 
5
-${TAMARIN_ACBUILD} environment add DEBIAN_FRONTEND noninteractive
6
-sudo -E /usr/bin/env bash - <<EOF
7
-export PATH=${PATH}
8
-${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- apt-get update
9
-${TAMARIN_ACBUILD} run --engine "${TAMARIN_ACBUILD_ENGINE}" -- apt-get install --yes --no-install-recommends git-core
10
-EOF
11
-${TAMARIN_ACBUILD} environment remove DEBIAN_FRONTEND
5
+echo 'ENV DEBIAN_FRONTEND=noninteractive' >> Dockerfile
6
+echo 'RUN apt-get update && apt-get install --yes --no-install-recommends git-core' >> Dockerfile
7
+echo 'ENV DEBIAN_FRONTEND=' >> Dockerfile

+ 1
- 2
lib/build.py View File

@@ -1,6 +1,6 @@
1 1
 import sys, os, argparse, tempfile
2 2
 sys.path.append(os.path.dirname(__file__) + '/lib')
3
-import tamarin, system, rkt
3
+import tamarin
4 4
 
5 5
 def get_args_parser():
6 6
     parser = argparse.ArgumentParser(description="Tamarin's container entrypoint")
@@ -12,7 +12,6 @@ def get_args_parser():
12 12
 def get_buildtools_dir():
13 13
   return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/buildtools")
14 14
 
15
-
16 15
 if __name__ == '__main__':
17 16
 
18 17
   parser = get_args_parser()

+ 0
- 38
lib/rkt.py View File

@@ -1,38 +0,0 @@
1
-import system, subprocess, os, tamarin, json, re
2
-
3
-def run(args, as_root = False, capture_output=False, debug=False):
4
-    """Run rkt with the specified args (use the local copy if rkt is not found in the $PATH)"""
5
-    rkt_bin = system.which('rkt', tamarin.get_workspace_subdir('rkt'))
6
-    cmd = ( ["sudo", "-E", rkt_bin] if os.geteuid() != 0 and as_root == True else [rkt_bin] ) + args
7
-    if debug:
8
-        print(" ".join(cmd))
9
-    if capture_output:
10
-        return subprocess.check_output(cmd, stdin=subprocess.PIPE)
11
-    else:
12
-        return subprocess.check_call(cmd, stdin=subprocess.PIPE)
13
-
14
-def get_images_list(rkt_flags = [], debug=False):
15
-    output = run([
16
-        "image",
17
-        "list",
18
-        "--format=json"
19
-    ] + rkt_flags, capture_output=True, debug=debug)
20
-    # Fetch the list of installed images
21
-    return json.loads(output.decode('utf-8'))
22
-
23
-def find_image_by_name(name_pattern, rkt_flags = []):
24
-    if type(name_pattern) is str:
25
-        name_pattern = re.compile(name_pattern)
26
-    images_list = get_images_list(rkt_flags = rkt_flags)
27
-    for image in images_list:
28
-        if name_pattern.search(image['name']):
29
-            return image
30
-    return None
31
-
32
-def export_image(image_id, dest_file, rkt_flags = [], debug=False):
33
-    run([
34
-        "image",
35
-        "export",
36
-        image_id,
37
-        dest_file,
38
-    ] + rkt_flags, debug=debug)

+ 0
- 29
lib/system.py View File

@@ -1,29 +0,0 @@
1
-import tarfile, os
2
-
3
-def extract_tar(file_path, dest_dir = ".", debug=False):
4
-    if debug:
5
-        print('Extracting "{:s}" to "{:s}"'.format(file_path, dest_dir))
6
-    with tarfile.open(file_path) as tar:
7
-        tar.extractall(dest_dir)
8
-        tar.close()
9
-
10
-def which(program, additional_paths = None):
11
-
12
-    def is_exe(fpath):
13
-        return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
14
-
15
-    fpath, fname = os.path.split(program)
16
-    if fpath:
17
-        if is_exe(program):
18
-            return program
19
-    else:
20
-        paths = os.environ["PATH"].split(os.pathsep);
21
-        if additional_paths != None:
22
-            paths.append(additional_paths)
23
-        for path in paths:
24
-            path = path.strip('"')
25
-            exe_file = os.path.join(path, program)
26
-            if is_exe(exe_file):
27
-                return exe_file
28
-
29
-    return None

+ 13
- 35
lib/tamarin.py View File

@@ -1,8 +1,6 @@
1
-import os, glob, subprocess, configparser
2
-import web, system
3
-import codecs
1
+import os, glob, subprocess, configparser, codecs, sys
4 2
 
5
-def run_profile_hooks(profile, step, cwd=None, env=None, debug=False):
3
+def run_profile_hooks(profile, step, **kwargs):
6 4
   hooks_dir = get_hooks_dir()
7 5
   step_hooks = profile[step]["hooks"]
8 6
   if not step_hooks:
@@ -12,7 +10,7 @@ def run_profile_hooks(profile, step, cwd=None, env=None, debug=False):
12 10
     if not trimmed_hook_name:
13 11
       continue
14 12
     hook_path = os.path.join(hooks_dir, trimmed_hook_name)
15
-    code = subprocess.check_call(hook_path, cwd=cwd, stdin=subprocess.PIPE, env=env)
13
+    run([hook_path], **kwargs)
16 14
 
17 15
 def get_hooks_dir():
18 16
   return os.path.realpath(os.path.dirname(os.path.abspath(__file__)) + "/../hooks")
@@ -51,37 +49,17 @@ def get_workspace_subdir(subdir):
51 49
     os.makedirs(dir_path, exist_ok=True)
52 50
     return dir_path
53 51
 
54
-def get_acbuild_achive_dest_dir():
55
-    """Return the first path matching the acbuild archive extraction destination in tamarin workspace"""
56
-    workspace_tmp = get_workspace_subdir('tmp')
57
-    return glob.glob(os.path.join(os.sep, workspace_tmp, 'acbuild-v*'))[0]
58
-
59
-def get_rkt_achive_dest_dir():
60
-    """Return the first path matching the rkt archive extraction destination in tamarin workspace"""
61
-    workspace_tmp = get_workspace_subdir('tmp')
62
-    return glob.glob(os.path.join(os.sep, workspace_tmp, 'rkt-v*'))[0]
63
-
64
-def download_rkt(debug=False):
65
-    """Download a local copy of rkt in the tamarin workspace and return the absolute path to the archive"""
66
-    url = "https://github.com/coreos/rkt/releases/download/v1.25.0/rkt-v1.25.0.tar.gz"
67
-    file_path=os.path.join(os.sep, get_workspace_subdir('tmp'), "rkt.tar.gz")
68
-    web.download_file(file_url=url, dest_path=file_path)
69
-    return file_path
70
-
71
-def download_acbuild(debug=False):
72
-    """Download a local copy of acbuild in the tamarin workspace and return the absolute path to the archive"""
73
-    url = "https://github.com/containers/build/releases/download/v0.4.0/acbuild-v0.4.0.tar.gz"
74
-    file_path=os.path.join(os.sep, get_workspace_subdir('tmp'), "acbuild.tar.gz")
75
-    web.download_file(file_url=url, dest_path=file_path)
76
-    return file_path
77
-
78
-def run_acbuild(args, captureOutput=False, as_root=False, debug=False):
79
-    """Run acbuild with the specified args (use the local copy if acbuild is not found in the $PATH)"""
80
-    acbuild_bin = system.which('acbuild', get_workspace_subdir('acbuild'))
81
-    cmd = ( ["sudo", "-E", acbuild_bin] if os.geteuid() != 0 and as_root == True else [acbuild_bin] ) + args
52
+def run(cmd, captureOutput=False, pty=False, debug=False, **kwargs):
53
+    """Execute an arbitrary command on the system"""
82 54
     if debug:
83 55
         print(" ".join(cmd))
56
+    stdin=subprocess.PIPE
57
+    if pty:
58
+        kwargs['stdin'] = sys.stdin
84 59
     if captureOutput:
85
-        return subprocess.check_output(cmd, stdin=subprocess.PIPE)
60
+        return subprocess.check_output(cmd, **kwargs)
86 61
     else:
87
-        return subprocess.check_call(cmd, stdin=subprocess.PIPE)
62
+        return subprocess.check_call(cmd, **kwargs)
63
+
64
+def run_docker(args, captureOutput=False, **kwargs):
65
+    return run(["docker"] + args, captureOutput=captureOutput, **kwargs)

+ 0
- 33
lib/web.py View File

@@ -1,33 +0,0 @@
1
-from urllib import request
2
-import math, sys
3
-
4
-def print_progress_bar(percent_progress=0, char_size=50, clear_line=True):
5
-
6
-    bar_progress = math.floor(char_size*(percent_progress/100))
7
-    bar = "=" * bar_progress + " " * (char_size - bar_progress)
8
-
9
-    if clear_line:
10
-        sys.stdout.write(u"\u001b[1000D")
11
-    sys.stdout.write("[{:s}] {:d}%".format(bar, int(percent_progress)))
12
-    sys.stdout.flush()
13
-
14
-def download_file(file_url, dest_path, bulk_size = 8192):
15
-
16
-    req = request.urlopen(file_url)
17
-    meta = req.info()
18
-    file_size = int(meta.get('Content-Length'))
19
-
20
-    with open(dest_path, 'wb') as dest_file:
21
-        print('Downloading "{:s}". Size: {:d}b'.format(file_url, file_size))
22
-        downloaded_size = 0
23
-        while True:
24
-            buff = req.read(bulk_size)
25
-            if not buff:
26
-                break
27
-            downloaded_size += len(buff)
28
-            dest_file.write(buff)
29
-            progress = downloaded_size/file_size*100
30
-            print_progress_bar(progress)
31
-        dest_file.close()
32
-    # Add linebreak
33
-    print("")

+ 43
- 110
package View File

@@ -1,10 +1,10 @@
1 1
 #!/usr/bin/env python3
2 2
 
3
-import argparse, sys, shutil, os, hashlib
3
+import argparse, sys, shutil, os, subprocess
4 4
 
5 5
 sys.path.append(os.path.dirname(__file__) + '/lib')
6 6
 
7
-import tamarin, system, rkt
7
+import tamarin
8 8
 
9 9
 def create_args_parser():
10 10
     '''Return a new configured ArgumentParser'''
@@ -20,80 +20,37 @@ def create_args_parser():
20 20
     parser.add_argument("-b", "--base", help="Use the specified image instead of the profile's one", default='')
21 21
     parser.add_argument("--rebuild", help="Ignore cache and rebuild container's image", action="store_true", default=False)
22 22
     parser.add_argument("--debug", help="Will add extra output and start the container in interactive mode", action="store_true", default=False)
23
+    parser.add_argument("--cleanup", help="Clear the workspace and remove obsolete Docker images before build", action="store_true", default=False)
23 24
 
24 25
     return parser
25 26
 
26
-def download_and_extract_rkt(dest_dir, debug=False):
27
-    '''Download and extract rkt to the given destination directory'''
28
-    rkt_archive_path = tamarin.download_rkt(debug=debug)
29
-    system.extract_tar(rkt_archive_path, workspace_tmp, debug=debug)
30
-    rkt_archive_dir = tamarin.get_rkt_achive_dest_dir()
31
-    shutil.rmtree(local_rkt_dir, ignore_errors=True)
32
-    os.rename(rkt_archive_dir, dest_dir)
33
-
34
-def download_and_extract_acbuild(dest_dir, debug=False):
35
-    '''Download and extract acbuild to the given destination directory'''
36
-    acbuild_archive_path = tamarin.download_acbuild(debug=debug)
37
-    system.extract_tar(acbuild_archive_path, workspace_tmp, debug=debug)
38
-    acbuild_archive_dir = tamarin.get_acbuild_achive_dest_dir()
39
-    shutil.rmtree(local_acbuild_dir, ignore_errors=True)
40
-    os.rename(acbuild_archive_dir, dest_dir)
41
-
42
-def get_cached_image_path(profile, debug=False):
43
-    '''Compute and return the path for an hypothetic cached image for the given profile'''
44
-    containerbuild_hooks = profile['containerbuild']['hooks']
45
-    hasher = hashlib.sha1()
46
-    hasher.update(base_image.encode())
47
-    hasher.update(containerbuild_hooks.encode())
48
-    image_hash = hasher.hexdigest()
49
-    cache_dir = tamarin.get_workspace_subdir('cache')
50
-    return os.path.join(os.sep, cache_dir, '{:s}.aci'.format(image_hash[:12]));
51
-
52
-def build_image(build_workspace, aci_file, base_image, profile, debug=False):
53
-
54
-    acbuild_flags = ["--work-path", build_workspace]
55
-
56
-    # Find and export base image from rkt' store
57
-    name_pattern = base_image.split('/')[-1] + '$'
58
-    image = rkt.find_image_by_name(name_pattern, rkt_flags=rkt_flags)
59
-    rkt.export_image(image['id'], aci_file, rkt_flags=rkt_flags, debug=debug);
60
-
61
-    # Build image
62
-    tamarin.run_acbuild(acbuild_flags+["begin", aci_file], debug=debug)
63
-    tamarin.run_acbuild(acbuild_flags+["set-name", "image_{:d}".format(pid)], debug=debug)
64
-    tamarin.run_acbuild(acbuild_flags+["mount", "add", "src", "/src", "--read-only"], debug=debug)
65
-    tamarin.run_acbuild(acbuild_flags+["mount", "add", "dist", "/dist"], debug=debug)
66
-    tamarin.run_acbuild(acbuild_flags+["mount", "add", "tamarin-hooks", "/tamarin/hooks", "--read-only"], debug=debug)
67
-    tamarin.run_acbuild(acbuild_flags+["mount", "add", "tamarin-lib", "/tamarin/lib", "--read-only"], debug=debug)
68
-    tamarin.run_acbuild(acbuild_flags+["mount", "add", "tamarin-profiles", "/tamarin/profiles", "--read-only"], debug=debug)
27
+def build_image(build_workspace, base_image, profile_name, profile, debug=False, rebuild=False):
28
+
29
+    with open("{:s}/Dockerfile".format(build_workspace), 'w') as dockerfile:
30
+        dockerfile.write("FROM {:s}\n".format(base_image))
69 31
 
70 32
     # Configure "containerbuild" hooks environment
71 33
     hooks_env = os.environ.copy()
72
-    hooks_env["PATH"] = os.environ['PATH'] + ':' + tamarin.get_workspace_subdir('acbuild')
73
-    hooks_env["TAMARIN_ACBUILD"] = " ".join([system.which('acbuild', local_acbuild_dir)]+acbuild_flags)
74
-    hooks_env["TAMARIN_ACBUILD_ENGINE"] = "chroot" if not system.which('systemctl') else "systemd-nspawn"
34
+    hooks_env["PATH"] = os.environ['PATH'] + ':' + tamarin.get_lib_dir()
75 35
 
76 36
     # Run hooks
77 37
     tamarin.run_profile_hooks(profile, 'containerbuild', cwd=build_workspace, env=hooks_env, debug=debug)
78 38
 
79
-    tamarin.run_acbuild(acbuild_flags+["write", "--overwrite", aci_file], as_root=True, debug=debug)
80
-    tamarin.run_acbuild(acbuild_flags+["end"], as_root=True, debug=debug)
39
+    image_tag = "tamarin:{:s}_{:s}_{:d}".format(profile_name, base_image.replace(':', '_'), os.getpid())
40
+
41
+    build_args = [ "build", "-t", image_tag ]
42
+
43
+    if rebuild:
44
+        build_args += [ "--no-cache" ]
81 45
 
82
-    return aci_file
46
+    tamarin.run_docker(build_args + [build_workspace], debug=debug)
83 47
 
84
-def cleanup(build_workspace, rkt_flags, debug=False):
48
+    return image_tag
85 49
 
86
-    # Nettoyage des conteneurs
87
-    rkt.run([
88
-        "gc",
89
-        "--grace-period=0"
90
-    ] + rkt_flags, as_root=True, debug=debug)
50
+def cleanup(build_workspace=None, debug=False):
91 51
 
92
-    # Nettoyage des images obsolètes du store
93
-    rkt.run([
94
-        "image",
95
-        "gc"
96
-    ] + rkt_flags, as_root=True, debug=debug)
52
+    if build_workspace == None:
53
+        build_workspace = tamarin.get_workspace_subdir('tmp')
97 54
 
98 55
     # Suppression de l'espace de travail de build
99 56
     shutil.rmtree(build_workspace, ignore_errors=True)
@@ -108,6 +65,9 @@ if __name__ == "__main__":
108 65
 
109 66
     validate_args(args)
110 67
 
68
+    if args.cleanup:
69
+        cleanup(debug=args.debug)
70
+
111 71
     # Verify project directory
112 72
     project_dir = os.path.abspath(args.project_directory)
113 73
     output_dir = os.path.abspath(args.output)
@@ -116,69 +76,42 @@ if __name__ == "__main__":
116 76
     profile = tamarin.load_profile(args.profile, debug=args.debug)
117 77
 
118 78
     workspace = tamarin.get_workspace_dir()
119
-    workspace_tmp = tamarin.get_workspace_subdir('tmp')
120
-
121
-    local_rkt_dir = tamarin.get_workspace_subdir('rkt')
122
-    if not system.which('rkt', local_rkt_dir):
123
-        download_and_extract_rkt(local_rkt_dir)
124
-
125
-    local_acbuild_dir = tamarin.get_workspace_subdir('acbuild')
126
-    if not system.which('acbuild', local_acbuild_dir):
127
-        download_and_extract_acbuild(local_acbuild_dir)
128 79
 
129 80
     pid = os.getpid()
130 81
     build_workspace = tamarin.get_workspace_subdir('tmp/build_{:d}'.format(pid))
131 82
 
132
-    rkt_store = tamarin.get_workspace_subdir('store')
133
-    rkt_flags = ["--dir={:s}".format(rkt_store)]
134
-
135 83
     base_image = args.base if args.base != '' else profile['profile']['default_image']
136 84
 
137
-    # If the base image is Docker-based, download it
138
-    if base_image.startswith('docker://'):
139
-        rkt.run([
140
-            "fetch",
141
-            "--insecure-options=image",
142
-            base_image
143
-        ] + rkt_flags, debug=args.debug)
144
-
145
-    aci_file = os.path.join(os.sep, build_workspace, 'image.aci')
146
-    cached_image_file = get_cached_image_path(profile, debug=args.debug)
147
-
148
-    if not args.rebuild and os.path.exists(cached_image_file):
149
-        # Copy cached image
150
-        shutil.copyfile(cached_image_file, aci_file)
151
-    else:
152
-        build_image(build_workspace, aci_file, base_image, profile, debug=args.debug)
153
-        # Cache image
154
-        shutil.copyfile(aci_file, cached_image_file)
85
+    image_tag = build_image(build_workspace, base_image, args.profile, profile,  debug=args.debug, rebuild=args.rebuild)
155 86
 
156 87
     # rkt run arguments
157
-    rkt_args = [
158
-      "run",
159
-      "--insecure-options=image",
160
-      aci_file, "--net=host",
161
-      "--volume=src,kind=host,source={:s}".format(project_dir),
162
-      "--volume=dist,kind=host,source={:s}".format(output_dir),
163
-      "--volume=tamarin-hooks,kind=host,source={:s}".format(tamarin.get_hooks_dir()),
164
-      "--volume=tamarin-lib,kind=host,source={:s}".format(tamarin.get_lib_dir()),
165
-      "--volume=tamarin-profiles,kind=host,source={:s}".format(tamarin.get_profiles_dir())
88
+    docker_args = [
89
+        "run",
90
+        "--rm",
91
+        "-v", "{:s}:/src:ro".format(project_dir),
92
+        "-v", "{:s}:/dist".format(output_dir),
93
+        "-v", "{:s}:/tamarin/hooks:ro".format(tamarin.get_hooks_dir()),
94
+        "-v", "{:s}:/tamarin/lib:ro".format(tamarin.get_lib_dir()),
95
+        "-v", "{:s}:/tamarin/profiles:ro".format(tamarin.get_profiles_dir())
166 96
     ]
167 97
 
168 98
     # Use environment proxy if defined
169 99
     for proxy_var in ['HTTP_PROXY', 'HTTPS_PROXY', 'http_proxy', 'https_proxy']:
170
-      if proxy_var in os.environ:
171
-        rkt_args += ["--set-env={:s}={:s}".format(proxy_var, os.environ[proxy_var])]
100
+        if proxy_var in os.environ:
101
+            docker_args += ["-e", "{:s}={:s}".format(proxy_var, os.environ[proxy_var])]
102
+
103
+    kwargs = dict()
104
+    kwargs['debug'] = args.debug
172 105
 
173 106
     if args.debug:
174
-      rkt_args += ["--interactive", "--exec", "/bin/bash"]
175
-      helper_cmd = " ".join(["/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture])
176
-      print("Executer '{:s}' pour lancer la construction du paquet.".format(helper_cmd))
107
+        kwargs['pty'] = True
108
+        docker_args += ["-it", image_tag, "/bin/sh"]
109
+        helper_cmd = " ".join(["/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture])
110
+        print("Executer '{:s}' pour lancer la construction du paquet.".format(helper_cmd))
177 111
     else:
178
-      rkt_args += ["--exec", "/usr/bin/python3", "--", "/tamarin/lib/build.py", args.profile, args.architecture]
112
+        docker_args += [image_tag, "/usr/bin/python3", "/tamarin/lib/build.py", args.profile, args.architecture]
179 113
 
180 114
     # Start container
181
-    rkt.run(rkt_flags+rkt_args, as_root=True, debug=args.debug)
115
+    tamarin.run_docker(docker_args, **kwargs)
182 116
 
183
-    # Cleanup
184
-    cleanup(build_workspace, rkt_flags, debug=args.debug)
117
+    cleanup(build_workspace, debug=args.debug)

+ 1
- 1
profiles/debian.conf View File

@@ -1,7 +1,7 @@
1 1
 # Configuration générale du profil
2 2
 [profile]
3 3
 # Image Docker par défaut
4
-default_image=docker://debian:jessie
4
+default_image=debian:jessie
5 5
 
6 6
 # Configuration de l'étape de pré-construction du conteneur
7 7
 [containerbuild]

Loading…
Cancel
Save