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

dexc-desktop: Snap package #2580

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

peterzen
Copy link
Member

@peterzen peterzen commented Oct 26, 2023

This PR adds configuration, build scripts and Github workflow to build the Snap package and publishing it in the Snap Store.

The snap build uses the .deb package. The PR also contains a few fixes/improvements in the deb build:

  • Icons: added SVG icon for hicolor and symbolic variations, fixed 128px PNG to match official version
  • icon install location changed to /usr/share/icons which is the XDG standard
  • binary installs in /usr/bin directly (this is standard practice, simplifies deb scripts)
  • added AppStream metainfo file (for GNOME/KDE/Ubuntu software centers and the snap)

Copy link
Member

@JoeGruffins JoeGruffins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting an error when running ./pkg/pkg-debian.sh:

dpkg-deb: error: parsing file './build/dexc_bf46fe348fb83893408e875408499761a3df5ea4-0_amd64/DEBIAN/control' near line 2 package 'dexc':
 'Version' field value 'bf46fe348fb83893408e875408499761a3df5ea4': version number does not start with digit

@peterzen
Copy link
Member Author

peterzen commented Nov 15, 2023

dpkg-deb: error: parsing file './build/dexc_bf46fe348fb83893408e875408499761a3df5ea4-0_amd64/DEBIAN/control' near line 2 package 'dexc':
'Version' field value 'bf46fe348fb83893408e875408499761a3df5ea4': version number does not start with digit

It pulls the version number from the git tag - the idea being that for release builds there's always a tag but for dev builds the commit hash confuses the deb build. Maybe this needs to be reconsidered.

If you git tag v0.7.0 or similar it will work.

@peterzen peterzen force-pushed the snapcraft-builder branch 2 times, most recently from bf46fe3 to 9bf282c Compare November 15, 2023 21:58
@JoeGruffins
Copy link
Member

It pulls the version number from the git tag - the idea being that for release builds there's always a tag but for dev builds the commit hash confuses the deb build. Maybe this needs to be reconsidered.

So the commit needs a tag to work? I did not know. Maybe add that to the readme there at least if it is a requirement?

Copy link
Member

@JoeGruffins JoeGruffins left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After adding a bogus tag was able to build and install with snap.

Copy link
Member

@buck54321 buck54321 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not seeing the benefit of the github actions deployment. What does it do for us over just running the script ourselves?

Icons: added SVG icon for hicolor and symbolic variations, fixed 128px PNG to match official version

Can you say more about the new files and what they do for us? Or point me to some documentation?

I don't care about the official logo version. I changed it because the official color was too dark and looked bad in my panel. None of this matters much, of course, because we're rebranding anyway, but prefer to use the lighter color that has margins.

@peterzen
Copy link
Member Author

I'm not seeing the benefit of the github actions deployment. What does it do for us over just running the script ourselves?

It does the same thing but makes life a tad easier. snapcraft, the snap builder isn't straightforward to run on systems other than Ubuntu as it requires several manual steps to initialize lxd which the build relies on. So basically you need to run the script in an Ubuntu VM which I presumed isn't the system of choice for running release builds.

The binary it packages into a snap comes from the .deb package.

Icons: added SVG icon for hicolor and symbolic variations, fixed 128px PNG to match official version

Can you say more about the new files and what they do for us? Or point me to some documentation?

dexc.png is scaled to 128px which is one of the default icon sizes, the 100px version was scaled up and rendered blurry
dexc.svg is a scalable version which the desktop environment picks up when a bitmap in the required size is not available
dexc-symbolic.svg is a B/W version that the desktop environment might use with certain accessibility settings like monochrome etc. Also this is ideally the icon to be used in the systray as in that size this provides the most contrast.

https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html

I don't care about the official logo version. I changed it because the official color was too dark and looked bad in my panel. None of this matters much, of course, because we're rebranding anyway, but prefer to use the lighter color that has margins.

The tray icon should really match the other icons (menu, dock, task switcher), if it's different it looks odd. How about using the monochrome version? That's the most distinctly recognizable in the tray visually.

