[Git][haskell-team/haskell-devscripts][master] 2 commits: Use Haskell to parse .cabal files (Closes: #1012569)
Scott Talbert (@swt2c)
gitlab at salsa.debian.org
Mon Jun 20 01:41:19 BST 2022
Scott Talbert pushed to branch master at Debian Haskell Group / haskell-devscripts
Commits:
38ca91d0 by Scott Talbert at 2022-06-19T20:33:33-04:00
Use Haskell to parse .cabal files (Closes: #1012569)
The grep/sed method didn't work for some .cabal files, so just use
Haskell which will necessarily know how to parse it's own files. This
will be a bit slower, but probably not enough to care too much.
- - - - -
140eb1fd by Scott Talbert at 2022-06-19T20:38:44-04:00
Release version 0.16.20 to unstable
- - - - -
4 changed files:
- + GetCabalVersion.hs
- debian/changelog
- debian/haskell-devscripts-minimal.install
- hlibrary.mk
Changes:
=====================================
GetCabalVersion.hs
=====================================
@@ -0,0 +1,26 @@
+import Distribution.PackageDescription (
+ package,
+ packageDescription,
+ PackageIdentifier,
+ pkgVersion
+ )
+import Distribution.PackageDescription.Parsec (readGenericPackageDescription)
+import Distribution.Pretty (prettyShow)
+import Distribution.Verbosity (silent)
+import System.Environment (getArgs)
+
+getPackageId :: IO PackageIdentifier
+getPackageId = do
+ args <- getArgs
+ gpd <- readGenericPackageDescription silent (head args)
+ return $ package $ packageDescription gpd
+
+packageVersion :: PackageIdentifier -> String
+packageVersion =
+ prettyShow . pkgVersion
+
+main :: IO ()
+main = do
+ pkgid <- getPackageId
+ putStrLn $ packageVersion pkgid
+ return ()
=====================================
debian/changelog
=====================================
@@ -1,3 +1,9 @@
+haskell-devscripts (0.16.20) unstable; urgency=medium
+
+ * Use Haskell to parse .cabal files (Closes: #1012569)
+
+ -- Scott Talbert <swt at techie.net> Sun, 19 Jun 2022 20:38:23 -0400
+
haskell-devscripts (0.16.19) unstable; urgency=medium
* Team Upload.
=====================================
debian/haskell-devscripts-minimal.install
=====================================
@@ -2,4 +2,4 @@ dh_* usr/bin/
Dh_Haskell.sh usr/share/haskell-devscripts/
hlibrary.mk usr/share/cdbs/1/class
lib/* usr/share/perl5/
-Setup-*.hs usr/share/haskell-devscripts/
+*.hs usr/share/haskell-devscripts/
=====================================
hlibrary.mk
=====================================
@@ -39,7 +39,7 @@ DEB_CABAL_PACKAGE ?= $(shell cat *.cabal |\
perl -ne \
'if (/^name\s*:\s*(.*?)\s*$$/i) {$$_ = $$1; tr/A-Z/a-z/; print; exit 0;}')
CABAL_PACKAGE=$(DEB_CABAL_PACKAGE)
-CABAL_VERSION=$(shell cat *.cabal | egrep -i '^\s*version:' | head -n1 | sed -r 's,^\s*version:\s*,,i'| sed -r 's,\s*$$,,i')
+CABAL_VERSION=$(shell runhaskell /usr/share/haskell-devscripts/GetCabalVersion.hs *.cabal || true)
DEB_ENABLE_TESTS ?= no
DEB_ENABLE_HOOGLE ?= yes
View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/9be3b3946b19d10d2547c74934914ddb86552c4c...140eb1fd441af8c1e82cc824d4c16f0e74b7f912
--
View it on GitLab: https://salsa.debian.org/haskell-team/haskell-devscripts/-/compare/9be3b3946b19d10d2547c74934914ddb86552c4c...140eb1fd441af8c1e82cc824d4c16f0e74b7f912
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-haskell-commits/attachments/20220620/e60196e3/attachment-0001.htm>
More information about the Pkg-haskell-commits
mailing list