public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] meta: change apt source fetcher to hook into SRC_URI
@ 2019-01-30 15:23 Henning Schild
  2019-01-30 15:25 ` Henning Schild
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Henning Schild @ 2019-01-30 15:23 UTC (permalink / raw)
  To: isar-users; +Cc: Jan Kiszka, Claudius Heine, Henning Schild

From: Henning Schild <henning.schild@siemens.com>

This patch allows users to use "debian://" URIs in SRC_URI and cleans up
the interface for recipes.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta-isar/recipes-app/hello/hello.inc |  2 +-
 meta/classes/base.bbclass             | 20 ++++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/meta-isar/recipes-app/hello/hello.inc b/meta-isar/recipes-app/hello/hello.inc
index 3976b15..ceab7a2 100644
--- a/meta-isar/recipes-app/hello/hello.inc
+++ b/meta-isar/recipes-app/hello/hello.inc
@@ -3,7 +3,7 @@
 inherit dpkg
 
 # this will fetch and unpack the sources from upstream debian
-SRC_APT = "${PN}"
+SRC_URI = "debian://${PN}=${PV}"
 
 MAINTAINER = "Your name here <you@domain.com>"
 CHANGELOG_V = "${PV}-99+isar"
diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
index d4082de..9885fdc 100644
--- a/meta/classes/base.bbclass
+++ b/meta/classes/base.bbclass
@@ -96,6 +96,26 @@ python() {
                                   + ws + "root_cleandirs\n")
 }
 
+# filter out all "debian://" URIs out of SRC_URI and stick them into SRC_APT
+# this makes for a nicer user interface
+python() {
+    src_uri = (d.getVar('SRC_URI', True) or "").split()
+    if len(src_uri) == 0:
+        return
+
+    prefix = "debian://"
+    new_src_uri = []
+    deb_src_uri = []
+    for u in src_uri:
+        if u.startswith(prefix):
+            deb_src_uri.append(u[len(prefix):])
+        else:
+            new_src_uri.append(u)
+
+    d.setVar('SRC_URI', ' '.join(new_src_uri))
+    d.prependVar('SRC_APT', ' '.join(deb_src_uri))
+}
+
 do_fetch[dirs] = "${DL_DIR}"
 do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
 do_fetch[vardeps] += "SRCREV"
-- 
2.19.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] meta: change apt source fetcher to hook into SRC_URI
  2019-01-30 15:23 [PATCH] meta: change apt source fetcher to hook into SRC_URI Henning Schild
@ 2019-01-30 15:25 ` Henning Schild
  2019-01-30 15:26 ` Jan Kiszka
  2019-01-31 14:19 ` Henning Schild
  2 siblings, 0 replies; 4+ messages in thread
From: Henning Schild @ 2019-01-30 15:25 UTC (permalink / raw)
  To: isar-users; +Cc: Jan Kiszka, Claudius Heine

This applies on top of the apt-get source series and gets the interface
"right". I can later fold it in or we keep the order, please let me
know what you think.

Maybe it should be "apt://" ... i actually guess so.

Henning

On Wed, 30 Jan 2019 16:23:21 +0100
Henning Schild <henning.schild@siemens.com> wrote:

