diff mbox series

[09/15,v4] fs: introduce per-rootfs TARGET_DIR variable

Message ID 98f2dfa3b5a89f108b51cc567c41665628a01bc3.1522487149.git.yann.morin.1998@free.fr
State Accepted
Commit c6e425729e5db04676df4e81cf4d48bafefb0942
Headers show
Series [01/15,v4] fs: run filesystem hooks under fakeroot | expand

Commit Message

Yann E. MORIN March 31, 2018, 9:05 a.m. UTC
... which for now still points to the base target directory, but this is
a step forward.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
---
 Makefile     | 4 +++-
 fs/common.mk | 1 +
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Arnout Vandecappelle March 31, 2018, 6:30 p.m. UTC | #1
On 31-03-18 11:05, Yann E. MORIN wrote:
> ... which for now still points to the base target directory, but this is
> a step forward.
> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> ---
>  Makefile     | 4 +++-
>  fs/common.mk | 1 +
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index e17675be9b..9fba7a3ed8 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -215,8 +215,10 @@ BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
>  
>  BUILD_DIR := $(BASE_DIR)/build
>  BINARIES_DIR := $(BASE_DIR)/images
> +# The target directory is common to all packages,
> +# but there is one that is specific to each filesystem.
>  BASE_TARGET_DIR := $(BASE_DIR)/target
> -TARGET_DIR = $(BASE_TARGET_DIR)
> +TARGET_DIR = $(if $(ROOTFS),$(ROOTFS_$(ROOTFS)_TARGET_DIR),$(BASE_TARGET_DIR))

 OK for now, but I think when PPS happens we should s/ROOTFS/PKG/ and simply use
$($(PKG)_TARGET_DIR) here.

 Regards,
 Arnout

>  # initial definition so that 'make clean' works for most users, even without
>  # .config. HOST_DIR will be overwritten later when .config is included.
>  HOST_DIR := $(BASE_DIR)/host
> diff --git a/fs/common.mk b/fs/common.mk
> index cd132cdbc7..363798bb20 100644
> --- a/fs/common.mk
> +++ b/fs/common.mk
> @@ -40,6 +40,7 @@ define inner-rootfs
>  
>  ROOTFS_$(2)_NAME = $(1)
>  ROOTFS_$(2)_DIR = $$(FS_DIR)/$(1)
> +ROOTFS_$(2)_TARGET_DIR = $$(BASE_TARGET_DIR)
>  
>  # extra deps
>  ROOTFS_$(2)_DEPENDENCIES += host-fakeroot host-makedevs \
>
Yann E. MORIN March 31, 2018, 6:51 p.m. UTC | #2
Arnout, All,

On 2018-03-31 20:30 +0200, Arnout Vandecappelle spake thusly:
> On 31-03-18 11:05, Yann E. MORIN wrote:
> > ... which for now still points to the base target directory, but this is
> > a step forward.
> > 
> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> > Cc: Arnout Vandecappelle <arnout@mind.be>
> > ---
> >  Makefile     | 4 +++-
> >  fs/common.mk | 1 +
> >  2 files changed, 4 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index e17675be9b..9fba7a3ed8 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -215,8 +215,10 @@ BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
> >  
> >  BUILD_DIR := $(BASE_DIR)/build
> >  BINARIES_DIR := $(BASE_DIR)/images
> > +# The target directory is common to all packages,
> > +# but there is one that is specific to each filesystem.
> >  BASE_TARGET_DIR := $(BASE_DIR)/target
> > -TARGET_DIR = $(BASE_TARGET_DIR)
> > +TARGET_DIR = $(if $(ROOTFS),$(ROOTFS_$(ROOTFS)_TARGET_DIR),$(BASE_TARGET_DIR))
> 
>  OK for now, but I think when PPS happens we should s/ROOTFS/PKG/ and simply use
> $($(PKG)_TARGET_DIR) here.

