Hello community,

here is the log from the commit of package yast2-proxy for openSUSE:Factory 
checked in at 2015-04-27 12:57:39
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-proxy (Old)
 and      /work/SRC/openSUSE:Factory/.yast2-proxy.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "yast2-proxy"

Changes:
--------
--- /work/SRC/openSUSE:Factory/yast2-proxy/yast2-proxy.changes  2014-12-05 
21:02:50.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.yast2-proxy.new/yast2-proxy.changes     
2015-04-27 12:57:40.000000000 +0200
@@ -1,0 +2,7 @@
+Thu Apr  9 15:35:53 UTC 2015 - mvid...@suse.com
+
+- Write also --noproxy to .curlrc otherwise it is ignored even if
+  set in the environment (bsc#923788).
+- 3.1.4
+
+-------------------------------------------------------------------

Old:
----
  yast2-proxy-3.1.3.tar.bz2

New:
----
  yast2-proxy-3.1.4.tar.bz2

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

Other differences:
------------------
++++++ yast2-proxy.spec ++++++
--- /var/tmp/diff_new_pack.D6OeAi/_old  2015-04-27 12:57:40.000000000 +0200
+++ /var/tmp/diff_new_pack.D6OeAi/_new  2015-04-27 12:57:40.000000000 +0200
@@ -1,7 +1,7 @@
 #
 # spec file for package yast2-proxy
 #
-# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
+# Copyright (c) 2015 SUSE LINUX Products GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-proxy
-Version:        3.1.3
+Version:        3.1.4
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build

++++++ yast2-proxy-3.1.3.tar.bz2 -> yast2-proxy-3.1.4.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-proxy-3.1.3/CONTRIBUTING.md 
new/yast2-proxy-3.1.4/CONTRIBUTING.md
--- old/yast2-proxy-3.1.3/CONTRIBUTING.md       2014-12-04 11:00:58.000000000 
+0100
+++ new/yast2-proxy-3.1.4/CONTRIBUTING.md       2015-04-17 10:38:55.000000000 
+0200
@@ -12,13 +12,13 @@
 -----------
 
 If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.novell.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
+[Bugzilla](https://bugzilla.suse.com/enter_bug.cgi?format=guided&product=openSUSE+Factory&component=YaST2)
 or [GitHub issues](../../issues). (For Bugzilla, use the [simplified
 
registration](https://secure-www.novell.com/selfreg/jsp/createSimpleAccount.jsp)
 if you don't have an account yet.)
 
 If you find a problem, please report it either using
-[Bugzilla](https://bugzilla.novell.com/) or GitHub issues. We can't guarantee
+[Bugzilla](https://bugzilla.suse.com/) or GitHub issues. We can't guarantee
 that every bug will be fixed, but we'll try.
 
 When creating a bug report, please follow our [bug reporting
@@ -71,7 +71,7 @@
 [widely used
 
conventions](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html).
 
-If your commit is related to a bug in Buzgilla or an issue on GitHub, make sure
+If your commit is related to a bug in Bugzilla or an issue on GitHub, make sure
 you mention it in the commit message for cross-reference. Use format like
 bnc#775814 or gh#yast/yast-foo#42. See also [GitHub
 
autolinking](https://help.github.com/articles/github-flavored-markdown#references)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-proxy-3.1.3/package/yast2-proxy.changes 
new/yast2-proxy-3.1.4/package/yast2-proxy.changes
--- old/yast2-proxy-3.1.3/package/yast2-proxy.changes   2014-12-04 
11:00:58.000000000 +0100
+++ new/yast2-proxy-3.1.4/package/yast2-proxy.changes   2015-04-23 
17:37:09.000000000 +0200
@@ -1,4 +1,11 @@
 -------------------------------------------------------------------
+Thu Apr  9 15:35:53 UTC 2015 - mvid...@suse.com
+
+- Write also --noproxy to .curlrc otherwise it is ignored even if
+  set in the environment (bsc#923788).
+- 3.1.4
+
+-------------------------------------------------------------------
 Thu Dec  4 09:51:05 UTC 2014 - jreidin...@suse.com
 
 - remove X-KDE-Library from desktop file (bnc#899104)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-proxy-3.1.3/package/yast2-proxy.spec 
new/yast2-proxy-3.1.4/package/yast2-proxy.spec
--- old/yast2-proxy-3.1.3/package/yast2-proxy.spec      2014-12-04 
11:00:58.000000000 +0100
+++ new/yast2-proxy-3.1.4/package/yast2-proxy.spec      2015-04-23 
17:37:09.000000000 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           yast2-proxy
-Version:        3.1.3
+Version:        3.1.4
 Release:        0
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-build
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-proxy-3.1.3/src/modules/Proxy.rb 
new/yast2-proxy-3.1.4/src/modules/Proxy.rb
--- old/yast2-proxy-3.1.3/src/modules/Proxy.rb  2014-12-04 11:00:59.000000000 
+0100
+++ new/yast2-proxy-3.1.4/src/modules/Proxy.rb  2015-04-23 17:37:09.000000000 
+0200
@@ -117,7 +117,64 @@
       true
     end
 
-    # Write routing settings and apply changes
+    def WriteSysconfig
+      SCR.Write(path(".sysconfig.proxy.PROXY_ENABLED"), @enabled ? "yes" : 
"no")
+      SCR.Write(path(".sysconfig.proxy.HTTP_PROXY"), @http)
+      SCR.Write(path(".sysconfig.proxy.HTTPS_PROXY"), @https)
+      SCR.Write(path(".sysconfig.proxy.FTP_PROXY"), @ftp)
+      SCR.Write(path(".sysconfig.proxy.NO_PROXY"), @no)
+      SCR.Write(path(".sysconfig.proxy"), nil)
+    end
+
+    # Escape backslash characters in .curlrc (bnc#331038)
+    # see also http://curl.haxx.se/docs/manpage.html#-K for escaping rules
+    def EscapeForCurlrc(s)
+      return nil if s.nil?
+      Builtins.mergestring(Builtins.splitstring(s, "\\"),
+                           "\\\\")
+    end
+
+    def WriteCurlrc
+      proxyuser = nil
+      if @user != ""
+        proxyuser = @user
+        proxyuser = @user + ":" + @pass if @pass != ""
+      end
+
+      options = {
+        "--proxy-user" => proxyuser,
+        # bnc#305163
+        "--proxy"      => @http,
+        # bsc#923788
+        "--noproxy"    => @no
+      }
+
+      # proxy is used, write /root/.curlrc
+      if @enabled
+        write_comment = true
+
+        options.each do |option, value|
+          value = nil if value == ""
+
+          SCR.Write(path(".root.curlrc") + option, EscapeForCurlrc(value))
+
+          if value != nil && write_comment
+            SCR.Write(path(".root.curlrc") + option + "comment",
+                      ChangedComment("proxy"))
+            write_comment = false
+          end
+        end
+        # proxy is not used, remove proxy-related settings
+      else
+        options.each_key do |option|
+          SCR.Write(path(".root.curlrc") + option, nil)
+        end
+      end
+
+      SCR.Write(path(".root.curlrc"), nil)
+    end
+
+    # Write proxy settings and apply changes
     # @return true if success
     def Write
       Builtins.y2milestone("Writing configuration")
@@ -141,65 +198,9 @@
       Progress.Title(_("Updating proxy configuration..."))
 
       # Update /etc/sysconfig/proxy
-      SCR.Write(path(".sysconfig.proxy.PROXY_ENABLED"), @enabled ? "yes" : 
"no")
-      SCR.Write(path(".sysconfig.proxy.HTTP_PROXY"), @http)
-      SCR.Write(path(".sysconfig.proxy.HTTPS_PROXY"), @https)
-      SCR.Write(path(".sysconfig.proxy.FTP_PROXY"), @ftp)
-      SCR.Write(path(".sysconfig.proxy.NO_PROXY"), @no)
-      SCR.Write(path(".sysconfig.proxy"), nil)
-
-      # proxy is used, write /root/.curlrc
-      # bugzilla #305163
-      if @enabled
-        # Update /root/.curlrc
-        proxyuser = nil
-        if @user != ""
-          #Escape backslash characters in .curlrc (#331038)
-          @user = Builtins.mergestring(
-            Builtins.splitstring(@user, "\\"),
-            "\\\\"
-          )
-          proxyuser = @user
-          proxyuser = Ops.add(Ops.add(@user, ":"), @pass) if @pass != ""
-        end
-
-        # nil or real value
-        SCR.Write(Builtins.add(path(".root.curlrc"), "--proxy-user"), 
proxyuser)
-
-        # not 'nil', not empty
-        # bugzilla #305163
-        if @http != nil && Ops.greater_than(Builtins.size(@http), 0)
-          SCR.Write(Builtins.add(path(".root.curlrc"), "--proxy"), @http)
-        else
-          SCR.Write(Builtins.add(path(".root.curlrc"), "--proxy"), nil)
-        end
+      WriteSysconfig()
 
-        # only written value can have a comment
-        if proxyuser != nil
-          SCR.Write(
-            Builtins.add(
-              Builtins.add(path(".root.curlrc"), "--proxy-user"),
-              "comment"
-            ),
-            ChangedComment("proxy")
-          ) 
-          # only when set, can have a comment
-        elsif @http != nil && Ops.greater_than(Builtins.size(@http), 0)
-          SCR.Write(
-            Builtins.add(
-              Builtins.add(path(".root.curlrc"), "--proxy"),
-              "comment"
-            ),
-            ChangedComment("proxy")
-          )
-        end 
-        # proxy is not used, remove proxy-related settings
-      else
-        SCR.Write(Builtins.add(path(".root.curlrc"), "--proxy-user"), nil)
-        SCR.Write(Builtins.add(path(".root.curlrc"), "--proxy"), nil)
-      end
-
-      SCR.Write(path(".root.curlrc"), nil)
+      WriteCurlrc()
       Builtins.sleep(sl)
       Progress.NextStage
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-proxy-3.1.3/test/Makefile.am 
new/yast2-proxy-3.1.4/test/Makefile.am
--- old/yast2-proxy-3.1.3/test/Makefile.am      2014-12-04 11:00:59.000000000 
+0100
+++ new/yast2-proxy-3.1.4/test/Makefile.am      2015-04-23 17:37:09.000000000 
+0200
@@ -1,5 +1,6 @@
 TESTS = \
-  test_proxy_return_code_test.rb
+  test_proxy_return_code_test.rb \
+  write_test.rb
 
 TEST_EXTENSIONS = .rb
 RB_LOG_COMPILER = rspec --format doc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-proxy-3.1.3/test/test_helper.rb 
new/yast2-proxy-3.1.4/test/test_helper.rb
--- old/yast2-proxy-3.1.3/test/test_helper.rb   2014-12-04 11:00:59.000000000 
+0100
+++ new/yast2-proxy-3.1.4/test/test_helper.rb   2015-04-23 17:37:09.000000000 
+0200
@@ -1,3 +1,5 @@
 srcdir = File.expand_path("../../src", __FILE__)
 y2dirs = ENV.fetch("Y2DIR", "").split(":")
 ENV["Y2DIR"] = y2dirs.unshift(srcdir).join(":")
+
+require "yast/rspec"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/yast2-proxy-3.1.3/test/write_test.rb 
new/yast2-proxy-3.1.4/test/write_test.rb
--- old/yast2-proxy-3.1.3/test/write_test.rb    1970-01-01 01:00:00.000000000 
+0100
+++ new/yast2-proxy-3.1.4/test/write_test.rb    2015-04-23 17:37:09.000000000 
+0200
@@ -0,0 +1,84 @@
+#!/usr/bin/env rspec
+require_relative "test_helper"
+require "yast"
+
+Yast.import "Proxy"
+
+describe "Yast::ProxyClass" do
+  subject do
+    Yast::Proxy
+  end
+
+  describe "#WriteCurlrc" do
+    it "deletes proxy entries, when proxy is disabled" do
+      subject.Import({"enabled" => false})
+
+      expect(Yast::SCR).to receive(:Write).
+        with(path_matching(/^\.root\.curlrc/), nil).
+        at_least(:once).
+        and_return true
+
+      expect(subject.WriteCurlrc).to be true
+    end
+
+    it "writes proxy settings, and a comment, when proxy is enabled" do
+      subject.Import({ "enabled"    => true,
+                       "http_proxy" => "proxy.example.org:3128" })
+
+      expect(Yast::SCR).to receive(:Write).
+        with(path_matching(/^\.root\.curlrc\..*\."comment"/), /Changed/).
+        once.and_return true
+
+      expect(Yast::SCR).to receive(:Write).
+        with(path(".root.curlrc.\"--proxy\""), "proxy.example.org:3128").
+        once.and_return true
+
+      expect(Yast::SCR).to receive(:Write).
+        with(path(".root.curlrc.\"--noproxy\""), "localhost").
+        once.and_return true
+
+      allow(Yast::SCR).to receive(:Write).
+        with(path_matching(/^\.root\.curlrc/), nil).
+        and_return true
+
+      expect(Yast::SCR).to receive(:Write).
+        with(path(".root.curlrc"), nil).
+        once.and_return true
+
+      expect(subject.WriteCurlrc).to be true
+    end
+
+    it "writes a no-proxy setting" do
+      subject.Import({ "enabled"    => true,
+                       "http_proxy" => "proxy.example.org:3128",
+                       "no_proxy"   => "example.org,example.com,localhost" })
+      expect(Yast::SCR).to receive(:Write).
+        with(path(".root.curlrc.\"--noproxy\""),
+             "example.org,example.com,localhost").
+        once.and_return true
+
+      allow(Yast::SCR).to receive(:Write).
+        with(path_matching(/^\.root\.curlrc/), anything).
+        and_return true
+
+      expect(subject.WriteCurlrc).to be true
+    end
+
+    it "escapes user name" do
+      subject.Import({ "enabled"        => true,
+                       "http_proxy"     => "proxy.example.org:3128",
+                       "proxy_user"     => "User\\Domain",
+                       "proxy_password" => "P" })
+
+      expect(Yast::SCR).to receive(:Write).
+        with(path(".root.curlrc.\"--proxy-user\""), "User\\\\Domain:P").
+        once.and_return true
+
+      allow(Yast::SCR).to receive(:Write).
+        with(path_matching(/^\.root\.curlrc/), anything).
+        and_return true
+
+      expect(subject.WriteCurlrc).to be true
+    end
+  end
+end


Reply via email to