99 Commits

Author SHA1 Message Date
Mehmet Basaran 71075d441a UBUNTU: [Packaging] update annotations scripts
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Mehmet Basaran <mehmet.basaran@canonical.com>
2025-06-15 10:34:06 +03:00
Stefan Bader 91137688a1 UBUNTU: [Packaging] update annotations scripts
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
2025-05-19 11:20:39 +02:00
Manuel Diewald 2e00a6fe44 UBUNTU: [Packaging] resync git-ubuntu-log
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Manuel Diewald <manuel.diewald@canonical.com>
2024-11-30 19:17:26 +01:00
Magali Lemes d3e18e2b69 UBUNTU: [Packaging] Remove fips-checks script
BugLink: https://bugs.launchpad.net/bugs/2055083

This script is now part of `cranky` and there is no need for it to live
in debian/ anymore, so remove it.

Signed-off-by: Magali Lemes <magali.lemes@canonical.com>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2024-05-01 15:55:10 +02:00
Roxana Nicolescu 782e3646d1 UBUNTU: [Packaging] update annotations scripts
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
2024-05-01 15:52:58 +02:00
Masahiro Yamada 056f4386aa UBUNTU: [Packaging] remove debian/scripts/misc/arch-has-odm-enabled.sh
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>
2024-04-04 23:49:01 +02:00
Dimitri John Ledkov 5f068dd3bc UBUNTU: [Packaging] Remove in-tree abi checks
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>
2024-03-11 09:41:23 +01:00
Andrea Righi 699c70c42e UBUNTU: [Packaging] resync getabis
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:41:20 +01:00
Dimitri John Ledkov bd433ee34b UBUNTU: [Packaging] Remove all custom retpoline-extract code
BugLink: https://bugs.launchpad.net/bugs/2046440

Now that retpoline & SLS mitigration checks are enforced during build
via objtool patch, drop all custom retpoline packaging, abi files, and
checks.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:41:19 +01:00
Marcelo Henrique Cerri ac9b3fe07b UBUNTU: [Packaging] Add a new fips-checks script
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>
2024-03-11 09:41:11 +01:00
Roxana Nicolescu 6c70187239 UBUNTU: [Debian] autoreconstruct - Do not generate chmod -x for deleted files
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>
2024-03-11 09:41:09 +01:00
Andrea Righi 63a035ca10 UBUNTU: [Packaging] update annotations scripts
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:41:09 +01:00
Juerg Haefliger a457ccd24f UBUNTU: [Packaging] scripts: Rewrite insert-ubuntu-changes in Python
Jira: https://warthogs.atlassian.net/browse/KERNTT-666
Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Acked-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
2024-03-11 09:41:07 +01:00
Juerg Haefliger c016043fd3 UBUNTU: [Packaging] Remove obsolete scripts
Remove the following old scripts which are no longer used:
  - fw-to-ihex.sh
  - insert-mainline-changes
  - retag
  - sanitize-annotations
  - splitconfig.pl
  - update-aufs.sh

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>
2024-03-11 09:41:06 +01:00
Andrea Righi 0b411127d2 UBUNTU: [Packaging] update annotations scripts
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:41:04 +01:00
Paolo Pisati 8f621360fc UBUNTU: [Packaging] resync git-ubuntu-log
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
2024-03-11 09:41:03 +01:00
Andrea Righi 28cc92b2c0 UBUNTU: [Packaging] resync getabis
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:49 +01:00
Andrea Righi 81311e5461 UBUNTU: [Packaging] update annotations scripts
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:45 +01:00
Andrea Righi 047ad5bf46 UBUNTU: [Packaging] resync getabis
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:42 +01:00
Andrea Righi ce4766e520 UBUNTU: [Packaging] resync git-ubuntu-log
BugLink: https://bugs.launchpad.net/bugs/1786013
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:42 +01:00
Andrea Righi 4795aa23f8 UBUNTU: [Packaging] annotations: never drop configs that have notes different than the parent
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:41 +01:00
Andrea Righi b967072613 UBUNTU: [Packaging] kconfig/annotations.py: support older way of merging dicts
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>
2024-03-11 09:40:41 +01:00
Juerg Haefliger c66e49e483 UBUNTU: [Packaging] Drop support of old config handling
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>
2024-03-11 09:40:40 +01:00
Andrea Righi a6e925fc62 UBUNTU: [Packaging] annotations: use python3 in the shebang
Make sure to not depend on python-is-python3 and explicitly use python3
for the main script.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:38 +01:00
Andrea Righi 337c7eeb4a UBUNTU: [Packaging] ignore KBUILD_VERBOSE in arch-has-odm-enabled.sh
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>
2024-03-11 09:40:35 +01:00
Roxana Nicolescu fafa7da28c UBUNTU: [Debian] autoreconstruct - fix restoration of execute permissions
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>
2024-03-11 09:40:34 +01:00
Juerg Haefliger 2a272fbe40 UBUNTU: [Packaging] Move final-checks script to debian/scripts/checks
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>
2024-03-11 09:40:34 +01:00
Andrea Righi 281ad73637 UBUNTU: [Packaging] annotations: prevent duplicate include lines
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>
2024-03-11 09:40:33 +01:00
Andrea Righi ad500f1b65 UBUNTU: [Packaging] propagate makefile variables to kernelconfig
BugLink: https://bugs.launchpad.net/bugs/2007654

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:28 +01:00
Andrea Righi 7ecfc3dd9d UBUNTU: [Packaging] annotations: various code cleanups
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>
2024-03-11 09:40:26 +01:00
Juerg Haefliger f1781299e3 UBUNTU: [Packaging] annotations: Check validity of FLAVOUR_DEP
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>
2024-03-11 09:40:26 +01:00
Juerg Haefliger 007607d60c UBUNTU: [Packaging] annotations: Write out annotations with notes first
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>
2024-03-11 09:40:26 +01:00
Juerg Haefliger e011f2959f UBUNTU: [Packaging] annotations: Fail on invalid lines
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>
2024-03-11 09:40:26 +01:00
Juerg Haefliger 7e9800b36e UBUNTU: [Packaging] annotations: Handle tabs in annotations file
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>
2024-03-11 09:40:26 +01:00
Juerg Haefliger 7a79eea193 UBUNTU: [Packaging] annotations: Clean up policy writes
The logic to determine if policy lines need to be written to the output
file is a little convoluted. Basically, if there is no 'policy' key in
a config, there is nothing to do, so put that check at the beginning of
the loop.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:26 +01:00
Juerg Haefliger 0bd2d18b70 UBUNTU: [Packaging] annotations: Fix linter errors
Fix the following flake8 errors:
  - E127 continuation line over-indented for visual indent
  - E722 do not use bare 'except'
  - E203 whitespace before ':'
  - E201 whitespace after '{'
  - E202 whitespace before '}'
  - E713 test for membership should be 'not in'

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:26 +01:00
Juerg Haefliger 7329f4be77 UBUNTU: [Packaging] annotations: Preserve single-line annotation rules
Currently, rules with notes are written out as separate lines, i. e.,
one line for the policy and one line for the note, followed by an
empty line. The parser now supports single line rules so preserve that
style when writting out the rules.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:26 +01:00
Juerg Haefliger 0c9146f650 UBUNTU: [Packaging] annotations: Handle single-line annoation rules
The old annotations file allowed single-line rules such as:
CONFIG_FOO  policy<'amd64': 'n'> note<LP: #123456>

