patches and low-level development discussion
 help / color / mirror / code / Atom feed
From: Demi Marie Obenour <demiobenour@gmail.com>
To: Alyssa Ross <hi@alyssa.is>,
	Spectrum OS Development <devel@spectrum-os.org>
Subject: Re: Generating file lists from a script
Date: Mon, 1 Sep 2025 18:14:26 -0400	[thread overview]
Message-ID: <22efad63-1f09-44cc-bde6-f1a895ff4d46@gmail.com> (raw)
In-Reply-To: <875xe3zrvc.fsf@alyssa.is>


[-- Attachment #1.1.1: Type: text/plain, Size: 1404 bytes --]

On 8/31/25 06:51, Alyssa Ross wrote:
> Demi Marie Obenour <demiobenour@gmail.com> writes:
> 
>> Maintaining the lists of files and directories in the makefiles
>> is error-prone.  Would it make sense to use a script to generate
>> them from the git repository?  The script would get it right
>> every time, whereas I tend to get it wrong more times than not.
> 
> As long as we're still maintaining a list of files in the source tree,
> rather than doing something like copying whole directories, and we don't
> have to make the Makefiles less readable to accomodate the script, I
> don't mind.

Would this work?

1. Move all files meant to be included into the images into
   a subdirectory, say `image`.
2. Move the lists of files and symlinks (but not FIFOs and
   directories) into a separate file that is included by the
   main Makefile.
3. Write a script that uses `git ls-files` to generate that
   file.

I already wrote a script that is a bit over 100 lines of code.
Its only dependencies are awk, (bash OR zsh), sort, env, and
git.  I only tested it with GNU awk, GNU bash, and GNU sort,
but I expect that it should work with any awk supporting -E,
any env implementing -S, and any shell supporting -euo pipefail.

If storing the permissions of FIFOs and directories is desired,
it would be trivial to add them.
-- 
Sincerely,
Demi Marie Obenour (she/her/hers)

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 7253 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2025-09-01 22:14 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-31  2:59 Generating file lists from a script Demi Marie Obenour
2025-08-31 10:51 ` Alyssa Ross
2025-09-01 22:14   ` Demi Marie Obenour [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22efad63-1f09-44cc-bde6-f1a895ff4d46@gmail.com \
    --to=demiobenour@gmail.com \
    --cc=devel@spectrum-os.org \
    --cc=hi@alyssa.is \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://spectrum-os.org/git/crosvm
	https://spectrum-os.org/git/doc
	https://spectrum-os.org/git/mktuntap
	https://spectrum-os.org/git/nixpkgs
	https://spectrum-os.org/git/spectrum
	https://spectrum-os.org/git/ucspi-vsock
	https://spectrum-os.org/git/www

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).