diff mbox series

[kteam-tools,v2,5/5] cranky: master -- getabis: Preserve ABI repo layout with new buildinfo packages

Message ID 20210610080807.25518-6-juergh@canonical.com
State New
Headers show
Series Use modinfo data for the ABI | expand

Commit Message

Juerg Haefliger June 10, 2021, 8:08 a.m. UTC
Newer buildinfo packages provide modules and modules.builtin directories
containing one file per module with modinfo data rather than a single file
with the list of modules. That is a lot of additional data that we don't
need in the repo so convert the content of the buildinfo package so that
the ABI modules layout is preserved.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
---
 cranky/master/getabis | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/cranky/master/getabis b/cranky/master/getabis
index ebe4c4abdbc0..57e3e36846ca 100755
--- a/cranky/master/getabis
+++ b/cranky/master/getabis
@@ -150,7 +150,27 @@  getall_set()
 			do
 				mv "$base/$comp" "$abidir/$arch/$sub.$comp"
 			done
-			cat "$base/fwinfo" >>"$fwinfo"
+			# fwinfo might no longer be provided
+			if [ -f "$base/fwinfo" ] ; then
+				cat "$base/fwinfo" >> "$fwinfo"
+			fi
+			# Handle new modules.builtin
+			if [ -e "$base/modules.builtin" ] ; then
+				mv "$base/modules.builtin" "$abidir/$arch/$sub.modules.builtin"
+			fi
+			# Convert the new-style module directories to preserve the
+			# existing ABI layout in the repo
+			for comp in modules modules.builtin ; do
+				mdir="$abidir/$arch/$sub.$comp"
+				if [ -d "$mdir" ] ; then
+					# Reconstruct fwinfo
+					grep -he '^firmware:' "$mdir"/* >> "$fwinfo"
+					# Reconstruct modules and modules.builtin files
+					ls -1 "$mdir" > "$mdir.tmp"
+					rm -rf "$mdir"
+					mv  "$mdir.tmp" "$mdir"
+				fi
+			done
 		fi
 		rm -rf tmp $filenames
 		echo "  done"