Why so? After PPS, each rootfs will still get their own private copy of
target, which is what we will want them to use...

So, with PPS, this would evetually be something like:

    TARGET_DIR = \
        $(if $(ROOTFS),$(ROOTFS_$(ROOTFS)_TARGET_DIR),\
            $(if $(PKG),$($(PKG)_TARGET_DIR),\
                $(BASE_TARGET_DIR)))

Regards,
Yann E. MORIN.

>  Regards,
>  Arnout
> 
> >  # initial definition so that 'make clean' works for most users, even without
> >  # .config. HOST_DIR will be overwritten later when .config is included.
> >  HOST_DIR := $(BASE_DIR)/host
> > diff --git a/fs/common.mk b/fs/common.mk
> > index cd132cdbc7..363798bb20 100644
> > --- a/fs/common.mk
> > +++ b/fs/common.mk
> > @@ -40,6 +40,7 @@ define inner-rootfs
> >  
> >  ROOTFS_$(2)_NAME = $(1)
> >  ROOTFS_$(2)_DIR = $$(FS_DIR)/$(1)
> > +ROOTFS_$(2)_TARGET_DIR = $$(BASE_TARGET_DIR)
> >  
> >  # extra deps
> >  ROOTFS_$(2)_DEPENDENCIES += host-fakeroot host-makedevs \
> > 
> 
> -- 
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
Arnout Vandecappelle March 31, 2018, 6:57 p.m. UTC | #3
On 31-03-18 20:51, Yann E. MORIN wrote:
> Arnout, All,
> 
> On 2018-03-31 20:30 +0200, Arnout Vandecappelle spake thusly:
>> On 31-03-18 11:05, Yann E. MORIN wrote:
>>> ... which for now still points to the base target directory, but this is
>>> a step forward.
>>>
>>> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
>>> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
>>> Cc: Arnout Vandecappelle <arnout@mind.be>
>>> ---
>>>  Makefile     | 4 +++-
>>>  fs/common.mk | 1 +
>>>  2 files changed, 4 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/Makefile b/Makefile
>>> index e17675be9b..9fba7a3ed8 100644
>>> --- a/Makefile
>>> +++ b/Makefile
>>> @@ -215,8 +215,10 @@ BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
>>>  
>>>  BUILD_DIR := $(BASE_DIR)/build
>>>  BINARIES_DIR := $(BASE_DIR)/images
>>> +# The target directory is common to all packages,
>>> +# but there is one that is specific to each filesystem.
>>>  BASE_TARGET_DIR := $(BASE_DIR)/target
>>> -TARGET_DIR = $(BASE_TARGET_DIR)
>>> +TARGET_DIR = $(if $(ROOTFS),$(ROOTFS_$(ROOTFS)_TARGET_DIR),$(BASE_TARGET_DIR))
>>
>>  OK for now, but I think when PPS happens we should s/ROOTFS/PKG/ and simply use
>> $($(PKG)_TARGET_DIR) here.
> 
> Why so? After PPS, each rootfs will still get their own private copy of
> target, which is what we will want them to use...
> 
> So, with PPS, this would evetually be something like:
> 
>     TARGET_DIR = \
>         $(if $(ROOTFS),$(ROOTFS_$(ROOTFS)_TARGET_DIR),\
>             $(if $(PKG),$($(PKG)_TARGET_DIR),\
>                 $(BASE_TARGET_DIR)))

 Which can be very simply

TARGET_DIR = $(if $(PKG),$($(PKG)_TARGET_DIR),$(BASE_TARGET_DIR))

if we rename ROOTFS to PKG.

 Regards,
 Arnout
Yann E. MORIN March 31, 2018, 7:11 p.m. UTC | #4
Arnout, All,

