浏览代码

Custom mirror and components for baiji create.

This assumes that debootstrap treats empty string in the mirror argument
as no mirror argument being passed at all. We can be safe as long as the
runtime environment of debootstrap (i.e. the shell command language
interpreter) does not distinguish between the two cases outlined above.
Ilyas Gasanov 6 年之前
父节点
当前提交
45169762be
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      baiji

+ 7 - 1
baiji

@@ -93,6 +93,10 @@ def fakeroot_filter(info):
          help = "distribution for base docker image"),
      arg("--tag",  default = "baiji:jessie",
          help = "tag to use for constructed base docker image"),
+     arg("--mirror", default = "",
+         help = "mirror URL to pull packages from"),
+     arg("--components", default = ["main"], nargs = "+",
+         help = "repository components to use"),
 )
 def create(args):
     """
@@ -104,7 +108,9 @@ def create(args):
 
     with tempdir() as dn:
         subprocess.check_call(("fakeroot", "/usr/sbin/debootstrap",
-                               "--foreign", "--variant=buildd", args.dist, dn))
+                               "--foreign", "--variant=buildd",
+                               "--components={}".format(",".join(args.components)),
+                               args.dist, dn, args.mirror))
         with Docker("import", "-", args.tag, stdin = subprocess.PIPE) as docker:
             with tarfile.open(mode = "w|", fileobj = docker.stdin) as tar:
                 tar.add(dn, ".", filter = fakeroot_filter)