Skip to content

pkg/utils: Support host operating systems without VERSION_ID - #1303

Merged
debarshiray merged 2 commits into
containers:mainfrom
debarshiray:wip/rishi/arch-distro
Jun 12, 2023
Merged

debarshiray merged 2 commits into
containers:mainfrom
debarshiray:wip/rishi/arch-distro

Conversation

@debarshiray

Copy link
Copy Markdown
Member

The VERSION_ID field in os-release(5) is optional [1]. It's absent on Arch Linux, which follows a rolling-release model and uses the BUILD_ID field instead:
BUILD_ID=rolling

A subsequent commit will add built-in support for Arch Linux. Hence, the code to get the default release from the host operating system can no longer assume the presence of the VERSION_ID field in os-release(5).

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

@debarshiray
debarshiray requested a review from martymichal as a code owner June 7, 2023 11:23
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 7, 2023
The VERSION_ID field in os-release(5) is optional [1].  It's absent on
Arch Linux, which follows a rolling-release model and uses the BUILD_ID
field instead:
  BUILD_ID=rolling

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code to get the default release from the host operating system can
no longer assume the presence of the VERSION_ID field in os-release(5).

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

containers#1303
@debarshiray
debarshiray force-pushed the wip/rishi/arch-distro branch from b50ae8c to a6c2990 Compare June 7, 2023 11:25
@softwarefactory-delete-me

Copy link
Copy Markdown

Comment thread src/pkg/utils/utils.go Resolved
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 7, 2023
The VERSION_ID field in os-release(5) is optional [1].  It's absent on
Arch Linux, which follows a rolling-release model and uses the BUILD_ID
field instead:
  BUILD_ID=rolling

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code to get the default release from the host operating system can
no longer assume the presence of the VERSION_ID field in os-release(5).

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

containers#1303
@debarshiray
debarshiray force-pushed the wip/rishi/arch-distro branch from a6c2990 to 506836e Compare June 7, 2023 12:35
@softwarefactory-delete-me

Copy link
Copy Markdown

Comment thread src/pkg/utils/utils.go
if err == nil {
if distroObj, supportedDistro := supportedDistros[hostID]; supportedDistro {
release, err := GetHostVersionID()
release, err := getDefaultReleaseForDistro(hostID)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't define releaseDefault in terms of an os-release(5) field like BUILD_ID (set to rolling) on Arch Linux. The arch-toolbox image is tagged with latest, not rolling, and there's nothing in os-release(5) that's set to latest. We really must stick to latest.

Time for another iteration.

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 7, 2023
The VERSION_ID field in os-release(5) is optional [1].  It's absent on
Arch Linux, which follows a rolling-release model and uses the BUILD_ID
field instead:
  BUILD_ID=rolling

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code to get the default release from the host operating system can
no longer assume the presence of the VERSION_ID field in os-release(5).

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

containers#1303
@debarshiray
debarshiray force-pushed the wip/rishi/arch-distro branch from 506836e to a39d373 Compare June 7, 2023 15:42
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 7, 2023
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 7, 2023
Operating system distributions like Arch Linux that follow a
rolling-release model don't have the concept of a release.  The latest
snapshot is the only available release.

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code can no longer assume that every distribution will have a
matching release.

containers#1303
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 7, 2023
This allows using the --distro option to create and enter Arch Linux
containers.  Due to Arch's rolling-release model, the --release option
isn't required.  If --release is used, the accepted values are 'latest'
and 'rolling'.

containers#1303
@softwarefactory-delete-me

Copy link
Copy Markdown

@softwarefactory-delete-me

Copy link
Copy Markdown

@softwarefactory-delete-me

Copy link
Copy Markdown

@debarshiray
debarshiray force-pushed the wip/rishi/arch-distro branch from e951ddc to b64e8c7 Compare June 8, 2023 12:13
@softwarefactory-delete-me

Copy link
Copy Markdown

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 8, 2023
The VERSION_ID field in os-release(5) is optional [1].  It's absent on
Arch Linux, which follows a rolling-release model and uses the BUILD_ID
field instead:
  BUILD_ID=rolling

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code to get the default release from the host operating system can
no longer assume the presence of the VERSION_ID field in os-release(5).

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

containers#1303
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 8, 2023
@debarshiray
debarshiray force-pushed the wip/rishi/arch-distro branch from b64e8c7 to 5f5dbbf Compare June 8, 2023 18:09
@debarshiray

Copy link
Copy Markdown
Member Author

Rebased on top of #1308

@softwarefactory-delete-me

Copy link
Copy Markdown

debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 9, 2023
The VERSION_ID field in os-release(5) is optional [1].  It's absent on
Arch Linux, which follows a rolling-release model and uses the BUILD_ID
field instead:
  BUILD_ID=rolling

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code to get the default release from the host operating system can
no longer assume the presence of the VERSION_ID field in os-release(5).

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

containers#1303
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 9, 2023
@debarshiray
debarshiray force-pushed the wip/rishi/arch-distro branch from 5f5dbbf to c3ed234 Compare June 9, 2023 12:04
@softwarefactory-delete-me

Copy link
Copy Markdown

The VERSION_ID field in os-release(5) is optional [1].  It's absent on
Arch Linux, which follows a rolling-release model and uses the BUILD_ID
field instead:
  BUILD_ID=rolling

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code to get the default release from the host operating system can
no longer assume the presence of the VERSION_ID field in os-release(5).

Note that the arch-toolbox image is tagged with 'latest', in accordance
with OCI conventions, not 'rolling' [2,3], which is the os-release(5)
BUILD_ID.  Therefore, it will be wise to use 'latest' as the default
release on Arch Linux, to simplify how the default release matches with
the default image's tag.  This means that a os-release(5) field can't be
used for the default release on Arch.

[1] https://www.freedesktop.org/software/systemd/man/os-release.html

[2] Commit 2568528
    containers#861

[3] Commit a4e5861
    containers#1308

containers#1303
@debarshiray
debarshiray force-pushed the wip/rishi/arch-distro branch from c3ed234 to 774ce8b Compare June 12, 2023 15:03
@softwarefactory-delete-me

Copy link
Copy Markdown

@debarshiray
debarshiray merged commit 774ce8b into containers:main Jun 12, 2023
@debarshiray
debarshiray deleted the wip/rishi/arch-distro branch June 12, 2023 16:07
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 12, 2023
Operating system distributions like Arch Linux that follow a
rolling-release model don't have the concept of a release.  The latest
snapshot is the only available release.

A subsequent commit will add built-in support for Arch Linux.  Hence,
the code can no longer assume that every distribution will have a
matching release.

containers#1303
debarshiray added a commit to debarshiray/toolbox that referenced this pull request Jun 12, 2023
This allows using the --distro option to create and enter Arch Linux
containers.  Due to Arch's rolling-release model, the --release option
isn't required.  If --release is used, the accepted values are 'latest'
and 'rolling'.

containers#1303
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant