FDS/OS 1.0 fixes
This commit is contained in:
@@ -30,31 +30,65 @@ expect_failure 'unsupported bootstrap option' tools/bootstrap-host --unknown
|
||||
|
||||
# Use a disposable minimal checkout to exercise pin and dirty-tree detection.
|
||||
mkdir -p "$scratch/repo/tools" "$scratch/repo/vendor/void-packages"
|
||||
cp tools/lib.sh tools/prepare-void "$scratch/repo/tools/"
|
||||
cp tools/lib.sh tools/prepare-void tools/prepare-void-workspace "$scratch/repo/tools/"
|
||||
fake="$scratch/repo/vendor/void-packages"
|
||||
git -C "$fake" init -q
|
||||
printf '# fixture\n' >"$fake/xbps-src"
|
||||
mkdir -p "$fake/srcpkgs/fds-upstream" "$fake/etc" "$scratch/repo/config" "$scratch/repo/packages/fds-fixture"
|
||||
printf '# upstream\n' >"$fake/srcpkgs/fds-upstream/template"
|
||||
printf 'etc/conf\n' >"$fake/.gitignore"
|
||||
printf 'etc/conf\nhostdir/\nmasterdir-*/\n' >"$fake/.gitignore"
|
||||
cp config/xbps-src.conf "$scratch/repo/config/"
|
||||
printf '# inert overlay fixture\n' >"$scratch/repo/packages/fds-fixture/template"
|
||||
git -C "$fake" add .
|
||||
git -C "$fake" -c user.name=FDS -c user.email=test@example.invalid commit -qm fixture
|
||||
git -C "$fake" rev-parse HEAD >"$scratch/repo/VOID_PACKAGES_COMMIT"
|
||||
bash -c 'source "$1"; check_void_pin' _ "$scratch/repo/tools/lib.sh"
|
||||
bash -c 'source "$1"; check_void_source' _ "$scratch/repo/tools/lib.sh"
|
||||
printf 'PASS: accepts exact clean Void commit\n'
|
||||
# Existing generated files and caches move without copying their payloads.
|
||||
cp -a "$scratch/repo/packages/fds-fixture" "$fake/srcpkgs/"
|
||||
cp config/xbps-src.conf "$fake/etc/conf"
|
||||
mkdir -p "$fake/hostdir" "$fake/masterdir-x86_64"
|
||||
printf 'cached input\n' >"$fake/hostdir/cache"
|
||||
cache_inode=$(stat -c %i "$fake/hostdir/cache")
|
||||
"$scratch/repo/tools/prepare-void"
|
||||
cmp "$scratch/repo/packages/fds-fixture/template" "$fake/srcpkgs/fds-fixture/template"
|
||||
build="$scratch/repo/.host/void-packages"
|
||||
[[ -z $(git -C "$fake" status --porcelain --untracked-files=all) ]] || die 'Migration dirtied upstream'
|
||||
[[ ! -e $fake/hostdir && ! -e $fake/etc/conf && ! -e $fake/srcpkgs/fds-fixture ]] || die 'Migration left build state in upstream'
|
||||
[[ $(stat -c %i "$build/hostdir/cache") == "$cache_inode" ]] || die 'Migration copied cache data'
|
||||
[[ ! -f $build/.git/objects/info/alternates ]] || die 'Build checkout depends on upstream object storage'
|
||||
bash -c 'source "$1"; check_void_pin' _ "$scratch/repo/tools/lib.sh"
|
||||
cmp "$scratch/repo/packages/fds-fixture/template" "$build/srcpkgs/fds-fixture/template"
|
||||
"$scratch/repo/tools/prepare-void"
|
||||
printf 'PASS: overlay copied and repeat preparation is idempotent\n'
|
||||
printf 'PASS: overlays and caches moved outside clean upstream; preparation is idempotent\n'
|
||||
printf '# changed\n' >>"$scratch/repo/packages/fds-fixture/template"
|
||||
expect_failure 'stale generated overlay' "$scratch/repo/tools/prepare-void"
|
||||
cp "$fake/srcpkgs/fds-fixture/template" "$scratch/repo/packages/fds-fixture/template"
|
||||
cp "$build/srcpkgs/fds-fixture/template" "$scratch/repo/packages/fds-fixture/template"
|
||||
# Preserve unexpected upstream additions and independently edited legacy copies.
|
||||
printf 'personal source\n' >"$fake/personal-file"
|
||||
expect_failure 'unknown upstream addition' "$scratch/repo/tools/prepare-void"
|
||||
[[ -f $fake/personal-file ]] || die 'Unknown file was removed'
|
||||
rm "$fake/personal-file"
|
||||
cp -a "$scratch/repo/packages/fds-fixture" "$fake/srcpkgs/"
|
||||
printf '# independent edit\n' >>"$fake/srcpkgs/fds-fixture/template"
|
||||
expect_failure 'edited legacy overlay' "$scratch/repo/tools/prepare-void"
|
||||
grep -q 'independent edit' "$fake/srcpkgs/fds-fixture/template"
|
||||
rm -r "$fake/srcpkgs/fds-fixture"
|
||||
# An explicit upstream pin update advances the build checkout and keeps caches.
|
||||
printf 'new upstream revision\n' >"$fake/README"
|
||||
git -C "$fake" add README
|
||||
git -C "$fake" -c user.name=FDS -c user.email=test@example.invalid commit -qm update
|
||||
git -C "$fake" rev-parse HEAD >"$scratch/repo/VOID_PACKAGES_COMMIT"
|
||||
# Production initializes upstream with depth 1; updating that boundary must work.
|
||||
git -C "$fake" rev-parse HEAD >"$fake/.git/shallow"
|
||||
expect_failure 'outdated build checkout' bash -c 'source "$1"; check_void_pin' _ "$scratch/repo/tools/lib.sh"
|
||||
"$scratch/repo/tools/prepare-void"
|
||||
[[ $(stat -c %i "$build/hostdir/cache") == "$cache_inode" ]] || die 'Pin update replaced cache'
|
||||
[[ $(git -C "$build" rev-parse HEAD) == "$(cat "$scratch/repo/VOID_PACKAGES_COMMIT")" ]] || die 'Build pin not advanced'
|
||||
mkdir -p "$scratch/repo/packages/fds-upstream"
|
||||
printf '# collision\n' >"$scratch/repo/packages/fds-upstream/template"
|
||||
expect_failure 'overlay replacing upstream package' "$scratch/repo/tools/prepare-void"
|
||||
printf '# changed config\n' >>"$fake/etc/conf"
|
||||
rm -r "$scratch/repo/packages/fds-upstream"
|
||||
printf '# changed config\n' >>"$build/etc/conf"
|
||||
expect_failure 'overwriting local xbps configuration' "$scratch/repo/tools/prepare-void"
|
||||
printf '\n# dirty\n' >>"$fake/xbps-src"
|
||||
expect_failure 'modified Void source' bash -c 'source "$1"; check_void_pin' _ "$scratch/repo/tools/lib.sh"
|
||||
|
||||
Reference in New Issue
Block a user