Changeset View
Changeset View
Standalone View
Standalone View
swh/loader/package/hackage/tests/data/fake_hackage.sh
- This file was added.
#!/usr/bin/env bash | |||||
# Script to generate fake Hackage http api response and fake Haskell package archives as .tar.gz. | |||||
set -euo pipefail | |||||
# Create directories | |||||
readonly TMP=tmp_dir/hackage | |||||
readonly BASE_API=https_hackage.haskell.org | |||||
mkdir -p $TMP | |||||
mkdir -p $BASE_API | |||||
# http api response | |||||
echo -e '''{"2.1.0.0":"normal"} | |||||
''' > ${BASE_API}/package_aeson | |||||
echo -e '''{"0.1":"normal","0.3.0.2":"normal"} | |||||
''' > ${BASE_API}/package_colors | |||||
# tar.gz package archives | |||||
# Haskell package tar.gz archive needs at least one directory with a {pkname}.cabal file | |||||
mkdir -p ${TMP}/aeson-2.1.0.0 | |||||
mkdir -p ${TMP}/colors-0.1 | |||||
mkdir -p ${TMP}/colors-0.3.0.2 | |||||
echo -e """name: aeson | |||||
version: 2.1.0.0 | |||||
license: BSD3 | |||||
license-file: LICENSE | |||||
category: Text, Web, JSON | |||||
copyright: | |||||
(c) 2011-2016 Bryan O'Sullivan | |||||
(c) 2011 MailRank, Inc. | |||||
author: Bryan O'Sullivan <bos@serpentine.com> | |||||
maintainer: Adam Bergmark <adam@bergmark.nl> | |||||
stability: experimental | |||||
tested-with: | |||||
GHC ==8.0.2 | |||||
|| ==8.2.2 | |||||
|| ==8.4.4 | |||||
|| ==8.6.5 | |||||
|| ==8.8.4 | |||||
|| ==8.10.7 | |||||
|| ==9.0.2 | |||||
|| ==9.2.3 | |||||
|| ==9.4.1 | |||||
synopsis: Fast JSON parsing and encoding | |||||
cabal-version: >=1.10 | |||||
homepage: https://github.com/haskell/aeson | |||||
bug-reports: https://github.com/haskell/aeson/issues | |||||
build-type: Simple | |||||
description: | |||||
A JSON parsing and encoding library optimized for ease of use | |||||
and high performance. | |||||
. | |||||
To get started, see the documentation for the @Data.Aeson@ module | |||||
below. | |||||
. | |||||
(A note on naming: in Greek mythology, Aeson was the father of Jason.) | |||||
extra-source-files: | |||||
*.yaml | |||||
benchmarks/json-data/*.json | |||||
cbits/*.c | |||||
changelog.md | |||||
README.markdown | |||||
src-ffi/Data/Aeson/Parser/*.hs | |||||
src-pure/Data/Aeson/Parser/*.hs | |||||
tests/golden/*.expected | |||||
tests/JSONTestSuite/test_parsing/*.json | |||||
tests/JSONTestSuite/test_transform/*.json | |||||
flag cffi | |||||
description: | |||||
Controls whether to include c-ffi bits or pure haskell. Default to False for security. | |||||
default: False | |||||
manual: True | |||||
flag ordered-keymap | |||||
description: Use ordered @Data.Map.Strict@ for KeyMap implementation. | |||||
default: True | |||||
manual: True | |||||
library | |||||
default-language: Haskell2010 | |||||
hs-source-dirs: src attoparsec-iso8601/src | |||||
exposed-modules: | |||||
Data.Aeson | |||||
Data.Aeson.Encoding | |||||
Data.Aeson.Encoding.Internal | |||||
Data.Aeson.Internal | |||||
Data.Aeson.Internal.Time | |||||
Data.Aeson.Key | |||||
Data.Aeson.KeyMap | |||||
Data.Aeson.Parser | |||||
Data.Aeson.Parser.Internal | |||||
Data.Aeson.QQ.Simple | |||||
Data.Aeson.Text | |||||
Data.Aeson.TH | |||||
Data.Aeson.Types | |||||
other-modules: | |||||
Data.Aeson.Encoding.Builder | |||||
Data.Aeson.Internal.ByteString | |||||
Data.Aeson.Internal.Functions | |||||
Data.Aeson.Internal.Text | |||||
Data.Aeson.Internal.TH | |||||
Data.Aeson.Parser.Time | |||||
Data.Aeson.Parser.Unescape | |||||
Data.Aeson.Types.Class | |||||
Data.Aeson.Types.FromJSON | |||||
Data.Aeson.Types.Generic | |||||
Data.Aeson.Types.Internal | |||||
Data.Aeson.Types.ToJSON | |||||
Data.Attoparsec.Time | |||||
Data.Attoparsec.Time.Internal | |||||
-- GHC bundled libs | |||||
build-depends: | |||||
base >=4.9.0.0 && <5 | |||||
, bytestring >=0.10.8.1 && <0.12 | |||||
, containers >=0.5.7.1 && <0.7 | |||||
, deepseq >=1.4.2.0 && <1.5 | |||||
, ghc-prim >=0.5.0.0 && <0.9 | |||||
, template-haskell >=2.11.0.0 && <2.19 | |||||
, text >=1.2.3.0 && <1.3 || >=2.0 && <2.1 | |||||
, time >=1.6.0.1 && <1.13 | |||||
-- Compat | |||||
build-depends: | |||||
base-compat-batteries >=0.10.0 && <0.13 | |||||
, generically >=0.1 && <0.2 | |||||
, time-compat >=1.9.6 && <1.10 | |||||
if !impl(ghc >=8.6) | |||||
build-depends: contravariant >=1.4.1 && <1.6 | |||||
-- Other dependencies | |||||
build-depends: | |||||
attoparsec >=0.14.2 && <0.15 | |||||
, data-fix >=0.3.2 && <0.4 | |||||
, dlist >=0.8.0.4 && <1.1 | |||||
, hashable >=1.3.5.0 && <1.5 | |||||
, indexed-traversable >=0.1.2 && <0.2 | |||||
, OneTuple >=0.3.1 && <0.4 | |||||
, primitive >=0.7.3.0 && <0.8 | |||||
, QuickCheck >=2.14.2 && <2.15 | |||||
, scientific >=0.3.7.0 && <0.4 | |||||
, semialign >=1.2 && <1.3 | |||||
, strict >=0.4 && <0.5 | |||||
, tagged >=0.8.6 && <0.9 | |||||
, text-short >=0.1.5 && <0.2 | |||||
, th-abstraction >=0.3.0.0 && <0.5 | |||||
, these >=1.1.1.1 && <1.2 | |||||
, unordered-containers >=0.2.10.0 && <0.3 | |||||
, uuid-types >=1.0.5 && <1.1 | |||||
, vector >=0.12.0.1 && <0.13 | |||||
, witherable >=0.4.2 && <0.5 | |||||
ghc-options: -Wall | |||||
if (impl(ghcjs) || !flag(cffi)) | |||||
hs-source-dirs: src-pure | |||||
other-modules: Data.Aeson.Parser.UnescapePure | |||||
else | |||||
c-sources: cbits/unescape_string.c | |||||
cpp-options: -DCFFI | |||||
hs-source-dirs: src-ffi | |||||
other-modules: Data.Aeson.Parser.UnescapeFFI | |||||
build-depends: text <2.0 | |||||
if flag(ordered-keymap) | |||||
cpp-options: -DUSE_ORDEREDMAP=1 | |||||
test-suite aeson-tests | |||||
default-language: Haskell2010 | |||||
type: exitcode-stdio-1.0 | |||||
hs-source-dirs: tests | |||||
main-is: Tests.hs | |||||
ghc-options: -Wall -threaded -rtsopts | |||||
other-modules: | |||||
DataFamilies.Encoders | |||||
DataFamilies.Instances | |||||
DataFamilies.Properties | |||||
DataFamilies.Types | |||||
Encoders | |||||
ErrorMessages | |||||
Functions | |||||
Instances | |||||
Options | |||||
Properties | |||||
PropertyGeneric | |||||
PropertyKeys | |||||
PropertyQC | |||||
PropertyRoundTrip | |||||
PropertyRTFunctors | |||||
PropertyTH | |||||
PropUtils | |||||
SerializationFormatSpec | |||||
Types | |||||
UnitTests | |||||
UnitTests.NullaryConstructors | |||||
build-depends: | |||||
aeson | |||||
, attoparsec | |||||
, base | |||||
, base-compat | |||||
, base-orphans >=0.5.3 && <0.9 | |||||
, base16-bytestring | |||||
, bytestring | |||||
, containers | |||||
, data-fix | |||||
, Diff >=0.4 && <0.5 | |||||
, directory | |||||
, dlist | |||||
, filepath | |||||
, generic-deriving >=1.10 && <1.15 | |||||
, generically | |||||
, ghc-prim >=0.2 | |||||
, hashable | |||||
, indexed-traversable | |||||
, integer-logarithms >=1 && <1.1 | |||||
, OneTuple | |||||
, primitive | |||||
, QuickCheck >=2.14.2 && <2.15 | |||||
, quickcheck-instances >=0.3.26.1 && <0.4 | |||||
, scientific | |||||
, strict | |||||
, tagged | |||||
, tasty | |||||
, tasty-golden | |||||
, tasty-hunit | |||||
, tasty-quickcheck | |||||
, template-haskell | |||||
, text | |||||
, text-short | |||||
, these | |||||
, time | |||||
, time-compat | |||||
, unordered-containers | |||||
, uuid-types | |||||
, vector | |||||
source-repository head | |||||
type: git | |||||
location: git://github.com/haskell/aeson.git | |||||
""" > ${TMP}/aeson-2.1.0.0/aeson.cabal | |||||
echo -e """-- Initial colors.cabal generated by cabal init. For further | |||||
-- documentation, see http://haskell.org/cabal/users-guide/ | |||||
name: colors | |||||
version: 0.1 | |||||
synopsis: A type for colors | |||||
-- description: | |||||
homepage: https://github.com/fumieval/colors | |||||
license: BSD3 | |||||
license-file: LICENSE | |||||
author: Fumiaki Kinoshita | |||||
maintainer: Fumiaki Kinoshita <fumiexcel@gmail.com> | |||||
-- copyright: | |||||
category: Data | |||||
build-type: Simple | |||||
cabal-version: >=1.8 | |||||
source-repository head | |||||
type: git | |||||
location: https://github.com/fumieval/colors.git | |||||
library | |||||
exposed-modules: Data.Color, Data.Color.Names, Data.Color.Class | |||||
-- other-modules: | |||||
build-depends: base ==4.*, profunctors ==3.* | |||||
""" > ${TMP}/colors-0.1/colors.cabal | |||||
echo -e """name: colors | |||||
version: 0.3.0.2 | |||||
synopsis: A type for colors | |||||
-- description: | |||||
homepage: https://github.com/fumieval/colors | |||||
license: BSD3 | |||||
license-file: LICENSE | |||||
author: Fumiaki Kinoshita | |||||
maintainer: Fumiaki Kinoshita <fumiexcel@gmail.com> | |||||
copyright: Copyright (C) 2013 Fumiaki Kinoshita | |||||
category: Data | |||||
build-type: Simple | |||||
cabal-version: >=1.8 | |||||
source-repository head | |||||
type: git | |||||
location: https://github.com/fumieval/colors.git | |||||
library | |||||
exposed-modules: Data.Color, Data.Color.Names, Data.Color.Class | |||||
-- other-modules: | |||||
build-depends: base ==4.*, profunctors >= 3 && < 5, linear, lens >= 4.0 && <5 | |||||
""" > ${TMP}/colors-0.3.0.2/colors.cabal | |||||
cd $TMP | |||||
tar -czf package_aeson-2.1.0.0_aeson-2.1.0.0.tar.gz aeson-2.1.0.0 | |||||
tar -czf package_colors-0.1_colors-0.1.tar.gz colors-0.1 | |||||
tar -czf package_colors-0.3.0.2_colors-0.3.0.2.tar.gz colors-0.3.0.2 | |||||
# Move .tar.gz archives to a servable directory | |||||
mv *.tar.gz ../../$BASE_API | |||||
# Clean up removing tmp_dir | |||||
cd ../../ | |||||
rm -r tmp_dir/ |