Skip to content

Commit 470a4fc

Browse files
committed
Is. #748 - Implement snap packaging
Snaps are universal Linux packages that can be installed and run on multiple GNU+Linux distributions with ease. This patch implements the necessary files to build tidy as a snap. Refer-to: Snapcraft - Snaps are universal Linux packages <https://snapcraft.io> Refer-to: Intent-To-Package: Snaps are Universal Linux Packages · Issue Conforming-to: tidy-html5/CONTRIBUTING.md at next · htacg/tidy-html5 <https://github.com/htacg/tidy-html5/blob/next/README/CONTRIBUTING.md> Conforming-to: tidy-html5/CODESTYLE.md at next · htacg/tidy-html5 <https://github.com/htacg/tidy-html5/blob/next/README/CODESTYLE.md> Signed-off-by: 林博仁(Buo-ren, Lin) <[email protected]>
1 parent 86b52dc commit 470a4fc

11 files changed

+174
-0
lines changed

.gitignore

+8
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,11 @@ temp*
1616
.DS_Store
1717
.idea
1818
*.old
19+
20+
# Snap packaging specific rules
21+
/parts/
22+
/stage/
23+
/prime/
24+
25+
/*.snap
26+
/*_source.tar.bz2

snap/.editorconfig

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
root = true
2+
3+
[*.yaml]
4+
indent_style = space
5+
indent_size = 4
6+
end_of_line = lf
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
insert_final_newline = true

snap/.gitignore

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Version Tracking Ignore Rules for Git VCS
2+
# https://git-scm.com/docs/gitignore
3+
/.snapcraft/
4+
5+
__pycache__
6+
*.pyc

snap/README.md

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Snap Packaging for Tidy
2+
![Placeholder Icon for Tidy](gui/icon.png "Placeholder Icon for Tidy")
3+
4+
**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.
5+
6+
[![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)
7+
8+
![Screenshot of the Snapped Application](screenshots/tidy-help-heading.png "Screenshot of the Snapped Application")
9+
10+
## Installation
11+
([Don't have snapd installed?](https://snapcraft.io/docs/core/install))
12+
13+
### In Terminal
14+
# Install Snap #
15+
sudo snap install tidy
16+
17+
# Connect the Snap to Optional Interfaces #
18+
## `removable-media`: For accessing files under /media and /run/media ##
19+
sudo snap connect tidy:removable-media
20+
21+
### The Graphical Way
22+
Browse <https://snapcraft.io/tidy> and follow the instructions.
23+
24+
## Support
25+
* Report issues regarding using this snap to the issue tracker:
26+
<https://github.com/htacg/tidy-html5/issues>
27+
28+
be sure to mention you are using the snap package.
29+
30+
* You may also post on the Snapcraft Forum, under the `snap` topic category:
31+
<https://forum.snapcraft.io/c/snap>

snap/gui/README.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# /snap/gui
2+
3+
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.
4+
5+
NOTE: The Snap Store requires SVG scalable image or PNG image with at least 256x256px in size.

snap/gui/icon.png

9.04 KB
Loading

snap/screenshots/README.markdown

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# /snap/screenshots
2+
3+
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.
23.6 KB
Loading

snap/snapcraft.yaml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
%YAML 1.2
2+
---
3+
# Snapcraft Recipe for Tidy
4+
# ------------------------------
5+
# This file is in the YAML data serialization format:
6+
# http://yaml.org
7+
# For the spec. of writing this file refer the following documentation:
8+
# * The snapcraft syntax
9+
# https://docs.snapcraft.io/build-snaps/syntax
10+
# * Snap Docs
11+
# https://snapdocs.labix.org
12+
# * Latest doc topics in the Snapcraft Forum
13+
# https://forum.snapcraft.io/c/doc
14+
# For support refer to the snapcraft section in the Snapcraft Forum:
15+
# https://forum.snapcraft.io/c/snapcraft
16+
17+
name: tidy
18+
summary: HTML parser and pretty printer. The grand daddy of HTML tools
19+
description: |
20+
Tidy is a console application for Mac OS X, Linux, Windows, UNIX,
21+
and more. It corrects and cleans up HTML and XML documents by fixing
22+
markup errors and upgrading legacy code to modern standards.
23+
24+
version: determined-by-version-script
25+
version-script: snap/utilities/set-snap-version.bash
26+
27+
confinement: strict
28+
grade: stable
29+
30+
apps:
31+
tidy:
32+
command: tidy
33+
plugs:
34+
- home
35+
- removable-media
36+
37+
parts:
38+
tidy:
39+
source: .
40+
source-type: local
41+
42+
# For stable release build
43+
#source-tag: '5.6.0'
44+
45+
plugin: cmake
46+
configflags:
47+
- -DCMAKE_BUILD_TYPE=Release
48+
49+
build-packages:
50+
- build-essential
51+
- xsltproc
52+
53+
filesets:
54+
executables:
55+
- bin/*
56+
library-headers:
57+
- include/*
58+
library-shared:
59+
- lib/*.so*
60+
library-static:
61+
- lib/*.a
62+
pkgconfig:
63+
- lib/pkgconfig/*
64+
manpages:
65+
- share/man/*

snap/utilities/README.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# /snap/utilities
2+
3+
Here are some utilities programs to help with snap packaging.

snap/utilities/set-snap-version.bash

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
#!/usr/bin/env bash
2+
# Set snap version according to various factors
3+
# 林博仁(Buo-ren, Lin) © 2018
4+
5+
set \
6+
-o errexit \
7+
-o errtrace \
8+
-o nounset \
9+
-o pipefail
10+
11+
init(){
12+
set \
13+
-o errexit \
14+
-o nounset
15+
16+
local \
17+
upstream_version \
18+
upstream_git_revision
19+
20+
upstream_version="$(
21+
head \
22+
--lines=1 \
23+
parts/tidy/src/version.txt
24+
)"
25+
26+
upstream_git_revision="$(
27+
git \
28+
-C parts/tidy/src \
29+
describe \
30+
--always \
31+
--dirty \
32+
--match nothing \
33+
| sed s/^v//
34+
)"
35+
36+
printf \
37+
-- \
38+
'%s' \
39+
"${upstream_version}-g${upstream_git_revision}"
40+
41+
exit 0
42+
}
43+
44+
init "${@}"

0 commit comments

Comments
 (0)