From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6467463440282681344 X-Received: by 10.25.225.195 with SMTP id l64mr115183lfk.16.1505895139794; Wed, 20 Sep 2017 01:12:19 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.46.97.18 with SMTP id v18ls72083ljb.50.gmail; Wed, 20 Sep 2017 01:12:19 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDs0x7C8Bhscsqds9hk1UrbBt4hbjyatY19RRohTWzaO0sRF8MHWaLRlSiXxprlAmuuecTI X-Received: by 10.25.143.201 with SMTP id s70mr118029lfk.38.1505895139490; Wed, 20 Sep 2017 01:12:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505895139; cv=none; d=google.com; s=arc-20160816; b=oPrcQk1I53ee1xWLarLchhSAy73/eXe1eLTvZf6T6xhd3s6loxZG1+okOwKskb6l4t p9fm4w5W5XzCA35pXfgA85jplmRxkho5Tdu/j5bNDDc4m8WwisXyRdaGfwL6zXI9tsLW rcDP/qqL6b44ehX6XcNHvsIgBxY9SRuUBFdJ5z09MbgqxrJ6/SkP89uzjumDz8fk1Zdc hCb7f4zoJdLz3BXjonE6nSyH8Hs3xS+fy7HLRcuwgTlQgvWdA5b4vCYq+kNSvI2elreZ Y0urHj7s2zJTqK2E+eMWnNgtAG6dU2rfvRnn79BAVAsmtteUAfmHfQtDNh4RAnscZKHM WjMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:from:references:cc:to:subject :arc-authentication-results; bh=vac7GEaBnSnBZFu9+3H6mBc359kqKYvdBg4ukI1jU6s=; b=VricVA64i8Otey4PiOBMQqw6odvHKc9ZC/b28/r+NwcpKiqECJC9LOgN3OtEqMcFO+ VAzQ959I6t7Pafa1R/kj7nBuBhxP97Gspdltq4JuOq4ToPgagMooHSNDvDxrQRQ/Ccjs vkFzqbq9Vg//BZXb5JPnDxmnIoF6u8YFhcSE+vvzTrOKu4LkgSgDosg/Xzi6cWKxlH9z WQfEsP1ZHOzXEdUmvCLfKQgBl0xYNaOIx15sQR9pCS9nAsIUCNYBGXNc5W3CVOlMtl+l HzCL2i2XjQiVQbltayagiQn6oITEn3A36JlFeR8kArPuNKLn5mT8PFZY63w20lAY0MC9 T7mg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Return-Path: Received: from aqmola.ilbers.de (aqmola.ilbers.de. [85.214.62.211]) by gmr-mx.google.com with ESMTPS id p70si80955wma.1.2017.09.20.01.12.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2017 01:12:19 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) client-ip=85.214.62.211; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: best guess record for domain of asmirnov@ilbers.de designates 85.214.62.211 as permitted sender) smtp.mailfrom=asmirnov@ilbers.de Received: from [10.0.2.15] ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id v8K8CGim013110 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Wed, 20 Sep 2017 10:12:18 +0200 Subject: Re: [PATCH v2 1/4] meta-isar-bin: Add reprepro configs To: Henning Schild Cc: isar-users@googlegroups.com References: <20170919122052.28688-1-asmirnov@ilbers.de> <20170919122052.28688-2-asmirnov@ilbers.de> <20170920095854.33e57f4a@md1em3qc> From: Alexander Smirnov Message-ID: <22bc2fd0-53b4-52cf-4950-dda1d17755aa@ilbers.de> Date: Wed, 20 Sep 2017 11:12:11 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 MIME-Version: 1.0 In-Reply-To: <20170920095854.33e57f4a@md1em3qc> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-TUID: 5jQCtHcI3KHi On 09/20/2017 10:58 AM, Henning Schild wrote: > Am Tue, 19 Sep 2017 15:20:49 +0300 > schrieb Alexander Smirnov : > >> Add template for reprepro configuration file and function that >> generates final config for specific deistro. >> >> Signed-off-by: Alexander Smirnov >> --- >> 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() >> +} > > Why is this not just a regular task early in the image chain? > The idea is to avoid races with multiconfig. If I add this as a regular task, it could be run in parallel by different multiconfigs, so there could occur races in `mkdir` and `sed`. The same is true when you try to build several images at the same time: $ bitbake image1 image2 IIRC bitbake anonymous tasks are executed during parsing stage, so they are serialized. Alex > Henning > >> do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}" >> >> # Install Debian packages, that were built from sources >