diff options
author | Luca Boccassi <bluca@debian.org> | 2024-06-06 01:14:37 +0200 |
---|---|---|
committer | Luca Boccassi <luca.boccassi@gmail.com> | 2024-06-06 13:16:03 +0200 |
commit | b99dc98780c97a005fe0143a46562d838b55bb84 (patch) | |
tree | ffdb126edbdb1f20ca7183e24829ee7f77b75b62 | |
parent | network/ndisc: use router lifetime as one for redirect route (diff) | |
download | systemd-b99dc98780c97a005fe0143a46562d838b55bb84.tar.xz systemd-b99dc98780c97a005fe0143a46562d838b55bb84.zip |
mkosi: do a sparse checkout of debian/ubuntu packaging repo
The repository on Salsa includes the full upstream sources, which means
they are duplicated, taking extra space and showing duplicated grep results.
But we only need the debian/ subfolder, so do a sparse clone and checkout.
-rw-r--r-- | mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf | 1 | ||||
-rwxr-xr-x | mkosi.images/system/mkosi.sync | 15 |
2 files changed, 15 insertions, 1 deletions
diff --git a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf index abb55884ee..964ade7325 100644 --- a/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf +++ b/mkosi.images/system/mkosi.conf.d/10-debian-ubuntu/mkosi.conf @@ -7,6 +7,7 @@ Distribution=|ubuntu [Content] Environment= GIT_URL=https://salsa.debian.org/systemd-team/systemd.git + GIT_SUBDIR=debian GIT_BRANCH=debian/master GIT_COMMIT=5b9607385d49c09440e6e3b35c03ceec73162aec diff --git a/mkosi.images/system/mkosi.sync b/mkosi.images/system/mkosi.sync index 6856af7c6b..d21ecd1980 100755 --- a/mkosi.images/system/mkosi.sync +++ b/mkosi.images/system/mkosi.sync @@ -13,8 +13,21 @@ if [[ -d "$PKG_SUBDIR/.git" ]] && [[ "$(git -C "$PKG_SUBDIR" rev-parse HEAD)" == exit 0 fi +# The repository on Salsa has the full upstream sources, so it's a waste of space to +# redownload and duplicate everything, so do a sparse checkout as we only need the +# packaging directory anyway +if [[ -n "${GIT_SUBDIR:-}" ]]; then + sparse=(--no-checkout --filter=tree:0) +else + sparse=() +fi + if [[ ! -e "$PKG_SUBDIR" ]] || [[ -z "$(ls --almost-all "$PKG_SUBDIR")" ]]; then - git clone "$GIT_URL" --branch "$GIT_BRANCH" "$PKG_SUBDIR" + git clone "$GIT_URL" --branch "$GIT_BRANCH" "${sparse[@]}" "$PKG_SUBDIR" + if [[ -n "${GIT_SUBDIR:-}" ]]; then + # --no-cone is needed to check out only one top-level directory + git -C "$PKG_SUBDIR" sparse-checkout set --no-cone "${GIT_SUBDIR:-}" + fi else git -C "$PKG_SUBDIR" remote set-url origin "$GIT_URL" git -C "$PKG_SUBDIR" fetch origin "$GIT_BRANCH" |