Re: [PATCH v7] Generate file lists from a script

Alyssa Ross
2025-10-01T09:35:31Z

[-- Attachment #1: Type: text/plain, Size: 1539 bytes --]

Demi Marie Obenour <demiobenour@gmail.com> writes:

> diff --git a/scripts/genfiles.sh b/scripts/genfiles.sh
> new file mode 100755
> index 0000000000000000000000000000000000000000..5bee72ec72bc3aeb5b2e1db26721664858661d35
> --- /dev/null
> +++ b/scripts/genfiles.sh
> @@ -0,0 +1,26 @@
> +#!/bin/sh --
> +# SPDX-License-Identifier: EUPL-1.2+
> +# SPDX-FileCopyrightText: 2025 Demi Marie Obenour <demiobenour@gmail.com>
> +set -euo pipefail
> +export LC_ALL=C LANGUAGE=C
> +dir=$(git rev-parse --show-toplevel)

shellcheck points out that this variable is never used. I'm not sure
whether you'd prefer to remove it, or re-add the cd, so please submit a
new version with your preferred behavior.

With that and DIRS reinstated in vm/sys/net:

Reviewed-by: Alyssa Ross <hi@alyssa.is>

> +for i in host/rootfs img/app vm/sys/net; do
> + output_file=$i/file-list.mk
> + {
> + git -C "$i" -c core.quotePath=true ls-files $'--format=%(objectmode)\t%(path)' -- image |
> + sort -t $'\t' -k 2
> + } |
> + awk -f scripts/genfiles.awk > "$output_file.tmp"
> + if [ -f "$output_file" ]; then
> + # Avoid changing output file if it is up to date, as that
> + # would cause unnecessary rebuilds.
> + if cmp -s -- "$output_file.tmp" "$output_file"; then
> + rm -- "$output_file.tmp"
> + continue
> + else
> + astatus=$?
> + if [ "$astatus" != 1 ]; then exit "$astatus"; fi
> + fi
> + fi
> + mv -- "$output_file.tmp" "$output_file"
> +done

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]