Skip to contentSkip to conversation

os-release: remove double-quotes around VERSION_ID value

PATCH In review Dmitry Rozhkov 6 participants 9 messages Feb 12, 2016 – Feb 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 os-release: remove double-quotes around VERSION_ID value

man 5 os-release states that VERSION_ID is

"
a lower-case string (mostly numeric, no spaces or other characters outside of 0-9, a-z, ".", "_" and "-") identifying the operating system version
"

This becomes crucial when ClearLinux's software update mechanism is integrated into builds, because its client side ignores VERSION_ID's value if it doesn't conform the definition.

---
 meta/recipes-core/os-release/os-release.bb | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/os-release/os-release.bb +5 -1
index df19ca2..1f0df9e 100644
@@ -29,7 +29,11 @@ python do_compile () {
         for field in d.getVar('OS_RELEASE_FIELDS', True).split():
             value = d.getVar(field, True)
             if value:
-                f.write('{0}="{1}"\n'.format(field, value))
+                if field == "VERSION_ID":
+                    format_str = '{0}={1}\n'
+                else:
+                    format_str = '{0}="{1}"\n'
+                f.write(format_str.format(field, value))
     if d.getVar('RPM_SIGN_PACKAGES', True) == '1':
         rpm_gpg_pubkey = d.getVar('RPM_GPG_PUBKEY', True)
         bb.utils.mkdirhier('${B}/rpm-gpg')
Signature · 12 lines
2.5.0

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki 
Business Identity Code: 0357606 - 4 
Domiciled in Helsinki 

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.
#1 lore raw
Quoted 8 lines · Dmitry Rozhkov

man 5 os-release states that VERSION_ID is

"
a lower-case string (mostly numeric, no spaces or other characters outside of 0-9, a-z, ".", "_" and "-") identifying the operating system version
"

Quoted 6 lines

This becomes crucial when ClearLinux's software update mechanism is integrated into builds, because its client side ignores VERSION_ID's value if it doesn't conform the definition.

I think we probably want this change, but we will also need to change the default assignment of VERSION_ID to match the rules:

"Variable assignment values must be enclosed in double or single quotes if they include spaces, semicolons or other special characters outside of A-Z, a-z, 0-9."

By default VERSION_ID is assigned DISTRO_VERSION, which contains invalid characters for this field in both OE Core (defaultsetup distro uses "nodistro.0") and meta-yocto (poky distro uses something like "2.0+snapshot-${DATE}" during development and something like "1.8.1" on a release).

Thoughts on changing these?

Regards,

Joshua

Quoted 36 lines

---
 meta/recipes-core/os-release/os-release.bb | 6 +++++-

 1 file changed, 5 insertions(+), 1 deletion(-)
meta/recipes-core/os-release/os-release.bb +0 -0
index df19ca2..1f0df9e 100644
@@ -29,7 +29,11 @@ python do_compile () {

         for field in d.getVar('OS_RELEASE_FIELDS', True).split():
             value = d.getVar(field, True)
             if value:
-                f.write('{0}="{1}"\n'.format(field, value)) +                if field == "VERSION_ID":
+                    format_str = '{0}={1}\n'
+                else:
+                    format_str = '{0}="{1}"\n'
+                f.write(format_str.format(field, value)) if d.getVar('RPM_SIGN_PACKAGES', True) == '1':
         rpm_gpg_pubkey = d.getVar('RPM_GPG_PUBKEY', True) bb.utils.mkdirhier('${B}/rpm-gpg')
--
2.5.0

---------------------------------------------------------------------
Intel Finland Oy
Registered Address: PL 281, 00181 Helsinki
Business Identity Code: 0357606 - 4
Domiciled in Helsinki

This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

#4 lore raw
In reply to Dmitry Rozhkov
Quoted 8 lines · Dmitry Rozhkov

man 5 os-release states that VERSION_ID is

"
a lower-case string (mostly numeric, no spaces or other characters outside of 0-9, a-z, ".", "_" and "-") identifying the operating system version
"

Quoted 4 lines

This becomes crucial when ClearLinux's software update mechanism is integrated into builds, because its client side ignores VERSION_ID's value if it doesn't conform the definition.

On Debian, the value is quoted:

VERSION_ID="8"

So I think the documentation refers to the value of VERSION_ID, with the surrounding quotes not being part of the *value*.

Signature · 1 line
olofjn
#2 lore raw
In reply to Joshua G Lock
Quoted 33 lines · Joshua G Lock
Quoted 8 lines · Dmitry Rozhkov

man 5 os-release states that VERSION_ID is

"
a lower-case string (mostly numeric, no spaces or other characters outside of 0-9, a-z, ".", "_" and "-") identifying the operating system version
"

Quoted 6 lines

This becomes crucial when ClearLinux's software update mechanism is integrated into builds, because its client side ignores VERSION_ID's value if it doesn't conform the definition.

I think we probably want this change, but we will also need to change the default assignment of VERSION_ID to match the rules:

"Variable assignment values must be enclosed in double or single quotes
if they include spaces, semicolons or other special characters outside
of A-Z, a-z, 0-9."

By default VERSION_ID is assigned DISTRO_VERSION, which contains invalid characters for this field in both OE Core (defaultsetup distro
uses "nodistro.0") and meta-yocto (poky distro uses something like "2.0+snapshot-${DATE}" during development and something like "1.8.1" on
a release).

Quoted 1 line

Thoughts on changing these?

nodistro.0 is ok isn't it?

We should probably manipulate the string when writing this, "+" -> "-" and "A-Z" -> "a-z"?

Not sure I want to change the high level values just due to this.

Cheers,

Richard

#5 lore raw
In reply to Dmitry Rozhkov
Quoted 6 lines · Dmitry Rozhkov

"
a lower-case string (mostly numeric, no spaces or other characters outside of 0-9, a-z, ".", "_" and "-") identifying the operating system version
"

To quote from the paragraph above:

"Variable assignment values should be enclosed in double or single quotes if they include spaces, semicolons or other special characters outside of A-Z, a-z, 0-9."

If the Clear updater is failing to handle quoted values then that's a bug in their parser.

Ross

#6 lore raw
In reply to Dmitry Rozhkov
Quoted 12 lines

Dnia 12 luty 2016 o 13:15 Dmitry Rozhkov <[email protected]> napisał(a):

man 5 os-release states that VERSION_ID is

"
a lower-case string (mostly numeric, no spaces or other characters outside of 0-9, a-z, ".", "_" and "-") identifying the operating system version
"

Quoted 4 lines

This becomes crucial when ClearLinux's software update mechanism is integrated into builds, because its client side ignores VERSION_ID's value if it doesn't conform the definition.

Is this integration work already published somewhere? I'm interested in trying out swupdate with Yocto, but the lack of publicly available repo is kind of holding this back (yes, I'm ware of SRPMs).

When I was asking on the mailing list about Yocto and ClearLinux back in January[1][2] Arjan responded that there was a mismatch between the development models used by Clear and Yocto and that there was a number of reasons for not using Yocto tooling in Clear. Now, I'm still interested in getting swupdate to work outside of Clear, so I took some time to go through the source code to figure out the update mechanism[3]. IMO making it work with Yocto should not be a significant effort, even in embedded applications.

Do you mind sharing the some details if there is a larger plan for getting Clear closer to Yocto/OE?

[1]. https://lists.clearlinux.org/pipermail/dev/2016-January/000150.html
[2]. https://lists.clearlinux.org/pipermail/dev/2016-January/000151.html
[3]. https://lists.clearlinux.org/pipermail/dev/2016-January/000159.html

--
Maciej Borzęcki
Senior Software Engineer at Open-RnD Sp. z o.o.
www.open-rnd.pl, Facebook, Twitter

#7 lore raw
Quoted 11 lines · Maciej Borzecki
Quoted 7 lines

Dnia 12 luty 2016 o 13:15 Dmitry Rozhkov <[email protected]> napisał(a):

This becomes crucial when ClearLinux's software
update mechanism is integrated into builds, because
its client side ignores VERSION_ID's value if it
doesn't conform the definition.

Is this integration work already published somewhere? I'm interested in trying out swupdate with Yocto, but the lack of publicly available repo is kind of holding this back (yes, I'm ware of SRPMs).

