70 Commits

Author SHA1 Message Date
Krzesimir Nowak
c6c67f1022 fixup! license filtering 2025-09-15 18:17:43 +02:00
Krzesimir Nowak
406d721afb some more debug 2025-09-15 18:17:03 +02:00
Krzesimir Nowak
39216d38a7 fixup! license filtering 2025-09-01 18:01:47 +02:00
Krzesimir Nowak
334935c5d8 pkg-auto: Signoff commits when syncing with Gentoo 2025-08-27 14:32:23 +02:00
Krzesimir Nowak
4107db1b6e save new state 2025-08-22 15:38:27 +02:00
Krzesimir Nowak
224811b27c license filtering 2025-08-22 15:38:27 +02:00
Krzesimir Nowak
eb0d90f895 pkg-auto: Openly declare some variables as globals 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
cf1a30501f pkg-auto: Inline generate_cache_diff_report function into call sites
After moving cache file creation and parsing, there isn't much left in
the function - it would just forward everything into the
diff_cache_data function.

It is possible that I will bring the function back under different
form later, as there is already some duplication.
2025-08-22 15:38:26 +02:00
Krzesimir Nowak
2eb4e0c323 pkg-auto: Factor out ebuild diff file and report generation 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
bd0905fb36 pkg-auto: Change the order of reading reports
No real change here, just thought it made sense to read all the old
reports first, then all the new reports.
2025-08-22 15:38:26 +02:00
Krzesimir Nowak
d43a7ad084 pkg-auto: Add missing case end 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
848ebfedeb pkg-auto: Use integer variable by name 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
892bde03a3 pkg-auto: Handle updates also in coreos-overlay and across repos 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
81c9f4cbd2 pkg-auto: Add reports for board pkgs with key-values 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
6abc91158d pkg-auto: Move a regex into a less-cryptic variable 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
00ad4b4cf2 pkg-auto: Fix generation of reports of key-value pairs
It was a grouping issue where we treated spaces before key-value pairs
as not optional. Fixing this by making them optional created another
issue, where we ran out of capture groups - sed support only 10
capture groups from \0 to \9, and the first fix caused the keyvals to
become 11th captured group. To work around this issue, I added some
non-capturing variants of some regexps and used that to reduce the
number of captured groups from 11 to 8.
2025-08-22 15:38:26 +02:00
Krzesimir Nowak
0419aa7a51 pkg-auto: Query sysext packages 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
b070764bfc ignore irrelevant stuff 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
ae2ab66421 pkg-auto: Figure out the latest stable slot for rust 2025-08-22 15:38:26 +02:00
Krzesimir Nowak
647f115757 pkg-auto: Code style changes
Mostly to avoid repeating variable names when declaring them and
initializing them.
2025-08-21 15:16:10 +02:00
Krzesimir Nowak
23b937e34b pkg-auto: Update docs of package handling functions 2025-08-21 15:16:10 +02:00
Krzesimir Nowak
23ba12f43e pkg-auto: Move and reword a comment
After the split off and adding jobs, the comment was bit outdated and
out of place, but still useful enough to keep it, but reword it and
move into a more relevant place.
2025-08-21 15:16:10 +02:00
Krzesimir Nowak
ad4eaa62c8 pkg-auto: Run package handling in jobs
This spawns some jobs, where each is waiting for messages from main
process. The message can be either a number followed by the number of
packages to handle (a batch) or command to shut down when there is no
more packages left to process. On the other hand, job can send a
message to the main process that it is done with the batch and is
ready for the next one. Any other message is printed on the terminal
by the main process.

