Compare commits

...

2 Commits

Author SHA1 Message Date
24c36ef856 Fix failure with --isolate=dir --force
Fixes #695
2023-01-02 20:39:27 +08:00
d1075987de Fix ARM cleanup 2023-01-02 20:35:46 +08:00
3 changed files with 30 additions and 28 deletions

View File

@@ -87,39 +87,29 @@ download_cabal_cache() {
cd /tmp cd /tmp
case "${RUNNER_OS}" in case "${RUNNER_OS}" in
"Linux") "Linux")
case "${DISTRO}" in case "${ARCH}" in
"Alpine") "32") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental4/i386-linux-cabal-cache
case "${ARCH}" in
"32") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/i386-linux-alpine-cabal-cache-1.0.5.1
;;
"64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-linux-alpine-cabal-cache-1.0.5.1
;;
esac
;; ;;
*) "64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental4/x86_64-linux-cabal-cache
case "${ARCH}" in ;;
"64") url=https://github.com/haskell-works/cabal-cache/releases/download/v1.0.5.1/cabal-cache-x86_64-linux.gz "ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental4/aarch64-linux-cabal-cache
;; ;;
"ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/aarch64-linux-cabal-cache-1.0.5.1 "ARM") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental4/armv7-linux-cabal-cache
;;
"ARM") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/armv7-linux-cabal-cache-1.0.5.1
;;
esac
;; ;;
esac esac
;; ;;
"FreeBSD") "FreeBSD")
url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-freebsd-cabal-cache-1.0.5.1 url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental4/x86_64-portbld-freebsd-cabal-cache
;; ;;
"Windows") "Windows")
exe=".exe" exe=".exe"
url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-mingw64-cabal-cache-1.0.5.1.exe url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental4/x86_64-mingw64-cabal-cache
;; ;;
"macOS") "macOS")
case "${ARCH}" in case "${ARCH}" in
"ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/aarch64-apple-darwin-cabal-cache-1.0.5.1 "ARM64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental4/aarch64-apple-darwin-cabal-cache
;; ;;
"64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/1.0.5.1/x86_64-apple-darwin-cabal-cache-1.0.5.1 "64") url=https://downloads.haskell.org/~ghcup/unofficial-bindists/cabal-cache/experimental4/x86_64-apple-darwin-cabal-cache
;; ;;
esac esac
;; ;;
@@ -134,8 +124,9 @@ download_cabal_cache() {
curl -o cabal-cache${exe} -L "${url}" curl -o cabal-cache${exe} -L "${url}"
;; ;;
esac esac
chmod +x cabal-cache${exe} sha_sum cabal-cache${exe}
cp "cabal-cache${exe}" "${dest}${exe}" mv "cabal-cache${exe}" "${dest}${exe}"
chmod +x "${dest}${exe}"
fi fi
) )
} }

View File

@@ -102,7 +102,7 @@ jobs:
- uses: docker://arm64v8/ubuntu:focal - uses: docker://arm64v8/ubuntu:focal
name: Cleanup (aarch64 linux) name: Cleanup (aarch64 linux)
with: with:
args: rm -rf .ghcup/ cabal/ dist-newstyle/ out/ args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
- name: git config - name: git config
run: | run: |
@@ -297,7 +297,7 @@ jobs:
- uses: docker://arm64v8/ubuntu:focal - uses: docker://arm64v8/ubuntu:focal
name: Cleanup (aarch64 linux) name: Cleanup (aarch64 linux)
with: with:
args: rm -rf .ghcup/ cabal/ dist-newstyle/ out/ args: "find . -mindepth 1 -maxdepth 1 -exec rm -rf -- {} +"
- name: Checkout code - name: Checkout code
uses: actions/checkout@v3 uses: actions/checkout@v3
@@ -313,7 +313,7 @@ jobs:
uses: docker://hasufell/arm32v7-ubuntu-haskell:focal uses: docker://hasufell/arm32v7-ubuntu-haskell:focal
name: Run build (armv7 linux) name: Run build (armv7 linux)
with: with:
run: sh .github/scripts/test.sh args: sh .github/scripts/test.sh
env: env:
ARTIFACT: ${{ matrix.ARTIFACT }} ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }} ARCH: ${{ matrix.ARCH }}
@@ -324,7 +324,7 @@ jobs:
uses: docker://hasufell/arm64v8-ubuntu-haskell:focal uses: docker://hasufell/arm64v8-ubuntu-haskell:focal
name: Run build (aarch64 linux) name: Run build (aarch64 linux)
with: with:
run: sh .github/scripts/test.sh args: sh .github/scripts/test.sh
env: env:
ARTIFACT: ${{ matrix.ARTIFACT }} ARTIFACT: ${{ matrix.ARTIFACT }}
ARCH: ${{ matrix.ARCH }} ARCH: ${{ matrix.ARCH }}

View File

@@ -48,6 +48,7 @@ import Streamly.Internal.Data.Unfold.Type
import qualified Streamly.Internal.Data.Unfold as U import qualified Streamly.Internal.Data.Unfold as U
import Streamly.Internal.Control.Concurrent ( withRunInIO ) import Streamly.Internal.Control.Concurrent ( withRunInIO )
import Streamly.Internal.Data.IOFinalizer ( newIOFinalizer, runIOFinalizer ) import Streamly.Internal.Data.IOFinalizer ( newIOFinalizer, runIOFinalizer )
import GHC.IO.Exception (IOException(ioe_type), IOErrorType (..))
-- | On unix, we can use symlinks, so we just get the -- | On unix, we can use symlinks, so we just get the
@@ -116,8 +117,18 @@ copyFile from to fail' = do
let dflags = [ FD.oNofollow let dflags = [ FD.oNofollow
, if fail' then FD.oExcl else FD.oTrunc , if fail' then FD.oExcl else FD.oTrunc
] ]
let openFdHandle' = openFdHandle to SPI.WriteOnly dflags $ Just sourceFileMode
bracket bracket
(openFdHandle to SPI.WriteOnly dflags $ Just sourceFileMode) (handleIO (\e -> if
-- if we copy from regular file to symlink, we need
-- to delete the symlink
| ioe_type e == InvalidArgument
, not fail' -> do
removeLink to
openFdHandle'
| otherwise -> throwIO e
)
openFdHandle')
(hClose . snd) (hClose . snd)
$ \(_, tH) -> do $ \(_, tH) -> do
hSetBinaryMode fH True hSetBinaryMode fH True