Hello community, here is the log from the commit of package inst-source-utils for openSUSE:Factory checked in at 2014-03-20 06:53:33 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/inst-source-utils (Old) and /work/SRC/openSUSE:Factory/.inst-source-utils.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "inst-source-utils" Changes: -------- --- /work/SRC/openSUSE:Factory/inst-source-utils/inst-source-utils.changes 2014-03-18 16:21:17.000000000 +0100 +++ /work/SRC/openSUSE:Factory/.inst-source-utils.new/inst-source-utils.changes 2014-03-20 06:53:36.000000000 +0100 @@ -1,0 +2,5 @@ +Tue Mar 18 16:40:34 CET 2014 - [email protected] + +- update create_package_descr: fix utf8 handling thanks to mls + +------------------------------------------------------------------- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ inst-source-utils.spec ++++++ --- /var/tmp/diff_new_pack.Z28UAy/_old 2014-03-20 06:53:36.000000000 +0100 +++ /var/tmp/diff_new_pack.Z28UAy/_new 2014-03-20 06:53:36.000000000 +0100 @@ -20,7 +20,7 @@ Summary: Utilities for creating customized installation sources License: GPL-2.0+ Group: System/YaST -Version: 2014.3.14 +Version: 2014.3.18 Release: 0 Url: http://en.opensuse.org/Inst-source-utils BuildArch: noarch ++++++ inst-source-utils.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/inst-source-utils/usr/bin/create_package_descr new/inst-source-utils/usr/bin/create_package_descr --- old/inst-source-utils/usr/bin/create_package_descr 2014-03-14 02:38:18.000000000 +0100 +++ new/inst-source-utils/usr/bin/create_package_descr 2014-03-18 16:40:31.000000000 +0100 @@ -35,6 +35,7 @@ use strict; use RPMQ; use Digest::MD5 (); +use Encode; my (@DATADIRS,@IGNOREDIRS,@LANGUAGES,%SEEN_PACKAGE,%IGNORE_PACKAGE,@SHA_CACHEDIR); my %lang_alias = ( "czech"=>"cs", @@ -494,22 +495,6 @@ close ( $pkg_du ); close ( $pkg_fl ) if $do_file_list; -print "INFO: now recoding to UTF-8: "; -foreach my $file ("packages","packages.DU") { - print "$file "; - system ( "recode", "ISO-8859-1...UTF-8", "$output_dir/$file" ); -} -foreach my $lang (@LANGUAGES) { - my $file = "packages.$lang_alias{$lang}"; - print "$file "; - if ( $lang eq "czech" || $lang eq "hungarian" ) { - system ( "recode", "ISO-8859-2...UTF-8", "$output_dir/$file" ); - } else { - system ( "recode", "ISO-8859-1...UTF-8", "$output_dir/$file" ); - } -} -print "\n"; - ##################################################################### ##################################################################### @@ -567,22 +552,40 @@ print $FH "## ".join(" ",@XX)."\n"; } +sub utf8ify { + my ($value) = @_; + eval { + Encode::_utf8_on($value); + $value = encode('UTF-8', $value, Encode::FB_CROAK); + }; + if ($@) { + Encode::_utf8_off($value); + $value = encode('UTF-8', $value, Encode::FB_DEFAULT); + } + Encode::_utf8_off($value); + return $value; +} + sub WriteAnyEntry { my ($FH,$value) = @_; + $value = utf8ify($value) if $value =~ /[\200-\377]/s; print $FH "$value\n"; } sub WriteSEntry { my ($FH,$tag,$value) = @_; - if ( $value ) { print $FH "=$tag: $value\n"; } + if ( $value ) { + $value = utf8ify($value) if $value =~ /[\200-\377]/s; + print $FH "=$tag: $value\n"; + } } sub WriteMEntry { my ($FH,$tag,@value) = @_; if ( @value && $value[0] ) { - print $FH "+$tag:\n"; - print $FH join("\n", @value)."\n"; - print $FH "-$tag:\n"; + my $value = join("\n", @value); + $value = utf8ify($value) if $value =~ /[\200-\377]/s; + print $FH "+$tag:\n$value\n-$tag:\n"; } } -- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
