Skip to content

Commit 19af738

Browse files
authored
Add new 'source manifest' output (#133)
This outputs a list of **source** packages used in the image. This is needed for GLVD. The list does not contain version numbers, and is de-duplicated, so if one source package is used to create multiple binary packages in the image, it will appear only once. See gardenlinux/glvd#189 for more details
1 parent 80c3880 commit 19af738

File tree

4 files changed

+21
-4
lines changed

4 files changed

+21
-4
lines changed

builder/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,5 @@ $(foreach artifact_rule,$(shell ./make_get_artifact_rules),$(eval $(call artifac
106106
ln -f -s -r '$<' '.build/$*'
107107

108108
# prevents match anything rule from applying to Makefile and image/convert scripts
109-
Makefile image image.release image.manifest image.requirements $(shell find features -name 'convert.*' -o -name image -o -name 'image.*'):
109+
Makefile image image.release image.manifest image.sourcemanifest image.requirements $(shell find features -name 'convert.*' -o -name image -o -name 'image.*'):
110110
true

builder/image.sourcemanifest

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
set -eufo pipefail
4+
5+
chroot_dir="$(mktemp -d)"
6+
mount -t tmpfs tmpfs "$chroot_dir"
7+
tar --extract --xattrs --xattrs-include '*' --directory "$chroot_dir" < "$1"
8+
9+
mount --rbind --make-rslave /proc "$chroot_dir/proc"
10+
11+
#shellcheck disable=SC2016
12+
chroot "$chroot_dir" dpkg-query --show --showformat='${source:Package}\n' | sort | uniq > "$2"
13+
14+
umount -l "$chroot_dir/proc"
15+
16+
umount "$chroot_dir"
17+
rmdir "$chroot_dir"

builder/make_get_artifact_rules

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
set -euo pipefail
44
shopt -s nullglob
55

6-
extensions=(release manifest requirements raw)
6+
extensions=(release manifest sourcemanifest requirements raw)
77

88
for feature in "features/"*; do
99
for i in "$feature/"{image,convert}.*; do

builder/make_list_build_artifacts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ cname="$1"
77

88
IFS=',' read -r -a features < <(./parse_features --allow-frankenstein --feature-dir features --cname "$cname" features)
99

10-
artifacts=(".build/$cname-$COMMIT.tar" ".build/$cname-$COMMIT.release" ".build/$cname-$COMMIT.manifest" ".build/$cname-$COMMIT.requirements")
10+
artifacts=(".build/$cname-$COMMIT.tar" ".build/$cname-$COMMIT.release" ".build/$cname-$COMMIT.manifest" ".build/$cname-$COMMIT.sourcemanifest" ".build/$cname-$COMMIT.requirements")
1111

1212
for feature in "${features[@]}"; do
1313
for i in "features/$feature/"{image,convert}.*; do
@@ -18,7 +18,7 @@ for feature in "${features[@]}"; do
1818
done
1919
done
2020

21-
if [ "${#artifacts[@]}" = 4 ] && [ -n "$(./parse_features --allow-frankenstein --feature-dir "features" --cname "$cname" platforms)" ]; then
21+
if [ "${#artifacts[@]}" = 5 ] && [ -n "$(./parse_features --allow-frankenstein --feature-dir "features" --cname "$cname" platforms)" ]; then
2222
artifacts+=(".build/$cname-$COMMIT.raw")
2323
fi
2424

0 commit comments

Comments
 (0)