Newer
Older
dub_jkp / test / prefer-add-path-packages.sh
  1. #!/usr/bin/env bash
  2.  
  3. . $(dirname ${BASH_SOURCE[0]})/common.sh
  4.  
  5. TMPDIR=$CURR_DIR/tmp-add-path
  6.  
  7. PACK_PATH="$CURR_DIR"/issue2262-exact-cached-version-match
  8.  
  9. # make sure that there are no left-over selections files or temp directory
  10. rm -f $PACK_PATH/dub.selections.json
  11. rm -rf $TMPDIR
  12.  
  13. # make sure that there are no cached versions of the dependency
  14. $DUB remove gitcompatibledubpackage@* -n || true
  15.  
  16. # build normally, should select 1.0.4
  17. if ! ${DUB} build --root $PACK_PATH | grep "gitcompatibledubpackage 1\.0\.4:"; then
  18. die $LINENO 'The initial build failed.'
  19. fi
  20.  
  21. # clone gitcompatibledubpackage and check out 1.0.4+commit.2.ccb31bf
  22. mkdir $TMPDIR
  23. $DUB add-path $TMPDIR
  24. cd $TMPDIR
  25. git clone https://github.com/dlang-community/gitcompatibledubpackage.git
  26. cd gitcompatibledubpackage
  27. git checkout -q ccb31bf6a655437176ec02e04c2305a8c7c90d67
  28. cd ../..
  29.  
  30. if ! $DUB list | grep "gitcompatibledubpackage 1\.0\.4+commit.2.gccb31bf"; then
  31. $DUB remove-path $TMPDIR
  32. die $LINENO 'Cloned package was not found in search path'
  33. fi
  34.  
  35. # should pick up the cloned package instead of the cached one now
  36. if ! ${DUB} build --root $PACK_PATH | grep "gitcompatibledubpackage 1\.0\.4+commit.2.gccb31bf:"; then
  37. $DUB remove-path $TMPDIR
  38. die $LINENO 'Did not pick up the add-path package.'
  39. fi
  40.  
  41. # clean up
  42. $DUB remove-path $TMPDIR
  43. rm -f $PACK_PATH/dub.selections.json
  44. rm -rf $TMPDIR