[Pkg-cracklib-commits] [SCM] Git repository for pkg-cracklib branch, master, updated. debian/2.8.18-2-17-g7291918

Jan Dittberner jandd at debian.org
Sat May 19 22:52:22 UTC 2012


The following commit has been merged in the master branch:
commit 2b96e635a18a9601e60574ab4bc940431486df65
Author: Jan Dittberner <jandd at debian.org>
Date:   Fri May 18 21:50:01 2012 +0200

    restructure debian/rules

diff --git a/debian/changelog b/debian/changelog
index db3b7f8..11fe41b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,7 @@ cracklib2 (2.8.19-1) UNRELEASED; urgency=low
     - add dpkg-dev (>= 1.16.1~) to Build-Depends
     - add DPKG_EXPORT_BUILDFLAGS=1 and include
       /usr/share/dpkg/buildflags.mk in debian/rules
+  * restructure debian/rules
 
  -- Jan Dittberner <jandd at debian.org>  Fri, 18 May 2012 20:25:36 +0200
 
diff --git a/debian/control b/debian/control
index 549b69c..84db264 100644
--- a/debian/control
+++ b/debian/control
@@ -6,7 +6,7 @@ Uploaders: Martin Pitt <mpitt at debian.org>
 Standards-Version: 3.9.3
 Build-Depends: debhelper (>= 7.0.50), python-all-dev (>= 2.6.6-3~),
  chrpath, xmlto, automake (>= 1.10), autoconf (>=2.61), libtool,
- python-setuptools, dpkg-dev (>= 1.16.1~)
+ python-setuptools, dpkg-dev (>= 1.16.1~), autotools-dev
 Homepage: http://sourceforge.net/projects/cracklib
 Vcs-Git: git://git.debian.org/pkg-cracklib/pkg-cracklib.git
 Vcs-Browser: http://git.debian.org/?p=pkg-cracklib/pkg-cracklib.git
diff --git a/debian/cracklib-runtime.install b/debian/cracklib-runtime.install
index b01261e..f1d15be 100644
--- a/debian/cracklib-runtime.install
+++ b/debian/cracklib-runtime.install
@@ -1,8 +1,2 @@
 debian/cracklib.conf etc/cracklib
 debian/update-cracklib usr/sbin
