pstodulk pushed to preupgrade-assistant (f22). "Fix for updating solution.txt caused by splitting reports"
notifications at fedoraproject.org
notifications at fedoraproject.org
Tue May 19 16:07:53 UTC 2015
From 73d1b96152ddef0200ca0664ceb1394ead92b992 Mon Sep 17 00:00:00 2001
From: Petr Stodulka <pstodulk at redhat.com>
Date: Tue, 19 May 2015 18:07:14 +0200
Subject: Fix for updating solution.txt caused by splitting reports
diff --git a/preupgrade-assistant-flush.patch b/preupgrade-assistant-flush.patch
deleted file mode 100644
index b7cef13..0000000
--- a/preupgrade-assistant-flush.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-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-repodata.patch b/preupgrade-assistant-repodata.patch
deleted file mode 100644
index b93b48c..0000000
--- a/preupgrade-assistant-repodata.patch
+++ /dev/null
@@ -1,40 +0,0 @@
-diff --git a/preup/kickstart.py b/preup/kickstart.py
-index ca4945f..5bbbd53 100644
---- a/preup/kickstart.py
-+++ b/preup/kickstart.py
-@@ -14,7 +14,12 @@ from pykickstart.version import makeVersion
- from pykickstart.constants import KS_SCRIPT_POST
- from preup.logger import log_message
- from preup import settings
--from preup.utils import write_to_file, get_file_content
-+from preup.utils import write_to_file, get_file_content, get_system
-+
-+if not get_system():
-+ from pykickstart.commands.repo import RHEL6_RepoData as SystemRepoData
-+else:
-+ from pykickstart.commands.repo import F21_RepoData as SystemRepoData
-
-
- class YumGroupManager(object):
-@@ -119,10 +124,10 @@ class YumGroupGenerator(object):
- return output + output_packages
-
-
--class RepoData(commands.repo.F21_RepoData):
-+class RepoData(SystemRepoData):
- def __init__(self, *args, **kwargs):
- self.enabled = kwargs.pop("enabled", True)
-- commands.repo.F21_RepoData.__init__(self, *args, **kwargs)
-+ SystemRepoData.__init__(self, *args, **kwargs)
-
-
- class KickstartGenerator(object):
-@@ -232,7 +237,7 @@ class KickstartGenerator(object):
- data = {}
- data['name'] = key
- data['baseurl'] = value.strip()
-- repodata = commands.repo.RHEL6_RepoData(**data)
-+ repodata = SystemRepoData(**data)
- repos += repodata.__str__()
- self.ks.handler.repo.dataList().append(repos)
-
diff --git a/preupgrade-assistant-reports.patch b/preupgrade-assistant-reports.patch
index 31d636b..46675e6 100644
--- a/preupgrade-assistant-reports.patch
+++ b/preupgrade-assistant-reports.patch
@@ -1,112 +1,103 @@
+commit 4cdba258528375146efb5feb8866b994e453edf2
+Author: Petr Hracek <phracek at redhat.com>
+Date: Mon May 18 17:03:15 2015 +0200
+
+ Fix for updating solution.txt caused by splitting reports
+
+ Signed-off-by: Petr Hracek <phracek at redhat.com>
+
diff --git a/preup/application.py b/preup/application.py
-index 66cab9a..7c885b6 100644
+index adb1836..ab75323 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):
+@@ -356,16 +356,7 @@ class Application(object):
+
def prepare_for_generation(self):
"""Function prepares the XML file for conversion to HTML format"""
- # We separate admin contents
+- # 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])
+- if report_user:
+- reports.append(report_user)
+- for report in reports:
++ for report in self._get_reports():
+ ReportParser.write_xccdf_version(report, direction=True)
+ self.run_generate(report, report.replace('.xml', '.html'))
+ # Switching back namespace
+@@ -392,6 +383,17 @@ class Application(object):
+ print_output=False,
+ shell=True)
+
++ def _get_reports(self):
+ reports = [self.get_default_xml_result_path()]
- report_admin = self.report_parser.get_report_type(settings.REPORTS[0])
++ 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]:
++ # We separate user contents
++ report_user = self.report_parser.get_report_type(settings.REPORTS[1])
+ 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
++ return reports
+
-+ # 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 finalize_xml_files(self):
+ """
+ Function copies postupgrade scripts and creates hash postupgrade file.
+@@ -401,7 +403,9 @@ class Application(object):
+ remediate.special_postupgrade_scripts(self.conf.result_dir)
+ remediate.hash_postupgrade_file(self.conf.verbose,
+ self.get_postupgrade_dir())
+- self.xml_mgr.find_solution_files(self.report_parser.get_solution_files())
++ solution_files = self.report_parser.get_solution_files()
++ for report in self._get_reports():
++ self.xml_mgr.find_solution_files(report.split('.')[0], solution_files)
+ remediate.copy_modified_config_files(self.conf.result_dir)
+
+ def run_third_party_modules(self, dir_name):
+diff --git a/preup/xml_manager.py b/preup/xml_manager.py
+index 15037b4..21798db 100644
+--- a/preup/xml_manager.py
++++ b/preup/xml_manager.py
+@@ -246,7 +246,7 @@ class XmlManager(object):
+ pass
+ return file_name
+
+- def update_html(self, solution_files, extension="html"):
++ def update_html(self, result_name, solution_files, extension="html"):
+ """
+ Function updates a XML or HTML file with relevant solution
+ texts
+@@ -264,7 +264,7 @@ class XmlManager(object):
+ "rb",
+ method=True)
+ orig_file = os.path.join(self.dirname,
+- self.result_base + "." + extension)
++ result_name + "." + extension)
+ lines = get_file_content(orig_file, "rb", method=True)
+
+ for cnt, line in enumerate(lines):
+@@ -283,7 +283,7 @@ class XmlManager(object):
+ extension)
+ write_to_file(orig_file, "wb", lines)
+
+- def find_solution_files(self, xml_solution_files):
++ def find_solution_files(self, result_name, xml_solution_files):
+ """
+ Function finds all text files in conten
+ and updates XML and HTML results
+@@ -294,9 +294,9 @@ class XmlManager(object):
+ files = [x for x in file_name if x.endswith(".txt")]
+ if files:
+ solution_files[dir_name] = files
+- self.update_html(solution_files)
+- self.update_html(solution_files, extension="xml")
+- clean_html(os.path.join(self.dirname, self.result_base + ".html"))
++ self.update_html(result_name, solution_files)
++ self.update_html(result_name, solution_files, extension="xml")
++ clean_html(os.path.join(self.dirname, result_name + ".html"))
- def set_names(self, names):
+ def remove_html_information(self):
+ report_path = os.path.join(self.dirname, self.result_base + ".html")
diff --git a/preupgrade-assistant-version.patch b/preupgrade-assistant-version.patch
deleted file mode 100644
index a4acd8c..0000000
--- a/preupgrade-assistant-version.patch
+++ /dev/null
@@ -1,13 +0,0 @@
-diff --git a/setup.py b/setup.py
-index f41765b..d0109c9 100755
---- a/setup.py
-+++ b/setup.py
-@@ -16,7 +16,7 @@ project_author_email = "phracek at redhat.com"
- project_description = "Preupgrade assistant"
- package_name = "%s" % project_name
- package_module_name = project_name
--package_version = "0.11.10"
-+package_version = "0.11.11"
-
- script_files = ['preupg', 'premigrate', 'preupg-xccdf-compose', 'preupg-create-group-xml']
-
diff --git a/preupgrade-assistant.spec b/preupgrade-assistant.spec
index d1a68a8..d2e5072 100644
--- a/preupgrade-assistant.spec
+++ b/preupgrade-assistant.spec
@@ -4,18 +4,15 @@
Name: preupgrade-assistant
Version: 0.11.12
-Release: 1%{?dist}
+Release: 2%{?dist}
Summary: Preupgrade assistant performs assessment of the system
License: GPLv3+
URL: https://github.com/phracek/preupgrade-assistant
Source0: https://github.com/phracek/%{name}/archive/%{pa_version}.tar.gz
Source1: macros.preupgrade-assistant
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
+# these patches can be removed for version greater than 0.11.12
+Patch1: preupgrade-assistant-reports.patch
BuildArch: noarch
BuildRequires: rpm-devel
@@ -80,6 +77,7 @@ and scripts for generating contents.
%prep
%setup -q -n %{name}-%{version}
%patch0 -p1 -b .not-ui
+%patch1 -p1 -b .reports
rm -rf preup_ui
rm -rf ui-conf
@@ -168,6 +166,10 @@ rm -f ${RPM_BUILD_ROOT}%{_bindir}/premigrate
%{_rpmconfigdir}/macros.d/macros.preupgrade-assistant
%changelog
+* Tue May 19 2015 Petr Stodulka <pstodulk at redhat.com> - 0.11.12-2
+- added patch for updating solution.txt caused by splitting reports
+- removed obsolete patches
+
* Fri May 15 2015 Petr Hracek <phracek at redhat.com> - 0.11.12-1
- Rebase to new upstream version 0.11.12
--
cgit v0.10.2
http://pkgs.fedoraproject.org/cgit/preupgrade-assistant.git/commit/?h=f22&id=73d1b96152ddef0200ca0664ceb1394ead92b992
More information about the scm-commits
mailing list