Author: aschnell Date: Wed Aug 29 14:41:17 2007 New Revision: 6975 URL: http://svn.opensuse.org/viewcvs/zypp?rev=6975&view=rev Log: - sign repositories Added: trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.rb (with props) trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.ref.out trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.rb (with props) trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.ref.out trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.rb (with props) trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.ref.out trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.rb (with props) trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.ref.out Modified: trunk/libzypp-testsuite/package/libzypp-testsuite-tools.changes trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp trunk/libzypp-testsuite/pokus/src/testsuite.rb Modified: trunk/libzypp-testsuite/package/libzypp-testsuite-tools.changes URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/package/libzypp-testsuite-tools.changes?rev=6975&r1=6974&r2=6975&view=diff ============================================================================== --- trunk/libzypp-testsuite/package/libzypp-testsuite-tools.changes (original) +++ trunk/libzypp-testsuite/package/libzypp-testsuite-tools.changes Wed Aug 29 14:41:17 2007 @@ -2,6 +2,7 @@ Wed Aug 29 11:22:23 CEST 2007 - aschnell@suse.de - added more tests +- sign repositories ------------------------------------------------------------------- Mon Aug 27 10:50:07 CEST 2007 - schubi@suse.de Modified: trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp?rev=6975&r1=6974&r2=6975&view=diff ============================================================================== --- trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp (original) +++ trunk/libzypp-testsuite/pokus/pokus.test/pokus_test.exp Wed Aug 29 14:41:17 2007 @@ -4,9 +4,6 @@ set dircases [glob $datadir/*-tests] -# FIXME: temporarily ignore signatures -setenv ZYPP_KEYRING_DEFAULT_ACCEPT_ALL 1 - foreach dircase $dircases { set testPath [split $dircase "/"] Modified: trunk/libzypp-testsuite/pokus/src/testsuite.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/src/testsuite.rb?rev=6975&r1=6974&r2=6975&view=diff ============================================================================== --- trunk/libzypp-testsuite/pokus/src/testsuite.rb (original) +++ trunk/libzypp-testsuite/pokus/src/testsuite.rb Wed Aug 29 14:41:17 2007 @@ -16,6 +16,26 @@ end + def Testsuite.sign_repo(type, path) + + case type + when :yum : file = "#{path}/repodata/repomd.xml" + when :yast : file = "#{path}/content" + else + STDERR.puts "Unknown repository type" + exit 1 + end + + system("gpg -q --home #{path} --no-default-keyring --import ../../data/privkey.txt") + system("gpg -q --home #{path} --no-default-keyring --sign --detach-sign --armor #{file}") + + keyring = ZYppFactory::instance.get_zypp.key_ring + publickey = PublicKey.new(Pathname.new("../../data/pubkey.txt")) + keyring.import_key(publickey, true) + + end + + def Testsuite.write_repo(type, packages) # ruby does *not* have a mkdtemp function! @@ -25,6 +45,8 @@ output = OutputFactory(type, path) output.write(packages) + sign_repo(type, path) + return path end Added: trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.rb?rev=6975&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.rb (added) +++ trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.rb Wed Aug 29 14:41:17 2007 @@ -0,0 +1,42 @@ +#!/usr/bin/ruby + + +# Generate a YaST repository and remove the signature file. + + +require 'zypptools/lib/arch' +require 'zypptools/lib/package' +require 'zypptools/output/output' +include ZYppTools + +require '../../src/testsuite' + + +packages = Array.new() + +pkg = Package.new("test") +pkg.arch = "ia64" +pkg.rpmsize = 42 +pkg.version = "1.2" +pkg.release = 1 +pkg.summary = "A pure test package" +packages.push(pkg) + +path = Testsuite.write_repo(:yast, packages) + + +FileUtils.rm(path + "/content.asc") + + +Testsuite.set_arch("ia64") + +begin + pool = Testsuite.read_repo("file://" + path) +rescue ZYppException => e + puts "ZYppException caught" + puts e.to_s +else + puts "Oh, no exception caught" + exit 1 +end + Added: trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.ref.out URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.ref.out?rev=6975&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.ref.out (added) +++ trunk/libzypp-testsuite/pokus/tests/trust-tests/yast1.ref.out Wed Aug 29 14:41:17 2007 @@ -0,0 +1,2 @@ +ZYppException caught +Valid metadata not found at specified URL(s) Added: trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.rb?rev=6975&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.rb (added) +++ trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.rb Wed Aug 29 14:41:17 2007 @@ -0,0 +1,46 @@ +#!/usr/bin/ruby + + +# Generate a YaST repository and delete the public key. + + +require 'zypptools/lib/arch' +require 'zypptools/lib/package' +require 'zypptools/output/output' +require 'zypp' +include ZYppTools +include Zypp + +require '../../src/testsuite' + + +packages = Array.new() + +pkg = Package.new("test") +pkg.arch = "ia64" +pkg.rpmsize = 42 +pkg.version = "1.2" +pkg.release = 1 +pkg.summary = "A pure test package" +packages.push(pkg) + +path = Testsuite.write_repo(:yast, packages) + + +keyring = ZYppFactory::instance.get_zypp.key_ring +publickey = PublicKey.new(Pathname.new("../../data/pubkey.txt")) +keyring.delete_key(publickey.id(), true) + + +Testsuite.set_arch("ia64") + +begin + pool = Testsuite.read_repo("file://" + path) +rescue ZYppException => e + puts "ZYppException caught" + puts e.to_s +else + puts "Oh, no exception caught" + exit 1 +end + Added: trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.ref.out URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.ref.out?rev=6975&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.ref.out (added) +++ trunk/libzypp-testsuite/pokus/tests/trust-tests/yast2.ref.out Wed Aug 29 14:41:17 2007 @@ -0,0 +1,2 @@ +ZYppException caught +Valid metadata not found at specified URL(s) Added: trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.rb?rev=6975&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.rb (added) +++ trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.rb Wed Aug 29 14:41:17 2007 @@ -0,0 +1,42 @@ +#!/usr/bin/ruby + + +# Generate a YUM repository and remove the signature file. + + +require 'zypptools/lib/arch' +require 'zypptools/lib/package' +require 'zypptools/output/output' +include ZYppTools + +require '../../src/testsuite' + + +packages = Array.new() + +pkg = Package.new("test") +pkg.arch = "ia64" +pkg.rpmsize = 42 +pkg.version = "1.2" +pkg.release = 1 +pkg.summary = "A pure test package" +packages.push(pkg) + +path = Testsuite.write_repo(:yum, packages) + + +FileUtils.rm(path + "/repodata/repomd.xml.asc") + + +Testsuite.set_arch("ia64") + +begin + pool = Testsuite.read_repo("file://" + path) +rescue ZYppException => e + puts "ZYppException caught" + puts e.to_s +else + puts "Oh, no exception caught" + exit 1 +end + Added: trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.ref.out URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.ref.out?rev=6975&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.ref.out (added) +++ trunk/libzypp-testsuite/pokus/tests/trust-tests/yum1.ref.out Wed Aug 29 14:41:17 2007 @@ -0,0 +1,2 @@ +ZYppException caught +Valid metadata not found at specified URL(s) Added: trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.rb URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.rb?rev=6975&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.rb (added) +++ trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.rb Wed Aug 29 14:41:17 2007 @@ -0,0 +1,46 @@ +#!/usr/bin/ruby + + +# Generate a YUM repository and delete the public key. + + +require 'zypptools/lib/arch' +require 'zypptools/lib/package' +require 'zypptools/output/output' +require 'zypp' +include ZYppTools +include Zypp + +require '../../src/testsuite' + + +packages = Array.new() + +pkg = Package.new("test") +pkg.arch = "ia64" +pkg.rpmsize = 42 +pkg.version = "1.2" +pkg.release = 1 +pkg.summary = "A pure test package" +packages.push(pkg) + +path = Testsuite.write_repo(:yum, packages) + + +keyring = ZYppFactory::instance.get_zypp.key_ring +publickey = PublicKey.new(Pathname.new("../../data/pubkey.txt")) +keyring.delete_key(publickey.id(), true) + + +Testsuite.set_arch("ia64") + +begin + pool = Testsuite.read_repo("file://" + path) +rescue ZYppException => e + puts "ZYppException caught" + puts e.to_s +else + puts "Oh, no exception caught" + exit 1 +end + Added: trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.ref.out URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.ref.out?rev=6975&view=auto ============================================================================== --- trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.ref.out (added) +++ trunk/libzypp-testsuite/pokus/tests/trust-tests/yum2.ref.out Wed Aug 29 14:41:17 2007 @@ -0,0 +1,2 @@ +ZYppException caught +Valid metadata not found at specified URL(s) -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org