After the packages are processed, the main process will collect and
merge the job reports into the main one.
2025-08-21 15:16:10 +02:00
Krzesimir Nowak
f5a193985c pkg-auto: More printing of current actions
This is to fill the silent moment between report generation in SDKs
and the beginning of package updates handling. Also adds missing info
about handling non-package updates.
2025-08-21 15:16:10 +02:00
Krzesimir Nowak
6668cf70b6 pkg-auto: Split off handling of a package update
There is no functional change, other than the fact that the new
function now uses the bunch of maps to access some package
information. The split off inches us closer towards running the
package handling in multiple jobs.
2025-08-21 15:16:10 +02:00
Krzesimir Nowak
078c726b50 pkg-auto: Add a "bunch of maps" struct
The purpose of this struct is to collect all the information that is
needed for handling package updates in one place. It is not really
used right now, but when the package handling is split off into a
separate function, it will come in handy as we can then pass a couple
of parameters to the new function instead of many.

Also, in future the struct will grow, when we add ignoring irrelevant
information in summary stubs or license filtering.
2025-08-21 15:16:10 +02:00
Krzesimir Nowak
f7cb37f32a pkg-auto: Drop unused functions
These functions were either inlined in those few (one?) place they
were used or just replaced.
2025-08-21 15:16:10 +02:00
Krzesimir Nowak
d4ea5e9606 pkg-auto: Diff directories based on updates directory
This is a continuation of passing the explicit location of an output
directory instead of hardcoding `${REPORTS_DIR}`.
2025-08-21 15:12:34 +02:00
Krzesimir Nowak
5eebb35b2a pkg-auto: Explicit location for package mentions in package handling
This is a step towards using different output directory in package
handling. This will be needed for the eventual package handling jobs
system, where each job has its own output directory.
2025-08-21 14:57:24 +02:00
Krzesimir Nowak
1ab38abdae pkg-auto: Explicit location for non-ebuild diffs in package handling
This is a step towards using different output directory in package
handling. This will be needed for the eventual package handling jobs
system, where each job has its own output directory.
2025-08-21 14:57:18 +02:00
Krzesimir Nowak
d0c9018fed pkg-auto: Explicit location for full diffs in package handling
This is a step towards using different output directory in package
handling. This will be needed for the eventual package handling jobs
system, where each job has its own output directory.
2025-08-21 14:57:12 +02:00
Krzesimir Nowak
772e005207 pkg-auto: Explicit location for summary stubs in package handling
This is a step towards using different output directory in package
handling. This will be needed for the eventual package handling jobs
system, where each job has its own output directory.
2025-08-21 14:57:06 +02:00
Krzesimir Nowak
5623ad1568 pkg-auto: Explicit location for changelog entry stubs in package handling
This is a step towards using different output directory in package
handling. This will be needed for the eventual package handling jobs
system, where each job has its own output directory.
2025-08-21 14:57:02 +02:00
Krzesimir Nowak
17e5e85528 pkg-auto: Explicit location for "developer warnings" in package handling
This is a step towards using different output directory in package
handling. This will be needed for the eventual package handling jobs
system, where each job has its own output directory.
2025-08-21 14:56:58 +02:00
Krzesimir Nowak
831b9e2100 pkg-auto: Explicit location for "warnings" in package handling
This is a step towards using different output directory in package
handling. This will be needed for the eventual package handling jobs
system, where each job has its own output directory.
2025-08-21 14:56:54 +02:00
Krzesimir Nowak
e9e90e7ade pkg-auto: Explicit location for "manual action needed" in package handling
This is a step towards using different output directory in package
handling. This will be needed for the eventual package handling jobs
system, where each job has its own output directory.
2025-08-21 14:55:31 +02:00
Krzesimir Nowak
864831e1ce pkg-auto: Pass paths to handle_pkg_* functions instead of slots
The slots were only used to repeatedly generate the same path to a
directory where the package ebuild diff is saved. So instead, generate
the output paths somewhere in outer scope, put them into a struct and
pass that around. That means that:

- We pass one parameter less (a name of a struct instead of two
  slots).

- We can make it easier to change the output directory later (changing
  it in a function like update_dir or update_dir_non_slot may affect
  locations we didn't want to change, whereas changing the value in
  struct scopes the affected areas). This will come in handy later,
  when we put package update handling into jobs, where each job will
  have its own output directory.

