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

Is. #748 - Implement snap packaging #749

Closed
wants to merge 1 commit into from
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ temp*
.DS_Store
.idea
*.old

# Snap packaging specific rules
/parts/
/stage/
/prime/

/*.snap
/*_source.tar.bz2
9 changes: 9 additions & 0 deletions snap/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*.yaml]
indent_style = space
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
6 changes: 6 additions & 0 deletions snap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Version Tracking Ignore Rules for Git VCS
# https://git-scm.com/docs/gitignore
/.snapcraft/

__pycache__
*.pyc
31 changes: 31 additions & 0 deletions snap/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Snap Packaging for Tidy
![Placeholder Icon for Tidy](gui/icon.png "Placeholder Icon for Tidy")

**This is the snap for Tidy**, *"HTML parser and pretty printer. The grand daddy of HTML tools."*. It works on Ubuntu, Fedora, Debian, and other major Linux distributions.

[![Build Status Badge of the `tidy` Snap](https://build.snapcraft.io/badge/htacg/tidy-html5.svg "Build Status of the `tidy` snap")](https://build.snapcraft.io/user/htacg/tidy-html5)

![Screenshot of the Snapped Application](screenshots/tidy-help-heading.png "Screenshot of the Snapped Application")

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

### In Terminal
# Install Snap #
sudo snap install tidy

# Connect the Snap to Optional Interfaces #
## `removable-media`: For accessing files under /media and /run/media ##
sudo snap connect tidy:removable-media

### The Graphical Way
Browse <https://snapcraft.io/tidy> and follow the instructions.

## Support
* Report issues regarding using this snap to the issue tracker:
<https://github.com/htacg/tidy-html5/issues>

be sure to mention you are using the snap package.

* You may also post on the Snapcraft Forum, under the `snap` topic category:
<https://forum.snapcraft.io/c/snap>
5 changes: 5 additions & 0 deletions snap/gui/README.md
Original file line number Diff line number Diff line change
@@ -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
Loading
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/screenshots/README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# /snap/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.
Binary file added snap/screenshots/tidy-help-heading.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
65 changes: 65 additions & 0 deletions snap/snapcraft.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
%YAML 1.2
---
# Snapcraft Recipe for Tidy
# ------------------------------
# This file is in the YAML data serialization format:
# http://yaml.org
# For the spec. of writing this file refer the following documentation:
# * The snapcraft syntax
# https://docs.snapcraft.io/build-snaps/syntax
# * Snap Docs
# https://snapdocs.labix.org
# * Latest doc topics in the Snapcraft Forum
# https://forum.snapcraft.io/c/doc
# For support refer to the snapcraft section in the Snapcraft Forum:
# https://forum.snapcraft.io/c/snapcraft

name: tidy
summary: HTML parser and pretty printer. The grand daddy of HTML tools
description: |
Tidy is a console application for Mac OS X, Linux, Windows, UNIX,
and more. It corrects and cleans up HTML and XML documents by fixing
markup errors and upgrading legacy code to modern standards.

version: determined-by-version-script
version-script: snap/utilities/set-snap-version.bash

confinement: strict
grade: stable

apps:
tidy:
command: tidy
plugs:
- home
- removable-media

parts:
tidy:
source: .
source-type: local

# For stable release build
#source-tag: '5.6.0'

plugin: cmake
configflags:
- -DCMAKE_BUILD_TYPE=Release

build-packages:
- build-essential
- xsltproc

filesets:
executables:
- bin/*
library-headers:
- include/*
library-shared:
- lib/*.so*
library-static:
- lib/*.a
pkgconfig:
- lib/pkgconfig/*
manpages:
- share/man/*
3 changes: 3 additions & 0 deletions snap/utilities/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# /snap/utilities

Here are some utilities programs to help with snap packaging.
44 changes: 44 additions & 0 deletions snap/utilities/set-snap-version.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
# Set snap version according to various factors
# 林博仁(Buo-ren, Lin) © 2018

set \
-o errexit \
-o errtrace \
-o nounset \
-o pipefail

init(){
set \
-o errexit \
-o nounset

local \
upstream_version \
upstream_git_revision

upstream_version="$(
head \
--lines=1 \
parts/tidy/src/version.txt
)"

upstream_git_revision="$(
git \
-C parts/tidy/src \
describe \
--always \
--dirty \
--match nothing \
| sed s/^v//
)"

printf \
-- \
'%s' \
"${upstream_version}-g${upstream_git_revision}"

exit 0
}

init "${@}"