Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(build snap): switch to the python build plugin #224

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 <[email protected]> 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/
Loading