Hello community,

here is the log from the commit of package yast2-country for openSUSE:Factory 
checked in at 2014-09-07 11:09:44
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-country (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-country.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-country"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-country/yast2-country.changes      
2014-08-25 11:03:33.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.yast2-country.new/yast2-country.changes 
2014-09-07 11:09:46.000000000 +0200
@@ -1,0 +2,7 @@
+Wed Sep  3 16:13:30 UTC 2014 - [email protected]
+
+- Added udev rules to handle layout of keyboards hot-plugged
+  during the installation process (bnc#885271)
+- 3.1.12
+
+-------------------------------------------------------------------

Old:
----
  yast2-country-3.1.11.tar.bz2

New:
----
  yast2-country-3.1.12.tar.bz2

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

Other differences:
------------------
++++++ yast2-country.spec ++++++
--- /var/tmp/diff_new_pack.L8bG5c/_old  2014-09-07 11:09:47.000000000 +0200
+++ /var/tmp/diff_new_pack.L8bG5c/_new  2014-09-07 11:09:47.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-country
-Version:        3.1.11
+Version:        3.1.12
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build



++++++ yast2-country-3.1.11.tar.bz2 -> yast2-country-3.1.12.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' 
old/yast2-country-3.1.11/keyboard/src/modules/Keyboard.rb 
new/yast2-country-3.1.12/keyboard/src/modules/Keyboard.rb
--- old/yast2-country-3.1.11/keyboard/src/modules/Keyboard.rb   2014-08-21 
16:40:17.000000000 +0200
+++ new/yast2-country-3.1.12/keyboard/src/modules/Keyboard.rb   2014-09-04 
14:10:09.000000000 +0200
@@ -95,6 +95,13 @@
   class KeyboardClass < Module
     include Yast::Logger
 
+    # Writing rules in /etc/udev would result in those files being copied to
+    # the installed system. That's not what we want. sys-int is temporary, so
+    # writing in its /usr/lib is safe.
+    UDEV_FILE = "/usr/lib/udev/rules.d/70-installation-keyboard.rules"
+    UDEV_COMMENT = "# Generated by Yast to handle the layout of keyboards "\
+                   "connected during installation\n"
+
     def main
       Yast.import "UI"
       textdomain "country"
@@ -1057,6 +1064,8 @@
             )
             SCR.Execute(path(".target.bash"), cmd)
           end
+          # bnc#885271: set udev rule to handle incoming attached keyboards
+          write_udev_rule if Stage.initial
         end
       end
       @xkb_cmd
@@ -1458,6 +1467,26 @@
       Initrd.Update
       Initrd.Write
     end
+
+    # Creates an udev rule to manage the layout for keyboards that are
+    # hotplugged during the installation process
+    def write_udev_rule
+      # Remove the file if present (needed to make udev aware of changes)
+      SCR.Execute(path(".target.remove"), UDEV_FILE)
+
+      # Using an array of arrays instead of a hash to get a predictable and
+      # ordered rule (even if it's not required by udev itself)
+      udev_env = [["XKBLAYOUT", @XkbLayout],
+                  ["XKBMODEL", @XkbModel],
+                  ["XKBVARIANT", @XkbVariant],
+                  ["XKBOPTIONS", @XkbOptions]]
+      udev_env.delete_if {|key,value| value.nil? || value.empty? }
+      if !udev_env.empty?
+        rule = 'ENV{ID_INPUT_KEYBOARD}=="1", '
+        rule << udev_env.map {|key,value| "ENV{#{key}}=\"#{value}\"" }.join(", 
")
+        SCR.Write(path(".target.string"), UDEV_FILE, UDEV_COMMENT + rule)
+      end
+    end
   end
 
   Keyboard = KeyboardClass.new
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-country-3.1.11/keyboard/test/SCRStub.rb 
new/yast2-country-3.1.12/keyboard/test/SCRStub.rb
--- old/yast2-country-3.1.11/keyboard/test/SCRStub.rb   2014-08-21 
16:40:17.000000000 +0200
+++ new/yast2-country-3.1.12/keyboard/test/SCRStub.rb   2014-09-04 
14:10:09.000000000 +0200
@@ -20,6 +20,7 @@
   SIZE_PATH = Yast::Path.new(".target.size")
   BASH_PATH = Yast::Path.new(".target.bash")
   STRING_PATH = Yast::Path.new(".target.string")
+  REMOVE_PATH = Yast::Path.new(".target.remove")
 
   # Ensures that non-stubbed SCR calls still works as expected after including
   # the module in the testsuite
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-country-3.1.11/keyboard/test/keyboard_test.rb 
new/yast2-country-3.1.12/keyboard/test/keyboard_test.rb
--- old/yast2-country-3.1.11/keyboard/test/keyboard_test.rb     2014-08-21 
16:40:17.000000000 +0200
+++ new/yast2-country-3.1.12/keyboard/test/keyboard_test.rb     2014-09-04 
14:10:09.000000000 +0200
@@ -10,6 +10,7 @@
   import "Path"
   import "Encoding"
   import "AsciiFile"
+  import "XVersion"
 
   RSpec.configure do |c|
     c.include SCRStub
@@ -142,5 +143,56 @@
         Keyboard.Set("russian")
       end
     end
+
+    describe "#SetX11" do
+      before(:each) do
+        stub_presence_of "/usr/sbin/xkbctrl"
+        allow(XVersion).to receive(:binPath).and_return "/usr/bin"
+      end
+
+      context "during installation" do
+        let(:mode) { "installation" }
+        let(:stage) { "initial" }
+        let(:chroot) { "installing" }
+
+        it "creates temporary udev rule" do
+          # Twice, one for SetKeyboard and again for SetX11
+          expect_to_execute(/xkbctrl es/).twice do |p, cmd|
+            dump_xkbctrl(:spanish, cmd.split("> ")[1])
+          end
+          expect_to_execute(/setxkbmap .*layout es/)
+
+          rule = "# Generated by Yast to handle the layout of keyboards 
connected during installation\n"
+          rule += 'ENV{ID_INPUT_KEYBOARD}=="1", ENV{XKBLAYOUT}="es", 
ENV{XKBMODEL}="microsoftpro", ENV{XKBVARIANT}="basic"'
+          file = "/usr/lib/udev/rules.d/70-installation-keyboard.rules"
+          expect(SCR).to receive(:Execute).with(SCRStub::REMOVE_PATH, file)
+          expect(SCR).to receive(:Write).with(SCRStub::STRING_PATH, file, rule)
+
+          Keyboard.SetKeyboard("spanish")
+          Keyboard.SetX11("spanish")
+        end
+      end
+
+      context "in an installed system" do
+        let(:mode) { "normal" }
+        let(:stage) { "normal" }
+        let(:chroot) { "spanish" }
+
+        it "does not create udev rules" do
+          # Twice, one for SetKeyboard and again for SetX11
+          expect_to_execute(/xkbctrl trq/).twice do |p, cmd|
+            dump_xkbctrl(:turkish, cmd.split("> ")[1])
+          end
+          expect_to_execute(/setxkbmap .*layout tr/)
+
+          expect(SCR).to_not receive(:Execute).with(SCRStub::REMOVE_PATH, 
anything)
+          expect(SCR).to_not receive(:Write).with(SCRStub::STRING_PATH,
+                                                  
"/etc/udev/rules.d/70-keyboard.rules",
+                                                  anything)
+          Keyboard.SetKeyboard("turkish")
+          Keyboard.SetX11("turkish")
+        end
+      end
+    end
   end
 end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-country-3.1.11/package/yast2-country.changes 
new/yast2-country-3.1.12/package/yast2-country.changes
--- old/yast2-country-3.1.11/package/yast2-country.changes      2014-08-21 
16:40:17.000000000 +0200
+++ new/yast2-country-3.1.12/package/yast2-country.changes      2014-09-04 
14:10:09.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Wed Sep  3 16:13:30 UTC 2014 - [email protected]
+
+- Added udev rules to handle layout of keyboards hot-plugged
+  during the installation process (bnc#885271)
+- 3.1.12
+
+-------------------------------------------------------------------
 Thu Aug 21 13:45:58 UTC 2014 - [email protected]
 
 - Persisted X11 keyboard configuration using localectl (bnc#892303)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-country-3.1.11/package/yast2-country.spec 
new/yast2-country-3.1.12/package/yast2-country.spec
--- old/yast2-country-3.1.11/package/yast2-country.spec 2014-08-21 
16:40:17.000000000 +0200
+++ new/yast2-country-3.1.12/package/yast2-country.spec 2014-09-04 
14:10:09.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-country
-Version:        3.1.11
+Version:        3.1.12
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

-- 
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to