-debian/tmp/usr/sbin/cracklib-check usr/sbin
-debian/tmp/usr/sbin/cracklib-format usr/sbin
-debian/tmp/usr/sbin/cracklib-packer usr/sbin
-debian/tmp/usr/sbin/cracklib-unpacker usr/sbin
-debian/tmp/usr/sbin/create-cracklib-dict usr/sbin
-debian/tmp/usr/share/cracklib/cracklib-small usr/share/dict
diff --git a/debian/libcrack2-dev.install b/debian/libcrack2-dev.install
deleted file mode 100644
index fcc69ae..0000000
--- a/debian/libcrack2-dev.install
+++ /dev/null
@@ -1,2 +0,0 @@
-debian/tmp/usr/include/*.h usr/include
-debian/tmp/usr/lib/libcrack.a usr/lib
diff --git a/debian/libcrack2.install b/debian/libcrack2.install
deleted file mode 100644
index b784046..0000000
--- a/debian/libcrack2.install
+++ /dev/null
@@ -1,2 +0,0 @@
-debian/tmp/usr/lib/libcrack.so.2.8.1 usr/lib
-debian/tmp/usr/share/locale/* usr/share/locale
diff --git a/debian/patches/pass-dict-to-cracklib.test.path b/debian/patches/pass-dict-to-cracklib.test.path
new file mode 100644
index 0000000..0b17bf3
--- /dev/null
+++ b/debian/patches/pass-dict-to-cracklib.test.path
@@ -0,0 +1,18 @@
+Subject: add support for dictionary path to cracklib.test
+Author: Jan Dittberner <jandd at debian.org>
+--- a/python/cracklib.py
++++ b/python/cracklib.py
+@@ -218,11 +218,11 @@
+     return new
+ 
+ 
+-def test(verbosity=1, repeat=1):
++def test(verbosity=1, repeat=1, dictpath=None):
+     """Test cracklib methods."""
+     import test_cracklib
+     import sys
+-    result = test_cracklib.run(verbosity=verbosity, repeat=repeat)
++    result = test_cracklib.run(verbosity=verbosity, repeat=repeat, use_dictpath=dictpath)
+     if result.wasSuccessful():
+         sys.exit(0)
+     sys.exit(1)
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..8f20253
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+pass-dict-to-cracklib.test.path
diff --git a/debian/rules b/debian/rules
index c2fd69b..4f85f95 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,30 +13,53 @@ PYVERS := $(shell pyversions -vs)
 
 override_dh_auto_configure:
 	aclocal && libtoolize && automake --add-missing && autoreconf
-	mkdir -p debian/tmpbuild
-	cd debian/tmpbuild; \
-	../../configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --disable-rpath --without-python --with-default-dict=/var/cache/cracklib/cracklib_dict
+	mkdir -p $(CURDIR)/debian/buildtmp/base
+	cd $(CURDIR)/debian/buildtmp/base; \
+	$(CURDIR)/configure \
+		--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+		--prefix=/usr --disable-rpath --without-python \
+		--with-default-dict=/var/cache/cracklib/cracklib_dict \
+		CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"
 	for i in $(PYVERS); do \
-		mkdir -p debian/build$$i; \
-		cd debian/build$$i; \
-		../../configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) --prefix=/usr --disable-rpath  --with-default-dict=/var/cache/cracklib/cracklib_dict PYTHON_PREFIX=/usr/lib/python$$i PYTHON=/usr/bin/python$$i; \
-		cd ../..; \
+		mkdir -p $(CURDIR)/debian/buildtmp/python$$i; \
+		cd $(CURDIR)/debian/buildtmp/python$$i; \
+		$(CURDIR)/configure \
+			--host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+			--prefix=/usr --disable-rpath \
+			--with-default-dict=/var/cache/cracklib/cracklib_dict \
+			PYTHON_PREFIX=$(call py_builddir_sh,$$i) \
+			PYTHON=/usr/bin/python$$i \
+			CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS)" LDFLAGS="$(LDFLAGS)"; \
 	done
 
 override_dh_auto_build:
-	$(MAKE) -C debian/tmpbuild
+	$(MAKE) -C $(CURDIR)/debian/buildtmp/base
 	for i in $(PYVERS); do \
-		${MAKE} -C debian/build$$i/python top_builddir=`pwd`/debian/tmpbuild; \
+		cd $(CURDIR)/debian/buildtmp/python$$i; \
+		rm -rf lib; ln -s $(CURDIR)/debian/buildtmp/base/lib lib; \
+		cd python; \
+		ln -s $(CURDIR)/python/*.py \
+		      $(CURDIR)/python/*.c \
+		      $(CURDIR)/debian/test_cracklib.py \
+		      $(CURDIR)/debian/crack.py \
+		      . ; \
+		CFLAGS="-I$(CURDIR)/lib $(CFLAGS)" LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" python$$i setup.py build ; \
 	done
 	xmlto -o debian/doc xhtml-nochunks debian/libcrack2.xml
 	xmlto -o debian/doc xhtml-nochunks debian/cracklib-runtime.xml
 
-override_dh_auto_clean:
-	rm -rf debian/tmpbuild
+override_dh_auto_test:
+	mkdir $(CURDIR)/debian/tmp
+	$(CURDIR)/debian/buildtmp/base/util/cracklib-packer $(CURDIR)/debian/tmp/cracklib_dict < \
+	 $(CURDIR)/dicts/cracklib-small
 	for i in $(PYVERS); do \
-		rm -rf debian/build$$i; \
+		cd $(CURDIR)/debian/buildtmp/python$$i/python/$(call py_builddir_sh,$$i); \
+		LD_LIBRARY_PATH=$(CURDIR)/debian/buildtmp/base/lib/.libs python$$i \
+		-c 'import cracklib; cracklib.test(dictpath="$(CURDIR)/debian/tmp/cracklib_dict")'; \
 	done
-	rm -f debian/python-cracklib.install
+
+override_dh_auto_clean:
+	rm -rf debian/buildtmp
 	rm -rf debian/doc
 	if [ -f Makefile ]; then $(MAKE) clean; fi
 	if [ -f Makefile ]; then $(MAKE) distclean; fi
@@ -46,31 +69,37 @@ override_dh_auto_clean:
 	 py-compile python/Makefile.in util/Makefile.in ltmain.sh		\
 	 m4/ltoptions.m4 m4/ltversion.m4 m4/libtool.m4 m4/ltsugar.m4		\
 	 m4/lt~obsolete.m4
+	dh_auto_clean
 
 override_dh_auto_install:
-	$(MAKE) -C debian/tmpbuild DESTDIR=`pwd`/debian/tmp install
-	for i in $(PYVERS); do \
-		$(MAKE) -C debian/build$$i/python install DESTDIR=`pwd`/debian/tmp; \
-		rm -rf debian/tmp/usr/lib/python$$i/*.pyc; \
-		rm -rf debian/tmp/usr/lib/python$$i/*.pyo; \
-	done
-	chrpath -d debian/tmp/usr/sbin/cracklib-check \
-	 debian/tmp/usr/sbin/cracklib-packer \
-	 debian/tmp/usr/sbin/cracklib-unpacker
+	$(MAKE) -C $(CURDIR)/debian/buildtmp/base DESTDIR=$(CURDIR)/debian/libcrack2 install
+	# move files to libcrack2-dev
+	mkdir -p $(CURDIR)/debian/libcrack2-dev/usr/lib
+	mv $(CURDIR)/debian/libcrack2/usr/include \
+	   $(CURDIR)/debian/libcrack2-dev/usr
+	mv $(CURDIR)/debian/libcrack2/usr/lib/*.a \
+	   $(CURDIR)/debian/libcrack2-dev/usr/lib
+	# move files to cracklib-runtime
+	mkdir -p $(CURDIR)/debian/cracklib-runtime/usr/share/dict
+	mv $(CURDIR)/debian/libcrack2/usr/sbin \
+	   $(CURDIR)/debian/cracklib-runtime/usr
+	mv $(CURDIR)/debian/libcrack2/usr/share/cracklib/cracklib-small \
+	   $(CURDIR)/debian/cracklib-runtime/usr/share/dict
+	# remove unused files
+	rm -f $(CURDIR)/debian/libcrack2/usr/lib/*.la \
+	      $(CURDIR)/debian/libcrack2/usr/lib/libcrack.so
+	rm -rf $(CURDIR)/debian/libcrack2/usr/share/cracklib
+	chrpath -d \
+	  $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-check \
+	  $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-packer \
+	  $(CURDIR)/debian/cracklib-runtime/usr/sbin/cracklib-unpacker
 	for i in $(PYVERS); do \
-		cd debian/build$$i/python; \
-		ln -s ../../../python/cracklib.py . ; \
-                ln -s ../../../_cracklibmodule.c . ; \
-		python$$i setup.py egg_info install_egg_info --install-dir "../../tmp/usr/lib/python$$i/$(call py_sitename_sh, $$i)"; \
-		cd ../../..; \
-		find "debian/tmp/usr/lib/python$$i/$(call py_sitename_sh, $$i)" -type f | grep egg-info >> debian/python-cracklib.install; \
-		echo "debian/tmp/usr/lib/python$$i/$(call py_sitename_sh, $$i)/_cracklibmodule.so usr/lib/python$$i/$(call py_sitename_sh, $$i)" >> debian/python-cracklib.install; \
-		echo "debian/tmp/usr/lib/python$$i/$(call py_sitename_sh, $$i)/cracklib.py usr/lib/python$$i/$(call py_sitename_sh, $$i)" >> debian/python-cracklib.install; \
-		echo "debian/crack.py usr/lib/python$$i/$(call py_sitename_sh, $$i)" >> debian/python-cracklib.install; \
+		cd $(CURDIR)/debian/buildtmp/python$$i/python; \
+		python$$i setup.py install --install-layout=deb --root $(CURDIR)/$(call py_pkgname,debian/python-cracklib,$$i); \
 	done
 
 override_dh_installchangelogs:
 	dh_installchangelogs NEWS
 
 %:
-	dh $@ --with python2
+	dh --with python2,autotools_dev $@
diff --git a/debian/test_cracklib.py b/debian/test_cracklib.py
new file mode 100644
index 0000000..cd20c90
--- /dev/null
+++ b/debian/test_cracklib.py
@@ -0,0 +1,137 @@
+# -*- python -*-
+# -*- coding: utf-8 -*-
+"""
+Test suite for cracklib's Python binding.
+"""
+import os
+import sys
+import unittest
+import cracklib
+
+__version__ = '2.8.19'
+
+tests = []
+dictpath = None
+
+
+class TestModuleFunctions(unittest.TestCase):
+    def test_VeryFascistCheck(self):
+        try:
+            cracklib.VeryFascistCheck('test', dictpath=dictpath)
+            self.fail('expected ValueError')
+        except ValueError:
+            pass
+        try:
+            cracklib.VeryFascistCheck('LhIRI6JXpKhUqBjT', dictpath=dictpath)
+        except ValueError:
+            self.fail('password should be good enough')
+
+    def test_palindrome(self):
+        try:
+            cracklib.VeryFascistCheck('ot23#xyx#32to', dictpath=dictpath)
+            self.fail('expected ValueError')
+        except ValueError:
+            e = sys.exc_info()[1]
+            self.assertEqual('is a palindrome', str(e))
+
+    def test_same(self):
+        try:
+            cracklib.VeryFascistCheck('test', 'test', dictpath=dictpath)
+            self.fail('expected ValueError')
+        except ValueError:
+            e = sys.exc_info()[1]
+            self.assertEqual('is the same as the old one', str(e))
+
+    def test_case_change(self):
+        try:
+            cracklib.VeryFascistCheck('test', 'TeSt', dictpath=dictpath)
+            self.fail('expected ValueError')
+        except ValueError:
+            e = sys.exc_info()[1]
+            self.assertEqual('case changes only', str(e))
+
+    def test_similar(self):
+        try:
+            cracklib.VeryFascistCheck('test12', 'test34', dictpath=dictpath)
+            self.fail('expected ValueError')
+        except ValueError:
+            e = sys.exc_info()[1]
+            self.assertEqual('is too similar to the old one', str(e))
+
+    def test_simple(self):
+        try:
+            cracklib.VeryFascistCheck('t3sx24', dictpath=dictpath)
+            self.fail('expected ValueError')
+        except ValueError:
+            e = sys.exc_info()[1]
+            self.assertEqual('is too simple', str(e))
+
+    def test_simple_lower(self):
+        for passwd in ['t' * i for i in range(
+            cracklib.MIN_LENGTH - cracklib.LOW_CREDIT)]:
+            self.assertEquals(
+                1, cracklib.simple(passwd),
+                'password {0} should be detected as too simple'.format(
+                    passwd))
+        self.assertEquals(0, cracklib.simple(
+            't' * (cracklib.MIN_LENGTH - cracklib.LOW_CREDIT)))
+
+    def test_simple_upper(self):
+        for passwd in ['T' * i for i in range(
+            cracklib.MIN_LENGTH - cracklib.UP_CREDIT)]:
+            self.assertEquals(
+                1, cracklib.simple(passwd),
+                'password {0} should be detected as too simple'.format(
+                    passwd))
+        self.assertEquals(0, cracklib.simple(
+            'T' * (cracklib.MIN_LENGTH - cracklib.UP_CREDIT)))
+
+    def test_simple_digit(self):
+        for passwd in ['1' * i for i in range(
+            cracklib.MIN_LENGTH - cracklib.DIG_CREDIT)]:
+            self.assertEquals(
+                1, cracklib.simple(passwd),
+                'password {0} should be detected as too simple'.format(
+                    passwd))
+        self.assertEquals(0, cracklib.simple(
+            '1' * (cracklib.MIN_LENGTH - cracklib.DIG_CREDIT)))
+
+    def test_simple_other(self):
+        for passwd in ['#' * i for i in range(
+            cracklib.MIN_LENGTH - cracklib.OTH_CREDIT)]:
+            self.assertEquals(
+                1, cracklib.simple(passwd),
+                'password {0} should be detected as too simple'.format(
+                    passwd))
+        self.assertEquals(0, cracklib.simple(
+            '#' * (cracklib.MIN_LENGTH - cracklib.OTH_CREDIT)))
+
+    def test_simple_combinations(self):
+        testset = '#a' * (cracklib.MIN_LENGTH // 2)
+        for passwd in [testset[:i] for i in range(
+            cracklib.MIN_LENGTH - cracklib.LOW_CREDIT - cracklib.OTH_CREDIT)]:
+            self.assertEquals(
+                1, cracklib.simple(passwd),
+                'password {0} should be detected as too simple'.format(
+                    passwd))
+        self.assertEquals(0, cracklib.simple(
+            testset[:(cracklib.MIN_LENGTH - cracklib.LOW_CREDIT -
+                cracklib.OTH_CREDIT)]))
+
+
+tests.append(TestModuleFunctions)
+
+
+def run(verbosity=1, repeat=1, use_dictpath=None):
+    global dictpath
+    print(('cracklib is installed in: ' + os.path.dirname(__file__)))
+    print(('cracklib version: ' + __version__))
+    print((sys.version))
+    dictpath=use_dictpath
+
+    suite = unittest.TestSuite()
+    for cls in tests:
+        for _ in range(repeat):
+            suite.addTest(unittest.makeSuite(cls))
+    runner = unittest.TextTestRunner(verbosity=verbosity)
+    return runner.run(suite)

-- 
Git repository for pkg-cracklib



More information about the Pkg-cracklib-commits mailing list