pstodulk pushed to preupgrade-assistant (f22). "fixed troubles with invalid xml and removed unknown arugment for print function"
notifications at fedoraproject.org
notifications at fedoraproject.org
Tue May 5 15:53:21 UTC 2015
>From 278fcac813f67a9b5776c2df51d561e5e8739518 Mon Sep 17 00:00:00 2001
From: Petr Stodulka <pstodulk at redhat.com>
Date: Tue, 5 May 2015 17:52:34 +0200
Subject: fixed troubles with invalid xml and removed unknown arugment for
print function
diff --git a/preupgrade-assistant-flush.patch b/preupgrade-assistant-flush.patch
new file mode 100644
index 0000000..b7cef13
--- /dev/null
+++ b/preupgrade-assistant-flush.patch
@@ -0,0 +1,13 @@
+diff --git a/preup/utils.py b/preup/utils.py
+index c932a63..14305bb 100644
+--- a/preup/utils.py
++++ b/preup/utils.py
+@@ -130,7 +130,7 @@ def run_subprocess(cmd, output=None, print_output=False, shell=False, function=N
+ stdout += stdout_data.decode(settings.defenc)
+ if function is None:
+ if print_output:
+- print (stdout_data, end="", flush=True)
++ print (stdout_data, end="")
+ else:
+ function(stdout_data)
+ sp.communicate()
diff --git a/preupgrade-assistant-reports.patch b/preupgrade-assistant-reports.patch
new file mode 100644
index 0000000..31d636b
--- /dev/null
+++ b/preupgrade-assistant-reports.patch
@@ -0,0 +1,112 @@
+diff --git a/preup/application.py b/preup/application.py
+index 66cab9a..7c885b6 100644
+--- a/preup/application.py
++++ b/preup/application.py
+@@ -207,18 +207,15 @@ class Application(object):
+ # Execute assessment
+ self.scanning_progress = ScanProgress(self.get_total_check(), self.conf.debug)
+ self.scanning_progress.set_names(self.report_parser.get_name_of_checks())
+- if not self.conf.debug:
+- log_message('%s:' % settings.assessment_text,
+- new_line=True,
+- log=False)
+- log_message('%.3d/%.3d ...running (%s)' % (
+- 1,
+- self.get_total_check(),
+- self.scanning_progress.get_full_name(0)),
+- new_line=False,
+- log=False)
+- else:
+- log_message(self.scanning_progress.get_full_name(0))
++ log_message('%s:' % settings.assessment_text,
++ new_line=True,
++ log=False)
++ log_message('%.3d/%.3d ...running (%s)' % (
++ 1,
++ self.get_total_check(),
++ self.scanning_progress.get_full_name(0)),
++ new_line=False,
++ log=False)
+ start_time = datetime.datetime.now()
+ self.run_scan(function=self.scanning_progress.show_progress)
+ end_time = datetime.datetime.now()
+@@ -293,10 +290,15 @@ class Application(object):
+ def prepare_for_generation(self):
+ """Function prepares the XML file for conversion to HTML format"""
+ # We separate admin contents
++ reports = [self.get_default_xml_result_path()]
+ report_admin = self.report_parser.get_report_type(settings.REPORTS[0])
++ if report_admin:
++ reports.append(report_admin)
+ # We separate user contents
+ report_user = self.report_parser.get_report_type(settings.REPORTS[1])
+- for report in [self.get_default_xml_result_path(), report_admin, report_user]:
++ if report_user:
++ reports.append(report_user)
++ for report in reports:
+ ReportParser.write_xccdf_version(report, direction=True)
+ self.run_generate(report, report.replace('.xml', '.html'))
+ # Switching back namespace
+diff --git a/preup/report_parser.py b/preup/report_parser.py
+index 536fe4c..d26ca59 100644
+--- a/preup/report_parser.py
++++ b/preup/report_parser.py
+@@ -378,6 +378,20 @@ class ReportParser(object):
+ if value.text == report_type:
+ list_parts.append(values_id.replace('_state_result_part', '').replace('xccdf_preupg_value_', ''))
+
++ if not list_parts:
++ self.reload_xml(orig_name)
++ return None
++
++ # Remove all reports from main Group node
++ search = './/%sRule' % self.element_prefix
++ for parent in self.target_tree.findall(search + '/..'):
++ for rule in parent.findall(search):
++ print(rule, rule.get('id'))
++ rule_id = rule.get('id').replace('xccdf_preupg_rule_', '')
++ if rule_id not in list_parts:
++ parent.remove(rule)
++
++ # Remove all reports from TestResult node
+ for test_result in self.get_nodes(self.target_tree, 'TestResult'):
+ for rule in self.get_nodes(test_result, 'rule-result'):
+ idref = rule.get('idref').replace('xccdf_preupg_rule_', '')
+diff --git a/preup/scanning.py b/preup/scanning.py
+index 9857efa..bc9dfa3 100644
+--- a/preup/scanning.py
++++ b/preup/scanning.py
+@@ -92,23 +92,18 @@ class ScanProgress(object):
+ prev_msg = self._return_correct_msg(self.get_full_name(self.current_count - 1))
+ self.width_size = old_width
+ cur_msg = self._return_correct_msg(self.get_full_name(self.current_count))
+- if self.debug:
+- log_message(stdout_data)
+- if self.total_count > self.current_count:
+- log_message(cur_msg)
+- else:
+- cnt_back = 7 + len(prev_msg) + 3
+- msg = u'%sdone (%s)' % ('\b' * cnt_back, prev_msg)
++ cnt_back = 7 + len(prev_msg) + 3
++ msg = u'%sdone (%s)' % ('\b' * cnt_back, prev_msg)
++ log_message(msg,
++ new_line=True,
++ log=False)
++ if self.total_count > self.current_count:
++ msg = self._return_correct_msg(u'%.3d/%.3d ...running (%s)' % (self.current_count + 1,
++ self.total_count,
++ cur_msg))
+ log_message(msg,
+- new_line=True,
++ new_line=False,
+ log=False)
+- if self.total_count > self.current_count:
+- msg = self._return_correct_msg(u'%.3d/%.3d ...running (%s)' % (self.current_count + 1,
+- self.total_count,
+- cur_msg))
+- log_message(msg,
+- new_line=False,
+- log=False)
+ log_message(stdout_data.strip(), print_output=0)
+
+ def set_names(self, names):
diff --git a/preupgrade-assistant.spec b/preupgrade-assistant.spec
index 4c2ad17..56b70f1 100644
--- a/preupgrade-assistant.spec
+++ b/preupgrade-assistant.spec
@@ -4,7 +4,7 @@
Name: preupgrade-assistant
Version: %{pa_version}
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Preupgrade assistant performs assessment of the system
License: GPLv3+
URL: https://github.com/phracek/preupgrade-assistant
@@ -14,6 +14,8 @@ Patch0: preupgrade-assistant-do-not-ship-ui.patch
# these patches can be removed for version greater than 0.11.11
Patch1: preupgrade-assistant-version.patch
Patch2: preupgrade-assistant-repodata.patch
+Patch3: preupgrade-assistant-flush.patch
+Patch4: preupgrade-assistant-reports.patch
BuildArch: noarch
BuildRequires: rpm-devel
@@ -72,6 +74,8 @@ migration after the installation of Fedora system.
%patch0 -p1 -b .not-ui
%patch1 -p1 -b .version
%patch2 -p1 -b .repodata
+%patch3 -p1 -b .flush
+%patch4 -p1 -b .reports
rm -rf preup_ui
rm -rf ui-conf
@@ -158,6 +162,10 @@ rm -f ${RPM_BUILD_ROOT}%{_bindir}/premigrate
%{_rpmconfigdir}/macros.d/macros.preupgrade-assistant
%changelog
+* Tue May 05 2015 Petr Stodulka <pstodulk at redhat.com> - 0.11.11-3
+- removed wrong argument 'flush' from print function causes crash
+- fixed wrong generated xml due to admin/user report separation
+
* Thu Apr 30 2015 Petr Stodulka <pstodulk at redhat.com> - 0.11.11-2
- added patch from upstream for *RepoData in preup/kickstart.py
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/preupgrade-assistant.git/commit/?h=f22&id=278fcac813f67a9b5776c2df51d561e5e8739518
More information about the scm-commits
mailing list