From: Jan Kiszka <jan.kiszka@siemens.com>
To: "[ext] Henning Schild" <henning.schild@siemens.com>,
Alexander Smirnov <asmirnov@ilbers.de>
Cc: isar-users@googlegroups.com
Subject: Re: [RFC][PATCH 2/3] classes/dsc: Basic Debian .dsc backend implementation
Date: Wed, 25 Apr 2018 12:11:01 +0200 [thread overview]
Message-ID: <b6c33c86-6481-f64b-0035-6ee19578c86c@siemens.com> (raw)
In-Reply-To: <20180423192731.3af2fa32@mmd1pvb1c.ad001.siemens.net>
On 2018-04-23 19:27, [ext] Henning Schild wrote:
> Am Mon, 23 Apr 2018 19:11:12 +0300
> schrieb Alexander Smirnov <asmirnov@ilbers.de>:
>
>> On 04/23/2018 06:04 PM, Henning Schild wrote:
>>> Am Mon, 23 Apr 2018 16:21:45 +0300
>>> schrieb Alexander Smirnov <asmirnov@ilbers.de>:
>>>
>>>> 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 <asmirnov@ilbers.de>
>>>> ---
>>>> 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
>>>
>>> Can we not use SRC_URI and append more sources as we read .dscs? A
>>> copy of the fetching code just reminds me of the broken
>>> fetch/unpack in the early Isar days.
>>> Because i have got my dscs in tarballs and in git ... and i am
>>> behind a proxy.
>>
>> Here I consider only traditional Debian way, when.dsc file is stored
>> directly in apt with .orig tarball and .debian patch:
>>
>> http://ftp.de.debian.org/debian/pool/main/h/hello/
>>
>> So this class intended to work with Debian apts.
>>
>>>
>>>> + 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)
>>>> +}
>>>
>>> Wow another fetcher ... same question as above.
>>
>> Upstream Debian source package contains 3 parts:
>> - .dsc
>> - .orig.tar.xz
>> - .debian.tar.xz
>>
>> So:
>> - First you need to fetch .dsc to get information about remaining 2
>> artifacts.
>> - .orig.tar.xz is fetched by standard fetcher.
>> - .debian.tar.xz is fetched here.
>>
>>>
>>>> +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)
>>>
>>> fetch^3 this time with unpack
>>
>> Again:
>> - .orig.tar.xz is unpacked by standard fetcher
>> - the content of .debian.tar.xz should be unpacked into the folder
>> from the .orig.tar.xz archive
>>
>> So in general, this is an attempt to collect and prepare all the
>> artifacts to make it usable with dpkg Isar class.
>
> Sure, fully understood the moment you mentioned dsc. All i wanted to
> find out whether we can use SRC_URI and the one fetcher/unapcker we
> have already. Why should it be called DSC_URI only because you download
> a .dsc?
> The magic that an "unpack" of a .dsc involves downloading even more and
> maybe unpacking that ... should go into a central place (do_unpack?) and
> SRC_URI should stay SRC_URI.
>
> i.e.: do_fetch/unpack in base.bbclass get
> ...
> for uri in src_uri:
> if uri ends with .dsc and unpack==true:
> add new uris to final_src_uri
> else:
> add uri to final_src_uri
> src_uri = final_src_uri
> ...
>
Ack, we should always try to design from the perspective of our users,
and there no reason for them to have separate URI lists.
Jan
--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
next prev parent reply other threads:[~2018-04-25 10:11 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-23 13:21 [RFC][PATCH 0/3] Experiments with .dsc backend Alexander Smirnov
2018-04-23 13:21 ` [RFC][PATCH 1/3] buildchroot: Include texinfo to base system Alexander Smirnov
2018-04-23 13:21 ` [RFC][PATCH 2/3] classes/dsc: Basic Debian .dsc backend implementation Alexander Smirnov
2018-04-23 15:04 ` Henning Schild
2018-04-23 16:11 ` Alexander Smirnov
2018-04-23 17:27 ` Henning Schild
2018-04-25 10:11 ` Jan Kiszka [this message]
2018-05-08 17:40 ` Henning Schild
2018-04-23 13:21 ` [RFC][PATCH 3/3] recipes-debian: Add example recipe to test Debian .dsc support Alexander Smirnov
2018-04-23 14:36 ` [RFC][PATCH 0/3] Experiments with .dsc backend Henning Schild
2018-04-23 15:26 ` Alexander Smirnov
2018-04-23 16:03 ` Henning Schild
2018-04-27 15:46 ` Alexander Smirnov
2018-05-02 8:19 ` Henning Schild
2018-05-08 17:37 ` Henning Schild
2018-05-08 18:31 ` Alexander Smirnov
2018-05-09 7:37 ` Henning Schild
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=b6c33c86-6481-f64b-0035-6ee19578c86c@siemens.com \
--to=jan.kiszka@siemens.com \
--cc=asmirnov@ilbers.de \
--cc=henning.schild@siemens.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox