From 5cccbb515f0e89f7c1e0961c1df28851862985c1 Mon Sep 17 00:00:00 2001 From: Mamoru TASAKA Date: Jan 03 2020 08:46:02 +0000 Subject: once porting till patch22 is done --- diff --git a/alexandria-0.6.8-export-to-CSV-bintex-with-ruby19.patch b/alexandria-0.6.8-export-to-CSV-bintex-with-ruby19.patch deleted file mode 100644 index ee53db3..0000000 --- a/alexandria-0.6.8-export-to-CSV-bintex-with-ruby19.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- alexandria-0.6.8/lib/alexandria/export_library.rb.ruby19_csv 2012-05-30 10:04:18.167329943 +0900 -+++ alexandria-0.6.8/lib/alexandria/export_library.rb 2012-05-30 10:07:52.230277906 +0900 -@@ -241,7 +241,14 @@ - File.open(filename, 'w') do |io| - io.puts "Title" + ';' + "Authors" + ';' + "Publisher" + ';' + "Edition" + ';' + "ISBN" + ';' + "Year Published" + ';' + "Rating" + "(0 to #{UI::MainApp::MAX_RATING_STARS.to_s})" + ';' + "Notes" + ';' + "Want?" + ';' + "Read?" + ';' + "Own?" + ';' + "Tags" - each do |book| -- io.puts book.title + ';' + book.authors.join(', ') + ';' + (book.publisher or "") + ';' + (book.edition or "") + ';' + (book.isbn or "") + ';' + (book.publishing_year.to_s or "") + ';' + (book.rating.to_s or "0") + ';' + (book.notes or "") + ';' + ( book.want ? "1" : "0") + ';' + ( book.redd ? "1" : "0") + ';' + ( book.own ? "1" : "0") + ';' + (book.tags ? book.tags.join(', ') : "") -+ io.puts book.title.force_encoding('UTF-8') + ';' + -+ book.authors.join(', ').force_encoding('UTF-8') + ';' + -+ (book.publisher or "").force_encoding('UTF-8') + ';' + -+ (book.edition or "").force_encoding('UTF-8') + ';' + (book.isbn or "") + ';' + -+ (book.publishing_year.to_s or "") + ';' + (book.rating.to_s or "0") + ';' + -+ (book.notes or "") + ';' + ( book.want ? "1" : "0") + ';' + -+ ( book.redd ? "1" : "0") + ';' + ( book.own ? "1" : "0") + -+ ';' + (book.tags ? book.tags.join(', ') : "") - end - end - end -@@ -499,12 +506,12 @@ - if book.authors != [] - bibtex << book.authors[0] - book.authors[1..-1].each do |author| -- bibtex << " and #{latex_escape(author)}" -+ bibtex << " and #{latex_escape(author.force_encoding('UTF-8'))}" - end - end - bibtex << "\",\n" -- bibtex << "title = \"#{latex_escape(book.title)}\",\n" -- bibtex << "publisher = \"#{latex_escape(book.publisher)}\",\n" -+ bibtex << "title = \"#{latex_escape(book.title.force_encoding('UTF-8'))}\",\n" -+ bibtex << "publisher = \"#{latex_escape(book.publisher.force_encoding('UTF-8'))}\",\n" - if book.notes and not book.notes.empty? - bibtex << "OPTnote = \"#{latex_escape(book.notes)}\",\n" - end diff --git a/alexandria-0.6.8-export-to-HTML-with-ruby19.patch b/alexandria-0.6.8-export-to-HTML-with-ruby19.patch deleted file mode 100644 index dec5c0b..0000000 --- a/alexandria-0.6.8-export-to-HTML-with-ruby19.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- alexandria-0.6.8/lib/alexandria/export_library.rb.export 2009-03-26 08:09:32.000000000 +0900 -+++ alexandria-0.6.8/lib/alexandria/export_library.rb 2012-05-06 01:22:03.000000000 +0900 -@@ -420,7 +420,7 @@ - xhtml << <#{xhtml_escape(book.title)}

-+

#{xhtml_escape(book.title).force_encoding("UTF-8")}

- EOS - end - -@@ -447,7 +447,7 @@ - xhtml << "" -@@ -455,13 +455,13 @@ - - unless book.edition == nil - xhtml << <#{xhtml_escape(book.edition)}

-+

#{xhtml_escape(book.edition).force_encoding("UTF-8")}

- EOS - end - - unless book.publisher == nil - xhtml << <#{xhtml_escape(book.publisher)}

-+

