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

John Ogness john.ogness at linutronix.de
Tue Aug 23 23:22:54 CEST 2016


Subject: [PATCH] pbuilder: access local repo via http

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.

This patch adds a config-package-dev package that will need to
be hosted on the elbe apt source server. This package will
install lighttpd and modify its configuration to run on the
loopback interface port 8080 and only allow access to
/var/cache/elbe/ files.

Signed-off-by: John Ogness <john.ogness at linutronix.de>
---
 .../debian/changelog                               |  5 +++++
 .../debathena-transform-lighttpd-1.0/debian/compat |  1 +
 .../debian/control                                 | 15 ++++++++++++++
 .../debian/copyright                               | 24 ++++++++++++++++++++++
 .../debian/debathena-transform-lighttpd.postinst   |  5 +++++
 .../debian/debathena-transform-lighttpd.transform  |  1 +
 .../debathena-transform-lighttpd-1.0/debian/rules  |  4 ++++
 .../debian/source/format                           |  1 +
 elbepack/init/preseed.cfg.mako                     |  1 +
 elbepack/pbuilder.py                               |  6 +++++-
 elbepack/repomanager.py                            |  2 ++
 11 files changed, 64 insertions(+), 1 deletion(-)
 create mode 100644 contrib/debathena-transform-lighttpd-1.0/debian/changelog
 create mode 100644 contrib/debathena-transform-lighttpd-1.0/debian/compat
 create mode 100644 contrib/debathena-transform-lighttpd-1.0/debian/control
 create mode 100644 contrib/debathena-transform-lighttpd-1.0/debian/copyright
 create mode 100755 contrib/debathena-transform-lighttpd-1.0/debian/debathena-transform-lighttpd.postinst
 create mode 100644 contrib/debathena-transform-lighttpd-1.0/debian/debathena-transform-lighttpd.transform
 create mode 100755 contrib/debathena-transform-lighttpd-1.0/debian/rules
 create mode 100644 contrib/debathena-transform-lighttpd-1.0/debian/source/format

diff --git a/contrib/debathena-transform-lighttpd-1.0/debian/changelog b/contrib/debathena-transform-lighttpd-1.0/debian/changelog
new file mode 100644
index 0000000..41ddf99
--- /dev/null
+++ b/contrib/debathena-transform-lighttpd-1.0/debian/changelog
@@ -0,0 +1,5 @@
+debathena-transform-lighttpd (1.0) unstable; urgency=low
+
+  * Initial release.
+
+ -- John Ogness <john.ogness at linutronix.de>  Tue, 23 Aug 2016 22:28:16 +0200
diff --git a/contrib/debathena-transform-lighttpd-1.0/debian/compat b/contrib/debathena-transform-lighttpd-1.0/debian/compat
new file mode 100644
index 0000000..7f8f011
--- /dev/null
+++ b/contrib/debathena-transform-lighttpd-1.0/debian/compat
@@ -0,0 +1 @@
+7
diff --git a/contrib/debathena-transform-lighttpd-1.0/debian/control b/contrib/debathena-transform-lighttpd-1.0/debian/control
new file mode 100644
index 0000000..8974a7a
--- /dev/null
+++ b/contrib/debathena-transform-lighttpd-1.0/debian/control
@@ -0,0 +1,15 @@
+Source: debathena-transform-lighttpd
+Section: config
+Priority: extra
+Maintainer: John Ogness <john.ogness at linutronix.de>
+Build-Depends: debhelper (>= 7.0.0~), config-package-dev (>= 4.15), lighttpd
+Standards-Version: 3.9.2
+
+Package: debathena-transform-lighttpd
+Architecture: all
+Depends: ${misc:Depends}, lighttpd
+Provides: ${diverted-files}
+Conflicts: ${diverted-files}
+Description: lighttpd config-package-dev package
+ This config-package-dev package updates the lighttpd configuration for
+ use within the elbe initvm.
diff --git a/contrib/debathena-transform-lighttpd-1.0/debian/copyright b/contrib/debathena-transform-lighttpd-1.0/debian/copyright
new file mode 100644
index 0000000..f0822b3
--- /dev/null
+++ b/contrib/debathena-transform-lighttpd-1.0/debian/copyright
@@ -0,0 +1,24 @@
+lighttpd config-package-dev package.
+
+Author: John Ogness <john.ogness at linutronix.de>
+
+Copyright 2016 Linutronix GmbH
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/contrib/debathena-transform-lighttpd-1.0/debian/debathena-transform-lighttpd.postinst b/contrib/debathena-transform-lighttpd-1.0/debian/debathena-transform-lighttpd.postinst
new file mode 100755
index 0000000..9a37d0a
--- /dev/null
+++ b/contrib/debathena-transform-lighttpd-1.0/debian/debathena-transform-lighttpd.postinst
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+#DEBHELPER#
+/etc/init.d/lighttpd stop
+/etc/init.d/lighttpd start
diff --git a/contrib/debathena-transform-lighttpd-1.0/debian/debathena-transform-lighttpd.transform b/contrib/debathena-transform-lighttpd-1.0/debian/debathena-transform-lighttpd.transform
new file mode 100644
index 0000000..c4514e5
--- /dev/null
+++ b/contrib/debathena-transform-lighttpd-1.0/debian/debathena-transform-lighttpd.transform
@@ -0,0 +1 @@
+/etc/lighttpd/lighttpd.conf.debathena sed -e 's/^server.bind.*//' -e 's/^\(server.\)port\(.*=\).*/\1port\2 8080\n\1bind\2 "127.0.0.1"\n$HTTP["url"] =~ "^\/var\/cache\/elbe\/" { url.access-deny = ( "disable" ) }/' -e 's/^\(server.document-root.*=\).*/\1 "\/"/' -e 's/^\(url.access-deny.*=\).*/\1 ( "" )/'
diff --git a/contrib/debathena-transform-lighttpd-1.0/debian/rules b/contrib/debathena-transform-lighttpd-1.0/debian/rules
new file mode 100755
index 0000000..fb88cc4
--- /dev/null
+++ b/contrib/debathena-transform-lighttpd-1.0/debian/rules
@@ -0,0 +1,4 @@
+#!/usr/bin/make -f
+
+%:
+	dh $@ --with=config-package
diff --git a/contrib/debathena-transform-lighttpd-1.0/debian/source/format b/contrib/debathena-transform-lighttpd-1.0/debian/source/format
new file mode 100644
index 0000000..89ae9db
--- /dev/null
+++ b/contrib/debathena-transform-lighttpd-1.0/debian/source/format
@@ -0,0 +1 @@
+3.0 (native)
diff --git a/elbepack/init/preseed.cfg.mako b/elbepack/init/preseed.cfg.mako
index 21138e9..e318d86 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 \
+debathena-transform-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