So I spent the night trying to figure out how the manual build process works using a yaml. And I have a huge headache now.
Anyway I created a yaml that does actually work at least locally on my machine. It creates a snap that I can start using snap run appname
. And of course now I would like to use the automated build process that is triggered when I push the yaml to Github.
But when I do that and the snap being built remotely the same yaml provokes an error I just can’t get rid of.
Here is my yaml:
snapcraft.yaml
name: sleek
base: core18
version: '0.2.1'
summary: A simple todo manager based on the concept of todo.txt
description: |
sleek is a simple todo manager based on the concept of todo.txt. That means you will use a simple but powerful syntax to add contexts and projects to your todos, you will prioritize them and set due dates. According to this input you will be able to filter and search your todos. There is no cloud integration, but as sleek writes your data to a plain text file, you can put it anywhere you want. That also means if you don't have sleek at hand or if you don't like it anymore you can just edit the todo.txt file with any text editor or other todo.txt application.
grade: stable
confinement: strict
icon: ./assets/icons/icon.png
license: MIT
architectures:
- build-on: [amd64, arm64, s390x, ppc64el, armhf]
run-on: [amd64, arm64, s390x, ppc64el, armhf]
apps:
sleek:
command: snap/command-chain/desktop-launch $SNAP/sleek/sleek --no-sandbox
extensions: [gnome-3-28]
plugs:
- browser-support
parts:
sleek:
plugin: nodejs
nodejs-package-manager: npm
nodejs-version: 15.2.1
build-snaps:
- node/15/stable
source: .
override-build: |
case $SNAPCRAFT_ARCH_TRIPLET in
"i386-linux-gnu") ARCH="ia32";;
"x86_64-linux-gnu") ARCH="x64";;
"arm-linux-gnueabihf") ARCH="armv7l";;
"aarch64-linux-gnu") ARCH="arm64";;
*) echo "ERROR: electron does not support the '$SNAPCRAFT_ARCH_TRIPLET' architecture" && exit 1;;
esac
npm install electron-packager
./node_modules/.bin/electron-packager . --overwrite --platform=linux --arch=$ARCH --output=release-build --prune=true
cp -v -R ./sleek-linux-$ARCH/ $SNAPCRAFT_PART_INSTALL/sleek
stage-packages:
- libnss3
build-packages:
- nodejs
- npm
cleanup:
after:
- sleek
plugin: nil
build-snaps:
- core18
override-prime: |
set -eux
for snap in "core18"; do # List all content-snaps and base snaps you're using here
cd "/snap/$snap/current" && find . -type f,l -exec rm -f "$SNAPCRAFT_PRIME/{}" \;
done
This creates this error which interrupts the build process:
extract from build error
[27/Nov/2020:10:49:58 +0000] "CONNECT registry.npmjs.org:443 HTTP/1.1" 200 3935327 "-" "-"
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
[27/Nov/2020:10:50:02 +0000] "CONNECT registry.npmjs.org:443 HTTP/1.1" 200 44891837 "-" "-"
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
[27/Nov/2020:10:53:39 +0000] "CONNECT github.com:443 HTTP/1.1" 200 7206 "-" "node/v15.3.0 node-sass-installer/5.0.0"
[27/Nov/2020:10:53:47 +0000] "CONNECT github-production-release-asset-2e65be.s3.amazonaws.com:443 HTTP/1.1" 200 3404291 "https://github.com/sass/node-sass/releases/download/v5.0.0/linux-x64-88_binding.node" "node/v15.3.0 node-sass-installer/5.0.0"
npm ERR! code 1
npm ERR! path /build/sleek/parts/sleek/build/node_modules/electron
npm ERR! command failed
npm ERR! command sh -c node install.js
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-11-27T10_53_47_695Z-debug.log
Failed to run 'override-build': Exit code was 1.
Build failed
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 258, in run
self.build()
File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 247, in build
env=env)
File "/usr/lib/python3/dist-packages/lpbuildd/target/build_snap.py", line 100, in run_build_command
return self.backend.run(args, env=full_env, **kwargs)
File "/usr/lib/python3/dist-packages/lpbuildd/target/lxd.py", line 537, in run
subprocess.check_call(cmd, **kwargs)
File "/usr/lib/python3.6/subprocess.py", line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['lxc', 'exec', 'lp-bionic-amd64', '--env', 'LANG=C.UTF-8', '--env', 'SHELL=/bin/sh', '--env', 'SNAPCRAFT_BUILD_INFO=1', '--env', 'SNAPCRAFT_IMAGE_INFO={"build-request-id": "lp-60699626", "build-request-timestamp": "2020-11-27T10:32:04Z", "build_url": "https://launchpad.net/~build.snapcraft.io/+snap/0bd466522b32144f4aca7878faa1937b/+build/1196432"}', '--env', 'SNAPCRAFT_BUILD_ENVIRONMENT=host', '--env', 'http_proxy=http://10.10.10.1:8222/', '--env', 'https_proxy=http://10.10.10.1:8222/', '--env', 'GIT_PROXY_COMMAND=/usr/local/bin/snap-git-proxy', '--', '/bin/sh', '-c', 'cd /build/sleek && linux64 snapcraft']' returned non-zero exit status 2.
Revoking proxy token...
RUN: /usr/share/launchpad-buildd/bin/in-target scan-for-processes --backend=lxd --series=bionic --arch=amd64 SNAPBUILD-1196432
Scanning for processes to kill in build SNAPBUILD-1196432
My package.json looks like this
package.json
{
"name": "sleek",
"productName": "sleek",
"version": "0.2.1",
"description": "A simple todo manager based on the concept of todo.txt",
"synopsis": "A simple todo manager based on the concept of todo.txt",
"category": "ProjectManagement",
"keywords": [
"todo.txt",
"todo",
"productivity",
"tasks"
],
"author": "Robin Ahle <mail@robbfolio.de>",
"copyright": "Copyright © 2020 ${author}",
"license": "MIT",
"repository": "https://github.com/ransome1/sleek/",
"icon": "assets/icons/512x512.png",
"main": "src/index.js",
"buildResources": "src",
"build": {
"appId": "com.sleek.desktop",
"linux": {
"icon": "assets/icons/512x512.png",
"category": "ProjectManagement",
"target": [
"deb",
"pacman",
"freebsd",
"rpm",
"AppImage"
]
},
"win": {
"target": [
"portable"
],
"icon": "assets/icons/512x512.ico"
},
"mac": {
"target": "dmg",
"icon": "assets/icons/512x512.icns",
"category": "public.app-category.productivity"
}
},
"appImage": {
"artifactName": "${productName}-${version}-${arch}.${ext}"
},
"rpm": {
"artifactName": "${productName}-${version}-${arch}.${ext}"
},
"freebsd": {
"artifactName": "${productName}-${version}-${arch}.${ext}"
},
"snap": {
"confinement": "strict",
"grade": "stable"
},
"scripts": {
"pack": "electron-builder --dir",
"dist": "electron-builder -l --publish never",
"snap": "electron-builder -l snap --arm64 --publish always",
"css-build": "node-sass src/scss/ --output src/css/",
"css-watch": "npm run css-build -- --watch",
"start": "npm run css-watch & electron .",
"build": "electron-packager ."
},
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.1",
"electron-squirrel-startup": "^1.0.0",
"electron-util": "^0.14.2",
"i18next": "^19.8.4",
"i18next-browser-languagedetector": "^6.0.1",
"i18next-fs-backend": "^1.0.7",
"md5": "^2.3.0"
},
"devDependencies": {
"bulma": "^0.9.1",
"electron": "11.0.3",
"electron-builder": "^22.9.1",
"node-sass": "^5.0.0"
}
}
Can anybody take a quick look at this and give me a little push into the right direction?
Best