From 554450c94359d95648d071685d8ecc32c0b2ee08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=2C=20Lin=29?= Date: Mon, 3 Sep 2018 16:17:47 +0800 Subject: [PATCH 1/7] Use automatic git-based versioning for the snap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Snapcraft supports automatic `git describe` based versioning when the `version` key is set to `git`. This gives more information of the source status of a snap distribution. Refer-to: Snapcraft.yaml reference - doc - snapcraft.io Signed-off-by: 林博仁(Buo-ren, Lin) --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 8be7d82f..4b9b7b5f 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -1,5 +1,5 @@ name: tesseract -version: master +version: git summary: open source optical character recognition engine description: | Tesseract has unicode (UTF-8) support, and can recognize more than 100 From 5ea8bf64f57cb892d743eac77b177d0131627cc4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=2C=20Lin=29?= Date: Mon, 3 Sep 2018 16:20:15 +0800 Subject: [PATCH 2/7] Flip snap packaging's grade to stable MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change allows downstream packagers to publish the snap to the candidate and stable channels. Signed-off-by: 林博仁(Buo-ren, Lin) --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 4b9b7b5f..da8c1d8d 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -6,7 +6,7 @@ description: | languages "out of the box". It can be trained to recognize other languages. Tesseract supports various output formats: plain-text, hocr(html), pdf. -grade: devel # must be 'stable' to release into candidate/stable channels +grade: stable # must be 'stable' to release into candidate/stable channels confinement: strict apps: From b5ff354d0676fdb875a84d6527fe42661ad6c9d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=2C=20Lin=29?= Date: Mon, 3 Sep 2018 16:32:09 +0800 Subject: [PATCH 3/7] Split app. command arguments into separate lines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows cleaner diffs for future modifications using the YAML's "folded" block scalar style. Refer-to: Folded Style - Block Scalar Styles - Block Styles Signed-off-by: 林博仁(Buo-ren, Lin) --- snap/snapcraft.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index da8c1d8d..5ed8a276 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -11,7 +11,10 @@ confinement: strict apps: tesseract: - command: env TESSDATA_PREFIX=$SNAP_USER_COMMON tesseract + command: > + env + TESSDATA_PREFIX=$SNAP_USER_COMMON + tesseract plugs: [home] parts: From aa48247f1a92cec5d85293a463bd01ff92ef325a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=2C=20Lin=29?= Date: Mon, 3 Sep 2018 16:45:08 +0800 Subject: [PATCH 4/7] Assert removable-media interface in the snap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows access to the files under `/media/*` and `/run/media/*`, as the connection is not automatic connect instructions is also added to the snap's description. Refer-to: Interfaces - doc - snapcraft.io Signed-off-by: 林博仁(Buo-ren, Lin) --- snap/snapcraft.yaml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index 5ed8a276..e89d5e20 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -6,6 +6,11 @@ description: | languages "out of the box". It can be trained to recognize other languages. Tesseract supports various output formats: plain-text, hocr(html), pdf. + If you want to access the files under /media/* or /run/media/* you'll have + to connect the snap to the `core` snap's `removable-media` interface: + + $ sudo snap connect tesseract:removable-media + grade: stable # must be 'stable' to release into candidate/stable channels confinement: strict @@ -15,7 +20,9 @@ apps: env TESSDATA_PREFIX=$SNAP_USER_COMMON tesseract - plugs: [home] + plugs: + - home + - removable-media parts: tesseract: From 9c8a585107ef9009fbfc297bc4575ce4c7383286 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=2C=20Lin=29?= Date: Mon, 3 Sep 2018 16:47:39 +0800 Subject: [PATCH 5/7] Add git tracking ignore rules for snap packaging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 林博仁(Buo-ren, Lin) --- .gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.gitignore b/.gitignore index f9339896..46222491 100644 --- a/.gitignore +++ b/.gitignore @@ -107,3 +107,11 @@ kernel*.bin times.txt /unlvtests/results* +# snap packaging specific rules +/parts/ +/stage/ +/prime/ +/snap/.snapcraft/ + +/*.snap +/*_source.tar.bz2 From ccbda7a20f510679a26ec944e276e06ae4cbad9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=2C=20Lin=29?= Date: Mon, 3 Sep 2018 17:13:06 +0800 Subject: [PATCH 6/7] Stage packages that provides the depending libraries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Snapcraft will soonly drop the feature to automatic staging the depending libraries into the snap, specify it manually to avoid breakage in the future. This deals with the following warning message in the build: ``` Priming leptonica Files from the build host were migrated into the snap to satisfy dependencies that would otherwise not be met. This feature will be removed in a future release. If these libraries are needed in the final snap, ensure that the following are either satisfied by a stage-packages entry or through a part: usr/lib/x86_64-linux-gnu/libjbig.so.0 usr/lib/x86_64-linux-gnu/libjpeg.so.8 usr/lib/x86_64-linux-gnu/libopenjp2.so.7 usr/lib/x86_64-linux-gnu/libtiff.so.5 Priming tesseract Files from the build host were migrated into the snap to satisfy dependencies that would otherwise not be met. This feature will be removed in a future release. If these libraries are needed in the final snap, ensure that the following are either satisfied by a stage-packages entry or through a part: usr/lib/x86_64-linux-gnu/libgomp.so.1 ``` Signed-off-by: 林博仁(Buo-ren, Lin) --- snap/snapcraft.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index e89d5e20..f6f1a240 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -37,7 +37,14 @@ parts: - libicu-dev - libpango1.0-dev - libcairo2-dev + stage-packages: + - libgomp1 after: [leptonica] leptonica: source: https://github.com/DanBloomberg/leptonica/archive/1.74.2.tar.gz plugin: autotools + stage-packages: + - libjbig0 + - libjpeg-turbo8 + - libopenjp2-7 + - libtiff5 \ No newline at end of file From 31de2cf60eb5fabdf24b171ab42ed5a70273568d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9E=97=E5=8D=9A=E4=BB=81=28Buo-ren=2C=20Lin=29?= Date: Mon, 3 Sep 2018 17:13:45 +0800 Subject: [PATCH 7/7] Add newline at end of file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 林博仁(Buo-ren, Lin) --- snap/snapcraft.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/snap/snapcraft.yaml b/snap/snapcraft.yaml index f6f1a240..64585c6b 100644 --- a/snap/snapcraft.yaml +++ b/snap/snapcraft.yaml @@ -47,4 +47,4 @@ parts: - libjbig0 - libjpeg-turbo8 - libopenjp2-7 - - libtiff5 \ No newline at end of file + - libtiff5