Skip to content

Commit

Permalink
fix(build snap): switch to the python build plugin (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
st3v3nmw committed Mar 4, 2024
1 parent 397a7a1 commit 826d63f
Showing 1 changed file with 11 additions and 35 deletions.
46 changes: 11 additions & 35 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ architectures:
- build-on: [s390x]
confinement: strict

environment:
LANDSCAPE_CLIENT_SNAP: 1
PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$SNAP/usr/lib/python3.10/site-packages:$PYTHONPATH

apps:
landscape-client:
daemon: simple
Expand All @@ -35,16 +39,9 @@ apps:
- snapd-control
- system-observe
- account-control
environment:
LANDSCAPE_CLIENT_SNAP: 1
PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$PYTHONPATH
config:
command: usr/bin/landscape-config
plugs: [network]
environment:
LANDSCAPE_CLIENT_SNAP: 1
PYTHONPATH: $SNAP/usr/lib/python3/dist-packages:$PYTHONPATH

layout:
/etc/landscape-client.conf:
bind-file: $SNAP_COMMON/etc/landscape-client.conf
Expand All @@ -53,19 +50,11 @@ layout:
/var/log/landscape:
bind: $SNAP_DATA/var/log/landscape

package-repositories:
- type: apt
ppa: landscape/self-hosted-beta

parts:
landscape-client:
plugin: dump
plugin: python
source: .
source-type: local # Don't use 'git' - it forces you to commit your changes
build-packages:
- debhelper
- devscripts
- dh-python
- gawk
- libdistro-info-perl
- lsb-release
Expand All @@ -83,21 +72,8 @@ parts:
- locales-all
- python3-dbus
override-build: |
git commit -n -a -m "dev build for snap" --no-gpg-sign --allow-empty
cat << EOF > debian/changelog
landscape-client (0.0.1) UNRELEASED; urgency=medium
* Test build for snap
-- Guy Incognito <guy.incognito@landscape.client> Fri, 1 Sep 2023 00:00:00 +0000
EOF
mkdir -p landscape-client-0.0.1
git ls-files --recurse-submodules | xargs -I {} cp -r --parents {} landscape-client-0.0.1/
rm -rf landscape-client-0.0.1/debian
tar -czf landscape-client-0.0.1.tar.gz landscape-client-0.0.1
cp -r debian landscape-client-0.0.1
cd landscape-client-0.0.1 && debuild -b --no-sign
cp ../landscape-*_0.0.1_*.deb $CRAFT_PART_INSTALL
make build
python3 setup.py install --prefix ${SNAPCRAFT_PRIME}/usr
stage-packages:
- adduser
- bc
Expand All @@ -116,8 +92,8 @@ parts:
- python3-twisted
- python3-dbus
- ubuntu-advantage-tools
override-prime: |
override-stage: |
craftctl default
rm $CRAFT_PRIME/landscape-*_0.0.1_*.deb
dpkg-deb -x $CRAFT_STAGE/landscape-common_0.0.1_*.deb $CRAFT_PRIME
dpkg-deb -x $CRAFT_STAGE/landscape-client_0.0.1_*.deb $CRAFT_PRIME
# Copy the scripts over
mkdir -p ${SNAPCRAFT_PRIME}/usr/bin/
cp -r ${SNAPCRAFT_PART_SRC}/scripts/. ${SNAPCRAFT_PRIME}/usr/bin/

0 comments on commit 826d63f

Please sign in to comment.