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

Add additional content #15

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
@@ -1,5 +1,5 @@
<h1 align="center">
<img src="https://avatars1.githubusercontent.com/u/29598503?v=3&s=256" alt="Project">
<img src="snap/gui/icon.png" alt="Project" style="height: 256px">
<br />
[Project]
</h1>
Expand All @@ -15,12 +15,12 @@ distributions.</p>

## Install

sudo snap install my-snap-name
sudo snap install --channel=edge --devmode my-snap-name
Copy link
Member

Choose a reason for hiding this comment

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

I think we want this to remain as-is.

Copy link
Member

Choose a reason for hiding this comment

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

I agee. Please revert this change @Lin-Buo-Ren


([Don't have snapd installed?](https://snapcraft.io/docs/core/install))

<!-- Uncomment and modify this when you have a screenshot
![my-snap-name](screenshot.png?raw=true "my-snap-name")
![my-snap-name](snap/screenshots/screenshot.png?raw=true "my-snap-name")
Copy link
Member

Choose a reason for hiding this comment

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

Files in /snap/ will be copied into the package. They cannot be filtered via stage: or prime: keywords. 👎 on this one.

Copy link
Member

Choose a reason for hiding this comment

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

I agree. Please revert this change @Lin-Buo-Ren

-->

<p align="center">Published for <img src="http://anything.codes/slack-emoji-for-techies/emoji/tux.png" align="top" width="24" /> with :gift_heart: by Snapcrafters</p>
Expand Down
5 changes: 5 additions & 0 deletions snap/README.markdown
@@ -0,0 +1,5 @@
# /snap

[Snaps are universal Linux packages](https://snapcraft.io/). Snaps are containerised software packages that are simple to create and install on all major Linux systems without modification.

Here are the files used for snap packaging, refer [snaps and snapcraft documentation](https://docs.snapcraft.io/) for more info.
5 changes: 5 additions & 0 deletions snap/gui/README.markdown
@@ -0,0 +1,5 @@
# /snap/gui

Copy the snapped application's icon here and specify it in snapcraft.yaml file using the `icon` keyword. This folder is not necessary if the icon is already existed in the source tree.

NOTE: The Snap Store requires SVG scalable image or PNG image with at least 256x256px in size.
Binary file added snap/gui/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions snap/patches/README.markdown
@@ -0,0 +1,3 @@
# /snap/patches
Copy link
Member

Choose a reason for hiding this comment

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

Files in /snap/ will be copied into the package. They cannot be filtered via stage: or prime: keywords. 👎 on this one.

Copy link
Member

Choose a reason for hiding this comment

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

I agree. Please revert this change @Lin-Buo-Ren


Here are the patches that are required to build a snap package that functions correctly.
28 changes: 28 additions & 0 deletions snap/patches/patch-desktop-entries.sed
@@ -0,0 +1,28 @@
# This sed script patches the desktop entries of the snapped
# application.
#
# Documentation:
#
# * GNU Sed Manual
# https://www.gnu.org/software/sed/manual
# * `sed` script overview - `sed` scripts
# * `sed` commands summary - `sed` scripts
# * The `s` Command - `sed` scripts
# * Overview of basic regular expression syntax - Regular
# Expressions: selecting text
# * Back-references and Subexpressions - Regular Expressions:
# selecting text

## Append '(Snappy Edition)' to the application name to make it
## distinguishable with the other same application using different
## software distribution technologies
##
## FIXME: The appended string is not localizable, the proper way to
## implement this is to probably use a new X-Snappy-Name keys
## with localestring format to let the translators fill in
## additional localized string and use these values to replace
## the Name keys here.
s/^\(Name\(\[.\+\]\)\?=.*\)$/\1 (Snappy Edition)/g
Copy link
Member

Choose a reason for hiding this comment

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

I don't like calling out that an application in a snap is any different to the same application packaged elsewhere. This is an example that people will use in their packages if we include it in this repo. I therefore think this line should be dropped.

Copy link
Member

Choose a reason for hiding this comment

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

I agree. Also Snappy is not how we refer to Snapcraft or Snaps these days. @Lin-Buo-Ren please revert this change.


## Fix-up application icon lookup
s|^Icon=.*|Icon=\${SNAP}/meta/gui/icon.svg|
3 changes: 3 additions & 0 deletions snap/screenshots/README.markdown
@@ -0,0 +1,3 @@
# Screenshots

The screenshots of the snapped application. This is not currently synced to the product page on the Snap Store and should be uploaded by yourself.
57 changes: 56 additions & 1 deletion snap/snapcraft.yaml
Expand Up @@ -8,8 +8,63 @@ description: |
store.

confinement: devmode # use 'strict' once you have the right plugs and slots
grade: devel
icon: snap/gui/icon.png

apps:
my-app:
command: my-app
desktop: share/applications/my-app.desktop
#plugs:
#- desktop
#- desktop-legacy
#- x11
#- unity7

#slots:

parts:
my-part:
# Patches to fix other parts
patches:
source: snap/patches
source-type: local
plugin: dump

# DISABLED: Bug #1775582 “`organize:{ /: another-dir/ }` causes the items under host root directory to be copied in another-dir” : Bugs : Snapcraft
# https://forum.snapcraft.io/t/organize-another-dir-causes-the-items-under-host-root-directory-to-be-copied-in-another-dir/5806
#organize:
#/: patches/
Copy link
Member

Choose a reason for hiding this comment

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

please drop the commented-out block

Copy link
Member

Choose a reason for hiding this comment

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

I agree, please remove this @Lin-Buo-Ren. I don't think we should be adding boilerplate that is only required for a few cases.

override-build: |
set -eu

snapcraftctl build

mkdir \
--parents \
"$SNAPCRAFT_PART_INSTALL"/patches
mv \
"$SNAPCRAFT_PART_INSTALL"/*.diff \
"$SNAPCRAFT_PART_INSTALL"/*.patch \
"$SNAPCRAFT_PART_INSTALL"/*.sed \
"$SNAPCRAFT_PART_INSTALL"/patches \
|| true # Empty patches folder is allowed
Copy link
Member

Choose a reason for hiding this comment

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

this override script isn't needed, please drop.

Copy link
Member

Choose a reason for hiding this comment

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

I really don't think we should be complicating a template yaml with patches. They are only required in rare cases.

stage:
- patches/*
Copy link
Member

Choose a reason for hiding this comment

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

This isn't needed.

override-prime: 'true'
Copy link
Member

Choose a reason for hiding this comment

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

replace with:

prime: [-*]

Copy link
Member

Choose a reason for hiding this comment

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

I'd like to see this patches stuff removed from the template yaml entirely. However, @Lin-Buo-Ren you have come up with an interesting use case. Perhaps a blog post on snapcraft.io about best practice for applying patches, when required, to a snap would be a good idea? What to collaborate on that?


my-app:
after:
- patches

# See 'snapcraft plugins'
plugin: nil

override-stage: |
set -eu

snapcraftctl stage

sed \
--file "${SNAPCRAFT_STAGE}"/patches/patch-desktop-entries.sed \
--in-place \
"${SNAPCRAFT_STAGE}"/share/applications/*.desktop