os-release: fix to install in the expected location

Message ID 20180904155000.3715-1-ross.burton@intel.com
State New
Headers show
Series
  • os-release: fix to install in the expected location
Related show

Commit Message

Burton, Ross Sept. 4, 2018, 3:50 p.m.
From: Joshua Lock <joshua.g.lock@intel.com>


os-release (5) recommends that the os-release file be installed in
/usr/lib/os-release and that /etc/os-release be a relative symlink to it.

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>

Signed-off-by: Ross Burton <ross.burton@intel.com>

---
 meta/recipes-core/os-release/os-release.bb | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Comments

Andre McCurdy Sept. 4, 2018, 8:19 p.m. | #1
On Tue, Sep 4, 2018 at 8:50 AM, Ross Burton <ross.burton@intel.com> wrote:
> From: Joshua Lock <joshua.g.lock@intel.com>

>

> os-release (5) recommends that the os-release file be installed in

> /usr/lib/os-release and that /etc/os-release be a relative symlink to it.

>

> Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>

> Signed-off-by: Ross Burton <ross.burton@intel.com>

> ---

>  meta/recipes-core/os-release/os-release.bb | 7 ++++---

>  1 file changed, 4 insertions(+), 3 deletions(-)

>

> diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb

> index f9887047561..c6e36001dc5 100644

> --- a/meta/recipes-core/os-release/os-release.bb

> +++ b/meta/recipes-core/os-release/os-release.bb

> @@ -1,7 +1,7 @@

>  inherit allarch

>

>  SUMMARY = "Operating system identification"

> -DESCRIPTION = "The /etc/os-release file contains operating system identification data."

> +DESCRIPTION = "The /usr/lib/os-release file contains operating system identification data."

>  LICENSE = "MIT"

>  INHIBIT_DEFAULT_DEPS = "1"

>

