Package: etckeeper
Version: 1.18.10-1
Severity: normal

Dear Maintainer,

Breezy is the python3 port of bazaar-ng, and I've added a plugin for
that. Otherwise cmdline utility is compatible with bzr invocation.

We also observed an ordering bug due to inconsistent locale usage,
thus switched to unicode C locale by default.

Also deprecated debhelper is in use, and I upgraded to debhelper 11.

Please consider applying/including all or some of these patches.

Regards,

Dimitri.
From b5919d7919dda614c3c3c76ba126f45e205494bd Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <x...@ubuntu.com>
Date: Mon, 29 Apr 2019 14:11:09 +0100
Subject: [PATCH 1/3] Add breezy python3 plugin

---
 Makefile                  |  3 +++
 debian/changelog          |  6 ++++++
 debian/control            |  6 +++---
 etckeeper-brz/__init__.py | 34 ++++++++++++++++++++++++++++++++++
 4 files changed, 46 insertions(+), 3 deletions(-)
 create mode 100644 etckeeper-brz/__init__.py

diff --git a/Makefile b/Makefile
index bac3fd5..c0cb23d 100644
--- a/Makefile
+++ b/Makefile
@@ -16,11 +16,13 @@ INSTALL=install
 INSTALL_EXE=${INSTALL}
 INSTALL_DATA=${INSTALL} -m 0644
 PYTHON=python
+PYTHON3=python3
 FAKEROOT := $(shell command -v fakeroot 2> /dev/null)
 TESTDIR := $(shell mktemp -u -d)
 
 build: etckeeper.spec etckeeper.version
        -$(PYTHON) ./etckeeper-bzr/__init__.py build || echo "** bzr support 
not built"
+       -$(PYTHON3) ./etckeeper-brz/__init__.py build || echo "** bzr support 
not built"
        -$(PYTHON) ./etckeeper-dnf/etckeeper.py build || echo "** DNF support 
not built"
 
 install: etckeeper.version
@@ -66,6 +68,7 @@ ifeq ($(HIGHLEVEL_PACKAGE_MANAGER),zypper)
        $(INSTALL) zypper-etckeeper.py 
$(DESTDIR)$(prefix)/lib/zypp/plugins/commit/zypper-etckeeper.py
 endif
        -$(PYTHON) ./etckeeper-bzr/__init__.py install --root=$(DESTDIR) 
${PYTHON_INSTALL_OPTS} || echo "** bzr support not installed"
+       -$(PYTHON3) ./etckeeper-brz/__init__.py install --root=$(DESTDIR) 
${PYTHON_INSTALL_OPTS} || echo "** brz support not installed"
        echo "** installation successful"
 
 clean: etckeeper.spec etckeeper.version
diff --git a/debian/changelog b/debian/changelog
index aca3d97..9457eb2 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+etckeeper (1.18.11) UNRELEASED; urgency=medium
+
+  * Add breezy python3 plugin
+
+ -- Dimitri John Ledkov <x...@ubuntu.com>  Mon, 29 Apr 2019 14:04:46 +0100
+
 etckeeper (1.18.10) unstable; urgency=medium
 
   * Avoid post-install failing when ps is from busybox or another
diff --git a/debian/control b/debian/control
index 7e3b8dc..f948a26 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,7 @@
 Source: etckeeper
 Section: admin
 Priority: optional
-Build-Depends: debhelper (>= 7), dpkg-dev (>= 1.9.0), bzr (>= 1.5~), python, 
dh-python, bats, fakeroot
+Build-Depends: debhelper (>= 7), dpkg-dev (>= 1.9.0), brz, python2, python3, 
dh-python, bats, fakeroot
 Maintainer: Antoine Beaupré <anar...@debian.org>
 Standards-Version: 3.9.8
 XS-Python-Version: all
@@ -11,11 +11,11 @@ Homepage: http://etckeeper.branchable.com/
 Package: etckeeper
 Architecture: all
 Section: admin
-Depends: git (>= 1:1.7) | mercurial | bzr (>= 1.5~) | darcs, ${misc:Depends}
+Depends: git (>= 1:1.7) | mercurial | brz | bzr (>= 1.5~) | darcs, 
${python3:Depends}, ${misc:Depends}
 Recommends: cron-daemon
 Suggests: sudo (>= 1.7.4p4)
 Conflicts: bzr (<< 1.5~)
-Description: store /etc in git, mercurial, bzr or darcs
+Description: store /etc in git, mercurial, brz, bzr or darcs
  The etckeeper program is a tool to let /etc be stored in a git, mercurial,
  bzr or darcs repository. It hooks into APT to automatically commit changes
  made to /etc during package upgrades. It tracks file metadata that version
