From c702265b939951e7e750e97941396fbf9d510b02 Mon Sep 17 00:00:00 2001 From: Akira TAGOH Date: Wed, 1 Mar 2023 15:42:29 +0900 Subject: [PATCH] New upstream release. Resolves: rhbz#2168726 --- paps-fix-build.patch | 85 ++++++++++++++++++++++++++++++++++++++ paps-fix-src-to-paps.patch | 18 ++++++++ paps.spec | 7 ++++ 3 files changed, 110 insertions(+) create mode 100644 paps-fix-build.patch create mode 100644 paps-fix-src-to-paps.patch diff --git a/paps-fix-build.patch b/paps-fix-build.patch new file mode 100644 index 0000000..e77f387 --- /dev/null +++ b/paps-fix-build.patch @@ -0,0 +1,85 @@ +From e2180b2e1493abc2a8d1165e10bf264d50fac0ae Mon Sep 17 00:00:00 2001 +From: Akira TAGOH +Date: Wed, 1 Mar 2023 15:24:27 +0900 +Subject: [PATCH] Fix the build issue + +Some code ignores a return value of g_string_free() and that causes: + +ignoring return value of 'gchar* g_string_free_and_steal(GString*)' declared with attribute 'warn_unused_result' [-Wunused-result] + +This fixes it. +--- + src/paps.cc | 21 ++++++++++++--------- + 1 file changed, 12 insertions(+), 9 deletions(-) + +diff --git a/src/paps.cc b/src/paps.cc +index cb48ddc..429b764 100644 +--- a/src/paps.cc ++++ b/src/paps.cc +@@ -368,6 +368,7 @@ copy_pango_parse_enum (GType type, + { + int i; + GString *s = g_string_new (nullptr); ++ gchar *gstr; + + for (i = 0, v = g_enum_get_value (klass, i); v; + i++ , v = g_enum_get_value (klass, i)) +@@ -382,10 +383,10 @@ copy_pango_parse_enum (GType type, + G_ENUM_CLASS_TYPE_NAME(klass), + s->str); + +- if (possible_values) +- *possible_values = s->str; ++ gstr = g_string_free (s, possible_values ? false : true); + +- g_string_free (s, possible_values ? false : true); ++ if (possible_values) ++ *possible_values = gstr; + } + } + +@@ -1001,7 +1002,7 @@ read_file (FILE *file, + if (ferror (file)) + { + fprintf(stderr, _("%s: Error reading file.\n"), g_get_prgname ()); +- g_string_free (inbuf, true); ++ (void) g_string_free (inbuf, true); + exit(1); + } + else if (bp == nullptr) +@@ -1043,8 +1044,7 @@ read_file (FILE *file, + if (inbuf->len && inbuf->str[inbuf->len-1] != '\n') + g_string_append(inbuf, "\n"); + +- text = inbuf->str; +- g_string_free (inbuf, false); ++ text = g_string_free (inbuf, false); + + if (encoding != nullptr && cvh != nullptr) + g_iconv_close(cvh); +@@ -1671,7 +1671,11 @@ get_date() + fprintf(stderr, _("%1$s: Error while converting date string from '%2$s' to UTF-8.\n"), + g_get_prgname(), get_encoding()); + /* Return the unconverted string. */ +- g_string_free(inbuf, false); ++ /* ++ * inbuf isn't used here, but a few memory is ++ * allocated by default. so it should be freed anyway. ++ */ ++ (void) g_string_free(inbuf, true); + g_iconv_close(cvh); + return date; + } +@@ -1679,8 +1683,7 @@ get_date() + obuffer[BUFSIZE * 6 - 1 - oblen] = 0; + g_string_append(inbuf, bp); + +- date_utf8 = inbuf->str; +- g_string_free(inbuf, false); ++ date_utf8 = g_string_free(inbuf, false); + g_iconv_close(cvh); + } + +-- +2.39.2 + diff --git a/paps-fix-src-to-paps.patch b/paps-fix-src-to-paps.patch new file mode 100644 index 0000000..d18f8af --- /dev/null +++ b/paps-fix-src-to-paps.patch @@ -0,0 +1,18 @@ +diff -pruN paps-0.8.0.orig/scripts/src-to-paps paps-0.8.0/scripts/src-to-paps +--- paps-0.8.0.orig/scripts/src-to-paps 2023-02-09 16:27:38.000000000 +0900 ++++ paps-0.8.0/scripts/src-to-paps 2023-03-01 15:00:27.801416563 +0900 +@@ -1,4 +1,4 @@ +-#!/usr/bin/python ++#!/usr/bin/python3 + + ###################################################################### + # Use GNU source-hightlight to turn source code into pango markup +@@ -49,7 +49,7 @@ def arg_if_not_none(param_name, val): + # Defaults + + # TBD - Make this a configuration variable +-pango_outlang_path = '/usr/local/share/paps/pango_markup.outlang' ++pango_outlang_path = '/usr/share/paps/pango_markup.outlang' + + parser = argparse.ArgumentParser(description='Process a file') + parser.add_argument('-o', '--output', diff --git a/paps.spec b/paps.spec index 3896660..d92ce8a 100644 --- a/paps.spec +++ b/paps.spec @@ -43,6 +43,9 @@ Patch59: %{name}-ft-header.patch Patch60: %{name}-a3.patch ## rhbz#1214939 Patch61: %{name}-fix-paper-size-truncate.patch +### For paps +Patch100: %{name}-fix-src-to-paps.patch +Patch101: %{name}-fix-build.patch Summary: Plain Text to PostScript converter %description @@ -62,6 +65,8 @@ This package contains a CUPS filter based on paps. %prep %setup -q -a 3 +%patch100 -p1 -b .src-to-paps +%patch101 -p1 -b .build pushd %{name}-0.6.8 %patch0 -p1 -b .shared %patch1 -p1 -b .wordwrap @@ -125,6 +130,8 @@ make install DESTDIR=$RPM_BUILD_ROOT INSTALL="/usr/bin/install -p" %files %doc AUTHORS COPYING.LIB README %{_bindir}/paps +%{_bindir}/src-to-paps +%{_datadir}/paps/pango_markup.outlang %{_mandir}/man1/paps.1* %files -n texttopaps