[Lsb-messages] /var/www/bzr/lsb/devel/python-test r53: Add a gensrc target to:
Stew Benedict
stewb at linux-foundation.org
Tue Mar 13 15:03:42 UTC 2012
------------------------------------------------------------
revno: 53
committer: Stew Benedict <stewb at linux-foundation.org>
branch nick: python-test
timestamp: Tue 2012-03-13 11:03:42 -0400
message:
Add a gensrc target to:
1) create lsb-python-modules.list from the db - now we don't need lsb-appchk-python to build
2) create tst_pythonModPresent.py (bug 3458, installed, not yet enabled)
added:
scripts/package/gen_tst_pythonModPresent.py
scripts/package/get_python_modules.sql
scripts/package/lsb-python-modules.list
scripts/package/tst_pythonModPresent.py
modified:
scripts/package/Makefile
scripts/package/lsb-test-python.spec.sed
-------------- next part --------------
=== modified file 'scripts/package/Makefile'
--- a/scripts/package/Makefile 2012-03-12 14:15:42 +0000
+++ b/scripts/package/Makefile 2012-03-13 15:03:42 +0000
@@ -1,14 +1,19 @@
# XXX We should play the usual tricks defining stuff here and building
# XXX a specfile from this info, but not yet: for now keep in sync
PACKAGE=lsb-test-python
-VERSION=4.1.2
+VERSION=4.1.3
RELEASE=1
PVER4=2.4.2
PVER5=2.5
+# need to bump this when we get into the next version
+LSB_VERSION=4.1
# for pkgchk
DEPS=
+# for getting the module list from the lsb db
+DBOPTS=-N -h $$LSBDBHOST -u $$LSBUSER --password=$$LSBDBPASSWD
+
# Derive date string for daily snapshots
ISO_DATE=$(shell date +"%Y%m%d")
PWD=$(shell pwd)
@@ -22,6 +27,7 @@
SOURCE1 = Python-$(PVER4).tar.bz2
SOURCE2 = Python-$(PVER5).tar.bz2
TETJ = tetj.py
+MODULE_LIST = lsb-python-modules.list
# Temporary build directory
TMP_BUILD_DIR=/tmp/$(FULL_PACKAGE_NAME)
@@ -73,6 +79,10 @@
clean:
@rm -f *.rpm *.deb *.tar.gz tetj.py $(PACKAGE).spec journal.*
+gensrc:
+ mysql $(DBOPTS) $$LSBDB < get_python_modules.sql > $(MODULE_LIST)
+ ./gen_tst_pythonModPresent.py $(LSB_VERSION) > tst_pythonModPresent.py
+
tarball: $(SOURCE0) $(SOURCE1) $(SOURCE2) $(TETJ)
# Specfile generation rule
=== added file 'scripts/package/gen_tst_pythonModPresent.py'
--- a/scripts/package/gen_tst_pythonModPresent.py 1970-01-01 00:00:00 +0000
+++ b/scripts/package/gen_tst_pythonModPresent.py 2012-03-13 15:03:42 +0000
@@ -0,0 +1,78 @@
+#!/usr/bin/python
+"""
+gen_tst_pythonModPresent.py - generate checkers to test
+presence of python modules
+
+Usage:
+
+gen_tst_pythonModPresent.py [lsbversion] > tst_pythonModPresent.py
+"""
+
+# Author: Denis Silakov
+#
+# Copyright (C) 2012 ROSA Laboratory
+# Copyright (C) 2012 Linux Foundation
+
+import os
+import sys
+import MySQLdb
+
+
+DEFAULTVER = "4.1"
+
+def print_test(mod, tst_cnt):
+ print """try:
+ import """ + mod + """
+ print "ok """ + str(tst_cnt) + """ - import """ + mod + """"
+ passed += 1
+except:
+ print "not ok """ + str(tst_cnt) + """ - import """ + mod + """"
+"""
+
+def main():
+ # Connect to the database, using the regular conventions for
+ # setting the database connection settings.
+
+ if 'LSBDBPASSWD' not in os.environ:
+ os.environ['LSBDBPASSWD'] = ''
+
+ global HANDLE
+ HANDLE = MySQLdb.connect(host=os.environ['LSBDBHOST'],
+ user=os.environ['LSBUSER'],
+ passwd=os.environ['LSBDBPASSWD'],
+ db=os.environ['LSBDB'])
+
+ try:
+ lsbversion = sys.argv[1]
+ except IndexError:
+ lsbversion = DEFAULTVER
+
+ mod_query = """
+SELECT DISTINCT ILMname FROM InterpretedLanguageModule
+JOIN InterpretedLanguage ON ILid=ILMlanguage
+WHERE ILname='Python'
+AND (ILMappearedin <= '""" + lsbversion + """' AND ILMappearedin<>'')
+AND (ILMwithdrawnin IS NULL OR ILMwithdrawnin > '""" + lsbversion + """')
+"""
+
+ print """#!/usr/bin/python
+
+passed = 0
+"""
+
+ tst_cnt = 1
+ itemlist = HANDLE.cursor()
+ itemlist.execute(mod_query)
+ for item in itemlist.fetchall():
+ print_test(item[0], tst_cnt)
+ tst_cnt += 1
+
+ itemlist.close()
+
+ print "print \"Passed \" + str(passed) + \" tests of " + str(tst_cnt-1) + "\""
+
+ print "sys.exit(passed != " + str(tst_cnt-1) + ")"
+
+
+if __name__ == '__main__':
+ main()
=== added file 'scripts/package/get_python_modules.sql'
--- a/scripts/package/get_python_modules.sql 1970-01-01 00:00:00 +0000
+++ b/scripts/package/get_python_modules.sql 2012-03-13 15:03:42 +0000
@@ -0,0 +1,5 @@
+select ILMname, ILMappearedin, ILMwithdrawnin, ILMdeprecatedsince from InterpretedLanguageModule
+where ILMlanguage in (select ILid from InterpretedLanguage
+where ILname = 'Python')
+and ILMappearedin <>'' and ILMappearedin >= '3.2'
+and (ILMwithdrawnin is NULL or ILMwithdrawnin >= '3.2')
=== added file 'scripts/package/lsb-python-modules.list'
--- a/scripts/package/lsb-python-modules.list 1970-01-01 00:00:00 +0000
+++ b/scripts/package/lsb-python-modules.list 2012-03-13 15:03:42 +0000
@@ -0,0 +1,46 @@
+array 3.2 NULL NULL
+audioop 3.2 4.0 NULL
+binascii 3.2 NULL NULL
+bisect 3.2 NULL NULL
+cPickle 3.2 NULL NULL
+cStringIO 3.2 NULL NULL
+cmath 3.2 NULL NULL
+codecs 3.2 NULL NULL
+collections 3.2 NULL NULL
+crypt 3.2 NULL NULL
+csv 3.2 NULL NULL
+datetime 3.2 NULL NULL
+errno 3.2 NULL NULL
+exceptions 3.2 NULL NULL
+fcntl 3.2 NULL NULL
+gc 3.2 NULL NULL
+grp 3.2 NULL NULL
+heapq 3.2 NULL NULL
+hotshot 3.2 NULL NULL
+imp 3.2 NULL NULL
+itertools 3.2 NULL NULL
+locale 3.2 NULL NULL
+marshal 3.2 NULL NULL
+mmap 3.2 NULL NULL
+operator 3.2 NULL NULL
+os 3.2 NULL NULL
+ossaudiodev 3.2 NULL NULL
+parser 3.2 NULL NULL
+posix 3.2 NULL NULL
+pwd 3.2 NULL NULL
+random 3.2 NULL NULL
+re 3.2 NULL NULL
+resource 3.2 NULL NULL
+select 3.2 NULL NULL
+signal 3.2 NULL NULL
+socket 3.2 NULL NULL
+string 3.2 NULL NULL
+sys 3.2 NULL NULL
+syslog 3.2 NULL NULL
+termios 3.2 NULL NULL
+thread 3.2 NULL NULL
+time 3.2 NULL NULL
+unicodedata 3.2 NULL NULL
+weakref 3.2 NULL NULL
+zipimport 3.2 NULL NULL
+zlib 3.2 NULL NULL
=== modified file 'scripts/package/lsb-test-python.spec.sed'
--- a/scripts/package/lsb-test-python.spec.sed 2012-03-12 14:15:42 +0000
+++ b/scripts/package/lsb-test-python.spec.sed 2012-03-13 15:03:42 +0000
@@ -16,6 +16,8 @@
Source1: http://www.python.org/ftp/python/%{pversion4}/Python-%{pversion4}.tar.bz2
Source2: http://www.python.org/ftp/python/%{pversion5}/Python-%{pversion5}.tar.bz2
Source3: tetj.py
+Source4: lsb-python-modules.list
+Source5: tst_pythonModPresent.py
Patch0: python-system-python.patch
Patch1: python-tet-test.patch
Patch2: python-test-new-behavior.patch
@@ -34,7 +36,6 @@
#Prefix: %{_prefix}
BuildRoot: %{_tmppath}/%{name}-root
AutoReqProv: no
-BuildRequires: lsb-appchk-python
%description
This is the official package version of the LSB Python test suite.
@@ -129,7 +130,7 @@
done
# only install the tests for modules defined in the spec
- for mod in `grep -v '^#' /opt/lsb/share/appchk/lsb-python-modules.list`;do
+ for mod in `grep -v '^#' %{SOURCE4}`;do
if [ -f Python-$pyver/Lib/test/test_$mod.py ];then
cp Python-$pyver/Lib/test/test_$mod.py ${RPM_BUILD_ROOT}/opt/lsb/test/python/$tlib/test/
fi
@@ -258,6 +259,10 @@
done
popd
+# add the new module test
+install -d ${RPM_BUILD_ROOT}/opt/lsb/test/python/all
+install %{SOURCE5} ${RPM_BUILD_ROOT}/opt/lsb/test/python/all
+
#==================================================
%clean
if [ ! -z "${RPM_BUILD_ROOT}" -a "${RPM_BUILD_ROOT}" != "/" ]; then
@@ -278,6 +283,10 @@
#==================================================
%changelog
+* Tue Mar 13 2012 Stew Benedict <stewb at linux-foundation.org>
+- add new module test (bug 3458)
+- remove buildrequires on lsbappchk-python (build our own copy in gensrc)
+
* Mon Mar 12 2012 Stew Benedict <stewb at linux-foundation.org>
- disable test_unicode subtest (bug 3286, P12)
=== added file 'scripts/package/tst_pythonModPresent.py'
--- a/scripts/package/tst_pythonModPresent.py 1970-01-01 00:00:00 +0000
+++ b/scripts/package/tst_pythonModPresent.py 2012-03-13 15:03:42 +0000
@@ -0,0 +1,321 @@
+#!/usr/bin/python
+
+passed = 0
+
+try:
+ import array
+ print "ok 1 - import array"
+ passed += 1
+except:
+ print "not ok 1 - import array"
+
+try:
+ import binascii
+ print "ok 2 - import binascii"
+ passed += 1
+except:
+ print "not ok 2 - import binascii"
+
+try:
+ import bisect
+ print "ok 3 - import bisect"
+ passed += 1
+except:
+ print "not ok 3 - import bisect"
+
+try:
+ import cPickle
+ print "ok 4 - import cPickle"
+ passed += 1
+except:
+ print "not ok 4 - import cPickle"
+
+try:
+ import cStringIO
+ print "ok 5 - import cStringIO"
+ passed += 1
+except:
+ print "not ok 5 - import cStringIO"
+
+try:
+ import cmath
+ print "ok 6 - import cmath"
+ passed += 1
+except:
+ print "not ok 6 - import cmath"
+
+try:
+ import codecs
+ print "ok 7 - import codecs"
+ passed += 1
+except:
+ print "not ok 7 - import codecs"
+
+try:
+ import collections
+ print "ok 8 - import collections"
+ passed += 1
+except:
+ print "not ok 8 - import collections"
+
+try:
+ import crypt
+ print "ok 9 - import crypt"
+ passed += 1
+except:
+ print "not ok 9 - import crypt"
+
+try:
+ import csv
+ print "ok 10 - import csv"
+ passed += 1
+except:
+ print "not ok 10 - import csv"
+
+try:
+ import datetime
+ print "ok 11 - import datetime"
+ passed += 1
+except:
+ print "not ok 11 - import datetime"
+
+try:
+ import errno
+ print "ok 12 - import errno"
+ passed += 1
+except:
+ print "not ok 12 - import errno"
+
+try:
+ import exceptions
+ print "ok 13 - import exceptions"
+ passed += 1
+except:
+ print "not ok 13 - import exceptions"
+
+try:
+ import fcntl
+ print "ok 14 - import fcntl"
+ passed += 1
+except:
+ print "not ok 14 - import fcntl"
+
+try:
+ import gc
+ print "ok 15 - import gc"
+ passed += 1
+except:
+ print "not ok 15 - import gc"
+
+try:
+ import grp
+ print "ok 16 - import grp"
+ passed += 1
+except:
+ print "not ok 16 - import grp"
+
+try:
+ import heapq
+ print "ok 17 - import heapq"
+ passed += 1
+except:
+ print "not ok 17 - import heapq"
+
+try:
+ import hotshot
+ print "ok 18 - import hotshot"
+ passed += 1
+except:
+ print "not ok 18 - import hotshot"
+
+try:
+ import imp
+ print "ok 19 - import imp"
+ passed += 1
+except:
+ print "not ok 19 - import imp"
+
+try:
+ import itertools
+ print "ok 20 - import itertools"
+ passed += 1
+except:
+ print "not ok 20 - import itertools"
+
+try:
+ import locale
+ print "ok 21 - import locale"
+ passed += 1
+except:
+ print "not ok 21 - import locale"
+
+try:
+ import marshal
+ print "ok 22 - import marshal"
+ passed += 1
+except:
+ print "not ok 22 - import marshal"
+
+try:
+ import mmap
+ print "ok 23 - import mmap"
+ passed += 1
+except:
+ print "not ok 23 - import mmap"
+
+try:
+ import operator
+ print "ok 24 - import operator"
+ passed += 1
+except:
+ print "not ok 24 - import operator"
+
+try:
+ import os
+ print "ok 25 - import os"
+ passed += 1
+except:
+ print "not ok 25 - import os"
+
+try:
+ import ossaudiodev
+ print "ok 26 - import ossaudiodev"
+ passed += 1
+except:
+ print "not ok 26 - import ossaudiodev"
+
+try:
+ import parser
+ print "ok 27 - import parser"
+ passed += 1
+except:
+ print "not ok 27 - import parser"
+
+try:
+ import posix
+ print "ok 28 - import posix"
+ passed += 1
+except:
+ print "not ok 28 - import posix"
+
+try:
+ import pwd
+ print "ok 29 - import pwd"
+ passed += 1
+except:
+ print "not ok 29 - import pwd"
+
+try:
+ import random
+ print "ok 30 - import random"
+ passed += 1
+except:
+ print "not ok 30 - import random"
+
+try:
+ import re
+ print "ok 31 - import re"
+ passed += 1
+except:
+ print "not ok 31 - import re"
+
+try:
+ import resource
+ print "ok 32 - import resource"
+ passed += 1
+except:
+ print "not ok 32 - import resource"
+
+try:
+ import select
+ print "ok 33 - import select"
+ passed += 1
+except:
+ print "not ok 33 - import select"
+
+try:
+ import signal
+ print "ok 34 - import signal"
+ passed += 1
+except:
+ print "not ok 34 - import signal"
+
+try:
+ import socket
+ print "ok 35 - import socket"
+ passed += 1
+except:
+ print "not ok 35 - import socket"
+
+try:
+ import string
+ print "ok 36 - import string"
+ passed += 1
+except:
+ print "not ok 36 - import string"
+
+try:
+ import sys
+ print "ok 37 - import sys"
+ passed += 1
+except:
+ print "not ok 37 - import sys"
+
+try:
+ import syslog
+ print "ok 38 - import syslog"
+ passed += 1
+except:
+ print "not ok 38 - import syslog"
+
+try:
+ import termios
+ print "ok 39 - import termios"
+ passed += 1
+except:
+ print "not ok 39 - import termios"
+
+try:
+ import thread
+ print "ok 40 - import thread"
+ passed += 1
+except:
+ print "not ok 40 - import thread"
+
+try:
+ import time
+ print "ok 41 - import time"
+ passed += 1
+except:
+ print "not ok 41 - import time"
+
+try:
+ import unicodedata
+ print "ok 42 - import unicodedata"
+ passed += 1
+except:
+ print "not ok 42 - import unicodedata"
+
+try:
+ import weakref
+ print "ok 43 - import weakref"
+ passed += 1
+except:
+ print "not ok 43 - import weakref"
+
+try:
+ import zipimport
+ print "ok 44 - import zipimport"
+ passed += 1
+except:
+ print "not ok 44 - import zipimport"
+
+try:
+ import zlib
+ print "ok 45 - import zlib"
+ passed += 1
+except:
+ print "not ok 45 - import zlib"
+
+print "Passed " + str(passed) + " tests of 45"
+sys.exit(passed != 45)
More information about the lsb-messages
mailing list