Skip to contentSkip to conversation

package/pkg-utils.mk: add dl_dir to show-info output

PATCH Superseded Arnout Vandecappelle (Essensium/Mind) 2 participants 3 messages Aug 3, 2019 – Sep 22, 2019

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 package/pkg-utils.mk: add dl_dir to show-info output

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)'

---
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(-)
package/pkg-utils.mk +2 -2
index b7280e930f..d3345f7c91 100644
@@ -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
Signature · 1 line
2.21.0
#1 lore raw

PATCH 1/1 package/pkg-utils.mk: add dl_dir to show-info output

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:

Quoted 40 lines

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)'

---
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(-)
package/pkg-utils.mk +1 -0
index b7280e930f..d3345f7c91 100644
@@ -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)),
 		{

package/pkg-utils.mk define _json-info-pkg-details · line 108

Quoted 6 lines
package/pkg-utils.mk +1 -2
@@ -104,8 +105,7 @@ define _json-info-pkg-details
 						$(call DOWNLOAD_URIS,$(dl),$(1))
 					)
 				)
-			]
-		},
+			]		},

Spurious unrelated change, I'm afraid... Otherwise:

Regards,
Yann E. MORIN.

Quoted 6 lines
package/pkg-utils.mk +0 -0
 	)
 	],
 endef
Signature · 1 line
2.21.0
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'
#2 lore raw

PATCH 1/1 package/pkg-utils.mk: add dl_dir to show-info output

Arnout, All,

On 2019-09-22 13:54 +0200, Yann E. MORIN spake thusly:

Quoted 1 line

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.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'