> From: Henning Schild <henning.schild@siemens.com>
> 
> This patch allows users to use "debian://" URIs in SRC_URI and cleans
> up the interface for recipes.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  meta-isar/recipes-app/hello/hello.inc |  2 +-
>  meta/classes/base.bbclass             | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/meta-isar/recipes-app/hello/hello.inc
> b/meta-isar/recipes-app/hello/hello.inc index 3976b15..ceab7a2 100644
> --- a/meta-isar/recipes-app/hello/hello.inc
> +++ b/meta-isar/recipes-app/hello/hello.inc
> @@ -3,7 +3,7 @@
>  inherit dpkg
>  
>  # this will fetch and unpack the sources from upstream debian
> -SRC_APT = "${PN}"
> +SRC_URI = "debian://${PN}=${PV}"
>  
>  MAINTAINER = "Your name here <you@domain.com>"
>  CHANGELOG_V = "${PV}-99+isar"
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index d4082de..9885fdc 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -96,6 +96,26 @@ python() {
>                                    + ws + "root_cleandirs\n")
>  }
>  
> +# filter out all "debian://" URIs out of SRC_URI and stick them into
> SRC_APT +# this makes for a nicer user interface
> +python() {
> +    src_uri = (d.getVar('SRC_URI', True) or "").split()
> +    if len(src_uri) == 0:
> +        return
> +
> +    prefix = "debian://"
> +    new_src_uri = []
> +    deb_src_uri = []
> +    for u in src_uri:
> +        if u.startswith(prefix):
> +            deb_src_uri.append(u[len(prefix):])
> +        else:
> +            new_src_uri.append(u)
> +
> +    d.setVar('SRC_URI', ' '.join(new_src_uri))
> +    d.prependVar('SRC_APT', ' '.join(deb_src_uri))
> +}
> +
>  do_fetch[dirs] = "${DL_DIR}"
>  do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
>  do_fetch[vardeps] += "SRCREV"


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] meta: change apt source fetcher to hook into SRC_URI
  2019-01-30 15:23 [PATCH] meta: change apt source fetcher to hook into SRC_URI Henning Schild
  2019-01-30 15:25 ` Henning Schild
@ 2019-01-30 15:26 ` Jan Kiszka
  2019-01-31 14:19 ` Henning Schild
  2 siblings, 0 replies; 4+ messages in thread
From: Jan Kiszka @ 2019-01-30 15:26 UTC (permalink / raw)
  To: Henning Schild, isar-users; +Cc: Claudius Heine

On 30.01.19 16:23, Henning Schild wrote:
> From: Henning Schild <henning.schild@siemens.com>
> 
> This patch allows users to use "debian://" URIs in SRC_URI and cleans up
> the interface for recipes.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>   meta-isar/recipes-app/hello/hello.inc |  2 +-
>   meta/classes/base.bbclass             | 20 ++++++++++++++++++++
>   2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/meta-isar/recipes-app/hello/hello.inc b/meta-isar/recipes-app/hello/hello.inc
> index 3976b15..ceab7a2 100644
> --- a/meta-isar/recipes-app/hello/hello.inc
> +++ b/meta-isar/recipes-app/hello/hello.inc
> @@ -3,7 +3,7 @@
>   inherit dpkg
>   
>   # this will fetch and unpack the sources from upstream debian
> -SRC_APT = "${PN}"
> +SRC_URI = "debian://${PN}=${PV}"
>   
>   MAINTAINER = "Your name here <you@domain.com>"
>   CHANGELOG_V = "${PV}-99+isar"
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index d4082de..9885fdc 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -96,6 +96,26 @@ python() {
>                                     + ws + "root_cleandirs\n")
>   }
>   
> +# filter out all "debian://" URIs out of SRC_URI and stick them into SRC_APT
> +# this makes for a nicer user interface
> +python() {
> +    src_uri = (d.getVar('SRC_URI', True) or "").split()
> +    if len(src_uri) == 0:
> +        return
> +
> +    prefix = "debian://"
> +    new_src_uri = []
> +    deb_src_uri = []
> +    for u in src_uri:
> +        if u.startswith(prefix):
> +            deb_src_uri.append(u[len(prefix):])
> +        else:
> +            new_src_uri.append(u)
> +
> +    d.setVar('SRC_URI', ' '.join(new_src_uri))
> +    d.prependVar('SRC_APT', ' '.join(deb_src_uri))
> +}
> +
>   do_fetch[dirs] = "${DL_DIR}"
>   do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
>   do_fetch[vardeps] += "SRCREV"
> 

Interesting approach...

However, shouldn't we call it "apt://" to address also Debian-derived distros?

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] meta: change apt source fetcher to hook into SRC_URI
  2019-01-30 15:23 [PATCH] meta: change apt source fetcher to hook into SRC_URI Henning Schild
  2019-01-30 15:25 ` Henning Schild
  2019-01-30 15:26 ` Jan Kiszka
@ 2019-01-31 14:19 ` Henning Schild
  2 siblings, 0 replies; 4+ messages in thread
From: Henning Schild @ 2019-01-31 14:19 UTC (permalink / raw)
  To: isar-users; +Cc: Jan Kiszka, Claudius Heine

This is now in v3 of the apt-get source series.

Henning

On Wed, 30 Jan 2019 16:23:21 +0100
Henning Schild <henning.schild@siemens.com> wrote:

> From: Henning Schild <henning.schild@siemens.com>
> 
> This patch allows users to use "debian://" URIs in SRC_URI and cleans
> up the interface for recipes.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  meta-isar/recipes-app/hello/hello.inc |  2 +-
>  meta/classes/base.bbclass             | 20 ++++++++++++++++++++
>  2 files changed, 21 insertions(+), 1 deletion(-)
> 
> diff --git a/meta-isar/recipes-app/hello/hello.inc
> b/meta-isar/recipes-app/hello/hello.inc index 3976b15..ceab7a2 100644
> --- a/meta-isar/recipes-app/hello/hello.inc
> +++ b/meta-isar/recipes-app/hello/hello.inc
> @@ -3,7 +3,7 @@
>  inherit dpkg
>  
>  # this will fetch and unpack the sources from upstream debian
> -SRC_APT = "${PN}"
> +SRC_URI = "debian://${PN}=${PV}"
>  
>  MAINTAINER = "Your name here <you@domain.com>"
>  CHANGELOG_V = "${PV}-99+isar"
> diff --git a/meta/classes/base.bbclass b/meta/classes/base.bbclass
> index d4082de..9885fdc 100644
> --- a/meta/classes/base.bbclass
> +++ b/meta/classes/base.bbclass
> @@ -96,6 +96,26 @@ python() {
>                                    + ws + "root_cleandirs\n")
>  }
>  
> +# filter out all "debian://" URIs out of SRC_URI and stick them into
> SRC_APT +# this makes for a nicer user interface
> +python() {
> +    src_uri = (d.getVar('SRC_URI', True) or "").split()
> +    if len(src_uri) == 0:
> +        return
> +
> +    prefix = "debian://"
> +    new_src_uri = []
> +    deb_src_uri = []
> +    for u in src_uri:
> +        if u.startswith(prefix):
> +            deb_src_uri.append(u[len(prefix):])
> +        else:
> +            new_src_uri.append(u)
> +
> +    d.setVar('SRC_URI', ' '.join(new_src_uri))
> +    d.prependVar('SRC_APT', ' '.join(deb_src_uri))
> +}
> +
>  do_fetch[dirs] = "${DL_DIR}"
>  do_fetch[file-checksums] = "${@bb.fetch.get_checksum_file_list(d)}"
>  do_fetch[vardeps] += "SRCREV"


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-01-31 14:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-30 15:23 [PATCH] meta: change apt source fetcher to hook into SRC_URI Henning Schild
2019-01-30 15:25 ` Henning Schild
2019-01-30 15:26 ` Jan Kiszka
2019-01-31 14:19 ` Henning Schild

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox