Hi,
On Thu, 20 Jul 2017 18:09:53 +0200
Cedric Bosdonnat <cbosdonnat(a)suse.com> wrote:
On Thu, 2017-07-20 at 17:01 +0200, Pino Toscano wrote:
> On Thursday, 20 July 2017 16:21:40 CEST Cédric Bosdonnat wrote:
> > In the appliance used to build the packages for openSUSE, os-release
> > is super minimal and only had ID_LIKE=suse. The code setting the
> > DISTRO variable only searches for ID variable so far, resulting in
> > invalid packagelist on openSUSE.
> >
> > This fix reads ID_LIKE as a fallback if ID contains nothing.
> > ---
> > m4/guestfs_appliance.m4 | 8 +++++++-
> > 1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/m4/guestfs_appliance.m4 b/m4/guestfs_appliance.m4
> > index fbba3373f..ce45256bc 100644
> > --- a/m4/guestfs_appliance.m4
> > +++ b/m4/guestfs_appliance.m4
> > @@ -97,9 +97,15 @@ AC_MSG_CHECKING([which Linux distro for package names])
> > if test -f /etc/os-release; then
> > ( . /etc/os-release && echo $ID | tr
'@<:@:lower:@:>@' '@<:@:upper:@:>@' )
>&AS_MESSAGE_LOG_FD
> > DISTRO="`. /etc/os-release && echo $ID | tr
'@<:@:lower:@:>@' '@<:@:upper:@:>@'`"
> > + dnl when building SUSE-family packages, the OBS appliance has no ID in
os-release,
> > + dnl only ID_LIKE set to suse. Read ID_LIKE as a fallback if no ID is
found.
> > + if test -z "$DISTRO"; then
> > + ( . /etc/os-release && echo $ID_LIKE | tr
'@<:@:lower:@:>@' '@<:@:upper:@:>@' )
>&AS_MESSAGE_LOG_FD
> > + DISTRO="`. /etc/os-release && echo $ID_LIKE | tr
'@<:@:lower:@:>@' '@<:@:upper:@:>@'`"
> > + fi
>
> NACK -- while this would be a fallback, theoretically ID_LIKE is a list
> of distros.
Then may be we should handle the values in the list to try to find one that fits
the values we know
> > AS_CASE([$DISTRO],
> > [FEDORA | RHEL | CENTOS],[DISTRO=REDHAT],
> > - [OPENSUSE | SLED | SLES],[DISTRO=SUSE],
> > + [OPENSUSE | SLED | SLES | SUSE],[DISTRO=SUSE],
>
> There is no need for this, since a value of $DISTRO not matching any of
> the cases in AS_CASE is left as-is, and SUSE is already the right value.
OK.
> What I would do is something like the following (untested):
>
> if test -f /etc/os-release; then
> [... get DISTRO like done now ...]
> endif
> if -n "$DISTRO" then
> : # value already found in os-release
> elif test -f /etc/debian_version; then
> [... etc, like now ...]
That doesn't change much from the current state, unless we add a case for
ID_LIKE=suse
> This way, the lack of ID in os-release will trigger the detection using
> the various release-like files. WDYT?
My problem is that openSUSE Tumbleweed (the one with the problem) doesn't have
the SuSE-release file anymore and has a too minimalistic os-release file.
Shouldn't this be rather fixed in openSUSE then? Or is there some
rationale behind why the ID is missing?
If the idea is to distinguish Tumbleweed from Leap then that's what the
fields VARIANT and VARIANT_ID are for I believe.
--
Cedric
_______________________________________________
Libguestfs mailing list
Libguestfs(a)redhat.com
https://www.redhat.com/mailman/listinfo/libguestfs
--
Tomáš Golembiovský <tgolembi(a)redhat.com>