Skip to content

Commit

Permalink
Merge pull request #11197 from anonymouse64/feature/build-packages-in…
Browse files Browse the repository at this point in the history
…stead-of-override-pull

build-aux/snap/snapcraft.yaml: use build-packages, don't fail dirty builds
  • Loading branch information
mvo5 committed Jan 5, 2022
2 parents b19c7d4 + 65419fc commit 7fcec7b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ jobs:
- name: Cache built artifact
run: |
mkdir -p $(dirname "$CACHE_RESULT_STAMP")
if ls snapd*dirty*.snap > /dev/null 2>&1; then
echo "PR produces dirty snapd snap version"
unsquashfs snapd*dirty*.snap
cat squashfs-root/usr/lib/snapd/dirty-git-tree-info.txt
exit 1
fi
cp -v *.snap "$(dirname $CACHE_RESULT_STAMP)/"
- name: Uploading snapd snap artifact
uses: actions/upload-artifact@v2
Expand Down
23 changes: 16 additions & 7 deletions build-aux/snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,14 @@ parts:
plugin: nil
source: .
build-snaps: [go/1.13/stable]
# these packages are needed to call mkversion.sh in override-pull, all other
# dependencies are installed using apt-get build-dep
build-packages:
- git
- dpkg-dev
override-pull: |
snapcraftctl pull
# set version, this needs dpkg-parsechangelog (from dpkg-dev) and git
sudo -E apt-get install -y dpkg-dev git
if sh -x ./mkversion.sh --output-only | grep "dirty"; then
echo "dirty git tree during build detected:"
git status
git diff
exit 1
fi
snapcraftctl set-version "$(./mkversion.sh --output-only)"
# Ensure that ./debian/ packaging which we are about to use
# matches the current `build-base` release. I.e. ubuntu-16.04
Expand All @@ -51,6 +49,17 @@ parts:
sudo -E apt-get build-dep -y ./
./get-deps.sh --skip-unused-check
override-build: |
# TODO: when something like "craftctl get-version" is ready, then we can
# use that, but until then, we have to re-run mkversion.sh to check if the
# version number was set as "dirty" from the override-pull step
if sh -x ./mkversion.sh --output-only | grep "dirty"; then
mkdir -p $SNAPCRAFT_PART_INSTALL/usr/lib/snapd
(
echo "dirty git tree during build detected:"
git status
git diff
) > $SNAPCRAFT_PART_INSTALL/usr/lib/snapd/dirty-git-tree-info.txt
fi
# unset the LD_FLAGS and LD_LIBRARY_PATH vars that snapcraft sets for us
# as those will point to the $SNAPCRAFT_STAGE which on re-builds will
# contain things like libc and friends that confuse the debian package
Expand Down

0 comments on commit 7fcec7b

Please sign in to comment.