From 21bfef4fff3536e39d87bb0614d038f6c82d5766 Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Mon, 17 Feb 2025 08:47:41 +0000 Subject: automatic import of preproc --- .gitignore | 1 + 0001-pipes-to-shlex.patch | 42 ++++++++++++++++++++++++++++++++ preproc.spec | 61 +++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 4 files changed, 105 insertions(+) create mode 100644 0001-pipes-to-shlex.patch create mode 100644 preproc.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..0a217c2 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/rpkg-util-preproc-bcad4393.tar.gz diff --git a/0001-pipes-to-shlex.patch b/0001-pipes-to-shlex.patch new file mode 100644 index 0000000..d0b6fef --- /dev/null +++ b/0001-pipes-to-shlex.patch @@ -0,0 +1,42 @@ +diff -urN rpkg-util-preproc-orig/preproc rpkg-util-preproc/preproc +--- rpkg-util-preproc-orig/preproc 2022-08-06 08:08:56.990976147 +0200 ++++ rpkg-util-preproc/preproc 2022-08-06 08:09:12.022647218 +0200 +@@ -5,7 +5,7 @@ + import subprocess + import tempfile + import argparse +-import pipes ++import shlex + import re + + +@@ -16,7 +16,7 @@ + quoted_items = [] + + for i in range(len(cmd)): +- quoted_items.append(pipes.quote(cmd[i])) ++ quoted_items.append(shlex.quote(cmd[i])) + + return ' '.join(quoted_items) + +diff -urN rpkg-util-preproc-orig/preproc-pyparsing rpkg-util-preproc/preproc-pyparsing +--- rpkg-util-preproc-orig/preproc-pyparsing 2022-08-06 08:08:56.991976126 +0200 ++++ rpkg-util-preproc/preproc-pyparsing 2022-08-06 08:09:18.289510084 +0200 +@@ -5,7 +5,7 @@ + import subprocess + import tempfile + import argparse +-import pipes ++import shlex + + from pyparsing import Combine, CharsNotIn, Regex, ZeroOrMore, Suppress, Literal + +@@ -17,7 +17,7 @@ + quoted_items = [] + + for i in range(len(cmd)): +- quoted_items.append(pipes.quote(cmd[i])) ++ quoted_items.append(shlex.quote(cmd[i])) + + return ' '.join(quoted_items) + diff --git a/preproc.spec b/preproc.spec new file mode 100644 index 0000000..af8180e --- /dev/null +++ b/preproc.spec @@ -0,0 +1,61 @@ +# vim: syntax=spec + +%global python_pkg python3 +%global python /usr/bin/python3 + +Name: preproc +Version: 0.5 +Release: 1 +Summary: Simple text preprocessor +License: GPLv2+ +URL: https://pagure.io/rpkg-util.git + +# Source is created by: +# git clone https://pagure.io/rpkg-util.git +# cd rpkg-util/preproc +# git checkout preproc-0.5-1 +# ./rpkg spec --sources +Source0: rpkg-util-preproc-bcad4393.tar.gz + +# Upstream indicates non-maintenance (aside from security) and 3.11 in F37 deprecates the +# pipes module (it's been deprecated since 2.7?). +Patch0: 0001-pipes-to-shlex.patch + +BuildArch: noarch + +BuildRequires: %{python_pkg} +Requires: %{python_pkg} + +%description +Simple text preprocessor implementing a very basic templating language. +You can use bash code enclosed in triple braces in a text file and +then pipe content of that file to preproc. preproc will replace each of +the tags with stdout of the executed code and print the final renderred +result to its own stdout. + +%prep +%setup -T -b 0 -q -n rpkg-util-preproc +%patch0 -p1 + +%check +sed -i '1 s|#.*|#!%{python}|' preproc +./test + +%install +install -d %{buildroot}%{_bindir} +install -p -m 0755 preproc %{buildroot}%{_bindir} + +sed -i '1 s|#.*|#!%{python}|' %{buildroot}%{_bindir}/preproc + +install -d %{buildroot}%{_mandir}/man1 +install -p -m 0644 man/preproc.1 %{buildroot}%{_mandir}/man1 + +%files +%{!?_licensedir:%global license %doc} +%license LICENSE +%{_bindir}/preproc +%{_mandir}/man1/preproc.1* + +%changelog +* Mon May 22 2023 lichaoran - 0.5-1 +- Init package diff --git a/sources b/sources new file mode 100644 index 0000000..0edd28b --- /dev/null +++ b/sources @@ -0,0 +1 @@ +0f2d4e3a23892c5e2664c06176b93e71 rpkg-util-preproc-bcad4393.tar.gz -- cgit v1.2.3