Skip to content

Instantly share code, notes, and snippets.

@rshipp
Created May 14, 2016 21:53
Show Gist options
  • Save rshipp/b6996076c0fa3ae0e7e71eee7f0e0c48 to your computer and use it in GitHub Desktop.
Save rshipp/b6996076c0fa3ae0e7e71eee7f0e0c48 to your computer and use it in GitHub Desktop.
Haskell helper
#!/bin/bash
name=$1
version=$(wget http://hackage.haskell.org/package/$name -qO- | grep Change\ log | sed 's,^.*<strong>\([0-9\.]*\)</strong></td></tr><tr><th>Change.*$,\1,')
echo Building $name-$version
cp -R haskell-conduit haskell-$name
cd haskell-$name
sed -i s/conduit/$name/g PKGBUILD
sed -i s/1.2.6.6/$version/g PKGBUILD
sed -i s/conduit/$name/g *.install
mv haskell-{conduit,$name}.install
../update_sums.sh
oldsums=$(sed -n '/^.*sums=(.*/,/.*)/p' PKGBUILD)
newsums=$(makepkg -g)
sed -i "/^.*sums=(.*/,/.*)$/y/${oldsums//$'\n'/\\n}/${newsums//$'\n'/\\n}/" PKGBUILD 2>/dev/null ||
sed -i "s/^.*sums=(.*).*$/${newsums/$'\n'/}/" PKGBUILD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment