From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6467463440282681344 X-Received: by 10.28.128.140 with SMTP id b134mr870558wmd.3.1507107823869; Wed, 04 Oct 2017 02:03:43 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.223.187.19 with SMTP id r19ls3779032wrg.1.gmail; Wed, 04 Oct 2017 02:03:43 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDzmiFi1rvU1qx8R+FiUOQBdkLajjfT44xMUWbw7rXOr7iA9lQH+WfzJFA6xDlAvKzmBaif X-Received: by 10.28.45.215 with SMTP id t206mr2206260wmt.17.1507107823578; Wed, 04 Oct 2017 02:03:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507107823; cv=none; d=google.com; s=arc-20160816; b=Wqe7/qCoUs8JlMy4UDBfWayxJjM9yiqwlge31MqWaH019bvFLG6rraanC2JEW9RcoN JMC+R8UqOWX7ynzIPLksMSoX/x5NPzCB8P8RB3CT6hiOEwgtKfkF99rzUp4Xo2mDnnQL pZZdWt8A7jVY6h5N96DBHp/izg3S+uPQW2MhTNq42tXdhMThBuCiEnFk7wrWiCuH4i5T 7edglUS8F/Er7odrH7YTqDlwMvgcgH7cLvLRiDjacAJKoO1Nk1mZ18uNinJpoURzMJRK it/yZ64yAlJ/FlXURJMH8+Y+i8zjPE96aWvR+1MaoIhr6PYVlU3yPSEKq/9CYogsaXoh VxAw== 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=OGMnQFf5ZpbSF6F9vibe85jDunvwyVn+Um4CIRiCYKc=; b=BmjAHqnLVW+ly5XZTcxVXVV0cjwQglyZSJdNLfEvqZ71Iazj2AXSwMh4phQywEiLWX 4TgCZZD3dvEFclut3l99TwR7xTsVaftEBIvAm2/zPbP7qHMtgHLlfiZGMpXBc018NONL DgpzUb/IvcpsxhUVOo9znjPUf3tUMA665dqCFPywQpY++dukCIu2naeQhUwAmiSRf3E7 jJDKkjT+ZmkescRF/qOvd2wWv6ukoWfjiNmohfD1kknvea+2klaKqgv5wsZLrKyY7Tja 5eRqmC/OWndf9N/Kg1EUqLSwJQ8cv/vKHhSj+b1cj1nN9xu4TeeUyHZEsTKZnmiF36R/ DpbQ== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 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 david.siemens.de (david.siemens.de. [192.35.17.14]) by gmr-mx.google.com with ESMTPS id q195si657170wme.4.2017.10.04.02.03.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Oct 2017 02:03:43 -0700 (PDT) Received-SPF: neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) client-ip=192.35.17.14; Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 192.35.17.14 is neither permitted nor denied by best guess record for domain of henning.schild@siemens.com) smtp.mailfrom=henning.schild@siemens.com Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by david.siemens.de (8.15.2/8.15.2) with ESMTPS id v9493ho7002493 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 4 Oct 2017 11:03:43 +0200 Received: from md1em3qc ([139.22.133.127]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id v9493gsT017460; Wed, 4 Oct 2017 11:03:42 +0200 Date: Wed, 4 Oct 2017 11:03:39 +0200 From: Henning Schild To: Alexander Smirnov Cc: Subject: Re: [PATCH 2/4] meta-isar-bin: Generate cache repos Message-ID: <20171004110339.5a80221e@md1em3qc> In-Reply-To: <20171002154531.4930-3-asmirnov@ilbers.de> References: <20171002154531.4930-1-asmirnov@ilbers.de> <20171002154531.4930-3-asmirnov@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: vlOey+zmdT2N Am Mon, 2 Oct 2017 18:45:29 +0300 schrieb Alexander Smirnov : > Generate repos for each configuration in multiconfig. > > Signed-off-by: Alexander Smirnov > --- > meta-isar-bin/conf/layer.conf | 3 +++ > meta-isar/conf/local.conf.sample | 4 ++++ > meta/classes/image.bbclass | 35 > ++++++++++++++++++++++++++++++++++- 3 files changed, 41 > insertions(+), 1 deletion(-) > > diff --git a/meta-isar-bin/conf/layer.conf > b/meta-isar-bin/conf/layer.conf index 3518184..5ef6e60 100644 > --- a/meta-isar-bin/conf/layer.conf > +++ b/meta-isar-bin/conf/layer.conf > @@ -9,3 +9,6 @@ DEBCACHEDIR ?= "${LAYERDIR}/apt" > > # Path to the configuration files templates used by `reprepro` > DEBFILESDIR ?= "${LAYERDIR}/files" > + > +# Path to the databases used by `reprepro` > +DEBDBDIR ?= "${LAYERDIR}/db" > diff --git a/meta-isar/conf/local.conf.sample > b/meta-isar/conf/local.conf.sample index a456b1b..660958f 100644 > --- a/meta-isar/conf/local.conf.sample > +++ b/meta-isar/conf/local.conf.sample > @@ -158,3 +158,7 @@ IMAGE_INSTALL = "hello example-raw" > # > # Default parallel jobs for bitbake: > BB_NUMBER_THREADS = "4" > + > +# > +# Number of attempts to try to get reprepro lock for access to apt > cache +REPREPRO_LOCK_ATTEMPTS = "16" > diff --git a/meta/classes/image.bbclass b/meta/classes/image.bbclass > index d30b139..b07775a 100644 > --- a/meta/classes/image.bbclass > +++ b/meta/classes/image.bbclass > @@ -1,5 +1,5 @@ > # This software is a part of ISAR. > -# Copyright (C) 2015-2016 ilbers GmbH > +# Copyright (C) 2015-2017 ilbers GmbH > > KERNEL_IMAGE ?= "" > INITRD_IMAGE ?= "" > @@ -14,6 +14,30 @@ CACHE_CONF_DIR = "${DEBCACHEDIR}/${DISTRO}/conf" > do_cache_config[dirs] = "${CACHE_CONF_DIR}" > do_cache_config[stamp-extra-info] = "${DISTRO}" > > +call_reprepro() { > + for i in $(seq 1 ${REPREPRO_LOCK_ATTEMPTS}); do > + # According to `sh` manual page, shell exit statuses fall > between > + # 0-255. The EEXIST error code is (-17), so casting to > usigned 8-bit cant you use python to get that number and use the name "EEXIST" instead of a hardcoded number? I think i sent a sniplet in an earlier mail. > + # integer results value (239). > + eexist="239" > + retval="0" > + reprepro --waitforlock 1 $* || retval="$?" The waitforlock should be skipped altogether, which means try it once. The current version means try twice. I got that wrong when i suggested to go for "1", sorry. > + # If reprepro has failed to get database lock, it returns > EEXIST code. > + # In this case we continue trying to get lock until max > amount of > + # attempts is reached. > + if [ $retval -eq $eexist ]; then > + bbwarn "Failed to get reprepro lock, trying again..." Are there other cases where reprepro returns -EEXIST? Henning > + else > + break > + fi > + done > + > + if [ $retval -ne 0 ]; then > + bbfatal "reprepro failed" > + fi > +} > + > # Generate reprepro config for current distro if it doesn't exist. > Once it's # generated, this task should do nothing. > do_cache_config() { > @@ -21,6 +45,15 @@ do_cache_config() { > sed -e "s#{DISTRO_NAME}#"${DEBDISTRONAME}"#g" \ > ${DEBFILESDIR}/distributions.in > > ${CACHE_CONF_DIR}/distributions fi > + > + path_cache="${DEBCACHEDIR}/${DISTRO}" > + path_databases="${DEBDBDIR}/${DISTRO}" > + > + if [ ! -d "${path_databases}" ]; then > + call_reprepro -b ${path_cache} \ > + --dbdir ${path_databases} \ > + export ${DEBDISTRONAME} > + fi > } > > addtask cache_config before do_fetch