From 8539a717fca56cf7b0154d115ac3b042f86c2586 Mon Sep 17 00:00:00 2001 From: Jens Petersen Date: Thu, 1 Sep 2016 14:59:29 +0900 Subject: [PATCH] %ghc_lib_subpackage now takes name-version processed with lua --- ghc-rpm-macros.spec | 5 ++++- macros.ghc-extra | 13 ++++++++++--- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/ghc-rpm-macros.spec b/ghc-rpm-macros.spec index a7c1e74..fcd24f4 100644 --- a/ghc-rpm-macros.spec +++ b/ghc-rpm-macros.spec @@ -10,7 +10,7 @@ #%%global without_hscolour 1 Name: ghc-rpm-macros -Version: 1.6.6 +Version: 1.6.7 Release: 1%{?dist} Summary: RPM macros for building packages for GHC @@ -135,6 +135,9 @@ EOF %changelog +* Thu Sep 1 2016 Jens Petersen - 1.6.7-1 +- ghc_lib_subpackage now takes name-version processed with lua + * Fri Aug 26 2016 Jens Petersen - 1.6.6-1 - ghc_gen_filelists: support packages with more than one license file - move licenses from docdir to licensedir instead of removing, diff --git a/macros.ghc-extra b/macros.ghc-extra index 4da5c4d..329a547 100644 --- a/macros.ghc-extra +++ b/macros.ghc-extra @@ -1,9 +1,16 @@ # RPM Macros for packaging Haskell packages with multiple libs -*-rpm-spec-*- -# ghc_lib_subpackage [-c cdepslist] [-l licensetag] [-x] [name] [version] +# ghc_lib_subpackage [-c cdepslist] [-l licensetag] [-x] [name-version] %ghc_lib_subpackage(c:l:x)\ -%define pkgname %{?1}%{!?1:%{pkg_name}}\ -%define pkgver %{?2}%{!?2:%{version}}\ +%define pkgname %{lua:\ +local pv = rpm.expand("%1")\ +local _, _, name = string.find(pv, "^([%a-]+)-")\ +print(name)\ +}\ +%define pkgver %{lua:\ +local pv = rpm.expand("%1")\ +print(string.sub(pv, string.find(pv, "[%d.]+$")))\ +}\ %{!-x:%{?1:%global ghc_packages_list %{?ghc_packages_list} %{pkgname}-%{pkgver}}}\ %define ghc_prefix %{?ghc_name}%{!?ghc_name:ghc}\ %define basepkg %{ghc_prefix}-%{pkgname}\