From 6c3fe6fcefb5b1bc5d78cb3624862e7a84430c70 Mon Sep 17 00:00:00 2001 From: CentOS Sources Date: Jun 10 2014 14:08:47 +0000 Subject: import subscription-manager-1.10.14-8.el7_0 --- diff --git a/SOURCES/subscription-manager-1.10.14-8-to-subscription-manager-1.10.14-9.patch b/SOURCES/subscription-manager-1.10.14-8-to-subscription-manager-1.10.14-9.patch deleted file mode 100644 index 1571101..0000000 --- a/SOURCES/subscription-manager-1.10.14-8-to-subscription-manager-1.10.14-9.patch +++ /dev/null @@ -1,169 +0,0 @@ -diff --git a/rel-eng/packages/subscription-manager b/rel-eng/packages/subscription-manager -index f9393db..69983e3 100644 ---- a/rel-eng/packages/subscription-manager -+++ b/rel-eng/packages/subscription-manager -@@ -1 +1 @@ --1.10.14-8 ./ -+1.10.14-9 ./ -diff --git a/src/subscription_manager/repolib.py b/src/subscription_manager/repolib.py -index fa0913d..6afdfc8 100644 ---- a/src/subscription_manager/repolib.py -+++ b/src/subscription_manager/repolib.py -@@ -15,7 +15,7 @@ - # in this software or its documentation. - # - --from iniparse import ConfigParser -+from iniparse import RawConfigParser as ConfigParser - import logging - import os - import string -@@ -542,16 +542,36 @@ class RepoFile(ConfigParser): - def read(self): - ConfigParser.read(self, self.path) - -+ def _configparsers_equal(self, otherparser): -+ if set(otherparser.sections()) != set(self.sections()): -+ return False -+ -+ for section in self.sections(): -+ # Sometimes we end up with ints, but values must be strings to compare -+ current_items = dict([(str(k), str(v)) for (k, v) in self.items(section)]) -+ if current_items != dict(otherparser.items(section)): -+ return False -+ return True -+ -+ def _has_changed(self): -+ ''' -+ Check if the version on disk is different from what we have loaded -+ ''' -+ on_disk = ConfigParser() -+ on_disk.read(self.path) -+ return not self._configparsers_equal(on_disk) -+ - def write(self): - if not self.manage_repos: - log.debug("Skipping write due to manage_repos setting: %s" % - self.path) - return -- f = open(self.path, 'w') -- tidy_writer = TidyWriter(f) -- ConfigParser.write(self, tidy_writer) -- tidy_writer.close() -- f.close() -+ if self._has_changed(): -+ f = open(self.path, 'w') -+ tidy_writer = TidyWriter(f) -+ ConfigParser.write(self, tidy_writer) -+ tidy_writer.close() -+ f.close() - - def add(self, repo): - self.add_section(repo.id) -diff --git a/subscription-manager.spec b/subscription-manager.spec -index 04a660d..cf294c7 100644 ---- a/subscription-manager.spec -+++ b/subscription-manager.spec -@@ -14,7 +14,7 @@ - - Name: subscription-manager - Version: 1.10.14 --Release: 8%{?dist} -+Release: 9%{?dist} - Summary: Tools and libraries for subscription and repository management - Group: System Environment/Base - License: GPLv2 -@@ -419,6 +419,9 @@ fi - %endif - - %changelog -+* Wed Jun 04 2014 ckozak 1.10.14-9 -+- 1104777: Don't rewrite redhat.repo unless it has changed (ckozak@redhat.com) -+ - * Tue May 27 2014 ckozak 1.10.14-8 - - 1098891: Update repos, persisting local settings when possible - (ckozak@redhat.com) -diff --git a/test/test_repolib.py b/test/test_repolib.py -index 72505a3..cde217a 100644 ---- a/test/test_repolib.py -+++ b/test/test_repolib.py -@@ -15,6 +15,7 @@ - - import unittest - -+from iniparse import RawConfigParser - from mock import Mock, patch - from StringIO import StringIO - -@@ -23,7 +24,8 @@ from stubs import StubCertificateDirectory, StubProductCertificate, \ - StubProduct, StubEntitlementCertificate, StubContent, \ - StubProductDirectory, StubUEP, StubConsumerIdentity - import subscription_manager.injection as inj --from subscription_manager.repolib import Repo, UpdateAction, TidyWriter -+from subscription_manager.repolib import Repo, UpdateAction, \ -+ TidyWriter, RepoFile - from subscription_manager import repolib - - -@@ -478,3 +480,61 @@ class TidyWriterTests(unittest.TestCase): - tidy_writer.close() - - self.assertEquals("test stuff\n\ntest\n", output.getvalue()) -+ -+ -+class RepoFileTest(unittest.TestCase): -+ -+ @patch("subscription_manager.repolib.RepoFile.create") -+ @patch("subscription_manager.repolib.TidyWriter") -+ def test_configparsers_equal(self, tidy_writer, stub_create): -+ rf = RepoFile() -+ other = RawConfigParser() -+ for parser in [rf, other]: -+ parser.add_section('test') -+ parser.set('test', 'key', 'val') -+ self.assertTrue(rf._configparsers_equal(other)) -+ -+ @patch("subscription_manager.repolib.RepoFile.create") -+ @patch("subscription_manager.repolib.TidyWriter") -+ def test_configparsers_diff_sections(self, tidy_writer, stub_create): -+ rf = RepoFile() -+ rf.add_section('new_section') -+ other = RawConfigParser() -+ for parser in [rf, other]: -+ parser.add_section('test') -+ parser.set('test', 'key', 'val') -+ self.assertFalse(rf._configparsers_equal(other)) -+ -+ @patch("subscription_manager.repolib.RepoFile.create") -+ @patch("subscription_manager.repolib.TidyWriter") -+ def test_configparsers_diff_item_val(self, tidy_writer, stub_create): -+ rf = RepoFile() -+ other = RawConfigParser() -+ for parser in [rf, other]: -+ parser.add_section('test') -+ parser.set('test', 'key', 'val') -+ rf.set('test', 'key', 'val2') -+ self.assertFalse(rf._configparsers_equal(other)) -+ -+ @patch("subscription_manager.repolib.RepoFile.create") -+ @patch("subscription_manager.repolib.TidyWriter") -+ def test_configparsers_diff_items(self, tidy_writer, stub_create): -+ rf = RepoFile() -+ other = RawConfigParser() -+ for parser in [rf, other]: -+ parser.add_section('test') -+ parser.set('test', 'key', 'val') -+ rf.set('test', 'somekey', 'val') -+ self.assertFalse(rf._configparsers_equal(other)) -+ -+ @patch("subscription_manager.repolib.RepoFile.create") -+ @patch("subscription_manager.repolib.TidyWriter") -+ def test_configparsers_equal_int(self, tidy_writer, stub_create): -+ rf = RepoFile() -+ other = RawConfigParser() -+ for parser in [rf, other]: -+ parser.add_section('test') -+ parser.set('test', 'key', 'val') -+ rf.set('test', 'k', 1) -+ other.set('test', 'k', '1') -+ self.assertTrue(rf._configparsers_equal(other)) diff --git a/SPECS/subscription-manager.spec b/SPECS/subscription-manager.spec index d1393fe..6248ba0 100644 --- a/SPECS/subscription-manager.spec +++ b/SPECS/subscription-manager.spec @@ -14,7 +14,7 @@ Name: subscription-manager Version: 1.10.14 -Release: 9%{?dist} +Release: 8%{?dist} Summary: Tools and libraries for subscription and repository management Group: System Environment/Base License: GPLv2 @@ -32,7 +32,6 @@ Patch3: subscription-manager-1.10.14-4-to-subscription-manager-1.10.14-5.patch Patch4: subscription-manager-1.10.14-5-to-subscription-manager-1.10.14-6.patch Patch5: subscription-manager-1.10.14-6-to-subscription-manager-1.10.14-7.patch Patch6: subscription-manager-1.10.14-7-to-subscription-manager-1.10.14-8.patch -Patch7: subscription-manager-1.10.14-8-to-subscription-manager-1.10.14-9.patch URL: https://fedorahosted.org/subscription-manager/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -157,7 +156,6 @@ subscriptions %patch4 -p1 %patch5 -p1 %patch6 -p1 -%patch7 -p1 %build make -f Makefile CFLAGS="%{optflags}" @@ -435,9 +433,6 @@ fi %endif %changelog -* Wed Jun 04 2014 ckozak 1.10.14-9 -- 1104777: Don't rewrite redhat.repo unless it has changed (ckozak@redhat.com) - * Tue May 27 2014 ckozak 1.10.14-8 - 1098891: Update repos, persisting local settings when possible (ckozak@redhat.com)