This does not remove the repeated generation of the paths, but it is a
first step.
2025-08-21 14:55:14 +02:00
Krzesimir Nowak
93a26ea067 pkg-auto: Move get_num_proc to util
This will come in handy for spawning jobs for handling package
updates. Since we don't want to spawn as many jobs as there are
packages, then limiting ourselves to the job count matching the
processor or core count sounds like a better idea.
2025-08-21 14:54:04 +02:00
Krzesimir Nowak
eb8684e88b pkg-auto: Run emerge report generation in jobs
We can run report generation for old and new in parallel in two
separate processes. Ought to be a bit less of wait.

This is more or less straightforward parallelization, since there are
only two jobs running. The only thing that needs taking care of is
forwarding job's output to the terminal and handling job failures.
2025-08-21 14:52:16 +02:00
Krzesimir Nowak
3f34011c83 pkg-auto: Add a jobs library
The library will be used for running emerge report and package update
report generation in separate processes to make them faster.

I initially wanted to use the relatively unknown feature of bash named
coprocs, but it was an unfinished feature as of bash 5.2, so I decided
to write my own then.

The library is rather basic - allows to fork a subprocess that will
run some bash function, communicate with it using subprocesses'
standard input/output, and reap the subprocess.
2025-08-21 14:50:25 +02:00
Krzesimir Nowak
45faa790cc pkg-auto: Fix occurences generation
Occurences file shows where the package name shows up in the
repository. It tries to be smart, so that checking for sys-devel/gcc
will not be showing sys-devel/gcc-config. But the smart check was
flawed as it ignored the forms like sys-devel/gcc-${PV}. Noticed when
trying to check occurences for sys-libs/libsepol and there were not
enough occurences shown.
2025-05-09 09:24:10 +02:00
Krzesimir Nowak
4bb175152f pkg-auto: Mark in-rootfs sysexts as sysexts in reports
They were showing up as "docker" or "containerd" in the reports, which
is confusing. "sysext-docker" or "sysext-containerd" makes it clear.
2025-04-30 12:45:01 +02:00
Krzesimir Nowak
1039ed0571
pkg-auto: Simplify the use of sed
Co-authored-by: James Le Cuirot <jlecuirot@microsoft.com>
2025-04-29 14:07:35 +02:00
Krzesimir Nowak
a8922be627
pkg-auto: Simplify error checking in emerge output
Co-authored-by: James Le Cuirot <jlecuirot@microsoft.com>
2025-04-29 14:07:13 +02:00
Krzesimir Nowak
ecd24bd5eb pkg-auto: Fix a shellcheck warning 2025-04-29 09:43:21 +02:00
Krzesimir Nowak
0d06b737ac pkg-auto: Disable shellcheck reference warnings
Two warnings, SC2034 and SC2178, pop up very often with the references
- shellcheck handles them poorly and produces a ton of bogus warnings
about them. Silence the warnings and drop most of the "shellcheck
disable" clauses.
2025-04-29 09:43:21 +02:00
Krzesimir Nowak
296efcdb22 pkg-auto: Add a setup for shellcheck's "source" checking
That way shellcheck sources some prepared files and learns about some
variables the sourced files define. Thanks to that, we can remove some
of the "shellcheck disable" clauses.
2025-04-29 09:43:21 +02:00
Krzesimir Nowak
13e84333b8 pkg-auto: Add md5-metadata cache diff reports to package reports 2025-04-29 09:43:21 +02:00
Krzesimir Nowak
016f35d8f5 pkg-auto: Add the md5-metadata cache diff library 2025-04-29 09:43:21 +02:00
Krzesimir Nowak
3b11e2404a pkg-auto: Add the highest-score-common-subsequence algorithm library
It's a more general variant of the longest-common-subsequence
algorithm.
2025-04-29 09:43:21 +02:00