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 <robin@broda.me>
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
Robin Broda 2018-05-03 09:27:03 +02:00 committed by Allan McRae
parent f173f6d0da
commit 5698d7b66d
2 changed files with 10 additions and 3 deletions

View file

@ -61,7 +61,7 @@ BUILDINFO file format.
*installed (array)*:: *installed (array)*::
The installed packages at build time including the version information of The installed packages at build time including the version information of
the package. Formatted as "$pkgname-$pkgver-$pkgrel". the package. Formatted as "$pkgname-$pkgver-$pkgrel-$pkgarch".
See Also See Also
-------- --------

View file

@ -699,8 +699,15 @@ write_buildinfo() {
write_kv_pair "buildenv" "${BUILDENV[@]}" write_kv_pair "buildenv" "${BUILDENV[@]}"
write_kv_pair "options" "${OPTIONS[@]}" write_kv_pair "options" "${OPTIONS[@]}"
local pkglist=($(run_pacman -Q | sed "s# #-#")) local pkglist=($(run_pacman -Qq))
write_kv_pair "installed" "${pkglist[@]}" 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 # build a sorted NUL-separated list of the full contents of the current