Commit Graph

13 Commits

Author SHA1 Message Date
Tony Ambardar
66252aa892 scripts/kernel_bump: Fix commit text formatting
Text of a commit message body should wrap at 75 characters. Manual commits
are expected to do so, but automated commits *must* do so to avoid adding
repeated ugly commits.

Signed-off-by: Tony Ambardar <itugrok@yahoo.com>
2024-04-29 00:24:02 +02:00
Olliver Schinagl
98235e60ed scripts/kernel_bump: Delete merge commit
While we have included the needed changes via a merge commit, there is
no need to keep it. Lets drop the merge commit, which we can do as we
haven't pushed anything.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:53 +02:00
Olliver Schinagl
71c663bcfd scripts/kernel_bump: Allow bumping sub-targets
Some targets may need to bump specific sub-targets only. So lets offer
this as an option.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:53 +02:00
Olliver Schinagl
b62aafc99a scripts/kernel_bump: Use the git index to find the needed config files
The current solution using `find` introduces a racecondition, where `find`
and `git mv` get in each others way. While this could be fixed with
more-utils sponge command (or even sort -u) to buffer the output of
find.

However, a much better approach, is to query the git index directly,
which will not change, and is far more accurate.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:53 +02:00
Olliver Schinagl
8ed187e471 scripts/kernel_bump: Use git to obtain the list of files
Instead of looping of a directory to find directories related to kernel
changes, use the git index instead.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:52 +02:00
Olliver Schinagl
9e6c4392f8 scripts/kernel_bump: Allow for migrating only configuration files
In some cases, we want to only migrate configuration files, e.g. if the
kernel was bumped already. Lets add a flag for this case to offer
flexibility. By default we will migrate configuration flags as before.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:52 +02:00
Olliver Schinagl
9f0cc3eb11 scripts/kernel_bump: Run script relative to the script dir
Determine the target directory based on the script location, which might
work better in some cases, but at least also allows the script to be ran
from with any location in the OpenWRT repository.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:52 +02:00
Olliver Schinagl
f9ac106779 scripts/kernel_bump: Do no run on dirty repositories
We want to avoid starting a process when we know it will fail later.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:52 +02:00
Olliver Schinagl
ed896c32b0 scripts/kernel_bump: Improve omitted version error
If a version string was not supplied, we currently print an empty
string. We can do better here. Also by popular demand, print the usage
information in case of error.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:52 +02:00
Olliver Schinagl
03f2f530a0 scripts/kernel_bump: Always drop v prefix
Naivly and lazyly the leading v was only dropped from optarg, not from any
environment variable.

Lets do this properly and ensure a leading 'v' is always dropped.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:52 +02:00
Olliver Schinagl
1bbc249266 scripts/kernel_bump: Drop unused function
No need to keep unused empty functions. A left over from early development.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:52 +02:00
Olliver Schinagl
7b7f170216 scripts/kernel_bump: Avoid potential copyright claim
Due to potential fears of copyright infringement noted by Elliott
Mitchell [0], rewrite our message to belong to OpenWRT.

Note, AI was used to aid in construction of this sentence.

[0]: https://lists.openwrt.org/pipermail/openwrt-devel/2024-March/042422.html

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
2024-04-12 18:20:52 +02:00
Olliver Schinagl
3561015efd scripts: Kernel bumper script
For years, we have struggled and been frustrated at loosing history of
files in git, due to the 'copy + add' strategy. This could have been
prevented with a double-commit 'mv + add' trick.

On the mailing list [0] the discussion was started to put the
instructions in a wiki. Instead, it is much better to just script it and
put it in the repo.

Instead of doing mv + copy, which leads to two commits, but no history
on the copied files, it uses move, + copy and merge, which results in
three (merge) commits, but keeps the history of all files. As always
with renames, `--follow` will be needed.

The tool is trivial and works either in the OpenWrt git root directory,
or in the actual target directory.

Tested on the `realtek` and generic targets.

Note, that the tool does not do any of the labor needed after the move,
such as updating configs, dropping patches etc.

To make sure this script is easily found by any developer, who just
wants to do a kernel bump, the script is added here and not to
maintainer-tools repo as those scripts are a little bit more specialized.
Bumping a kernel is a trivial task that often regular developers do,
where most do not even know the existence of maintainer tools, are not
part of the main repo they'd clone, not part of the docker container
they'd use and so discoverability is probably much more important.

[0]: https://lists.openwrt.org/pipermail/openwrt-devel/2023-October/041673.html

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Tested-by: Robert Marko <robimarko@gmail.com>
Tested-by: Weijie Gao <hackpascal@gmail.com>
2024-03-11 09:53:01 +01:00