Skip to content

Commit

Permalink
snapcraft.yaml.template
Browse files Browse the repository at this point in the history
  • Loading branch information
janesser committed Jan 4, 2025
1 parent ab8bc96 commit 1158794
Show file tree
Hide file tree
Showing 6 changed files with 80 additions and 7 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
# snapcraft specifics
parts
stage
prime
*.snap
.snapcraft
__pycache__
*.pyc

# generated
snap/snapcraft.yaml
11 changes: 11 additions & 0 deletions eclipse-packages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# all sources should have &r=1 amended
latest: 2024-12R
2024-12R:
eclipse-java:
amd64:
source: https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2024-12/R/eclipse-java-2024-12-R-linux-gtk-x86_64.tar.gz&r=1
checksum: "sha512/dae3fdace259f237afaadad98ac3c16bf571eb7e2704200e5159de9a6bde594c4112e983dd0eac3c35c0fd5325f1cf9d798e2fd511a5059fc02ceca71391927c"
eclipse-pde:
amd64:
source: https://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/2024-12/R/eclipse-committers-2024-12-R-linux-gtk-x86_64.tar.gz&r=1
checksum: "sha512/133dfeb699fe604c24d96ec521dfb201196505eaceaefd62f1d00e5d87953ee224839f113a1603c4c8dfec433155827c2d175a5ad838e6d32a7dd477a728c620"
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
yglu
setuptools
19 changes: 19 additions & 0 deletions set-eclipse-package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
SOURCE=$(dirname -- ${BASH_SOURCE[0]})
echo source-root: $SOURCE

export ECLIPSE_PACKAGE=${ECLIPSE_PACKAGE:='eclipse-java'}
echo setting up for $ECLIPSE_PACKAGE
export ECLIPSE_ARCH=${ECLIPSE_ARCH:=`dpkg --print-architecture`}
echo target arch is $ECLIPSE_ARCH

SNAPCRAFT_YAML=$SOURCE/snap/snapcraft.yaml

YGLU_ENABLE_ENV=true pipx run --pip-args "-r requirements.txt" yglu snapcraft.yaml.template | tee $SNAPCRAFT_YAML

if [ $? -eq 0 ]; then
echo written $SNAPCRAFT_YAML for $ECLIPSE_PACKAGE.
else
echo ERROR see above.
return 1
fi
19 changes: 12 additions & 7 deletions snap/snapcraft.yaml → snapcraft.yaml.template
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: eclipse
ename: !- $env[ECLIPSE_PACKAGE]
earch: !- $env[ECLIPSE_ARCH]
epackages: !- $import('eclipse-packages.yaml')

name: !? .ename
base: core22

version: 2024-12
version: !? .epackages.latest

summary: Extensible Tool Platform and Java IDE
website: https://eclipse.org/ide
description:
Expand All @@ -18,15 +23,15 @@ architectures:
- build-on: arm64

apps:
eclipse:
!? .ename:
command: bin/eclipse-wrapper

parts:
eclipse:
plugin: dump
source:
- on amd64: https://download.eclipse.org/technology/epp/downloads/release/${SNAPCRAFT_PROJECT_VERSION}/R/eclipse-java-${SNAPCRAFT_PROJECT_VERSION}-R-linux-gtk-x86_64.tar.gz
- on arm64: https://download.eclipse.org/technology/epp/downloads/release/${SNAPCRAFT_PROJECT_VERSION}/R/eclipse-java-${SNAPCRAFT_PROJECT_VERSION}-R-linux-gtk-aarch64.tar.gz
source-type: tar
source: !? $_.epackages[$_.version][$_.name][$_.earch].source
source-checksum: !? $_.epackages[$_.version][$_.name][$_.earch].checksum
organize:
'configuration': 'usr/lib/eclipse/configuration'
'dropins': 'usr/lib/eclipse/dropins'
Expand Down Expand Up @@ -70,6 +75,6 @@ parts:

lint:
ignore:
- classic
- classic # open sandbox paradoxon
- library:
- usr/lib/**/*.so*
26 changes: 26 additions & 0 deletions try-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash
set -e

if [ -n $1 ]; then
ECLIPSE_PACKAGE=$1
fi

export ECLIPSE_PACKAGE=${ECLIPSE_PACKAGE:='eclipse-java'}
export ECLIPSE_ARCH=${ECLIPSE_ARCH:=`dpkg --print-architecture`}

. ./set-eclipse-package.sh

CLEAN=${CLEAN:=false}

if $CLEAN; then
sudo snap remove --purge $ECLIPSE_PACKAGE
snapcraft clean
fi

# sudo less /var/snap/lxd/common/lxd/logs/lxd.log
snapcraft pack --debug

AUTORUN=${AUTORUN:=false}
if $AUTORUN; then
snap run $ECLIPSE_PACKAGE &
fi

0 comments on commit 1158794

Please sign in to comment.