Skip to content

ENT-12600: detect-environment: Document and refactor #1737

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

larsewi
Copy link
Contributor

@larsewi larsewi commented Jun 6, 2025

Build with exotics and no tests
Build Status

@larsewi larsewi changed the title detect-environment: Fixed shellcheck issues detect-environment: Document and refactor Jun 6, 2025
@larsewi larsewi changed the title detect-environment: Document and refactor ENT-12600: detect-environment: Document and refactor Jun 6, 2025
@cf-bottom
Copy link

Thanks for submitting a PR! Maybe @craigcomstock can review this?

@larsewi larsewi force-pushed the detect-environment branch 5 times, most recently from eb0edfd to 4ccc0c9 Compare June 10, 2025 11:49
@larsewi larsewi force-pushed the detect-environment branch 2 times, most recently from d6ca0df to 2632a22 Compare June 16, 2025 08:06
larsewi added 18 commits June 16, 2025 10:17
Renamed function `detect_labels` to `detect_cross_target`, because this
is really what it does. Furthermore, I added a comment explaining the
code, as well as code to inform about the detection of cross target.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
The rest of the file uses two space indentation. Hence, the check to see
if the functions script was sourced should also have two space
indentation for consitency.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Put the pattern block terminators on separate lines, in the
detect_distribution function, for the sake of consistency.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Removed version substitution of the Debian release code-names (e.g.,
jessie, buster, etc.) from /etc/debian_version. Looking through the
[changelog](https://launchpad.net/debian/+source/base-files/+changelog)
for the base-files package in Debian, you can easily see that it has
never contained the code-names. At least not since version 5.0.3.
Furthermore, we have not updated the version substitution since Debian
10 which is End-of-Life.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
There has not been a 1-digit major release of ubuntu for a long time.
Hence, there is no point in looking for it when verifying the version
number extracted from /etc/lsb-release.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
On SUSE 12 the /etc/SuSE-release file exists with a deprecation warning.
However, /etc/os-release also exists. So we might as well remove the
parsing of the former and rely on the latter.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
If the former if condition is true, then the latter implicitly cannot be
true. Hence, there is no point in evaluating it.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Put the pattern block terminators on separate lines, in the
detect_packaging function, for the sake of consistency.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Put the pattern block terminators on separate lines, in the
detect_arch function, for the sake of consistency.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
For some reason the version detection for FreeBSD and HP-UX was in the
detect_arch function. However, it belongs in the detect_os function.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
AIX 5.3 is no longer supported, so we don't need this environment
variable anymore.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
@larsewi larsewi force-pushed the detect-environment branch from 2632a22 to b2be1bc Compare June 16, 2025 08:19
larsewi added 7 commits June 16, 2025 16:39
Signed-off-by: Lars Erik Wik <[email protected]>
The function "fatal" is not defined in this script. So it may not be
available.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Put the pattern block terminators on separate lines, in the
detect_cores function, for the sake of consistency.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
The detect-environment script is quite noicy due to the fact that it
prints the environment every time it's sourced. Hence, modified it to
print only the environment variables that the script affects.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
If we disable -x to decrease the verbosity of the build scripts. Then
these log messages will come in handy.

Ticket: ENT-12600
Signed-off-by: Lars Erik Wik <[email protected]>
@larsewi larsewi force-pushed the detect-environment branch from b2be1bc to d02fbb9 Compare June 16, 2025 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants