Hello community, here is the log from the commit of package yast2 for openSUSE:Factory checked in at 2013-09-27 19:30:41 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/yast2 (Old) and /work/SRC/openSUSE:Factory/.yast2.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2" Changes: -------- --- /work/SRC/openSUSE:Factory/yast2/yast2.changes 2013-08-25 13:35:24.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.yast2.new/yast2.changes 2013-09-27 19:30:42.000000000 +0200 @@ -1,0 +2,13 @@ +Thu Aug 29 05:57:29 UTC 2013 - jreidin...@suse.com + +- use ruby builtin IP regexp and clean a bit code +- 3.0.7 + +------------------------------------------------------------------- +Wed Aug 28 08:13:21 UTC 2013 - jreidin...@suse.com + +- removed output redirection for /sbin/yast2, now it ends up in + ~/.xsession-errors like for every other X program (BNC#766555) +- 3.0.6 + +------------------------------------------------------------------- Old: ---- yast2-3.0.5.tar.bz2 New: ---- yast2-3.0.7.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ yast2.spec ++++++ --- /var/tmp/diff_new_pack.RNk0Ri/_old 2013-09-27 19:30:43.000000000 +0200 +++ /var/tmp/diff_new_pack.RNk0Ri/_new 2013-09-27 19:30:43.000000000 +0200 @@ -1,7 +1,7 @@ # # spec file for package yast2 # -# Copyright (c) 2012 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2013 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,20 +17,26 @@ Name: yast2 -Version: 3.0.5 +Version: 3.0.7 Release: 0 BuildRoot: %{_tmppath}/%{name}-%{version}-build Source0: yast2-%{version}.tar.bz2 - -Group: System/YaST -License: GPL-2.0 Source1: yast2-rpmlintrc -BuildRequires: perl-XML-Writer update-desktop-files yast2-devtools yast2-perl-bindings yast2-testsuite +BuildRequires: perl-XML-Writer +BuildRequires: update-desktop-files +BuildRequires: yast2-devtools +BuildRequires: yast2-perl-bindings +BuildRequires: yast2-testsuite # Needed already in build time -BuildRequires: yast2-core >= 2.18.12 yast2-pkg-bindings >= 2.20.3 yast2-ycp-ui-bindings >= 2.18.4 +BuildRequires: yast2-core >= 2.18.12 +BuildRequires: yast2-pkg-bindings >= 2.20.3 +BuildRequires: yast2-ycp-ui-bindings >= 2.18.4 + +# Needed for tests +BuildRequires: ruby # for symlinking yardoc duplicates BuildRequires: fdupes @@ -52,8 +58,10 @@ Requires: perl-Config-Crontab # for ag_tty (/bin/stty) # for /usr/bin/md5sum -Requires: coreutils sysconfig >= 0.80.0 -Requires: yast2-xml yast2-hardware-detection +Requires: coreutils +Requires: sysconfig >= 0.80.0 +Requires: yast2-hardware-detection +Requires: yast2-xml # for SLPAPI.pm Requires: yast2-perl-bindings # for ag_anyxml @@ -98,24 +106,32 @@ Provides: yast2-lib-sequencer Obsoletes: yast2-lib-sequencer -Provides: yast2-lib-wizard yast2-lib-wizard-devel yast2-trans-wizard -Obsoletes: yast2-lib-wizard yast2-lib-wizard-devel yast2-trans-wizard -Provides: yast2-trans-menu y2t_menu -Obsoletes: yast2-trans-menu y2t_menu +Provides: yast2-lib-wizard +Provides: yast2-lib-wizard-devel +Provides: yast2-trans-wizard +Obsoletes: yast2-lib-wizard +Obsoletes: yast2-lib-wizard-devel +Obsoletes: yast2-trans-wizard +Provides: y2t_menu +Provides: yast2-trans-menu +Obsoletes: y2t_menu +Obsoletes: yast2-trans-menu # moved here from another packages -Provides: yast2-installation:/usr/share/YaST2/modules/Installation.ycp -Provides: yast2-installation:/usr/share/YaST2/modules/Product.ycp +Provides: yast2-dns-server:/usr/share/YaST2/modules/DnsServerAPI.pm Provides: yast2-installation:/usr/share/YaST2/modules/Hotplug.ycp Provides: yast2-installation:/usr/share/YaST2/modules/HwStatus.ycp +Provides: yast2-installation:/usr/share/YaST2/modules/Installation.ycp +Provides: yast2-installation:/usr/share/YaST2/modules/Product.ycp +Provides: yast2-mail-aliases Provides: yast2-network:/usr/share/YaST2/modules/Internet.ycp Provides: yast2-packager:/usr/lib/YaST2/servers_non_y2/ag_anyxml -Provides: yast2-dns-server:/usr/share/YaST2/modules/DnsServerAPI.pm -Provides: yast2-mail-aliases Requires: yast2-ruby-bindings >= 1.0.0 Summary: YaST2 - Main Package +License: GPL-2.0 +Group: System/YaST %description This package contains scripts and data needed for SuSE Linux @@ -123,14 +139,14 @@ %package devel-doc Requires: yast2 = %version -Group: System/YaST Provides: yast2-lib-sequencer-devel -Obsoletes: yast2-lib-sequencer-devel Obsoletes: yast2-devel +Obsoletes: yast2-lib-sequencer-devel Provides: yast2-devel Requires: yast2-core-devel Summary: YaST2 - Development Scripts and Documentation +Group: System/YaST %description devel-doc This package contains scripts and data needed for a SUSE Linux @@ -162,7 +178,6 @@ %suse_update_desktop_file -d ycc_${d%.desktop} ${d%.desktop} done - mkdir -p "$RPM_BUILD_ROOT"/usr/share/YaST2/clients mkdir -p "$RPM_BUILD_ROOT"%{_prefix}/share/applications/YaST2 mkdir -p "$RPM_BUILD_ROOT"/usr/share/YaST2/images ++++++ yast2-3.0.5.tar.bz2 -> yast2-3.0.7.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/Makefile.in new/yast2-3.0.7/Makefile.in --- old/yast2-3.0.5/Makefile.in 2013-08-22 16:25:11.000000000 +0200 +++ new/yast2-3.0.7/Makefile.in 2013-08-30 15:02:04.000000000 +0200 @@ -694,7 +694,7 @@ *.zip*) \ unzip $(distdir).zip ;;\ esac - chmod -R a-w $(distdir); chmod a+w $(distdir) + chmod -R a-w $(distdir); chmod u+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/VERSION new/yast2-3.0.7/VERSION --- old/yast2-3.0.5/VERSION 2013-08-22 12:23:36.000000000 +0200 +++ new/yast2-3.0.7/VERSION 2013-08-30 15:01:51.000000000 +0200 @@ -1 +1 @@ -3.0.5 +3.0.7 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/configure new/yast2-3.0.7/configure --- old/yast2-3.0.5/configure 2013-08-22 16:25:11.000000000 +0200 +++ new/yast2-3.0.7/configure 2013-08-30 15:02:03.000000000 +0200 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for yast2 3.0.5. +# Generated by GNU Autoconf 2.69 for yast2 3.0.7. # # Report bugs to <http://bugs.opensuse.org/>. # @@ -579,8 +579,8 @@ # Identity of this package. PACKAGE_NAME='yast2' PACKAGE_TARNAME='yast2' -PACKAGE_VERSION='3.0.5' -PACKAGE_STRING='yast2 3.0.5' +PACKAGE_VERSION='3.0.7' +PACKAGE_STRING='yast2 3.0.7' PACKAGE_BUGREPORT='http://bugs.opensuse.org/' PACKAGE_URL='' @@ -1252,7 +1252,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures yast2 3.0.5 to adapt to many kinds of systems. +\`configure' configures yast2 3.0.7 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1323,7 +1323,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of yast2 3.0.5:";; + short | recursive ) echo "Configuration of yast2 3.0.7:";; esac cat <<\_ACEOF @@ -1403,7 +1403,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -yast2 configure 3.0.5 +yast2 configure 3.0.7 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1420,7 +1420,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by yast2 $as_me 3.0.5, which was +It was created by yast2 $as_me 3.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2359,7 +2359,7 @@ # Define the identity of the package. PACKAGE='yast2' - VERSION='3.0.5' + VERSION='3.0.7' cat >>confdefs.h <<_ACEOF @@ -2482,7 +2482,7 @@ -VERSION="3.0.5" +VERSION="3.0.7" RPMNAME="yast2" MAINTAINER="YaST2 Maintainers <yast2-maintain...@suse.de>" @@ -2986,7 +2986,7 @@ # also done via makefile ac_config_files="$ac_config_files library/general/src/modules/Version.rb library/network/src/scrconf/network.scr" -ac_config_files="$ac_config_files Makefile data/Makefile doc/autodocs/Makefile doc/examples/Makefile doc/screenshots/Makefile doc/Makefile library/types/src/Makefile library/types/testsuite/Makefile library/types/doc/autodocs/Makefile library/types/doc/Makefile library/types/Makefile library/runlevel/doc/autodocs/Makefile library/runlevel/doc/Makefile library/runlevel/src/Makefile library/runlevel/testsuite/Makefile library/runlevel/Makefile library/sequencer/doc/autodocs/Makefile library/sequencer/doc/images/Makefile library/sequencer/doc/examples/Makefile library/sequencer/doc/Makefile library/sequencer/src/Makefile library/sequencer/testsuite/Makefile library/sequencer/Makefile library/xml/doc/autodocs/Makefile library/xml/doc/Makefile library/xml/src/Makefile library/xml/Makefile library/commandline/doc/autodocs/Makefile library/commandline/doc/Makefile library/commandline/src/Makefile library/commandline/testsuite/Makefile library/commandline/Makefile library/desktop/doc/autodocs/Makefile library/desktop/doc/Makefile library/desktop/groups/Makefile library/desktop/src/Makefile library/desktop/Makefile library/wizard/doc/autodocs/Makefile library/wizard/doc/examples/Makefile library/wizard/doc/screenshots/Makefile library/wizard/doc/Makefile library/wizard/src/Makefile library/wizard/testsuite/Makefile library/wizard/Makefile library/control/doc/autodocs/Makefile library/control/doc/Makefile library/control/src/Makefile library/control/testsuite/Makefile library/control/Makefile library/cwm/doc/autodocs/Makefile library/cwm/doc/Makefile library/cwm/src/Makefile library/cwm/testsuite/Makefile library/cwm/Makefile library/log/doc/autodocs/Makefile library/log/doc/Makefile library/log/src/Makefile library/log/Makefile library/system/doc/autodocs/Makefile library/system/doc/Makefile library/system/src/Makefile library/system/testsuite/Makefile library/system/Makefile library/packages/src/Makefile library/packages/testsuite/Makefile library/packages/doc/autodocs/Makefile library/packages/doc/Makefile library/packages/Makefile library/cron/src/Makefile library/cron/doc/autodocs/Makefile library/cron/doc/Makefile library/cron/Makefile library/network/doc/autodocs/Makefile library/network/doc/Makefile library/network/src/Makefile library/network/testsuite/Makefile library/network/Makefile library/gpg/doc/autodocs/Makefile library/gpg/doc/Makefile library/gpg/src/Makefile library/gpg/testsuite/Makefile library/gpg/Makefile library/general/src/Makefile library/general/testsuite/Makefile library/general/Makefile library/Makefile scripts/Makefile" +ac_config_files="$ac_config_files Makefile data/Makefile doc/autodocs/Makefile doc/examples/Makefile doc/screenshots/Makefile doc/Makefile library/types/src/Makefile library/types/testsuite/Makefile library/types/doc/autodocs/Makefile library/types/doc/Makefile library/types/test/Makefile library/types/Makefile library/runlevel/doc/autodocs/Makefile library/runlevel/doc/Makefile library/runlevel/src/Makefile library/runlevel/testsuite/Makefile library/runlevel/Makefile library/sequencer/doc/autodocs/Makefile library/sequencer/doc/images/Makefile library/sequencer/doc/examples/Makefile library/sequencer/doc/Makefile library/sequencer/src/Makefile library/sequencer/testsuite/Makefile library/sequencer/Makefile library/xml/doc/autodocs/Makefile library/xml/doc/Makefile library/xml/src/Makefile library/xml/Makefile library/commandline/doc/autodocs/Makefile library/commandline/doc/Makefile library/commandline/src/Makefile library/commandline/testsuite/Makefile library/commandline/Makefile library/desktop/doc/autodocs/Makefile library/desktop/doc/Makefile library/desktop/groups/Makefile library/desktop/src/Makefile library/desktop/Makefile library/wizard/doc/autodocs/Makefile library/wizard/doc/examples/Makefile library/wizard/doc/screenshots/Makefile library/wizard/doc/Makefile library/wizard/src/Makefile library/wizard/testsuite/Makefile library/wizard/Makefile library/control/doc/autodocs/Makefile library/control/doc/Makefile library/control/src/Makefile library/control/testsuite/Makefile library/control/Makefile library/cwm/doc/autodocs/Makefile library/cwm/doc/Makefile library/cwm/src/Makefile library/cwm/testsuite/Makefile library/cwm/Makefile library/log/doc/autodocs/Makefile library/log/doc/Makefile library/log/src/Makefile library/log/Makefile library/system/doc/autodocs/Makefile library/system/doc/Makefile library/system/src/Makefile library/system/testsuite/Makefile library/system/Makefile library/packages/src/Makefile library/packages/testsuite/Makefile library/packages/doc/autodocs/Makefile library/packages/doc/Makefile library/packages/Makefile library/cron/src/Makefile library/cron/doc/autodocs/Makefile library/cron/doc/Makefile library/cron/Makefile library/network/doc/autodocs/Makefile library/network/doc/Makefile library/network/src/Makefile library/network/testsuite/Makefile library/network/Makefile library/gpg/doc/autodocs/Makefile library/gpg/doc/Makefile library/gpg/src/Makefile library/gpg/testsuite/Makefile library/gpg/Makefile library/general/src/Makefile library/general/testsuite/Makefile library/general/Makefile library/Makefile scripts/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -3551,7 +3551,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by yast2 $as_me 3.0.5, which was +This file was extended by yast2 $as_me 3.0.7, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -3604,7 +3604,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -yast2 config.status 3.0.5 +yast2 config.status 3.0.7 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" @@ -3729,6 +3729,7 @@ "library/types/testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES library/types/testsuite/Makefile" ;; "library/types/doc/autodocs/Makefile") CONFIG_FILES="$CONFIG_FILES library/types/doc/autodocs/Makefile" ;; "library/types/doc/Makefile") CONFIG_FILES="$CONFIG_FILES library/types/doc/Makefile" ;; + "library/types/test/Makefile") CONFIG_FILES="$CONFIG_FILES library/types/test/Makefile" ;; "library/types/Makefile") CONFIG_FILES="$CONFIG_FILES library/types/Makefile" ;; "library/runlevel/doc/autodocs/Makefile") CONFIG_FILES="$CONFIG_FILES library/runlevel/doc/autodocs/Makefile" ;; "library/runlevel/doc/Makefile") CONFIG_FILES="$CONFIG_FILES library/runlevel/doc/Makefile" ;; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/configure.ac new/yast2-3.0.7/configure.ac --- old/yast2-3.0.5/configure.ac 2013-08-22 16:25:09.000000000 +0200 +++ new/yast2-3.0.7/configure.ac 2013-08-30 15:01:59.000000000 +0200 @@ -3,7 +3,7 @@ dnl -- This file is generated by y2autoconf 3.0.4 - DO NOT EDIT! -- dnl (edit configure.ac.in or configure.in.in instead) -AC_INIT(yast2, 3.0.5, http://bugs.opensuse.org/, yast2) +AC_INIT(yast2, 3.0.7, http://bugs.opensuse.org/, yast2) dnl Check for presence of file 'RPMNAME' AC_CONFIG_SRCDIR([RPMNAME]) @@ -18,7 +18,7 @@ AM_INIT_AUTOMAKE(tar-ustar -Wno-portability) dnl Important YaST2 variables -VERSION="3.0.5" +VERSION="3.0.7" RPMNAME="yast2" MAINTAINER="YaST2 Maintainers <yast2-maintain...@suse.de>" @@ -207,6 +207,7 @@ library/types/testsuite/Makefile library/types/doc/autodocs/Makefile library/types/doc/Makefile +library/types/test/Makefile library/types/Makefile library/runlevel/doc/autodocs/Makefile library/runlevel/doc/Makefile diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/library/types/Makefile.am new/yast2-3.0.7/library/types/Makefile.am --- old/yast2-3.0.5/library/types/Makefile.am 2013-08-22 10:17:53.000000000 +0200 +++ new/yast2-3.0.7/library/types/Makefile.am 2013-08-22 12:53:32.000000000 +0200 @@ -2,4 +2,4 @@ # Makefile.am for yast2/library/types # -SUBDIRS = src testsuite doc +SUBDIRS = src testsuite doc test diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/library/types/Makefile.in new/yast2-3.0.7/library/types/Makefile.in --- old/yast2-3.0.5/library/types/Makefile.in 2013-08-22 16:25:13.000000000 +0200 +++ new/yast2-3.0.7/library/types/Makefile.in 2013-08-30 15:02:07.000000000 +0200 @@ -231,7 +231,7 @@ ydatadir = @ydatadir@ yncludedir = @yncludedir@ ystartupdir = @ystartupdir@ -SUBDIRS = src testsuite doc +SUBDIRS = src testsuite doc test all: all-recursive .SUFFIXES: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/library/types/src/modules/IP.rb new/yast2-3.0.7/library/types/src/modules/IP.rb --- old/yast2-3.0.5/library/types/src/modules/IP.rb 2013-08-22 10:17:53.000000000 +0200 +++ new/yast2-3.0.7/library/types/src/modules/IP.rb 2013-08-30 15:01:51.000000000 +0200 @@ -29,6 +29,7 @@ # # $Id$ require "yast" +require "resolv" module Yast class IPClass < Module @@ -58,22 +59,10 @@ # @param [String] ip IPv4 address # @return true if correct def Check4(ip) - return false if ip == nil || ip == "" - num = "(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])" - ipv4 = Ops.add(Ops.add(Ops.add(Ops.add("^", num), "(\\."), num), "){3}$") - Builtins.regexpmatch(ip, ipv4) - end + return false if ip == nil - # Check syntax of IPv4 address (maybe better) - # @param ip IPv4 address - # @return true if correct - # global defin boolean Check4_new(string ip) ``{ - # if(ip == nil || ip == "") return false; - # string num0 = "(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])"; - # string num1 = "(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])"; - # string ipv4 = "^" + num0 + "(\\." + num1 + "){3}$"; - # return regexpmatch(ip, ipv4); - # } + !Resolv::IPv4::Regex.match(ip).nil? + end # Describe a valid IPv6 address # @return [String] describtion a valid IPv4 address @@ -90,43 +79,26 @@ # @param [String] ip IPv6 address # @return true if correct def Check6(ip) - return false if ip == nil || ip == "" - - #string num = "([1-9a-fA-F][0-9a-fA-F]*|0)"; - num = "([0-9a-fA-F]{1,4})" + return false if ip == nil - # 1:2:3:4:5:6:7:8 - if Builtins.regexpmatch( - ip, - Ops.add(Ops.add(Ops.add(Ops.add("^", num), "(:"), num), "){7}$") - ) - return true - end - # ::3:4:5:6:7:8 - if Builtins.regexpmatch(ip, Ops.add(Ops.add("^:(:", num), "){1,6}$")) - return true - end - # 1:2:3:4:5:6:: - if Builtins.regexpmatch(ip, Ops.add(Ops.add("^(", num), ":){1,6}:$")) - return true - end - # :: only once - return false if Builtins.regexpmatch(ip, "::.*::") - # : max 7x - return false if Builtins.regexpmatch(ip, "^([^:]*:){8,}") - # 1:2:3::5:6:7:8 - # 1:2:3:4:5:6::8 - if Builtins.regexpmatch( - ip, - Ops.add( - Ops.add(Ops.add(Ops.add("^(", num), ":){1,6}(:"), num), - "){1,6}$" - ) - ) - return true + # we need special regex because Resolv::IPv6::Regex support also directly + # mapped ipv4 to ipv6 which yast doesn't support + regexp = / + (?:#{Resolv::IPv6::Regex_8Hex}) | + (?:#{Resolv::IPv6::Regex_CompressedHex}) + /xo + res = !regexp.match(ip).nil? + + # workaround for compressed address as it is hard to check correct number + # in compressed ip using regexp only + if res && ip.include?("::") + prefix, suffix = ip.split("::") + elements = prefix.split(":") + elements += suffix.split(":") if suffix + return elements.size < 8 end - false + return res end # If param contains IPv6 in one of its various forms, extracts it. @@ -182,36 +154,21 @@ # @param [String] ip IPv4 address # @return ip address as integer def ToInteger(ip) - # FIXME: Check4, also to Compute* - l = Builtins.maplist(Builtins.splitstring(ip, ".")) do |e| - Builtins.tointeger(e) - end - Ops.add( - Ops.add( - Ops.add( - Ops.get_integer(l, 3, 0), - Ops.shift_left(Ops.get_integer(l, 2, 0), 8) - ), - Ops.shift_left(Ops.get_integer(l, 1, 0), 16) - ), - Ops.shift_left(Ops.get_integer(l, 0, 0), 24) - ) + return nil unless Check4(ip) + + parts = ip.split(".") + parts.reduce(0) {|r, p| (r << 8) + p.to_i } end # Convert IPv4 address from integer to string # @param [Fixnum] ip IPv4 address # @return ip address as string def ToString(ip) - l = Builtins.maplist([16777216, 65536, 256, 1]) do |b| - Ops.bitwise_and(Ops.divide(ip, b), 255) + parts = [16777216, 65536, 256, 1].map do |b| + (ip / b) & 255 end - Builtins.sformat( - "%1.%2.%3.%4", - Ops.get_integer(l, 0, 0), - Ops.get_integer(l, 1, 0), - Ops.get_integer(l, 2, 0), - Ops.get_integer(l, 3, 0) - ) + + parts.join(".") end # Converts IPv4 address from string to hex format @@ -220,14 +177,12 @@ # @example IP::ToHex("192.168.1.1") -> "0xC0A80101" # @example IP::ToHex("10.10.0.1") -> "0x0A0A0001" def ToHex(ip) - tmp = Ops.add( - "00000000", - Builtins.substring( - Builtins.toupper(Builtins.tohexstring(ToInteger(ip))), - 2 - ) - ) - Builtins.substring(tmp, Ops.subtract(Builtins.size(tmp), 8)) + int = ToInteger(ip) + return nil unless int + + hex = int.to_s(16) + + ("0" * (8 - hex.size)) + hex.upcase end # Compute IPv4 network address from ip4 address and network mask. @@ -265,25 +220,13 @@ # IPv4ToBits("80.25.135.2") -> "01010000000110011000011100000010" # IPv4ToBits("172.24.233.211") -> "10101100000110001110100111010011" def IPv4ToBits(ipv4) - if !Check4(ipv4) + unless Check4(ipv4) Builtins.y2error("Not a valid IPv4: %1", ipv4) return nil end - ret = "" - Builtins.foreach(Builtins.splitstring(ipv4, ".")) do |ipv4_part| - ipv4_part_i = Builtins.tointeger(ipv4_part) - Builtins.foreach(@bit_weight_row) do |try_i| - if Ops.greater_than(Ops.divide(ipv4_part_i, try_i), 0) - ipv4_part_i = Ops.modulo(ipv4_part_i, try_i) - ret = Ops.add(ret, "1") - else - ret = Ops.add(ret, "0") - end - end - end - - ret + bits = ToInteger(ipv4).to_s(2) + "0" * (32 - bits.size) + bits end # Converts 32 bit binary number to its IPv4 repserentation. @@ -306,30 +249,7 @@ return nil end - ipv4 = "" - position = 0 - while Ops.less_than(position, 32) - ip_part = 0 - eight_bits = Builtins.substring(bits, position, 8) - - counter = -1 - while Ops.less_than(counter, 8) - counter = Ops.add(counter, 1) - one_bit = Builtins.substring(eight_bits, counter, 1) - - if one_bit == "1" - ip_part = Ops.add(ip_part, Ops.get(@bit_weight_row, counter, 0)) - end - end - - ipv4 = Ops.add( - Ops.add(ipv4, ipv4 != "" ? "." : ""), - Builtins.tostring(ip_part) - ) - position = Ops.add(position, 8) - end - - ipv4 + ToString(bits.to_i(2)) end def CheckNetworkShared(network) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/library/types/test/Makefile.am new/yast2-3.0.7/library/types/test/Makefile.am --- old/yast2-3.0.5/library/types/test/Makefile.am 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.0.7/library/types/test/Makefile.am 2013-08-30 15:01:51.000000000 +0200 @@ -0,0 +1,5 @@ +TESTS = ip_test.rb +TEST_EXTENSIONS = .rb +RB_LOG_COMPILER = ruby +VERBOSE = 1 +EXTRA_DIST = $(TESTS) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/library/types/test/Makefile.in new/yast2-3.0.7/library/types/test/Makefile.in --- old/yast2-3.0.5/library/types/test/Makefile.in 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.0.7/library/types/test/Makefile.in 2013-08-30 15:02:07.000000000 +0200 @@ -0,0 +1,481 @@ +# Makefile.in generated by automake 1.12.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = library/types/test +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +am__tty_colors_dummy = \ + mgn= red= grn= lgn= blu= brg= std=; \ + am__color_tests=no +am__tty_colors = $(am__tty_colors_dummy) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +IFCFG_DIR = @IFCFG_DIR@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINTAINER = @MAINTAINER@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +MYEXPECT = @MYEXPECT@ +MYRUNTEST = @MYRUNTEST@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +RPMNAME = @RPMNAME@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +STYLESHEET_CSS = @STYLESHEET_CSS@ +STYLESHEET_HTML = @STYLESHEET_HTML@ +STYLESHEET_PDF = @STYLESHEET_PDF@ +STYLESHEET_YCPDOC = @STYLESHEET_YCPDOC@ +STYLESHEET_YDOC = @STYLESHEET_YDOC@ +VERSION = @VERSION@ +XGETTEXT = @XGETTEXT@ +Y2DEVTOOLS_PREFIX = @Y2DEVTOOLS_PREFIX@ +YCPC = @YCPC@ +YCPDOC = @YCPDOC@ +YCPMAKEDEP = @YCPMAKEDEP@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +agentdir = @agentdir@ +am__leading_dot = @am__leading_dot@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +clientdir = @clientdir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +desktopdir = @desktopdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +execcompdir = @execcompdir@ +fillupdir = @fillupdir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +imagedir = @imagedir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +pkgconfigdatadir = @pkgconfigdatadir@ +pkgconfigdir = @pkgconfigdir@ +plugindir = @plugindir@ +potdir = @potdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +schemadir = @schemadir@ +scrconfdir = @scrconfdir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +themedir = @themedir@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +yast2dir = @yast2dir@ +ybindir = @ybindir@ +ydatadir = @ydatadir@ +yncludedir = @yncludedir@ +ystartupdir = @ystartupdir@ +TESTS = ip_test.rb +TEST_EXTENSIONS = .rb +RB_LOG_COMPILER = ruby +VERBOSE = 1 +EXTRA_DIST = $(TESTS) +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu library/types/test/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu library/types/test/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + +cscope cscopelist: + + +check-TESTS: $(TESTS) + @failed=0; all=0; xfail=0; xpass=0; skip=0; \ + srcdir=$(srcdir); export srcdir; \ + list=' $(TESTS) '; \ + $(am__tty_colors); \ + if test -n "$$list"; then \ + for tst in $$list; do \ + if test -f ./$$tst; then dir=./; \ + elif test -f $$tst; then dir=; \ + else dir="$(srcdir)/"; fi; \ + if $(TESTS_ENVIRONMENT) $${dir}$$tst $(AM_TESTS_FD_REDIRECT); then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xpass=`expr $$xpass + 1`; \ + failed=`expr $$failed + 1`; \ + col=$$red; res=XPASS; \ + ;; \ + *) \ + col=$$grn; res=PASS; \ + ;; \ + esac; \ + elif test $$? -ne 77; then \ + all=`expr $$all + 1`; \ + case " $(XFAIL_TESTS) " in \ + *[\ \ ]$$tst[\ \ ]*) \ + xfail=`expr $$xfail + 1`; \ + col=$$lgn; res=XFAIL; \ + ;; \ + *) \ + failed=`expr $$failed + 1`; \ + col=$$red; res=FAIL; \ + ;; \ + esac; \ + else \ + skip=`expr $$skip + 1`; \ + col=$$blu; res=SKIP; \ + fi; \ + echo "$${col}$$res$${std}: $$tst"; \ + done; \ + if test "$$all" -eq 1; then \ + tests="test"; \ + All=""; \ + else \ + tests="tests"; \ + All="All "; \ + fi; \ + if test "$$failed" -eq 0; then \ + if test "$$xfail" -eq 0; then \ + banner="$$All$$all $$tests passed"; \ + else \ + if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \ + banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \ + fi; \ + else \ + if test "$$xpass" -eq 0; then \ + banner="$$failed of $$all $$tests failed"; \ + else \ + if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \ + banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \ + fi; \ + fi; \ + dashes="$$banner"; \ + skipped=""; \ + if test "$$skip" -ne 0; then \ + if test "$$skip" -eq 1; then \ + skipped="($$skip test was not run)"; \ + else \ + skipped="($$skip tests were not run)"; \ + fi; \ + test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$skipped"; \ + fi; \ + report=""; \ + if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \ + report="Please report to $(PACKAGE_BUGREPORT)"; \ + test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \ + dashes="$$report"; \ + fi; \ + dashes=`echo "$$dashes" | sed s/./=/g`; \ + if test "$$failed" -eq 0; then \ + col="$$grn"; \ + else \ + col="$$red"; \ + fi; \ + echo "$${col}$$dashes$${std}"; \ + echo "$${col}$$banner$${std}"; \ + test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \ + test -z "$$report" || echo "$${col}$$report$${std}"; \ + echo "$${col}$$dashes$${std}"; \ + test "$$failed" -eq 0; \ + else :; fi + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-TESTS +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am check check-TESTS check-am clean clean-generic \ + distclean distclean-generic distdir dvi dvi-am html html-am \ + info info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \ + uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/library/types/test/ip_test.rb new/yast2-3.0.7/library/types/test/ip_test.rb --- old/yast2-3.0.5/library/types/test/ip_test.rb 1970-01-01 01:00:00.000000000 +0100 +++ new/yast2-3.0.7/library/types/test/ip_test.rb 2013-08-30 15:01:51.000000000 +0200 @@ -0,0 +1,188 @@ +#! /usr/bin/env ruby +ENV["Y2DIR"] = File.expand_path("../../src", __FILE__) + +require "minitest/autorun" +require "yast" + +Yast.import "IP" + +describe Yast::IP do + before do + @object = Yast::IPClass.new + @object.main + end + + describe "when asked for validation string for IPv4" do + it "must return translated text" do + @object.Valid4.must_match /^A valid/ + end + end + + describe "when told to check IPv4" do + valid_ip4s = [ + "0.0.0.0", + "127.0.0.1", + "255.255.255.255", + "10.11.12.13", + ] + valid_ip4s.each do |valid_ip4| + it "return true for valid IPv4 '#{valid_ip4}'" do + @object.Check4(valid_ip4).must_equal true + end + end + + invalid_ip4s = [ + "0.0.0", + "127.0.0.1.1", + "256.255.255.255", + "01.01.012.013", + "10,11.12.13", + ] + invalid_ip4s.each do |invalid_ip4| + it "return false for invalid IPv4 '#{invalid_ip4}'" do + @object.Check4(invalid_ip4).must_equal false + end + end + + it "return false for empty argument" do + @object.Check4("").must_equal false + end + + it "return false for nil argument" do + @object.Check4(nil).must_equal false + end + end + + describe "when told to check IPv6" do + + valid_ip6s = [ + "1:2:3:4:5:6:7:8", + "::3:4:5:6:7:8", + "1:2:3:4:5:6::", + "1:2:3::5:6:7:8", + "1:2:3:4:5:6::8", + "a:FF:b:c:d:d:e:e", + "fe80::200:1cff:feb5:5433", + "0::", + "0000::", + "0:1::", + "1:0::", + "1:0::0" + ] + valid_ip6s.each do |valid_ip6| + it "return true for valid IPv6 '#{valid_ip6}'" do + @object.Check6(valid_ip6).must_equal true + end + end + + invalid_ip6s = [ + "1::3:4:5:6::8", + "1:2:3:4:5:6:7:8:9", + "1:2:3:4::5:6:7:8:9", + ":2:3:4:5:6:7:8", + "1:2:3:4:5:6:7:", + "g:FF:b:c:d:d:e:e", + "127.0.0.1", + "1:2:3:4:5:6:127.0.0.1", # FIXME old yast doesn't support direct mapping IPv4 to IPv6 + ] + invalid_ip6s.each do |invalid_ip6| + it "return false for invalid IPv6 '#{invalid_ip6}" do + @object.Check6(invalid_ip6).must_equal false + end + end + + it "return false for empty argument" do + @object.Check6("").must_equal false + end + + it "return false for nil argument" do + @object.Check6(nil).must_equal false + end + end + + describe "when told to compute integer value" do + it "return value for valid ipv4" do + result_map = { + "0.0.0.0" => 0, + "127.0.0.1" => 2130706433, + "192.168.110.23" => 3232263703, + "10.20.1.29" => 169083165 + } + result_map.each_pair do |k,v| + @object.ToInteger(k).must_equal v + end + end + + it "return nil if value is not valid ipv4" do + @object.ToInteger("blabla").must_equal nil + end + end + + describe "when told to create ipv4 string from integer" do + it "it return ipv4" do + result_map = { + "0.0.0.0" => 0, + "127.0.0.1" => 2130706433, + "192.168.110.23" => 3232263703, + "10.20.1.29" => 169083165 + } + result_map.each_pair do |k,v| + @object.ToString(v).must_equal k + end + end + end + + describe "when told to create string with hex value of ipv4 string" do + it "return value for valid ipv4" do + result_map = { + "0.0.0.0" => "00000000", + "10.10.0.1" => "0A0A0001", + "192.168.1.1" => "C0A80101", + "255.255.255.255" => "FFFFFFFF" + } + result_map.each_pair do |k,v| + @object.ToHex(k).must_equal v + end + end + + it "return nil if value is not valid ipv4" do + @object.ToHex("blabla").must_equal nil + end + end + + describe "when told to convert IPv4 address into bits" do + it "return value for proper ipv4" do + result_map = { + "80.25.135.2" => "01010000000110011000011100000010", + "172.24.233.211" => "10101100000110001110100111010011" + } + result_map.each_pair do |k,v| + @object.IPv4ToBits(k).must_equal v + end + end + + it "return nil if value is not valid ipv4" do + @object.IPv4ToBits("blabla").must_equal nil + end + end + + describe "when told to convert bits to IPv4 address" do + it "return value for string" do + result_map = { + "80.25.135.2" => "01010000000110011000011100000010", + "172.24.233.211" => "10101100000110001110100111010011" + } + result_map.each_pair do |k,v| + @object.BitsToIPv4(v).must_equal k + end + end + + it "return nil if size of string is not 32" do + @object.BitsToIPv4("101").must_equal nil + end + + it "return nil if value is not valid string with 0 or 1" do + @object.BitsToIPv4("blabla").must_equal nil + end + end +end diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/library/types/testsuite/tests/IP.out new/yast2-3.0.7/library/types/testsuite/tests/IP.out --- old/yast2-3.0.5/library/types/testsuite/tests/IP.out 2013-08-22 10:17:53.000000000 +0200 +++ new/yast2-3.0.7/library/types/testsuite/tests/IP.out 2013-08-30 15:01:51.000000000 +0200 @@ -1,72 +1,8 @@ -Dump IP::Check4 -Return false -Return false -Return false -Return false -Return false -Return false -Return false -Return false -Return false -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Dump IP::Check6 -Return false -Return false -Return false -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return true -Return false -Return false -Return false -Return false -Return false Dump IP::UndecorateIPv6 Return fe80::219:d1ff:feac:fd10 Return ::1 Return fe80::3 Return fe80::3 -Dump IP::ToInteger -Return 0 -Return 2130706433 -Return 3232263703 -Return 169083165 -Dump IP::ToString -Return 0.0.0.0 -Return 127.0.0.1 -Return 192.168.110.23 -Return 10.20.1.29 -Dump IP::ToHex -Return 00000000 -Return 0A0A0001 -Return C0A80101 -Return FFFFFFFF Dump IP::ComputeNetwork Return 127.0.0.0 Return 192.168.110.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/library/types/testsuite/tests/IP.rb new/yast2-3.0.7/library/types/testsuite/tests/IP.rb --- old/yast2-3.0.5/library/types/testsuite/tests/IP.rb 2013-08-22 10:17:53.000000000 +0200 +++ new/yast2-3.0.7/library/types/testsuite/tests/IP.rb 2013-08-30 15:01:51.000000000 +0200 @@ -27,86 +27,12 @@ Yast.include self, "testsuite.rb" Yast.import "IP" - DUMP("IP::Check4") - TEST(lambda { IP.Check4(nil) }, [], nil) - TEST(lambda { IP.Check4("") }, [], nil) - TEST(lambda { IP.Check4("A.1.2.3") }, [], nil) - TEST(lambda { IP.Check4("1.2.3") }, [], nil) - TEST(lambda { IP.Check4("1..2.34") }, [], nil) - TEST(lambda { IP.Check4("1. .2.34") }, [], nil) - TEST(lambda { IP.Check4("255.255.256.255") }, [], nil) - TEST(lambda { IP.Check4("127") }, [], nil) - TEST(lambda { IP.Check4("----------") }, [], nil) - TEST(lambda { IP.Check4("127.0.0.1") }, [], nil) - TEST(lambda { IP.Check4("255.255.255.0") }, [], nil) - TEST(lambda { IP.Check4("255.255.255.255") }, [], nil) - TEST(lambda { IP.Check4("192.168.0.1") }, [], nil) - TEST(lambda { IP.Check4("195.113.31.123") }, [], nil) - TEST(lambda { IP.Check4("255.0.0.1") }, [], nil) - TEST(lambda { IP.Check4("10.20.1.29") }, [], nil) - TEST(lambda { IP.Check4("1.2.3.4") }, [], nil) - TEST(lambda { IP.Check4("0.0.0.0") }, [], nil) - - DUMP("IP::Check6") - TEST(lambda { IP.Check6(nil) }, [], nil) - TEST(lambda { IP.Check6("") }, [], nil) - TEST(lambda { IP.Check6("----------") }, [], nil) - TEST(lambda { IP.Check6("1:1:1:01:1:1:1:1") }, [], nil) - TEST(lambda { IP.Check6("fec0:1:2:0:200:1cff:feb5:a7ea") }, [], nil) - TEST(lambda { IP.Check6("fe80::200:1cff:feb5:a7ea") }, [], nil) - TEST(lambda { IP.Check6("fe80::1cb5:a7ea") }, [], nil) - - TEST(lambda { IP.Check6("1:2:3:4:5:6:7:8") }, [], nil) - TEST(lambda { IP.Check6("::3:4:5:6:7:8") }, [], nil) - TEST(lambda { IP.Check6("1:2:3:4:5:6::") }, [], nil) - TEST(lambda { IP.Check6("1:2::4:5:6:7:8") }, [], nil) - TEST(lambda { IP.Check6("1::3:4:5:6:7:8") }, [], nil) - TEST(lambda { IP.Check6("1:2:3:4:5:6::8") }, [], nil) - TEST(lambda { IP.Check6("1:2:3::8") }, [], nil) - TEST(lambda { IP.Check6("::1") }, [], nil) - TEST(lambda { IP.Check6("::1:2") }, [], nil) - TEST(lambda { IP.Check6("1:2::") }, [], nil) - TEST(lambda { IP.Check6("1::") }, [], nil) - - TEST(lambda { IP.Check6("0::") }, [], nil) - TEST(lambda { IP.Check6("0000::") }, [], nil) - TEST(lambda { IP.Check6("0:1::") }, [], nil) - TEST(lambda { IP.Check6("1:0::") }, [], nil) - TEST(lambda { IP.Check6("1:0::0") }, [], nil) - - TEST(lambda { IP.Check6("fe80::200:1cff:feb5:5433") }, [], nil) - - TEST(lambda { IP.Check6(":2:3:4:5:6:7:8") }, [], nil) - TEST(lambda { IP.Check6("1:2:3:4:5:6:7:") }, [], nil) - TEST(lambda { IP.Check6("1::3:4::6:7:8") }, [], nil) - TEST(lambda { IP.Check6("1:2:3:4:5:6:7:8:9") }, [], nil) - TEST(lambda { IP.Check6("1:2:3:4::5:6:7:8:9") }, [], nil) - DUMP("IP::UndecorateIPv6") TEST(IP.UndecorateIPv6("fe80::219:d1ff:feac:fd10"), [], nil) TEST(IP.UndecorateIPv6("[::1]"), [], nil) TEST(IP.UndecorateIPv6("fe80::3%eth0"), [], nil) TEST(IP.UndecorateIPv6("[fe80::3%eth0]"), [], nil) - - DUMP("IP::ToInteger") - TEST(lambda { IP.ToInteger("0.0.0.0") }, [], nil) - TEST(lambda { IP.ToInteger("127.0.0.1") }, [], nil) - TEST(lambda { IP.ToInteger("192.168.110.23") }, [], nil) - TEST(lambda { IP.ToInteger("10.20.1.29") }, [], nil) - - DUMP("IP::ToString") - TEST(lambda { IP.ToString(0) }, [], nil) - TEST(lambda { IP.ToString(2130706433) }, [], nil) - TEST(lambda { IP.ToString(3232263703) }, [], nil) - TEST(lambda { IP.ToString(169083165) }, [], nil) - - DUMP("IP::ToHex") - TEST(lambda { IP.ToHex("0.0.0.0") }, [], nil) - TEST(lambda { IP.ToHex("10.10.0.1") }, [], nil) - TEST(lambda { IP.ToHex("192.168.1.1") }, [], nil) - TEST(lambda { IP.ToHex("255.255.255.255") }, [], nil) - DUMP("IP::ComputeNetwork") TEST(lambda { IP.ComputeNetwork("127.0.0.1", "255.0.0.0") }, [], nil) TEST(lambda { IP.ComputeNetwork("192.168.110.23", "255.255.255.0") }, [], nil) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/yast2-3.0.5/scripts/yast2 new/yast2-3.0.7/scripts/yast2 --- old/yast2-3.0.5/scripts/yast2 2013-08-22 10:17:53.000000000 +0200 +++ new/yast2-3.0.7/scripts/yast2 2013-08-28 10:21:52.000000000 +0200 @@ -44,45 +44,8 @@ exit 1; fi -# #211392, #265263 -# if we are in X and do not have _input_ from terminal, -# save the output and display it via xmessage in case of error. -# TODO: also use bug-buddy or the kde thing... (#265263#c48) -redirect() -{ - if [ -n "$DISPLAY" -a ! -t 0 ]; then - ERRLOG=`mktemp -t yast2-err-XXXXXX` - trap exit_trap EXIT - exec &> $ERRLOG - fi -} - -# $1: file with error message -display_error_file() -{ - if [ -x /usr/bin/zenity ]; then - /usr/bin/zenity --title="Error" --text-info --filename="$1" - elif [ -x /usr/bin/kdialog ]; then - /usr/bin/kdialog --title "Error" --textbox "$1" - else - xmessage -buttons OK:0 -default OK -center -file "$1" - fi -} - exit_code=0 -exit_trap() -{ - # handily, exit_code is set to $? of y2base. - # If there was an error and there is anything to display, pop up. - if [ $exit_code != 0 -a $exit_code != 16 -a -s $ERRLOG ]; then - display_error_file $ERRLOG - fi - rm -f $ERRLOG -} -# redirect the output if necessary -redirect - # Accumulated arguments for both the Qt UI and y2cc; currently supported: # --fullscreen # --noborder @@ -105,19 +68,6 @@ echo " --noborder no window manager border for main window" echo " --fullscreen use full screen" echo - echo "exceptional case for installing packages:" - echo "$0 OPTION <package> [<package> [...]]" - echo - echo "OPTION:" - echo " -i, --install install rpm package" - echo " --update update rpm package" - echo " --remove remove rpm package" - echo - echo "<package> can be a single short package name (e.g. gvim)" - echo "which will be installed with dependency checking, or the full" - echo "path to an rpm package (e.g /tmp/gvim.rpm) which will be" - echo "installed without dependency checking" - echo } listmodules() @@ -139,9 +89,10 @@ probe_desktop_gui() { if [ "$DESKTOP_SESSION" = "gnome" -o \ + "$DESKTOP_SESSION" = "LXDE" -o \ "$DESKTOP_SESSION" = "xfce" ]; then DESKTOP_GUI="gtk" - elif echo $WINDOWMANAGER | grep -qi "\(gnome\|xfce\)"; then + elif echo $WINDOWMANAGER | grep -qi "\(gnome\|xfce|lxde\)"; then DESKTOP_GUI="gtk" else DESKTOP_GUI="qt" @@ -302,7 +253,6 @@ echo $$ > /var/run/yast.pid fi -# set lang from sysconfig set_lang_from_sysconfig # default defaults @@ -319,7 +269,7 @@ source "$HOME/.yast2/yast2" fi -if [ ! -z "$CMDLINE_UI" ]; then +if [ -n "$CMDLINE_UI" ]; then WANTED_GUI="$CMDLINE_UI" WANTED_SHELL="$CMDLINE_UI" fi @@ -363,13 +313,8 @@ esac fi - # this fixes launching of interactive subprocesses, #150799 - #Y2UI_ARGS="$Y2UI_ARGS --nothreads" - #uncomment the above line if anything in TUI breaks ;-) - #threads are welcomed back in ncurses frontend (F#301899) - # set color theme, if defined - if [ ! -z "$Y2NCURSES_COLOR_THEME" ]; then + if [ -n "$Y2NCURSES_COLOR_THEME" ]; then export Y2NCURSES_COLOR_THEME="$Y2NCURSES_COLOR_THEME" fi @@ -383,7 +328,6 @@ echo "Something is wrong with the YaST user interface, NCurses selected but no terminal available." >&2 exit_code=1 # also skips y2base later fi -# quick hack: treat gtk like qt elif [ "$SELECTED_GUI" = "qt" -o "$SELECTED_GUI" = "gtk" ]; then if [ "$SELECTED_GUI" = "qt" ]; then @@ -404,7 +348,7 @@ # do it! # $@ are args for ycp -if [ $module == "menu" -a -f "$y2ccbin" ] ; then +if [ $module == "menu" -a -x "$y2ccbin" ] ; then $y2ccbin $Y2UI_ARGS "$@" exit_code=$? else -- To unsubscribe, e-mail: opensuse-commit+unsubscr...@opensuse.org For additional commands, e-mail: opensuse-commit+h...@opensuse.org