On Ubuntu, /bin/sh is a symlink to /bin/dash by default.
While this is a rare use case, when /bin/sh is a symlink to /bin/bash,
the annotation check fails due to a mismatch of CONFIG_UBUNTU_ODM_DRIVERS.
debian/scripts/misc/arch-has-odm-enabled.sh always fails with bash.
You can see it if you directly execute it.
[with dash]
$ dash debian/scripts/misc/arch-has-odm-enabled.sh amd64
cat: debian/scripts/misc/../../../debian.master/rules.d/hooks.mk: No such file or directory
$ echo $?
0
[with bash]
$ bash debian/scripts/misc/arch-has-odm-enabled.sh amd64
cat: debian/scripts/misc/../../../debian.master/rules.d/hooks.mk: No such file or directory
debian/scripts/misc/arch-has-odm-enabled.sh: line 26: return: can only `return' from a function or sourced script
$ echo $?
2
Bash provides stricter checks, hence the 'return' statement outside
a function leads to an error.
While it is trivial to fix, I wonder if we need this script in the
first place. Its purpose is to make CONFIG_UBUNTU_ODM_DRIVERS a
user-unconfigurable option.
Given debian.*/config/annotations specifying the CONFIG set for each
arch/flavour, why not handle CONFIG_UBUNTU_ODM_DRIVERS just like
other normal CONFIG options? Users are still allow to toggle it from
menuconfig etc., but I do not see a significant issue, as any trouble
comes to users' responsibility when they change CONFIG options by
themselves.
Signed-off-by: Masahiro Yamada <masahiro.yamada@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Remove the update-dkms-versions script from the tree, it's replaced by
'cranky update-dkms-versions', move the dkms-versions file and fix all
references to the old location.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
linux-buildinfo packages are now externally compared by swm, with
results approving or rejecting updates based on the stable
tracker. Those checks also allow hints and overrides to accept
intentional changes.
Also these are done on the correct pair-wise comparisons, especially
when two streams are being cranked.
The above eliminates the need to identify previous build abi,
download, extract it, vendor it in, and assert it at build time.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/1945989
Add a new script responsible for checking if any FIPS relevant commit
was added since the last version. If a new change is found, a
corresponding entry should exist in the justifications file otherwise
the check will fail.
The justifications file is located at "${DEBIAN}/fips.justifications"
and should follow the following format for each commit justification:
<commit short message>
<commit justification>
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Kelsey Skunberg <kelsey.skunberg@canonical.com>
(ported from commit 68d02506ae6b236d7df155cdcaa64456e9153d5e focal)
[magalilemes: added arch/arm64/crypto and lib/crypto/{sha1,aes}.c to
crypto_files; changed the way tag_prefix is set]
Signed-off-by: Magali Lemes <magali.lemes@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2045562
Debian source format 1.0 cannot remove files, create symlinks and change
permission in the .diff.gz tarball. Therefore any changes in these 3
categories cannot be represented without any tricks. To solve this,
the `reconstruct` script is used every time we build the source package.
The script is generated by `gen-auto-reconstruct` script by the `cranky
close`. It checks if there has been any changes in the 3 categories
mentioned above between the upstream version (i.e v6.5) and the current one.
The problem with the script is that in case a file A was removed since the
upstream version was released, the `reconstruct` script will contains
these commands in this exact order:
rm -f A
chmod -x A
The second command will fail because file A does not exist anymore.
This is solved by generating the `chmod +/-x` commands before `rm`.
Which results in:
chmod -x A
rm -f A
But because the reconstruct script is used during `clean` rule which is
triggered pretty much during every cranky step which is run in the
source repo, the first command will always file because file is not
present anymore in the tree. To solve this, any `chmod` change is added
only if the file has not been deleted. Therefore if file A has been
deleted, the `reconstruct` script will contain only this:
rm -f A
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Acked-by: Manuel Diewald <manuel.diewald@canonical.com>
Acked-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Sub-flavors were a concept in Maverick and earlier. In fact, it was
removed later in Maverick but that commit was not carried forward to
Natty so it's still here. Finally get rid of it.
(forwardported from commit db54f0fec701e97b829f0abb2750c30464b38dec maverick/linux)
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Agathe Porte <agathe.porte@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Fix the following shellcheck reported issues:
- SC2145 (error): Argument mixes string and array. Use * or separate argument.
- SC2166 (warning): Prefer [ p ] && [ q ] as [ p -a q ] is not well defined.
- SC2086 (info): Double quote to prevent globbing and word splitting.
- SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"?
- SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?.
- SC2001 (style): See if you can use ${variable//search/replace} instead.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Andrei Gherzan <andrei.gherzan@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2020531
The '|=' update operator for merging dicts is available starting in
python 3.9 however in focal we have python 3.8, which causes the
annotation parsing script to crash.
Support also the old way of merging dicts available since python 3.5
that uses dict unpacking, e.g. dict1 = {**dict1, **dict2}
Signed-off-by: Luke Nowakowski-Krijger <luke.nowakowskikrijger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
All kernels and their derivatives have been migrated to the new annotations
scheme by now so clean up the tree and drop the support of the old config
handling.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
BugLink: https://bugs.launchpad.net/bugs/2015867
After enabling Rust in the kernel, the size of linux-headers increased
consistently.
Some work has been done to reduce the size, such as dropping the binary
artifacts (*.o and *.cmd), but it would be nice to keep the size of
linux-headers reasonably small to avoid wasting too much space in the
cloud images.
For this reason introduce a new package linux-lib-rust to ship all the
Rust headers and libraries required to build out-of-tree kernel modules
in Rust.
Before this patch: 96M /usr/src/linux-headers-6.2.0-21-generic
After this patch: 29M /usr/src/linux-headers-6.2.0-21-generic
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Recent kernels don't seem to set KBUILD_VERBOSE anymore, also checking
this variable to determine if we need to enable/disable Ubuntu ODM
drivers does not make any sense, so simply disable this check.
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
BugLink: http://bugs.launchpad.net/bugs/2015498
Debian source package diffs cannot represent that a file should be
executable.
gen-auto-reconstruct detects the situations where a file has changed
its permissions and restores the execute permissions in the
reconstruct script, assuming the file has always had execute permission.
This does not work in case a file removed the execute permission because
the script will change it back.
The script now adds either `chmod +x` or `chmod -x` based on the actual
permission change.
Signed-off-by: Andy Whitcroft <apw@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
Acked-by: Andrei Gherzan <andrei.gherzan@canonical.com>
Acked-by: Tim Gardner <tim.gardner@canonical.com>
Acked-by: Cory Todd <cory.todd@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
The final-checks script is doing some final ABI checkig that should be
skipped if 'do_skip_checks' is true. Just like the other checker scripts
in debian/scripts/checks.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Move the final-checks script to debian/scripts/checks so that all the
checker scripts are in one place.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
Includes are always parsed recursively, but when we save them (e.g.,
when the annotations file is updated) we should always save only the
top-level includes, without repeating the recursive ones.
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
In successful builds, ensure that log variable remains set to the
correct value, such that further processing can be done on it for the
lrm builds.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
The current code is effectively this:
set -e; (false; true) || exit "$?"
Due to historical reasons any code inside a pipeline is executed with
`set +e` mode effective, meaning false command doesn't return, the
rest of commands are executed, and the error code from () is set to
the last (usually successful) command.
This is the reason, why my previous buggy behaviour despite generating
errors inside the dkms-build--nvidia-N didn't abort the build, but
happily produced linux-nvidia-objects.deb which contained empty
SHA256SUMS file and broken BUILD CLEAN scripts that did nothing.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
In recent releases we have fixed up most dkms modules to correctly
detect, and skip building dkms modules when compiling against
incompatible kernels. For example, trying to build a WiFi driver
against a kernel without 80221 config enabled, results in dkms
returning error code 9 skipped build, due to incompatibility. Our DKMS
autopkgtests already honor such cases, and mark test results as
passing for skipped {kernel, dkms-module} combinations.
Improve kernel's dkms-build script to distinguish failed versus
skipped builds, by propagating exact status code. For standalone
skipped dkms modules, skip generating an empty deb packages.
Also do not fail over missing make.log for the skipped dkms builds,
which do not have one.
This change will enable us to use a static list of dkms-versions
across all kernels, without need to do anything special for cases were
a vendored dkms module is declared incompatible in dkms.conf for a
given kernel.
For example, v4l2loopback incompatible with cloud kernels that do not
enable CONFIG_VIDEO, or backports-iwlwifi incompatible with kvm
kernel.
This patch is tested against working, skipepd, and FTBFS dkms modules,
which correctly built the full kernel, skipped some dkms modules, or
failed the overall build.
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
kconfig: Fix pylint violations
Fix the following:
R0205: Class 'Config' inherits from object, can be safely removed from bases in python3 (useless-object-inheritance)
E1101: Instance of 'Config' has no '_parse' member (no-member)
W0613: Unused argument 'arch' (unused-argument)
W0613: Unused argument 'flavour' (unused-argument)
W1514: Using open without explicitly specifying an encoding (unspecified-encoding)
R0201: Method could be a function (no-self-use)
E1101: Instance of 'Config' has no 'config' member (no-member)
W0707: Consider explicitly re-raising using the 'from' keyword (raise-missing-from)
W0105: String statement has no effect (pointless-string-statement)
W0123: Use of eval (eval-used)
W0102: Dangerous default value [] as argument (dangerous-default-value)
R1723: Unnecessary "elif" after "break" (no-else-break)
R1705: Unnecessary "elif" after "return" (no-else-return)
R1704: Redefining argument with the local name 'arch' (redefined-argument-from-local)
Signed-off-by: Juerg Haefliger <juergh@proton.me>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
FLAVOUR_DEP is used to map flavors from the main annotations file to
flavors from includes. Currently, there is no check that any of the
listed flavors exists or is valid so the resulting behavior is
(probably) undefined/unexpected. Add a sanity check to verify the
FLAVOUR_DEP flavors.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
When writing the annotations file, separate them into two groups: With
and without a note. Write the group with notes first and separate the
other group with a visual marker.
The idea is that all configs that are set/modified manually should have
an annotation note and putting them at the top of the annotations file
should make it easier to figure out what the config of this kernel is
about.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Currently, invalid lines are silently ignored, which is not good.
Fix this by raising an exception if the line can't be parsed. While at
it, remove one level of nesting by using if-continue.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
Handle tabs in the annotations file by replacing them with spaces.
While at make the parsing more robust by removing leading and trailing
whitespaces and ignoring empty lines.
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>