* [PATCH v2] scripts/archive-source: find directory name for subprojects
@ 2024-10-11 8:35 Paolo Bonzini
2024-10-11 12:12 ` Peter Maydell
0 siblings, 1 reply; 2+ messages in thread
From: Paolo Bonzini @ 2024-10-11 8:35 UTC (permalink / raw)
To: qemu-devel; +Cc: peter.maydell
Rust subprojects have the semantic version (followed by -rs) in the subproject
name, but the full version (without -rs) is used by crates.io for the root
directory of the tarball. Teach scripts/archive-source.sh to look for the
root directory name in wrap files.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
v1->v2:
- put local dir on separate line
- use :- to print default even if $dir is empty
- use error function and invert "if test -f" condition
- simplify sed script to avoid jumps
scripts/archive-source.sh | 23 ++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)
diff --git a/scripts/archive-source.sh b/scripts/archive-source.sh
index 65af8063e4b..3f9c51ce2cb 100755
--- a/scripts/archive-source.sh
+++ b/scripts/archive-source.sh
@@ -48,13 +48,34 @@ function tree_ish() {
echo "$retval"
}
+function subproject_dir() {
+ if test ! -f "subprojects/$1.wrap"; then
+ error "scripts/archive-source.sh should only process wrap subprojects"
+ fi
+
+ # Print the directory key of the wrap file, defaulting to the
+ # subproject name. The wrap file is in ini format and should
+ # have a single section only. There should be only one section
+ # named "[wrap-*]", which helps keeping the script simple.
+ local dir
+ dir=$(sed -n \
+ -e '/^\[wrap-[a-z][a-z]*\]$/,/^\[/{' \
+ -e '/^directory *= */!b' \
+ -e 's///p' \
+ -e 'q' \
+ -e '}' \
+ "subprojects/$1.wrap")
+
+ echo "${dir:-$1}"
+}
+
git archive --format tar "$(tree_ish)" > "$tar_file"
test $? -ne 0 && error "failed to archive qemu"
for sp in $subprojects; do
meson subprojects download $sp
test $? -ne 0 && error "failed to download subproject $sp"
- tar --append --file "$tar_file" --exclude=.git subprojects/$sp
+ tar --append --file "$tar_file" --exclude=.git subprojects/"$(subproject_dir $sp)"
test $? -ne 0 && error "failed to append subproject $sp to $tar_file"
done
exit 0
--
2.46.2
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] scripts/archive-source: find directory name for subprojects
2024-10-11 8:35 [PATCH v2] scripts/archive-source: find directory name for subprojects Paolo Bonzini
@ 2024-10-11 12:12 ` Peter Maydell
0 siblings, 0 replies; 2+ messages in thread
From: Peter Maydell @ 2024-10-11 12:12 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-devel
On Fri, 11 Oct 2024 at 09:35, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> Rust subprojects have the semantic version (followed by -rs) in the subproject
> name, but the full version (without -rs) is used by crates.io for the root
> directory of the tarball. Teach scripts/archive-source.sh to look for the
> root directory name in wrap files.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
thanks
-- PMM
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-10-11 17:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-11 8:35 [PATCH v2] scripts/archive-source: find directory name for subprojects Paolo Bonzini
2024-10-11 12:12 ` Peter Maydell
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).