[elbe-devel] [RFC PATCH] pbuilder: access local repo via http

John Ogness john.ogness at linutronix.de
Tue Aug 23 15:52:20 CEST 2016


Some pbuilder packages may depend on previous pbuilder packages
that are only available in the local repository. This can be
accessed via a local http server. The ordering is also set so
that the local repository is preferred over any other apt
source.

NOTE: lighttpd is not configured with this patch. For this patch
      to work, the following lines should exist in
      /etc/lighttpd/lighttpd.conf

      server.document-root = "/"
      server.bind = "127.0.0.1"
      server.port = 8080

Signed-off-by: John Ogness <john.ogness at linutronix.de>
---
I couldn't figure out the best way to automatically configure the
lighttpd server when setting up the initvm. It seems this should
be done in the initrd? Also, it may be desirable to add lighttpd
rules to restrict access to /var/cache/elbe/.

 elbepack/init/preseed.cfg.mako | 1 +
 elbepack/pbuilder.py           | 6 +++++-
 elbepack/repomanager.py        | 2 ++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/elbepack/init/preseed.cfg.mako b/elbepack/init/preseed.cfg.mako
index 21138e9..07366ed 100644
--- a/elbepack/init/preseed.cfg.mako
+++ b/elbepack/init/preseed.cfg.mako
@@ -104,6 +104,7 @@ apt-mirror-setup apt-setup/use_mirror boolean false
 
 d-i finish-install/reboot_in_progress note
 d-i pkgsel/include string rng-tools btrfs-tools openssh-client \
+lighttpd \
 elbe-soap elbe-buildenv qemu-elbe-user-static \
 % for n in pkgs:
 % if n.tag == "pkg":
diff --git a/elbepack/pbuilder.py b/elbepack/pbuilder.py
index cf654f4..0fe5d6e 100644
--- a/elbepack/pbuilder.py
+++ b/elbepack/pbuilder.py
@@ -15,6 +15,7 @@ def pbuilder_write_config (builddir, xml, log):
     fp.write ('#!/bin/sh\n')
     fp.write ('set -e\n')
     fp.write ('MIRRORSITE="%s"\n' % xml.get_primary_mirror(False))
+    fp.write ('OTHERMIRROR="deb http://127.0.0.1:8080%s/repo jessie main"\n' % builddir)
     fp.write ('BASETGZ="%s"\n' % os.path.join (builddir, 'pbuilder', 'base.tgz'))
 
     fp.write ('DISTRIBUTION="%s"\n' % xml.prj.text ('suite'))
@@ -71,8 +72,11 @@ def pbuilder_write_repo_hook (builddir, xml):
         return "# no mirrors configured"
 
     mirror = "#!/bin/sh\n"
+
+    mirror += 'echo "deb http://127.0.0.1:8080' + builddir + '/repo ' + xml.prj.text("suite") + ' main" > /etc/apt/sources.list\n'
+
     if xml.prj.has("mirror/primary_host"):
-        mirror += 'echo "deb ' + xml.get_primary_mirror (None) + ' ' + xml.prj.text("suite") + ' main" > /etc/apt/sources.list\n'
+        mirror += 'echo "deb ' + xml.get_primary_mirror (None) + ' ' + xml.prj.text("suite") + ' main" >> /etc/apt/sources.list\n'
 
         if xml.prj.has("mirror/url-list"):
             for url in xml.prj.node("mirror/url-list"):
diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
index d10ad62..eab452b 100644
--- a/elbepack/repomanager.py
+++ b/elbepack/repomanager.py
@@ -133,6 +133,8 @@ class RepoBase(object):
 
         if need_update:
             self.log.do( 'reprepro --export=force --basedir "' + self.fs.path + '" update' )
+        else:
+            self.log.do( 'reprepro --basedir "' + self.fs.path + '" export ' + att.codename )
 
     def finalize( self ):
         for att in self.attrs:
-- 
2.8.1




More information about the elbe-devel mailing list