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 deleted file mode 100644 index 21318a4..0000000 --- a/alexandria-0.7.4-export-to-CSV-bintex-with-ruby19.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- 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-yaml-unescape.patch b/alexandria-0.7.4-yaml-unescape.patch deleted file mode 100644 index 22c5759..0000000 --- a/alexandria-0.7.4-yaml-unescape.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- 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-07 14:39:45.495305334 +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 = 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 -@@ -170,6 +185,8 @@ module Alexandria - private - - def regularize_book_from_yaml(name) -+ require 'syck/encoding' -+ - text = IO.read(name) - - # Code to remove the mystery string in books imported from Amazon -@@ -192,7 +209,7 @@ module Alexandria - end - - # TODO: Ensure book loading passes through Book#initialize -- book = YAML.safe_load(text, permitted_classes: [Book, Time]) -+ book = YAML.safe_load(Syck::unescape(text), permitted_classes: [Book, Time]) - - unless book.isbn.class == String - # HACK diff --git a/alexandria-0.7.5-export-to-CSV-bintex-with-ruby19.patch b/alexandria-0.7.5-export-to-CSV-bintex-with-ruby19.patch new file mode 100644 index 0000000..95c0ac7 --- /dev/null +++ b/alexandria-0.7.5-export-to-CSV-bintex-with-ruby19.patch @@ -0,0 +1,30 @@ +--- alexandria-book-collection-manager-0.7.5/lib/alexandria/export_library.rb.export_csv 2020-10-17 15:49:16.241200513 +0900 ++++ alexandria-book-collection-manager-0.7.5/lib/alexandria/export_library.rb 2020-10-17 16:01:18.184960155 +0900 +@@ -108,12 +108,12 @@ module Alexandria + 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 +@@ -380,8 +380,8 @@ module Alexandria + 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 && !book.notes.empty? + bibtex << "OPTnote = \"#{latex_escape(book.notes)}\",\n" + end diff --git a/alexandria-0.7.5-yaml-unescape.patch b/alexandria-0.7.5-yaml-unescape.patch new file mode 100644 index 0000000..905f105 --- /dev/null +++ b/alexandria-0.7.5-yaml-unescape.patch @@ -0,0 +1,53 @@ +--- alexandria-book-collection-manager-0.7.5/lib/alexandria/library_store.rb.broken_yaml 2020-05-11 16:39:20.000000000 +0900 ++++ alexandria-book-collection-manager-0.7.5/lib/alexandria/library_store.rb 2020-10-17 16:07:44.600805994 +0900 +@@ -48,8 +48,23 @@ module Alexandria + Dir["*" + Library::EXT[:book]].sort.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 = 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 +@@ -181,6 +196,8 @@ module Alexandria + private + + def regularize_book_from_yaml(name) ++ require 'syck/encoding' ++ + text = IO.read(name) + + # Code to remove the mystery string in books imported from Amazon +@@ -203,7 +220,7 @@ module Alexandria + end + + # TODO: Ensure book loading passes through Book#initialize +- book = YAML.safe_load(text, permitted_classes: [Book, Time]) ++ book = YAML.safe_load(Syck::unescape(text), permitted_classes: [Book, Time]) + + unless book.isbn.class == String + # HACK diff --git a/alexandria.spec b/alexandria.spec index 5a0ed80..a1f446f 100644 --- a/alexandria.spec +++ b/alexandria.spec @@ -1,8 +1,8 @@ -%define majorver 0.7.4 +%define majorver 0.7.5 %undefine minorver %undefine ifpre -%define fedorarel 3 +%define fedorarel 0.100 %define rel %{?ifpre:0.}%{fedorarel}%{?minorver:.%minorver} @@ -46,14 +46,14 @@ Patch18: alexandria-0.7.4-utf8-convert.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.7.4-export-to-CSV-bintex-with-ruby19.patch +Patch20: alexandria-0.7.5-export-to-CSV-bintex-with-ruby19.patch # Remove garbage character with icon view on multibyte locate 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.7.4-yaml-unescape.patch +Patch22: alexandria-0.7.5-yaml-unescape.patch # Add a feature to remove broken yaml files at startup when requested # (bug 869556) Patch23: alexandria-0.7.4-delete-broken-yaml.patch