Package: cfv
Version: 1.18.2-1ubuntu1
Severity: normal
Tags: patch

modules md5 and sha are deprecated in Python 2.6 and interpreter throws ugly
DeprecationWarning when they are imported.

This patch fixes it (by trying to import methods from hashlib module first).
It also contain fixes needed to build package with Python 2.6 and some
code clean up (simplified debian/rules file, versioned dependency in
debian/control, fixes for few lintian warnings).

-- System Information:
Debian Release: 5.0
  APT prefers jaunty-updates
  APT policy: (700, 'jaunty-updates'), (700, 'jaunty-security'), (650, 'jaunty')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.28-11-generic (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages cfv depends on:
ii  python                    2.6.2-0ubuntu1 An interactive high-level object-o
ii  python-support            0.8.7ubuntu4   automated rebuilding support for P

cfv recommends no packages.

Versions of packages cfv suggests:
pn  bittorrent | bittornado   <none>         (no description available)
ii  python-imaging            1.1.6-3ubuntu1 Python Imaging Library

-- no debconf information
diff -u cfv-1.18.2/debian/rules cfv-1.18.2/debian/rules
--- cfv-1.18.2/debian/rules
+++ cfv-1.18.2/debian/rules
@@ -2,55 +2,28 @@
-# Sample debian/rules that uses debhelper.
-# GNU copyright 1997 to 1999 by Joey Hess.
-
-# Uncomment this to turn on verbose mode.
-#export DH_VERBOSE=1
 
 include /usr/share/dpatch/dpatch.make
+include /usr/share/python/python.mk
 
-# This is the debhelper compatability version to use.
-export DH_COMPAT=4
-
-build: build-stamp
-build-stamp: patch-stamp
-	dh_testdir
-	touch build-stamp
+build: patch build-stamp
+build-stamp:
+	touch $@
 
 clean: unpatch
-	dh_testdir
-	dh_testroot
-	rm -f build-stamp
-
-	# Add here commands to clean up after the build process.
-	-$(MAKE) distclean
+	dh $@
 
-	dh_clean
-
-install: build
+install: build install-stamp
+install-stamp:
 	dh_testdir
 	dh_testroot
-	dh_clean -k
-	dh_installdirs
-	mkdir -p `pwd`/debian/cfv/usr/lib/$(shell pyversions -d)/site-packages/
-	$(MAKE) install-wrapper-only DESTDIR=`pwd`/debian/cfv/ prefix=/usr mandir=/usr/share/man
-
+	mkdir -p debian/cfv/usr/lib/$(shell pyversions -d)/$(call py_sitename, $*)
+	make install-wrapper-only prefix=/usr mandir=/usr/share/man DESTDIR=debian/cfv/ pkgdir=/usr/lib/$(shell pyversions -d)/$(call py_sitename, $*)
+	touch $@
 
-# Build architecture-independent files here.
 binary-indep: build install
 	dh_testdir
 	dh_testroot
-	dh_installdocs
-	dh_installchangelogs Changelog
-	dh_pysupport
-	dh_link
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
+	dh_install -i
 
-# Build architecture-dependent files here.
 binary-arch: build install
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install
+	dh $@
diff -u cfv-1.18.2/debian/control cfv-1.18.2/debian/control
--- cfv-1.18.2/debian/control
+++ cfv-1.18.2/debian/control
@@ -2,12 +2,13 @@
 Section: utils
 Priority: optional
 Maintainer: Stefan Alfredsson <a...@debian.org>
-Build-Depends: python-dev, debhelper, python-support (>= 0.4), dpatch
+Build-Depends: python-dev (>= 2.5.4), debhelper (>= 7), python-support (>= 0.4), dpatch
 Standards-Version: 3.8.0.1
+Homepage: http://cfv.sourceforge.net/
 
 Package: cfv
 Architecture: all
-Depends: ${python:Depends}
+Depends: ${python:Depends}, ${misc:Depends}
 Suggests: python-imaging, bittorrent | bittornado
 Description: versatile file checksum creator and verifier
  cfv is a utility to test and create a wide range of checksum
diff -u cfv-1.18.2/debian/changelog cfv-1.18.2/debian/changelog
--- cfv-1.18.2/debian/changelog
+++ cfv-1.18.2/debian/changelog
@@ -1,3 +1,20 @@
+cfv (1.18.2-2) unstable; urgency=low
+
+  * debian/patches/02_fix_python_warnings.dpatch:
+    -Fix DeprecationWarning from md5 and sha modules.
+  * debian/rules:
+    - Simplify rules, make it compatible with Python 2.6.
+  * debian/control:
+    - Add versioned Build-Depends on debhelper and python packages.
+    - Add Homepage.
+    - Make package depends on ${misc:Depends}.
+  * debian/copyright:
+    - Use GPL-2 instead of GPL symlink.
+  * debian/compat:
+    - Make package compatible with debhelper 7.
+
+ -- Krzysztof Klimonda <kklimo...@syntaxhighlighted.com>  Sat, 06 Jun 2009 03:06:22 +0200
+
 cfv (1.18.2-1) unstable; urgency=low
 
   * New upstream release
diff -u cfv-1.18.2/debian/copyright cfv-1.18.2/debian/copyright
--- cfv-1.18.2/debian/copyright
+++ cfv-1.18.2/debian/copyright
@@ -11 +11 @@
-License can be found in /usr/share/common-licenses/GPL file.
+License can be found in /usr/share/common-licenses/GPL-2 file.
diff -u cfv-1.18.2/debian/patches/00list cfv-1.18.2/debian/patches/00list
--- cfv-1.18.2/debian/patches/00list
+++ cfv-1.18.2/debian/patches/00list
@@ -1,0 +2 @@
+02_fix_python_warnings
only in patch2:
unchanged:
--- cfv-1.18.2.orig/debian/compat
+++ cfv-1.18.2/debian/compat
@@ -0,0 +1 @@
+7
only in patch2:
unchanged:
--- cfv-1.18.2.orig/debian/patches/02_fix_python_warnings.dpatch
+++ cfv-1.18.2/debian/patches/02_fix_python_warnings.dpatch
@@ -0,0 +1,48 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 02_fix_python_warnings.dpatch by Krzysztof Klimonda <kklimo...@syntaxhighlighted.com>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Fix Python DeprecationWarning from usage of old modules.
+
+...@dpatch@
+diff -urNad cfv-1.18.2~/cfv cfv-1.18.2/cfv
+--- cfv-1.18.2~/cfv	2009-06-06 03:56:27.000000000 +0200
++++ cfv-1.18.2/cfv	2009-06-06 04:10:51.357461185 +0200
+@@ -667,9 +667,13 @@
+ 		stats.bytesread = stats.bytesread+s
+ 		return m.digest(),s
+ 
+-import sha
++try:
++	from hashlib import sha1 as sha
++except ImportError:
++	import sha
++	sha = sha.new
+ def _getfilesha1(file):
+-	return _getfilechecksum(file, sha.new)
++	return _getfilechecksum(file, sha)
+ 			
+ try:
+ 	if os.environ.get('CFV_NOFCHKSUM'): raise ImportError
+@@ -696,7 +700,11 @@
+ 			if stdprogress: progress.cleanup()
+ 		return c,s
+ except ImportError:
+-	import md5
++	try:
++		from hashlib import md5
++	except ImportError:
++		import md5
++		md5 = md5.new
+ 	try:
+ 		import zlib
+ 		_crc32=zlib.crc32
+@@ -713,7 +721,7 @@
+ 			return struct.pack('>I', self.value & 0xFFFFFFFF)
+ 
+ 	def _getfilemd5(file):
+-		return _getfilechecksum(file, md5.new)
++		return _getfilechecksum(file, md5)
+ 			
+ 	def _getfilecrc(file):
+ 		return _getfilechecksum(file, CRC32)

Reply via email to