public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Alexander Smirnov <asmirnov@ilbers.de>
To: isar-users@googlegroups.com
Cc: Alexander Smirnov <asmirnov@ilbers.de>
Subject: [PATCH v2 1/4] meta-isar-bin: Add reprepro configs
Date: Tue, 19 Sep 2017 15:20:49 +0300	[thread overview]
Message-ID: <20170919122052.28688-2-asmirnov@ilbers.de> (raw)
In-Reply-To: <20170919122052.28688-1-asmirnov@ilbers.de>

Add template for reprepro configuration file and function that
generates final config for specific deistro.

Signed-off-by: Alexander Smirnov <asmirnov@ilbers.de>
---
 meta-isar-bin/conf/layer.conf        | 11 +++++++++++
 meta-isar-bin/files/distributions.in |  3 +++
 meta-isar/conf/bblayers.conf.sample  |  1 +
 meta/classes/image.bbclass           | 25 +++++++++++++++++++++++++
 4 files changed, 40 insertions(+)
 create mode 100644 meta-isar-bin/conf/layer.conf
 create mode 100644 meta-isar-bin/files/distributions.in

diff --git a/meta-isar-bin/conf/layer.conf b/meta-isar-bin/conf/layer.conf
new file mode 100644
index 0000000..3518184
--- /dev/null
+++ b/meta-isar-bin/conf/layer.conf
@@ -0,0 +1,11 @@
+# This software is a part of ISAR.
+# Copyright (C) 2017 ilbers GmbH
+
+# Codename of the repository created by the caching class
+DEBDISTRONAME = "isar"
+
+# Path to the caching repository
+DEBCACHEDIR ?= "${LAYERDIR}/apt"
+
+# Path to the configuration files templates used by `reprepro`
+DEBFILESDIR ?= "${LAYERDIR}/files"
diff --git a/meta-isar-bin/files/distributions.in b/meta-isar-bin/files/distributions.in
new file mode 100644
index 0000000..cd214c6
--- /dev/null
+++ b/meta-isar-bin/files/distributions.in
@@ -0,0 +1,3 @@
+Codename: {DISTRO_NAME}
+Architectures: i386 armhf amd64 source
+Components: main
diff --git a/meta-isar/conf/bblayers.conf.sample b/meta-isar/conf/bblayers.conf.sample
index 80867e7..53a362b 100644
--- a/meta-isar/conf/bblayers.conf.sample
+++ b/meta-isar/conf/bblayers.conf.sample
@@ -8,6 +8,7 @@ BBFILES ?= ""
 BBLAYERS ?= " \
   ##ISARROOT##/meta \
   ##ISARROOT##/meta-isar \
+  ##ISARROOT##/meta-isar-bin \
   "
 BBLAYERS_NON_REMOVABLE ?= " \
   ##ISARROOT##/meta \
diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass
index 5bf9524..30f241a 100644
--- a/meta/classes/image.bbclass
+++ b/meta/classes/image.bbclass
@@ -10,6 +10,31 @@ IMAGE_ROOTFS   = "${WORKDIR}/rootfs"
 
 inherit ${IMAGE_TYPE}
 
+# Generate apt cache configuration file
+python __anonymous () {
+    DISTRO = d.getVar("DISTRO", True)
+    DEBFILESDIR = d.getVar("DEBFILESDIR", True)
+    DEBCACHEDIR = d.getVar("DEBCACHEDIR", True)
+
+    cache_conf_path = os.path.join(DEBCACHEDIR, DISTRO, "conf")
+    cache_conf_file = os.path.join(cache_conf_path, "distributions")
+    cache_conf_file_in = os.path.join(DEBFILESDIR, "distributions.in")
+
+    import subprocess
+
+    if not os.path.exists(cache_conf_path):
+        os.makedirs(cache_conf_path)
+
+    if not os.path.exists(cache_conf_file):
+        f = open(cache_conf_file, "w")
+        subprocess.check_call([
+            "sed",
+            "-e", "s#{DISTRO_NAME}#" + d.getVar("DEBDISTRONAME", True) + "#g",
+            cache_conf_file_in,
+            ], stdout=f)
+        f.close()
+}
+
 do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}"
 
 # Install Debian packages, that were built from sources
-- 
2.1.4


  reply	other threads:[~2017-09-19 12:21 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-19 12:20 [PATCH v2 0/4] Basic binary cache implementation Alexander Smirnov
2017-09-19 12:20 ` Alexander Smirnov [this message]
2017-09-20  7:58   ` [PATCH v2 1/4] meta-isar-bin: Add reprepro configs Henning Schild
2017-09-20  8:12     ` Alexander Smirnov
2017-09-20  8:38       ` Henning Schild
2017-09-20  8:51         ` Alexander Smirnov
2017-09-19 12:20 ` [PATCH v2 2/4] meta-isar-bin: Generate cache repos Alexander Smirnov
2017-09-20  8:11   ` Henning Schild
2017-09-20  8:26     ` Alexander Smirnov
2017-09-21  8:55       ` Andreas Reichel
2017-09-21  9:21         ` Claudius Heine
2017-09-22 10:56         ` Baurzhan Ismagulov
2017-09-25 10:49           ` Claudius Heine
2017-09-25 11:57             ` Alexander Smirnov
2017-09-25 13:48               ` Claudius Heine
2017-09-19 12:20 ` [PATCH v2 3/4] meta-isar-bin: Populate cache Alexander Smirnov
2017-09-20  8:22   ` Henning Schild
2017-09-20  8:49     ` Alexander Smirnov
2017-09-19 12:20 ` [PATCH v2 4/4] meta-isar-bin: Install packages via multistrap Alexander Smirnov
2017-09-20  8:28   ` Henning Schild

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170919122052.28688-2-asmirnov@ilbers.de \
    --to=asmirnov@ilbers.de \
    --cc=isar-users@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox