diff -pruN 2.1.74-1/debian/changelog 2.1.74-0ubuntu5/debian/changelog
--- 2.1.74-1/debian/changelog	2021-03-27 11:06:38.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/changelog	2022-09-01 02:41:11.000000000 +0000
@@ -1,22 +1,97 @@
-python-rtslib-fb (2.1.74-1) experimental; urgency=medium
+python-rtslib-fb (2.1.74-0ubuntu5) kinetic; urgency=medium
 
-  * New upstream release.
-  * Rebased fix-path-of-etc-saveconfig.json.patch.
-  * Removed CVE-2020-14019 patch applied upstream.
+  * d/p/handle-target-kernel-module-new-attribute-cpus_allow.patch:
+    Handle new Linux kernel module attribute "cpus_allowed_list".
+    (LP: #1988366)
+
+ -- Sergio Durigan Junior <sergio.durigan@canonical.com>  Wed, 31 Aug 2022 22:41:11 -0400
+
+python-rtslib-fb (2.1.74-0ubuntu4) jammy; urgency=medium
+
+  * No-change rebuild to update maintainer scripts, see LP: 1959054
+
+ -- Dave Jones <dave.jones@canonical.com>  Wed, 16 Feb 2022 17:27:17 +0000
+
+python-rtslib-fb (2.1.74-0ubuntu3) hirsute; urgency=medium
+
+  *  d/python3-rtslib-fb.rtslib-fb-targetctl.service: Add check to skip
+     starting this service when running in a container (LP: #1865037).
+
+ -- Chris MacNaughton <chris.macnaughton@ubuntu.com>  Fri, 05 Mar 2021 16:26:14 +0000
+
+python-rtslib-fb (2.1.74-0ubuntu2) hirsute; urgency=medium
+
+  * Fix service fail on install due to name mismatch and lost mkdir (LP: #1916715)
+    - d/python3-rtslib-fb.rtslib-fb-targetctl.service: add back debianized
+      systemd service file
+    - d/rules: install rtslib-fb-targetctl.service as it was in Focal
+
+ -- Christian Ehrhardt <christian.ehrhardt@canonical.com>  Wed, 24 Feb 2021 09:32:35 +0100
+
+python-rtslib-fb (2.1.74-0ubuntu1) hirsute; urgency=medium
+
+  * New upstream release.  Remaining changes:
+    - d/p/fix-path-of-etc-saveconfig.json.patch: Refresh patch.
+    - d/p/lp1891214-disable-xen-pvscsi.patch: Disable xen-pvscsi due
+      to unsup xen_scsiback module (LP #1891214)
+    - Adjust rules for build, install, man, docs, init and systemd:
+      + Use the pybuild build system.
+      + Add override_installman to install manpages.
+      + Add override_dh_installdocs to install the .md documentation
+        files shipped by the project.
+      + Simplify override_dh_installinit.
+      + Add override_dh_installsystemd to install the systemd unit file.
+    - d/p/fix-interpreter-version.patch: Set interpreter version to
+      Python 3.
+  * Dropped changes:
+    - d/p/CVE-2020-14019.patch: keep proper umask when calling
+      shutil.copy() in rtslib/root.py.
+      [Incorporated by upstream]
+  * Added changes:
+    - d/python3-rtslib-fb.install: Use wildcard to match any Python
+      version when installing the files.
+    - Reenable testsuite run (LP: #1890243)
+      + d/control: B-D on python3-pyudev.
+      + d/rules: Don't disable tests.
+
+ -- Sergio Durigan Junior <sergio.durigan@canonical.com>  Fri, 29 Jan 2021 15:34:36 -0500
+
+python-rtslib-fb (2.1.73-1ubuntu4) groovy; urgency=medium
 
- -- Thomas Goirand <zigo@debian.org>  Sat, 27 Mar 2021 12:06:38 +0100
+  * Disable xen-pvscsi due to unsup xen_scsiback module (LP: #1891214)
 
-python-rtslib-fb (2.1.71-3) unstable; urgency=medium
+ -- Rafael David Tinoco <rafaeldtinoco@ubuntu.com>  Tue, 08 Sep 2020 17:11:00 +0000
 
-  * CVE-2020-14019: Open-iSCSI rtslib-fb through 2.1.72 has weak permissions
-    for /etc/target/saveconfig.json because shutil.copyfile (instead of
-    shutil.copy) is used, and thus permissions are not preserved. In Debian,
-    this file is /etc/rtslib-fb-target/saveconfig.json. Add commits from
-    https://github.com/open-iscsi/rtslib-fb/pull/162/commits to fix this.
-    (Closes: #972227).
-  * Fixed rtslib-fb-targetctl systemd .service installation.
+python-rtslib-fb (2.1.73-1ubuntu3) groovy; urgency=medium
 
- -- Thomas Goirand <zigo@debian.org>  Sun, 22 Nov 2020 20:33:22 +0100
+  * SECURITY UPDATE: insecure saveconfig.json permissions
+    - debian/patches/CVE-2020-14019.patch: keep proper umask when calling
+      shutil.copy() in rtslib/root.py.
+    - CVE-2020-14019
+
+ -- Marc Deslauriers <marc.deslauriers@ubuntu.com>  Tue, 18 Aug 2020 10:25:05 -0400
+
+python-rtslib-fb (2.1.73-1ubuntu2) groovy; urgency=medium
+
+  * Fix FTBFS for python3 (LP #1890243)
+
+ -- Rafael David Tinoco <rafaeldtinoco@ubuntu.com>  Tue, 04 Aug 2020 07:13:51 +0000
+
+python-rtslib-fb (2.1.73-1ubuntu1) groovy; urgency=medium
+
+  * New upstream version.
+
+ -- Rafael David Tinoco <rafaeldtinoco@ubuntu.com>  Tue, 04 Aug 2020 05:25:13 +0000
+
+python-rtslib-fb (2.1.73-1) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * New upstream version 2.1.73
+  * Update d/p/fix-path-of-etc-saveconfig.json.patch
+  * Adjust rules for build, install, man, docs, init and systemd
+  * Fix interpreter version: d/p/fix-interpreter-version.patch
+
+ -- Rafael David Tinoco <rafaeldtinoco@ubuntu.com>  Sat, 27 Jun 2020 02:46:27 +0000
 
 python-rtslib-fb (2.1.71-2) unstable; urgency=medium
 
@@ -33,6 +108,12 @@ python-rtslib-fb (2.1.71-1) experimental
 
  -- Thomas Goirand <zigo@debian.org>  Mon, 30 Mar 2020 10:58:30 +0200
 
+python-rtslib-fb (2.1.71-0ubuntu1) focal; urgency=medium
+
+  * New upstream release.
+
+ -- James Page <james.page@ubuntu.com>  Tue, 25 Feb 2020 13:36:13 +0000
+
 python-rtslib-fb (2.1.69-3) unstable; urgency=medium
 
   [ Ondřej Nový ]
diff -pruN 2.1.74-1/debian/control 2.1.74-0ubuntu5/debian/control
--- 2.1.74-1/debian/control	2021-03-27 11:06:38.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/control	2021-01-29 20:51:25.000000000 +0000
@@ -1,16 +1,17 @@
 Source: python-rtslib-fb
 Section: python
 Priority: optional
-Maintainer: Debian OpenStack <team+openstack@tracker.debian.org>
+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
+XSBC-Original-Maintainer: Debian OpenStack <team+openstack@tracker.debian.org>
 Uploaders:
  Thomas Goirand <zigo@debian.org>,
  Andy Grover <andy@groveronline.com>,
 Build-Depends:
  debhelper-compat (= 11),
  dh-python,
- openstack-pkg-tools (>= 99~),
  python3-all,
  python3-setuptools,
+ python3-pyudev,
 Build-Depends-Indep:
  python3-six,
 Standards-Version: 4.5.0
diff -pruN 2.1.74-1/debian/patches/fix-interpreter-version.patch 2.1.74-0ubuntu5/debian/patches/fix-interpreter-version.patch
--- 2.1.74-1/debian/patches/fix-interpreter-version.patch	1970-01-01 00:00:00.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/patches/fix-interpreter-version.patch	2022-09-01 02:40:38.000000000 +0000
@@ -0,0 +1,15 @@
+Description: Use python3 as interpreter by default
+Author: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
+Last-Update: 2020-06-26
+---
+ scripts/targetctl | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/scripts/targetctl
++++ b/scripts/targetctl
+@@ -1,4 +1,4 @@
+-#!/usr/bin/python
++#!/usr/bin/python3
+ '''
+ targetctl
+ 
diff -pruN 2.1.74-1/debian/patches/fix-path-of-etc-saveconfig.json.patch 2.1.74-0ubuntu5/debian/patches/fix-path-of-etc-saveconfig.json.patch
--- 2.1.74-1/debian/patches/fix-path-of-etc-saveconfig.json.patch	2021-03-27 11:06:38.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/patches/fix-path-of-etc-saveconfig.json.patch	2022-09-01 02:40:38.000000000 +0000
@@ -3,31 +3,124 @@ Description: Fix path for the /etc/targe
  this to /etc/rtslib-fb-target/saveconfig.json
 Author: Thomas Goirand <zigo@debian.org>
 Forwarded: no
-Last-Update: 2014-01-25
+Reviewed-by: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
+Last-Update: 2020-06-26
 
-Index: python-rtslib-fb/scripts/targetctl
+---
+ doc/saveconfig.json.5   | 4 ++--
+ doc/targetctl.8         | 4 ++--
+ rtslib/root.py          | 8 ++++----
+ scripts/convert-to-json | 2 +-
+ scripts/targetctl       | 2 +-
+ 5 files changed, 10 insertions(+), 10 deletions(-)
+
+Index: python-rtslib-fb/doc/saveconfig.json.5
 ===================================================================
---- python-rtslib-fb.orig/scripts/targetctl
-+++ python-rtslib-fb/scripts/targetctl
-@@ -28,7 +28,7 @@ from rtslib_fb import RTSRoot
- import os
- import sys
- 
--default_save_file = "/etc/target/saveconfig.json"
-+default_save_file = "/etc/rtslib-fb-target/saveconfig.json"
- err = sys.stderr
- 
- def usage():
+--- python-rtslib-fb.orig/doc/saveconfig.json.5	2021-01-29 10:39:37.243019916 -0500
++++ python-rtslib-fb/doc/saveconfig.json.5	2021-01-29 10:39:37.239019953 -0500
+@@ -3,7 +3,7 @@
+ .B saveconfig.json
+ \- Saved configuration file for rtslib-fb and LIO kernel target
+ .SH DESCRIPTION
+-.B /etc/target/saveconfig.json
++.B /etc/rtslib-fb-target/saveconfig.json
+ is the default location for storing the configuration of the Linux
+ kernel target, also known as LIO. Since the target is in the kernel, tools like
+ .B targetctl
+@@ -239,7 +239,7 @@
+ .BR targetcli (8),
+ .BR targetctl (8)
+ .SH FILES
+-.B /etc/target/saveconfig.json
++.B /etc/rtslib-fb-target/saveconfig.json
+ .SH AUTHOR
+ Man page written by Andy Grover <agrover@redhat.com>.
+ .SH REPORTING BUGS
+Index: python-rtslib-fb/doc/targetctl.8
+===================================================================
+--- python-rtslib-fb.orig/doc/targetctl.8	2021-01-29 10:39:37.243019916 -0500
++++ python-rtslib-fb/doc/targetctl.8	2021-01-29 10:39:37.239019953 -0500
+@@ -26,7 +26,7 @@
+ is not supplied,
+ .B targetctl
+ will use the default file location,
+-.BR /etc/target/saveconfig.json.
++.BR /etc/rtslib-fb-target/saveconfig.json.
+ .P
+ .B targetctl restore [config-file]
+ .P
+@@ -50,7 +50,7 @@
+ .BR targetd (8),
+ .BR saveconfig.json (5)
+ .SH FILES
+-.B /etc/target/saveconfig.json
++.B /etc/rtslib-fb-target/saveconfig.json
+ .P
+ .B /sys/kernel/config/target
+ .SH AUTHOR
 Index: python-rtslib-fb/rtslib/root.py
 ===================================================================
---- python-rtslib-fb.orig/rtslib/root.py
-+++ python-rtslib-fb/rtslib/root.py
+--- python-rtslib-fb.orig/rtslib/root.py	2021-01-29 10:39:37.243019916 -0500
++++ python-rtslib-fb/rtslib/root.py	2021-01-29 10:39:37.239019953 -0500
 @@ -34,7 +34,7 @@
  from .utils import fread, fwrite
  from .alua import ALUATargetPortGroup
  
 -default_save_file = "/etc/target/saveconfig.json"
-+default_save_file = "/etc/rtslib-fb-targets/saveconfig.json"
++default_save_file = "/etc/rtslib-fb-target/saveconfig.json"
  
  class RTSRoot(CFSNode):
      '''
+@@ -65,7 +65,7 @@
+     # this should match the kernel target driver default db dir
+     _default_dbroot = "/var/target"
+     # this is where the target DB is to be located (instead of the default)
+-    _preferred_dbroot = "/etc/target"
++    _preferred_dbroot = "/etc/rtslib-fb-target"
+ 
+     def __init__(self):
+         '''
+@@ -449,7 +449,7 @@
+     def save_to_file(self, save_file=None, so_path=None):
+         '''
+         Write the configuration in json format to a file.
+-        Save file defaults to '/etc/target/saveconfig.json'.
++        Save file defaults to '/etc/rtslib-fb-target/saveconfig.json'.
+         '''
+         if not save_file:
+             save_file = default_save_file
+@@ -496,7 +496,7 @@
+                           abort_on_error=False):
+         '''
+         Restore the configuration from a file in json format.
+-        Restore file defaults to '/etc/target/saveconfig.json'.
++        Restore file defaults to '/etc/rtslib-fb-target/saveconfig.json'.
+         Returns a list of non-fatal errors. If abort_on_error is set,
+           it will raise the exception instead of continuing.
+         '''
+Index: python-rtslib-fb/scripts/convert-to-json
+===================================================================
+--- python-rtslib-fb.orig/scripts/convert-to-json	2021-01-29 10:39:37.243019916 -0500
++++ python-rtslib-fb/scripts/convert-to-json	2021-01-29 10:39:37.239019953 -0500
+@@ -316,7 +316,7 @@
+         elif txt[cur] == "fabric":
+             cur = parse_fabric(txt, cur)
+ 
+-with open("/etc/target/scsi_target.lio") as f:
++with open("/etc/rtslib-fb-target/scsi_target.lio") as f:
+     txt = f.read()
+     txt = split(txt)
+     cur = parse(txt, 0)
+Index: python-rtslib-fb/scripts/targetctl
+===================================================================
+--- python-rtslib-fb.orig/scripts/targetctl	2021-01-29 10:39:37.243019916 -0500
++++ python-rtslib-fb/scripts/targetctl	2021-01-29 10:39:37.239019953 -0500
+@@ -28,7 +28,7 @@
+ import os
+ import sys
+ 
+-default_save_file = "/etc/target/saveconfig.json"
++default_save_file = "/etc/rtslib-fb-target/saveconfig.json"
+ err = sys.stderr
+ 
+ def usage():
diff -pruN 2.1.74-1/debian/patches/handle-target-kernel-module-new-attribute-cpus_allow.patch 2.1.74-0ubuntu5/debian/patches/handle-target-kernel-module-new-attribute-cpus_allow.patch
--- 2.1.74-1/debian/patches/handle-target-kernel-module-new-attribute-cpus_allow.patch	1970-01-01 00:00:00.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/patches/handle-target-kernel-module-new-attribute-cpus_allow.patch	2022-09-01 02:41:11.000000000 +0000
@@ -0,0 +1,82 @@
+From: Mingzhe Zou <zoumingzhe@qq.com>
+Date: Fri, 11 Feb 2022 15:49:23 +0800
+Subject: handle target kernel module new attribute cpus_allowed_list
+
+target has been added cpus_allowed_list attribute in sysfs.
+Therefore, the rtslib should handle the new attribute:
+    1. add cpus_allowed_list item in target_names_excludes
+    2. add cpus_allowed_list feature in ISCSIFabricModule
+
+Signed-off-by: Zou Mingzhe mingzhe.zou@easystack.cn
+
+Origin: upstream, https://github.com/open-iscsi/rtslib-fb/commit/8d2543c4da62e962661011fea5b19252b9660822
+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-rtslib-fb/+bug/1988366
+Applied-Upstream: 2.1.75
+---
+ rtslib/fabric.py | 32 ++++++++++++++++++++++++++++----
+ 1 file changed, 28 insertions(+), 4 deletions(-)
+
+diff --git a/rtslib/fabric.py b/rtslib/fabric.py
+index cb23a0f..aacbce7 100644
+--- a/rtslib/fabric.py
++++ b/rtslib/fabric.py
+@@ -118,9 +118,15 @@ from .utils import RTSLibError, modprobe, ignored
+ from .target import Target
+ from .utils import _get_auth_attr, _set_auth_attr
+ 
+-version_attributes = set(["lio_version", "version"])
+-discovery_auth_attributes = set(["discovery_auth"])
+-target_names_excludes = version_attributes | discovery_auth_attributes
++excludes_list = [
++    # version_attributes
++    "lio_version", "version",
++    # discovery_auth_attributes
++    "discovery_auth",
++    # cpus_allowed_list_attributes
++    "cpus_allowed_list",
++]
++target_names_excludes = set(excludes_list)
+ 
+ 
+ class _BaseFabricModule(CFSNode):
+@@ -144,7 +150,8 @@ class _BaseFabricModule(CFSNode):
+         self.name = name
+         self.spec_file = "N/A"
+         self._path = "%s/%s" % (self.configfs_dir, self.name)
+-        self.features = ('discovery_auth', 'acls', 'auth', 'nps', 'tpgts')
++        self.features = ('discovery_auth', 'acls', 'auth', 'nps', 'tpgts',
++            'cpus_allowed_list')
+         self.wwn_types = ('free',)
+         self.kernel_module = "%s_target_mod" % self.name
+ 
+@@ -220,6 +227,18 @@ class _BaseFabricModule(CFSNode):
+             raise RTSLibError("Fabric module %s does not implement "
+                               + "the %s feature" % (self.name, feature))
+ 
++    def _get_cpus_allowed_list(self):
++        self._check_self()
++        self._assert_feature('cpus_allowed_list')
++        path = "%s/cpus_allowed_list" % self.path
++        return fread(path)
++
++    def _set_cpus_allowed_list(self, allowed):
++        self._check_self()
++        self._assert_feature('cpus_allowed_list')
++        path = "%s/cpus_allowed_list" % self.path
++        fwrite(path, allowed)
++
+     def clear_discovery_auth_settings(self):
+         self._check_self()
+         self._assert_feature('discovery_auth')
+@@ -267,6 +286,11 @@ class _BaseFabricModule(CFSNode):
+         self._assert_feature('discovery_auth')
+         _set_auth_attr(self, *args, **kwargs)
+ 
++    cpus_allowed_list = \
++            property(_get_cpus_allowed_list,
++                     _set_cpus_allowed_list,
++                     doc="Set or get the cpus_allowed_list attribute.")
++
+     discovery_enable_auth = \
+             property(_get_discovery_enable_auth,
+                      _set_discovery_enable_auth,
diff -pruN 2.1.74-1/debian/patches/lp1891214-disable-xen-pvscsi.patch 2.1.74-0ubuntu5/debian/patches/lp1891214-disable-xen-pvscsi.patch
--- 2.1.74-1/debian/patches/lp1891214-disable-xen-pvscsi.patch	1970-01-01 00:00:00.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/patches/lp1891214-disable-xen-pvscsi.patch	2022-09-01 02:40:38.000000000 +0000
@@ -0,0 +1,18 @@
+Description: Disable xen-pvscsi due to unsupported xen_scsiback module
+
+Author: Rafael David Tinoco <rafaeldtinoco@ubuntu.com>
+Bug-Ubuntu: https://launchpad.net/bugs/1891214
+Forwarded: not-needed
+Last-Update: 2020-09-08
+
+--- python-rtslib-fb-2.1.73.orig/rtslib/fabric.py
++++ python-rtslib-fb-2.1.73/rtslib/fabric.py
+@@ -469,7 +469,7 @@ fabric_modules = {
+     "tcm_fc": FCoEFabricModule,
+ #    "usb_gadget": USBGadgetFabricModule, # very rare, don't show
+     "vhost": VhostFabricModule,
+-    "xen-pvscsi": XenPvScsiFabricModule,
++#    "xen-pvscsi": XenPvScsiFabricModule,
+     "ibmvscsis": IbmvscsisFabricModule,
+     }
+ 
diff -pruN 2.1.74-1/debian/patches/series 2.1.74-0ubuntu5/debian/patches/series
--- 2.1.74-1/debian/patches/series	2021-03-27 11:06:38.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/patches/series	2022-09-01 02:40:14.000000000 +0000
@@ -1 +1,4 @@
 fix-path-of-etc-saveconfig.json.patch
+fix-interpreter-version.patch
+lp1891214-disable-xen-pvscsi.patch
+handle-target-kernel-module-new-attribute-cpus_allow.patch
diff -pruN 2.1.74-1/debian/python3-rtslib-fb.install 2.1.74-0ubuntu5/debian/python3-rtslib-fb.install
--- 2.1.74-1/debian/python3-rtslib-fb.install	1970-01-01 00:00:00.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/python3-rtslib-fb.install	2021-01-29 20:51:25.000000000 +0000
@@ -0,0 +1,5 @@
+scripts/convert-to-json                     /usr/bin
+scripts/targetctl                           /usr/bin
+usr/lib/python3*/dist-packages/rtslib       /usr/lib/python3/dist-packages
+usr/lib/python3*/dist-packages/rtslib_fb    /usr/lib/python3/dist-packages
+systemd/target.service                      /lib/systemd/system
diff -pruN 2.1.74-1/debian/python3-rtslib-fb.rtslib-fb-targetctl.init 2.1.74-0ubuntu5/debian/python3-rtslib-fb.rtslib-fb-targetctl.init
--- 2.1.74-1/debian/python3-rtslib-fb.rtslib-fb-targetctl.init	2021-03-27 11:06:38.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/python3-rtslib-fb.rtslib-fb-targetctl.init	2021-01-28 20:34:15.000000000 +0000
@@ -53,7 +53,6 @@ case "$1" in
 start)
 	check_configfs_module
 	check_configfs_mounted
-	mkdir -p /etc/rtslib-fb-target
 	log_daemon_msg "Loading $DESC" "$NAME"
 	${DAEMON} restore
 	if [ $? -gt 0 ] ; then
diff -pruN 2.1.74-1/debian/python3-rtslib-fb.rtslib-fb-targetctl.service 2.1.74-0ubuntu5/debian/python3-rtslib-fb.rtslib-fb-targetctl.service
--- 2.1.74-1/debian/python3-rtslib-fb.rtslib-fb-targetctl.service	2021-03-27 11:06:38.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/python3-rtslib-fb.rtslib-fb-targetctl.service	2022-09-01 02:36:25.000000000 +0000
@@ -2,6 +2,7 @@
 Description=Restore LIO kernel target configuration
 Requires=sys-kernel-config.mount
 After=sys-kernel-config.mount network.target local-fs.target
+ConditionVirtualization=!container
 
 [Service]
 Type=oneshot
diff -pruN 2.1.74-1/debian/rules 2.1.74-0ubuntu5/debian/rules
--- 2.1.74-1/debian/rules	2021-03-27 11:06:38.000000000 +0000
+++ 2.1.74-0ubuntu5/debian/rules	2022-09-01 02:36:25.000000000 +0000
@@ -1,38 +1,36 @@
 #!/usr/bin/make -f
 
-#prevent internet access to use PyPi
-export http_proxy = http://127.0.0.1:9
+export DH_VERBOSE=1
 
-UPSTREAM_GIT := https://github.com/open-iscsi/rtslib-fb.git
-include /usr/share/openstack-pkg-tools/pkgos.make
+include /usr/share/dpkg/default.mk
 
 %:
-	dh $@ --buildsystem=python_distutils --with python3
-
-override_dh_auto_clean:
-	rm -rf build
-	find . -iname '*.pyc' -delete
-	for i in $$(find . -type d -iname __pycache__) ; do rm -rf $$i ; done
-
-override_dh_auto_install:
-	pkgos-dh_auto_install --no-py2
+	dh $@ --with python3 --buildsystem=pybuild
 
 override_dh_auto_build:
-	echo "Do nothing..."
+	pybuild --configure
+	pybuild --build
 
-override_dh_python3:
-	dh_python3 --shebang=/usr/bin/python3
+override_dh_auto_install:
+	mkdir -p debian/tmp/etc/rtslib-fb-target/
+	pybuild --install
 
-#override_dh_installdocs:
-#	mkdir -p build
-#	mkdir -p $(CURDIR)/debian/python-rtslib-fb-doc/usr/share/doc/python-rtslib-fb-doc/html
-#	cd build; epydoc --no-sourcecode --html -n rtslib-fb \
-#		--exclude configobj ../rtslib/*.py \
-#		--output $(CURDIR)/debian/python-rtslib-fb-doc/usr/share/doc/python-rtslib-fb-doc/html
-#	dh_installdocs -O--buildsystem=python_distutils
+override_dh_auto_clean:
+	rm -rf .pybuild/
+	rm -rf build/
+	rm -rf *.egg-info/
+
+override_dh_installman:
+	dh_installman doc/saveconfig.json.5
+	dh_installman doc/targetctl.8
+
+override_dh_installdocs:
+	dh_installdocs README.md
+	dh_installdocs COPYING
+	dh_installdocs doc/getting_started.md
 
 override_dh_installinit:
-	dh_installinit -O--buildsystem=python_distutils --name rtslib-fb-targetctl
+	dh_installinit --name rtslib-fb-targetctl
 
 override_dh_installsystemd:
-	dh_installsystemd -p python3-rtslib-fb --name rtslib-fb-targetctl
+	dh_installsystemd -p python3-rtslib-fb --no-stop-on-upgrade --name rtslib-fb-targetctl