#{xhtml_escape(book.publisher).force_encoding("UTF-8")}

- EOS - end - diff --git a/alexandria-0.6.8-iconview-multibyte.patch b/alexandria-0.6.8-iconview-multibyte.patch deleted file mode 100644 index 30bfef0..0000000 --- a/alexandria-0.6.8-iconview-multibyte.patch +++ /dev/null @@ -1,12 +0,0 @@ ---- alexandria-0.6.8/lib/alexandria/ui/ui_manager.rb.icon_multibyte 2012-05-30 10:04:18.132330198 +0900 -+++ alexandria-0.6.8/lib/alexandria/ui/ui_manager.rb 2012-05-29 18:29:54.430690741 +0900 -@@ -824,6 +824,9 @@ - iter[Columns::IDENT] = book.ident.to_s - iter[Columns::TITLE] = book.title - title = book.title.sub(REDUCE_TITLE_REGEX, '\1...') -+ # More nice method is needed here... -+ title = title.encode("UTF-16", "UTF-8", :invalid => :replace, :undef => :replace, :replace => ".") -+ title = title.encode("UTF-8") - iter[Columns::TITLE_REDUCED] = title - # Don't know why, however force_encoding seems needed here to - # prevent crash... diff --git a/alexandria-0.6.8-utf8-convert.patch b/alexandria-0.6.8-utf8-convert.patch deleted file mode 100644 index 8db1fbc..0000000 --- a/alexandria-0.6.8-utf8-convert.patch +++ /dev/null @@ -1,28 +0,0 @@ ---- alexandria-0.6.8/lib/alexandria/ui/dialogs/misc_dialogs.rb.ruby19_utf8 2009-03-26 08:09:32.000000000 +0900 -+++ alexandria-0.6.8/lib/alexandria/ui/dialogs/misc_dialogs.rb 2012-04-13 12:38:05.065369194 +0900 -@@ -22,9 +22,11 @@ - GetText.bindtextdomain(Alexandria::TEXTDOMAIN, :charset => "UTF-8") - - def initialize(parent, library, book) -+ # Don't know why, however force_encoding seems needed here to -+ # prevent crash... - super(parent, - _("The book '%s' already exists in '%s'. Would you like " + -- "to replace it?") % [ book.title, library.name ], -+ "to replace it?") % [ book.title, library.name ].dup.map!{|str| str.force_encoding("UTF-8")}, - Gtk::Stock::DIALOG_QUESTION, - [[_("_Skip"), Gtk::Dialog::RESPONSE_CANCEL], - [_("_Replace"), Gtk::Dialog::RESPONSE_OK]], ---- alexandria-0.6.8/lib/alexandria/ui/ui_manager.rb.ruby19_utf8 2011-11-15 22:09:19.000000000 +0900 -+++ alexandria-0.6.8/lib/alexandria/ui/ui_manager.rb 2012-04-13 12:38:05.066369229 +0900 -@@ -825,7 +825,9 @@ - iter[Columns::TITLE] = book.title - title = book.title.sub(REDUCE_TITLE_REGEX, '\1...') - iter[Columns::TITLE_REDUCED] = title -- iter[Columns::AUTHORS] = book.authors.join(', ') -+ # Don't know why, however force_encoding seems needed here to -+ # prevent crash... -+ iter[Columns::AUTHORS] = book.authors.dup.map!{|str| str.force_encoding("UTF-8")}.join(', ') - iter[Columns::ISBN] = book.isbn.to_s - iter[Columns::PUBLISHER] = book.publisher - iter[Columns::PUBLISH_DATE] = (book.publishing_year.to_s rescue "") diff --git a/alexandria-0.6.8-yaml-unescape.patch b/alexandria-0.6.8-yaml-unescape.patch deleted file mode 100644 index c1a166a..0000000 --- a/alexandria-0.6.8-yaml-unescape.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- alexandria-0.6.8/lib/alexandria/models/library.rb.broken_yaml 2009-12-07 05:16:57.000000000 +0900 -+++ alexandria-0.6.8/lib/alexandria/models/library.rb 2012-10-13 03:25:24.000000000 +0900 -@@ -78,8 +78,23 @@ - - test[1] = filename if test[0] == 0 - -+ book_valid_p = true -+ - if not File.size? test[1] - log.warn { "Book file #{test[1]} was empty"} -+ book_valid_p = false -+ end -+ -+ if book_valid_p -+ begin -+ book = self.regularize_book_from_yaml(test[1]) -+ rescue Psych::SyntaxError => e -+ log.warn "Book file #{test[1]} could not be parsed" -+ book_valid_p = false -+ end -+ end -+ -+ if not book_valid_p - md = /([\dxX]{10,13})#{EXT[:book]}/.match(filename) - if md - file_isbn = md[1] -@@ -90,7 +105,7 @@ - end - next - end -- book = self.regularize_book_from_yaml(test[1]) -+ - old_isbn = book.isbn - old_pub_year = book.publishing_year - begin -@@ -178,6 +193,8 @@ - end - - def self.regularize_book_from_yaml(name) -+ require 'syck/encoding' -+ - text = IO.read(name) - - #Code to remove the mystery string in books imported from Amazon -@@ -198,7 +215,7 @@ - new_yaml.sub!(/^\s*\-+\s*/, '') - text.sub!(md[0], "loaned_since: #{new_yaml}\n") - end -- book = YAML.load(text) -+ book = YAML.load(Syck::unescape(text)) - unless book.isbn.class == String - # HACK - md = /isbn: (.+)/.match(text) diff --git a/alexandria-0.6.8-z3950-next.patch b/alexandria-0.6.8-z3950-next.patch deleted file mode 100644 index 665f5e5..0000000 --- a/alexandria-0.6.8-z3950-next.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- alexandria-0.6.8/./lib/alexandria/book_providers/z3950.rb.next 2009-12-22 06:13:29.000000000 +0900 -+++ alexandria-0.6.8/./lib/alexandria/book_providers/z3950.rb 2012-04-10 23:40:53.000000000 +0900 -@@ -100,7 +100,7 @@ - msg - } - -- next if marc.title.nil? # or marc.authors.empty? -+ raise if marc.title.nil? # or marc.authors.empty? - - isbn = isbn or marc.isbn - isbn = Library.canonicalise_ean(isbn) diff --git a/alexandria-0.7.4-export-to-CSV-bintex-with-ruby19.patch b/alexandria-0.7.4-export-to-CSV-bintex-with-ruby19.patch new file mode 100644 index 0000000..21318a4 --- /dev/null +++ b/alexandria-0.7.4-export-to-CSV-bintex-with-ruby19.patch @@ -0,0 +1,30 @@ +--- alexandria-book-collection-manager-0.7.4/lib/alexandria/export_library.rb.csv 2020-01-03 16:24:11.989122168 +0900 ++++ alexandria-book-collection-manager-0.7.4/lib/alexandria/export_library.rb 2020-01-03 16:37:23.739363736 +0900 +@@ -110,12 +110,12 @@ + io.puts "#{book.title} " + # put a link to the book's cover. only works on iPod 5G and above(?). + if File.exist?(cover(book)) +- io.puts '' + book.title + "" ++ io.puts '' + book.title.force_encoding('UTF-8') + "" + else +- io.puts book.title ++ io.puts book.title.force_encoding('UTF-8') + end +- io.puts book.authors.join(", ") +- io.puts book.edition ++ io.puts book.authors.join(", ").force_encoding('UTF-8') ++ io.puts book.edition.force_encoding('UTF-8') + io.puts((book.isbn || "")) + # we need to close the files so the iPod can be ejected/unmounted without us closing Alexandria + io.close +@@ -379,8 +379,8 @@ + end + end + bibtex << "\",\n" +- bibtex << "title = \"#{latex_escape(book.title)}\",\n" +- bibtex << "publisher = \"#{latex_escape(book.publisher)}\",\n" ++ bibtex << "title = \"#{latex_escape(book.title.force_encoding('UTF-8'))}\",\n" ++ bibtex << "publisher = \"#{latex_escape(book.publisher.force_encoding('UTF-8'))}\",\n" + bibtex << "OPTnote = \"#{latex_escape(book.notes)}\",\n" if book.notes && !book.notes.empty? + # year is a required field in bibtex @BOOK + bibtex << "year = " + (book.publishing_year || '"n/a"').to_s + "\n" diff --git a/alexandria-0.7.4-export-to-HTML-with-ruby19.patch b/alexandria-0.7.4-export-to-HTML-with-ruby19.patch new file mode 100644 index 0000000..70cf52f --- /dev/null +++ b/alexandria-0.7.4-export-to-HTML-with-ruby19.patch @@ -0,0 +1,45 @@ +--- alexandria-book-collection-manager-0.7.4/lib/alexandria/export_library.rb.export_html 2020-01-03 16:17:05.053552865 +0900 ++++ alexandria-book-collection-manager-0.7.4/lib/alexandria/export_library.rb 2020-01-03 16:24:11.989122168 +0900 +@@ -302,7 +302,7 @@ + xhtml << <<~EOS + Cover file for '#{xhtml_escape(book.title)}' + EOS +@@ -314,7 +314,7 @@ + + unless book.title.nil? + xhtml << <<~EOS +-

