* [Buildroot] [PATCH] package/pkg-utils.mk: add dl_dir to show-info output
@ 2019-06-19 20:17 Arnout Vandecappelle
2019-06-19 20:28 ` Yann E. MORIN
0 siblings, 1 reply; 6+ messages in thread
From: Arnout Vandecappelle @ 2019-06-19 20:17 UTC (permalink / raw)
To: buildroot
It can be useful for scripts to be able to access a package's source
file after download. That used to be easy, just DL_DIR/PKG_SOURCE.
However, with the subdirectories in DL_DIR which can be overridden with
PKG_DL_SUBDIR, that is no longer easy.
Therefore, this patch adds dl_dir to the downloads list of a package. It
can be used with the following jq script to get a newline-separated list
of all downloaded files:
make show-info | jq -r '.[].downloads[]? | (.dl_dir + "/" + .source)'
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
---
package/pkg-utils.mk | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index b7280e930f..4de0bc042c 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -104,7 +104,8 @@ define _json-info-pkg-details
$(call DOWNLOAD_URIS,$(dl),$(1))
)
)
- ]
+ ],
+ "dl_dir": "$($(1)_DL_DIR)"
},
)
],
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] package/pkg-utils.mk: add dl_dir to show-info output
2019-06-19 20:17 [Buildroot] [PATCH] package/pkg-utils.mk: add dl_dir to show-info output Arnout Vandecappelle
@ 2019-06-19 20:28 ` Yann E. MORIN
2019-06-22 8:05 ` Yann E. MORIN
0 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2019-06-19 20:28 UTC (permalink / raw)
To: buildroot
Arnout, All,
On 2019-06-19 22:17 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
> It can be useful for scripts to be able to access a package's source
> file after download. That used to be easy, just DL_DIR/PKG_SOURCE.
> However, with the subdirectories in DL_DIR which can be overridden with
> PKG_DL_SUBDIR, that is no longer easy.
>
> Therefore, this patch adds dl_dir to the downloads list of a package. It
> can be used with the following jq script to get a newline-separated list
> of all downloaded files:
Aha! The first extension to show-info! :-)
> make show-info | jq -r '.[].downloads[]? | (.dl_dir + "/" + .source)'
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> ---
> package/pkg-utils.mk | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
> index b7280e930f..4de0bc042c 100644
> --- a/package/pkg-utils.mk
> +++ b/package/pkg-utils.mk
> @@ -104,7 +104,8 @@ define _json-info-pkg-details
> $(call DOWNLOAD_URIS,$(dl),$(1))
> )
> )
> - ]
> + ],
> + "dl_dir": "$($(1)_DL_DIR)"
This means that the dl_dir key is repeated as-is for all the blobs
download by a package.
Instead, what about emitting the full path to said blob:
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index b7280e930f..80ad349dac 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -104,7 +104,8 @@ define _json-info-pkg-details
$(call DOWNLOAD_URIS,$(dl),$(1))
)
)
- ]
+ ],
+ "path": "$($(1)_DL_DIR)/$(notdir $(dl))"
},
)
],
Or just dump the dl_dir only once:
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index b7280e930f..bd918e5faa 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -94,6 +94,7 @@ endef
define _json-info-pkg-details
"version": "$($(1)_DL_VERSION)",
"licenses": "$($(1)_LICENSE)",
+ "dl_dir": "$($(1)_DL_DIR)",
"downloads": [
$(foreach dl,$(sort $($ (1)_ALL_DOWNLOADS)),
{
Regards,
Yann E. MORIN.
> },
> )
> ],
> --
> 2.21.0
>
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 6+ messages in thread* [Buildroot] [PATCH] package/pkg-utils.mk: add dl_dir to show-info output
2019-06-19 20:28 ` Yann E. MORIN
@ 2019-06-22 8:05 ` Yann E. MORIN
0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2019-06-22 8:05 UTC (permalink / raw)
To: buildroot
Arnout, All,
On 2019-06-19 22:28 +0200, Yann E. MORIN spake thusly:
> On 2019-06-19 22:17 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
> > Therefore, this patch adds dl_dir to the downloads list of a package. It
> > can be used with the following jq script to get a newline-separated list
> > of all downloaded files:
[--SNIP--]
> Instead, what about emitting the full path to said blob:
>
> diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
> index b7280e930f..80ad349dac 100644
> --- a/package/pkg-utils.mk
> +++ b/package/pkg-utils.mk
> @@ -104,7 +104,8 @@ define _json-info-pkg-details
> $(call DOWNLOAD_URIS,$(dl),$(1))
> )
> )
> - ]
> + ],
> + "path": "$($(1)_DL_DIR)/$(notdir $(dl))"
> },
> )
> ],
>
> Or just dump the dl_dir only once:
>
> diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
> index b7280e930f..bd918e5faa 100644
> --- a/package/pkg-utils.mk
> +++ b/package/pkg-utils.mk
> @@ -94,6 +94,7 @@ endef
> define _json-info-pkg-details
> "version": "$($(1)_DL_VERSION)",
> "licenses": "$($(1)_LICENSE)",
> + "dl_dir": "$($(1)_DL_DIR)",
> "downloads": [
> $(foreach dl,$(sort $($ (1)_ALL_DOWNLOADS)),
> {
Actually, there is just one thing I don't like about $($(1)_DL_DIR), is
that it contains a local information: it starts with BR2_DL_DIR, which
is user- and site-specific.
Instead, I'd argue we should just print $($(1)_DL_SUBDIR).
That way, the generated json blurb can even be distributed, and there is
no local information that leaks. Note: even the user name (as present in
$(BR2_DL_DIR)) can be a liability in some cases (true story).
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Buildroot] [PATCH] package/pkg-utils.mk: add dl_dir to show-info output
@ 2019-08-03 13:49 Arnout Vandecappelle
2019-09-22 11:54 ` Yann E. MORIN
0 siblings, 1 reply; 6+ messages in thread
From: Arnout Vandecappelle @ 2019-08-03 13:49 UTC (permalink / raw)
To: buildroot
It can be useful for scripts to be able to access a package's source
file after download. That used to be easy, just DL_DIR/PKG_SOURCE.
However, with the subdirectories in DL_DIR which can be overridden with
PKG_DL_SUBDIR, that is no longer easy.
Therefore, this patch adds dl_dir to the package information. It prints
just PKG_DL_SUBDIR, to avoid dumping absolute paths to the buildroot
directory in the show-info output.
It can be used with the following jq script to get a newline-separated
list of all downloaded files:
make show-info | jq -r '.[] | ("dl/" + .dl_dir + "/" + .downloads[]?.source)'
Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
Cc: Yann E. MORIN <yann.morin.1998@free.fr>
---
v1 -> v2:
- Use DL_SUBDIR (i.e. relative path) instead of DL_DIR (i.e. absolute
path). (Yann)
- Move the definition one level higher, because it is anyway the same
for all sources. (Yann)
- Update jq script in commit message to handle the above.
---
package/pkg-utils.mk | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
index b7280e930f..d3345f7c91 100644
--- a/package/pkg-utils.mk
+++ b/package/pkg-utils.mk
@@ -94,6 +94,7 @@ endef
define _json-info-pkg-details
"version": "$($(1)_DL_VERSION)",
"licenses": "$($(1)_LICENSE)",
+ "dl_dir": "$($(1)_DL_SUBDIR)",
"downloads": [
$(foreach dl,$(sort $($(1)_ALL_DOWNLOADS)),
{
@@ -104,8 +105,7 @@ define _json-info-pkg-details
$(call DOWNLOAD_URIS,$(dl),$(1))
)
)
- ]
- },
+ ] },
)
],
endef
--
2.21.0
^ permalink raw reply related [flat|nested] 6+ messages in thread* [Buildroot] [PATCH] package/pkg-utils.mk: add dl_dir to show-info output
2019-08-03 13:49 Arnout Vandecappelle
@ 2019-09-22 11:54 ` Yann E. MORIN
2019-09-22 11:55 ` Yann E. MORIN
0 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2019-09-22 11:54 UTC (permalink / raw)
To: buildroot
Arnout, All,
Sorry for the long delay in reviewing this. One minor comment below...
On 2019-08-03 15:49 +0200, Arnout Vandecappelle (Essensium/Mind) spake thusly:
> It can be useful for scripts to be able to access a package's source
> file after download. That used to be easy, just DL_DIR/PKG_SOURCE.
> However, with the subdirectories in DL_DIR which can be overridden with
> PKG_DL_SUBDIR, that is no longer easy.
>
> Therefore, this patch adds dl_dir to the package information. It prints
> just PKG_DL_SUBDIR, to avoid dumping absolute paths to the buildroot
> directory in the show-info output.
>
> It can be used with the following jq script to get a newline-separated
> list of all downloaded files:
>
> make show-info | jq -r '.[] | ("dl/" + .dl_dir + "/" + .downloads[]?.source)'
>
> Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
> Cc: Yann E. MORIN <yann.morin.1998@free.fr>
> ---
> v1 -> v2:
> - Use DL_SUBDIR (i.e. relative path) instead of DL_DIR (i.e. absolute
> path). (Yann)
> - Move the definition one level higher, because it is anyway the same
> for all sources. (Yann)
> - Update jq script in commit message to handle the above.
> ---
> package/pkg-utils.mk | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/package/pkg-utils.mk b/package/pkg-utils.mk
> index b7280e930f..d3345f7c91 100644
> --- a/package/pkg-utils.mk
> +++ b/package/pkg-utils.mk
> @@ -94,6 +94,7 @@ endef
> define _json-info-pkg-details
> "version": "$($(1)_DL_VERSION)",
> "licenses": "$($(1)_LICENSE)",
> + "dl_dir": "$($(1)_DL_SUBDIR)",
> "downloads": [
> $(foreach dl,$(sort $($(1)_ALL_DOWNLOADS)),
> {
> @@ -104,8 +105,7 @@ define _json-info-pkg-details
> $(call DOWNLOAD_URIS,$(dl),$(1))
> )
> )
> - ]
> - },
> + ] },
Spurious unrelated change, I'm afraid... Otherwise:
Acked-by: Yann E. MORIN <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> )
> ],
> endef
> --
> 2.21.0
>
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 6+ messages in thread* [Buildroot] [PATCH] package/pkg-utils.mk: add dl_dir to show-info output
2019-09-22 11:54 ` Yann E. MORIN
@ 2019-09-22 11:55 ` Yann E. MORIN
0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2019-09-22 11:55 UTC (permalink / raw)
To: buildroot
Arnout, All,
On 2019-09-22 13:54 +0200, Yann E. MORIN spake thusly:
> Sorry for the long delay in reviewing this. One minor comment below...
In fact, this is v2 of the patch. I already acked v3, so it was no
really a logn delay! ;-)
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-09-22 11:55 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-19 20:17 [Buildroot] [PATCH] package/pkg-utils.mk: add dl_dir to show-info output Arnout Vandecappelle
2019-06-19 20:28 ` Yann E. MORIN
2019-06-22 8:05 ` Yann E. MORIN
-- strict thread matches above, loose matches on Subject: below --
2019-08-03 13:49 Arnout Vandecappelle
2019-09-22 11:54 ` Yann E. MORIN
2019-09-22 11:55 ` Yann E. MORIN
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox