From d18035f280eb38102f2e7a5aba37add2077755ae Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 1 Apr 2025 10:37:45 +0200 Subject: [PATCH 1/7] Improve release handling - Preserve original timestamps of unmodified files. - Create new tag only if there were changes. Signed-off-by: Stefan Weil --- release.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/release.sh b/release.sh index a95f4cf..8124c20 100755 --- a/release.sh +++ b/release.sh @@ -10,8 +10,16 @@ fi ## Update install.rdf and manifest.json ############## -perl -pi -e "s/em:version=\"[^\"]*/em:version=\"$version/;" src/install.rdf -perl -pi -e "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/" src/manifest.json +perl -pi.bak -e "s/em:version=\"[^\"]*/em:version=\"$version/;" src/install.rdf +if cmp -s src/install.rdf.bak src/install.rdf; then + # Nothing changed, restore original file and timestamp. + mv src/install.rdf.bak src/install.rdf +fi +perl -pi.bak -e "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/" src/manifest.json +if cmp -s src/manifest.json.bak src/manifest.json; then + # Nothing changed, restore original file and timestamp. + mv src/manifest.json.bak src/manifest.json +fi ############## @@ -23,8 +31,8 @@ perl -pi -e "s/\"version\": \"[^\"]*\"/\"version\": \"$version\"/" src/manifest. perl -pi -e "s/\"version\": \"[^\"]*\",/\"version\": \"${version}\",/" updates.json perl -pi -e "s/\"update_link\": \"[^\"]*\",/\"update_link\": \"https:\/\/github.com\/UB-Mannheim\/zotero-ocr\/releases\/download\/${version}\/zotero-ocr-${version}.xpi\",/" updates.json perl -pi -e "s/\"update_hash\": \"[^\"]*\",/\"update_hash\": \"sha256:$(shasum -a 256 build\/zotero-ocr-${version}.xpi | cut -d' ' -f1)\",/" updates.json -cp updates.json update.rdf +cp -p update.rdf updates.json git add src/install.rdf src/manifest.json update.rdf updates.json -git commit -m "Release $version" 1>&2 +git commit -m "Release $version" && git tag -a -m "Release $version" "$version" From f648d6607f3e8de5b7c495dcd8ec4c4f551fbdd5 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 1 Apr 2025 10:54:27 +0200 Subject: [PATCH 2/7] Update documentation for building Signed-off-by: Stefan Weil --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index df62627..7f05e99 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,8 @@ The defaut Zotero OCR settings are intended to facilitate troubleshooting, and y Regular users do not need to read this section. -After any code changes one can build a new extension file by `./build.sh `. +Developers can build a new extension file by running `./build.sh [VERSION]`. +It will ask for a version if no version was given on the command line. Then in Zotero install the newly created `.xpi`-file. as described in the Installation section. If any error occurs then you will see more details in the `Help`, `Report Error...` dialog. For some debugging messages you can activate in Zotero the debugging in the `Help`, `Debug Output Logging`. From cdab514146eef1e093cf63e389c3ba3b76989063 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 1 Apr 2025 10:56:31 +0200 Subject: [PATCH 3/7] Update CI builds CI builds now use a tag which includes the current date. This avoids a conflict with the existing tag of the current release. Signed-off-by: Stefan Weil --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 48d05e0..24f3f54 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,7 +24,7 @@ jobs: run: git config --global user.email "ci@example.com" && git config --global user.name "GitHub CI" - name: Run build - run: ./release.sh $(git describe --tags || echo ci-test) && cp -a build/*.xpi . + run: ./release.sh $(git describe --tags || echo ci-test)-$(date -I) && cp -a build/*.xpi . - uses: actions/upload-artifact@v4 with: From 5569d191dc536e73e7def828e2b8e61b476b79bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20B=C3=BCchau?= Date: Wed, 14 May 2025 14:39:03 +0200 Subject: [PATCH 4/7] =?UTF-8?q?=F0=9F=A9=B9=20Fix=20pdftoppm=20executable?= =?UTF-8?q?=20typo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/zotero-ocr.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/zotero-ocr.js b/src/zotero-ocr.js index 34615f3..163750a 100644 --- a/src/zotero-ocr.js +++ b/src/zotero-ocr.js @@ -117,7 +117,7 @@ ZoteroOCR = { */ let pdftoppmPaths = ["", "/usr/local/bin/", "/usr/bin/", "/opt/homebrew/bin/", "/usr/local/homebrew/bin/"]; - let pdftoppm = await checkExternalCmd("pdtfoppm", "zoteroocr.pdftoppmPath", pdftoppmPaths); + let pdftoppm = await checkExternalCmd("pdftoppm", "zoteroocr.pdftoppmPath", pdftoppmPaths); if (!(await IOUtils.exists(pdftoppm))) { window.alert("No pdftoppm executable found, last check: " + pdftoppm); return; From 2a07437172e4d77b2c46d7b3a3ed13a667b70c65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20B=C3=BCchau?= Date: Wed, 14 May 2025 14:44:31 +0200 Subject: [PATCH 5/7] =?UTF-8?q?=E2=9D=84=EF=B8=8F=20Look=20for=20pdftoppm?= =?UTF-8?q?=20and=20tesseract=20also=20in=20NixOS=20default=20system=20exe?= =?UTF-8?q?cutable=20path?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/zotero-ocr.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/zotero-ocr.js b/src/zotero-ocr.js index 163750a..59546ef 100644 --- a/src/zotero-ocr.js +++ b/src/zotero-ocr.js @@ -116,14 +116,14 @@ ZoteroOCR = { If the last possible option doesn't exist, display an error message and quit. */ - let pdftoppmPaths = ["", "/usr/local/bin/", "/usr/bin/", "/opt/homebrew/bin/", "/usr/local/homebrew/bin/"]; + let pdftoppmPaths = ["", "/usr/local/bin/", "/usr/bin/", "/opt/homebrew/bin/", "/usr/local/homebrew/bin/", "/run/current-system/sw/bin/"]; let pdftoppm = await checkExternalCmd("pdftoppm", "zoteroocr.pdftoppmPath", pdftoppmPaths); if (!(await IOUtils.exists(pdftoppm))) { window.alert("No pdftoppm executable found, last check: " + pdftoppm); return; } - let ocrEnginePaths = ["", "/usr/local/bin/", "/usr/bin/", "C:\\Program Files\\Tesseract-OCR\\", "/opt/homebrew/bin/", "/usr/local/homebrew/bin/"]; + let ocrEnginePaths = ["", "/usr/local/bin/", "/usr/bin/", "C:\\Program Files\\Tesseract-OCR\\", "/opt/homebrew/bin/", "/usr/local/homebrew/bin/", "/run/current-system/sw/bin/"]; let ocrEngine = await checkExternalCmd("tesseract", "zoteroocr.ocrPath", ocrEnginePaths); if (!(await IOUtils.exists(ocrEngine))) { window.alert("No tesseract executable found, last check: " + ocrEngine); From 99840021619c4156633653c6584b814ac0296ed8 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 14 May 2025 16:50:29 +0200 Subject: [PATCH 6/7] Fix bug in release script Fixes: d18035f280eb ("Improve release handling") Signed-off-by: Stefan Weil --- release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release.sh b/release.sh index 8124c20..c16bf74 100755 --- a/release.sh +++ b/release.sh @@ -31,7 +31,7 @@ fi perl -pi -e "s/\"version\": \"[^\"]*\",/\"version\": \"${version}\",/" updates.json perl -pi -e "s/\"update_link\": \"[^\"]*\",/\"update_link\": \"https:\/\/github.com\/UB-Mannheim\/zotero-ocr\/releases\/download\/${version}\/zotero-ocr-${version}.xpi\",/" updates.json perl -pi -e "s/\"update_hash\": \"[^\"]*\",/\"update_hash\": \"sha256:$(shasum -a 256 build\/zotero-ocr-${version}.xpi | cut -d' ' -f1)\",/" updates.json -cp -p update.rdf updates.json +cp -p updates.json update.rdf git add src/install.rdf src/manifest.json update.rdf updates.json git commit -m "Release $version" && From 831046000eb362a1173421c96af3e0917c68f06d Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 14 May 2025 16:51:48 +0200 Subject: [PATCH 7/7] Release 0.9.2 --- src/install.rdf | 2 +- src/manifest.json | 2 +- update.rdf | 6 +++--- updates.json | 6 +++--- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/install.rdf b/src/install.rdf index d30489a..83a8d2b 100644 --- a/src/install.rdf +++ b/src/install.rdf @@ -6,7 +6,7 @@ RDF:about="urn:mozilla:install-manifest" em:id="zotero-ocr@bib.uni-mannheim.de" em:name="Zotero OCR" - em:version="0.9.1" + em:version="0.9.2" em:iconURL="chrome://zoteroocr/skin/ubmannheim.png" em:icon64URL="chrome://zoteroocr/skin/ubmannheim64x64.png" em:creator="Philipp Zumstein" diff --git a/src/manifest.json b/src/manifest.json index 7f62b87..f597ee5 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 2, "name": "Zotero OCR", - "version": "0.9.1", + "version": "0.9.2", "description": "Zotero Plugin for OCR", "author": "Philipp Zumstein", "homepage_url": "https://github.com/UB-Mannheim/zotero-ocr", diff --git a/update.rdf b/update.rdf index 8d7047e..bf2038b 100644 --- a/update.rdf +++ b/update.rdf @@ -3,9 +3,9 @@ "zotero-ocr@bib.uni-mannheim.de": { "updates": [ { - "version": "0.9.1", - "update_link": "https://github.com/UB-Mannheim/zotero-ocr/releases/download/0.9.1/zotero-ocr-0.9.1.xpi", - "update_hash": "sha256:4d66a15909954da17b58b182027d3d8d0faa023c59aac513f5396c3465692d83", + "version": "0.9.2", + "update_link": "https://github.com/UB-Mannheim/zotero-ocr/releases/download/0.9.2/zotero-ocr-0.9.2.xpi", + "update_hash": "sha256:6d34154c4296d148a3d82695e18c0b89101416fd43a2f9f7eae9fa20144d293c", "applications": { "gecko": { "strict_min_version": "60.0" diff --git a/updates.json b/updates.json index 8d7047e..bf2038b 100644 --- a/updates.json +++ b/updates.json @@ -3,9 +3,9 @@ "zotero-ocr@bib.uni-mannheim.de": { "updates": [ { - "version": "0.9.1", - "update_link": "https://github.com/UB-Mannheim/zotero-ocr/releases/download/0.9.1/zotero-ocr-0.9.1.xpi", - "update_hash": "sha256:4d66a15909954da17b58b182027d3d8d0faa023c59aac513f5396c3465692d83", + "version": "0.9.2", + "update_link": "https://github.com/UB-Mannheim/zotero-ocr/releases/download/0.9.2/zotero-ocr-0.9.2.xpi", + "update_hash": "sha256:6d34154c4296d148a3d82695e18c0b89101416fd43a2f9f7eae9fa20144d293c", "applications": { "gecko": { "strict_min_version": "60.0"