diff --git a/0001-Do-not-use-with-open-as-foo-construct.patch b/0001-Do-not-use-with-open-as-foo-construct.patch new file mode 100644 index 0000000..863c98f --- /dev/null +++ b/0001-Do-not-use-with-open-as-foo-construct.patch @@ -0,0 +1,30 @@ +From d369dc4f3d4118fe2bdeaab6d066569f09235409 Mon Sep 17 00:00:00 2001 +From: Petr Muller +Date: Wed, 10 Apr 2013 16:20:16 +0200 +Subject: [PATCH 1/2] Do not use 'with open() as foo' construct + +It does not work on RHEL<=5, with old Python not having +this syntax yet +--- + src/python/journalling.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/python/journalling.py b/src/python/journalling.py +index 7a107a0..3c9b565 100755 +--- a/src/python/journalling.py ++++ b/src/python/journalling.py +@@ -439,8 +439,9 @@ class Journal(object): + + releaseEl = newdoc.createElement("release") + try: +- with open("/etc/redhat-release", "r") as release_file: +- release = release_file.read().strip() ++ release_file = open("/etc/redhat-release", "r") ++ release = release_file.read().strip() ++ release_file.close() + except IOError: + release = "unknown" + release = unicode(release, 'utf-8', errors='replace') +-- +1.9.3 + diff --git a/0001-Fix-mktemp-call-for-older-RHELs.patch b/0001-Fix-mktemp-call-for-older-RHELs.patch new file mode 100644 index 0000000..1dba66b --- /dev/null +++ b/0001-Fix-mktemp-call-for-older-RHELs.patch @@ -0,0 +1,62 @@ +From 48b38892a458b8398a76305ff90f123e45d90067 Mon Sep 17 00:00:00 2001 +From: Petr Muller +Date: Fri, 7 Jun 2013 13:36:16 +0200 +Subject: [PATCH] Fix mktemp call for older RHELs + +Version of mktemp present in older RHELs (RHEL5 and older) does not +support --tmpdir parameter used in rlLog and rlRun implementations. + +Therefore, on these RHELs, older parameter -p (deprecated in newer +RHELs) must be used. +--- + src/logging.sh | 4 ++-- + src/testing.sh | 6 +++--- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/logging.sh b/src/logging.sh +index d831ac8..9519918 100644 +--- a/src/logging.sh ++++ b/src/logging.sh +@@ -55,9 +55,9 @@ Implements also phase support with automatic assert evaluation. + __INTERNAL_LogText() { + local MESSAGE=${1:-"***BAD BEAKERLIB_HLOG CALL***"} + local LOGFILE=${2:-$OUTPUTFILE} +- [ -z "$LOGFILE" ] && LOGFILE=$( mktemp --tmpdir=$__INTERNAL_PERSISTENT_TMP ) ++ [ -z "$LOGFILE" ] && LOGFILE=$( mktemp -p $__INTERNAL_PERSISTENT_TMP ) + [ ! -e "$LOGFILE" ] && touch "$LOGFILE" +- [ ! -w "$LOGFILE" ] && LOGFILE=$( mktemp --tmpdir=$__INTERNAL_PERSISTENT_TMP ) ++ [ ! -w "$LOGFILE" ] && LOGFILE=$( mktemp -p $__INTERNAL_PERSISTENT_TMP ) + echo -e "$MESSAGE" | tee -a $LOGFILE >&2 + return $? + } +diff --git a/src/testing.sh b/src/testing.sh +index afa7554..7aeb8a0 100644 +--- a/src/testing.sh ++++ b/src/testing.sh +@@ -668,12 +668,12 @@ rlRun() { + case "$1" in + -l) + DO_LOG=true; +- [ -n "$LOG_FILE" ] || LOG_FILE=$( mktemp --tmpdir=$__INTERNAL_PERSISTENT_TMP ) ++ [ -n "$LOG_FILE" ] || LOG_FILE=$( mktemp -p $__INTERNAL_PERSISTENT_TMP ) + shift;; + -c) + DO_LOG=true; + DO_CON=true; +- [ -n "$LOG_FILE" ] || LOG_FILE=$( mktemp --tmpdir=$__INTERNAL_PERSISTENT_TMP ) ++ [ -n "$LOG_FILE" ] || LOG_FILE=$( mktemp -p $__INTERNAL_PERSISTENT_TMP ) + shift;; + -t) + DO_TAG=true; +@@ -682,7 +682,7 @@ rlRun() { + shift;; + -s) + DO_KEEP=true +- [ -n "$LOG_FILE" ] || LOG_FILE=$( mktemp --tmpdir=$__INTERNAL_PERSISTENT_TMP ) ++ [ -n "$LOG_FILE" ] || LOG_FILE=$( mktemp -p $__INTERNAL_PERSISTENT_TMP ) + shift;; + --) + shift; +-- +1.9.3 + diff --git a/0001-fir-for-python-compat-on-RHEL5.patch b/0001-fir-for-python-compat-on-RHEL5.patch new file mode 100644 index 0000000..245fcc5 --- /dev/null +++ b/0001-fir-for-python-compat-on-RHEL5.patch @@ -0,0 +1,28 @@ +From feb6ed1f9bed4100d65b021de47cc6097fa976e2 Mon Sep 17 00:00:00 2001 +From: Dalibor Pospisil +Date: Wed, 18 Jun 2014 11:46:20 +0200 +Subject: [PATCH] fir for python compat on RHEL5 + +--- + src/python/bstor.py | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/src/python/bstor.py b/src/python/bstor.py +index 04d4dfd..a512795 100755 +--- a/src/python/bstor.py ++++ b/src/python/bstor.py +@@ -36,8 +36,9 @@ class Storage(object): + + def __save_file(self, parser): + fpath = os.path.join(self.__obtain_dir(), self.namespace) +- with open(fpath, 'w') as cfile: +- parser.write(cfile) ++ cfile = open(fpath, 'w') ++ parser.write(cfile) ++ cfile.close() + + def get(self, key): + parser = self.__obtain_file() +-- +1.9.3 + diff --git a/0001-mi-object-does-not-have-size-in-old-pythons.patch b/0001-mi-object-does-not-have-size-in-old-pythons.patch new file mode 100644 index 0000000..561c7b1 --- /dev/null +++ b/0001-mi-object-does-not-have-size-in-old-pythons.patch @@ -0,0 +1,25 @@ +From f38e47bd18676b87db9aecbe878954b6896b569a Mon Sep 17 00:00:00 2001 +From: Petr Muller +Date: Wed, 10 Apr 2013 19:17:01 +0200 +Subject: [PATCH 2/2] mi object does not have size in old pythons + +--- + src/python/journalling.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/python/journalling.py b/src/python/journalling.py +index 3c9b565..b7ede6d 100755 +--- a/src/python/journalling.py ++++ b/src/python/journalling.py +@@ -318,7 +318,7 @@ class Journal(object): + def getRpmVersion(xmldoc, package, rpm_ts): + rpms = [] + mi = rpm_ts.dbMatch("name", package) +- if len(mi) == 0: ++ if mi.count() == 0: + if package != 'unknown': + pkgDetailsEl = xmldoc.createElement("pkgnotinstalled") + pkgDetailsCon = xmldoc.createTextNode("%s" % package) +-- +1.9.3 + diff --git a/beakerlib.spec b/beakerlib.spec index 4ce3dc2..02c6c0c 100644 --- a/beakerlib.spec +++ b/beakerlib.spec @@ -1,7 +1,7 @@ Name: beakerlib Summary: A shell-level integration testing library Version: 1.9 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv2 Group: Development/Libraries BuildRoot: %{_tmppath}/%{name}-%{version}-root @@ -13,13 +13,19 @@ Requires: nfs-utils Requires: python2 Requires: grep Requires: sed +Obsoletes: rhtslib beaker-lib +Provides: rhtslib beaker-lib + +Patch0: 0001-Do-not-use-with-open-as-foo-construct.patch +Patch2: 0001-mi-object-does-not-have-size-in-old-pythons.patch +Patch3: 0001-Fix-mktemp-call-for-older-RHELs.patch +Patch4: 0001-fir-for-python-compat-on-RHEL5.patch BuildRequires: /usr/bin/pod2man %description The BeakerLib project means to provide a library of various helpers, which could be used when writing operating system level integration tests. - %package vim-syntax Summary: Files for syntax highlighting BeakerLib tests in VIM editor Group: Development/Libraries @@ -29,14 +35,16 @@ BuildRequires: vim-common %description vim-syntax Files for syntax highlighting BeakerLib tests in VIM editor - %prep %setup -q +%patch0 -p1 -b .no-with-in-python +%patch2 -p1 -b .mi-rpm-objects +%patch3 -p1 -b .tmpdir +%patch4 -p1 -b .no-with-in-python %build make build - %install %{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}} %{!?_tmpfilesdir: %global _tmpfilesdir %{_prefix}/lib/tmpfiles.d/} @@ -72,6 +80,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/vim/vimfiles/after/syntax/beakerlib.vim %changelog +* Tue Jun 18 2014 Dalibor Pospisil - 1.9-2 +- added missing patch for python compatibility + * Tue Jun 17 2014 Dalibor Pospisil - 1.9-1 - rebase to upstream 1.9