From mboxrd@z Thu Jan 1 00:00:00 1970 X-GM-THRID: 6547633542169362432 X-Received: by 2002:adf:ce85:: with SMTP id r5-v6mr3265023wrn.12.1525801210317; Tue, 08 May 2018 10:40:10 -0700 (PDT) X-BeenThere: isar-users@googlegroups.com Received: by 2002:a1c:3089:: with SMTP id w131-v6ls354823wmw.7.gmail; Tue, 08 May 2018 10:40:09 -0700 (PDT) X-Google-Smtp-Source: AB8JxZozF2FHJrPTRIHywm38wLx01c4UPataoS9Wqc35a4i6MQv0C8uQ/wfBoHdAqwRWrO5guStG X-Received: by 2002:a1c:6c14:: with SMTP id h20-v6mr545508wmc.13.1525801209830; Tue, 08 May 2018 10:40:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525801209; cv=none; d=google.com; s=arc-20160816; b=m7np3SrX6ylc7szfxpnzDGlYTLC5uSTCmPyVk19TdFUaINswGKNMJnxHbn3xzfqPnk r9CRAdPU2Y+wwgqEUK68s8MMVgvPKxu+gjCD+h2lBqQ2MCMQ0jro5cKU/aU2ue7Jfw1b U2qpLLUBVbJuT9iGcDZLx6ikFgbNLpB/M2pBCLnopuOx/EWAY3esdtNb/QJhOQoxctff Y4LBHpvpLKI5tG9soO0b7aWKgq3gjOgiWWh/lTbaHwrXkwoqtsqTO2VTuHHwMBJbRXNS fnqt4uINfwKlUaBoYD5a4Po9mxC2N+2G+IhVNBknNzjAL6CV1KKCq/CVB0pOegIfsaQv VSBw== 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=tCPnKEJPWc76rbcnS83zSYNcHca0kbtKprVMuE7TcJw=; b=EgunHG3TJli0K175iTeZjEBt9zcfzid4TOUrKZ/jaON4+Wb6AIAjm+KCrs7dVIhIAk qRRQjkTFyDSyYS20NIqRneu/9bJdJc5VVGeoQ6HPMVDqt3GsR/EoTInH9JFiAyGtR/Zg uEA5vmEFjixDgalHRqcWE3yFTB4rFZE1RiEeBWNsNK36AKXVK6ywLFf70tZYaB7TZsNv 7rIf9cN6k58KXvbN7U7I694DO1xyLYQGpq4I46+Jxls/Z50k6rIPSJwMh6SksZ6mEil8 A8zXo4TyolTYdPNuLYzVrA//amwCy6zSR2vKvWWvmDcB4OkmHH1sllwiqB1M+jDkR21z V1hg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Return-Path: Received: from thoth.sbs.de (thoth.sbs.de. [192.35.17.2]) by gmr-mx.google.com with ESMTPS id y144-v6si500889wmd.3.2018.05.08.10.40.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 08 May 2018 10:40:09 -0700 (PDT) Received-SPF: pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) client-ip=192.35.17.2; Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of henning.schild@siemens.com designates 192.35.17.2 as permitted sender) smtp.mailfrom=henning.schild@siemens.com Received: from mail1.siemens.de (mail1.siemens.de [139.23.33.14]) by thoth.sbs.de (8.15.2/8.15.2) with ESMTPS id w48He9Ch014818 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 8 May 2018 19:40:09 +0200 Received: from md1pvb1c.ad001.siemens.net (md1pvb1c.ad001.siemens.net [139.25.68.40]) by mail1.siemens.de (8.15.2/8.15.2) with ESMTP id w48He9sA030526; Tue, 8 May 2018 19:40:09 +0200 Date: Tue, 8 May 2018 19:40:07 +0200 From: Henning Schild To: Alexander Smirnov Cc: Subject: Re: [RFC][PATCH 2/3] classes/dsc: Basic Debian .dsc backend implementation Message-ID: <20180508194007.5e5d73e6@md1pvb1c.ad001.siemens.net> In-Reply-To: <20180423132146.14743-3-asmirnov@ilbers.de> References: <20180423132146.14743-1-asmirnov@ilbers.de> <20180423132146.14743-3-asmirnov@ilbers.de> X-Mailer: Claws Mail 3.15.0-dirty (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: 6u62IAlsOi5l Am Mon, 23 Apr 2018 16:21:45 +0300 schrieb Alexander Smirnov : > This patch introduces class to work with Debian .dsc files. The > main goal is to simplify re-building and customization of original > Debian packages. > > To rebuild package from the upstream the following recipe template > could be used: > > DSC_URI = "http://ftp.de.debian.org/...dsc;md5sum=..." > inherit debian-dsc > > All the remaining information bitbake will derive automatically. > This is only first implementation, so there are still several open > issues like: > - Chose correct upstream package version depending on Debian distro > - quilt-3.0 source format support > - Cross-recipe dependencies recognition > > Signed-off-by: Alexander Smirnov > --- > meta/classes/debian-dsc.bbclass | 112 > ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 112 > insertions(+) create mode 100644 meta/classes/debian-dsc.bbclass > > diff --git a/meta/classes/debian-dsc.bbclass > b/meta/classes/debian-dsc.bbclass new file mode 100644 > index 0000000..4159e3a > --- /dev/null > +++ b/meta/classes/debian-dsc.bbclass > @@ -0,0 +1,112 @@ > +# Debian .dsc backend > +# > +# This software is a part of ISAR. > +# Copyright (c) ilbers GmbH, 2018 > +# > +# SPDX-License-Identifier: MIT > + > +# List of non-standard variables added to package workspace > +# > +# Set by user: > +# * DSC_URI - uri link to .dsc file in upstream apt > +# > +# Generated automatically: > +# * DEBIAN_URI - uri link to Debian patch in upstream apt > + > +python __anonymous() { > + # Fetch .dsc package file > + dsc_uri = (d.getVar("DSC_URI", True) or "").split() > + if len(dsc_uri) == 0: > + return > + > + try: > + fetcher = bb.fetch2.Fetch(dsc_uri, d) > + fetcher.download() > + except bb.fetch2.BBFetchException as e: > + raise bb.build.FuncFailed(e) > + > + # Open .dsc file from downloads > + dl_dir = d.getVar("DL_DIR", True) > + dsc_file = (dsc_uri[0].split(";")[0]).split("/")[-1] > + filepath = dl_dir + "/" + dsc_file > + > + pv = "" > + src_uri = "" > + > + # Parse .dsc file to get package details > + with open(filepath, "r") as file: > + line = file.readline() > + > + while line: > + # Get package version and export PV > + if line.startswith("Version:") and not pv: > + pv = line.split(": ")[-1].rstrip() > + d.setVar("PV", pv) > + > + # Get package and Debian patch arcives names > + if line.startswith("Files:") and not src_uri: > + line = file.readline() > + src = line.split(" ")[-1].rstrip() > + src_uri = (dsc_uri[0].rsplit("/", 1))[0] + "/" + src > + src_uri = src_uri + ";md5sum=" + line.split(" > ")[1].rstrip() > + d.setVar("SRC_URI", src_uri) > + > + line = file.readline() > + debian = line.split(" ")[-1].rstrip() > + debian_uri = (dsc_uri[0].rsplit("/", 1))[0] + "/" + > debian > + debian_uri = debian_uri + ";md5sum=" + line.split(" > ")[1].rstrip() > + d.setVar("DEBIAN_URI", debian_uri) > + > + line = file.readline() > + > + file.close() > + > + # Set correct path to unpacked sources > + pv_orig = (src.split("_")[-1]).split(".orig")[0] > + pn = d.getVar("PN", True) > + d.setVar("S", pn + "-" + pv_orig) > +} > + > +python do_fetch_append() { > + debian_uri = (d.getVar("DEBIAN_URI", True) or "").split() > + if len(debian_uri) == 0: > + return > + > + try: > + fetcher = bb.fetch2.Fetch(debian_uri, d) > + fetcher.download() > + except bb.fetch2.BBFetchException as e: > + raise bb.build.FuncFailed(e) > +} > + > +python do_unpack_append() { > + import subprocess > + > + s = d.getVar("S", True) > + workdir = d.getVar("WORKDIR", True) > + debian_uri = (d.getVar("DEBIAN_URI", True) or "").split() > + > + try: > + fetcher = bb.fetch2.Fetch(debian_uri, d) > + fetcher.unpack(workdir + "/" + s) > + except bb.fetch2.BBFetchException as e: > + raise bb.build.FuncFailed(e) > +} > + > +# NOTE: this is workaround to serve quilt-3.0 package format support. > +# To build such package, the original tarball should be placed > +# in "../" folder. In general, this should be handled by Isar > +# core build classes, but for now this class in the only one > user +# for quilt-3.0, so for the first implementation let"s > keep it here. +# Open issues: > +# - How to identify if package has quilt-3.0 source format? Had the same issue... The format is in the .dsc. We should check which other formats change what we need to build. > +# - How to avoid copying of tarballs from downloads to working dir? i fetched twice, once with unpack=false Henning > +do_build_prepend() { > + dl_dir="${@ d.getVar('DL_DIR', True)}" > + workdir="${@ d.getVar('WORKDIR', True)}" > + file="${@ ((d.getVar('SRC_URI', > True)).split(";")[0]).split("/")[-1]}" + > + install -m 644 $dl_dir/$file $workdir > +} > + > +inherit dpkg