#{xhtml_escape(book.title)}

++

#{xhtml_escape(book.title).force_encoding("UTF-8")}

+ EOS + end + +@@ -322,7 +322,7 @@ + xhtml << '
    ' + book.authors.each do |author| + xhtml << <<~EOS +-
  • #{xhtml_escape(author)}
  • ++
  • #{xhtml_escape(author).force_encoding("UTF-8")}
  • + EOS + end + xhtml << "
" +@@ -330,13 +330,13 @@ + + unless book.edition.nil? + xhtml << <<~EOS +-

#{xhtml_escape(book.edition)}

++

#{xhtml_escape(book.edition).force_encoding("UTF-8")}

+ EOS + end + + unless book.publisher.nil? + xhtml << <<~EOS +-

#{xhtml_escape(book.publisher)}

++

#{xhtml_escape(book.publisher).force_encoding("UTF-8")}

+ EOS + end + diff --git a/alexandria-0.7.4-iconview-multibyte.patch b/alexandria-0.7.4-iconview-multibyte.patch new file mode 100644 index 0000000..65db51f --- /dev/null +++ b/alexandria-0.7.4-iconview-multibyte.patch @@ -0,0 +1,12 @@ +--- alexandria-book-collection-manager-0.7.4/lib/alexandria/ui/ui_manager.rb.icon_multibyte 2020-01-03 16:17:05.051552867 +0900 ++++ alexandria-book-collection-manager-0.7.4/lib/alexandria/ui/ui_manager.rb 2020-01-03 16:41:08.841182941 +0900 +@@ -713,6 +713,9 @@ + iter[Columns::IDENT] = book.ident.to_s + iter[Columns::TITLE] = book.title + title = book.title.sub(REDUCE_TITLE_REGEX, '\1...') ++ # More nice method is needed here... ++ title = title.encode("UTF-16", "UTF-8", :invalid => :replace, :undef => :replace, :replace => ".") ++ title = title.encode("UTF-8") + iter[Columns::TITLE_REDUCED] = title + # Don't know why, however force_encoding seems needed here to + # prevent crash... diff --git a/alexandria-0.7.4-utf8-convert.patch b/alexandria-0.7.4-utf8-convert.patch new file mode 100644 index 0000000..694f555 --- /dev/null +++ b/alexandria-0.7.4-utf8-convert.patch @@ -0,0 +1,28 @@ +--- alexandria-book-collection-manager-0.7.4/lib/alexandria/ui/conflict_while_copying_dialog.rb.utf8 2019-10-25 01:20:07.000000000 +0900 ++++ alexandria-book-collection-manager-0.7.4/lib/alexandria/ui/conflict_while_copying_dialog.rb 2020-01-03 16:11:41.543997217 +0900 +@@ -13,9 +13,11 @@ module Alexandria + GetText.bindtextdomain(Alexandria::TEXTDOMAIN, charset: "UTF-8") + + def initialize(parent, library, book) ++ # Don't know why, however force_encoding seems needed here to ++ # prevent crash... + super(parent, + format(_("The book '%s' already exists in '%s'. Would you like " \ +- "to replace it?"), book.title, library.name), ++ "to replace it?"), book.title, library.name).dup.map!{|str| str.force_encoding("UTF-8")}, + Gtk::Stock::DIALOG_QUESTION, + [[_("_Skip"), Gtk::ResponseType::CANCEL], + [_("_Replace"), Gtk::ResponseType::OK]], +--- alexandria-book-collection-manager-0.7.4/lib/alexandria/ui/ui_manager.rb.utf8 2019-10-25 01:20:07.000000000 +0900 ++++ alexandria-book-collection-manager-0.7.4/lib/alexandria/ui/ui_manager.rb 2020-01-03 16:14:53.165730869 +0900 +@@ -714,7 +714,9 @@ module Alexandria + iter[Columns::TITLE] = book.title + title = book.title.sub(REDUCE_TITLE_REGEX, '\1...') + iter[Columns::TITLE_REDUCED] = title +- iter[Columns::AUTHORS] = book.authors.join(", ") ++ # Don't know why, however force_encoding seems needed here to ++ # prevent crash... ++ iter[Columns::AUTHORS] = book.authors.dup.map!{|str| str.force_encoding("UTF-8")}.join(", ") + iter[Columns::ISBN] = book.isbn.to_s + iter[Columns::PUBLISHER] = book.publisher + iter[Columns::PUBLISH_DATE] = book.publishing_year.to_s diff --git a/alexandria-0.7.4-yaml-unescape.patch b/alexandria-0.7.4-yaml-unescape.patch new file mode 100644 index 0000000..94f825e --- /dev/null +++ b/alexandria-0.7.4-yaml-unescape.patch @@ -0,0 +1,44 @@ +--- alexandria-book-collection-manager-0.7.4/lib/alexandria/library_store.rb.broken_yaml 2019-10-25 01:20:07.000000000 +0900 ++++ alexandria-book-collection-manager-0.7.4/lib/alexandria/library_store.rb 2020-01-03 17:38:07.340338529 +0900 +@@ -48,8 +48,23 @@ module Alexandria + Dir["*" + Library::EXT[:book]].each do |filename| + test[1] = filename if (test[0]).zero? + ++ book_valid_p = true ++ + unless File.size? test[1] + log.warn { "Book file #{test[1]} was empty" } ++ book_valid_p = false ++ end ++ ++ if book_valid_p ++ begin ++ book = self.regularize_book_from_yaml(test[1]) ++ rescue Psych::SyntaxError => e ++ log.warn "Book file #{test[1]} could not be parsed" ++ book_valid_p = false ++ end ++ end ++ ++ if not book_valid_p + md = /([\dxX]{10,13})#{Library::EXT[:book]}/.match(filename) + if md + file_isbn = md[1] +@@ -60,7 +75,7 @@ module Alexandria + end + next + end +- book = regularize_book_from_yaml(test[1]) ++ + old_isbn = book.isbn + old_pub_year = book.publishing_year + begin +@@ -193,6 +208,8 @@ module Alexandria + + # TODO: Ensure book loading passes through Book#initialize + book = YAML.safe_load(text, permitted_classes: [Book, Time]) ++ # TODO: Need check if this can be removed ++ # book = YAML.load(Syck::unescape(text)) + + unless book.isbn.class == String + # HACK diff --git a/alexandria.spec b/alexandria.spec index 00449ae..60b605b 100644 --- a/alexandria.spec +++ b/alexandria.spec @@ -36,27 +36,24 @@ Patch14: alexandria-0.7.4-ascii-fix.patch # Well, with the original fix, some strange failure on startup # happens on ja_JP.utf8... #Patch15: alexandria-0.6.8-kcodefix.patch -# With working zoom and ruby19, z3950 provider aborts -# with syntax error about next -Patch17: alexandria-0.6.8-z3950-next.patch # Two fixes: # a. loading yaml file generated by ruby 18x will show garbage characters # b. moving book entry to another library which also contains the # same book will cause crash.. -Patch18: alexandria-0.6.8-utf8-convert.patch +Patch18: alexandria-0.7.4-utf8-convert.patch # More UTF-8 fix on ruby 1.9, when exporting library to HTML # (bug 819188) -Patch19: alexandria-0.6.8-export-to-HTML-with-ruby19.patch +Patch19: alexandria-0.7.4-export-to-HTML-with-ruby19.patch # More UTF-8 fix on ruby 1.9, when exporting library to csv # or bibtex -Patch20: alexandria-0.6.8-export-to-CSV-bintex-with-ruby19.patch +Patch20: alexandria-0.7.4-export-to-CSV-bintex-with-ruby19.patch # Remove garbage character with icon view on multibyte locate -Patch21: alexandria-0.6.8-iconview-multibyte.patch +Patch21: alexandria-0.7.4-iconview-multibyte.patch # Split Patch18 into two patches, one for lib/alexandria/models/library.rb # (this file) and other. Also handle broken yaml file correctly and let # user redownload it # (bug 861740) -Patch22: alexandria-0.6.8-yaml-unescape.patch +Patch22: alexandria-0.7.4-yaml-unescape.patch # Add a feature to remove broken yaml files at startup when requested # (bug 869556) Patch23: alexandria-0.6.9-delete-broken-yaml.patch @@ -155,7 +152,6 @@ Alexandria is a GNOME application to help you manage your book collection. #%%patch4 -p0 -b .up29479.search %patch14 -p1 -b .ascii #%%patch15 -p1 -b .kcodefix -%patch17 -p1 -b .z3950_next %patch18 -p1 -b .ruby19_utf8 %patch19 -p1 -b .export_html %patch20 -p1 -b .export_csv