From 774ae4cf8f4b210fdadc6cd57ddf01b76def1c4b Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Mon, 18 Sep 2023 18:31:45 +0800 Subject: [PATCH] add ghc-info.sh to read fields from ghc --info --- ghc-info.sh | 8 ++++++++ ghc-rpm-macros.spec | 10 ++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) create mode 100755 ghc-info.sh diff --git a/ghc-info.sh b/ghc-info.sh new file mode 100755 index 0000000..af1eabf --- /dev/null +++ b/ghc-info.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +[ $# -lt 2 ] && echo "Usage: $(basename "$0") GHCVERSION INFOFIELD" + +GHCVER=$1 +FIELD=$2 + +/usr/bin/ghc-${GHCVER} --info | grep \"$FIELD\" | sed -e 's/.*","\(.*\)")/\1/' diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec index 874e06e..23f8b8d 100644 --- a/ghc-rpm-macros.spec +++ b/ghc-rpm-macros.spec @@ -7,8 +7,8 @@ %endif Name: ghc-rpm-macros -Version: 2.5.3 -Release: 2%{?dist} +Version: 2.6.0 +Release: 1%{?dist} Summary: RPM macros for building Haskell packages for GHC License: GPL-3.0-or-later @@ -27,6 +27,7 @@ Source9: macros.ghc-os Source10: Setup.hs Source11: cabal-tweak-drop-dep Source12: cabal-tweak-remove-upperbound +Source13: ghc-info.sh Requires: redhat-rpm-config # ghc_version needs ghc-compiler or ghcX.Y-compiler-default Requires: chrpath @@ -127,6 +128,7 @@ echo -e "\n%%_ghcdynlibdir %%{_libdir}" >> %{buildroot}%{macros_dir}/macros.ghc- %endif install -p -D -m 0755 %{SOURCE3} %{buildroot}%{_prefix}/lib/rpm/ghc-deps.sh +install -p -D -m 0755 %{SOURCE13} %{buildroot}%{_prefix}/lib/rpm/ghc-info.sh %if 0%{?fedora} || 0%{?rhel} >= 7 install -p -D -m 0644 %{SOURCE7} %{buildroot}%{_prefix}/lib/rpm/fileattrs/ghc.attr @@ -154,6 +156,7 @@ mkdir -p %{buildroot}%{_docdir}/ghc/html/libraries %{_prefix}/lib/rpm/fileattrs/ghc.attr %endif %{_prefix}/lib/rpm/ghc-deps.sh +%{_prefix}/lib/rpm/ghc-info.sh %{_prefix}/lib/rpm/ghc-pkg-wrapper %{_bindir}/cabal-tweak-dep-ver %{_bindir}/cabal-tweak-drop-dep @@ -182,6 +185,9 @@ mkdir -p %{buildroot}%{_docdir}/ghc/html/libraries %changelog +* Mon Sep 18 2023 Jens Petersen - 2.6.0-1 +- add ghc-info.sh to read fields from ghc --info + * Mon Sep 18 2023 Jens Petersen - 2.5.3-2 - obsolete ghc-data-array-byte - migrate to SPDX license tag