I'm working on integrating swupd into OE-Core, it's a work in progress and so far nothing has been published (the work is not yet in a functional state).

The recipes we are currently using for swupd-server and swupd-client use the src.rpm's from clearlinux.org

Quoted 2 lines

Do you mind sharing the some details if there is a larger plan for getting Clear closer to Yocto/OE?

We have a couple of tickets in the Yocto Project bugzilla[1][2] which give an overview of the approach I'm taking for this initial implementation.

The approach is fairly conservative in an attempt to get something usable integrated that lets us work with the swupd developers to iron out issues with utilising swupd from within OE.

Regards,

Joshua

1. https://bugzilla.yoctoproject.org/show_bug.cgi?id=9039
2. https://bugzilla.yoctoproject.org/show_bug.cgi?id=9040

#3 lore raw
In reply to Richard Purdie
Quoted 36 lines · Richard Purdie
Quoted 35 lines · Joshua G Lock
Quoted 8 lines · Dmitry Rozhkov

man 5 os-release states that VERSION_ID is

"
a lower-case string (mostly numeric, no spaces or other characters outside of 0-9, a-z, ".", "_" and "-") identifying the operating system version
"

Quoted 6 lines

This becomes crucial when ClearLinux's software update mechanism is integrated into builds, because its client side ignores VERSION_ID's value if it doesn't conform the definition.

