From 6a44a4c53347efa90b490baa6c26e45d2980beee Mon Sep 17 00:00:00 2001 From: Mamoru Tasaka Date: Feb 27 2009 11:21:33 +0000 Subject: Apply library UTF-8 patch on F-10/9 --- diff --git a/alexandria-0.6.3-library-utf8-string.patch b/alexandria-0.6.3-library-utf8-string.patch new file mode 100644 index 0000000..5fc92a9 --- /dev/null +++ b/alexandria-0.6.3-library-utf8-string.patch @@ -0,0 +1,54 @@ +Index: lib/alexandria/ui/sidepane.rb +=================================================================== +--- lib/alexandria/ui/sidepane.rb (revision 1012) ++++ lib/alexandria/ui/sidepane.rb (revision 1021) +@@ -19,18 +19,42 @@ + x and x.name != @parent.selected_library.name + end + +- def contains_illegal_character new_text +- /([^\w\s'"()&?!:;.\-])/.match(new_text) ++ # if new_text is invalid utf-8, returns true ++ # if new_text contains disallowed char (/ or initial .), returns a MatchData object ++ # otherwise returns nil ++ def contains_illegal_character(new_text) ++ begin ++ new_text.unpack("U*") # attempt to unpack as UTF-8 characters ++ match = /(^\.|\/)/.match(new_text) ++ # forbid / character (since Library names become dir names) ++ # also no initial . since that hides the Library (hidden file) ++ # forbidding an initial dot also disallows "." and ".." ++ # which are of course pre-existing directories. ++ return match ++ rescue Exception => ex ++ log.warn { "New library name not valid UTF-8: #{ex.message}" } ++ return true ++ end ++ # /([^\w\s'"()&?!:;.\-])/.match(new_text) # anglocentric! + end + + def on_edited_library cell, path_string, new_text +- log.debug { "edited" } ++ log.debug { "edited library name #{new_text}" } ++ ## new_text = new_text.reverse # for testing; ++ # a great way to generate broken UTF-8 + if cell.text != new_text + if match = contains_illegal_character(new_text) +- log.debug { "Illegal character" } +- ErrorDialog.new(@main_app, _("Invalid library name '%s'") % new_text, +- _("The name provided contains the " + "illegal character '%s'.") % +- match[1].gsub(/&/, "&")) ++ if match.instance_of? MatchData ++ chars = match[1].gsub(/&/, "&") ++ ErrorDialog.new(@main_app, _("Invalid library name '%s'") % new_text, ++ _("The name provided contains the " + ++ "disallowed character %s ") % chars) ++ else ++ ErrorDialog.new(@main_app, _("Invalid library name"), ++ _("The name provided contains " + ++ "invalid characters.")) ++ end ++ + elsif new_text.strip.empty? + log.debug { "Empty text" } + ErrorDialog.new(@main_app, _("The library name " + diff --git a/alexandria.spec b/alexandria.spec index 179234d..315ea4f 100644 --- a/alexandria.spec +++ b/alexandria.spec @@ -1,11 +1,11 @@ -%{!?ruby_sitelib: %define ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")} +%{!?ruby_sitelib: %global ruby_sitelib %(ruby -rrbconfig -e "puts Config::CONFIG['sitelibdir']")} %define rubyabi 1.8 %define repoid 32739 %define majorver 0.6.3 %undefine minorver -%define fedorarel 7 +%define fedorarel 11 %define rel %{?minorver:0.}%{fedorarel}%{?minorver:.%minorver} @@ -19,7 +19,12 @@ Group: Applications/Productivity License: GPLv2+ URL: http://alexandria.rubyforge.org/ Source0: http://rubyforge.org/frs/download.php/%{repoid}/%{name}-%{version}%{?minorver}.tar.gz +# http://rubyforge.org/tracker/?func=detail&atid=863&aid=19042&group_id=205 +# Turned out this was actually bug in ruby-gnome2, fixed in 0.17.0 rc1 #Patch0: alexandria-0.6.3-crash_tooltips.patch +# http://rubyforge.org/tracker/?func=detail&atid=863&aid=20168&group_id=205 +# Patch is already in upstream svn repo +Patch1: alexandria-0.6.3-library-utf8-string.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch @@ -68,6 +73,7 @@ Alexandria is a GNOME application to help you manage your book collection. %prep %setup -q -n %{name}-%{majorver}%{?minorver} #%%patch0 -p1 -b .tooltips +%patch1 -p0 -b .utf_8 %build rake build @@ -132,7 +138,6 @@ exit 0 %post touch --no-create %{_datadir}/icons/hicolor/ -%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor %{_bindir}/scrollkeeper-update -q -o %{_datadir}/omf/%{name} @@ -150,10 +155,16 @@ fi exit 0 %postun +%{_bindir}/scrollkeeper-update -q +[ "$1" -eq 0 ] || exit 0 + touch --no-create %{_datadir}/icons/hicolor/ %{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor -%{_bindir}/scrollkeeper-update -q +exit 0 + +%posttrans +%{_bindir}/gtk-update-icon-cache --quiet %{_datadir}/icons/hicolor exit 0 %files -f %{name}.lang @@ -182,6 +193,22 @@ exit 0 %{_datadir}/icons/hicolor/*/apps/%{name}.* %changelog +* Fri Feb 27 2009 Mamoru Tasaka - 0.6.3-11 +- library UTF-8 patch update + +* Thu Feb 26 2009 Mamoru Tasaka - 0.6.3-10 +- Use upstreamed patch for UTF-8 strings issue + +* Thu Feb 26 2009 Mamoru Tasaka - 0.6.3-9 +- Attempt to handle UTF-8 strings in library names correctly + +* Tue Feb 24 2009 Mamoru Tasaka +- F-11: Mass rebuild + +* Tue Feb 24 2009 Mamoru Tasaka - 0.6.3-8 +- Global-ize "nested" macro +- GTK icon cache update scripts update + * Wed Feb 4 2009 Mamoru Tasaka - 0.6.3-7 - Add hpricot dependency again (for Amazon provider)