diff -Nru cpm-0.32/debian/changelog cpm-0.32/debian/changelog
--- cpm-0.32/debian/changelog	2020-08-19 04:15:38.000000000 +1000
+++ cpm-0.32/debian/changelog	2022-03-27 22:15:18.000000000 +1100
@@ -1,3 +1,31 @@
+cpm (0.32-1.4) unstable; urgency=medium
+
+  * Non-maintainer upload.
+  * Switch to debhelper-compat v13.
+  * debian/changelog: Remove trailing whitespace.
+  * debian/copyright: Switch to DEP-5 format and update for 2022.
+  * debian/control:
+    - Priority: extra -> optional.
+    - Update Build-Depends:
+      + libgpgme11-dev -> libgpgme-dev.
+      + libncurses5-dev -> libncurses-dev (Closes: #851594).
+      + Require pkg-config.
+      + Remove autotools-dev and dh_autoreconf (no longer needed).
+      + Remove duplicate libcdk5-dev entry.
+    - Declare Rules-Requires-Root: binary-targets.
+    - Update Vcs-Git and homepage fields.
+    - Raise Standards-Version to 4.6.0 (no changes needed).
+    - Remove trailing whitespace.
+  * debian/patches:
+    - Use pkg-config to find libxml2 (Closes: #949088).
+    - Remove non-POSIX features from configure.in (Closes: #998786).
+    - Rename 'ftbfs.patch' to fix-ftbfs-gcc-10.patch'.
+  * debian/rules: Remove unneeded dh arguments --parallel --with=autoreconf.
+  * Add debian/upstream/metadata file.
+  * Update debian/watch and point to GitHub.
+
+ -- Hugh McMaster <hugh.mcmaster@outlook.com>  Sun, 27 Mar 2022 22:15:18 +1100
+
 cpm (0.32-1.3) unstable; urgency=medium
 
   * Non-maintainer upload.
@@ -17,7 +45,7 @@
 
   * Non-maintainer upload.
   * Fix ftbfs due to cdk.h moved from /usr/include/cdk to /usr/include
-    (Closes: #802221) 
+    (Closes: #802221)
 
  -- YunQiang Su <syq@debian.org>  Sun, 18 Oct 2015 23:14:34 +0800
 
@@ -74,6 +102,6 @@
 
 cpm (0.25-1) unstable; urgency=low
 
-  * Initial release (Closes: #522225, #588526) 
+  * Initial release (Closes: #522225, #588526)
 
  -- Stig Sandbeck Mathisen <ssm@debian.org>  Mon, 17 Jan 2011 17:40:55 +0100
diff -Nru cpm-0.32/debian/compat cpm-0.32/debian/compat
--- cpm-0.32/debian/compat	2020-08-19 04:05:18.000000000 +1000
+++ cpm-0.32/debian/compat	1970-01-01 10:00:00.000000000 +1000
@@ -1 +0,0 @@
-9
diff -Nru cpm-0.32/debian/control cpm-0.32/debian/control
--- cpm-0.32/debian/control	2020-08-19 04:05:18.000000000 +1000
+++ cpm-0.32/debian/control	2022-03-27 22:03:31.000000000 +1100
@@ -1,32 +1,30 @@
 Source: cpm
 Section: utils
-Priority: extra
+Priority: optional
 Maintainer: Kacper Wysocki (Redpill-Linpro) <kwy@redpill-linpro.com>
 Uploaders: Stig Sandbeck Mathisen <ssm@debian.org>
 Build-Depends:
- debhelper (>= 9~),
- autotools-dev,
- dh-autoreconf,
+ debhelper-compat (= 13),
  libcdk5-dev,
  libcrack2-dev,
  libdotconf-dev,
- libgpgme11-dev,
- libncurses5-dev,
- libncursesw5-dev,
+ libgpgme-dev,
+ libncurses-dev,
  libxml2-dev,
+ pkg-config,
  txt2man,
- zlib1g-dev,
- libcdk5-dev,
-Standards-Version: 3.9.5
-Vcs-Git: git://github.com/comotion/cpm.git
+ zlib1g-dev
+Standards-Version: 4.6.0
+Rules-Requires-Root: binary-targets
+Homepage: https://github.com/comotion/cpm
 Vcs-Browser: https://github.com/comotion/cpm
-Homepage: http://github.com/comotion/cpm
+Vcs-Git: https://github.com/comotion/cpm.git
 
 Package: cpm
 Architecture: any
 Depends: ${misc:Depends}, ${shlibs:Depends},
  libxml2-utils
-Description: Curses based password manager using PGP-encryption 
+Description: Curses based password manager using PGP-encryption
  This program is a ncurses based console tool to manage passwords
  and store them public key encrypted in a file - even for more than
  one person. The encryption is handled via GnuPG so the programs data
diff -Nru cpm-0.32/debian/copyright cpm-0.32/debian/copyright
--- cpm-0.32/debian/copyright	2020-08-19 04:05:18.000000000 +1000
+++ cpm-0.32/debian/copyright	2022-03-27 21:54:53.000000000 +1100
@@ -1,37 +1,34 @@
-This package was debianized by Lars Bahner <bahner@debian.org> on
-Fri, 03 Apr 2009 14:59:19 +0200.
-
-It was downloaded from http://www.harry-b.de/dokuwiki/doku.php?id=harry:cpm
-
-Upstream Author:
-
-    Harry Brueckner <harry_b@mm.st>
-
-Copyright:
-
-    Copyright (C) 2005-2009 Harry Brueckner
-    Copyright (C) 2010 Kacper Wysocki
-
-License:
-
-    This package is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This package is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this package; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
-
-On Debian systems, the complete text of the GNU General
-Public License can be found in `/usr/share/common-licenses/GPL'.
-
-The Debian packaging is (C) 2009, Lars Bahner <bahner@debian.org> and
-is licensed under the GPL, see above.
-
-
+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: cpm
+Upstream-Contact: Harry Brueckner <harry_b@mm.st>
+Source: https://github.com/comotion/cpm
+
+Files: *
+Copyright: 2005-2009 Harry Brueckner
+           2010 Kacper Wysocki
+License: GPL-2+
+
+Files: debian/*
+Copyright: 2009 Lars Bahner
+           2022 Hugh McMaster
+License: GPL-2+
+
+License: GPL-2+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; either version 2 of the License, or
+  (at your option) any later version.
+ .
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+ .
+  You should have received a copy of the GNU General Public License
+  along with this program;  if not, write to the Free Software
+  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
+  MA 02110-1301, USA.
+ .
+  On Debian GNU/Linux systems, the complete text of the GNU General
+  Public License version 2 can be found in
+  `/usr/share/common-licenses/GPL-2'.
diff -Nru cpm-0.32/debian/patches/fix-ftbfs-gcc-10.patch cpm-0.32/debian/patches/fix-ftbfs-gcc-10.patch
--- cpm-0.32/debian/patches/fix-ftbfs-gcc-10.patch	1970-01-01 10:00:00.000000000 +1000
+++ cpm-0.32/debian/patches/fix-ftbfs-gcc-10.patch	2020-08-19 04:15:38.000000000 +1000
@@ -0,0 +1,32 @@
+Description: Fix ftbfs with GCC-10
+
+Author: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
+Bug-Debian: https://bugs.debian.org/957102
+Forwarded: no
+
+---
+
+--- cpm-0.32.orig/configuration.c
++++ cpm-0.32/configuration.c
+@@ -33,6 +33,8 @@
+ #include "listhandler.h"
+ #include "memory.h"
+ 
++cpmconfig_t*	config;
++cpmruntime_t*	runtime;
+ 
+ /* #############################################################################
+  *
+--- cpm-0.32.orig/configuration.h
++++ cpm-0.32/configuration.h
+@@ -100,8 +100,8 @@ typedef struct
+ /* #############################################################################
+  * global variables
+  */
+-cpmconfig_t*            config;
+-cpmruntime_t*           runtime;
++extern cpmconfig_t*            config;
++extern cpmruntime_t*           runtime;
+ 
+ #define CRACKLIB_OFF    0
+ #define CRACKLIB_ON     1
diff -Nru cpm-0.32/debian/patches/fix_ftbfs.patch cpm-0.32/debian/patches/fix_ftbfs.patch
--- cpm-0.32/debian/patches/fix_ftbfs.patch	2020-08-19 04:15:38.000000000 +1000
+++ cpm-0.32/debian/patches/fix_ftbfs.patch	1970-01-01 10:00:00.000000000 +1000
@@ -1,32 +0,0 @@
-Description: Fix ftbfs with GCC-10
-
-Author: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
-Bug-Debian: https://bugs.debian.org/957102
-Forwarded: no
-
----
-
---- cpm-0.32.orig/configuration.c
-+++ cpm-0.32/configuration.c
-@@ -33,6 +33,8 @@
- #include "listhandler.h"
- #include "memory.h"
- 
-+cpmconfig_t*	config;
-+cpmruntime_t*	runtime;
- 
- /* #############################################################################
-  *
---- cpm-0.32.orig/configuration.h
-+++ cpm-0.32/configuration.h
-@@ -100,8 +100,8 @@ typedef struct
- /* #############################################################################
-  * global variables
-  */
--cpmconfig_t*            config;
--cpmruntime_t*           runtime;
-+extern cpmconfig_t*            config;
-+extern cpmruntime_t*           runtime;
- 
- #define CRACKLIB_OFF    0
- #define CRACKLIB_ON     1
diff -Nru cpm-0.32/debian/patches/libxml2.patch cpm-0.32/debian/patches/libxml2.patch
--- cpm-0.32/debian/patches/libxml2.patch	1970-01-01 10:00:00.000000000 +1000
+++ cpm-0.32/debian/patches/libxml2.patch	2022-03-26 22:26:05.000000000 +1100
@@ -0,0 +1,43 @@
+Description: Use pkg-config to find libxml2
+Author: Hugh McMaster <hugh.mcmaster@outlook.com>
+Bug-Debian: https://bugs.debian.org/949088
+Forwarded: not-needed
+Last-Update: 2022-03-26
+
+--- a/configure.in
++++ b/configure.in
+@@ -14,6 +14,8 @@
+ AC_PROG_LN_S
+ AC_PROG_MAKE_SET
+ 
++PKG_PROG_PKG_CONFIG
++
+ # Check --with-XXX configuration
+ AC_ARG_WITH(curses-dir,
+     [  --with-curses-dir=PATH  path to the curses installation],
+@@ -346,23 +348,11 @@
+ AC_SUBST(CDK_VERSION_DEF)
+ AC_SUBST(CDK_DEBIAN_DEP)
+ 
++PKG_CHECK_MODULES([LIBXML], [libxml-2.0])
+ 
+-# ------------------------------------------------------------------------------
+-# libxml2 check from http://webcvs.kde.org/cgi-bin/cvsweb.cgi/kdelibs/kdoctools/configure.in.in?rev=1.38&content-type=text/x-cvsweb-markup
+-
+-AC_PATH_PROG([XML_CONFIG], [xml2-config])
+-if test -z "$ac_cv_path_XML_CONFIG"; then
+-  AC_MSG_ERROR([Could not find libxml2 anywhere.])
+-fi
+-
+-LIBXML_LIBS="`$XML_CONFIG --libs`"
+-LIBXML_CFLAGS="`$XML_CONFIG --cflags`"
+-LIBXML_XMLLINT=`dirname $XML_CONFIG`"/xmllint"
+-AC_SUBST(LIBXML_LIBS)
+-AC_SUBST(LIBXML_CFLAGS)
++LIBXML_XMLLINT="$exec_prefix/bin/xmllint"
+ AC_SUBST(LIBXML_XMLLINT)
+ 
+-
+ AC_PATH_PROG([GPGME_CONFIG], [gpgme-config])
+ if test -z "$ac_cv_path_GPGME_CONFIG"; then
+   AC_MSG_ERROR([Could not find gpgme anywhere.])
diff -Nru cpm-0.32/debian/patches/posix-configure-in.patch cpm-0.32/debian/patches/posix-configure-in.patch
--- cpm-0.32/debian/patches/posix-configure-in.patch	1970-01-01 10:00:00.000000000 +1000
+++ cpm-0.32/debian/patches/posix-configure-in.patch	2022-03-26 22:21:43.000000000 +1100
@@ -0,0 +1,82 @@
+Description: Remove non-POSIX features from configure.in.
+Author: Hugh McMaster <hugh.mcmaster@outlook.com>
+Bug-Debian: https://bugs.debian.org/998786
+Forwarded: not-needed
+Last-Update: 2022-03-26
+
+--- a/configure.in
++++ b/configure.in
+@@ -48,27 +48,27 @@
+ case ${use_curses_lib} in
+   ncurses)
+       AC_CHECK_LIB(ncurses, initscr)
+-      if test "${ac_cv_lib_ncurses_initscr}" == "yes"; then
++      if test "${ac_cv_lib_ncurses_initscr}" = "yes"; then
+         curses_found=1
+         curses_config=ncurses5-config
+       fi
+       ;;
+   ncursesw)
+       AC_CHECK_LIB(ncursesw, wget_wch)
+-      if test "${ac_cv_lib_ncursesw_wget_wch}" == "yes"; then
++      if test "${ac_cv_lib_ncursesw_wget_wch}" = "yes"; then
+         curses_found=1
+         curses_config=ncursesw5-config
+       fi
+       ;;
+   pdcurses)
+       AC_CHECK_LIB(pdcurses, initscr)
+-      if test "${ac_cv_lib_pdcurses_initscr}" == "yes"; then
++      if test "${ac_cv_lib_pdcurses_initscr}" = "yes"; then
+         curses_found=1
+       fi
+       ;;
+   curses)
+       AC_CHECK_LIB(curses, initscr)
+-      if test "${ac_cv_lib_curses_initscr}" == "yes"; then
++      if test "${ac_cv_lib_curses_initscr}" = "yes"; then
+         curses_found=1
+       fi
+       ;;
+@@ -116,7 +116,7 @@
+ AC_ARG_WITH(cracklib-dir,
+     [  --with-cracklib-dir=PATH   path to the libcrack installation],
+     [
+-      if test "${withval}" == "no"; then
++      if test "${withval}" = "no"; then
+         CFLAGS="${CFLAGS} -DNO_CRACKLIB"
+         USE_CRACKLIB=0
+       else
+@@ -163,7 +163,7 @@
+     [  --with-memlock=LIMIT    limit for max. memory lock validation
+                           WARNING: It is NOT recommended to turn this off! ],
+     [
+-      if test "${withval}" == "no"; then
++      if test "${withval}" = "no"; then
+         CFLAGS="${CFLAGS} -DNO_MEMLOCK"
+       else
+         CFLAGS="${CFLAGS} -DMEMLOCK_LIMIT=${withval}"
+@@ -202,7 +202,7 @@
+ if test "${ac_cv_lib_cdk_initCDKScreen}" != "yes"; then
+   AC_MSG_ERROR([can not find the cdk library.])
+ fi
+-if test ${USE_CRACKLIB} == 1; then
++if test ${USE_CRACKLIB} = 1; then
+   AC_CHECK_LIB(crack, FascistCheck)
+   if test "${ac_cv_lib_crack_FascistCheck}" != "yes"; then
+     AC_MSG_ERROR([can not find the crack library.])
+@@ -232,12 +232,12 @@
+ 
+ # ------------------------------------------------------------------------------
+ # try to find the cracklib dictionary
+-if test ${USE_CRACKLIB} == 1; then
++if test ${USE_CRACKLIB} = 1; then
+   if test -z ${CRACKLIB_DICTPATH}; then
+     # the -D setting here is necessary, because general.c would not compile
+     # without this definition
+     CRACK_H=`${CC} -DCRACKLIB_DICTPATH='\"/\"' ${CFLAGS} ${CPPFLAGS} -M -MG general.c | perl -e 'while (<>) { $_ =~ s/^.*://; $_ =~ s/^\\s+//; $_ =~ s/\\\\//; $_ =~ s/\\s+$//; @tmp = split(/ /, $_); while (@tmp) { $file = shift(@tmp); if ($file =~ m:/crack\\.h$:) { print "$file\\n"; } } }' | sort | uniq`
+-    if test "${CRACK_H}" == ""; then
++    if test "${CRACK_H}" = ""; then
+       AC_MSG_ERROR([could not locate the cracklib header file.])
+     else
+       AC_MSG_NOTICE([cracklib header found at ${CRACK_H}.])
diff -Nru cpm-0.32/debian/patches/series cpm-0.32/debian/patches/series
--- cpm-0.32/debian/patches/series	2020-08-19 04:10:09.000000000 +1000
+++ cpm-0.32/debian/patches/series	2022-03-26 22:22:26.000000000 +1100
@@ -1 +1,3 @@
-fix_ftbfs.patch
+fix-ftbfs-gcc-10.patch
+libxml2.patch
+posix-configure-in.patch
diff -Nru cpm-0.32/debian/rules cpm-0.32/debian/rules
--- cpm-0.32/debian/rules	2020-08-19 04:05:18.000000000 +1000
+++ cpm-0.32/debian/rules	2022-03-27 21:48:45.000000000 +1100
@@ -1,19 +1,18 @@
 #!/usr/bin/make -f
-# -*- makefile -*-
 
-%:
-	dh $@ --parallel --with=autoreconf
+override_dh_auto_clean:
+	rm -f debian/cpmrc
+	dh_auto_clean
 
 override_dh_auto_configure:
 	dh_auto_configure -- \
 	  --with-cracklib-dict=/var/cache/cracklib/cracklib_dict
 
-override_dh_auto_clean:
-	rm -f debian/cpmrc
-	dh_auto_clean
-
 override_dh_auto_test:
 
 override_dh_auto_install:
 	install -m 0644 $(CURDIR)/conf/cpmrc-default $(CURDIR)/debian/cpmrc
 	dh_auto_install
+
+%:
+	dh $@
diff -Nru cpm-0.32/debian/upstream/metadata cpm-0.32/debian/upstream/metadata
--- cpm-0.32/debian/upstream/metadata	1970-01-01 10:00:00.000000000 +1000
+++ cpm-0.32/debian/upstream/metadata	2022-03-27 22:14:31.000000000 +1100
@@ -0,0 +1,4 @@
+Bug-Database: https://github.com/comotion/cpm/issues
+Bug-Submit: https://github.com/comotion/cpm/issues
+Repository: https://github.com/comotion/cpm.git
+Repository-Browse: https://github.com/comotion/cpm
diff -Nru cpm-0.32/debian/watch cpm-0.32/debian/watch
--- cpm-0.32/debian/watch	2020-08-19 04:05:18.000000000 +1000
+++ cpm-0.32/debian/watch	2022-03-26 22:15:41.000000000 +1100
@@ -1,2 +1,2 @@
-version=3
-http://githubredir.debian.net/github/comotion/cpm /github/comotion/cpm/(\d+\.\d+).tar.gz
+version=4
+https://github.com/comotion/cpm/tags (?!.*debian).*(\d\S+)\.tar\.gz
