Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package yast2-packager for openSUSE:Factory 
checked in at 2022-02-15 23:57:03
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-packager (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-packager.new.1956 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-packager"

Tue Feb 15 23:57:03 2022 rev:422 rq:954306 version:4.4.23

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-packager/yast2-packager.changes    
2022-02-10 23:11:32.472127029 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-packager.new.1956/yast2-packager.changes  
2022-02-15 23:57:12.888201669 +0100
@@ -1,0 +2,7 @@
+Mon Feb 14 09:40:00 UTC 2022 - Ladislav Slez??k <lsle...@suse.cz>
+
+- Remove duplicate repositories created at the end of installation
+  (repositories which are stored in the *.repo_1 files, bsc#1194546)
+- 4.4.23
+
+-------------------------------------------------------------------

Old:
----
  yast2-packager-4.4.22.tar.bz2

New:
----
  yast2-packager-4.4.23.tar.bz2

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ yast2-packager.spec ++++++
--- /var/tmp/diff_new_pack.lxPxvM/_old  2022-02-15 23:57:13.472203281 +0100
+++ /var/tmp/diff_new_pack.lxPxvM/_new  2022-02-15 23:57:13.480203304 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        4.4.22
+Version:        4.4.23
 Release:        0
 Summary:        YaST2 - Package Library
 License:        GPL-2.0-or-later

++++++ yast2-packager-4.4.22.tar.bz2 -> yast2-packager-4.4.23.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-4.4.22/package/yast2-packager.changes 
new/yast2-packager-4.4.23/package/yast2-packager.changes
--- old/yast2-packager-4.4.22/package/yast2-packager.changes    2022-02-08 
10:58:29.000000000 +0100
+++ new/yast2-packager-4.4.23/package/yast2-packager.changes    2022-02-14 
13:55:18.000000000 +0100
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Mon Feb 14 09:40:00 UTC 2022 - Ladislav Slez??k <lsle...@suse.cz>
+
+- Remove duplicate repositories created at the end of installation
+  (repositories which are stored in the *.repo_1 files, bsc#1194546)
+- 4.4.23
+
+-------------------------------------------------------------------
 Tue Feb  8 09:50:41 UTC 2022 - Imobach Gonzalez Sosa <igonzalezs...@suse.com>
 
 - Fix a wrong reference to PackageSystem#EnsureSourceInit
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-4.4.22/package/yast2-packager.spec 
new/yast2-packager-4.4.23/package/yast2-packager.spec
--- old/yast2-packager-4.4.22/package/yast2-packager.spec       2022-02-08 
10:58:29.000000000 +0100
+++ new/yast2-packager-4.4.23/package/yast2-packager.spec       2022-02-14 
13:55:18.000000000 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-packager
-Version:        4.4.22
+Version:        4.4.23
 Release:        0
 Summary:        YaST2 - Package Library
 License:        GPL-2.0-or-later
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-packager-4.4.22/src/lib/packager/clients/pkg_finish.rb 
new/yast2-packager-4.4.23/src/lib/packager/clients/pkg_finish.rb
--- old/yast2-packager-4.4.22/src/lib/packager/clients/pkg_finish.rb    
2022-02-08 10:58:29.000000000 +0100
+++ new/yast2-packager-4.4.23/src/lib/packager/clients/pkg_finish.rb    
2022-02-14 13:55:18.000000000 +0100
@@ -97,6 +97,7 @@
 
       # save all repositories and finish target
       Pkg.SourceSaveAll
+      remove_duplicates
       Pkg.TargetFinish
 
       # save repository metadata cache to the installed system
@@ -305,5 +306,27 @@
         config.save
       end
     end
+
+    # Remove duplicate repositories. If a repository with the same alias
+    # already exists libzypp saves it with suffix ".repo_1".
+    # The duplicate repositories comes from an RPM package
+    # @see bsc#1194546
+    def remove_duplicates
+      # all repositories, including the disabled ones
+      repos = Pkg.SourceGetCurrent(false)
+
+      to_delete = repos.select do |repo|
+        Yast::Pkg.SourceGeneralData(repo)["file"]&.match?(/\.repo_\d+\z/)
+      end
+
+      return if to_delete.empty?
+
+      to_delete.each do |repo|
+        log.info("Deleting duplicate repository 
#{Yast::Pkg.SourceGeneralData(repo)["file"]}")
+        Pkg.SourceDelete(repo)
+      end
+
+      Pkg.SourceSaveAll
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-packager-4.4.22/test/pkg_finish_test.rb 
new/yast2-packager-4.4.23/test/pkg_finish_test.rb
--- old/yast2-packager-4.4.22/test/pkg_finish_test.rb   2022-02-08 
10:58:29.000000000 +0100
+++ new/yast2-packager-4.4.23/test/pkg_finish_test.rb   2022-02-14 
13:55:18.000000000 +0100
@@ -56,6 +56,9 @@
       allow(Yast::Mode).to receive(:update).and_return(update)
       allow(Yast::Stage).to receive(:initial).and_return(true)
       allow(Yast::Pkg).to receive(:SourceLoad)
+      allow(Yast::Pkg).to receive(:SourceDelete)
+      allow(Yast::Pkg).to receive(:SourceSaveAll)
+      allow(Yast::Pkg).to receive(:SourceGetCurrent).and_return([])
       allow(File).to receive(:exist?).and_call_original
       allow(File).to receive(:exist?).with(FAILED_PKGS_PATH).and_return(false)
       allow(Yast::Packager::CFA::ZyppConf)
@@ -82,6 +85,19 @@
       client.run
     end
 
+    it "removes duplicate repositories" do
+      # the repositories stored in the *.repo_1 files are deleted
+      expect(Yast::Pkg).to receive(:SourceGetCurrent).and_return([42, 43])
+      expect(Yast::Pkg).to receive(:SourceGeneralData).with(42) \
+        .and_return("file" => "/etc/zypp/repos.d/test.repo")
+      expect(Yast::Pkg).to receive(:SourceGeneralData).with(43) \
+        .and_return("file" => "/etc/zypp/repos.d/test.repo_1").twice
+      expect(Yast::Pkg).to receive(:SourceDelete).with(43)
+      expect(Yast::Pkg).to receive(:SourceSaveAll)
+
+      client.run
+    end
+
     context "given some local repository" do
       let(:repositories) { [local_repo, local_dvd_repo, remote_repo] }
       let(:base_products) { [sles_product, sled_product] }

Reply via email to