Created
January 3, 2012 22:17
-
-
Save davetapley/1557244 to your computer and use it in GitHub Desktop.
If a package's sdist tarball is newer than its cabal-dev installed version, reinstall it
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
SANDBOX_DIR="cabal-dev" | |
SDIST_DIR="./sdist/" | |
SDIST_SUFFIX=".tar.gz" | |
PACKAGES_CONF_DIR=$SANDBOX_DIR"/packages-"`ghc --numeric-version`".conf/" | |
find $SDIST_DIR -name *$SDIST_SUFFIX -print0 | while read -d $'\0' sdist_path | |
do | |
file_name=${sdist_path#$SDIST_DIR} | |
package_name=${file_name%$SDIST_SUFFIX} | |
echo "Checking sdist tarball at" $sdist_path "(package is" $package_name ")" | |
find $PACKAGES_CONF_DIR -name $package_name* -print0 | while read -d $'\0' installed_sdist_path | |
do | |
echo "installed at" $installed_sdist_path | |
if [ $installed_sdist_path -nt $sdist_path ] | |
then | |
echo "... which is newer than latest sdist tarball, ignoring" | |
else | |
echo "... which is older than latest sdist tarball, re-installing" | |
cabal-dev -s $SANDBOX_DIR install $sdist_path | |
fi | |
done | |
echo | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment