pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/security/sshfp Avoid deprecation warnings under Python:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/cccaf589a3d1
branches:  trunk
changeset: 567427:cccaf589a3d1
user:      tron <tron%pkgsrc.org@localhost>
date:      Tue Nov 17 12:23:01 2009 +0000

description:
Avoid deprecation warnings under Python:
1.) Use "hashlib" instead of "sha" module if possible.
2.) Use "subprocess" module instead of os.popen3().
Both changes tested with Python 2.4 and 2.6.

Pkgsrc-related improvements:
1.) Support "user-destdir" installation (no changes required).
2.) Set license to "gnu-gpl-v2".
3.) Reduce patches by recording the fact that the manual page gets
    compressed automatically (which "pkgsrc" handles fine) instead
    of trying to prevent that.

diffstat:

 security/sshfp/Makefile         |   8 +++++-
 security/sshfp/distinfo         |   5 ++-
 security/sshfp/patches/patch-aa |  10 +-------
 security/sshfp/patches/patch-ab |  49 +++++++++++++++++++++++++++++++++++++++++
 4 files changed, 59 insertions(+), 13 deletions(-)

diffs (113 lines):

diff -r de43cac59b02 -r cccaf589a3d1 security/sshfp/Makefile
--- a/security/sshfp/Makefile   Tue Nov 17 11:54:10 2009 +0000
+++ b/security/sshfp/Makefile   Tue Nov 17 12:23:01 2009 +0000
@@ -1,16 +1,20 @@
-# $NetBSD: Makefile,v 1.3 2009/11/17 09:01:43 tron Exp $
+# $NetBSD: Makefile,v 1.4 2009/11/17 12:23:01 tron Exp $
 
 DISTNAME=      sshfp-1.1.3
-PKGREVISION=   1
+PKGREVISION=   2
 CATEGORIES=    security net
 MASTER_SITES=  http://www.xelerance.com/software/sshfp/
 
 MAINTAINER=    agc%NetBSD.org@localhost
 HOMEPAGE=      http://www.xelerance.com/
 COMMENT=       Print ssh host key fingerprint resource records
+LICENSE=       gnu-gpl-v2
+
+PKG_DESTDIR_SUPPORT=   user-destdir
 
 DEPENDS+=       ${PYPKGPREFIX}-dns>=1.6.0:../../net/py-dns
 
+MANCOMPRESSED=                 yes
 NO_BUILD=                      yes
 PYTHON_PATCH_SCRIPTS=          sshfp
 
diff -r de43cac59b02 -r cccaf589a3d1 security/sshfp/distinfo
--- a/security/sshfp/distinfo   Tue Nov 17 11:54:10 2009 +0000
+++ b/security/sshfp/distinfo   Tue Nov 17 12:23:01 2009 +0000
@@ -1,6 +1,7 @@
-$NetBSD: distinfo,v 1.1.1.1 2008/07/31 10:21:21 agc Exp $
+$NetBSD: distinfo,v 1.2 2009/11/17 12:23:01 tron Exp $
 
 SHA1 (sshfp-1.1.3.tar.gz) = bf42c956a992ac9442e9bbaa4af8f5599f321c2b
 RMD160 (sshfp-1.1.3.tar.gz) = 9b325ed30e75e0f485eea11676a420932f5c9b1e
 Size (sshfp-1.1.3.tar.gz) = 15477 bytes
-SHA1 (patch-aa) = 020c5799cf883a7de7d3ba345a2b413f10c16be1
+SHA1 (patch-aa) = c6a00eb486790e9d489a4f476785986209a1c11e
+SHA1 (patch-ab) = b91c5a45302960c39f00e82b945eaac0e7304cf0
diff -r de43cac59b02 -r cccaf589a3d1 security/sshfp/patches/patch-aa
--- a/security/sshfp/patches/patch-aa   Tue Nov 17 11:54:10 2009 +0000
+++ b/security/sshfp/patches/patch-aa   Tue Nov 17 12:23:01 2009 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-aa,v 1.1.1.1 2008/07/31 10:21:21 agc Exp $
+$NetBSD: patch-aa,v 1.2 2009/11/17 12:23:01 tron Exp $
 
 --- Makefile   2008/07/31 09:38:52     1.1
 +++ Makefile   2008/07/31 09:37:43
@@ -13,11 +13,3 @@
  
  all: man-page
        
-@@ -14,7 +14,6 @@
-       install -m 0755 sshfp $(BIN)
-       install -d 0755 $(MAN)
-       install -m 0644 sshfp.1 $(MAN)
--      gzip $(MAN)/sshfp.1
- 
- man-page:
-       nroff -man sshfp.1 > sshfp.1.txt
diff -r de43cac59b02 -r cccaf589a3d1 security/sshfp/patches/patch-ab
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/security/sshfp/patches/patch-ab   Tue Nov 17 12:23:01 2009 +0000
@@ -0,0 +1,49 @@
+$NetBSD: patch-ab,v 1.1 2009/11/17 12:23:01 tron Exp $
+
+Fix deprecation warnings under Python 2.6.
+
+--- sshfp.orig 2007-05-15 22:10:26.000000000 +0100
++++ sshfp      2009-11-17 11:54:50.000000000 +0000
+@@ -8,9 +8,17 @@
+ import sys
+ import getopt
+ import base64
+-import sha
++
++try:
++    import hashlib
++    SHA1_CLASS = hashlib.sha1
++except ImportError:
++    import sha
++    SHA1_CLASS = sha.sha
++
+ import commands
+ import time
++import subprocess
+ # www.dnspython.org
+ try:
+       import dns.resolver
+@@ -58,7 +66,9 @@
+       except TypeError:
+               print "FAILED on hostname "+hostname+" with keyblob "+keyblob
+               return "ERROR"
+-      fpsha1 = sha.new(rawkey).hexdigest()
++        sha1 = SHA1_CLASS()
++        sha1.update(rawkey)
++        fpsha1 = sha1.hexdigest()
+       # check for Reverse entries
+       reverse = 1
+       parts = hostname.split(".",3)
+@@ -183,7 +193,11 @@
+       cmd = "ssh-keyscan -p %s -T %s -t %s %s" % (port, timeout, algo, hosts)
+       if quiet:
+               cmd = cmd + " 2>/dev/null"
+-      tochild, fromchild, childerror = os.popen3(cmd, 'r')
++        cmd_pipe = subprocess.Popen(cmd, shell = True, stdin = subprocess.PIPE,
++          stdout = subprocess.PIPE, stderr = subprocess.PIPE, close_fds = True)
++        tochild = cmd_pipe.stdin
++        fromchild = cmd_pipe.stdout
++        childerror = cmd_pipe.stderr
+         err = childerror.readlines()
+         khdns = "\n".join(fromchild.readlines())
+         for e in err:



Home | Main Index | Thread Index | Old Index