|
|
60210b |
From 98159abd6965d32805e17a859b2d08c6fa42ec8a Mon Sep 17 00:00:00 2001
|
|
|
60210b |
From: Zbynek Moravec <zmoravec@redhat.com>
|
|
|
60210b |
Date: Wed, 8 Jul 2015 15:10:18 +0200
|
|
|
60210b |
Subject: [PATCH] trac#469 Add Python3 support. Fix --srpm-destination
|
|
|
60210b |
|
|
|
60210b |
---
|
|
|
60210b |
utils/scap-as-rpm | 18 +++++++++---------
|
|
|
60210b |
1 file changed, 9 insertions(+), 9 deletions(-)
|
|
|
60210b |
|
|
|
60210b |
diff --git a/utils/scap-as-rpm b/utils/scap-as-rpm
|
|
|
60210b |
index fee1f5b..4dae7d9 100755
|
|
|
60210b |
--- a/utils/scap-as-rpm
|
|
|
60210b |
+++ b/utils/scap-as-rpm
|
|
|
60210b |
@@ -1,4 +1,4 @@
|
|
|
60210b |
-#!/usr/bin/python2
|
|
|
60210b |
+#!/usr/bin/python
|
|
|
60210b |
# Copyright 2013 Red Hat Inc., Durham, North Carolina.
|
|
|
60210b |
# All Rights Reserved.
|
|
|
60210b |
#
|
|
|
60210b |
@@ -70,7 +70,7 @@ except ImportError:
|
|
|
60210b |
opts, args = optparse.OptionParser.parse_args(self, args, values)
|
|
|
60210b |
if self._args_spec:
|
|
|
60210b |
if not args:
|
|
|
60210b |
- print "Missing arguments: %s" % self._args_spec
|
|
|
60210b |
+ print("Missing arguments: %s" % self._args_spec)
|
|
|
60210b |
self.print_help()
|
|
|
60210b |
|
|
|
60210b |
setattr(opts, self._args_name, args)
|
|
|
60210b |
@@ -87,7 +87,7 @@ except ImportError:
|
|
|
60210b |
if fobj:
|
|
|
60210b |
fobj.write("%s\n" % self._args_description)
|
|
|
60210b |
else:
|
|
|
60210b |
- print self._args_description
|
|
|
60210b |
+ print(self._args_description)
|
|
|
60210b |
|
|
|
60210b |
ParserClass = ArgOptParserShim
|
|
|
60210b |
|
|
|
60210b |
@@ -136,7 +136,7 @@ if subprocess.call(["rpmbuild", "--version"], stdout = sys.stdout, stderr = sys.
|
|
|
60210b |
sys.exit(1)
|
|
|
60210b |
|
|
|
60210b |
def get_rpmbuild_paths():
|
|
|
60210b |
- sources = subprocess_check_output(["rpm", "--eval", "%{_sourcedir}"]).strip()
|
|
|
60210b |
+ sources = subprocess_check_output(["rpm", "--eval", "%{_sourcedir}"]).strip().decode('utf-8')
|
|
|
60210b |
|
|
|
60210b |
if not os.path.exists(sources):
|
|
|
60210b |
if subprocess.call(["rpmdev-setuptree"], stdout = sys.stdout, stderr = sys.stderr) != 0:
|
|
|
60210b |
@@ -145,8 +145,8 @@ def get_rpmbuild_paths():
|
|
|
60210b |
"'%s'\n" % (sources))
|
|
|
60210b |
raise CannotContinueError()
|
|
|
60210b |
|
|
|
60210b |
- rpm = subprocess_check_output(["rpm", "--eval", "%{_rpmdir}"]).strip()
|
|
|
60210b |
- srpm = subprocess_check_output(["rpm", "--eval", "%{_srcrpmdir}"]).strip()
|
|
|
60210b |
+ rpm = subprocess_check_output(["rpm", "--eval", "%{_rpmdir}"]).strip().decode('utf-8')
|
|
|
60210b |
+ srpm = subprocess_check_output(["rpm", "--eval", "%{_srcrpmdir}"]).strip().decode('utf-8')
|
|
|
60210b |
|
|
|
60210b |
if not os.path.exists(rpm) or not os.path.exists(srpm):
|
|
|
60210b |
sys.stderr.write("The SOURCES rpmbuild directory exists but RPM or SRPM do not. Please make "
|
|
|
60210b |
@@ -201,7 +201,7 @@ BuildArch: noarch
|
|
|
60210b |
#Requires: openscap-utils >= ${__package_openscap_version}
|
|
|
60210b |
|
|
|
60210b |
%description
|
|
|
60210b |
-asdf
|
|
|
60210b |
+This package was generated by scap-as-rpm.
|
|
|
60210b |
|
|
|
60210b |
%prep
|
|
|
60210b |
${__package_prepper}
|
|
|
60210b |
@@ -272,7 +272,7 @@ def main():
|
|
|
60210b |
help = "The folder (absolute or relative to CWD) where the result RPM shall be saved.")
|
|
|
60210b |
parser.add_argument("--srpm-destination", dest = "srpm_destination", default = None,
|
|
|
60210b |
help = "The folder (absolute or relative to CWD) where the result SRPM shall be saved.")
|
|
|
60210b |
- parser.add_argument("files", metavar="FILE", nargs="+",
|
|
|
60210b |
+ parser.add_argument("files", metavar = "FILE", nargs = "+",
|
|
|
60210b |
help = "List of files that should be put into the result package. "
|
|
|
60210b |
"These should be SCAP XML files but such requirement is not enforced.")
|
|
|
60210b |
|
|
|
60210b |
@@ -332,7 +332,7 @@ def main():
|
|
|
60210b |
|
|
|
60210b |
shutil.copy(os.path.join(rpmbuild_rpm_path, "noarch", rpm_basename), os.path.join(args.rpm_destination, rpm_basename))
|
|
|
60210b |
if args.srpm_destination is not None:
|
|
|
60210b |
- shutil.copy(os.path.join(rpmbuild_srpm_path, srpm_basename), os.path.join(args.srpm_destination, rpm_basename))
|
|
|
60210b |
+ shutil.copy(os.path.join(rpmbuild_srpm_path, srpm_basename), os.path.join(args.srpm_destination, srpm_basename))
|
|
|
60210b |
|
|
|
60210b |
print("")
|
|
|
60210b |
print("Resulting RPM:\t'%s'" % (os.path.join(args.rpm_destination, rpm_basename)))
|