On 2018-03-31 20:57 +0200, Arnout Vandecappelle spake thusly:
> On 31-03-18 20:51, Yann E. MORIN wrote:
> > Arnout, All,
> > 
> > On 2018-03-31 20:30 +0200, Arnout Vandecappelle spake thusly:
> >> On 31-03-18 11:05, Yann E. MORIN wrote:
> >>> ... which for now still points to the base target directory, but this is
> >>> a step forward.
> >>>
> >>> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> >>> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> >>> Cc: Arnout Vandecappelle <arnout@mind.be>
> >>> ---
> >>>  Makefile     | 4 +++-
> >>>  fs/common.mk | 1 +
> >>>  2 files changed, 4 insertions(+), 1 deletion(-)
> >>>
> >>> diff --git a/Makefile b/Makefile
> >>> index e17675be9b..9fba7a3ed8 100644
> >>> --- a/Makefile
> >>> +++ b/Makefile
> >>> @@ -215,8 +215,10 @@ BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
> >>>  
> >>>  BUILD_DIR := $(BASE_DIR)/build
> >>>  BINARIES_DIR := $(BASE_DIR)/images
> >>> +# The target directory is common to all packages,
> >>> +# but there is one that is specific to each filesystem.
> >>>  BASE_TARGET_DIR := $(BASE_DIR)/target
> >>> -TARGET_DIR = $(BASE_TARGET_DIR)
> >>> +TARGET_DIR = $(if $(ROOTFS),$(ROOTFS_$(ROOTFS)_TARGET_DIR),$(BASE_TARGET_DIR))
> >>
> >>  OK for now, but I think when PPS happens we should s/ROOTFS/PKG/ and simply use
> >> $($(PKG)_TARGET_DIR) here.
> > 
> > Why so? After PPS, each rootfs will still get their own private copy of
> > target, which is what we will want them to use...
> > 
> > So, with PPS, this would evetually be something like:
> > 
> >     TARGET_DIR = \
> >         $(if $(ROOTFS),$(ROOTFS_$(ROOTFS)_TARGET_DIR),\
> >             $(if $(PKG),$($(PKG)_TARGET_DIR),\
> >                 $(BASE_TARGET_DIR)))
> 
>  Which can be very simply
> 
> TARGET_DIR = $(if $(PKG),$($(PKG)_TARGET_DIR),$(BASE_TARGET_DIR))
> 
> if we rename ROOTFS to PKG.

Ah, right. I already thought of that, but since this is not a package
but rootfs, I did not see the point in naming this PKG, just for the
sake of simplifying a code that will come later and is still far from
ready for review yet...

But yes...

Regards,
Yann E. MORIN.
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index e17675be9b..9fba7a3ed8 100644
--- a/Makefile
+++ b/Makefile
@@ -215,8 +215,10 @@  BR_GRAPH_OUT := $(or $(BR2_GRAPH_OUT),pdf)
 
 BUILD_DIR := $(BASE_DIR)/build
 BINARIES_DIR := $(BASE_DIR)/images
+# The target directory is common to all packages,
+# but there is one that is specific to each filesystem.
 BASE_TARGET_DIR := $(BASE_DIR)/target
-TARGET_DIR = $(BASE_TARGET_DIR)
+TARGET_DIR = $(if $(ROOTFS),$(ROOTFS_$(ROOTFS)_TARGET_DIR),$(BASE_TARGET_DIR))
 # initial definition so that 'make clean' works for most users, even without
 # .config. HOST_DIR will be overwritten later when .config is included.
 HOST_DIR := $(BASE_DIR)/host
diff --git a/fs/common.mk b/fs/common.mk
index cd132cdbc7..363798bb20 100644
--- a/fs/common.mk
+++ b/fs/common.mk
@@ -40,6 +40,7 @@  define inner-rootfs
 
 ROOTFS_$(2)_NAME = $(1)
 ROOTFS_$(2)_DIR = $$(FS_DIR)/$(1)
+ROOTFS_$(2)_TARGET_DIR = $$(BASE_TARGET_DIR)
 
 # extra deps
 ROOTFS_$(2)_DEPENDENCIES += host-fakeroot host-makedevs \