From 5698d7b66daa2a0bc99cab7a989cef1c806c3bf6 Mon Sep 17 00:00:00 2001 From: Robin Broda Date: Thu, 3 May 2018 09:27:03 +0200 Subject: Append architecture information to 'installed' elements in .BUILDINFO Adding the architecture to the 'installed' elements of the .BUILDINFO file makes it easier to retrieve the packages needed to reconstruct the build environment. Signed-off-by: Robin Broda Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 238d4259..14dd3eac 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -699,8 +699,15 @@ write_buildinfo() { write_kv_pair "buildenv" "${BUILDENV[@]}" write_kv_pair "options" "${OPTIONS[@]}" - local pkglist=($(run_pacman -Q | sed "s# #-#")) - write_kv_pair "installed" "${pkglist[@]}" + local pkglist=($(run_pacman -Qq)) + local pkginfos="$(LC_ALL=C run_pacman -Qi ${pkglist[@]})" + local pkginfos_parsed=($(awk -F': ' '\ + /^Name .*/ {printf $2} \ + /^Version .*/ {printf "-"$2} \ + /^Architecture .*/ {print "-"$2} \ + ' <<< "${pkginfos}")) + + write_kv_pair "installed" "${pkginfos_parsed[@]}" } # build a sorted NUL-separated list of the full contents of the current -- cgit v1.2.3-70-g09d2