From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6467463440282681344 X-Received: by 10.28.47.197 with SMTP id v188mr1413491wmv.23.1506959156141; Mon, 02 Oct 2017 08:45:56 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 10.223.188.18 with SMTP id s18ls3475424wrg.9.gmail; Mon, 02 Oct 2017 08:45:55 -0700 (PDT) X-Google-Smtp-Source: AOwi7QDkfsPNGSPuryQKcAlS7ZfQkyLn8lFr9kl2oyI/+ZgmBgOS45vjgB6yue2lXV/v5rTOumco X-Received: by 10.223.174.201 with SMTP id y67mr1476745wrc.7.1506959155774; Mon, 02 Oct 2017 08:45:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1506959155; cv=none; d=google.com; s=arc-20160816; b=FPqXS0JwS6ALpaoYH8eBIKIlInduUyN3TYMGZ1MGD+zfi/DVpgqQLFVPgIHuIHxgWU wSwm5HrPl7Vu8RGsumJUr7iujlimiG09kj1bdJVl8OxC6nCFo2bT6MUHg4qBNdYOgx58 f5Geu7wODVdc3FVl9tgVPgQGRVJhNJT8RhlKIpdVWRdGQ/5TTrz0eSagVG2jqXzuWUbm UrNA5D/zz6ZZitGaDaieczyOVlAHocagcShypZincFmbxxpe/jsdgVgG5WAFjOBqVm7/ rzKwELBnbUqB2sVKB5vKqdkCZE7WmYct82956U23MphQl5mSaMXtKXtOw4zBJKW1wqhj Ivjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=bGBIw2yUkFZzQ2RGQHEeORZcAoamhLPHp9LOxukcTeI=; b=OFnwwy967mtYQtAgWnDXdFyjElzI5TlyFbXQH0v48Y9EZvmks0HYqCTt4Kk8yfIZJY b5ZSMXQ3bRm4FBJmm5pdo/PV3THTNmMzhcTRLiJjWQ6U743EqSYj0a2Zzf7Xfs/U87nG JqAHz8Xe8B5rmDhZgmyC4VSol3pF8S7uDWVdHNivipWfRr3h9WfIBB+zZ7c3llbXMBpN yzyIVS5zvc1LLvxkZ26p4oYyF6DmA5P3uiAgvMwZ2HUxSnq8S6poVJbPWiHLFv2L4Vzk bYYMy62jQBxtSFy/ZgAfZUeOrDu655jSKHydpAgoSNF5Ilv03NkTmP1ptBWkSeAMnpQ/ yo6Q== 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 r65si1098381wmf.2.2017.10.02.08.45.55 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Oct 2017 08:45:55 -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 localhost.localdomain ([188.227.110.165]) (authenticated bits=0) by aqmola.ilbers.de (8.14.4/8.14.4/Debian-4+deb7u1) with ESMTP id v92Fjc8B020957 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 2 Oct 2017 17:45:46 +0200 From: Alexander Smirnov To: isar-users@googlegroups.com Cc: Alexander Smirnov Subject: [PATCH 2/4] meta-isar-bin: Generate cache repos Date: Mon, 2 Oct 2017 18:45:29 +0300 Message-Id: <20171002154531.4930-3-asmirnov@ilbers.de> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20171002154531.4930-1-asmirnov@ilbers.de> References: <20171002154531.4930-1-asmirnov@ilbers.de> X-TUID: 0KFDiHHGTsjZ 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 + # integer results value (239). + eexist="239" + retval="0" + reprepro --waitforlock 1 $* || retval="$?" + + # 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..." + 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 -- 2.1.4