From 397f79ffd5a5998762e04d2900ce225011bfef49 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Tue, 22 Oct 2024 10:17:57 +0200 Subject: [PATCH 1/7] WIP --- .github/workflows/build-deb-package.yml | 48 +++++++++++++++++++ changedetectionio/__main__.py | 4 ++ .../installed-by-dh_install | 1 + .../installed-by-dh_installdocs | 0 debian/changedetection.io.service | 13 +++++ .../systemd/system/changedetection.io.service | 13 +++++ .../doc/changedetection.io/changelog.Debian | 5 ++ debian/changelog | 5 ++ debian/control | 14 ++++++ debian/debhelper-build-stamp | 1 + debian/install | 1 + debian/postinst | 23 +++++++++ debian/postrm | 11 +++++ debian/prerm | 8 ++++ debian/rules | 12 +++++ 15 files changed, 159 insertions(+) create mode 100644 .github/workflows/build-deb-package.yml create mode 100644 changedetectionio/__main__.py create mode 100644 debian/.debhelper/generated/changedetection.io/installed-by-dh_install create mode 100644 debian/.debhelper/generated/changedetection.io/installed-by-dh_installdocs create mode 100644 debian/changedetection.io.service create mode 100644 debian/changedetection.io/lib/systemd/system/changedetection.io.service create mode 100644 debian/changedetection.io/usr/share/doc/changedetection.io/changelog.Debian create mode 100644 debian/changelog create mode 100644 debian/control create mode 100644 debian/debhelper-build-stamp create mode 100644 debian/install create mode 100755 debian/postinst create mode 100755 debian/postrm create mode 100755 debian/prerm create mode 100755 debian/rules diff --git a/.github/workflows/build-deb-package.yml b/.github/workflows/build-deb-package.yml new file mode 100644 index 00000000000..13e203c1ff5 --- /dev/null +++ b/.github/workflows/build-deb-package.yml @@ -0,0 +1,48 @@ +name: Build Debian Package +# Check status: systemctl status changedetection.io.service +# Get logs: journalctl -u changedetection.io.service +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + +jobs: + build-deb: + runs-on: ubuntu-latest + name: Build and Package changedetection.io + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: '3.8' + + - name: Install Build Dependencies + run: | + sudo apt-get update + sudo apt-get install -y \ + build-essential \ + devscripts \ + dh-virtualenv \ + dh-python \ + python3-all \ + python3-all-dev \ + python3.10 \ + python3.10-venv \ + python3.10-dev \ + debhelper-compat + + - name: Build the Debian Package + run: | + debuild -us -uc + + - name: Upload Debian Package Artifact + uses: actions/upload-artifact@v3 + with: + name: changedetection.io-deb-package + path: ../*.deb diff --git a/changedetectionio/__main__.py b/changedetectionio/__main__.py new file mode 100644 index 00000000000..c7c70d0be2f --- /dev/null +++ b/changedetectionio/__main__.py @@ -0,0 +1,4 @@ +from . import main + +if __name__ == '__main__': + main() diff --git a/debian/.debhelper/generated/changedetection.io/installed-by-dh_install b/debian/.debhelper/generated/changedetection.io/installed-by-dh_install new file mode 100644 index 00000000000..8d6095dc921 --- /dev/null +++ b/debian/.debhelper/generated/changedetection.io/installed-by-dh_install @@ -0,0 +1 @@ +./debian/changedetection.io.service diff --git a/debian/.debhelper/generated/changedetection.io/installed-by-dh_installdocs b/debian/.debhelper/generated/changedetection.io/installed-by-dh_installdocs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/debian/changedetection.io.service b/debian/changedetection.io.service new file mode 100644 index 00000000000..bb8de00005e --- /dev/null +++ b/debian/changedetection.io.service @@ -0,0 +1,13 @@ +[Unit] +Description=changedetection.io Service +After=network.target + +[Service] +User=changedetio +Group=changedetio +WorkingDirectory=/opt/changedetection.io +ExecStart=/opt/changedetection.io/bin/python -m changedetectionio +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/debian/changedetection.io/lib/systemd/system/changedetection.io.service b/debian/changedetection.io/lib/systemd/system/changedetection.io.service new file mode 100644 index 00000000000..bb8de00005e --- /dev/null +++ b/debian/changedetection.io/lib/systemd/system/changedetection.io.service @@ -0,0 +1,13 @@ +[Unit] +Description=changedetection.io Service +After=network.target + +[Service] +User=changedetio +Group=changedetio +WorkingDirectory=/opt/changedetection.io +ExecStart=/opt/changedetection.io/bin/python -m changedetectionio +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/debian/changedetection.io/usr/share/doc/changedetection.io/changelog.Debian b/debian/changedetection.io/usr/share/doc/changedetection.io/changelog.Debian new file mode 100644 index 00000000000..e9265678f95 --- /dev/null +++ b/debian/changedetection.io/usr/share/doc/changedetection.io/changelog.Debian @@ -0,0 +1,5 @@ +changedetection.io (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Your Name Wed, 01 Nov 2023 12:00:00 +0000 diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000000..e9265678f95 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +changedetection.io (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Your Name Wed, 01 Nov 2023 12:00:00 +0000 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000000..f0f9c488829 --- /dev/null +++ b/debian/control @@ -0,0 +1,14 @@ +Source: changedetection.io +Section: web +Priority: optional +Maintainer: Your Name +Build-Depends: debhelper-compat (= 13), dh-virtualenv, dh-python, python3-all (>= 3.10), python3-all (<< 3.13), python3.10, python3.10-venv +Standards-Version: 4.6.0 +Rules-Requires-Root: no +Homepage: https://github.com/dgtlmoon/changedetection.io + +Package: changedetection.io +Architecture: all +Depends: ${misc:Depends}, python3 (>= 3.10), python3 (<< 3.13) +Description: Web page change detection - Python application + A web-based application for monitoring web pages for changes. \ No newline at end of file diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp new file mode 100644 index 00000000000..b1ec0d8802c --- /dev/null +++ b/debian/debhelper-build-stamp @@ -0,0 +1 @@ +changedetection.io diff --git a/debian/install b/debian/install new file mode 100644 index 00000000000..9ba3bb64d0f --- /dev/null +++ b/debian/install @@ -0,0 +1 @@ +debian/changedetection.io.service lib/systemd/system/ diff --git a/debian/postinst b/debian/postinst new file mode 100755 index 00000000000..8aac5aed1e1 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,23 @@ +#!/bin/sh +set -e + +# Determine Python version +PYTHON_VERSION=$(ls /usr/bin/python3.1[0-2] | head -n1 | xargs basename) + +# Create 'changedetio' user if it doesn't exist +if ! id "changedetio" >/dev/null 2>&1; then + adduser --system --group --no-create-home changedetio +fi + +# Set ownership of the installation directory +chown -R changedetio:changedetio /opt/changedetection.io + +# Update the systemd service file if necessary +sed -i "s|ExecStart=.*|ExecStart=/opt/changedetection.io/bin/$PYTHON_VERSION -m changedetectionio|" /lib/systemd/system/changedetection.io.service + +# Enable and start the service +systemctl daemon-reload +systemctl enable changedetection.io.service +systemctl start changedetection.io.service + +exit 0 \ No newline at end of file diff --git a/debian/postrm b/debian/postrm new file mode 100755 index 00000000000..0cf85ff23e4 --- /dev/null +++ b/debian/postrm @@ -0,0 +1,11 @@ +#!/bin/sh +set -e + +# Remove user on purge +if [ "$1" = "purge" ]; then + deluser --system changedetio +fi + +systemctl daemon-reload + +exit 0 diff --git a/debian/prerm b/debian/prerm new file mode 100755 index 00000000000..5ae480f9f2d --- /dev/null +++ b/debian/prerm @@ -0,0 +1,8 @@ +#!/bin/sh +set -e + +# Stop and disable the service +systemctl stop changedetection.io.service +systemctl disable changedetection.io.service + +exit 0 diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000000..daccd392dc1 --- /dev/null +++ b/debian/rules @@ -0,0 +1,12 @@ +#!/usr/bin/make -f + +%: + dh $@ --with python-virtualenv --buildsystem=pybuild + +PYTHON_VERSION := $(shell py3versions -r '>= 3.10 << 3.13' -i) + +override_dh_virtualenv: + dh_virtualenv --sourcedirectory=. \ + --install-suffix='' \ + --requirements=requirements.txt \ + --python=/usr/bin/$(PYTHON_VERSION) \ No newline at end of file From 26556d8091876be0d5711d89150e71fc1f81ff7c Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 27 Dec 2024 11:31:21 +0100 Subject: [PATCH 2/7] bump to 3.10 --- .github/workflows/build-deb-package.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-deb-package.yml b/.github/workflows/build-deb-package.yml index 13e203c1ff5..63b62cff7f3 100644 --- a/.github/workflows/build-deb-package.yml +++ b/.github/workflows/build-deb-package.yml @@ -17,10 +17,10 @@ jobs: - name: Checkout repository uses: actions/checkout@v3 - - name: Set up Python 3.8 + - name: Set up Python 3.10 uses: actions/setup-python@v4 with: - python-version: '3.8' + python-version: '3.10' - name: Install Build Dependencies run: | From 41da9480c7a14d41a0bcf93df91d8337d29173b7 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 27 Dec 2024 11:31:48 +0100 Subject: [PATCH 3/7] add note --- .github/workflows/build-deb-package.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-deb-package.yml b/.github/workflows/build-deb-package.yml index 63b62cff7f3..aee3fc98616 100644 --- a/.github/workflows/build-deb-package.yml +++ b/.github/workflows/build-deb-package.yml @@ -46,3 +46,5 @@ jobs: with: name: changedetection.io-deb-package path: ../*.deb + +#@todo install and test that some basic content appears \ No newline at end of file From 81a837ebacd2bee8b3306e5fa9ae916329d88876 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 27 Dec 2024 11:33:23 +0100 Subject: [PATCH 4/7] on any --- .github/workflows/build-deb-package.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/.github/workflows/build-deb-package.yml b/.github/workflows/build-deb-package.yml index aee3fc98616..46f0c105838 100644 --- a/.github/workflows/build-deb-package.yml +++ b/.github/workflows/build-deb-package.yml @@ -1,12 +1,7 @@ name: Build Debian Package # Check status: systemctl status changedetection.io.service # Get logs: journalctl -u changedetection.io.service -on: - push: - branches: [ main ] - pull_request: - branches: [ main ] - workflow_dispatch: +on: [push, pull_request] jobs: build-deb: From 9d1fc0704d04624ea26ececbc79218f4bdbdf0f1 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 27 Dec 2024 11:48:01 +0100 Subject: [PATCH 5/7] bump build --- .github/workflows/build-deb-package.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-deb-package.yml b/.github/workflows/build-deb-package.yml index 46f0c105838..b72dc83b667 100644 --- a/.github/workflows/build-deb-package.yml +++ b/.github/workflows/build-deb-package.yml @@ -34,6 +34,7 @@ jobs: - name: Build the Debian Package run: | + tar cvzf changedetection.io_1.0.orig.tar.gz . debuild -us -uc - name: Upload Debian Package Artifact From d013928a6ce3944a93519a7e24996db21ede8382 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 27 Dec 2024 12:16:14 +0100 Subject: [PATCH 6/7] link to pypi version --- .github/workflows/build-deb-package.yml | 9 ++++++++- MANIFEST.in | 3 +++ .../usr/share/doc/changedetection.io/changelog.Debian | 5 ----- debian/changelog | 2 +- debian/control | 1 + debian/rules | 1 + 6 files changed, 14 insertions(+), 7 deletions(-) delete mode 100644 debian/changedetection.io/usr/share/doc/changedetection.io/changelog.Debian diff --git a/.github/workflows/build-deb-package.yml b/.github/workflows/build-deb-package.yml index b72dc83b667..89491fcc886 100644 --- a/.github/workflows/build-deb-package.yml +++ b/.github/workflows/build-deb-package.yml @@ -7,10 +7,14 @@ jobs: build-deb: runs-on: ubuntu-latest name: Build and Package changedetection.io + env: + PACKAGE_VERSION: 0.48.5 # or load from somewhere else steps: - name: Checkout repository uses: actions/checkout@v3 + with: + path: changedetection.io-${{ env.PACKAGE_VERSION }} - name: Set up Python 3.10 uses: actions/setup-python@v4 @@ -33,8 +37,11 @@ jobs: debhelper-compat - name: Build the Debian Package + # Build it the same as the pypi way, then use the same package tar run: | - tar cvzf changedetection.io_1.0.orig.tar.gz . + mkdir /tmp/changedetection.io + python3 -m build + mv dist/*gz . debuild -us -uc - name: Upload Debian Package Artifact diff --git a/MANIFEST.in b/MANIFEST.in index 47d95225798..343553e2cf3 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -10,6 +10,8 @@ recursive-include changedetectionio/tests * prune changedetectionio/static/package-lock.json prune changedetectionio/static/styles/node_modules prune changedetectionio/static/styles/package-lock.json +prune changedetectionio/tests/test-datastore + include changedetection.py include requirements.txt include README-pip.md @@ -18,5 +20,6 @@ global-exclude node_modules global-exclude venv global-exclude test-datastore +global-exclude changedetectionio/tests/test-datastore global-exclude changedetection.io*dist-info global-exclude changedetectionio/tests/proxy_socks5/test-datastore diff --git a/debian/changedetection.io/usr/share/doc/changedetection.io/changelog.Debian b/debian/changedetection.io/usr/share/doc/changedetection.io/changelog.Debian deleted file mode 100644 index e9265678f95..00000000000 --- a/debian/changedetection.io/usr/share/doc/changedetection.io/changelog.Debian +++ /dev/null @@ -1,5 +0,0 @@ -changedetection.io (1.0-1) unstable; urgency=medium - - * Initial release. - - -- Your Name Wed, 01 Nov 2023 12:00:00 +0000 diff --git a/debian/changelog b/debian/changelog index e9265678f95..637bc42afe4 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,4 +1,4 @@ -changedetection.io (1.0-1) unstable; urgency=medium +changedetection.io (0.48.5) unstable; urgency=medium * Initial release. diff --git a/debian/control b/debian/control index f0f9c488829..2821574d90b 100644 --- a/debian/control +++ b/debian/control @@ -6,6 +6,7 @@ Build-Depends: debhelper-compat (= 13), dh-virtualenv, dh-python, python3-all (> Standards-Version: 4.6.0 Rules-Requires-Root: no Homepage: https://github.com/dgtlmoon/changedetection.io +X-Python3-Version: >= 3.10 Package: changedetection.io Architecture: all diff --git a/debian/rules b/debian/rules index daccd392dc1..b0166a65297 100755 --- a/debian/rules +++ b/debian/rules @@ -8,5 +8,6 @@ PYTHON_VERSION := $(shell py3versions -r '>= 3.10 << 3.13' -i) override_dh_virtualenv: dh_virtualenv --sourcedirectory=. \ --install-suffix='' \ + --destdir=/tmp/changedetection.io \ --requirements=requirements.txt \ --python=/usr/bin/$(PYTHON_VERSION) \ No newline at end of file From dfab8647452e4a72af0f0971938dc371a6f50775 Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Fri, 27 Dec 2024 12:57:01 +0100 Subject: [PATCH 7/7] WIP --- .github/workflows/build-deb-package.yml | 4 ++-- .../generated/changedetection.io/installed-by-dh_install | 1 - .../generated/changedetection.io/installed-by-dh_installdocs | 0 debian/control | 5 ++--- debian/debhelper-build-stamp | 2 +- debian/rules | 5 +---- 6 files changed, 6 insertions(+), 11 deletions(-) delete mode 100644 debian/.debhelper/generated/changedetection.io/installed-by-dh_install delete mode 100644 debian/.debhelper/generated/changedetection.io/installed-by-dh_installdocs diff --git a/.github/workflows/build-deb-package.yml b/.github/workflows/build-deb-package.yml index 89491fcc886..47c92505cea 100644 --- a/.github/workflows/build-deb-package.yml +++ b/.github/workflows/build-deb-package.yml @@ -16,10 +16,10 @@ jobs: with: path: changedetection.io-${{ env.PACKAGE_VERSION }} - - name: Set up Python 3.10 + - name: Set up Python 3.11 uses: actions/setup-python@v4 with: - python-version: '3.10' + python-version: '3.11' - name: Install Build Dependencies run: | diff --git a/debian/.debhelper/generated/changedetection.io/installed-by-dh_install b/debian/.debhelper/generated/changedetection.io/installed-by-dh_install deleted file mode 100644 index 8d6095dc921..00000000000 --- a/debian/.debhelper/generated/changedetection.io/installed-by-dh_install +++ /dev/null @@ -1 +0,0 @@ -./debian/changedetection.io.service diff --git a/debian/.debhelper/generated/changedetection.io/installed-by-dh_installdocs b/debian/.debhelper/generated/changedetection.io/installed-by-dh_installdocs deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/debian/control b/debian/control index 2821574d90b..2e50df25630 100644 --- a/debian/control +++ b/debian/control @@ -6,10 +6,9 @@ Build-Depends: debhelper-compat (= 13), dh-virtualenv, dh-python, python3-all (> Standards-Version: 4.6.0 Rules-Requires-Root: no Homepage: https://github.com/dgtlmoon/changedetection.io -X-Python3-Version: >= 3.10 -Package: changedetection.io +Package: python-changedetection.io Architecture: all Depends: ${misc:Depends}, python3 (>= 3.10), python3 (<< 3.13) Description: Web page change detection - Python application - A web-based application for monitoring web pages for changes. \ No newline at end of file + A web-based application for monitoring web pages for changes. diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp index b1ec0d8802c..6419ac36544 100644 --- a/debian/debhelper-build-stamp +++ b/debian/debhelper-build-stamp @@ -1 +1 @@ -changedetection.io +python-changedetection.io diff --git a/debian/rules b/debian/rules index b0166a65297..9bbbcf4bfdc 100755 --- a/debian/rules +++ b/debian/rules @@ -3,11 +3,8 @@ %: dh $@ --with python-virtualenv --buildsystem=pybuild -PYTHON_VERSION := $(shell py3versions -r '>= 3.10 << 3.13' -i) - override_dh_virtualenv: dh_virtualenv --sourcedirectory=. \ --install-suffix='' \ - --destdir=/tmp/changedetection.io \ --requirements=requirements.txt \ - --python=/usr/bin/$(PYTHON_VERSION) \ No newline at end of file + --python=/usr/bin/python3.11 \ No newline at end of file