> @@ -42,6 +42,7 @@ python do_compile () {

>  do_compile[vardeps] += "${OS_RELEASE_FIELDS}"

>

>  do_install () {

> -    install -d ${D}${sysconfdir}

> -    install -m 0644 os-release ${D}${sysconfdir}/

> +    install -d ${D}${libdir}

> +    install -m 0644 os-release ${D}${libdir}/

> +    lnr ${D}${libdir}/os-release ${D}${sysconfdir}


This probably needs an "rm -f ${D}${sysconfdir}/os-release" too to
prevent problems if install is run twice as lnr doesn't handle the
case where the target already exists.

>  }

> --

> 2.11.0

>

> --

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Khem Raj Sept. 4, 2018, 8:46 p.m. | #2
On Tue, Sep 4, 2018 at 1:19 PM Andre McCurdy <armccurdy@gmail.com> wrote:
>

> On Tue, Sep 4, 2018 at 8:50 AM, Ross Burton <ross.burton@intel.com> wrote:

> > From: Joshua Lock <joshua.g.lock@intel.com>

> >

> > os-release (5) recommends that the os-release file be installed in

> > /usr/lib/os-release and that /etc/os-release be a relative symlink to it.

> >

> > Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>

> > Signed-off-by: Ross Burton <ross.burton@intel.com>

> > ---

> >  meta/recipes-core/os-release/os-release.bb | 7 ++++---

> >  1 file changed, 4 insertions(+), 3 deletions(-)

> >

> > diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb

> > index f9887047561..c6e36001dc5 100644

> > --- a/meta/recipes-core/os-release/os-release.bb

> > +++ b/meta/recipes-core/os-release/os-release.bb

> > @@ -1,7 +1,7 @@

> >  inherit allarch

> >

> >  SUMMARY = "Operating system identification"

> > -DESCRIPTION = "The /etc/os-release file contains operating system identification data."

> > +DESCRIPTION = "The /usr/lib/os-release file contains operating system identification data."

> >  LICENSE = "MIT"

> >  INHIBIT_DEFAULT_DEPS = "1"

> >

> > @@ -42,6 +42,7 @@ python do_compile () {

> >  do_compile[vardeps] += "${OS_RELEASE_FIELDS}"

> >

> >  do_install () {

> > -    install -d ${D}${sysconfdir}

> > -    install -m 0644 os-release ${D}${sysconfdir}/

> > +    install -d ${D}${libdir}

> > +    install -m 0644 os-release ${D}${libdir}/


both install calls above could be squashed into install -D -m 0644 ...

> > +    lnr ${D}${libdir}/os-release ${D}${sysconfdir}

>

> This probably needs an "rm -f ${D}${sysconfdir}/os-release" too to

> prevent problems if install is run twice as lnr doesn't handle the

> case where the target already exists.

>

> >  }

> > --

> > 2.11.0

> >

> > --

> > _______________________________________________

> > Openembedded-core mailing list

> > Openembedded-core@lists.openembedded.org

> > http://lists.openembedded.org/mailman/listinfo/openembedded-core

> --

> _______________________________________________

> Openembedded-core mailing list

> Openembedded-core@lists.openembedded.org

> http://lists.openembedded.org/mailman/listinfo/openembedded-core

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Richard Purdie Sept. 4, 2018, 10:36 p.m. | #3
On Tue, 2018-09-04 at 13:19 -0700, Andre McCurdy wrote:
> On Tue, Sep 4, 2018 at 8:50 AM, Ross Burton <ross.burton@intel.com>

> wrote:

> > From: Joshua Lock <joshua.g.lock@intel.com>

> > 

> > os-release (5) recommends that the os-release file be installed in

> > /usr/lib/os-release and that /etc/os-release be a relative symlink

> > to it.

> > 

> > Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>

> > Signed-off-by: Ross Burton <ross.burton@intel.com>

> > ---

> >  meta/recipes-core/os-release/os-release.bb | 7 ++++---

> >  1 file changed, 4 insertions(+), 3 deletions(-)

> > 

> > diff --git a/meta/recipes-core/os-release/os-release.bb

> > b/meta/recipes-core/os-release/os-release.bb

> > index f9887047561..c6e36001dc5 100644

> > --- a/meta/recipes-core/os-release/os-release.bb

> > +++ b/meta/recipes-core/os-release/os-release.bb

> > @@ -1,7 +1,7 @@

> >  inherit allarch

> > 

> >  SUMMARY = "Operating system identification"

> > -DESCRIPTION = "The /etc/os-release file contains operating system

> > identification data."

> > +DESCRIPTION = "The /usr/lib/os-release file contains operating

> > system identification data."

> >  LICENSE = "MIT"

> >  INHIBIT_DEFAULT_DEPS = "1"

> > 

> > @@ -42,6 +42,7 @@ python do_compile () {

> >  do_compile[vardeps] += "${OS_RELEASE_FIELDS}"

> > 

> >  do_install () {

> > -    install -d ${D}${sysconfdir}

> > -    install -m 0644 os-release ${D}${sysconfdir}/

> > +    install -d ${D}${libdir}

> > +    install -m 0644 os-release ${D}${libdir}/

> > +    lnr ${D}${libdir}/os-release ${D}${sysconfdir}

> 

> This probably needs an "rm -f ${D}${sysconfdir}/os-release" too to

> prevent problems if install is run twice as lnr doesn't handle the

> case where the target already exists.


Doesn't do_install clean out ${D} each time it reruns though?

Cheers,

Richard
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Khem Raj Sept. 4, 2018, 11 p.m. | #4
On Tue, Sep 4, 2018 at 8:50 AM Ross Burton <ross.burton@intel.com> wrote:
>

> From: Joshua Lock <joshua.g.lock@intel.com>

>

> os-release (5) recommends that the os-release file be installed in

> /usr/lib/os-release and that /etc/os-release be a relative symlink to it.

>

> Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>

> Signed-off-by: Ross Burton <ross.burton@intel.com>

> ---

>  meta/recipes-core/os-release/os-release.bb | 7 ++++---

>  1 file changed, 4 insertions(+), 3 deletions(-)

>

> diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb

> index f9887047561..c6e36001dc5 100644

> --- a/meta/recipes-core/os-release/os-release.bb

> +++ b/meta/recipes-core/os-release/os-release.bb

> @@ -1,7 +1,7 @@

>  inherit allarch

>

>  SUMMARY = "Operating system identification"

> -DESCRIPTION = "The /etc/os-release file contains operating system identification data."

> +DESCRIPTION = "The /usr/lib/os-release file contains operating system identification data."

>  LICENSE = "MIT"

>  INHIBIT_DEFAULT_DEPS = "1"

>

> @@ -42,6 +42,7 @@ python do_compile () {

>  do_compile[vardeps] += "${OS_RELEASE_FIELDS}"

>

>  do_install () {

> -    install -d ${D}${sysconfdir}

> -    install -m 0644 os-release ${D}${sysconfdir}/

> +    install -d ${D}${libdir}

> +    install -m 0644 os-release ${D}${libdir}/

> +    lnr ${D}${libdir}/os-release ${D}${sysconfdir}

>  }


I am also seeing packaging failures

ERROR: os-release-1.0-r0 do_package: QA Issue: os-release:
Files/directories were installed but not shipped in any package:
  /usr
  /usr/lib
  /usr/lib/os-release
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Andre McCurdy Sept. 5, 2018, 2:04 a.m. | #5
On Tue, Sep 4, 2018 at 3:36 PM, Richard Purdie
<richard.purdie@linuxfoundation.org> wrote:
> On Tue, 2018-09-04 at 13:19 -0700, Andre McCurdy wrote:

>> On Tue, Sep 4, 2018 at 8:50 AM, Ross Burton <ross.burton@intel.com>

>> wrote:

>> > From: Joshua Lock <joshua.g.lock@intel.com>

>> >

>> > os-release (5) recommends that the os-release file be installed in

>> > /usr/lib/os-release and that /etc/os-release be a relative symlink

>> > to it.

>> >

>> > Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>

>> > Signed-off-by: Ross Burton <ross.burton@intel.com>

>> > ---

>> >  meta/recipes-core/os-release/os-release.bb | 7 ++++---

>> >  1 file changed, 4 insertions(+), 3 deletions(-)

>> >

>> > diff --git a/meta/recipes-core/os-release/os-release.bb

>> > b/meta/recipes-core/os-release/os-release.bb

>> > index f9887047561..c6e36001dc5 100644

>> > --- a/meta/recipes-core/os-release/os-release.bb

>> > +++ b/meta/recipes-core/os-release/os-release.bb

>> > @@ -1,7 +1,7 @@

>> >  inherit allarch

>> >

>> >  SUMMARY = "Operating system identification"

>> > -DESCRIPTION = "The /etc/os-release file contains operating system

>> > identification data."

>> > +DESCRIPTION = "The /usr/lib/os-release file contains operating

>> > system identification data."

>> >  LICENSE = "MIT"

>> >  INHIBIT_DEFAULT_DEPS = "1"

>> >

>> > @@ -42,6 +42,7 @@ python do_compile () {

>> >  do_compile[vardeps] += "${OS_RELEASE_FIELDS}"

>> >

>> >  do_install () {

>> > -    install -d ${D}${sysconfdir}

>> > -    install -m 0644 os-release ${D}${sysconfdir}/

>> > +    install -d ${D}${libdir}

>> > +    install -m 0644 os-release ${D}${libdir}/

>> > +    lnr ${D}${libdir}/os-release ${D}${sysconfdir}

>>

>> This probably needs an "rm -f ${D}${sysconfdir}/os-release" too to

>> prevent problems if install is run twice as lnr doesn't handle the

>> case where the target already exists.

>

> Doesn't do_install clean out ${D} each time it reruns though?


Yes, it does. Sometimes it's useful to rerun the run.do_install script
manually though.
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Richard Purdie Sept. 5, 2018, 8:47 a.m. | #6
On Tue, 2018-09-04 at 19:04 -0700, Andre McCurdy wrote:
> On Tue, Sep 4, 2018 at 3:36 PM, Richard Purdie

> <richard.purdie@linuxfoundation.org> wrote:

> > On Tue, 2018-09-04 at 13:19 -0700, Andre McCurdy wrote:

> > > On Tue, Sep 4, 2018 at 8:50 AM, Ross Burton <ross.burton@intel.co

> > > m>

> > > wrote:

> > > This probably needs an "rm -f ${D}${sysconfdir}/os-release" too

> > > to

> > > prevent problems if install is run twice as lnr doesn't handle

> > > the

> > > case where the target already exists.

> > 

> > Doesn't do_install clean out ${D} each time it reruns though?

> 

> Yes, it does. Sometimes it's useful to rerun the run.do_install

> script

> manually though.


We don't support that, I think its reasonable to assume that ${D} is
empty at the start of do_install. To do otherwise would mean changing a
lot of do_install functions for very little gain IMO.

Cheers,

Richard
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Martin Jansa Sept. 5, 2018, 10:31 a.m. | #7
On Tue, Sep 04, 2018 at 01:19:28PM -0700, Andre McCurdy wrote:
> On Tue, Sep 4, 2018 at 8:50 AM, Ross Burton <ross.burton@intel.com> wrote:

> > From: Joshua Lock <joshua.g.lock@intel.com>

> >

> > os-release (5) recommends that the os-release file be installed in

> > /usr/lib/os-release and that /etc/os-release be a relative symlink to it.

> >

> > Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>

> > Signed-off-by: Ross Burton <ross.burton@intel.com>

> > ---

> >  meta/recipes-core/os-release/os-release.bb | 7 ++++---

> >  1 file changed, 4 insertions(+), 3 deletions(-)

> >

> > diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb

> > index f9887047561..c6e36001dc5 100644

> > --- a/meta/recipes-core/os-release/os-release.bb

> > +++ b/meta/recipes-core/os-release/os-release.bb

> > @@ -1,7 +1,7 @@

> >  inherit allarch

> >

> >  SUMMARY = "Operating system identification"

> > -DESCRIPTION = "The /etc/os-release file contains operating system identification data."

> > +DESCRIPTION = "The /usr/lib/os-release file contains operating system identification data."

> >  LICENSE = "MIT"

> >  INHIBIT_DEFAULT_DEPS = "1"

> >

> > @@ -42,6 +42,7 @@ python do_compile () {

> >  do_compile[vardeps] += "${OS_RELEASE_FIELDS}"

> >

> >  do_install () {

> > -    install -d ${D}${sysconfdir}

> > -    install -m 0644 os-release ${D}${sysconfdir}/

> > +    install -d ${D}${libdir}

> > +    install -m 0644 os-release ${D}${libdir}/

> > +    lnr ${D}${libdir}/os-release ${D}${sysconfdir}

> 

> This probably needs an "rm -f ${D}${sysconfdir}/os-release" too to

> prevent problems if install is run twice as lnr doesn't handle the

> case where the target already exists.


Why do we need ${D} in first place? Doesn't

ln -snf ${libdir}/os-release ${D}${sysconfdir}

solve both issues?

-- 
Martin 'JaMa' Jansa     jabber: Martin.Jansa@gmail.com
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core
Andre McCurdy Sept. 5, 2018, 3:56 p.m. | #8
On Wed, Sep 5, 2018 at 1:47 AM,  <richard.purdie@linuxfoundation.org> wrote:
> On Tue, 2018-09-04 at 19:04 -0700, Andre McCurdy wrote:

>> On Tue, Sep 4, 2018 at 3:36 PM, Richard Purdie

>> <richard.purdie@linuxfoundation.org> wrote:

>> > On Tue, 2018-09-04 at 13:19 -0700, Andre McCurdy wrote:

>> > > On Tue, Sep 4, 2018 at 8:50 AM, Ross Burton <ross.burton@intel.co

>> > > m>

>> > > wrote:

>> > > This probably needs an "rm -f ${D}${sysconfdir}/os-release" too

>> > > to

>> > > prevent problems if install is run twice as lnr doesn't handle

>> > > the

>> > > case where the target already exists.

>> >

>> > Doesn't do_install clean out ${D} each time it reruns though?

>>

>> Yes, it does. Sometimes it's useful to rerun the run.do_install

>> script

>> manually though.

>

> We don't support that, I think its reasonable to assume that ${D} is

> empty at the start of do_install. To do otherwise would mean changing a

> lot of do_install functions for very little gain IMO.


Most callers of lnr already explicitly remove the target first.
Ensuring new calls to lnr do the same as they are added isn't a lot of
work.
-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch

diff --git a/meta/recipes-core/os-release/os-release.bb b/meta/recipes-core/os-release/os-release.bb
index f9887047561..c6e36001dc5 100644
--- a/meta/recipes-core/os-release/os-release.bb
+++ b/meta/recipes-core/os-release/os-release.bb
@@ -1,7 +1,7 @@ 
 inherit allarch
 
 SUMMARY = "Operating system identification"
-DESCRIPTION = "The /etc/os-release file contains operating system identification data."
+DESCRIPTION = "The /usr/lib/os-release file contains operating system identification data."
 LICENSE = "MIT"
 INHIBIT_DEFAULT_DEPS = "1"
 
@@ -42,6 +42,7 @@  python do_compile () {
 do_compile[vardeps] += "${OS_RELEASE_FIELDS}"
 
 do_install () {
-    install -d ${D}${sysconfdir}
-    install -m 0644 os-release ${D}${sysconfdir}/
+    install -d ${D}${libdir}
+    install -m 0644 os-release ${D}${libdir}/
+    lnr ${D}${libdir}/os-release ${D}${sysconfdir}
 }