archlinux 0.3.5 → 0.3.6
raw patch · 6 files changed
+70/−257 lines, 6 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Distribution.ArchLinux.SystemProvides: corePackagesFromFile :: String -> [Dependency]
- Distribution.ArchLinux.SystemProvides: depstr2hs :: String -> Maybe Dependency
- Distribution.ArchLinux.SystemProvides: getDefaultSystemProvides :: IO SystemProvides
- Distribution.ArchLinux.SystemProvides: getSystemProvidesFromFiles :: FilePath -> FilePath -> IO SystemProvides
- Distribution.ArchLinux.SystemProvides: translationTableFromFile :: String -> Map String String
- Distribution.ArchLinux.SystemProvides: trstr2hs :: String -> Maybe (String, String)
+ Distribution.ArchLinux.SystemProvides: emptySystemProvides :: SystemProvides
+ Distribution.ArchLinux.SystemProvides: instance Eq SystemProvides
+ Distribution.ArchLinux.SystemProvides: instance Show SystemProvides
+ Distribution.ArchLinux.SystemProvides: parseSystemProvides :: String -> String -> String -> SystemProvides
+ Distribution.ArchLinux.SystemProvides: platformPackages :: SystemProvides -> [Dependency]
- Distribution.ArchLinux.SystemProvides: SystemProvides :: [Dependency] -> Map String String -> SystemProvides
+ Distribution.ArchLinux.SystemProvides: SystemProvides :: [Dependency] -> [Dependency] -> Map String String -> SystemProvides
Files
- Distribution/ArchLinux/CabalTranslation.hs +10/−9
- Distribution/ArchLinux/PkgBuild.hs +35/−39
- Distribution/ArchLinux/SystemProvides.lhs +24/−21
- archlinux.cabal +1/−2
- data/ghc-provides.txt +0/−77
- data/library-providers.txt +0/−109
Distribution/ArchLinux/CabalTranslation.hs view
@@ -46,14 +46,14 @@ (CompilerId GHC (Version [6,12,3] [])) -- now constrain it to solve in the context of a modern ghc only- (corePackages systemContext)+ (corePackages systemContext ++ platformPackages systemContext) cabalsrc of Left deps -> trace ("Unresolved dependencies: " ++show deps) Nothing Right (pkg,_) -> Just pkg { buildDepends = removeCoreFrom (buildDepends pkg) systemContext } -- attempt to filter out core packages we've already satisified--- not actuall correct, since it doesn't take any version+-- not actually correct, since it doesn't take any version -- info into account. -- -- TODO this should use configDependency to find the precise@@ -78,7 +78,7 @@ ------------------------------------------------------------------------------------ ----- | Translate a generic cabal file into a PGKBUILD (using default+-- | Translate a generic cabal file into a PKGBUILD (using default -- values for pkgname and pkgrel). -- cabal2pkg :: PackageDescription -> SystemProvides -> (AnnotatedPkgBuild, Maybe String)@@ -89,7 +89,7 @@ isLibrary = isJust (library cabal) && map toLower (display name) `notElem` shouldNotBeLibraries ----- | Translate a generic cabal file into a PGKBUILD, using the specified+-- | Translate a generic cabal file into a PKGBUILD, using the specified -- ArchLinux package name and package release. -- cabal2pkg' :: PackageDescription -> String -> Int -> SystemProvides -> (AnnotatedPkgBuild, Maybe String)@@ -205,7 +205,8 @@ "http://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz" , arch_build = [ "cd ${srcdir}/${_hkgname}-${pkgver}"- , "runhaskell Setup configure --prefix=/usr --docdir=/usr/share/doc/${pkgname} -O --enable-split-objs"+ , "runhaskell Setup configure -O --enable-split-objs --enable-shared \\"+ , " --prefix=/usr --docdir=/usr/share/doc/${pkgname} --libsubdir=\\$compiler/site-local/\\$pkgid" , "runhaskell Setup build" , "runhaskell Setup haddock" , "runhaskell Setup register --gen-script"@@ -251,23 +252,23 @@ install_hook :: String -> String install_hook pkgname = unlines- [ "HS_DIR=/usr/share/haskell/" ++ pkgname+ [ "HS_DIR=usr/share/haskell/" ++ pkgname , "post_install() {" , " ${HS_DIR}/register.sh"- , " (cd /usr/share/doc/ghc/html/libraries; ./gen_contents_index)"+ , " (cd usr/share/doc/ghc/html/libraries; ./gen_contents_index)" , "}" , "pre_upgrade() {" , " ${HS_DIR}/unregister.sh" , "}" , "post_upgrade() {" , " ${HS_DIR}/register.sh"- , " (cd /usr/share/doc/ghc/html/libraries; ./gen_contents_index)"+ , " (cd usr/share/doc/ghc/html/libraries; ./gen_contents_index)" , "}" , "pre_remove() {" , " ${HS_DIR}/unregister.sh" , "}" , "post_remove() {"- , " (cd /usr/share/doc/ghc/html/libraries; ./gen_contents_index)"+ , " (cd usr/share/doc/ghc/html/libraries; ./gen_contents_index)" , "}" ] findCLibs :: PackageDescription -> SystemProvides -> [String]
Distribution/ArchLinux/PkgBuild.hs view
@@ -180,29 +180,36 @@ -- the PKGBUILD version spec is less expressive than cabal, we can -- only handle simple intervals like (0,v) or (v,+infty) mydisp :: VersionInterval -> Doc-mydisp (LowerBound v InclusiveBound, NoUpperBound) = if v==zeroVersion then empty else text ">=" <> disp v-mydisp (LowerBound v ExclusiveBound, NoUpperBound) = text ">" <> disp v-mydisp (_, UpperBound v boundType) = text symbol <> disp v- where symbol = if boundType == InclusiveBound then "<=" else "<"+mydisp (LowerBound v t, NoUpperBound) =+ case t of+ InclusiveBound -> if v==zeroVersion then empty else text ">=" <> disp v+ ExclusiveBound -> text ">" <> disp v+mydisp (LowerBound v1 _, UpperBound v2 t2) = text symbol <> disp v2+ where symbol | v1 == v2 = "="+ | t2 == InclusiveBound = "<="+ | t2 == ExclusiveBound = "<" zeroVersion :: Version zeroVersion = Version [0] [] instance Text ArchDep where disp (ArchDep (Dependency name ver)) =- disp name <> mydisp2 intervals+ disp name <> mydisp (collapse intervals) where intervals = asVersionIntervals ver strName = display name -- >= (greater than or equal to), <= (less than or -- equal to), = (equal to), > (greater than), or <- mydisp2 l | l == [] = trace ("WARNING: version requirement for " ++- strName ++ " is logically impossible.") empty- | tail l == [] = mydisp $ head l- -- If there are multiple possible ranges, take only latest versions- | otherwise = trace ("WARNING: multiple version ranges specified for " ++- strName ++ " using only the last one.") $ mydisp $ last l-+ --+ -- Reduce intervals to a single one+ collapse l | null l = trace ("WARNING: version requirement for " +++ strName ++ " is logically impossible.")+ (head $ asVersionIntervals anyVersion)+ | null $ tail l = head l+ -- If there are multiple possible ranges, take the interval that contains all+ | otherwise = trace ("WARNING: multiple version ranges specified for " +++ strName ++ ", using the extremal bounds instead.")+ (fst $ head l, snd $ last l) parse = undefined --@@ -460,7 +467,7 @@ , text "pkgrel" <=> int (arch_pkgrel pkg) , text "pkgdesc"- <=> text (show (arch_pkgdesc pkg))+ <=> doubleQuotes (text $ escapeForBash $ arch_pkgdesc pkg) , text "url" <=> doubleQuotes (text (arch_url pkg)) , text "license"@@ -490,6 +497,21 @@ $$ char '}' ] +--+-- | Helper function to escape strings for PKGBUILDs+--+escapeForBash :: String -> String+escapeForBash = concatMap escapeCharForBash++escapeCharForBash :: Char -> String+escapeCharForBash c = case c of+ '$' -> "\\$"+ '`' -> "\\`"+ '"' -> "\\\""+ '\\' -> "\\\\"+ '\n' -> " "+ x -> [x]+ instance Text PkgBuild where disp p = rawpkg2doc p parse = undefined@@ -513,29 +535,3 @@ -- pkg2doc :: String -> AnnotatedPkgBuild -> Doc pkg2doc email pkg = text "# Maintainer:" <+> text email $$ disp pkg------- | A data type to represent a full ArchLinux package----data ArchPackage = ArchPackage- { archpkg_pkgbuild :: AnnotatedPkgBuild- -- ^- -- The annotated PKGBUILD file- , archpkg_install :: Maybe String- -- ^- -- The contents of the install script if it exists.- , archpkg_others :: [(String, String)]- -- ^- -- A list of additional files (filename, contents)- }------- | An empty package----emptyArchPkg :: ArchPackage-emptyArchPkg = ArchPackage- { archpkg_pkgbuild = emptyPkg- , archpkg_install = Nothing- , archpkg_others = []- }-
Distribution/ArchLinux/SystemProvides.lhs view
@@ -4,7 +4,11 @@ Maintainer: Arch Haskell Team <arch-haskell@haskell.org> -> module Distribution.ArchLinux.SystemProvides where+> module Distribution.ArchLinux.SystemProvides+> ( SystemProvides(..)+> , emptySystemProvides+> , parseSystemProvides+> ) where Cabal modules @@ -15,10 +19,7 @@ > import Distribution.Text > import qualified Data.Map as M > import Data.Maybe-> import System.FilePath -> import Paths_archlinux- A big structure holding data about ArchLinux > data SystemProvides = SystemProvides@@ -26,35 +27,37 @@ > -- ^ > -- A list of Dependencies which are automatically satified > -- when GHC is installed.+> , platformPackages :: [Dependency]+> -- ^+> -- A list of packages to preferably use (e.g. Haskell Platform) > , translationTable :: M.Map String String > -- ^ > -- A hash-map where keys are library names and values are > -- names of the corresponding ArchLinux package. > }+> deriving (Show,Eq) -Get SystemProvides from package-installed files+Empty SystemProvides -> getDefaultSystemProvides :: IO SystemProvides-> getDefaultSystemProvides = do-> fnc <- getDataFileName $ "data" </> "ghc-provides.txt"-> fnt <- getDataFileName $ "data" </> "library-providers.txt"-> getSystemProvidesFromFiles fnc fnt+> emptySystemProvides :: SystemProvides+> emptySystemProvides = SystemProvides [] [] M.empty -> getSystemProvidesFromFiles :: FilePath -> FilePath -> IO SystemProvides-> getSystemProvidesFromFiles filePkg fileTranslation = do-> fc <- readFile filePkg-> ft <- readFile fileTranslation-> return SystemProvides { corePackages = corePackagesFromFile fc-> , translationTable = translationTableFromFile ft }+Get SystemProvides from files. -Extract GHC-provided dependencies from a file+> parseSystemProvides :: String -> String -> String -> SystemProvides+> parseSystemProvides sPkg sPlat sTranslation =+> SystemProvides { corePackages = parseDeplist sPkg+> , platformPackages = parseDeplist sPlat+> , translationTable = parseTranslationTable sTranslation } +Extract a list of dependency descriptions from a file+ > depstr2hs :: String -> Maybe Dependency > depstr2hs s | s == "" || head s == '#' = Nothing > | otherwise = simpleParse s -> corePackagesFromFile :: String -> [Dependency]-> corePackagesFromFile srcfile1 = mapMaybe depstr2hs $ lines srcfile1+> parseDeplist :: String -> [Dependency]+> parseDeplist srcfile = mapMaybe depstr2hs $ lines srcfile Now we translate the "library-providers" file. Any line beginning with "# " or lines with something else than two words are discarded. Lines should have@@ -66,5 +69,5 @@ > a:b:_ -> Just (a,b) > _ -> Nothing -> translationTableFromFile :: String -> M.Map String String-> translationTableFromFile srcfile2 = M.fromList $ mapMaybe trstr2hs $ lines srcfile2+> parseTranslationTable :: String -> M.Map String String+> parseTranslationTable srcfile2 = M.fromList $ mapMaybe trstr2hs $ lines srcfile2
archlinux.cabal view
@@ -1,5 +1,5 @@ name: archlinux-version: 0.3.5+version: 0.3.6 license: BSD3 license-file: LICENSE author: Don Stewart <dons@galois.com>@@ -13,7 +13,6 @@ build-type: Simple stability: stable cabal-version: >= 1.8-data-files: data/*.txt source-repository head type: git
− data/ghc-provides.txt
@@ -1,77 +0,0 @@-##-## Core packages and their versions. These come with-## ghc, so we should be right.-##-## http://haskell.org/haskellwiki/Libraries_released_with_GHC-##-## And what Arch Linux thinks GHC provides:-##-## http://repos.archlinux.org/wsvn/packages/ghc/repos/extra-x86_64/PKGBUILD-##-## Note: we could just list these directly, and have yaourt solve them.-##-## NEW POLICY:-## We rely on all "provides" from the GHC library to be listed explicitly.-##--base==4.1.0.0-dph-base-dph-par-dph-prim-interface-dph-prim-par-dph-prim-seq-dph-seq-ghc-ghc-prim-integer-integer-gmp-ghc-binary--## Official Provides: http://repos.archlinux.org/wsvn/packages/ghc/repos/extra-x86_64/PKGBUILD-#array==0.3.0.1-#bytestring==0.9.1.7-#cabal==1.8.0.6-#containers==0.3.0.0-#directory==1.0.1.1-#extensible-exceptions==0.1.1.1-#filepath==1.1.0.4-#haskell98==1.0.1.1-#hpc==0.5.0.5-#old-locale==1.0.0.2-#old-time==1.0.0.5-#pretty==1.0.1.1-#process==1.0.1.3-#random==1.0.0.2-#syb==0.1.0.2-#template-haskell==2.4.0.1-#time==1.1.4-#unix==2.4.0.2-#haddock==2.6.0-## utf8-string-#-#-## Removed in 6.12.x-# html==1.0.1.2-# integer==0.1.0.0-# QuickCheck==1.2.0.0-# haskell-src==1.0.1.3-# parsec==2.1.0.0-# packedstring==0.1.0.1-# parallel==1.1.0.0-# network==2.2.0.1-# mtl==1.1.0.2-# stm==2.1.1.2-# HUnit==1.2.0.3-# xhtml==3000.2.0.1-# regex-base==0.72.0.2-# regex-compat==0.71.0.1-# regex-posix==0.72.0.2-#-## Removed in 6.10.x-# editline-# ALUT==2.1.0.0-# cgi==3001.1.5.1-# fgl==5.4.1.1 -- gone-# GLUT==2.1.1.1-# OpenAL==1.3.1.1 -- gone-# readline==1.0.1.0
− data/library-providers.txt
@@ -1,109 +0,0 @@-# This file lists external library dependencies and the ArchLinux-# packages providing them. For example, if the openssl package-# provides libssl.so, there should be a line-#-# ssl openssl-#--Imlib2 imlib2-SDL sdl-adns adns-alut freealut-bz2 bzip2-cblas blas-crack cracklib-crypto openssl-curl curl-freetype freetype2-glib glib2-wmflite libwmf-il devil--jpeg libjpeg-ldap libldap-pcap libpcap-png libpng-x11 libx11-xrandr libxrandr-xml2 libxml2-exif libexif-tiff libtiff-sndfile libsndfile-gcrypt libgcrypt-gnutls gnutls-gnutls-extra gnutls-fftw3 fftw--pq postgresql-ssl openssl-wx wxgtk-odbc unixodbc-z zlib-curses ncurses-xslt libxslt-uuid e2fsprogs-ev libev-pthread glibc-m glibc-gl libgl-glu mesa-glut freeglut-db_cxx db-sqlite3 sqlite3-xdamage libxdamage--icui18n icu-icuuc icu-icudata icu--netsnmp net-snmp-asound alsa-lib-ffi libffi-ogg libogg-theora libtheora-mtp libmtp-cv opencv-highgui opencv-xss libxss-idn libidn-libgsasl gsasl-event libevent-gcc_s gcc-libs-stdc++ gcc-libs--# subsumed into glib--gobject glib2-gmodule glib2-gio glib2-gthread glib-gnome-vfs-module-gstreamer-audio gstreamer0.10-base-gstreamer-base gstreamer0.10-gstreamer-controller gstreamer0.10-gstreamer-dataprotocol gstreamer0.10-gstreamer-net gstreamer0.10-ogremain--webkit libwebkit-cairo cairo-pango pango-pangocairo pango-gtk+ gtk2-gdk gtk-gdk-x11-2.0 gtk2-gtk-x11-2.0 gtk2-vte vte-xine xine-lib-ncurses ncurses-ncursesw ncurses-panel ncurses--gstreamer gstreamer0.10-gstreamer-plugins-base gstreamer0.10-base--# Packages from AUR-xenctrl xen-csound64 csound5-doublefann fann-zmq zeromq