diff --git a/etckeeper-brz/__init__.py b/etckeeper-brz/__init__.py
new file mode 100644
index 0000000..5f04ba6
--- /dev/null
+++ b/etckeeper-brz/__init__.py
@@ -0,0 +1,34 @@
+#
+# Breezy plugin that runs etckeeper pre-commit when necessary
+
+"""Runs etckeeper pre-commit when necessary."""
+
+from breezy.errors import BzrError
+import os
+
+def etckeeper_startcommit_hook(tree):
+    abspath = getattr(tree, "abspath", None)
+    if abspath is None or not os.path.exists(abspath(".etckeeper")):
+        # Only run the commit hook when this is an etckeeper branch
+        return
+    import subprocess
+    ret = subprocess.call(["etckeeper", "pre-commit", abspath(".")])
+    if ret != 0:
+        raise BzrError("etckeeper pre-commit failed")
+
+try:
+    from breezy.hooks import install_lazy_named_hook
+except ImportError:
+    from breezy.mutabletree import MutableTree
+    MutableTree.hooks.install_named_hook('start_commit',
+        etckeeper_startcommit_hook, 'etckeeper')
+else:
+    install_lazy_named_hook(
+        "breezy.mutabletree", "MutableTree.hooks",
+        'start_commit', etckeeper_startcommit_hook, 'etckeeper')
+
+if __name__ == "__main__":
+    from distutils.core import setup
+    setup(name="brz-etckeeper",
+          packages=["breezy.plugins.etckeeper"],
+          package_dir={"breezy.plugins.etckeeper":"etckeeper-brz"})
-- 
2.20.1

>From 10d74939aeff32d6638b905ec248ccd6f37fe512 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <x...@ubuntu.com>
Date: Mon, 29 Apr 2019 14:11:51 +0100
Subject: [PATCH 2/3] Default to UTF8 encoding, for consistent ordering

---
 debian/changelog              | 1 +
 etckeeper                     | 4 ++++
 pre-commit.d/30store-metadata | 2 +-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 9457eb2..01aa03a 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,7 @@
 etckeeper (1.18.11) UNRELEASED; urgency=medium
 
   * Add breezy python3 plugin
+  * Default to UTF8 encoding, for consistent ordering
 
  -- Dimitri John Ledkov <x...@ubuntu.com>  Mon, 29 Apr 2019 14:04:46 +0100
 
diff --git a/etckeeper b/etckeeper
index 73b6a1f..e1be2e6 100755
--- a/etckeeper
+++ b/etckeeper
@@ -54,6 +54,10 @@ fi
 if [ ! -z "$AVOID_SPECIAL_FILE_WARNING" ]; then
        export AVOID_SPECIAL_FILE_WARNING
 fi
+if [ -z "$LANG" ]; then
+       # Default to UTF8 encoding, if unset
+       export LANG=C.UTF-8
+fi
 
 if [ ! -z "$PUSH_REMOTE" ]; then
        export PUSH_REMOTE
diff --git a/pre-commit.d/30store-metadata b/pre-commit.d/30store-metadata
index ce014d1..e070bce 100755
--- a/pre-commit.d/30store-metadata
+++ b/pre-commit.d/30store-metadata
@@ -2,7 +2,7 @@
 set -e
 
 # Make sure sort always sorts in same order.
-LANG=C
+LANG=C.UTF-8
 export LANG
 
 filter_ignore() {
-- 
2.20.1

From cd544a86ef6fefd18639440b8fe153c6672cf671 Mon Sep 17 00:00:00 2001
From: Dimitri John Ledkov <x...@ubuntu.com>
Date: Mon, 29 Apr 2019 14:12:55 +0100
Subject: [PATCH 3/3] Upgrade to debhelper 11

---
 debian/changelog | 1 +
 debian/compat    | 2 +-
 debian/control   | 2 +-
 debian/rules     | 2 +-
 4 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 01aa03a..a45915c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ etckeeper (1.18.11) UNRELEASED; urgency=medium
 
   * Add breezy python3 plugin
   * Default to UTF8 encoding, for consistent ordering
+  * Upgrade to debhelper 11
 
  -- Dimitri John Ledkov <x...@ubuntu.com>  Mon, 29 Apr 2019 14:04:46 +0100
 
diff --git a/debian/compat b/debian/compat
index 7f8f011..b4de394 100644
--- a/debian/compat
+++ b/debian/compat
@@ -1 +1 @@
-7
+11
diff --git a/debian/control b/debian/control
index f948a26..58bf07c 100644
--- a/debian/control
+++ b/debian/control
@@ -1,7 +1,7 @@
 Source: etckeeper
 Section: admin
 Priority: optional
-Build-Depends: debhelper (>= 7), dpkg-dev (>= 1.9.0), brz, python2, python3, 
dh-python, bats, fakeroot
+Build-Depends: debhelper (>= 11), dpkg-dev (>= 1.9.0), brz, python2, python3, 
dh-python, bats, fakeroot
 Maintainer: Antoine Beaupré <anar...@debian.org>
 Standards-Version: 3.9.8
 XS-Python-Version: all
diff --git a/debian/rules b/debian/rules
index 603f44e..d2fce42 100755
--- a/debian/rules
+++ b/debian/rules
@@ -3,7 +3,7 @@
 export PYTHON_INSTALL_OPTS=--install-layout=deb
 
 %:
-       dh --with python2 $@
+       dh $@ --with python3
 
 override_dh_installdocs:
        dh_installdocs -X.gitignore
-- 
2.20.1

Reply via email to