The new annotations parser doesn't support that, so add it.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:26 +01:00
Andrea Righi 82d666f0e3 UBUNTU: [Packaging]: annotations: fix _remove_entry() logic
Drop unnecessary delete statements and fix the code to properly remove
the entry in _remove_entry().

Reported-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:25 +01:00
Andrea Righi cce5a4b5a8 UBUNTU: [Packaging] annotations: do not drop undefined configs in derivatives
Prevent dropping configs that are undefined across all the supported
architectures in annotations that have includes, because we may want to
use them to override configs imported from other annotations.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:25 +01:00
Andrea Righi ae281486dd UBUNTU: [Packaging] annotations: make sure to always drop undefined configs
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:22 +01:00
Juerg Haefliger 59d9bce332 UBUNTU: [Packaging] debian/rules: Bring back 'editconfigs'
With the switch to the new annotations-only mechanism and the new
annotations script, the 'editconfigs' target was dropped for some
reason. It's usefull so bring it back.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:21 +01:00
Andrea Righi 31273be7e7 UBUNTU: [Packaging] annotations: add CONFIG_GCC_VERSION to the list of ignored configs
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:19 +01:00
Juerg Haefliger 228475c418 UBUNTU: [Packaging] scripts/misc/kernelconfig: Disable config checks for mainline builds
For mainline builds, all checks need to be disabled since failures can't
be tolerated/handled. For that, do_skip_checks is set to 'true' but the
new kernelconfig script doesn't honor that. Fix it.

While at it, add a header comment listing all supported environment
variables.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:19 +01:00
Juerg Haefliger 4628038f69 UBUNTU: [Packaging] scripts/misc/kernelconfig: Rewrite
The kernelconfig script evolved over a long time and accumulated quite
some cruft. With the switch to using annotations only, that got even
worse so it's time for a major overhaul. Rather than sending tons of
little patches, just rewrite the whole script and also ensure shellcheck
is happy.

No functional changes intended.

Signed-off-by: Juerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:18 +01:00
Andrea Righi 93592077df UBUNTU: [Packaging] annotations: remove configs that are undefined across all arches/flavours
Sometimes certain config options are removed in new kernels, so when
annotations is updated these options result to be undefined across all
architectures and flavours, in this case it's much more clean to simply
drop them from annotations (considering that the kernel doesn't support
them anymore).

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:14 +01:00
Andrea Righi d778032fc9 UBUNTU: [Packaging] old-kernelconfig: update config-check path
Fixes: a2e8127f516e ("UBUNTU: [Packaging] Move checker scripts to debian/scripts/checks")
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:13 +01:00
Andrea Righi 92ef1ebdb8 UBUNTU: [Packaging] annotations: unify same rule across all flavour within the same arch
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:12 +01:00
Andrea Righi b0712d8ece UBUNTU: [Packaging] kernelconfig: always complete all config checks
Do not exit immediately at the first config-check failure, make sure all
arches and flavour are checked and then reports all the failures.

Also clean up a little bit the genconfigs code.

Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:12 +01:00
Andrea Righi 3d0017e24d UBUNTU: [Packaging] annotations: do not add constraints on toolchain versions
Signed-off-by: Andrea Righi <andrea.righi@canonical.com>
2024-03-11 09:40:11 +01:00