I think we probably want this change, but we will also need to change
the default assignment of VERSION_ID to match the rules:

"Variable assignment values must be enclosed in double or single quotes
if they include spaces, semicolons or other special characters outside
of A-Z, a-z, 0-9."

By default VERSION_ID is assigned DISTRO_VERSION, which contains invalid characters for this field in both OE Core (defaultsetup distro
uses "nodistro.0") and meta-yocto (poky distro uses something like "2.0+snapshot-${DATE}" during development and something like "1.8.1"
on
a release).

Quoted 3 lines
Quoted 1 line

Thoughts on changing these?

nodistro.0 is ok isn't it?

It is yes, I wasn't paying enough attention earlier.

Quoted 4 lines

We should probably manipulate the string when writing this, "+" -> "- "
and "A-Z" -> "a-z"?

That sounds like a good solution to me.

Regards,

Joshua

#8 lore raw
In reply to Joshua G Lock
Quoted 27 lines

Dnia 12 luty 2016 o 22:49 Joshua G Lock <[email protected]> napisał(a):

Quoted 11 lines · Maciej Borzecki
Quoted 7 lines

Dnia 12 luty 2016 o 13:15 Dmitry Rozhkov <[email protected]> napisał(a):

This becomes crucial when ClearLinux's software update mechanism is integrated into builds, because its client side ignores VERSION_ID's value if it doesn't conform the definition.

Is this integration work already published somewhere? I'm interested in trying out swupdate with Yocto, but the lack of publicly available repo is kind of holding this back (yes, I'm ware of SRPMs).

I'm working on integrating swupd into OE-Core, it's a work in progress and so far nothing has been published (the work is not yet in a functional state).

The recipes we are currently using for swupd-server and swupd-client use the src.rpm's from clearlinux.org

Quoted 2 lines

Do you mind sharing the some details if there is a larger plan for getting Clear closer to Yocto/OE?

Quoted 8 lines

We have a couple of tickets in the Yocto Project bugzilla[1][2] which give an overview of the approach I'm taking for this initial implementation.

The approach is fairly conservative in an attempt to get something usable integrated that lets us work with the swupd developers to iron out issues with utilising swupd from within OE.

Thanks for taking the time to respond. I'll keep an eye on both BZ issues.

--
Maciej Borzęcki
Senior Software Engineer at Open-RnD Sp. z o.o.
www.open-rnd.pl, Facebook, Twitter