From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6467463440282681344 X-Received: by 10.46.46.10 with SMTP id u10mr407860lju.15.1505896702097; Wed, 20 Sep 2017 01:38:22 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.46.93.93 with SMTP id r90ls73581ljb.30.gmail; Wed, 20 Sep 2017 01:38:21 -0700 (PDT) X-Google-Smtp-Source: AOwi7QA4q7YVagkxkslUddPvGfrt0z4+LWVq/jibpeEKmJZDSWj3WWswNow2WFnCW2cEvLi59hWV X-Received: by 10.46.4.198 with SMTP id a67mr394001ljf.16.1505896701799; Wed, 20 Sep 2017 01:38:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1505896701; cv=none; d=google.com; s=arc-20160816; b=d3+C/Ury+4nG4ZL+u+SjekB4DvkluVNHmZHGCFczcPMCREkX9k3GFDFScMPaSJKZcj iZkKfT1P0ek60X41blYSPN4EUfhODvB8QDrsY66r4wxmcdlZbe65MnYNoPH0AVXpcb/c gTN9DQ45i1FT7LwESA6Pbn5mJGqmTt1TNzhOgEhlInvgz+/Wq5icQyCzYbomRYODPfoQ FR0CqdHPOWvfP5X/ltU4k6Ya+iZJk67gtGEWTEWAkHLmK18otSx8aUgqblmkUuD3pmcV Pvch+nYwRtqf1ECvxGfxTdyS+V2j8axbsyx4EqbpKpIU7b9yXYFsHuhlPvo5Niq2zQji c1MQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:arc-authentication-results; bh=nzrtUfbxit7N5e4S6rmHMB8wmMCnwvXlWFc9Yg31IwY=; b=E/1+VttADBqZ+8ZlEUG3TESmxZKRZ+wQqYyyLZypvJgJEwptfqgSZfROrX80cV3IVs QjJdyJ5ziW7Ull73L4wGSbfxr0GOanR9FXJ7mqycs/WZvMovwTeoqfx9btnyoGaFDuk+ maOsrGeC4EH7gmFFHx92/I30YrjcxvhTSzi6cA6EKP7qygtLIJCi+uVcvs8Yki4RJ84T pY0aXAgGz1sl2+y4C9/olCDZfUWnSxNXVRKQqFlMyUoM44fZrDxaYOk7JbLCX9/B3Xdr jPxPw6gvAw17BPDGMvL7BFzGaXj8159AvZbYHRpBQ1FDQudkCjsjIbj4UA7nIkxFkKQW OrRw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from goliath.siemens.de (goliath.siemens.de. [192.35.17.28]) by gmr-mx.google.com with ESMTPS id j4si110407wmi.2.2017.09.20.01.38.21 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Sep 2017 01:38:21 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) client-ip=192.35.17.28; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.28 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) smtp.mailfrom=henning.schild@siemens.com Received: from mail2.siemens.de (mail2.siemens.de [139.25.208.11]) by goliath.siemens.de (8.15.2/8.15.2) with ESMTPS id v8K8cLDR029382 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 20 Sep 2017 10:38:21 +0200 Received: from md1em3qc ([139.25.68.40]) by mail2.siemens.de (8.15.2/8.15.2) with ESMTP id v8K8cLZr028436; Wed, 20 Sep 2017 10:38:21 +0200 Date: Wed, 20 Sep 2017 10:38:35 +0200 From: Henning Schild To: Alexander Smirnov Cc: Subject: Re: [PATCH v2 1/4] meta-isar-bin: Add reprepro configs Message-ID: <20170920103835.2d54d218@md1em3qc> In-Reply-To: <22bc2fd0-53b4-52cf-4950-dda1d17755aa@ilbers.de> References: <20170919122052.28688-1-asmirnov@ilbers.de> <20170919122052.28688-2-asmirnov@ilbers.de> <20170920095854.33e57f4a@md1em3qc> <22bc2fd0-53b4-52cf-4950-dda1d17755aa@ilbers.de> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.31; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-TUID: znCyoCbCz6iN Am Wed, 20 Sep 2017 11:12:11 +0300 schrieb Alexander Smirnov : > 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. I see, but that makes them a very strong measure that you can never override i.e. in a layer on top. Not sure if that matters but i would shy away from using the strongest measure if it can be done in a different way. For the dir how about using newtask[dirs] i guess bitbake will know how to handle that and it seems to be the bitbake way anyways. And for the sed, if the race happens and two or more seds get run. They should just produce the same output and not fail if it was already there sed "s#{DISTRO_NAME}#" + d.getVar("DEBDISTRONAME", True) + "#g" \ cache_conf_file_in > cache_conf_file Henning > Alex > > > Henning > > > >> do_populate[stamp-extra-info] = "${DISTRO}-${MACHINE}" > >> > >> # Install Debian packages, that were built from sources > >