From c0d09e598a153624532f8d3b2ebcab5808e6c958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Frings-F=C3=BCrst?= Date: Sat, 14 Oct 2017 22:26:22 +0200 Subject: Install mwctools.py to /usr/share/mwc; New debian/patches/0001-config.patch; New debian/NEWS.Debian --- debian/NEWS.Debian | 6 +++ debian/changelog | 10 +++++ debian/mwc.install | 1 + debian/patches/0001-config.patch | 83 ++++++++++++++++++++++++++++++++++++++++ debian/patches/series | 1 + 5 files changed, 101 insertions(+) create mode 100644 debian/NEWS.Debian create mode 100644 debian/patches/0001-config.patch diff --git a/debian/NEWS.Debian b/debian/NEWS.Debian new file mode 100644 index 0000000..339080e --- /dev/null +++ b/debian/NEWS.Debian @@ -0,0 +1,6 @@ +mwc (2.0.4-2) unstable; urgency=high + + Since release 2.0.0 the syntacs of the config file has + changed. Please read the sample for rewrite. + + -- Jörg Frings-Fürst Sat, 14 Oct 2017 19:57:10 +0200 diff --git a/debian/changelog b/debian/changelog index 716efc8..8c50dab 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,13 @@ +mwc (2.0.4-2) UNRELEASED; urgency=medium + + * debian/mwc.install: + - Install mwctools.py to /usr/share/mwc (Closes: #877924). + * New debian/patches/0001-config.patch: + - Add loading config from every path (Closes: #877927). + * New debian/NEWS.Debian about the new config file syntax. + + -- Jörg Frings-Fürst Sat, 14 Oct 2017 19:57:10 +0200 + mwc (2.0.4-1) unstable; urgency=medium * New upstream release: diff --git a/debian/mwc.install b/debian/mwc.install index d893da8..65e0d12 100644 --- a/debian/mwc.install +++ b/debian/mwc.install @@ -1,2 +1,3 @@ mwc.py /usr/share/mwc +mwctools.py /usr/share/mwc mwcfeedserver.py /usr/share/mwc diff --git a/debian/patches/0001-config.patch b/debian/patches/0001-config.patch new file mode 100644 index 0000000..df47bb4 --- /dev/null +++ b/debian/patches/0001-config.patch @@ -0,0 +1,83 @@ +Description: add loading config from every path + Add loading config from every path + Separation data / program +Author: Jörg Frings-Fürst +Last-Update: 2017-10-14 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +Index: trunk/mwc.py +=================================================================== +--- trunk.orig/mwc.py ++++ trunk/mwc.py +@@ -198,7 +198,7 @@ def pollWebsites(): + + + if __name__ == "__main__": +- configMod = 'config' ++ configMod = '/etc/mwc/mwc-config' + dryrun = None + + try: +@@ -215,7 +215,23 @@ if __name__ == "__main__": + elif opt in ('-d', '--dry-run'): + dryrun = arg + +- config = importlib.import_module(configMod) ++ # ++ # add code to load config from nonsystem path ++ # and change to datadir ++ # ++ try: ++ path = os.path.dirname(configMod) ++ fullname = os.path.basename(configMod) ++ sys.path.append(path) ++ config = importlib.import_module(fullname) ++ except: ++ print('Error: loading config') ++ sys.exit(2) ++ try: ++ os.chdir(config.datadir) ++ except: ++ print('Error: datadir not found') ++ sys.exit(3) + + if dryrun: + for thesite in config.sites: +Index: trunk/mwcfeedserver.py +=================================================================== +--- trunk.orig/mwcfeedserver.py ++++ trunk/mwcfeedserver.py +@@ -14,7 +14,7 @@ import getopt + + bind = 'localhost' + port = 8000 +-configMod = 'config' ++configMod = '/etc/mwc/mwc-config' + + + try: +@@ -34,7 +34,23 @@ for opt, arg in opts: + elif opt in ('-p', '--port'): + port = int(arg) + +-config = importlib.import_module(configMod) ++ # ++ # add code to load config from nonsystem path ++ # and change to datadir ++ # ++ try: ++ path = os.path.dirname(configMod) ++ fullname = os.path.basename(configMod) ++ sys.path.append(path) ++ config = importlib.import_module(fullname) ++ except: ++ print('Error: loading config') ++ sys.exit(2) ++ try: ++ os.chdir(config.datadir) ++ except: ++ print('Error: datadir not found') ++ sys.exit(3) + + + handler = http.server.SimpleHTTPRequestHandler diff --git a/debian/patches/series b/debian/patches/series index e69de29..2361bcf 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -0,0 +1 @@ +0001-config.patch -- cgit v1.2.3