Skip to content

Commit

Permalink
build source index (#27)
Browse files Browse the repository at this point in the history
include source packages into the package pool and create corresponding source index

Fixes gardenlinux/gardenlinux#2384
  • Loading branch information
nkraetzschmar authored and gehoern committed Oct 21, 2024
1 parent cfb8dc0 commit 31d1661
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
13 changes: 13 additions & 0 deletions create_dist
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,19 @@ for arch in all amd64 arm64; do
echo " $hash $size main/binary-$arch/Packages.gz" >> "$index_files"
done

dir="$target/dists/$dist/main/source"
mkdir -p "$dir"
(cd "$target" && dpkg-scansources pool) > "$dir/Sources"

size="$(wc -c "$dir/Sources" | awk '{ print $1 }')"
hash="$(sha256sum "$dir/Sources" | head -c 64)"
echo " $hash $size main/source/Sources" >> "$index_files"
gzip < "$dir/Sources" > "$dir/Sources.gz"
rm "$dir/Sources"
size="$(wc -c "$dir/Sources.gz" | awk '{ print $1 }')"
hash="$(sha256sum "$dir/Sources.gz" | head -c 64)"
echo " $hash $size main/source/Sources.gz" >> "$index_files"

date="$(date -R -u)"

cat << EOF | gpg --clearsign > "$target/dists/$dist/InRelease"
Expand Down
19 changes: 19 additions & 0 deletions download_pkgs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ find download -name "*_all.deb" -or -name "*_$arch.deb" | sort | while read -r p
cp --update=none "$pkg" "$target/pool/$hash/"
done

find download -name "*.dsc" | sort | while read -r src; do
hash="$(sha256sum < "$src" | head -c 64)"
mkdir -p "$target/pool/$hash"
cp --update=none "$src" "$target/pool/$hash/$(basename "$src")"
awk '/^Files:$/ { flag = 1; next } !/^ / { flag = 0; } flag { print $3 }' < "$src" | while read f; do
cp --update=none "download/$f" "$target/pool/$hash/$f"
done
done

rm -rf download
sort -o pkgs -u pkgs

Expand All @@ -52,6 +61,7 @@ join -v 1 <(cat arch_import_list recursive_depends | sort | uniq) pkgs | { grep

mkdir apt_download
(cd apt_download && xargs apt-get download) < recursive_needed
(cd apt_download && xargs apt-get source --download-only) < recursive_needed

find apt_download -name "*.deb" | while read -r pkg; do
hash="$(sha256sum < "$pkg" | head -c 64)"
Expand All @@ -60,4 +70,13 @@ find apt_download -name "*.deb" | while read -r pkg; do
rm "$pkg"
done

find apt_download -name "*.dsc" | while read -r src; do
hash="$(sha256sum < "$src" | head -c 64)"
mkdir -p "$target/pool/$hash"
cp --update=none "$src" "$target/pool/$hash/$(basename "$src")"
awk '/^Files:$/ { flag = 1; next } !/^ / { flag = 0; } flag { print $3 }' < "$src" | while read f; do
cp --update=none "apt_download/$f" "$target/pool/$hash/$f"
done
done

rm -rf apt_download

0 comments on commit 31d1661

Please sign in to comment.