[arch-haskell] Thoughts on Procedure

Don Stewart dons at galois.com
Sat Oct 12 07:37:01 UTC 2013

> On 2010/10/14 Don Stewart <dons at galois.com> wrote:
> > You can use cabal-install to do consistency checks, as described here:
> >
> >    http://www.well-typed.com/blog/24
> >
> > [...]
> >
> > Indicating that those are inconsistent. You could take the list of
> > things in AUR, with version numbers, and ask cabal install if they're
> > consistent (and then, when they're not, iterate, removing inconsistent
> > packages).
> That's certainly a good idea, but we would have to encode the package
> name in the PKGBUILD to retrieve it easily. The best option would be
> to have cabal-install as a library so that we could access it from
> Haskell. I don't want to use IOs for something that should be a pure
> function.

Well, its not the end of the world, and it is a pure function over the parsed
set of PKGBUILDs.

The Haskell/Cabal package name for a given Arch package is computed from
the Hackage URL in the PKGBUILD, like so:

    import Distribution.ArchLinux.AUR
    import Distribution.ArchLinux.PkgBuild
    import System.Environment
    import System.FilePath

    main = do
        [p] <- getArgs
        k <- package p

        case k of
             (Right aur, _) | not (null (packageURL aur))  -> do
                                     putStrLn $ takeFileName (packageURL aur) -- haskell package name
             _ -> putStrLn $ "Package "++show p++" doesn't have an associated PKGBUILD"

An example:

    $ ./get-hackage-name.hs haskell-haxml

-- Don

More information about the arch-haskell mailing list