Comment on lines 48 to 54
if [ ! -d ../../webserver/site/dist ]; then
CWD=$(pwd)
cd ../../webserver/site
npm clean-install
npm run build
cd $CWD
fi
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just because there's a file there doesn't mean its the right one. Any reason not to just build it every time?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The idea here was that the site package is added to the repo on the release branch so there's no need to build it at the time of building the release packages but it certainly won't hurt.

# in this directory.

# pick up the release tag from git
VER=$(git describe --tags --abbrev=0 --always | sed -e 's/^v//')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. If I do

git fetch upstream --tags
git checkout -b v0.6.3 v0.6.3
git describe --tags --abbrev=0 --always | sed -e 's/^v//'

I get

0.6.2

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does upstream point to github.com/decred/dcrdex? I'm getting the correct tag on a fresh clone.

$ git clone https://github.com/decred/dcrdex
Cloning into 'dcrdex'...
...
$ cd dcrdex
$ git fetch origin --tags
$ git checkout -b v0.6.3 v0.6.3
Switched to a new branch 'v0.6.3'
$ git describe --tags --abbrev=0 --always | sed -e 's/^v//'
0.6.3

client/cmd/dexc-desktop/pkg/pkg-debian.sh Outdated Show resolved Hide resolved
Comment on lines +4 to +6

snapcraft login

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will prompt for snapcraft account credentials? Is it expected that the app is already snapcraft register'd?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it will ask for the account creds - the app must be registered in the same account.
https://snapcraft.io/snaps

Comment on lines +68 to +89
prime:
- -usr/lib/x86_64-linux-gnu/libEGL_mesa*
- -usr/lib/x86_64-linux-gnu/libGLX_mesa*
- -usr/lib/x86_64-linux-gnu/libGLESv2*
- -usr/lib/x86_64-linux-gnu/libcaca++*
- -usr/lib/x86_64-linux-gnu/libcolordprivate*
- -usr/lib/x86_64-linux-gnu/libdconf*
- -usr/lib/x86_64-linux-gnu/libexslt*
- -usr/lib/x86_64-linux-gnu/libgstcheck-1.0*
- -usr/lib/x86_64-linux-gnu/libgstcontroller-1.0*
- -usr/lib/x86_64-linux-gnu/libicuio*
- -usr/lib/x86_64-linux-gnu/libicutest*
- -usr/lib/x86_64-linux-gnu/libjacknet*
- -usr/lib/x86_64-linux-gnu/libjackserver*
- -usr/lib/x86_64-linux-gnu/liborc-test-0.4*
- -usr/lib/x86_64-linux-gnu/libpulse-simple*
- -usr/lib/x86_64-linux-gnu/libunwind-coredump*
- -usr/lib/x86_64-linux-gnu/libunwind-ptrace*
- -usr/lib/x86_64-linux-gnu/libunwind-x86_64*
- -usr/lib/x86_64-linux-gnu/libwoff2enc*
- -usr/lib/x86_64-linux-gnu/libicutu*
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this list generated and what does it mean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are libraries that .deb packages in the dexc.deb dependency tree (libgtk-3-0, libwebkit2gtk-4.0-37 and their deps) install but are not required. The list is emitted by snapcraft.

Comment on lines +39 to +51
plugs:
- home
- opengl
- x11
- desktop
- desktop-legacy
- network
- network-status
- browser-support
- screen-inhibit-control
- dbus-svc
- dbus-dbusmenu
- dbus-statusnotifier
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this list generated and what does it mean?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This list defines the snap interfaces the app needs access to, basically they translate into AppArmor permissions. It's assembled from the documentation and trial-and-error.

https://snapcraft.io/docs/interface-management

@@ -66,7 +66,7 @@ require (
github.com/decred/dcrd/dcrec/edwards/v2 v2.0.3 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect
github.com/decred/dcrd/dcrjson/v4 v4.0.1 // indirect
github.com/decred/dcrd/dcrutil/v4 v4.0.1 // indirect
github.com/decred/dcrd/dcrutil/v4 v4.0.2-0.20231005000813-c102e54b4128 // indirect
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did we need this for something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to incorporate decred/dcrd#3196

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants