Message ID | 9c560fb0f335f99d5350617f0368ae591e46e837.1416068005.git.yann.morin.1998@free.fr |
---|---|
State | Changes Requested |
Headers | show |
On 15/11/14 17:19, Yann E. MORIN wrote: > Some upstreams may use a naming scheme that does not fit well in how > Buildroot wants to handle filenames. > > For example, GitHub used to have a scheme like: > https://github.com/USER/REPO/archive/VERSION.tar.gz > > which means we would have a local file named VERSION.tar.gz, when we > want to have PKG-VERSION.tar.gz > > Other forges are also known to have similar schemes. Google Code, for > example, may also use similarly named files. > > Introduce a new variable, FOO_UPSTREAM_SOURCE, which the package may set > in that case. If not set, it defaults to FOO_SOURCE. Instead of this, I was thinking of the reverse approach: define FOO_LOCAL_SOURCE. It could possibly even be calculated automatically in pkg-generic.mk. E.g. $(2)_LOCAL_SOURCE = \ $$(if $$(findstring $(3),$$($(2)_SOURCE)), $$($(2)_SOURCE), $(3)-$$($(2)_SOURCE)) (and something similar for adding the version, so it should probably be factored into a function). Regards, Arnout > > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> > Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> > Cc: Samuel Martin <s.martin49@gmail.com> > Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> > Cc: Peter Korsgaard <jacmet@uclibc.org> > Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com> > Cc: Arnout Vandecappelle <arnout@mind.be> > --- > package/pkg-generic.mk | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk > index 543cb60..30bce59 100644 > --- a/package/pkg-generic.mk > +++ b/package/pkg-generic.mk > @@ -84,7 +84,7 @@ ifeq ($(DL_MODE),DOWNLOAD) > done ; \ > fi > endif > - $(if $($(PKG)_SOURCE),$(call > DOWNLOAD,$($(PKG)_SITE:/=)/$($(PKG)_SOURCE),$($(PKG)_SOURCE))) > + $(if $($(PKG)_SOURCE),$(call > DOWNLOAD,$($(PKG)_SITE:/=)/$($(PKG)_UPSTREAM_SOURCE),$($(PKG)_SOURCE))) > $(foreach p,$($(PKG)_EXTRA_DOWNLOADS),$(call > DOWNLOAD,$($(PKG)_SITE:/=)/$(p))$(sep)) > $(foreach p,$($(PKG)_PATCH),\ > $(if $(findstring ://,$(p)),\ > @@ -361,6 +361,10 @@ ifndef $(2)_SOURCE > endif > endif > > +ifndef $(2)_UPSTREAM_SOURCE > + $(2)_UPSTREAM_SOURCE = $$($(2)_SOURCE) > +endif > + > ifndef $(2)_PATCH > ifdef $(3)_PATCH > $(2)_PATCH = $$($(3)_PATCH)
Arnout, All, On 2014-11-18 21:54 +0100, Arnout Vandecappelle spake thusly: > On 15/11/14 17:19, Yann E. MORIN wrote: > > Some upstreams may use a naming scheme that does not fit well in how > > Buildroot wants to handle filenames. > > > > For example, GitHub used to have a scheme like: > > https://github.com/USER/REPO/archive/VERSION.tar.gz > > > > which means we would have a local file named VERSION.tar.gz, when we > > want to have PKG-VERSION.tar.gz > > > > Other forges are also known to have similar schemes. Google Code, for > > example, may also use similarly named files. > > > > Introduce a new variable, FOO_UPSTREAM_SOURCE, which the package may set > > in that case. If not set, it defaults to FOO_SOURCE. > > Instead of this, I was thinking of the reverse approach: define FOO_LOCAL_SOURCE. OK, will change. > It could possibly even be calculated automatically in pkg-generic.mk. E.g. > > $(2)_LOCAL_SOURCE = \ > $$(if $$(findstring $(3),$$($(2)_SOURCE)), > $$($(2)_SOURCE), > $(3)-$$($(2)_SOURCE)) > > (and something similar for adding the version, so it should probably be factored > into a function). Well, why not just simply revert what I did with _UPSTREAM_SOURCE: ifndef $(2)_LOCAL_SOURCE $(2)_LOCAL_SOURCE = $$($(2)_SOURCE) endif That's much more readable and simple than the above, given that $(2)_SOURCE is already auto-computed by tje pkg-generic infra. Regards, Yann E. MORIN.
Arnout, All, On 2014-11-23 18:06 +0100, Yann E. MORIN spake thusly: > On 2014-11-18 21:54 +0100, Arnout Vandecappelle spake thusly: > > On 15/11/14 17:19, Yann E. MORIN wrote: > > > Some upstreams may use a naming scheme that does not fit well in how > > > Buildroot wants to handle filenames. > > > > > > For example, GitHub used to have a scheme like: > > > https://github.com/USER/REPO/archive/VERSION.tar.gz > > > > > > which means we would have a local file named VERSION.tar.gz, when we > > > want to have PKG-VERSION.tar.gz > > > > > > Other forges are also known to have similar schemes. Google Code, for > > > example, may also use similarly named files. > > > > > > Introduce a new variable, FOO_UPSTREAM_SOURCE, which the package may set > > > in that case. If not set, it defaults to FOO_SOURCE. > > > > Instead of this, I was thinking of the reverse approach: define FOO_LOCAL_SOURCE. > > OK, will change. Well, actually, I'm not convinced. What I've done is add FOO_LOCAL_SOURCE, which defaults to FOO_SOURCE if not defined: ifndef $(2)_LOCAL_SOURCE $(2)_LOCAL_SOURCE = $$($(2)_SOURCE) endif But then, here's what I thought about: - if both upstream and local are the same, we just have to define FOO_SOURCE and be done with it; - furthermore, if the value of FOO_SOURCE is the default PKG-VERSION.tar.gz, we need not specify it at all; - if upstream and local differ, then we must specify both, even though FOO_LOCAL_SOURCE is in the format we default to. So, I prefer we keep FOO_UPSTREAM_SOURCE, to really emp[hasise that it is upstream that is doing weird things, not us. I'm still open for discussion on this, though. Regards, Yann E. MORIN.
diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 543cb60..30bce59 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -84,7 +84,7 @@ ifeq ($(DL_MODE),DOWNLOAD) done ; \ fi endif - $(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE:/=)/$($(PKG)_SOURCE),$($(PKG)_SOURCE))) + $(if $($(PKG)_SOURCE),$(call DOWNLOAD,$($(PKG)_SITE:/=)/$($(PKG)_UPSTREAM_SOURCE),$($(PKG)_SOURCE))) $(foreach p,$($(PKG)_EXTRA_DOWNLOADS),$(call DOWNLOAD,$($(PKG)_SITE:/=)/$(p))$(sep)) $(foreach p,$($(PKG)_PATCH),\ $(if $(findstring ://,$(p)),\ @@ -361,6 +361,10 @@ ifndef $(2)_SOURCE endif endif +ifndef $(2)_UPSTREAM_SOURCE + $(2)_UPSTREAM_SOURCE = $$($(2)_SOURCE) +endif + ifndef $(2)_PATCH ifdef $(3)_PATCH $(2)_PATCH = $$($(3)_PATCH)
Some upstreams may use a naming scheme that does not fit well in how Buildroot wants to handle filenames. For example, GitHub used to have a scheme like: https://github.com/USER/REPO/archive/VERSION.tar.gz which means we would have a local file named VERSION.tar.gz, when we want to have PKG-VERSION.tar.gz Other forges are also known to have similar schemes. Google Code, for example, may also use similarly named files. Introduce a new variable, FOO_UPSTREAM_SOURCE, which the package may set in that case. If not set, it defaults to FOO_SOURCE. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Maxime Hadjinlian <maxime.hadjinlian@gmail.com> Cc: Samuel Martin <s.martin49@gmail.com> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Cc: Peter Korsgaard <jacmet@uclibc.org> Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com> Cc: Arnout Vandecappelle <arnout@mind.be> --- package/pkg-generic.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)