diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..bfe127253e2 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# See: https://editorconfig.org +root = true + +[*] +charset = utf-8 + +[*.hs] +indent_style = space +indent_size = 2 + +[Makefile] +indent_style = tab diff --git a/.github/dependabot.yml b/.github/dependabot.yml index b3b2315d909..b1c8bd9d9d8 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -13,3 +13,4 @@ updates: schedule: # Check for updates to GitHub Actions every week interval: "weekly" + diff --git a/.github/mergify.yml b/.github/mergify.yml index 4a1efe926a8..e01afbd5ed2 100644 --- a/.github/mergify.yml +++ b/.github/mergify.yml @@ -1,3 +1,22 @@ +# Note: We do not use the rebase strategy to merge PRs, because that +# loses information needed by changelog-d to associate commits with PRs. + +priority_rules: + + - name: high priority + conditions: + - 'label=priority: high :fire:' + priority: high + + # The idea is we slightly prioritize those PRs because we're in + # a release cycle if a PR matches. + - name: release branch + conditions: + - 'base~=^3\.' + - 'label!=backport' + # 'normal' is 2000, 'high' is 3000 + priority: 2500 + pull_request_rules: # implementing PR delay logic: apply a label after 2 days of inactivity @@ -8,42 +27,89 @@ pull_request_rules: - merge delay passed name: Wait for 2 days before validating merge conditions: - - updated-at<2 days ago + - or: + - 'label=priority: high :fire:' + - updated-at<2 days ago + - or: + - label=merge me + - label=squash+merge me + - label=merge+no rebase + - '#approved-reviews-by>=2' + + # label when Mergify is ready but waiting for the above + - actions: + label: + add: + - ready and waiting + name: Waiting out merge delay (used by bot) + conditions: + - base=master + - -draft + - -closed - or: - label=merge me - label=squash+merge me - label=merge+no rebase - '#approved-reviews-by>=2' + - '#changes-requested-reviews-by=0' + # oy + # lifted these from branch protection imports + - check-success=fourmolu + - check-success=hlint + - check-success=Meta checks + - check-success=Doctest Cabal + - check-success=Validate post job + - check-success=Bootstrap post job + - 'check-success=docs/readthedocs.org:cabal' + + # label when Mergify didn't trigger a merge automatically + - actions: + label: + add: + - waiting too long + name: Mergify hasn't merged a PR yet + conditions: + - base=master + - -draft + - -closed + - -merged + - '#approved-reviews-by>=2' + - '#changes-requested-reviews-by=0' + - updated-at<4 days ago + - label=merge delay passed + # oy + # lifted these from branch protection imports + - check-success=fourmolu + - check-success=hlint + - check-success=Meta checks + - check-success=Doctest Cabal + - check-success=Validate post job + - check-success=Bootstrap post job + - 'check-success=docs/readthedocs.org:cabal' # rebase+merge strategy - actions: queue: name: default - # Merge into master with a merge commit - method: merge - # Update the pr branch with rebase, so the history is clean - update_method: rebase name: Put pull requests in the rebase+merge queue conditions: - base=master - label=merge me - label=merge delay passed - '#approved-reviews-by>=2' + - '-label~=^blocked:' # merge+squash strategy - actions: queue: - name: default - method: squash - # both update methods get absorbed by the squash, so we use the most - # reliable - update_method: merge + name: squash-merge name: Put pull requests in the squash+merge queue conditions: - base=master - label=squash+merge me - label=merge delay passed - '#approved-reviews-by>=2' + - '-label~=^blocked:' # merge+no rebase strategy - actions: @@ -55,36 +121,55 @@ pull_request_rules: - label=merge+no rebase - label=merge delay passed - '#approved-reviews-by>=2' + - '-label~=^blocked:' - # rebase+merge strategy for backports: require 1 approver instead of 2 + # merge strategy for release branches + - actions: + queue: + name: default + name: Put release branch pull requests in the rebase+merge queue + conditions: + - label=merge me + - base!=master + - -body~=backport + - '#approved-reviews-by>=2' + - '-label~=^blocked:' + + # merge+squash strategy for release branches + - actions: + queue: + name: squash-merge + name: Put release branch pull requests in the squash+merge queue + conditions: + - base!=master + - label=squash+merge me + - -body~=backport + - '#approved-reviews-by>=2' + - '-label~=^blocked:' + + # merge strategy for backports: require 1 approver instead of 2 - actions: queue: name: default - # Merge with a merge commit - method: merge - # Update the pr branch with rebase, so the history is clean - update_method: rebase name: Put backports in the rebase+merge queue conditions: - label=merge me - base!=master - body~=backport - '#approved-reviews-by>=1' + - '-label~=^blocked:' # merge+squash strategy for backports: require 1 approver instead of 2 - actions: queue: - name: default - method: squash - # both update methods get absorbed by the squash, so we use the most - # reliable - update_method: merge + name: squash-merge name: Put backports in the squash+merge queue conditions: - label=squash+merge me - base!=master - body~=backport - '#approved-reviews-by>=1' + - '-label~=^blocked:' # backports should be labeled as such - actions: @@ -96,5 +181,18 @@ pull_request_rules: - body~=automatic backport queue_rules: + # Mergify now requires different queues for different strategies - name: default update_bot_account: Mikolaj + merge_method: merge + update_method: rebase + + - name: squash-merge + update_bot_account: Mikolaj + merge_method: squash + update_method: merge + +defaults: + actions: + backport: + title: "Backport #{{ number }}: {{ title }}" diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 098deef816c..e6576b7d92d 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -8,6 +8,7 @@ Include the following checklist in your PR: * [ ] Patches conform to the [coding conventions](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#other-conventions). * [ ] Any changes that could be relevant to users [have been recorded in the changelog](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#changelog). + * [ ] [Is the change significant?](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#is-my-change-significant) If so, remember to add `significance: significant` in the changelog file. * [ ] The documentation has been updated, if necessary. * [ ] [Manual QA notes](https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#qa-notes) have been included. * [ ] Tests have been added. (*Ask for help if you don’t know how to write them! Ask for an exemption if tests are too complex for too little coverage!*) diff --git a/.github/workflows/bootstrap.skip.yml b/.github/workflows/bootstrap.skip.yml index 3a47870b533..40ccb0ae9bc 100644 --- a/.github/workflows/bootstrap.skip.yml +++ b/.github/workflows/bootstrap.skip.yml @@ -19,6 +19,11 @@ on: - 'doc/**' - '**/README.md' - 'CONTRIBUTING.md' + - "changelog.d/**" + # only top level for these, because various test packages have them too + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" branches: - master pull_request: @@ -26,6 +31,10 @@ on: - 'doc/**' - '**/README.md' - 'CONTRIBUTING.md' + - "changelog.d/**" + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" release: types: - created diff --git a/.github/workflows/bootstrap.yml b/.github/workflows/bootstrap.yml index 56970448239..d85b2ae4f12 100644 --- a/.github/workflows/bootstrap.yml +++ b/.github/workflows/bootstrap.yml @@ -14,6 +14,11 @@ on: - 'doc/**' - '**/README.md' - 'CONTRIBUTING.md' + - "changelog.d/**" + # only top level for these, because various test packages have them too + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" branches: - master pull_request: @@ -21,6 +26,10 @@ on: - 'doc/**' - '**/README.md' - 'CONTRIBUTING.md' + - "changelog.d/**" + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" release: types: - created @@ -30,7 +39,7 @@ jobs: strategy: matrix: os: [ubuntu-latest] - ghc: ["8.10.7", "9.0.2", "9.2.8", "9.4.8", "9.6.4", "9.8.2"] + ghc: ["9.0.2", "9.2.8", "9.4.8", "9.6.6", "9.8.2"] include: - os: macos-latest ghc: "9.2.8" @@ -43,7 +52,7 @@ jobs: rm -rf ~/.config/cabal rm -rf ~/.cache/cabal - - uses: actions/cache@v3 + - uses: actions/cache@v4 name: Cache the downloads id: bootstrap-cache with: @@ -69,7 +78,7 @@ jobs: run: | _build/bin/cabal --version - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: cabal-${{ matrix.os }}-${{ matrix.ghc }}-bootstrapped path: _build/artifacts/* diff --git a/.github/workflows/changelogs.yml b/.github/workflows/changelogs.yml index 922c0cf46f9..388739dfb19 100644 --- a/.github/workflows/changelogs.yml +++ b/.github/workflows/changelogs.yml @@ -26,43 +26,13 @@ jobs: steps: - # Cannot install changelog-d directly from remote tarball due to - # https://github.com/haskell/cabal/issues/7360 - # Also, we would like to get the build plan for the cache key. - - name: Fetch changelog-d - run: | - changelog_d_latest="$(curl https://codeberg.org/api/v1/repos/fgaz/changelog-d/branches/master | jq -r .commit.id)" - echo "Using changelog-d revision $changelog_d_latest" - curl "https://codeberg.org/fgaz/changelog-d/archive/$changelog_d_latest.tar.gz" -o changelog-d.tar.gz - tar -xf changelog-d.tar.gz - - - name: Update Hackage index - run: cabal v2-update - - - name: Build plan for changelog-d - working-directory: changelog-d - run: | - cabal v2-build --dry-run --allow-newer=changelog-d:base - - - name: Restore dependencies of changelog-d - uses: actions/cache/restore@v4 - id: cache - with: - path: ~/.local/state/cabal - key: linux-store-changelogs-${{ hashfiles('changelog-d/dist-newstyle/cache/plan.json') }} - restore-keys: linux-store-changelogs - - name: Install changelog-d - working-directory: changelog-d run: | - cabal v2-install --allow-newer=changelog-d:base - - - name: Cache dependencies of changelog-d - uses: actions/cache/save@v4 - if: always() && steps.cache.outputs.cache-hit != 'true' - with: - path: ~/.local/state/cabal - key: ${{ steps.cache.outputs.cache-primary-key }} + curl --create-dirs -o "$HOME/.local/bin/changelog-d" -sS --fail \ + "https://codeberg.org/fgaz/changelog-d/releases/download/v1.0.1/changelog-d-v1.0.1-x86_64-linux" + chmod +x "$HOME/.local/bin/changelog-d" + # https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path + echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Checkout cabal sources uses: actions/checkout@v4 diff --git a/.github/workflows/check-sdist.skip.yml b/.github/workflows/check-sdist.skip.yml new file mode 100644 index 00000000000..522c9896f0d --- /dev/null +++ b/.github/workflows/check-sdist.skip.yml @@ -0,0 +1,48 @@ +name: Check sdist Skip + +# This Workflow is special and contains a workaround for a known limitation of GitHub CI. +# +# The problem: We don't want to run the "check sdist" jobs on PRs which contain only changes +# to the docs, since these jobs take a long time to complete without providing any benefit. +# We therefore use path-filtering in the workflow triggers for the check sdist jobs, namely +# "paths-ignore: doc/**". But the "Check sdist post job" is a required job, therefore a PR cannot +# be merged unless the "Bootstrap post job" completes succesfully, which it doesn't do if we +# filter it out. +# +# The solution: We use a second job with the same name which always returns the exit code 0. +# The logic implemented for "required" workflows accepts if 1) at least one job with that name +# runs through, AND 2) If multiple jobs of that name exist, then all jobs of that name have to +# finish successfully. +on: + push: + paths: + - 'doc/**' + - '**/README.md' + - 'CONTRIBUTING.md' + - "changelog.d/**" + # only top level for these, because various test packages have them too + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" + branches: + - master + pull_request: + paths: + - 'doc/**' + - '**/README.md' + - 'CONTRIBUTING.md' + - "changelog.d/**" + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" + release: + types: + - created + +jobs: + check-sdist-post-job: + if: always() + name: Check sdist post job + runs-on: ubuntu-latest + steps: + - run: exit 0 diff --git a/.github/workflows/check-sdist.yml b/.github/workflows/check-sdist.yml new file mode 100644 index 00000000000..f9349238310 --- /dev/null +++ b/.github/workflows/check-sdist.yml @@ -0,0 +1,99 @@ +name: Check sdist + +# See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. +concurrency: + group: ${{ github.ref }}-${{ github.workflow }} + cancel-in-progress: true + +on: + push: + paths-ignore: + - "doc/**" + - "**/README.md" + - "CONTRIBUTING.md" + - "changelog.d/**" + # only top level for these, because various test packages have them too + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" + branches: + - master + pull_request: + paths-ignore: + - "doc/**" + - "**/README.md" + - "CONTRIBUTING.md" + - "changelog.d/**" + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" + release: + types: + - created + +jobs: + + # Dogfood the generated sdist, to avoid bugs like https://github.com/haskell/cabal/issues/9833 + # No caching, since the point is to verify they can be installed "from scratch" + # Don't run on master or a PR targeting master, because there's never an installable Cabal + dogfood-sdists: + name: Dogfood sdist on ghc-${{ matrix.ghc }} + if: github.ref != 'refs/heads/master' && github.base_ref != 'master' + runs-on: ubuntu-latest + strategy: + matrix: + # this should be kept up to date with the list in validate.yml, but should be the + # *first* compiler release so we validate against what is hopefully the first + # release of a corresponding Cabal and friends. it can also be short since it's + # highly unlikely that we are releasing really old branches. + ghc: + ["9.12.1", "9.10.1", "9.8.1", "9.6.1"] + + steps: + + - uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ matrix.ghc }} + cabal-version: latest + + - uses: actions/checkout@v4 + + - name: Make sdist + run: cabal sdist cabal-install + + - name: Install from sdist + run: | + # skip if a suitable Cabal isn't in this ghc's bootlibs, since that's the case + # that causes failures for users (otherwise cabal-install will install a matching + # version itself) + # we only want to test cabal-install, to ensure that it works with existing Cabals + # (don't look at this too closely) + sdist="$(ls dist-newstyle/sdist/cabal-install-*.tar.gz | sed -n '\,^dist-newstyle/sdist/cabal-install-[0-9.]*\.tar\.gz$,{;p;q;}')" + # extract the cabal-install major version + ver="$(echo "$sdist" | sed -n 's,^dist-newstyle/sdist/cabal-install-\([0-9][0-9]*\.[0-9][0-9]*\)\.[0-9.]*\.tar\.gz$,\1,p')" + # dunno if this will ever be extended to freebsd, but grep -q is a gnu-ism + if ghc-pkg --global --simple-output list Cabal | grep "^Cabal-$ver\\." >/dev/null; then + # sigh, someone broke installing from tarballs + rm -rf cabal*.project Cabal Cabal-syntax cabal-install-solver cabal-install + tar xfz "$sdist" + cd "cabal-install-$cbl"* + cabal install + else + echo No matching bootlib Cabal version to test against. + exit 0 + fi + + check-sdist-post-job: + if: always() + name: Check sdist post job + runs-on: ubuntu-latest + # IMPORTANT! Any job added to the workflow should be added here too + needs: [dogfood-sdists] + + steps: + - run: | + echo "jobs info: ${{ toJSON(needs) }}" + - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: exit 1 + diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml new file mode 100644 index 00000000000..6219653e4fe --- /dev/null +++ b/.github/workflows/dependabot.yml @@ -0,0 +1,17 @@ +# copied from https://github.com/ubuntu/authd/commit/3f9df8f21d952cd33fd44d3834d0edeec1f5766f + +name: Dependabot rules validation + +on: + pull_request: + paths: + - '.github/dependabot.yml' + +jobs: + validate: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: marocchino/validate-dependabot@v3 + id: validate diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index d54310be613..11f4c4ce5d2 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -10,10 +10,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: haskell-actions/run-fourmolu@v10 + - uses: haskell-actions/run-fourmolu@v11 with: version: "0.12.0.0" pattern: | Cabal/**/*.hs Cabal-syntax/**/*.hs cabal-install/**/*.hs + cabal-validate/**/*.hs diff --git a/.github/workflows/quick-jobs.yml b/.github/workflows/quick-jobs.yml index 87204a291f1..82c3fbd1244 100644 --- a/.github/workflows/quick-jobs.yml +++ b/.github/workflows/quick-jobs.yml @@ -14,6 +14,9 @@ on: types: - created +env: + GHC_FOR_QUICK_JOBS: 9.6.5 + jobs: meta: name: Meta checks @@ -25,15 +28,13 @@ jobs: gen-paths-module gen-spdx gen-spdx-exc - # This job is not run in a container, any recent GHC should be fine steps: - # SKIP installation of ghc and cabal and use the preinstalled versions. - # - name: ghcup - # run: | - # ghcup --version - # ghcup config set cache true - # ghcup install ghc recommended - # ghcup set ghc recommended + - name: Install primary compiler + uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ env.GHC_FOR_QUICK_JOBS }} + cabal-version: latest - name: Haskell versions run: | ghc --version @@ -71,6 +72,16 @@ jobs: name: Doctest Cabal runs-on: ubuntu-latest steps: + - name: Install primary compiler + uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ env.GHC_FOR_QUICK_JOBS }} + cabal-version: latest + - name: Haskell versions + run: | + ghc --version + cabal --version # It is complicated to get a proper cache key for the dependencies of a package # (here: doctest) that we just `cabal install`. # So, as a heuristics we update the cache once per day. @@ -106,6 +117,16 @@ jobs: env: cabal_build: cabal build buildinfo-reference-generator steps: + - name: Install primary compiler + uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ env.GHC_FOR_QUICK_JOBS }} + cabal-version: latest + - name: Haskell versions + run: | + ghc --version + cabal --version - name: Update Hackage index run: cabal v2-update - uses: actions/checkout@v4 @@ -133,6 +154,16 @@ jobs: name: Check Release Project runs-on: ubuntu-latest steps: + - name: Install primary compiler + uses: haskell-actions/setup@v2 + id: setup-haskell + with: + ghc-version: ${{ env.GHC_FOR_QUICK_JOBS }} + cabal-version: latest + - name: Haskell versions + run: | + ghc --version + cabal --version - name: Update Hackage Index run: cabal v2-update - uses: actions/checkout@v4 diff --git a/.github/workflows/typos.yml b/.github/workflows/typos.yml new file mode 100644 index 00000000000..ab16dc1bf35 --- /dev/null +++ b/.github/workflows/typos.yml @@ -0,0 +1,32 @@ +name: Typos + +on: + pull_request: + push: + branches: ["master"] + +env: + TYPOS_VER: v1.28.1 + TYPOS_PLATFORM: x86_64-unknown-linux-musl + +jobs: + typos: + defaults: + run: + shell: bash + runs-on: ubuntu-latest + + steps: + + - uses: actions/checkout@v4 + + - run: | + wget -q https://github.com/crate-ci/typos/releases/download/${{ env.TYPOS_VER }}/typos-${{ env.TYPOS_VER }}-${{ env.TYPOS_PLATFORM }}.tar.gz + tar -xf typos-${{ env.TYPOS_VER }}-${{ env.TYPOS_PLATFORM }}.tar.gz --one-top-level=typos-${{ env.TYPOS_VER }} + mkdir -p "$HOME/.local/bin" + mv typos-${{ env.TYPOS_VER }} "$HOME/.local/bin/typos-${{ env.TYPOS_VER }}" + chmod +x "$HOME/.local/bin/typos-${{ env.TYPOS_VER }}/typos" + echo "$HOME/.local/bin/typos-${{ env.TYPOS_VER }}" >> $GITHUB_PATH + + - run: make users-guide-typos + - run: make markdown-typos diff --git a/.github/workflows/users-guide.yml b/.github/workflows/users-guide.yml index 8047ede1031..64969e427c4 100644 --- a/.github/workflows/users-guide.yml +++ b/.github/workflows/users-guide.yml @@ -15,7 +15,6 @@ on: - 'doc/Makefile' - 'doc/pyproject.toml' - 'doc/requirements.in' - - 'doc/requirements.txt' - 'doc/*.inc' - 'doc/*.py' - 'doc/*.rst' @@ -26,7 +25,6 @@ on: - 'doc/Makefile' - 'doc/pyproject.toml' - 'doc/requirements.in' - - 'doc/requirements.txt' - 'doc/*.inc' - 'doc/*.py' - 'doc/*.rst' @@ -58,6 +56,14 @@ jobs: with: python-version: ${{ matrix.python-version }} + - name: Install pip-compile + run: | + pip install pip-tools + + - name: Create requirements.txt from requirements.in + run: | + make users-guide-requirements + # Subsumed by make users-guide # - name: Install dependencies # run: | @@ -67,7 +73,7 @@ jobs: run: | make SPHINX_HTML_OUTDIR=html users-guide - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: users-guide-html path: html/ diff --git a/.github/workflows/validate.skip.yml b/.github/workflows/validate.skip.yml index af608e92d49..f4aa50ae191 100644 --- a/.github/workflows/validate.skip.yml +++ b/.github/workflows/validate.skip.yml @@ -19,6 +19,11 @@ on: - 'doc/**' - '**/README.md' - 'CONTRIBUTING.md' + - "changelog.d/**" + # only top level for these, because various test packages have them too + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" branches: - master pull_request: @@ -26,6 +31,10 @@ on: - 'doc/**' - '**/README.md' - 'CONTRIBUTING.md' + - "changelog.d/**" + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" release: types: - created diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index bc765b59ba9..daa0811440d 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -1,11 +1,5 @@ name: Validate -# We use bash as default even in windows -# to try keep the workflow as uniform as possible -defaults: - run: - shell: bash - # See: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency. concurrency: group: ${{ github.ref }}-${{ github.workflow }} @@ -17,16 +11,27 @@ concurrency: on: push: paths-ignore: - - 'doc/**' - - '**/README.md' - - 'CONTRIBUTING.md' + - "doc/**" + - "**/README.md" + - "CONTRIBUTING.md" + - "changelog.d/**" + # only top level for these, because various test packages have them too + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" branches: - master + # hardcoded LTS branch, change when new LTS released! + - '3.12' pull_request: paths-ignore: - - 'doc/**' - - '**/README.md' - - 'CONTRIBUTING.md' + - "doc/**" + - "**/README.md" + - "CONTRIBUTING.md" + - "changelog.d/**" + - "*/ChangeLog.md" + - "*/changelog.md" + - "release-notes/**" release: types: - created @@ -37,73 +42,115 @@ on: inputs: allow-newer: description: allow-newer line - required: true + required: false type: string constraints: description: constraints line - required: true + required: false type: string env: # We choose a stable ghc version across all os's # which will be used to do the next release - GHC_FOR_RELEASE: '9.4.8' + GHC_FOR_RELEASE: "9.4.8" # Ideally we should use the version about to be released for hackage tests and benchmarks - GHC_FOR_SOLVER_BENCHMARKS: '9.4.8' - GHC_FOR_COMPLETE_HACKAGE_TESTS: '9.4.8' - COMMON_FLAGS: '-j 2 -v' + GHC_FOR_SOLVER_BENCHMARKS: "9.4.8" + GHC_FOR_COMPLETE_HACKAGE_TESTS: "9.4.8" + COMMON_FLAGS: "-j 2 -v" # See https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#hackage-revisions ALLOWNEWER: ${{ github.event.inputs.allow-newer }} CONSTRAINTS: ${{ github.event.inputs.constraints }} - jobs: validate: - name: Validate ${{ matrix.os }} ghc-${{ matrix.ghc }} - runs-on: ${{ matrix.os }} + name: Validate ${{ matrix.sys.os }} ghc-${{ matrix.ghc }} + runs-on: ${{ matrix.sys.os }} outputs: GHC_FOR_RELEASE: ${{ format('["{0}"]', env.GHC_FOR_RELEASE) }} strategy: + fail-fast: false matrix: - os: [ubuntu-latest, macos-13, windows-latest] + sys: + - { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" } + - { os: ubuntu-22.04, shell: bash } + - { os: macos-latest, shell: bash } # If you remove something from here, then add it to the old-ghcs job. # Also a removed GHC from here means that we are actually dropping # support, so the PR *must* have a changelog entry. - ghc: ['9.8.2', '9.6.4', '9.4.8', '9.2.8', '9.0.2', '8.10.7', '8.8.4', '8.6.5'] + ghc: + [ + "9.12.1", + "9.10.1", + "9.8.4", + "9.6.6", + "9.4.8", + "9.2.8", + "9.0.2", + "8.10.7", + "8.8.4", + ] exclude: + # Throws fatal "cabal-tests.exe: fd:8: hGetLine: end of file" exception + # even with --io-manager=native + - sys: + { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" } + ghc: "9.0.2" # corrupts GHA cache or the fabric of reality itself, see https://github.com/haskell/cabal/issues/8356 - - os: windows-latest - ghc: '8.10.7' + - sys: + { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" } + ghc: "8.10.7" # lot of segfaults caused by ghc bugs - - os: windows-latest - ghc: '8.8.4' - # it often randomly does "C:\Users\RUNNER~1\AppData\Local\Temp\ghcFEDE.c: DeleteFile "\\\\?\\C:\\Users\\RUNNER~1\\AppData\\Local\\Temp\\ghcFEDE.c": permission denied (Access is denied.)" - - os: windows-latest - ghc: '8.6.5' - + - sys: + { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" } + ghc: "8.8.4" + # ghc before 8.10.5 doesn't run on AArch64 + # 9.0.2 suffers from https://gitlab.haskell.org/ghc/ghc/-/issues/20592 + # 8.10.7 throws asm errors in hashable's cbits suggesting the runner doesn't + # support a CPU extension for hardware SHA; may be fixable with flags + - sys: + { os: macos-latest, shell: bash } + ghc: "9.0.2" + - sys: + { os: macos-latest, shell: bash } + ghc: "8.10.7" + - sys: + { os: macos-latest, shell: bash } + ghc: "8.8.4" + defaults: + run: + shell: ${{ matrix.sys.shell }} steps: - - name: Work around XDG directories existence (haskell-actions/setup#62) if: runner.os == 'macOS' run: | rm -rf ~/.config/cabal rm -rf ~/.cache/cabal + - name: "WIN: Setup TMP environment variable" + if: runner.os == 'Windows' + run: | + echo "TMP=${{ runner.temp }}" >> "$GITHUB_ENV" + - uses: actions/checkout@v4 # See https://github.com/haskell/cabal/blob/master/CONTRIBUTING.md#hackage-revisions - - name: Manually supplied constraints/allow-newer - if: github.event_name == 'workflow_dispatch' + - name: Add manually supplied allow-newer + if: github.event_name == 'workflow_dispatch' && github.event.inputs.allow-newer != '' run: | - echo "allow-newer: ${ALLOWNEWER}" >> cabal.validate.project - echo "constraints: ${CONSTRAINTS}" >> cabal.validate.project + echo "allow-newer: ${{ github.event.inputs.allow-newer }}" >> cabal.validate.project + + - name: Add manually supplied constraints + if: github.event_name == 'workflow_dispatch' && github.event.inputs.constraints != '' + run: | + echo "constraints: ${{ github.event.inputs.constraints }}" >> cabal.validate.project - uses: haskell-actions/setup@v2 id: setup-haskell with: ghc-version: ${{ matrix.ghc }} - cabal-version: latest # latest is mandatory for cabal-testsuite, see https://github.com/haskell/cabal/issues/8133 + cabal-version: 3.12.1.0 # see https://github.com/haskell/cabal/pull/10251 + ghcup-release-channel: https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.8.yaml # See the following link for a breakdown of the following step # https://github.com/haskell/actions/issues/7#issuecomment-745697160 @@ -116,9 +163,6 @@ jobs: key: ${{ runner.os }}-${{ matrix.ghc }}-${{ github.sha }} restore-keys: ${{ runner.os }}-${{ matrix.ghc }}- - - name: Work around git problem https://bugs.launchpad.net/ubuntu/+source/git/+bug/1993586 (cabal PR #8546) - run: git config --global protocol.file.allow always - # The tool is not essential to the rest of the test suite. If # hackage-repo-tool is not present, any test that requires it will # be skipped. @@ -129,10 +173,15 @@ jobs: run: cabal install --ignore-project hackage-repo-tool # Needed by cabal-testsuite/PackageTests/Configure/setup.test.hs - - name: Install Autotools + - name: "MAC: Install Autotools" if: runner.os == 'macOS' run: brew install automake + # Needed by cabal-testsuite/PackageTests/Configure/setup.test.hs + - name: "WIN: Install Autotools" + if: runner.os == 'Windows' + run: /usr/bin/pacman --noconfirm -S autotools + - name: Set validate inputs run: | FLAGS="${{ env.COMMON_FLAGS }}" @@ -144,15 +193,19 @@ jobs: fi echo "FLAGS=$FLAGS" >> "$GITHUB_ENV" - - name: Validate print-config - run: sh validate.sh $FLAGS -s print-config - - - name: Validate print-tool-versions - run: sh validate.sh $FLAGS -s print-tool-versions - - name: Validate build run: sh validate.sh $FLAGS -s build + - name: Canonicalize architecture + run: | + case ${{ runner.arch }} in + X86) arch=i386 ;; + X64) arch=x86_64 ;; + ARM64) arch=aarch64 ;; + *) echo "Unsupported architecture, please fix validate.yaml" 2>/dev/null; exit 1 ;; + esac + echo "CABAL_ARCH=$arch" >> "$GITHUB_ENV" + - name: Tar cabal head executable if: matrix.ghc == env.GHC_FOR_RELEASE run: | @@ -171,7 +224,7 @@ jobs: fi DIR=$(dirname "$CABAL_EXEC") FILE=$(basename "$CABAL_EXEC") - CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-x86_64.tar.gz" + CABAL_EXEC_TAR="cabal-head-${{ runner.os }}-$CABAL_ARCH.tar.gz" tar -czvf "$CABAL_EXEC_TAR" -C "$DIR" "$FILE" echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> "$GITHUB_ENV" @@ -180,50 +233,50 @@ jobs: # - Make it available in the workflow to make easier testing it locally - name: Upload cabal-install executable to workflow artifacts if: matrix.ghc == env.GHC_FOR_RELEASE - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: - name: cabal-${{ runner.os }}-x86_64 + name: cabal-${{ runner.os }}-${{ env.CABAL_ARCH }} path: ${{ env.CABAL_EXEC_TAR }} - - name: Validate lib-tests + - name: Validate tests env: # `rawSystemStdInOut reports text decoding errors` # test does not find ghc without the full path in windows GHCPATH: ${{ steps.setup-haskell.outputs.ghc-exe }} - run: sh validate.sh $FLAGS -s lib-tests - - - name: Validate lib-suite - run: sh validate.sh $FLAGS -s lib-suite - - - name: Validate cli-tests - run: sh validate.sh $FLAGS -s cli-tests - - - name: Validate cli-suite - run: sh validate.sh $FLAGS -s cli-suite - - - name: Validate solver-benchmarks-tests - if: matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS - run: sh validate.sh $FLAGS -s solver-benchmarks-tests - - - name: Validate solver-benchmarks-run - if: matrix.ghc == env.GHC_FOR_SOLVER_BENCHMARKS - run: sh validate.sh $FLAGS -s solver-benchmarks-run - + run: | + set +e + rc=0 + tests="lib-tests lib-suite cli-tests cli-suite" + if [ "${{ matrix.ghc }}" = "${{ env.GHC_FOR_SOLVER_BENCHMARKS }}" ]; then + tests="$tests solver-benchmarks-tests solver-benchmarks-run" + fi + for test in $tests; do + echo Validate "$test" + sh validate.sh $FLAGS -s "$test" || rc=1 + echo End "$test" + done + exit $rc + # The above ensures all the tests get run, for a single platform+ghc. + # Trying to ensure they run for *all* combinations but still fail + # at the end seems to be extremely difficult at best. It's doable, + # but it requires a continuously growing stack of conditions and + # one possibly nightmarish final conditional. 'fail-fast' gets us + # partway there, at least, but is still imperfect. validate-old-ghcs: name: Validate old ghcs ${{ matrix.extra-ghc }} - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 needs: validate strategy: matrix: - extra-ghc: ['8.4.4', '8.2.2', '8.0.2'] + extra-ghc: + ["8.4.4", "8.2.2", "8.0.2"] ## GHC 7.10.3 does not install on ubuntu-22.04 with ghcup. ## Older GHCs are not supported by ghcup in the first place. fail-fast: false steps: - - uses: actions/checkout@v4 - name: Install prerequisites for old GHCs @@ -262,17 +315,20 @@ jobs: restore-keys: ${{ runner.os }}-${{ env.GHC_FOR_RELEASE }}- - name: Validate build + id: build run: sh validate.sh ${{ env.COMMON_FLAGS }} -s build - name: "Validate lib-suite-extras --extra-hc ghc-${{ matrix.extra-ghc }}" env: EXTRA_GHC: ghc-${{ matrix.extra-ghc }} run: sh validate.sh ${{ env.COMMON_FLAGS }} --lib-only -s lib-suite-extras --extra-hc "${{ env.EXTRA_GHC }}" + # See the comment above about running all tests but still failing if one + # of them does; it also applies here. build-alpine: name: Build statically linked using alpine runs-on: ubuntu-latest - container: 'alpine:3.19' + container: "alpine:3.19" steps: - name: Install extra dependencies shell: sh @@ -327,34 +383,55 @@ jobs: echo "CABAL_EXEC_TAR=$CABAL_EXEC_TAR" >> "$GITHUB_ENV" - name: Upload cabal-install executable to workflow artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: cabal-${{ runner.os }}-static-x86_64 path: ${{ env.CABAL_EXEC_TAR }} - # The previous jobs use a released version of cabal to build cabal HEAD itself # This one uses the cabal HEAD generated executable in the previous step # to build itself again, as sanity check dogfooding: - name: Dogfooding ${{ matrix.os }} ghc-${{ matrix.ghc }} - runs-on: ${{ matrix.os }} + name: Dogfooding ${{ matrix.sys.os }} ghc-${{ matrix.ghc }} + runs-on: ${{ matrix.sys.os }} needs: validate strategy: matrix: - os: [ubuntu-latest, macos-latest, windows-latest] + sys: + - { os: windows-latest, shell: "C:/msys64/usr/bin/bash.exe -e {0}" } + - { os: ubuntu-22.04, shell: bash } + - { os: macos-latest, shell: bash } # We only use one ghc version the used one for the next release (defined at top of the workflow) # We need to build an array dynamically to inject the appropiate env var in a previous job, # see https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson ghc: ${{ fromJSON (needs.validate.outputs.GHC_FOR_RELEASE) }} + defaults: + run: + shell: ${{ matrix.sys.shell }} steps: - - name: Work around XDG directories existence (haskell-actions/setup#62) + # TODO: make a reusable action for this + - name: Canonicalize architecture + run: | + case ${{ runner.arch }} in + X86) arch=i386 ;; + X64) arch=x86_64 ;; + ARM64) arch=aarch64 ;; + *) echo "Unsupported architecture" 2>/dev/null; exit 1 ;; + esac + echo "CABAL_ARCH=$arch" >> "$GITHUB_ENV" + + - name: "MAC: Work around XDG directories existence (haskell-actions/setup#62)" if: runner.os == 'macOS' run: | rm -rf ~/.config/cabal rm -rf ~/.cache/cabal + - name: "WIN: Setup TMP environment variable" + if: runner.os == 'Windows' + run: | + echo "TMP=${{ runner.temp }}" >> "$GITHUB_ENV" + - uses: actions/checkout@v4 - uses: haskell-actions/setup@v2 @@ -364,16 +441,13 @@ jobs: cabal-version: latest # default, we are not using it in this job - name: Download cabal executable from workflow artifacts - uses: actions/download-artifact@v3 + uses: actions/download-artifact@v4 with: - name: cabal-${{ runner.os }}-x86_64 + name: cabal-${{ runner.os }}-${{ env.CABAL_ARCH }} path: cabal-head - name: Untar the cabal executable - run: tar -xzf "./cabal-head/cabal-head-${{ runner.os }}-x86_64.tar.gz" -C cabal-head - - - name: print-config using cabal HEAD - run: sh validate.sh ${{ env.COMMON_FLAGS }} --with-cabal ./cabal-head/cabal -s print-config + run: tar -xzf "./cabal-head/cabal-head-${{ runner.os }}-$CABAL_ARCH.tar.gz" -C cabal-head # We dont use cache to force a build with a fresh store dir and build dir # This way we check cabal can build all its dependencies @@ -384,42 +458,72 @@ jobs: name: Create a GitHub prerelease with the binary artifacts runs-on: ubuntu-latest if: github.ref == 'refs/heads/master' + permissions: + contents: write # IMPORTANT! Any job added to the workflow should be added here too needs: [validate, validate-old-ghcs, build-alpine, dogfooding] steps: - - uses: actions/download-artifact@v3 - with: - name: cabal-Windows-x86_64 + - uses: liudonghua123/delete-release-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_name: 'cabal-head' - - uses: actions/download-artifact@v3 - with: - name: cabal-Linux-x86_64 + - uses: actions/download-artifact@v4 + with: + pattern: cabal-* + path: binaries + merge-multiple: true + + - name: Create GitHub prerelease + uses: softprops/action-gh-release@v2 + with: + tag_name: cabal-head + prerelease: true + files: binaries/cabal-* + + prerelease-lts: + name: Create a GitHub LTS prerelease with the binary artifacts + runs-on: ubuntu-latest + # The LTS branch is hardcoded for now, update it on a new LTS! + if: github.ref == 'refs/heads/3.12' + permissions: + contents: write + + # IMPORTANT! Any job added to the workflow should be added here too + needs: [validate, validate-old-ghcs, build-alpine, dogfooding] - - uses: actions/download-artifact@v3 + steps: + - uses: liudonghua123/delete-release-action@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - name: cabal-Linux-static-x86_64 + release_name: 'cabal-lts-head' - - uses: actions/download-artifact@v3 + - uses: actions/download-artifact@v4 with: - name: cabal-macOS-x86_64 + pattern: cabal-* + path: binaries + merge-multiple: true + + - run: | + # bash-ism, but we forced bash above + cd binaries + for f in cabal-*; do + mv "$f" "cabal-lts-${f##cabal-}" + done - name: Create GitHub prerelease - uses: marvinpinto/action-automatic-releases@v1.2.1 + uses: softprops/action-gh-release@v2 with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - automatic_release_tag: cabal-head + tag_name: cabal-lts-head prerelease: true - title: cabal-head - files: | - cabal-head-Windows-x86_64.tar.gz - cabal-head-Linux-x86_64.tar.gz - cabal-head-Linux-static-x86_64.tar.gz - cabal-head-macOS-x86_64.tar.gz + files: binaries/cabal-* # We use this job as a summary of the workflow - # It will fail if any of the previous jobs does it + # It will fail if any of the previous jobs does # This way we can use it exclusively in branch protection rules # and abstract away the concrete jobs of the workflow, including their names validate-post-job: diff --git a/.github/workflows/whitespace.yml b/.github/workflows/whitespace.yml index 46088d3d351..a6869a59e3f 100644 --- a/.github/workflows/whitespace.yml +++ b/.github/workflows/whitespace.yml @@ -7,8 +7,21 @@ on: jobs: whitespace: + defaults: + run: + shell: bash runs-on: ubuntu-latest steps: + - uses: actions/checkout@v4 - - uses: andreasabel/fix-whitespace-action@v1 + + - run: | + # no longer using the action because apparently we're supposed to use the Makefile here + wget -q https://github.com/agda/fix-whitespace/releases/download/v0.1/fix-whitespace-0.1-linux.binary + mkdir -p "$HOME/.local/bin" + mv fix-whitespace-0.1-linux.binary "$HOME/.local/bin/fix-whitespace" + chmod +x "$HOME/.local/bin/fix-whitespace" + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - run: make whitespace diff --git a/.gitignore b/.gitignore index 3e0b65c8085..8adb6aee95f 100644 --- a/.gitignore +++ b/.gitignore @@ -24,6 +24,7 @@ bootstrap/*.plan.json /cabal-install/dist/ /cabal-install/Setup /cabal-install/source-file-list +/cabal-install/tests/IntegrationTests2/config/cabal-config .stylish-haskell.yaml .stylish-haskell.yml @@ -40,6 +41,7 @@ _build *~ .*.swp *.bak +.vscode # GHC build @@ -68,17 +70,18 @@ register.sh # listed explicitly to show which files are generated but ignored testdb/intree/cabal.project-test testdb/intree/store/**/bin/alex +testdb/intree/store/**/bin/alex.exe testdb/intree/store/**/cabal-hash.txt testdb/intree/store/**/share/AlexTemplate.hs testdb/intree/store/**/share/AlexWrappers.hs testdb/intree/store/**/share/doc/LICENSE testdb/intree/store/*/incoming/alex-*.lock +testdb/intree/store/*/incoming/lx-*.lock testdb/intree/store/*/package.db/package.cache testdb/intree/store/*/package.db/package.cache.lock # windows test artifacts cabal-testsuite/**/*.exe -cabal-testsuite/**/*.bat cabal-testsuite/**/haddocks # python artifacts from documentation builds @@ -87,6 +90,7 @@ cabal-testsuite/**/haddocks venv .venv /doc/.skjold_cache/ +/doc/requirements.txt # macOS folder metadata .DS_Store @@ -97,6 +101,9 @@ bench.html # Emacs .projectile +# direnv +.envrc + ## Release Scripts # ignore the downloaded binary files diff --git a/.hlint.yaml b/.hlint.yaml index 6266b76964f..26dc61fbbd1 100644 --- a/.hlint.yaml +++ b/.hlint.yaml @@ -1,8 +1,8 @@ # Warnings currently triggered by your code - ignore: {name: "Avoid NonEmpty.unzip"} # 1 hint -- ignore: {name: "Avoid lambda"} # 46 hints +- ignore: {name: "Avoid lambda"} # 47 hints - ignore: {name: "Avoid lambda using `infix`"} # 22 hints -- ignore: {name: "Eta reduce"} # 116 hints +- ignore: {name: "Eta reduce"} # 124 hints - ignore: {name: "Evaluate"} # 10 hints - ignore: {name: "Functor law"} # 10 hints - ignore: {name: "Fuse concatMap/map"} # 3 hints @@ -16,27 +16,26 @@ - ignore: {name: "Monoid law, right identity"} # 3 hints - ignore: {name: "Move filter"} # 4 hints - ignore: {name: "Move guards forward"} # 4 hints -- ignore: {name: "Redundant $"} # 175 hints +- ignore: {name: "Redundant $"} # 179 hints - ignore: {name: "Redundant $!"} # 1 hint - ignore: {name: "Redundant <$>"} # 16 hints - ignore: {name: "Redundant =="} # 1 hint -- ignore: {name: "Redundant bracket"} # 232 hints +- ignore: {name: "Redundant bracket"} # 239 hints - ignore: {name: "Redundant fmap"} # 1 hint - ignore: {name: "Redundant guard"} # 2 hints -- ignore: {name: "Redundant if"} # 3 hints +- ignore: {name: "Redundant if"} # 6 hints - ignore: {name: "Redundant lambda"} # 19 hints - ignore: {name: "Redundant multi-way if"} # 1 hint -- ignore: {name: "Redundant return"} # 7 hints -- ignore: {name: "Replace case with fromMaybe"} # 5 hints +- ignore: {name: "Redundant return"} # 9 hints +- ignore: {name: "Replace case with fromMaybe"} # 6 hints - ignore: {name: "Replace case with maybe"} # 10 hints -- ignore: {name: "Unused LANGUAGE pragma"} # 167 hints - ignore: {name: "Use $>"} # 5 hints - ignore: {name: "Use ++"} # 4 hints -- ignore: {name: "Use :"} # 25 hints +- ignore: {name: "Use :"} # 30 hints - ignore: {name: "Use <$"} # 2 hints -- ignore: {name: "Use <$>"} # 86 hints +- ignore: {name: "Use <$>"} # 87 hints - ignore: {name: "Use <&>"} # 14 hints -- ignore: {name: "Use <=<"} # 5 hints +- ignore: {name: "Use <=<"} # 4 hints - ignore: {name: "Use =<<"} # 7 hints - ignore: {name: "Use =="} # 3 hints - ignore: {name: "Use >=>"} # 3 hints @@ -44,40 +43,40 @@ - ignore: {name: "Use Down"} # 3 hints - ignore: {name: "Use Just"} # 2 hints - ignore: {name: "Use bimap"} # 7 hints -- ignore: {name: "Use camelCase"} # 96 hints +- ignore: {name: "Use camelCase"} # 98 hints - ignore: {name: "Use catMaybes"} # 3 hints -- ignore: {name: "Use concatMap"} # 1 hint +- ignore: {name: "Use concatMap"} # 2 hints - ignore: {name: "Use const"} # 36 hints - ignore: {name: "Use elem"} # 2 hints -- ignore: {name: "Use fewer imports"} # 19 hints +- ignore: {name: "Use fewer imports"} # 13 hints - ignore: {name: "Use first"} # 4 hints -- ignore: {name: "Use fmap"} # 24 hints +- ignore: {name: "Use fmap"} # 26 hints - ignore: {name: "Use fold"} # 1 hint - ignore: {name: "Use for"} # 1 hint - ignore: {name: "Use forM_"} # 1 hint -- ignore: {name: "Use fromMaybe"} # 1 hint +- ignore: {name: "Use fromMaybe"} # 4 hints - ignore: {name: "Use fromRight"} # 1 hint - ignore: {name: "Use fst"} # 1 hint -- ignore: {name: "Use if"} # 4 hints +- ignore: {name: "Use if"} # 2 hints - ignore: {name: "Use infix"} # 20 hints - ignore: {name: "Use isAsciiLower"} # 2 hints - ignore: {name: "Use isAsciiUpper"} # 2 hints - ignore: {name: "Use isDigit"} # 2 hints - ignore: {name: "Use isJust"} # 1 hint - ignore: {name: "Use isNothing"} # 1 hint -- ignore: {name: "Use lambda-case"} # 47 hints +- ignore: {name: "Use lambda-case"} # 55 hints - ignore: {name: "Use lefts"} # 1 hint -- ignore: {name: "Use list comprehension"} # 16 hints +- ignore: {name: "Use list comprehension"} # 18 hints - ignore: {name: "Use list literal"} # 3 hints - ignore: {name: "Use list literal pattern"} # 11 hints - ignore: {name: "Use map once"} # 7 hints - ignore: {name: "Use map with tuple-section"} # 3 hints - ignore: {name: "Use mapMaybe"} # 13 hints -- ignore: {name: "Use max"} # 1 hint +- ignore: {name: "Use max"} # 2 hints - ignore: {name: "Use maybe"} # 8 hints - ignore: {name: "Use minimumBy"} # 1 hint - ignore: {name: "Use newtype instead of data"} # 26 hints -- ignore: {name: "Use notElem"} # 8 hints +- ignore: {name: "Use notElem"} # 9 hints - ignore: {name: "Use null"} # 2 hints - ignore: {name: "Use record patterns"} # 16 hints - ignore: {name: "Use replicateM"} # 1 hint @@ -88,16 +87,30 @@ - ignore: {name: "Use traverse"} # 1 hint - ignore: {name: "Use tuple-section"} # 28 hints - ignore: {name: "Use typeRep"} # 2 hints -- ignore: {name: "Use unless"} # 20 hints +- ignore: {name: "Use uncurry"} # 1 hint +- ignore: {name: "Use unless"} # 22 hints - ignore: {name: "Use unwords"} # 8 hints -- ignore: {name: "Use void"} # 22 hints +- ignore: {name: "Use void"} # 23 hints - ignore: {name: "Use when"} # 1 hint - arguments: - --ignore-glob=Cabal-syntax/src/Distribution/Fields/Lexer.hs + - --ignore-glob=cabal-testsuite/PackageTests/BuildWays/q/app/Main.hs - --ignore-glob=cabal-testsuite/PackageTests/CmmSources/src/Demo.hs - --ignore-glob=cabal-testsuite/PackageTests/CmmSourcesDyn/src/Demo.hs - --ignore-glob=cabal-testsuite/PackageTests/CmmSourcesExe/src/Demo.hs + - --ignore-glob=cabal-testsuite/PackageTests/NewBuild/CmdRun/Script/script.hs + - --ignore-glob=cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptLiterate/script.lhs + - --ignore-glob=cabal-testsuite/PackageTests/Regression/T5309/lib/Bio/Character/Exportable/Class.hs + - --ignore-glob=cabal-testsuite/PackageTests/SetupHooks/SetupHooksC2HsRules/SetupHooks.hs + - --ignore-glob=cabal-testsuite/PackageTests/SetupHooks/SetupHooksDuplicateRuleId/SetupHooks.hs + - --ignore-glob=cabal-testsuite/PackageTests/SetupHooks/SetupHooksInvalidRuleOutputIndex/SetupHooks.hs + - --ignore-glob=cabal-testsuite/PackageTests/SetupHooks/SetupHooksRuleOrdering/SetupHooks.hs + - --ignore-glob=cabal-testsuite/PackageTests/SetupHooks/SetupHooksUnusedRules/SetupHooks.hs + - --ignore-glob=cabal-testsuite/PackageTests/TemplateHaskell/dynamic/TH.hs + - --ignore-glob=cabal-testsuite/PackageTests/TemplateHaskell/profiling/TH.hs + - --ignore-glob=cabal-testsuite/PackageTests/TemplateHaskell/vanilla/TH.hs - --ignore-glob=templates/Paths_pkg.template.hs - --ignore-glob=templates/SPDX.LicenseExceptionId.template.hs - --ignore-glob=templates/SPDX.LicenseId.template.hs + - --ignore-glob=dist-* diff --git a/.readthedocs.yml b/.readthedocs.yml index 016f7e47a48..31bb9507b4f 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -7,6 +7,10 @@ build: os: "ubuntu-22.04" tools: python: "3.8" + jobs: + post_create_environment: + - pip install pip-tools + - make users-guide-requirements python: install: diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 00000000000..9e633fb004d --- /dev/null +++ b/.typos.toml @@ -0,0 +1,2 @@ +[default] +extend-ignore-re = ["(?s)(#|//)\\s*spellchecker:off.*?\\n\\s*(#|//)\\s*spellchecker:on"] diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 062ee73f3d5..7a7842017c5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,25 +1,47 @@ # Contributing to Cabal -Building Cabal for hacking --------------------------- +## Building Cabal for hacking -If you use the latest version of cabal published on Hackage, it is sufficient to run: +If you use the `cabal` executable from the latest version of the +[cabal-install](https://hackage.haskell.org/package/cabal-install) package +published on Hackage, it is sufficient to run: ``` -cabal build cabal +$ cabal build cabal ``` -If not, you aren't able to build the testsuite, so you need to disable the default `cabal.project` that implies configuring the testsuite, e.g., with: +If you have trouble building the testsuite for this initial build, try building +with the release project that excludes this testsuite: ``` -cabal build --project-file=cabal.release.project cabal +$ cabal build cabal --project-file=cabal.release.project ``` -> **Note** -> If you're using Nix, you might find it convenient to work within a shell that has all the `Cabal` development dependencies: -> ``` -> $ nix-shell -p cabal-install ghc ghcid haskellPackages.fourmolu_0_12_0_0 pkgconfig zlib.dev +> [!NOTE] +> The default `cabal.project` is picked up implicitly as if the +> `--project-file=cabal.project` explicit option had been given. + +For developing, we recommend using the locally built version of `cabal`, the +executable, if only because one of the released versions available may be +lacking a fix. This can be installed: + +``` +$ cabal install cabal-install:exe:cabal --overwrite-policy=always +``` + +It can be run without first installing it with `cabal run cabal --` followed by +its own arguments, as shown here for `build --help`: + +``` +$ cabal run cabal -- build --help +``` + +> [!NOTE] +> If you're using Nix, you might find it convenient to work within a shell that has the following `Cabal` development dependencies: +> ```bash +> $ nix-shell -p cabal-install ghc ghcid pkg-config zlib.dev # incomplete > ``` +> One dependency that we left out in the above command is `haskellPackages.fourmolu_0_12_0_0` which would need to be installed manually. > A Nix flake developer shell with these dependencies is also available, supported solely by the community, through the command `nix develop github:yvan-sraka/cabal.nix`. The location of your build products will vary depending on which version of @@ -30,15 +52,18 @@ to find the binary (or just run `find -type f -executable -name cabal`). Here are some other useful variations on the commands: ``` -cabal build Cabal # build library only -cabal build Cabal-tests:unit-tests # build Cabal's unit test suite -cabal build cabal-tests # etc... +$ cabal build Cabal # build library only +$ cabal build Cabal-tests:unit-tests # build Cabal's unit test suite +$ cabal build cabal-tests # etc... ``` -Running tests -------------- +## Running tests + +There are two ways to run tests: in CI with GitHub actions and locally with +`./validate.sh`. + +### Using GitHub Actions. -**Using GitHub Actions.** If you are not in a hurry, the most convenient way to run tests on Cabal is to make a branch on GitHub and then open a pull request; our continuous integration service on GitHub Actions builds and @@ -62,7 +87,8 @@ Some tips for using GitHub Actions effectively: already failed), be nice to others and cancel the rest of the jobs, so that other commits on the build queue can be processed. -**How to debug a failing CI test.** +### How to debug a failing CI test. + One of the annoying things about running tests on CI is when they fail, there is often no easy way to further troubleshoot the broken build. Here are some guidelines for debugging continuous integration @@ -90,7 +116,11 @@ failures: If none of these let you reproduce, there might be some race condition or continuous integration breakage; please file a bug. -**Running tests locally.** +### Running tests locally. + +The [`./validate.sh`](./validate.sh) script runs all the test suites. It takes +various options to restrict the test suites it runs; use `--help` to list them. + To run tests locally with `cabal`, you will need to know the name of the test suite you want. Cabal and cabal-install have several. Also, you'll want to read [Where are my build products?](http://cabal.readthedocs.io/en/latest/nix-local-build.html#where-are-my-build-products) @@ -127,8 +157,14 @@ For these test executables, `-p` which applies a regex filter to the test names. When running `cabal-install` test suites, one need only use `cabal test` or `cabal run ` in order to test locally. -QA Notes --------- +## Running other checks locally + +Various other checks done by CI can be run locally to make sure your code doesn't +fail annoyingly once you push it. `make checks` will do these checks. The list of +checks is expected to grow over time, to make it easier to avoid CI turnaround on +simple problems. + +## QA Notes Manual Quality Assurance (QA) is performed to ensure that the changes impacting the command-line interface, whether adding or modifying a behaviour, @@ -139,39 +175,79 @@ Contributions that touch `cabal-install` are expected to include notes for the Q They are a description of an expected result upon calling `cabal-install` with certain parameters, and should be written in the body of the ticket or PR under their own heading, like this: -For instance: +```markdown +## QA Notes -> \#\# QA Notes -> -> Calling `cabal haddock-project` should produce documentation for the whole cabal project with the following defaults enabled: -> * Documentation lives in ./haddocks -> * The file `./haddocks/index.html` should exist +Calling `cabal haddock-project` should produce documentation for the whole +cabal project with the following defaults enabled: +* Documentation lives in ./haddocks +* The file `./haddocks/index.html` should exist +``` Manual QA is not expected to find every possible bug, but to really challenge the assumptions of the contributor, and to verify that their own testing of their patch is not influenced by their setup or implicit knowledge of the system. -Code Style ---------------- - -We use automated formatting with Fourmolu to enforce a unified style across the code bases. It is checked in the CI process. -After installing Fourmolu 0.12, there are some makefile targets to help formatting -the code base. +## Code Style +We use automated formatting, checked in the CI process, to enforce a unified +style across the code bases and include these makefile targets to help with +formatting: * `make style` - Format the `Cabal`, `Cabal-syntax` and `cabal-install` directories. * `make style-modified` - Format files modified in the current tree. * `make style-commit COMMIT=` - Format files modified between HEAD and the given reference. -Whitespace Conventions ----------------------- +> [!NOTE] +> We use `fourmolu-0.12.0.0` for formatting. If installing it with `cabal +> install`, please make sure to use a version of `GHC >= 9.2.1 && < 9.8`. +> Its requirement of `GHC2021` sets the lower bound, and its reliance on +> `ghc-lib-parser` sets the upper bound on GHC versions. A command for +> installing it this way is: +> +> ``` +> $ cabal install fourmolu-0.12.0.0 --overwrite-policy=always --ignore-project +> ``` + +> [!Tip] +> If you have multiple versions of GHC installed with `ghcup`, a series-specific +> GHC can be used by adding an option of `--with-compiler=ghc-x.y` (for the +> latest installed `x.y.z` version in the `x.y` series) or an option of +> `--with-compiler=ghc-x.y.z` to the above install command. +> +> ``` +> $ ghc --numeric-version +> 9.10.1 +> +> $ ghc-9.6 --numeric-version +> 9.6.6 +> +> $ ghc-9.4.8 --numeric-version +> 9.4.8 +> ``` +> +> If not using the `--with-compiler` option then the system `ghc` version should +> be one in the `ghc-9.2`, `ghc-9.4` or `ghc-9.6` series when installing +> `fourmolu`. + +> [!WARNING] +> If you have need of another `fourmolu` version for other work and want to +> switch between versions then your options are reinstalling or using a nix shell +> or something similar. It is not yet possible to specify development +> environment tools within a package with different constraints on dependencies, +> see [issue-9230][issue-9230]. + +[issue-9230]: https://github.com/haskell/cabal/issues/9230 + +## Whitespace Conventions We use automated whitespace convention checking. Violations can be fixed by running [fix-whitespace](https://hackage.haskell.org/package/fix-whitespace). If -you push a fix of a whitespace violation, please do so in a _separate commit_. +you push a fix of a whitespace violation, please do so in a _separate commit_. For convenience, +`make whitespace` will show violations and `make fix-whitespace` will fix them, if the +`fix-whitespace` utility is installed. -Other Conventions ------------------ +## Other Conventions * Format your commit messages [in the standard way](https://chris.beams.io/posts/git-commit/#seven-rules). @@ -231,8 +307,7 @@ Other Conventions #endif ``` -GitHub Ticket Conventions -------------------- +## GitHub Ticket Conventions Each major `Cabal`/`cabal-install` release (e.g. 3.4, 3.6, etc.) has a corresponding GitHub Project and milestone. A ticket is included in a release's @@ -245,8 +320,7 @@ accepting a fix in that release, i.e. we would very much appreciate someone working on it, but are not committing to actively sourcing someone to work on it. -GitHub Pull Request Conventions -------------------- +## GitHub Pull Request Conventions Every (non-backport) pull request has to go through a review and get 2 approvals. After this is done, the author of the pull request is expected to add @@ -287,8 +361,7 @@ think it does not warrant an issue). Feel free to open a new issue (or new issues) when appropriate. -Changelog ---------- +## Changelog Anything that changes `cabal-install:exe:cabal` or changes exports from library modules or changes behaviour of functions exported from packages published to @@ -322,13 +395,40 @@ description: { } ``` -Only the `synopsis` field is actually required, but you should also set the others where applicable. +Changelogs may also be written in "markdown-frontmatter" format. This is useful +if your description contains braces, which must be escaped with backslashes in +`.cabal` file format. Another benefit of using an `.md` extension with your +changelog is that it will be checked for typos. + +The front matter is in YAML syntax, not `.cabal` file syntax, and the file +_must_ begin with a line containing only hyphens. + +```markdown +--- +synopsis: Add feature xyz +packages: [cabal-install] +prs: 0000 +issues: [0000, 0000] +significance: significant +--- + +- Detail number 1 +- Detail number 2 + +``` +The package list must be enclosed in square brackets and comma-separated, but this +isn't needed for `prs` or `issues`; those are free-form and any YAML syntax will +be accepted. Note that the number signs on PR and issue numbers are required in +`.cabal` file syntax, but won't work in markdown-frontmatter syntax because they +signify comments in YAML. + +Only the `synopsis` and `prs` fields are required, but you should also set the others where applicable. | Field | Description | | ----- | ----------- | | `synopsis` | Brief description of the change. Often just the pr title. | | `description` | Longer description, with a list of sub-changes. Not needed for small/atomic changes. | -| `packages` | Packages affected by the change (`cabal-install`, `Cabal`...). Omit if it's an overarching or non-package change. | +| `packages` | Packages affected by the change (`cabal-install`, `Cabal`...). Omit if it's a non-package change. | | `prs` | Space-separated hash-prefixed pull request numbers containing the change (usually just one). | | `issues` | Space-separated hash-prefixed issue numbers that the change fixes/closes/affects. | | `significance` | Set to `significant` if the change is significant, that is if it warrants being put near the top of the changelog. | @@ -342,8 +442,19 @@ At release time, the entries will be merged with In addition, if you're changing the `.cabal` file format specification you should add an entry in `doc/file-format-changelog.rst`. -Communicating -------------- +### Is my change `significant`? + +Use your best judgement and if unsure ask other maintainers. If your PR fixes +a specific ticket, how busy was the discussion there? A new command or option +most likely warrants a `significance: significant` tag, same with command +line changes that disrupts the workflow of many users or an API change +that requires substantial time to integrate in a program. + +Put yourself in the shoes of the user: would you appreciate seeing this +change highlighted in the announcement post or release notes overview? If +so, add `significance: significant`. + +## Communicating There are a few main venues of communication: @@ -354,10 +465,9 @@ There are a few main venues of communication: * Many developers idle on `#hackage` on [`irc.libera.chat`](https://libera.chat). The `#ghc` channel is also a decently good bet. * You can join the channel using a web client, even anonymously: https://web.libera.chat/#hackage - * Alternatively you can join it using [matrix](https://matrix.org/): https://matrix.to/#/#hackage:libera.chat + * Alternatively you can join it using [matrix](https://matrix.org/): https://matrix.to/#/#hackage:matrix.org -Releases --------- +## Releases Notes for how to make a release are at the wiki page ["Making a release"](https://github.com/haskell/cabal/wiki/Making-a-release). @@ -365,8 +475,7 @@ Currently, [@emilypi](https://github.com/emilypi), [@fgaz](https://github.com/fg `haskell.org/cabal`, and [@Mikolaj](https://github.com/Mikolaj) is the point of contact for getting permissions. -Preview Releases ----------------- +## Preview Releases We make preview releases available to facilitate testing of development builds. @@ -384,8 +493,7 @@ To reproduce these locally, set up an Alpine build environment using GHCup, and then build by calling `cabal build cabal-install --enable-executable-static`. -API Documentation ------------------ +## API Documentation Auto-generated API documentation for the `master` branch of Cabal is automatically uploaded here: http://haskell.github.io/cabal-website/doc/html/Cabal/. @@ -393,8 +501,7 @@ Auto-generated API documentation for the `master` branch of Cabal is automatical You can contribute by triaging issues which may include reproducing bug reports or asking for vital information, such as version numbers or reproduction instructions. If you would like to start triaging issues, one easy way to get started is to [subscribe to cabal on CodeTriage](https://www.codetriage.com/haskell/cabal). -Hackage Revisions ------------------ +## Hackage Revisions We are reactive rather than proactive with revising bounds on our dependencies for code already released on Hackage. If you would benefit from a version bump, @@ -407,7 +514,7 @@ it, someone with enough permissions needs to go on the [Validate workflow page](https://github.com/haskell/cabal/actions/workflows/validate.yml) and dispatch it manually by clicking "Run workflow". -Running workflow manually as discussed above requires you to supply two inputs: +Running workflow manually as discussed above allows you to supply two inputs: > allow-newer line > constraints line diff --git a/Cabal-QuickCheck/Cabal-QuickCheck.cabal b/Cabal-QuickCheck/Cabal-QuickCheck.cabal index 37c0f88fc4e..0fbccd53d91 100644 --- a/Cabal-QuickCheck/Cabal-QuickCheck.cabal +++ b/Cabal-QuickCheck/Cabal-QuickCheck.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: Cabal-QuickCheck -version: 3.13.0.0 +version: 3.15.0.0 synopsis: QuickCheck instances for types in Cabal category: Testing build-type: Simple @@ -14,8 +14,8 @@ library build-depends: , base , bytestring - , Cabal ^>=3.13.0.0 - , Cabal-syntax ^>=3.13.0.0 + , Cabal ^>=3.15.0.0 + , Cabal-syntax ^>=3.15.0.0 , QuickCheck ^>=2.13.2 || ^>=2.14 exposed-modules: diff --git a/Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs b/Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs index 00f32bc0d70..29f0b5d85e9 100644 --- a/Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs +++ b/Cabal-QuickCheck/src/Test/QuickCheck/GenericArbitrary.hs @@ -10,10 +10,6 @@ module Test.QuickCheck.GenericArbitrary ( import GHC.Generics import Test.QuickCheck -#if !MIN_VERSION_base(4,8,0) -import Control.Applicative (pure, (<$>), (<*>)) -#endif - -- Generic arbitrary for non-recursive types genericArbitrary :: (Generic a, GArbitrary (Rep a)) => Gen a genericArbitrary = fmap to garbitrary diff --git a/Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs b/Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs index e5b5077d414..a3b489ef369 100644 --- a/Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs +++ b/Cabal-QuickCheck/src/Test/QuickCheck/Instances/Cabal.hs @@ -1,30 +1,24 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE TypeOperators #-} +{-# LANGUAGE FlexibleInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module Test.QuickCheck.Instances.Cabal () where #if !MIN_VERSION_base(4,18,0) import Control.Applicative (liftA2) #endif -import Data.Bits (shiftR) +import Data.Bits (countLeadingZeros, finiteBitSize, shiftL, shiftR) import Data.Char (isAlphaNum, isDigit, toLower) import Data.List (intercalate, (\\)) import Data.List.NonEmpty (NonEmpty (..)) import Distribution.Utils.Generic (lowercase) import Test.QuickCheck -#if MIN_VERSION_base(4,8,0) -import Data.Bits (countLeadingZeros, finiteBitSize, shiftL) -#else -import Data.Bits (popCount) -#endif - import Distribution.CabalSpecVersion import Distribution.Compat.NonEmptySet (NonEmptySet) import Distribution.Compiler import Distribution.FieldGrammar.Newtypes import Distribution.ModuleName -import Distribution.Simple.Compiler (DebugInfoLevel (..), OptimisationLevel (..), PackageDB (..), ProfDetailLevel (..), knownProfDetailLevels) +import Distribution.Simple.Compiler import Distribution.Simple.Flag (Flag (..)) import Distribution.Simple.InstallDirs import Distribution.Simple.Setup (HaddockTarget (..), TestShowDetails (..), DumpBuildInfo) @@ -54,10 +48,6 @@ import Test.QuickCheck.GenericArbitrary import qualified Data.ByteString.Char8 as BS8 import qualified Distribution.Compat.NonEmptySet as NES -#if !MIN_VERSION_base(4,8,0) -import Control.Applicative (pure, (<$>), (<*>)) -#endif - ------------------------------------------------------------------------------- -- CabalSpecVersion ------------------------------------------------------------------------------- @@ -486,7 +476,7 @@ instance Arbitrary TestShowDetails where -- PackageDB ------------------------------------------------------------------------------- -instance Arbitrary PackageDB where +instance Arbitrary (PackageDBX FilePath) where arbitrary = oneof [ pure GlobalPackageDB , pure UserPackageDB , SpecificPackageDB <$> arbitraryShortPath @@ -541,8 +531,4 @@ intSqrt n = case compare n 0 of iter x = shiftR (x + n `div` x) 1 guess :: Int -#if MIN_VERSION_base(4,8,0) guess = shiftR n (shiftL (finiteBitSize n - countLeadingZeros n) 1) -#else - guess = shiftR n (shiftR (popCount n) 1) -#endif diff --git a/Cabal-described/Cabal-described.cabal b/Cabal-described/Cabal-described.cabal index 8f7f9c66750..e8fd71a49fa 100644 --- a/Cabal-described/Cabal-described.cabal +++ b/Cabal-described/Cabal-described.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: Cabal-described -version: 3.13.0.0 +version: 3.15.0.0 synopsis: Described functionality for types in Cabal category: Testing, Parsec description: Provides rere bindings @@ -12,14 +12,14 @@ library ghc-options: -Wall build-depends: , base - , Cabal ^>=3.13.0.0 - , Cabal-syntax ^>=3.13.0.0 + , Cabal ^>=3.15.0.0 + , Cabal-syntax ^>=3.15.0.0 , containers , pretty , QuickCheck , rere >=0.1 && <0.3 - , tasty - , tasty-quickcheck + , tasty <1.6 + , tasty-quickcheck <0.12 exposed-modules: Distribution.Described diff --git a/Cabal-described/src/Distribution/Utils/GrammarRegex.hs b/Cabal-described/src/Distribution/Utils/GrammarRegex.hs index d355848b73d..471ee25d44f 100644 --- a/Cabal-described/src/Distribution/Utils/GrammarRegex.hs +++ b/Cabal-described/src/Distribution/Utils/GrammarRegex.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} diff --git a/Cabal-hooks/CHANGELOG.md b/Cabal-hooks/CHANGELOG.md new file mode 100644 index 00000000000..6b85a3c125b --- /dev/null +++ b/Cabal-hooks/CHANGELOG.md @@ -0,0 +1,12 @@ +# Changelog for `Cabal-hooks` + +## 3.16 – November 2024 + + * Release accompanying `Cabal-3.16`. + No changes to `Cabal-hooks` itself; all changes come changes in re-exports + from `Cabal`. + +## 3.14 – November 2024 + + * Initial release of the `Hooks` API. + diff --git a/Cabal-hooks/Cabal-hooks.cabal b/Cabal-hooks/Cabal-hooks.cabal index 419f15764b9..6b41d1f00e6 100644 --- a/Cabal-hooks/Cabal-hooks.cabal +++ b/Cabal-hooks/Cabal-hooks.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: Cabal-hooks -version: 0.1 +version: 3.16 copyright: 2023, Cabal Development Team license: BSD-3-Clause license-file: LICENSE @@ -27,11 +27,10 @@ library hs-source-dirs: src build-depends: - Cabal-syntax >= 3.13 && < 3.15, - Cabal >= 3.13 && < 3.15, - base >= 4.11 && < 5, + Cabal-syntax >= 3.15 && < 3.17, + Cabal >= 3.15 && < 3.17, + base >= 4.13 && < 5, containers >= 0.5.0.0 && < 0.8, - filepath >= 1.3.0.1 && < 1.5, transformers >= 0.5.6.0 && < 0.7 ghc-options: -Wall -fno-ignore-asserts -fwarn-tabs -fwarn-incomplete-uni-patterns -fwarn-incomplete-record-updates diff --git a/Cabal-hooks/readme.md b/Cabal-hooks/README.md similarity index 94% rename from Cabal-hooks/readme.md rename to Cabal-hooks/README.md index 9304784efe6..87704aa50c5 100644 --- a/Cabal-hooks/readme.md +++ b/Cabal-hooks/README.md @@ -40,7 +40,7 @@ build-type: Hooks custom-setup setup-depends: - Cabal-hooks >= 0.1 && < 0.2 + Cabal-hooks >= 3.14 && < 3.15 ``` and your `SetupHooks.hs` file should look like: diff --git a/Cabal-hooks/changelog.md b/Cabal-hooks/changelog.md deleted file mode 100644 index ea633b2936a..00000000000 --- a/Cabal-hooks/changelog.md +++ /dev/null @@ -1,6 +0,0 @@ -# Changelog for `Cabal-hooks` - -## 0.1 – December 2023 - - * Initial release of the `Hooks` API. - diff --git a/Cabal-hooks/src/Distribution/Simple/SetupHooks.hs b/Cabal-hooks/src/Distribution/Simple/SetupHooks.hs index 488387b8e2f..5e194ec9161 100644 --- a/Cabal-hooks/src/Distribution/Simple/SetupHooks.hs +++ b/Cabal-hooks/src/Distribution/Simple/SetupHooks.hs @@ -2,12 +2,8 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DerivingStrategies #-} {-# LANGUAGE DuplicateRecordFields #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecursiveDo #-} {-# LANGUAGE StaticPointers #-} -{-# LANGUAGE TupleSections #-} -{-# LANGUAGE OverloadedStrings #-} {-| Module: Distribution.Simple.SetupHooks @@ -78,8 +74,8 @@ module Distribution.Simple.SetupHooks -- *** Rule inputs/outputs -- $rulesDemand - , Location - , findFileInDirs + , Location(..) + , location , autogenComponentModulesDir , componentBuildDir @@ -202,7 +198,7 @@ import Distribution.Simple.SetupHooks.Errors import Distribution.Simple.SetupHooks.Internal import Distribution.Simple.SetupHooks.Rule as Rule import Distribution.Simple.Utils - ( dieWithException, findFirstFile) + ( dieWithException ) import Distribution.System ( Platform(..) ) import Distribution.Types.Component @@ -235,12 +231,8 @@ import qualified Control.Monad.Trans.Writer.Strict as Writer #endif import Data.Foldable ( for_ ) -import Data.List - ( nub ) import Data.Map.Strict as Map ( insertLookupWithKey ) -import System.FilePath - ( () ) -------------------------------------------------------------------------------- -- Haddocks for the SetupHooks API @@ -264,7 +256,7 @@ Usage example: > custom-setup > setup-depends: > base >= 4.18 && < 5, -> Cabal-hooks >= 0.1 && < 0.2 +> Cabal-hooks >= 3.14 && < 3.15 > > The declared Cabal version should also be at least 3.14. @@ -466,14 +458,5 @@ addRuleMonitors :: Monad m => [MonitorFilePath] -> RulesT m () addRuleMonitors = RulesT . lift . lift . Writer.tell {-# INLINEABLE addRuleMonitors #-} --- | Find a file in the given search directories. -findFileInDirs :: FilePath -> [FilePath] -> IO (Maybe Location) -findFileInDirs file dirs = - findFirstFile - (uncurry ()) - [ (path, file) - | path <- nub dirs - ] - - -- TODO: add API functions that search and declare the appropriate monitoring - -- at the same time. +-- TODO: add API functions that search and declare the appropriate monitoring +-- at the same time. diff --git a/Cabal-syntax/Cabal-syntax.cabal b/Cabal-syntax/Cabal-syntax.cabal index a1873228428..42fb7f7d51e 100644 --- a/Cabal-syntax/Cabal-syntax.cabal +++ b/Cabal-syntax/Cabal-syntax.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: Cabal-syntax -version: 3.13.0.0 +version: 3.15.0.0 copyright: 2003-2024, Cabal Development Team (see AUTHORS file) license: BSD-3-Clause license-file: LICENSE @@ -29,11 +29,11 @@ library build-depends: array >= 0.4.0.1 && < 0.6, - base >= 4.11 && < 5, + base >= 4.13 && < 5, binary >= 0.7 && < 0.9, bytestring >= 0.10.0.0 && < 0.13, containers >= 0.5.0.0 && < 0.8, - deepseq >= 1.3.0.1 && < 1.6, + deepseq >= 1.3.0.1 && < 1.7, directory >= 1.2 && < 1.4, filepath >= 1.3.0.1 && < 1.6, mtl >= 2.1 && < 2.4, @@ -76,7 +76,6 @@ library Distribution.Compat.Parsing Distribution.Compat.Prelude Distribution.Compat.Semigroup - Distribution.Compat.Typeable Distribution.Compiler Distribution.FieldGrammar Distribution.FieldGrammar.Class @@ -136,6 +135,7 @@ library Distribution.Types.ConfVar Distribution.Types.Dependency Distribution.Types.DependencyMap + Distribution.Types.DependencySatisfaction Distribution.Types.ExeDependency Distribution.Types.Executable Distribution.Types.Executable.Lens @@ -159,6 +159,8 @@ library Distribution.Types.Library.Lens Distribution.Types.LibraryName Distribution.Types.LibraryVisibility + Distribution.Types.MissingDependency + Distribution.Types.MissingDependencyReason Distribution.Types.Mixin Distribution.Types.Module Distribution.Types.ModuleReexport diff --git a/Cabal-syntax/ChangeLog.md b/Cabal-syntax/ChangeLog.md index 7554aaf4980..205dcdb9cf0 100644 --- a/Cabal-syntax/ChangeLog.md +++ b/Cabal-syntax/ChangeLog.md @@ -1 +1 @@ -Please see https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.12.0.0.md +Please see https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.14.1.0.md diff --git a/Cabal-syntax/src/Distribution/Backpack.hs b/Cabal-syntax/src/Distribution/Backpack.hs index b30028bc41c..e70b9ffc692 100644 --- a/Cabal-syntax/src/Distribution/Backpack.hs +++ b/Cabal-syntax/src/Distribution/Backpack.hs @@ -1,8 +1,6 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE PatternGuards #-} {-# LANGUAGE RankNTypes #-} -- | This module defines the core data types for Backpack. For more @@ -70,7 +68,7 @@ import qualified Data.Set as Set -- represent it as a 'DefiniteUnitId uid'. -- -- For a source component using Backpack, however, there is more --- structure as components may be parametrized over some signatures, and +-- structure as components may be parameterized over some signatures, and -- these \"holes\" may be partially or wholly filled. -- -- OpenUnitId plays an important role when we are mix-in linking, @@ -91,7 +89,7 @@ data OpenUnitId -- MUST NOT be for an indefinite component; an 'OpenUnitId' -- is guaranteed not to have any holes. DefiniteUnitId DefUnitId - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) -- TODO: cache holes? @@ -165,7 +163,7 @@ mkDefUnitId cid insts = data OpenModule = OpenModule OpenUnitId ModuleName | OpenModuleVar ModuleName - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary OpenModule instance Structured OpenModule diff --git a/Cabal-syntax/src/Distribution/CabalSpecVersion.hs b/Cabal-syntax/src/Distribution/CabalSpecVersion.hs index 3d1f9418e4a..a81e8921a94 100644 --- a/Cabal-syntax/src/Distribution/CabalSpecVersion.hs +++ b/Cabal-syntax/src/Distribution/CabalSpecVersion.hs @@ -35,7 +35,7 @@ data CabalSpecVersion | -- 3.10: no changes CabalSpecV3_12 | CabalSpecV3_14 - deriving (Eq, Ord, Show, Read, Enum, Bounded, Typeable, Data, Generic) + deriving (Eq, Ord, Show, Read, Enum, Bounded, Data, Generic) instance Binary CabalSpecVersion instance Structured CabalSpecVersion diff --git a/Cabal-syntax/src/Distribution/Compat/Binary.hs b/Cabal-syntax/src/Distribution/Compat/Binary.hs index 8849fc13b10..563337333ff 100644 --- a/Cabal-syntax/src/Distribution/Compat/Binary.hs +++ b/Cabal-syntax/src/Distribution/Compat/Binary.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE PatternSynonyms #-} module Distribution.Compat.Binary ( decodeOrFailIO @@ -20,4 +19,4 @@ decodeOrFailIO :: Binary a => ByteString -> IO (Either String a) decodeOrFailIO bs = catch (evaluate (decode bs) >>= return . Right) handler where - handler (ErrorCallWithLocation str _) = return $ Left str + handler (ErrorCall str) = return $ Left str diff --git a/Cabal-syntax/src/Distribution/Compat/Graph.hs b/Cabal-syntax/src/Distribution/Compat/Graph.hs index c01f3162b2d..792cc47ce5f 100644 --- a/Cabal-syntax/src/Distribution/Compat/Graph.hs +++ b/Cabal-syntax/src/Distribution/Compat/Graph.hs @@ -1,6 +1,5 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} @@ -122,7 +121,6 @@ data Graph a = Graph , graphKeyToVertex :: Key a -> Maybe G.Vertex , graphBroken :: [(a, [Key a])] } - deriving (Typeable) -- NB: Not a Functor! (or Traversable), because you need -- to restrict Key a ~ Key b. We provide our own mapping @@ -148,24 +146,20 @@ instance (Eq (Key a), Eq a) => Eq (Graph a) where g1 == g2 = graphMap g1 == graphMap g2 instance Foldable.Foldable Graph where + elem x = Foldable.elem x . graphMap fold = Foldable.fold . graphMap - foldr f z = Foldable.foldr f z . graphMap foldl f z = Foldable.foldl f z . graphMap - foldMap f = Foldable.foldMap f . graphMap foldl' f z = Foldable.foldl' f z . graphMap + foldr f z = Foldable.foldr f z . graphMap foldr' f z = Foldable.foldr' f z . graphMap -#ifdef MIN_VERSION_base -#if MIN_VERSION_base(4,8,0) + foldMap f = Foldable.foldMap f . graphMap length = Foldable.length . graphMap - null = Foldable.null . graphMap - toList = Foldable.toList . graphMap - elem x = Foldable.elem x . graphMap maximum = Foldable.maximum . graphMap minimum = Foldable.minimum . graphMap - sum = Foldable.sum . graphMap + null = Foldable.null . graphMap product = Foldable.product . graphMap -#endif -#endif + sum = Foldable.sum . graphMap + toList = Foldable.toList . graphMap instance (NFData a, NFData (Key a)) => NFData (Graph a) where rnf diff --git a/Cabal-syntax/src/Distribution/Compat/Newtype.hs b/Cabal-syntax/src/Distribution/Compat/Newtype.hs index 00da1e83542..56f55a9282b 100644 --- a/Cabal-syntax/src/Distribution/Compat/Newtype.hs +++ b/Cabal-syntax/src/Distribution/Compat/Newtype.hs @@ -14,15 +14,10 @@ module Distribution.Compat.Newtype , unpack' ) where +import Data.Coerce (Coercible, coerce) import Data.Functor.Identity (Identity (..)) import Data.Monoid (Endo (..), Product (..), Sum (..)) -#if MIN_VERSION_base(4,7,0) -import Data.Coerce (coerce, Coercible) -#else -import Unsafe.Coerce (unsafeCoerce) -#endif - -- | The @FunctionalDependencies@ version of 'Newtype' type-class. -- -- Since Cabal-3.0 class arguments are in a different order than in @newtype@ package. @@ -40,22 +35,12 @@ import Unsafe.Coerce (unsafeCoerce) {- FOURMOLU_DISABLE -} class Newtype o n | n -> o where pack :: o -> n -#if MIN_VERSION_base(4,7,0) default pack :: Coercible o n => o -> n pack = coerce -#else - default pack :: o -> n - pack = unsafeCoerce -#endif unpack :: n -> o -#if MIN_VERSION_base(4,7,0) default unpack :: Coercible n o => n -> o unpack = coerce -#else - default unpack :: n -> o - unpack = unsafeCoerce -#endif {- FOURMOLU_ENABLE -} instance Newtype a (Identity a) diff --git a/Cabal-syntax/src/Distribution/Compat/NonEmptySet.hs b/Cabal-syntax/src/Distribution/Compat/NonEmptySet.hs index 034da7ee90c..3ece4251b29 100644 --- a/Cabal-syntax/src/Distribution/Compat/NonEmptySet.hs +++ b/Cabal-syntax/src/Distribution/Compat/NonEmptySet.hs @@ -12,6 +12,7 @@ module Distribution.Compat.NonEmptySet -- * Deletion , delete + , filter -- * Conversions , toNonEmpty @@ -32,7 +33,6 @@ import Control.DeepSeq (NFData (..)) import Data.Data (Data) import Data.List.NonEmpty (NonEmpty (..)) import Data.Semigroup (Semigroup (..)) -import Data.Typeable (Typeable) import qualified Data.Foldable as F import qualified Data.Set as Set @@ -48,7 +48,7 @@ import Control.Monad (fail) -- | @since 3.4.0.0 newtype NonEmptySet a = NES (Set.Set a) - deriving (Eq, Ord, Typeable, Data, Read) + deriving (Eq, Ord, Data, Read) ------------------------------------------------------------------------------- -- Instances @@ -87,12 +87,9 @@ instance Ord a => Semigroup (NonEmptySet a) where instance F.Foldable NonEmptySet where foldMap f (NES s) = F.foldMap f s foldr f z (NES s) = F.foldr f z s - -#if MIN_VERSION_base(4,8,0) - toList = toList - null _ = False + toList = toList + null _ = False length (NES s) = F.length s -#endif ------------------------------------------------------------------------------- -- Constructors @@ -119,6 +116,9 @@ delete x (NES xs) where res = Set.delete x xs +filter :: (a -> Bool) -> NonEmptySet a -> Set.Set a +filter predicate (NES set) = Set.filter predicate set + ------------------------------------------------------------------------------- -- Conversions ------------------------------------------------------------------------------- diff --git a/Cabal-syntax/src/Distribution/Compat/Prelude.hs b/Cabal-syntax/src/Distribution/Compat/Prelude.hs index 3cbf3c17a8a..2d6f92b5da6 100644 --- a/Cabal-syntax/src/Distribution/Compat/Prelude.hs +++ b/Cabal-syntax/src/Distribution/Compat/Prelude.hs @@ -4,14 +4,6 @@ {-# LANGUAGE Trustworthy #-} {-# LANGUAGE TypeOperators #-} -{- FOURMOLU_DISABLE -} -#ifdef MIN_VERSION_base -#define MINVER_base_411 MIN_VERSION_base(4,11,0) -#else -#define MINVER_base_411 (__GLASGOW_HASKELL__ >= 804) -#endif -{- FOURMOLU_ENABLE -} - -- | This module does two things: -- -- * Acts as a compatibility layer, like @base-compat@. @@ -194,11 +186,10 @@ import Prelude as BasePrelude hiding ( mapM, mapM_, sequence, any, all, head, tail, last, init -- partial functions , read -#if MINVER_base_411 + , foldr1, foldl1 -- As of base 4.11.0.0 Prelude exports part of Semigroup(..). -- Hide this so we instead rely on Distribution.Compat.Semigroup. , Semigroup(..) -#endif , Word -- We hide them, as we import only some members , Traversable, traverse, sequenceA @@ -243,11 +234,11 @@ import Data.Ord (comparing) import Data.Proxy (Proxy (..)) import Data.Set (Set) import Data.String (IsString (..)) +import Data.Typeable (TypeRep, Typeable, typeRep) import Data.Void (Void, absurd, vacuous) import Data.Word (Word, Word16, Word32, Word64, Word8) import Distribution.Compat.Binary (Binary (..)) import Distribution.Compat.Semigroup (Semigroup (..), gmappend, gmempty) -import Distribution.Compat.Typeable (TypeRep, Typeable, typeRep) import GHC.Generics (Generic (..), K1 (unK1), M1 (unM1), U1 (U1), V1, (:*:) ((:*:)), (:+:) (L1, R1)) import System.Exit (ExitCode (..), exitFailure, exitSuccess, exitWith) import Text.Read (readMaybe) diff --git a/Cabal-syntax/src/Distribution/Compat/Semigroup.hs b/Cabal-syntax/src/Distribution/Compat/Semigroup.hs index 9db9f6ebe98..9ebc7f0f7f4 100644 --- a/Cabal-syntax/src/Distribution/Compat/Semigroup.hs +++ b/Cabal-syntax/src/Distribution/Compat/Semigroup.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} @@ -18,7 +17,6 @@ module Distribution.Compat.Semigroup , gmempty ) where -import Data.Typeable (Typeable) import Distribution.Compat.Binary (Binary) import Distribution.Utils.Structured (Structured) @@ -39,7 +37,7 @@ instance Semigroup (First' a) where -- | A copy of 'Data.Semigroup.Last'. newtype Last' a = Last' {getLast' :: a} - deriving (Eq, Ord, Read, Show, Generic, Binary, Typeable) + deriving (Eq, Ord, Read, Show, Generic, Binary) instance Structured a => Structured (Last' a) @@ -52,7 +50,7 @@ instance Functor Last' where -- | A wrapper around 'Maybe', providing the 'Semigroup' and 'Monoid' instances -- implemented for 'Maybe' since @base-4.11@. newtype Option' a = Option' {getOption' :: Maybe a} - deriving (Eq, Ord, Read, Show, Binary, Generic, Functor, Typeable) + deriving (Eq, Ord, Read, Show, Binary, Generic, Functor) instance Structured a => Structured (Option' a) diff --git a/Cabal-syntax/src/Distribution/Compat/Typeable.hs b/Cabal-syntax/src/Distribution/Compat/Typeable.hs deleted file mode 100644 index 161f868a823..00000000000 --- a/Cabal-syntax/src/Distribution/Compat/Typeable.hs +++ /dev/null @@ -1,19 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE ScopedTypeVariables #-} - -module Distribution.Compat.Typeable - ( Typeable - , TypeRep - , typeRep - ) where - -#if MIN_VERSION_base(4,7,0) -import Data.Typeable (Typeable, TypeRep, typeRep) -#else -import Data.Typeable (Typeable, TypeRep, typeOf) -#endif - -#if !MIN_VERSION_base(4,7,0) -typeRep :: forall a proxy. Typeable a => proxy a -> TypeRep -typeRep _ = typeOf (undefined :: a) -#endif diff --git a/Cabal-syntax/src/Distribution/Compiler.hs b/Cabal-syntax/src/Distribution/Compiler.hs index 8fb3f88851e..40148776ee1 100644 --- a/Cabal-syntax/src/Distribution/Compiler.hs +++ b/Cabal-syntax/src/Distribution/Compiler.hs @@ -1,6 +1,4 @@ {-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveTraversable #-} @@ -75,9 +73,12 @@ data CompilerFlavor | LHC | UHC | Eta + | -- | @since 3.12.1.0 + -- MicroHS, see https://github.com/augustss/MicroHs + MHS | HaskellSuite String -- string is the id of the actual compiler | OtherCompiler String - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Binary CompilerFlavor instance Structured CompilerFlavor @@ -85,7 +86,7 @@ instance NFData CompilerFlavor where rnf = genericRnf knownCompilerFlavors :: [CompilerFlavor] knownCompilerFlavors = - [GHC, GHCJS, NHC, YHC, Hugs, HBC, Helium, JHC, LHC, UHC, Eta] + [GHC, GHCJS, NHC, YHC, Hugs, HBC, Helium, JHC, LHC, UHC, Eta, MHS] instance Pretty CompilerFlavor where pretty (OtherCompiler name) = Disp.text name @@ -142,7 +143,6 @@ data PerCompilerFlavor v = PerCompilerFlavor v v , Read , Eq , Ord - , Typeable , Data , Functor , Foldable @@ -173,7 +173,7 @@ instance (Semigroup a, Monoid a) => Monoid (PerCompilerFlavor a) where -- ------------------------------------------------------------ data CompilerId = CompilerId CompilerFlavor Version - deriving (Eq, Generic, Ord, Read, Show, Typeable) + deriving (Eq, Generic, Ord, Read, Show) instance Binary CompilerId instance Structured CompilerId @@ -223,7 +223,7 @@ instance Binary CompilerInfo data AbiTag = NoAbiTag | AbiTag String - deriving (Eq, Generic, Show, Read, Typeable) + deriving (Eq, Generic, Show, Read) instance Binary AbiTag instance Structured AbiTag diff --git a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs index d39e77ebbeb..8123285e2b9 100644 --- a/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs +++ b/Cabal-syntax/src/Distribution/FieldGrammar/Newtypes.hs @@ -1,8 +1,8 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} -{-# LANGUAGE FunctionalDependencies #-} {-# LANGUAGE InstanceSigs #-} +{-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} diff --git a/Cabal-syntax/src/Distribution/Fields/Field.hs b/Cabal-syntax/src/Distribution/Fields/Field.hs index c7d63533e52..496e847b1d0 100644 --- a/Cabal-syntax/src/Distribution/Fields/Field.hs +++ b/Cabal-syntax/src/Distribution/Fields/Field.hs @@ -1,12 +1,10 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE StandaloneDeriving #-} -- | Cabal-like file AST types: 'Field', 'Section' etc -- --- These types are parametrized by an annotation. +-- These types are parameterized by an annotation. module Distribution.Fields.Field ( -- * Cabal file Field (..) diff --git a/Cabal-syntax/src/Distribution/Fields/Lexer.x b/Cabal-syntax/src/Distribution/Fields/Lexer.x index 4fc501d5186..b9b8ad54c4e 100644 --- a/Cabal-syntax/src/Distribution/Fields/Lexer.x +++ b/Cabal-syntax/src/Distribution/Fields/Lexer.x @@ -20,7 +20,7 @@ module Distribution.Fields.Lexer ,mkLexState) where import Prelude () -import qualified Prelude as Prelude +import qualified Prelude import Distribution.Compat.Prelude import Distribution.Fields.LexerMonad diff --git a/Cabal-syntax/src/Distribution/Fields/LexerMonad.hs b/Cabal-syntax/src/Distribution/Fields/LexerMonad.hs index 601a1d579f6..2aa53d2b5dd 100644 --- a/Cabal-syntax/src/Distribution/Fields/LexerMonad.hs +++ b/Cabal-syntax/src/Distribution/Fields/LexerMonad.hs @@ -94,7 +94,7 @@ toPWarnings = Just $ PWarning PWTLexTab (NE.head poss) $ "Tabs used as indentation at " ++ intercalate ", " (NE.toList $ fmap showPos poss) toWarning LexInconsistentIndentation poss = Just $ PWarning PWTInconsistentIndentation (NE.head poss) $ "Inconsistent indentation. Indentation jumps at lines " ++ intercalate ", " (NE.toList $ fmap (show . positionRow) poss) - -- LexBraces warning about using { } delimeters is not reported as parser warning. + -- LexBraces warning about using { } delimiters is not reported as parser warning. toWarning LexBraces _ = Nothing diff --git a/Cabal-syntax/src/Distribution/Fields/ParseResult.hs b/Cabal-syntax/src/Distribution/Fields/ParseResult.hs index 7174aaa99bf..aad7de2737a 100644 --- a/Cabal-syntax/src/Distribution/Fields/ParseResult.hs +++ b/Cabal-syntax/src/Distribution/Fields/ParseResult.hs @@ -18,22 +18,11 @@ module Distribution.Fields.ParseResult , withoutWarnings ) where +import Distribution.Compat.Prelude import Distribution.Parsec.Error (PError (..)) import Distribution.Parsec.Position (Position (..), zeroPos) import Distribution.Parsec.Warning (PWarnType (..), PWarning (..)) import Distribution.Version (Version) -import Prelude () - --- liftA2 is not in base <4.10, hence we need to only import it explicitly when we're on >=4.10 --- --- Additionally, since liftA2 will be exported from Prelude starting with ~4.18, we should hide --- it from Prelude and get it from Control.Applicative to be backwards compatible and avoid warnings -#if MIN_VERSION_base(4,10,0) -import Distribution.Compat.Prelude hiding (Applicative(..)) -import Control.Applicative (Applicative (..)) -#else -import Distribution.Compat.Prelude -#endif -- | A monad with failure and accumulating errors and warnings. newtype ParseResult a = PR @@ -100,14 +89,6 @@ instance Applicative ParseResult where success s2 x' {-# INLINE (<*) #-} -#if MIN_VERSION_base(4,10,0) - liftA2 f x y = PR $ \ !s0 failure success -> - unPR x s0 failure $ \ !s1 x' -> - unPR y s1 failure $ \ !s2 y' -> - success s2 (f x' y') - {-# INLINE liftA2 #-} -#endif - instance Monad ParseResult where return = pure (>>) = (*>) diff --git a/Cabal-syntax/src/Distribution/Fields/Parser.hs b/Cabal-syntax/src/Distribution/Fields/Parser.hs index e018caa7fe0..8d04dfba260 100644 --- a/Cabal-syntax/src/Distribution/Fields/Parser.hs +++ b/Cabal-syntax/src/Distribution/Fields/Parser.hs @@ -1,7 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE PatternGuards #-} ----------------------------------------------------------------------------- diff --git a/Cabal-syntax/src/Distribution/Fields/Pretty.hs b/Cabal-syntax/src/Distribution/Fields/Pretty.hs index 58f54d2848c..d458ca41e80 100644 --- a/Cabal-syntax/src/Distribution/Fields/Pretty.hs +++ b/Cabal-syntax/src/Distribution/Fields/Pretty.hs @@ -1,6 +1,4 @@ {-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE LambdaCase #-} diff --git a/Cabal-syntax/src/Distribution/License.hs b/Cabal-syntax/src/Distribution/License.hs index f79ef6d0549..bcd2b84b63b 100644 --- a/Cabal-syntax/src/Distribution/License.hs +++ b/Cabal-syntax/src/Distribution/License.hs @@ -111,7 +111,7 @@ data License OtherLicense | -- | Indicates an erroneous license name. UnknownLicense String - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary License instance Structured License diff --git a/Cabal-syntax/src/Distribution/ModuleName.hs b/Cabal-syntax/src/Distribution/ModuleName.hs index 90082d29f06..59c318004a9 100644 --- a/Cabal-syntax/src/Distribution/ModuleName.hs +++ b/Cabal-syntax/src/Distribution/ModuleName.hs @@ -40,7 +40,7 @@ import qualified Text.PrettyPrint as Disp -- | A valid Haskell module name. newtype ModuleName = ModuleName ShortText - deriving (Eq, Generic, Ord, Read, Show, Typeable, Data) + deriving (Eq, Generic, Ord, Read, Show, Data) unModuleName :: ModuleName -> String unModuleName (ModuleName s) = fromShortText s diff --git a/Cabal-syntax/src/Distribution/Package.hs b/Cabal-syntax/src/Distribution/Package.hs index c4f20349391..9a6be33a95e 100644 --- a/Cabal-syntax/src/Distribution/Package.hs +++ b/Cabal-syntax/src/Distribution/Package.hs @@ -1,7 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} - ----------------------------------------------------------------------------- -- | diff --git a/Cabal-syntax/src/Distribution/PackageDescription/Configuration.hs b/Cabal-syntax/src/Distribution/PackageDescription/Configuration.hs index e811c361221..eebf760094d 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/Configuration.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/Configuration.hs @@ -56,12 +56,13 @@ import Distribution.System import Distribution.Types.Component import Distribution.Types.ComponentRequestedSpec import Distribution.Types.DependencyMap +import Distribution.Types.DependencySatisfaction (DependencySatisfaction (..)) +import Distribution.Types.MissingDependency (MissingDependency (..)) import Distribution.Types.PackageVersionConstraint import Distribution.Utils.Generic import Distribution.Utils.Path (sameDirectory) import Distribution.Version -import qualified Data.Map.Lazy as Map import Data.Tree (Tree (Node)) ------------------------------------------------------------------------------ @@ -144,15 +145,17 @@ parseCondition = condOr ------------------------------------------------------------------------------ --- | Result of dependency test. Isomorphic to @Maybe d@ but renamed for +-- | Result of dependency test. Isomorphic to @Maybe@ but renamed for -- clarity. -data DepTestRslt d = DepOk | MissingDeps d +data DepTestRslt + = DepOk + | MissingDeps [MissingDependency] -instance Semigroup d => Monoid (DepTestRslt d) where +instance Monoid DepTestRslt where mempty = DepOk mappend = (<>) -instance Semigroup d => Semigroup (DepTestRslt d) where +instance Semigroup DepTestRslt where DepOk <> x = x x <> DepOk = x (MissingDeps d) <> (MissingDeps d') = MissingDeps (d <> d') @@ -190,13 +193,13 @@ resolveWithFlags -> [PackageVersionConstraint] -- ^ Additional constraints -> [CondTree ConfVar [Dependency] PDTagged] - -> ([Dependency] -> DepTestRslt [Dependency]) + -> ([Dependency] -> DepTestRslt) -- ^ Dependency test function. - -> Either [Dependency] (TargetSet PDTagged, FlagAssignment) + -> Either [MissingDependency] (TargetSet PDTagged, FlagAssignment) -- ^ Either the missing dependencies (error case), or a pair of -- (set of build targets with dependencies, chosen flag assignments) resolveWithFlags dom enabled os arch impl constrs trees checkDeps = - either (Left . fromDepMapUnion) Right $ explore (build mempty dom) + explore (build mempty dom) where -- simplify trees by (partially) evaluating all conditions and converting -- dependencies to dependency maps. @@ -216,7 +219,7 @@ resolveWithFlags dom enabled os arch impl constrs trees checkDeps = -- computation overhead in the successful case. explore :: Tree FlagAssignment - -> Either DepMapUnion (TargetSet PDTagged, FlagAssignment) + -> Either [MissingDependency] (TargetSet PDTagged, FlagAssignment) explore (Node flags ts) = let targetSet = TargetSet $ @@ -229,7 +232,7 @@ resolveWithFlags dom enabled os arch impl constrs trees checkDeps = DepOk | null ts -> Right (targetSet, flags) | otherwise -> tryAll $ map explore ts - MissingDeps mds -> Left (toDepMapUnion mds) + MissingDeps mds -> Left mds -- Builds a tree of all possible flag assignments. Internal nodes -- have only partial assignments. @@ -238,18 +241,18 @@ resolveWithFlags dom enabled os arch impl constrs trees checkDeps = build assigned ((fn, vals) : unassigned) = Node assigned $ map (\v -> build (insertFlagAssignment fn v assigned) unassigned) vals - tryAll :: [Either DepMapUnion a] -> Either DepMapUnion a + tryAll :: Monoid a => [Either a b] -> Either a b tryAll = foldr mp mz -- special version of `mplus' for our local purposes - mp :: Either DepMapUnion a -> Either DepMapUnion a -> Either DepMapUnion a + mp :: Monoid a => Either a b -> Either a b -> Either a b mp m@(Right _) _ = m mp _ m@(Right _) = m mp (Left xs) (Left ys) = Left (xs <> ys) -- `mzero' - mz :: Either DepMapUnion a - mz = Left (DepMapUnion Map.empty) + mz :: Monoid a => Either a b + mz = Left mempty env :: FlagAssignment -> FlagName -> Either FlagName Bool env flags flag = (maybe (Left flag) Right . lookupFlagAssignment flag) flags @@ -323,27 +326,6 @@ extractConditions f gpkg = , extractCondition (f . benchmarkBuildInfo) . snd <$> condBenchmarks gpkg ] --- | A map of package constraints that combines version ranges using 'unionVersionRanges'. -newtype DepMapUnion = DepMapUnion {unDepMapUnion :: Map PackageName (VersionRange, NonEmptySet LibraryName)} - -instance Semigroup DepMapUnion where - DepMapUnion x <> DepMapUnion y = - DepMapUnion $ - Map.unionWith unionVersionRanges' x y - -unionVersionRanges' - :: (VersionRange, NonEmptySet LibraryName) - -> (VersionRange, NonEmptySet LibraryName) - -> (VersionRange, NonEmptySet LibraryName) -unionVersionRanges' (vr, cs) (vr', cs') = (unionVersionRanges vr vr', cs <> cs') - -toDepMapUnion :: [Dependency] -> DepMapUnion -toDepMapUnion ds = - DepMapUnion $ Map.fromListWith unionVersionRanges' [(p, (vr, cs)) | Dependency p vr cs <- ds] - -fromDepMapUnion :: DepMapUnion -> [Dependency] -fromDepMapUnion m = [Dependency p vr cs | (p, (vr, cs)) <- Map.toList (unDepMapUnion m)] - freeVars :: CondTree ConfVar c a -> [FlagName] freeVars t = [f | PackageFlag f <- freeVars' t] where @@ -453,7 +435,7 @@ finalizePD :: FlagAssignment -- ^ Explicitly specified flag assignments -> ComponentRequestedSpec - -> (Dependency -> Bool) + -> (Dependency -> DependencySatisfaction) -- ^ Is a given dependency satisfiable from the set of -- available packages? If this is unknown then use -- True. @@ -465,7 +447,7 @@ finalizePD -- ^ Additional constraints -> GenericPackageDescription -> Either - [Dependency] + [MissingDependency] (PackageDescription, FlagAssignment) -- ^ Either missing dependencies or the resolved package -- description along with the flag assignments chosen. @@ -526,7 +508,11 @@ finalizePD | otherwise -> [b, not b] -- flagDefaults = map (\(n,x:_) -> (n,x)) flagChoices check ds = - let missingDeps = filter (not . satisfyDep) ds + let missingDeps = + [ MissingDependency dependency reason + | (dependency, Unsatisfied reason) <- + map (\dependency -> (dependency, satisfyDep dependency)) ds + ] in if null missingDeps then DepOk else MissingDeps missingDeps diff --git a/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs b/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs index db6b7f7607b..49db03ee3c1 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs @@ -143,6 +143,8 @@ packageDescriptionFieldGrammar = <*> monoidalFieldAla "extra-source-files" formatExtraSourceFiles L.extraSrcFiles <*> monoidalFieldAla "extra-tmp-files" (alaList' VCat RelativePathNT) L.extraTmpFiles <*> monoidalFieldAla "extra-doc-files" formatExtraSourceFiles L.extraDocFiles + <*> monoidalFieldAla "extra-files" formatExtraSourceFiles L.extraFiles + ^^^ availableSince CabalSpecV3_14 [] where packageIdentifierGrammar = PackageIdentifier @@ -673,6 +675,7 @@ buildInfoFieldGrammar = <*> optionsFieldGrammar <*> profOptionsFieldGrammar <*> sharedOptionsFieldGrammar + <*> profSharedOptionsFieldGrammar <*> pure mempty -- static-options ??? <*> prefixedFields "x-" L.customFieldsBI <*> monoidalFieldAla "build-depends" formatDependencyList L.targetBuildDepends @@ -738,6 +741,19 @@ sharedOptionsFieldGrammar = extract :: CompilerFlavor -> ALens' BuildInfo [String] extract flavor = L.sharedOptions . lookupLens flavor +profSharedOptionsFieldGrammar + :: (FieldGrammar c g, Applicative (g BuildInfo), c (List NoCommaFSep Token' String)) + => g BuildInfo (PerCompilerFlavor [String]) +profSharedOptionsFieldGrammar = + PerCompilerFlavor + <$> monoidalFieldAla "ghc-prof-shared-options" (alaList' NoCommaFSep Token') (extract GHC) + ^^^ availableSince CabalSpecV3_14 [] + <*> monoidalFieldAla "ghcjs-prof-shared-options" (alaList' NoCommaFSep Token') (extract GHCJS) + ^^^ availableSince CabalSpecV3_14 [] + where + extract :: CompilerFlavor -> ALens' BuildInfo [String] + extract flavor = L.profSharedOptions . lookupLens flavor + lookupLens :: (Functor f, Monoid v) => CompilerFlavor -> LensLike' f (PerCompilerFlavor v) v lookupLens k f p@(PerCompilerFlavor ghc ghcjs) | k == GHC = (\n -> PerCompilerFlavor n ghcjs) <$> f ghc diff --git a/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs b/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs index ae4c0cfec6b..e9fced4f770 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs @@ -679,7 +679,7 @@ processImports v fromBuildInfo commonStanzas = go [] fields' <- catMaybes <$> traverse (warnImport v) fields pure $ (fields', \x -> foldr (mergeCommonStanza fromBuildInfo) x acc) --- | Warn on "import" fields, also map to Maybe, so errorneous fields can be filtered +-- | Warn on "import" fields, also map to Maybe, so erroneous fields can be filtered warnImport :: CabalSpecVersion -> Field Position -> ParseResult (Maybe (Field Position)) warnImport v (Field (Name pos name) _) | name == "import" = do if specHasCommonStanzas v == NoCommonStanzas diff --git a/Cabal-syntax/src/Distribution/Parsec.hs b/Cabal-syntax/src/Distribution/Parsec.hs index 4c6e31e5aaa..3bf62597222 100644 --- a/Cabal-syntax/src/Distribution/Parsec.hs +++ b/Cabal-syntax/src/Distribution/Parsec.hs @@ -145,10 +145,6 @@ instance Monad ParsecParser where (>>) = (*>) {-# INLINE (>>) #-} -#if !(MIN_VERSION_base(4,13,0)) - fail = Fail.fail -#endif - instance MonadPlus ParsecParser where mzero = empty mplus = (<|>) diff --git a/Cabal-syntax/src/Distribution/Pretty.hs b/Cabal-syntax/src/Distribution/Pretty.hs index 3ddb806d81b..fcb0a7f0d0b 100644 --- a/Cabal-syntax/src/Distribution/Pretty.hs +++ b/Cabal-syntax/src/Distribution/Pretty.hs @@ -10,6 +10,8 @@ module Distribution.Pretty , showTokenStr , showFreeText , showFreeTextV3 + , commaSpaceSep + , commaSep -- * Deprecated , Separator @@ -118,3 +120,11 @@ lines_ s = in l : case s' of [] -> [] (_ : s'') -> lines_ s'' + +-- | Separate a list of documents by commas and spaces. +commaSpaceSep :: Pretty a => [a] -> PP.Doc +commaSpaceSep = PP.hsep . PP.punctuate PP.comma . map pretty + +-- | Separate a list of documents by commas. +commaSep :: Pretty a => [a] -> PP.Doc +commaSep = PP.hcat . PP.punctuate PP.comma . map pretty diff --git a/Cabal-syntax/src/Distribution/SPDX/License.hs b/Cabal-syntax/src/Distribution/SPDX/License.hs index af271e9115a..2331e66c669 100644 --- a/Cabal-syntax/src/Distribution/SPDX/License.hs +++ b/Cabal-syntax/src/Distribution/SPDX/License.hs @@ -41,7 +41,7 @@ data License NONE | -- | A valid SPDX License Expression as defined in Appendix IV. License LicenseExpression - deriving (Show, Read, Eq, Ord, Typeable, Data, Generic) + deriving (Show, Read, Eq, Ord, Data, Generic) instance Binary License instance Structured License diff --git a/Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs b/Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs index 6246d8df41d..19c2507446d 100644 --- a/Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs +++ b/Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs @@ -30,76 +30,81 @@ import qualified Text.PrettyPrint as Disp -- LicenseExceptionId ------------------------------------------------------------------------------- --- | SPDX License Exceptions identifiers list v3.23 +-- | SPDX License Exceptions identifiers list v3.25 data LicenseExceptionId - = DS389_exception -- ^ @389-exception@, 389 Directory Server Exception - | Asterisk_exception -- ^ @Asterisk-exception@, Asterisk exception, SPDX License List 3.23 + = N_389_exception -- ^ @389-exception@, 389 Directory Server Exception + | Asterisk_exception -- ^ @Asterisk-exception@, Asterisk exception, SPDX License List 3.23, SPDX License List 3.25 + | Asterisk_linking_protocols_exception -- ^ @Asterisk-linking-protocols-exception@, Asterisk linking protocols exception, SPDX License List 3.25 | Autoconf_exception_2_0 -- ^ @Autoconf-exception-2.0@, Autoconf exception 2.0 | Autoconf_exception_3_0 -- ^ @Autoconf-exception-3.0@, Autoconf exception 3.0 - | Autoconf_exception_generic_3_0 -- ^ @Autoconf-exception-generic-3.0@, Autoconf generic exception for GPL-3.0, SPDX License List 3.23 - | Autoconf_exception_generic -- ^ @Autoconf-exception-generic@, Autoconf generic exception, SPDX License List 3.23 - | Autoconf_exception_macro -- ^ @Autoconf-exception-macro@, Autoconf macro exception, SPDX License List 3.23 - | Bison_exception_1_24 -- ^ @Bison-exception-1.24@, Bison exception 1.24, SPDX License List 3.23 + | Autoconf_exception_generic_3_0 -- ^ @Autoconf-exception-generic-3.0@, Autoconf generic exception for GPL-3.0, SPDX License List 3.23, SPDX License List 3.25 + | Autoconf_exception_generic -- ^ @Autoconf-exception-generic@, Autoconf generic exception, SPDX License List 3.23, SPDX License List 3.25 + | Autoconf_exception_macro -- ^ @Autoconf-exception-macro@, Autoconf macro exception, SPDX License List 3.23, SPDX License List 3.25 + | Bison_exception_1_24 -- ^ @Bison-exception-1.24@, Bison exception 1.24, SPDX License List 3.23, SPDX License List 3.25 | Bison_exception_2_2 -- ^ @Bison-exception-2.2@, Bison exception 2.2 | Bootloader_exception -- ^ @Bootloader-exception@, Bootloader Distribution Exception | Classpath_exception_2_0 -- ^ @Classpath-exception-2.0@, Classpath exception 2.0 | CLISP_exception_2_0 -- ^ @CLISP-exception-2.0@, CLISP exception 2.0 - | Cryptsetup_OpenSSL_exception -- ^ @cryptsetup-OpenSSL-exception@, cryptsetup OpenSSL exception, SPDX License List 3.23 + | Cryptsetup_OpenSSL_exception -- ^ @cryptsetup-OpenSSL-exception@, cryptsetup OpenSSL exception, SPDX License List 3.23, SPDX License List 3.25 | DigiRule_FOSS_exception -- ^ @DigiRule-FOSS-exception@, DigiRule FOSS License Exception | ECos_exception_2_0 -- ^ @eCos-exception-2.0@, eCos exception 2.0 + | Erlang_otp_linking_exception -- ^ @erlang-otp-linking-exception@, Erlang/OTP Linking Exception, SPDX License List 3.25 | Fawkes_Runtime_exception -- ^ @Fawkes-Runtime-exception@, Fawkes Runtime Exception | FLTK_exception -- ^ @FLTK-exception@, FLTK exception - | Fmt_exception -- ^ @fmt-exception@, fmt exception, SPDX License List 3.23 + | Fmt_exception -- ^ @fmt-exception@, fmt exception, SPDX License List 3.23, SPDX License List 3.25 | Font_exception_2_0 -- ^ @Font-exception-2.0@, Font exception 2.0 | Freertos_exception_2_0 -- ^ @freertos-exception-2.0@, FreeRTOS Exception 2.0 - | GCC_exception_2_0_note -- ^ @GCC-exception-2.0-note@, GCC Runtime Library exception 2.0 - note variant, SPDX License List 3.23 + | GCC_exception_2_0_note -- ^ @GCC-exception-2.0-note@, GCC Runtime Library exception 2.0 - note variant, SPDX License List 3.23, SPDX License List 3.25 | GCC_exception_2_0 -- ^ @GCC-exception-2.0@, GCC Runtime Library exception 2.0 | GCC_exception_3_1 -- ^ @GCC-exception-3.1@, GCC Runtime Library exception 3.1 - | Gmsh_exception -- ^ @Gmsh-exception@, Gmsh exception>, SPDX License List 3.23 - | GNAT_exception -- ^ @GNAT-exception@, GNAT exception, SPDX License List 3.23 - | GNOME_examples_exception -- ^ @GNOME-examples-exception@, GNOME examples exception, SPDX License List 3.23 - | GNU_compiler_exception -- ^ @GNU-compiler-exception@, GNU Compiler Exception, SPDX License List 3.23 + | Gmsh_exception -- ^ @Gmsh-exception@, Gmsh exception>, SPDX License List 3.23, SPDX License List 3.25 + | GNAT_exception -- ^ @GNAT-exception@, GNAT exception, SPDX License List 3.23, SPDX License List 3.25 + | GNOME_examples_exception -- ^ @GNOME-examples-exception@, GNOME examples exception, SPDX License List 3.23, SPDX License List 3.25 + | GNU_compiler_exception -- ^ @GNU-compiler-exception@, GNU Compiler Exception, SPDX License List 3.23, SPDX License List 3.25 | Gnu_javamail_exception -- ^ @gnu-javamail-exception@, GNU JavaMail exception - | GPL_3_0_interface_exception -- ^ @GPL-3.0-interface-exception@, GPL-3.0 Interface Exception, SPDX License List 3.23 - | GPL_3_0_linking_exception -- ^ @GPL-3.0-linking-exception@, GPL-3.0 Linking Exception, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GPL_3_0_linking_source_exception -- ^ @GPL-3.0-linking-source-exception@, GPL-3.0 Linking Exception (with Corresponding Source), SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GPL_CC_1_0 -- ^ @GPL-CC-1.0@, GPL Cooperation Commitment 1.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GStreamer_exception_2005 -- ^ @GStreamer-exception-2005@, GStreamer Exception (2005), SPDX License List 3.23 - | GStreamer_exception_2008 -- ^ @GStreamer-exception-2008@, GStreamer Exception (2008), SPDX License List 3.23 + | GPL_3_0_interface_exception -- ^ @GPL-3.0-interface-exception@, GPL-3.0 Interface Exception, SPDX License List 3.23, SPDX License List 3.25 + | GPL_3_0_linking_exception -- ^ @GPL-3.0-linking-exception@, GPL-3.0 Linking Exception, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GPL_3_0_linking_source_exception -- ^ @GPL-3.0-linking-source-exception@, GPL-3.0 Linking Exception (with Corresponding Source), SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GPL_CC_1_0 -- ^ @GPL-CC-1.0@, GPL Cooperation Commitment 1.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GStreamer_exception_2005 -- ^ @GStreamer-exception-2005@, GStreamer Exception (2005), SPDX License List 3.23, SPDX License List 3.25 + | GStreamer_exception_2008 -- ^ @GStreamer-exception-2008@, GStreamer Exception (2008), SPDX License List 3.23, SPDX License List 3.25 | I2p_gpl_java_exception -- ^ @i2p-gpl-java-exception@, i2p GPL+Java Exception - | KiCad_libraries_exception -- ^ @KiCad-libraries-exception@, KiCad Libraries Exception, SPDX License List 3.23 - | LGPL_3_0_linking_exception -- ^ @LGPL-3.0-linking-exception@, LGPL-3.0 Linking Exception, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Libpri_OpenH323_exception -- ^ @libpri-OpenH323-exception@, libpri OpenH323 exception, SPDX License List 3.23 + | KiCad_libraries_exception -- ^ @KiCad-libraries-exception@, KiCad Libraries Exception, SPDX License List 3.23, SPDX License List 3.25 + | LGPL_3_0_linking_exception -- ^ @LGPL-3.0-linking-exception@, LGPL-3.0 Linking Exception, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Libpri_OpenH323_exception -- ^ @libpri-OpenH323-exception@, libpri OpenH323 exception, SPDX License List 3.23, SPDX License List 3.25 | Libtool_exception -- ^ @Libtool-exception@, Libtool Exception | Linux_syscall_note -- ^ @Linux-syscall-note@, Linux Syscall Note - | LLGPL -- ^ @LLGPL@, LLGPL Preamble, SPDX License List 3.23 - | LLVM_exception -- ^ @LLVM-exception@, LLVM Exception, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | LLGPL -- ^ @LLGPL@, LLGPL Preamble, SPDX License List 3.23, SPDX License List 3.25 + | LLVM_exception -- ^ @LLVM-exception@, LLVM Exception, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | LZMA_exception -- ^ @LZMA-exception@, LZMA exception | Mif_exception -- ^ @mif-exception@, Macros and Inline Functions Exception | Nokia_Qt_exception_1_1 -- ^ @Nokia-Qt-exception-1.1@, Nokia Qt LGPL exception 1.1, SPDX License List 3.0, SPDX License List 3.2 - | OCaml_LGPL_linking_exception -- ^ @OCaml-LGPL-linking-exception@, OCaml LGPL Linking Exception, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | OCaml_LGPL_linking_exception -- ^ @OCaml-LGPL-linking-exception@, OCaml LGPL Linking Exception, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | OCCT_exception_1_0 -- ^ @OCCT-exception-1.0@, Open CASCADE Exception 1.0 - | OpenJDK_assembly_exception_1_0 -- ^ @OpenJDK-assembly-exception-1.0@, OpenJDK Assembly exception 1.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | OpenJDK_assembly_exception_1_0 -- ^ @OpenJDK-assembly-exception-1.0@, OpenJDK Assembly exception 1.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Openvpn_openssl_exception -- ^ @openvpn-openssl-exception@, OpenVPN OpenSSL Exception - | PS_or_PDF_font_exception_20170817 -- ^ @PS-or-PDF-font-exception-20170817@, PS/PDF font exception (2017-08-17), SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | QPL_1_0_INRIA_2004_exception -- ^ @QPL-1.0-INRIA-2004-exception@, INRIA QPL 1.0 2004 variant exception, SPDX License List 3.23 - | Qt_GPL_exception_1_0 -- ^ @Qt-GPL-exception-1.0@, Qt GPL exception 1.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Qt_LGPL_exception_1_1 -- ^ @Qt-LGPL-exception-1.1@, Qt LGPL exception 1.1, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | PCRE2_exception -- ^ @PCRE2-exception@, PCRE2 exception, SPDX License List 3.25 + | PS_or_PDF_font_exception_20170817 -- ^ @PS-or-PDF-font-exception-20170817@, PS/PDF font exception (2017-08-17), SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | QPL_1_0_INRIA_2004_exception -- ^ @QPL-1.0-INRIA-2004-exception@, INRIA QPL 1.0 2004 variant exception, SPDX License List 3.23, SPDX License List 3.25 + | Qt_GPL_exception_1_0 -- ^ @Qt-GPL-exception-1.0@, Qt GPL exception 1.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Qt_LGPL_exception_1_1 -- ^ @Qt-LGPL-exception-1.1@, Qt LGPL exception 1.1, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Qwt_exception_1_0 -- ^ @Qwt-exception-1.0@, Qwt exception 1.0 - | SANE_exception -- ^ @SANE-exception@, SANE Exception, SPDX License List 3.23 - | SHL_2_0 -- ^ @SHL-2.0@, Solderpad Hardware License v2.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | SHL_2_1 -- ^ @SHL-2.1@, Solderpad Hardware License v2.1, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Stunnel_exception -- ^ @stunnel-exception@, stunnel Exception, SPDX License List 3.23 - | SWI_exception -- ^ @SWI-exception@, SWI exception, SPDX License List 3.23 - | Swift_exception -- ^ @Swift-exception@, Swift Exception, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Texinfo_exception -- ^ @Texinfo-exception@, Texinfo exception, SPDX License List 3.23 + | Romic_exception -- ^ @romic-exception@, Romic Exception, SPDX License List 3.25 + | RRDtool_FLOSS_exception_2_0 -- ^ @RRDtool-FLOSS-exception-2.0@, RRDtool FLOSS exception 2.0, SPDX License List 3.25 + | SANE_exception -- ^ @SANE-exception@, SANE Exception, SPDX License List 3.23, SPDX License List 3.25 + | SHL_2_0 -- ^ @SHL-2.0@, Solderpad Hardware License v2.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | SHL_2_1 -- ^ @SHL-2.1@, Solderpad Hardware License v2.1, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Stunnel_exception -- ^ @stunnel-exception@, stunnel Exception, SPDX License List 3.23, SPDX License List 3.25 + | SWI_exception -- ^ @SWI-exception@, SWI exception, SPDX License List 3.23, SPDX License List 3.25 + | Swift_exception -- ^ @Swift-exception@, Swift Exception, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Texinfo_exception -- ^ @Texinfo-exception@, Texinfo exception, SPDX License List 3.23, SPDX License List 3.25 | U_boot_exception_2_0 -- ^ @u-boot-exception-2.0@, U-Boot exception 2.0 - | UBDL_exception -- ^ @UBDL-exception@, Unmodified Binary Distribution exception, SPDX License List 3.23 - | Universal_FOSS_exception_1_0 -- ^ @Universal-FOSS-exception-1.0@, Universal FOSS Exception, Version 1.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Vsftpd_openssl_exception -- ^ @vsftpd-openssl-exception@, vsftpd OpenSSL exception, SPDX License List 3.23 + | UBDL_exception -- ^ @UBDL-exception@, Unmodified Binary Distribution exception, SPDX License List 3.23, SPDX License List 3.25 + | Universal_FOSS_exception_1_0 -- ^ @Universal-FOSS-exception-1.0@, Universal FOSS Exception, Version 1.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Vsftpd_openssl_exception -- ^ @vsftpd-openssl-exception@, vsftpd OpenSSL exception, SPDX License List 3.23, SPDX License List 3.25 | WxWindows_exception_3_1 -- ^ @WxWindows-exception-3.1@, WxWindows Library Exception 3.1 - | X11vnc_openssl_exception -- ^ @x11vnc-openssl-exception@, x11vnc OpenSSL Exception, SPDX License List 3.23 - deriving (Eq, Ord, Enum, Bounded, Show, Read, Typeable, Data, Generic) + | X11vnc_openssl_exception -- ^ @x11vnc-openssl-exception@, x11vnc OpenSSL Exception, SPDX License List 3.23, SPDX License List 3.25 + deriving (Eq, Ord, Enum, Bounded, Show, Read, Data, Generic) instance Binary LicenseExceptionId where put = Binary.putWord8 . fromIntegral . fromEnum @@ -132,8 +137,9 @@ instance NFData LicenseExceptionId where -- | License SPDX identifier, e.g. @"BSD-3-Clause"@. licenseExceptionId :: LicenseExceptionId -> String -licenseExceptionId DS389_exception = "389-exception" +licenseExceptionId N_389_exception = "389-exception" licenseExceptionId Asterisk_exception = "Asterisk-exception" +licenseExceptionId Asterisk_linking_protocols_exception = "Asterisk-linking-protocols-exception" licenseExceptionId Autoconf_exception_2_0 = "Autoconf-exception-2.0" licenseExceptionId Autoconf_exception_3_0 = "Autoconf-exception-3.0" licenseExceptionId Autoconf_exception_generic_3_0 = "Autoconf-exception-generic-3.0" @@ -147,6 +153,7 @@ licenseExceptionId CLISP_exception_2_0 = "CLISP-exception-2.0" licenseExceptionId Cryptsetup_OpenSSL_exception = "cryptsetup-OpenSSL-exception" licenseExceptionId DigiRule_FOSS_exception = "DigiRule-FOSS-exception" licenseExceptionId ECos_exception_2_0 = "eCos-exception-2.0" +licenseExceptionId Erlang_otp_linking_exception = "erlang-otp-linking-exception" licenseExceptionId Fawkes_Runtime_exception = "Fawkes-Runtime-exception" licenseExceptionId FLTK_exception = "FLTK-exception" licenseExceptionId Fmt_exception = "fmt-exception" @@ -181,11 +188,14 @@ licenseExceptionId OCaml_LGPL_linking_exception = "OCaml-LGPL-linking-exception" licenseExceptionId OCCT_exception_1_0 = "OCCT-exception-1.0" licenseExceptionId OpenJDK_assembly_exception_1_0 = "OpenJDK-assembly-exception-1.0" licenseExceptionId Openvpn_openssl_exception = "openvpn-openssl-exception" +licenseExceptionId PCRE2_exception = "PCRE2-exception" licenseExceptionId PS_or_PDF_font_exception_20170817 = "PS-or-PDF-font-exception-20170817" licenseExceptionId QPL_1_0_INRIA_2004_exception = "QPL-1.0-INRIA-2004-exception" licenseExceptionId Qt_GPL_exception_1_0 = "Qt-GPL-exception-1.0" licenseExceptionId Qt_LGPL_exception_1_1 = "Qt-LGPL-exception-1.1" licenseExceptionId Qwt_exception_1_0 = "Qwt-exception-1.0" +licenseExceptionId Romic_exception = "romic-exception" +licenseExceptionId RRDtool_FLOSS_exception_2_0 = "RRDtool-FLOSS-exception-2.0" licenseExceptionId SANE_exception = "SANE-exception" licenseExceptionId SHL_2_0 = "SHL-2.0" licenseExceptionId SHL_2_1 = "SHL-2.1" @@ -202,8 +212,9 @@ licenseExceptionId X11vnc_openssl_exception = "x11vnc-openssl-exception" -- | License name, e.g. @"GNU General Public License v2.0 only"@ licenseExceptionName :: LicenseExceptionId -> String -licenseExceptionName DS389_exception = "389 Directory Server Exception" +licenseExceptionName N_389_exception = "389 Directory Server Exception" licenseExceptionName Asterisk_exception = "Asterisk exception" +licenseExceptionName Asterisk_linking_protocols_exception = "Asterisk linking protocols exception" licenseExceptionName Autoconf_exception_2_0 = "Autoconf exception 2.0" licenseExceptionName Autoconf_exception_3_0 = "Autoconf exception 3.0" licenseExceptionName Autoconf_exception_generic_3_0 = "Autoconf generic exception for GPL-3.0" @@ -217,6 +228,7 @@ licenseExceptionName CLISP_exception_2_0 = "CLISP exception 2.0" licenseExceptionName Cryptsetup_OpenSSL_exception = "cryptsetup OpenSSL exception" licenseExceptionName DigiRule_FOSS_exception = "DigiRule FOSS License Exception" licenseExceptionName ECos_exception_2_0 = "eCos exception 2.0" +licenseExceptionName Erlang_otp_linking_exception = "Erlang/OTP Linking Exception" licenseExceptionName Fawkes_Runtime_exception = "Fawkes Runtime Exception" licenseExceptionName FLTK_exception = "FLTK exception" licenseExceptionName Fmt_exception = "fmt exception" @@ -251,11 +263,14 @@ licenseExceptionName OCaml_LGPL_linking_exception = "OCaml LGPL Linking Exceptio licenseExceptionName OCCT_exception_1_0 = "Open CASCADE Exception 1.0" licenseExceptionName OpenJDK_assembly_exception_1_0 = "OpenJDK Assembly exception 1.0" licenseExceptionName Openvpn_openssl_exception = "OpenVPN OpenSSL Exception" +licenseExceptionName PCRE2_exception = "PCRE2 exception" licenseExceptionName PS_or_PDF_font_exception_20170817 = "PS/PDF font exception (2017-08-17)" licenseExceptionName QPL_1_0_INRIA_2004_exception = "INRIA QPL 1.0 2004 variant exception" licenseExceptionName Qt_GPL_exception_1_0 = "Qt GPL exception 1.0" licenseExceptionName Qt_LGPL_exception_1_1 = "Qt LGPL exception 1.1" licenseExceptionName Qwt_exception_1_0 = "Qwt exception 1.0" +licenseExceptionName Romic_exception = "Romic Exception" +licenseExceptionName RRDtool_FLOSS_exception_2_0 = "RRDtool FLOSS exception 2.0" licenseExceptionName SANE_exception = "SANE Exception" licenseExceptionName SHL_2_0 = "Solderpad Hardware License v2.0" licenseExceptionName SHL_2_1 = "Solderpad Hardware License v2.1" @@ -394,6 +409,54 @@ licenseExceptionIdList LicenseListVersion_3_23 = , X11vnc_openssl_exception ] ++ bulkOfLicenses +licenseExceptionIdList LicenseListVersion_3_25 = + [ Asterisk_exception + , Asterisk_linking_protocols_exception + , Autoconf_exception_generic_3_0 + , Autoconf_exception_generic + , Autoconf_exception_macro + , Bison_exception_1_24 + , Cryptsetup_OpenSSL_exception + , Erlang_otp_linking_exception + , Fmt_exception + , GCC_exception_2_0_note + , Gmsh_exception + , GNAT_exception + , GNOME_examples_exception + , GNU_compiler_exception + , GPL_3_0_interface_exception + , GPL_3_0_linking_exception + , GPL_3_0_linking_source_exception + , GPL_CC_1_0 + , GStreamer_exception_2005 + , GStreamer_exception_2008 + , KiCad_libraries_exception + , LGPL_3_0_linking_exception + , Libpri_OpenH323_exception + , LLGPL + , LLVM_exception + , OCaml_LGPL_linking_exception + , OpenJDK_assembly_exception_1_0 + , PCRE2_exception + , PS_or_PDF_font_exception_20170817 + , QPL_1_0_INRIA_2004_exception + , Qt_GPL_exception_1_0 + , Qt_LGPL_exception_1_1 + , Romic_exception + , RRDtool_FLOSS_exception_2_0 + , SANE_exception + , SHL_2_0 + , SHL_2_1 + , Stunnel_exception + , SWI_exception + , Swift_exception + , Texinfo_exception + , UBDL_exception + , Universal_FOSS_exception_1_0 + , Vsftpd_openssl_exception + , X11vnc_openssl_exception + ] + ++ bulkOfLicenses -- | Create a 'LicenseExceptionId' from a 'String'. mkLicenseExceptionId :: LicenseListVersion -> String -> Maybe LicenseExceptionId @@ -404,6 +467,7 @@ mkLicenseExceptionId LicenseListVersion_3_9 s = Map.lookup s stringLookup_3_9 mkLicenseExceptionId LicenseListVersion_3_10 s = Map.lookup s stringLookup_3_10 mkLicenseExceptionId LicenseListVersion_3_16 s = Map.lookup s stringLookup_3_16 mkLicenseExceptionId LicenseListVersion_3_23 s = Map.lookup s stringLookup_3_23 +mkLicenseExceptionId LicenseListVersion_3_25 s = Map.lookup s stringLookup_3_25 stringLookup_3_0 :: Map String LicenseExceptionId stringLookup_3_0 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ @@ -433,10 +497,14 @@ stringLookup_3_23 :: Map String LicenseExceptionId stringLookup_3_23 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ licenseExceptionIdList LicenseListVersion_3_23 +stringLookup_3_25 :: Map String LicenseExceptionId +stringLookup_3_25 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ + licenseExceptionIdList LicenseListVersion_3_25 + -- | License exceptions in all SPDX License lists bulkOfLicenses :: [LicenseExceptionId] bulkOfLicenses = - [ DS389_exception + [ N_389_exception , Autoconf_exception_2_0 , Autoconf_exception_3_0 , Bison_exception_2_2 diff --git a/Cabal-syntax/src/Distribution/SPDX/LicenseExpression.hs b/Cabal-syntax/src/Distribution/SPDX/LicenseExpression.hs index c77314746f8..2fe784b2792 100644 --- a/Cabal-syntax/src/Distribution/SPDX/LicenseExpression.hs +++ b/Cabal-syntax/src/Distribution/SPDX/LicenseExpression.hs @@ -43,7 +43,7 @@ data LicenseExpression = ELicense !SimpleLicenseExpression !(Maybe LicenseExceptionId) | EAnd !LicenseExpression !LicenseExpression | EOr !LicenseExpression !LicenseExpression - deriving (Show, Read, Eq, Ord, Typeable, Data, Generic) + deriving (Show, Read, Eq, Ord, Data, Generic) -- | Simple License Expressions. data SimpleLicenseExpression @@ -53,7 +53,7 @@ data SimpleLicenseExpression ELicenseIdPlus LicenseId | -- | A SPDX user defined license reference: For example: @LicenseRef-23@, @LicenseRef-MIT-Style-1@, or @DocumentRef-spdx-tool-1.2:LicenseRef-MIT-Style-2@ ELicenseRef LicenseRef - deriving (Show, Read, Eq, Ord, Typeable, Data, Generic) + deriving (Show, Read, Eq, Ord, Data, Generic) simpleLicenseExpression :: LicenseId -> LicenseExpression simpleLicenseExpression i = ELicense (ELicenseId i) Nothing diff --git a/Cabal-syntax/src/Distribution/SPDX/LicenseId.hs b/Cabal-syntax/src/Distribution/SPDX/LicenseId.hs index 5af7fd86e8b..3f4d34fe007 100644 --- a/Cabal-syntax/src/Distribution/SPDX/LicenseId.hs +++ b/Cabal-syntax/src/Distribution/SPDX/LicenseId.hs @@ -33,16 +33,17 @@ import qualified Text.PrettyPrint as Disp -- LicenseId ------------------------------------------------------------------------------- --- | SPDX License identifiers list v3.23 +-- | SPDX License identifiers list v3.25 data LicenseId - = NullBSD -- ^ @0BSD@, BSD Zero Clause License + = N_0BSD -- ^ @0BSD@, BSD Zero Clause License + | N_3D_Slicer_1_0 -- ^ @3D-Slicer-1.0@, 3D Slicer License v1.0, SPDX License List 3.25 | AAL -- ^ @AAL@, Attribution Assurance License | Abstyles -- ^ @Abstyles@, Abstyles License - | AdaCore_doc -- ^ @AdaCore-doc@, AdaCore Doc License, SPDX License List 3.23 + | AdaCore_doc -- ^ @AdaCore-doc@, AdaCore Doc License, SPDX License List 3.23, SPDX License List 3.25 | Adobe_2006 -- ^ @Adobe-2006@, Adobe Systems Incorporated Source Code License Agreement - | Adobe_Display_PostScript -- ^ @Adobe-Display-PostScript@, Adobe Display PostScript License, SPDX License List 3.23 + | Adobe_Display_PostScript -- ^ @Adobe-Display-PostScript@, Adobe Display PostScript License, SPDX License List 3.23, SPDX License List 3.25 | Adobe_Glyph -- ^ @Adobe-Glyph@, Adobe Glyph List License - | Adobe_Utopia -- ^ @Adobe-Utopia@, Adobe Utopia Font License, SPDX License List 3.23 + | Adobe_Utopia -- ^ @Adobe-Utopia@, Adobe Utopia Font License, SPDX License List 3.23, SPDX License List 3.25 | ADSL -- ^ @ADSL@, Amazon Digital Services License | AFL_1_1 -- ^ @AFL-1.1@, Academic Free License v1.1 | AFL_1_2 -- ^ @AFL-1.2@, Academic Free License v1.2 @@ -51,151 +52,155 @@ data LicenseId | AFL_3_0 -- ^ @AFL-3.0@, Academic Free License v3.0 | Afmparse -- ^ @Afmparse@, Afmparse License | AGPL_1_0 -- ^ @AGPL-1.0@, Affero General Public License v1.0, SPDX License List 3.0 - | AGPL_1_0_only -- ^ @AGPL-1.0-only@, Affero General Public License v1.0 only, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | AGPL_1_0_or_later -- ^ @AGPL-1.0-or-later@, Affero General Public License v1.0 or later, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | AGPL_1_0_only -- ^ @AGPL-1.0-only@, Affero General Public License v1.0 only, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | AGPL_1_0_or_later -- ^ @AGPL-1.0-or-later@, Affero General Public License v1.0 or later, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | AGPL_3_0_only -- ^ @AGPL-3.0-only@, GNU Affero General Public License v3.0 only | AGPL_3_0_or_later -- ^ @AGPL-3.0-or-later@, GNU Affero General Public License v3.0 or later | Aladdin -- ^ @Aladdin@, Aladdin Free Public License + | AMD_newlib -- ^ @AMD-newlib@, AMD newlib License, SPDX License List 3.25 | AMDPLPA -- ^ @AMDPLPA@, AMD's plpa_map.c License - | AML_glslang -- ^ @AML-glslang@, AML glslang variant License, SPDX License List 3.23 + | AML_glslang -- ^ @AML-glslang@, AML glslang variant License, SPDX License List 3.23, SPDX License List 3.25 | AML -- ^ @AML@, Apple MIT License | AMPAS -- ^ @AMPAS@, Academy of Motion Picture Arts and Sciences BSD - | ANTLR_PD_fallback -- ^ @ANTLR-PD-fallback@, ANTLR Software Rights Notice with license fallback, SPDX License List 3.16, SPDX License List 3.23 + | ANTLR_PD_fallback -- ^ @ANTLR-PD-fallback@, ANTLR Software Rights Notice with license fallback, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | ANTLR_PD -- ^ @ANTLR-PD@, ANTLR Software Rights Notice + | Any_OSI -- ^ @any-OSI@, Any OSI License, SPDX License List 3.25 | Apache_1_0 -- ^ @Apache-1.0@, Apache License 1.0 | Apache_1_1 -- ^ @Apache-1.1@, Apache License 1.1 | Apache_2_0 -- ^ @Apache-2.0@, Apache License 2.0 | APAFML -- ^ @APAFML@, Adobe Postscript AFM License | APL_1_0 -- ^ @APL-1.0@, Adaptive Public License 1.0 - | App_s2p -- ^ @App-s2p@, App::s2p License, SPDX License List 3.16, SPDX License List 3.23 + | App_s2p -- ^ @App-s2p@, App::s2p License, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | APSL_1_0 -- ^ @APSL-1.0@, Apple Public Source License 1.0 | APSL_1_1 -- ^ @APSL-1.1@, Apple Public Source License 1.1 | APSL_1_2 -- ^ @APSL-1.2@, Apple Public Source License 1.2 | APSL_2_0 -- ^ @APSL-2.0@, Apple Public Source License 2.0 - | Arphic_1999 -- ^ @Arphic-1999@, Arphic Public License, SPDX License List 3.23 + | Arphic_1999 -- ^ @Arphic-1999@, Arphic Public License, SPDX License List 3.23, SPDX License List 3.25 | Artistic_1_0_cl8 -- ^ @Artistic-1.0-cl8@, Artistic License 1.0 w/clause 8 | Artistic_1_0_Perl -- ^ @Artistic-1.0-Perl@, Artistic License 1.0 (Perl) | Artistic_1_0 -- ^ @Artistic-1.0@, Artistic License 1.0 | Artistic_2_0 -- ^ @Artistic-2.0@, Artistic License 2.0 - | ASWF_Digital_Assets_1_0 -- ^ @ASWF-Digital-Assets-1.0@, ASWF Digital Assets License version 1.0, SPDX License List 3.23 - | ASWF_Digital_Assets_1_1 -- ^ @ASWF-Digital-Assets-1.1@, ASWF Digital Assets License 1.1, SPDX License List 3.23 - | Baekmuk -- ^ @Baekmuk@, Baekmuk License, SPDX License List 3.23 + | ASWF_Digital_Assets_1_0 -- ^ @ASWF-Digital-Assets-1.0@, ASWF Digital Assets License version 1.0, SPDX License List 3.23, SPDX License List 3.25 + | ASWF_Digital_Assets_1_1 -- ^ @ASWF-Digital-Assets-1.1@, ASWF Digital Assets License 1.1, SPDX License List 3.23, SPDX License List 3.25 + | Baekmuk -- ^ @Baekmuk@, Baekmuk License, SPDX License List 3.23, SPDX License List 3.25 | Bahyph -- ^ @Bahyph@, Bahyph License | Barr -- ^ @Barr@, Barr License - | Bcrypt_Solar_Designer -- ^ @bcrypt-Solar-Designer@, bcrypt Solar Designer License, SPDX License List 3.23 + | Bcrypt_Solar_Designer -- ^ @bcrypt-Solar-Designer@, bcrypt Solar Designer License, SPDX License List 3.23, SPDX License List 3.25 | Beerware -- ^ @Beerware@, Beerware License - | Bitstream_Charter -- ^ @Bitstream-Charter@, Bitstream Charter Font License, SPDX License List 3.23 - | Bitstream_Vera -- ^ @Bitstream-Vera@, Bitstream Vera Font License, SPDX License List 3.23 + | Bitstream_Charter -- ^ @Bitstream-Charter@, Bitstream Charter Font License, SPDX License List 3.23, SPDX License List 3.25 + | Bitstream_Vera -- ^ @Bitstream-Vera@, Bitstream Vera Font License, SPDX License List 3.23, SPDX License List 3.25 | BitTorrent_1_0 -- ^ @BitTorrent-1.0@, BitTorrent Open Source License v1.0 | BitTorrent_1_1 -- ^ @BitTorrent-1.1@, BitTorrent Open Source License v1.1 - | Blessing -- ^ @blessing@, SQLite Blessing, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | BlueOak_1_0_0 -- ^ @BlueOak-1.0.0@, Blue Oak Model License 1.0.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Boehm_GC -- ^ @Boehm-GC@, Boehm-Demers-Weiser GC License, SPDX License List 3.23 + | Blessing -- ^ @blessing@, SQLite Blessing, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | BlueOak_1_0_0 -- ^ @BlueOak-1.0.0@, Blue Oak Model License 1.0.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Boehm_GC -- ^ @Boehm-GC@, Boehm-Demers-Weiser GC License, SPDX License List 3.23, SPDX License List 3.25 | Borceux -- ^ @Borceux@, Borceux license - | Brian_Gladman_2_Clause -- ^ @Brian-Gladman-2-Clause@, Brian Gladman 2-Clause License, SPDX License List 3.23 - | Brian_Gladman_3_Clause -- ^ @Brian-Gladman-3-Clause@, Brian Gladman 3-Clause License, SPDX License List 3.23 + | Brian_Gladman_2_Clause -- ^ @Brian-Gladman-2-Clause@, Brian Gladman 2-Clause License, SPDX License List 3.23, SPDX License List 3.25 + | Brian_Gladman_3_Clause -- ^ @Brian-Gladman-3-Clause@, Brian Gladman 3-Clause License, SPDX License List 3.23, SPDX License List 3.25 | BSD_1_Clause -- ^ @BSD-1-Clause@, BSD 1-Clause License | BSD_2_Clause_FreeBSD -- ^ @BSD-2-Clause-FreeBSD@, BSD 2-Clause FreeBSD License, SPDX License List 3.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9 | BSD_2_Clause_NetBSD -- ^ @BSD-2-Clause-NetBSD@, BSD 2-Clause NetBSD License, SPDX License List 3.0, SPDX License List 3.2, SPDX License List 3.6 - | BSD_2_Clause_Darwin -- ^ @BSD-2-Clause-Darwin@, BSD 2-Clause - Ian Darwin variant, SPDX License List 3.23 + | BSD_2_Clause_Darwin -- ^ @BSD-2-Clause-Darwin@, BSD 2-Clause - Ian Darwin variant, SPDX License List 3.23, SPDX License List 3.25 + | BSD_2_Clause_first_lines -- ^ @BSD-2-Clause-first-lines@, BSD 2-Clause - first lines requirement, SPDX License List 3.25 | BSD_2_Clause_Patent -- ^ @BSD-2-Clause-Patent@, BSD-2-Clause Plus Patent License - | BSD_2_Clause_Views -- ^ @BSD-2-Clause-Views@, BSD 2-Clause with views sentence, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | BSD_2_Clause_Views -- ^ @BSD-2-Clause-Views@, BSD 2-Clause with views sentence, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | BSD_2_Clause -- ^ @BSD-2-Clause@, BSD 2-Clause "Simplified" License - | BSD_3_Clause_acpica -- ^ @BSD-3-Clause-acpica@, BSD 3-Clause acpica variant, SPDX License List 3.23 + | BSD_3_Clause_acpica -- ^ @BSD-3-Clause-acpica@, BSD 3-Clause acpica variant, SPDX License List 3.23, SPDX License List 3.25 | BSD_3_Clause_Attribution -- ^ @BSD-3-Clause-Attribution@, BSD with attribution | BSD_3_Clause_Clear -- ^ @BSD-3-Clause-Clear@, BSD 3-Clause Clear License - | BSD_3_Clause_flex -- ^ @BSD-3-Clause-flex@, BSD 3-Clause Flex variant, SPDX License List 3.23 - | BSD_3_Clause_HP -- ^ @BSD-3-Clause-HP@, Hewlett-Packard BSD variant license, SPDX License List 3.23 + | BSD_3_Clause_flex -- ^ @BSD-3-Clause-flex@, BSD 3-Clause Flex variant, SPDX License List 3.23, SPDX License List 3.25 + | BSD_3_Clause_HP -- ^ @BSD-3-Clause-HP@, Hewlett-Packard BSD variant license, SPDX License List 3.23, SPDX License List 3.25 | BSD_3_Clause_LBNL -- ^ @BSD-3-Clause-LBNL@, Lawrence Berkeley National Labs BSD variant license - | BSD_3_Clause_Modification -- ^ @BSD-3-Clause-Modification@, BSD 3-Clause Modification, SPDX License List 3.16, SPDX License List 3.23 - | BSD_3_Clause_No_Military_License -- ^ @BSD-3-Clause-No-Military-License@, BSD 3-Clause No Military License, SPDX License List 3.16, SPDX License List 3.23 + | BSD_3_Clause_Modification -- ^ @BSD-3-Clause-Modification@, BSD 3-Clause Modification, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | BSD_3_Clause_No_Military_License -- ^ @BSD-3-Clause-No-Military-License@, BSD 3-Clause No Military License, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | BSD_3_Clause_No_Nuclear_License_2014 -- ^ @BSD-3-Clause-No-Nuclear-License-2014@, BSD 3-Clause No Nuclear License 2014 | BSD_3_Clause_No_Nuclear_License -- ^ @BSD-3-Clause-No-Nuclear-License@, BSD 3-Clause No Nuclear License | BSD_3_Clause_No_Nuclear_Warranty -- ^ @BSD-3-Clause-No-Nuclear-Warranty@, BSD 3-Clause No Nuclear Warranty - | BSD_3_Clause_Open_MPI -- ^ @BSD-3-Clause-Open-MPI@, BSD 3-Clause Open MPI variant, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | BSD_3_Clause_Sun -- ^ @BSD-3-Clause-Sun@, BSD 3-Clause Sun Microsystems, SPDX License List 3.23 + | BSD_3_Clause_Open_MPI -- ^ @BSD-3-Clause-Open-MPI@, BSD 3-Clause Open MPI variant, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | BSD_3_Clause_Sun -- ^ @BSD-3-Clause-Sun@, BSD 3-Clause Sun Microsystems, SPDX License List 3.23, SPDX License List 3.25 | BSD_3_Clause -- ^ @BSD-3-Clause@, BSD 3-Clause "New" or "Revised" License - | BSD_4_Clause_Shortened -- ^ @BSD-4-Clause-Shortened@, BSD 4 Clause Shortened, SPDX License List 3.16, SPDX License List 3.23 + | BSD_4_Clause_Shortened -- ^ @BSD-4-Clause-Shortened@, BSD 4 Clause Shortened, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | BSD_4_Clause_UC -- ^ @BSD-4-Clause-UC@, BSD-4-Clause (University of California-Specific) | BSD_4_Clause -- ^ @BSD-4-Clause@, BSD 4-Clause "Original" or "Old" License - | BSD_4_3RENO -- ^ @BSD-4.3RENO@, BSD 4.3 RENO License, SPDX License List 3.23 - | BSD_4_3TAHOE -- ^ @BSD-4.3TAHOE@, BSD 4.3 TAHOE License, SPDX License List 3.23 - | BSD_Advertising_Acknowledgement -- ^ @BSD-Advertising-Acknowledgement@, BSD Advertising Acknowledgement License, SPDX License List 3.23 - | BSD_Attribution_HPND_disclaimer -- ^ @BSD-Attribution-HPND-disclaimer@, BSD with Attribution and HPND disclaimer, SPDX License List 3.23 - | BSD_Inferno_Nettverk -- ^ @BSD-Inferno-Nettverk@, BSD-Inferno-Nettverk, SPDX License List 3.23 + | BSD_4_3RENO -- ^ @BSD-4.3RENO@, BSD 4.3 RENO License, SPDX License List 3.23, SPDX License List 3.25 + | BSD_4_3TAHOE -- ^ @BSD-4.3TAHOE@, BSD 4.3 TAHOE License, SPDX License List 3.23, SPDX License List 3.25 + | BSD_Advertising_Acknowledgement -- ^ @BSD-Advertising-Acknowledgement@, BSD Advertising Acknowledgement License, SPDX License List 3.23, SPDX License List 3.25 + | BSD_Attribution_HPND_disclaimer -- ^ @BSD-Attribution-HPND-disclaimer@, BSD with Attribution and HPND disclaimer, SPDX License List 3.23, SPDX License List 3.25 + | BSD_Inferno_Nettverk -- ^ @BSD-Inferno-Nettverk@, BSD-Inferno-Nettverk, SPDX License List 3.23, SPDX License List 3.25 | BSD_Protection -- ^ @BSD-Protection@, BSD Protection License - | BSD_Source_beginning_file -- ^ @BSD-Source-beginning-file@, BSD Source Code Attribution - beginning of file variant, SPDX License List 3.23 + | BSD_Source_beginning_file -- ^ @BSD-Source-beginning-file@, BSD Source Code Attribution - beginning of file variant, SPDX License List 3.23, SPDX License List 3.25 | BSD_Source_Code -- ^ @BSD-Source-Code@, BSD Source Code Attribution - | BSD_Systemics_W3Works -- ^ @BSD-Systemics-W3Works@, Systemics W3Works BSD variant license, SPDX License List 3.23 - | BSD_Systemics -- ^ @BSD-Systemics@, Systemics BSD variant license, SPDX License List 3.23 + | BSD_Systemics_W3Works -- ^ @BSD-Systemics-W3Works@, Systemics W3Works BSD variant license, SPDX License List 3.23, SPDX License List 3.25 + | BSD_Systemics -- ^ @BSD-Systemics@, Systemics BSD variant license, SPDX License List 3.23, SPDX License List 3.25 | BSL_1_0 -- ^ @BSL-1.0@, Boost Software License 1.0 | Bzip2_1_0_5 -- ^ @bzip2-1.0.5@, bzip2 and libbzip2 License v1.0.5, SPDX License List 3.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10 - | BUSL_1_1 -- ^ @BUSL-1.1@, Business Source License 1.1, SPDX License List 3.16, SPDX License List 3.23 + | BUSL_1_1 -- ^ @BUSL-1.1@, Business Source License 1.1, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Bzip2_1_0_6 -- ^ @bzip2-1.0.6@, bzip2 and libbzip2 License v1.0.6 - | C_UDA_1_0 -- ^ @C-UDA-1.0@, Computational Use of Data Agreement v1.0, SPDX License List 3.16, SPDX License List 3.23 - | CAL_1_0_Combined_Work_Exception -- ^ @CAL-1.0-Combined-Work-Exception@, Cryptographic Autonomy License 1.0 (Combined Work Exception), SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | CAL_1_0 -- ^ @CAL-1.0@, Cryptographic Autonomy License 1.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Caldera_no_preamble -- ^ @Caldera-no-preamble@, Caldera License (without preamble), SPDX License List 3.23 + | C_UDA_1_0 -- ^ @C-UDA-1.0@, Computational Use of Data Agreement v1.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CAL_1_0_Combined_Work_Exception -- ^ @CAL-1.0-Combined-Work-Exception@, Cryptographic Autonomy License 1.0 (Combined Work Exception), SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CAL_1_0 -- ^ @CAL-1.0@, Cryptographic Autonomy License 1.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Caldera_no_preamble -- ^ @Caldera-no-preamble@, Caldera License (without preamble), SPDX License List 3.23, SPDX License List 3.25 | Caldera -- ^ @Caldera@, Caldera License + | Catharon -- ^ @Catharon@, Catharon License, SPDX License List 3.25 | CATOSL_1_1 -- ^ @CATOSL-1.1@, Computer Associates Trusted Open Source License 1.1 | CC_BY_1_0 -- ^ @CC-BY-1.0@, Creative Commons Attribution 1.0 Generic | CC_BY_2_0 -- ^ @CC-BY-2.0@, Creative Commons Attribution 2.0 Generic - | CC_BY_2_5_AU -- ^ @CC-BY-2.5-AU@, Creative Commons Attribution 2.5 Australia, SPDX License List 3.16, SPDX License List 3.23 + | CC_BY_2_5_AU -- ^ @CC-BY-2.5-AU@, Creative Commons Attribution 2.5 Australia, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_2_5 -- ^ @CC-BY-2.5@, Creative Commons Attribution 2.5 Generic - | CC_BY_3_0_AT -- ^ @CC-BY-3.0-AT@, Creative Commons Attribution 3.0 Austria, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | CC_BY_3_0_AU -- ^ @CC-BY-3.0-AU@, Creative Commons Attribution 3.0 Australia, SPDX License List 3.23 - | CC_BY_3_0_DE -- ^ @CC-BY-3.0-DE@, Creative Commons Attribution 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23 - | CC_BY_3_0_IGO -- ^ @CC-BY-3.0-IGO@, Creative Commons Attribution 3.0 IGO, SPDX License List 3.23 - | CC_BY_3_0_NL -- ^ @CC-BY-3.0-NL@, Creative Commons Attribution 3.0 Netherlands, SPDX License List 3.16, SPDX License List 3.23 - | CC_BY_3_0_US -- ^ @CC-BY-3.0-US@, Creative Commons Attribution 3.0 United States, SPDX License List 3.16, SPDX License List 3.23 + | CC_BY_3_0_AT -- ^ @CC-BY-3.0-AT@, Creative Commons Attribution 3.0 Austria, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_3_0_AU -- ^ @CC-BY-3.0-AU@, Creative Commons Attribution 3.0 Australia, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_3_0_DE -- ^ @CC-BY-3.0-DE@, Creative Commons Attribution 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_3_0_IGO -- ^ @CC-BY-3.0-IGO@, Creative Commons Attribution 3.0 IGO, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_3_0_NL -- ^ @CC-BY-3.0-NL@, Creative Commons Attribution 3.0 Netherlands, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_3_0_US -- ^ @CC-BY-3.0-US@, Creative Commons Attribution 3.0 United States, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_3_0 -- ^ @CC-BY-3.0@, Creative Commons Attribution 3.0 Unported | CC_BY_4_0 -- ^ @CC-BY-4.0@, Creative Commons Attribution 4.0 International | CC_BY_NC_1_0 -- ^ @CC-BY-NC-1.0@, Creative Commons Attribution Non Commercial 1.0 Generic | CC_BY_NC_2_0 -- ^ @CC-BY-NC-2.0@, Creative Commons Attribution Non Commercial 2.0 Generic | CC_BY_NC_2_5 -- ^ @CC-BY-NC-2.5@, Creative Commons Attribution Non Commercial 2.5 Generic - | CC_BY_NC_3_0_DE -- ^ @CC-BY-NC-3.0-DE@, Creative Commons Attribution Non Commercial 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23 + | CC_BY_NC_3_0_DE -- ^ @CC-BY-NC-3.0-DE@, Creative Commons Attribution Non Commercial 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_NC_3_0 -- ^ @CC-BY-NC-3.0@, Creative Commons Attribution Non Commercial 3.0 Unported | CC_BY_NC_4_0 -- ^ @CC-BY-NC-4.0@, Creative Commons Attribution Non Commercial 4.0 International | CC_BY_NC_ND_1_0 -- ^ @CC-BY-NC-ND-1.0@, Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic | CC_BY_NC_ND_2_0 -- ^ @CC-BY-NC-ND-2.0@, Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic | CC_BY_NC_ND_2_5 -- ^ @CC-BY-NC-ND-2.5@, Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic - | CC_BY_NC_ND_3_0_DE -- ^ @CC-BY-NC-ND-3.0-DE@, Creative Commons Attribution Non Commercial No Derivatives 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23 - | CC_BY_NC_ND_3_0_IGO -- ^ @CC-BY-NC-ND-3.0-IGO@, Creative Commons Attribution Non Commercial No Derivatives 3.0 IGO, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | CC_BY_NC_ND_3_0_DE -- ^ @CC-BY-NC-ND-3.0-DE@, Creative Commons Attribution Non Commercial No Derivatives 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_NC_ND_3_0_IGO -- ^ @CC-BY-NC-ND-3.0-IGO@, Creative Commons Attribution Non Commercial No Derivatives 3.0 IGO, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_NC_ND_3_0 -- ^ @CC-BY-NC-ND-3.0@, Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported | CC_BY_NC_ND_4_0 -- ^ @CC-BY-NC-ND-4.0@, Creative Commons Attribution Non Commercial No Derivatives 4.0 International | CC_BY_NC_SA_1_0 -- ^ @CC-BY-NC-SA-1.0@, Creative Commons Attribution Non Commercial Share Alike 1.0 Generic - | CC_BY_NC_SA_2_0_DE -- ^ @CC-BY-NC-SA-2.0-DE@, Creative Commons Attribution Non Commercial Share Alike 2.0 Germany, SPDX License List 3.23 - | CC_BY_NC_SA_2_0_FR -- ^ @CC-BY-NC-SA-2.0-FR@, Creative Commons Attribution-NonCommercial-ShareAlike 2.0 France, SPDX License List 3.16, SPDX License List 3.23 - | CC_BY_NC_SA_2_0_UK -- ^ @CC-BY-NC-SA-2.0-UK@, Creative Commons Attribution Non Commercial Share Alike 2.0 England and Wales, SPDX License List 3.16, SPDX License List 3.23 + | CC_BY_NC_SA_2_0_DE -- ^ @CC-BY-NC-SA-2.0-DE@, Creative Commons Attribution Non Commercial Share Alike 2.0 Germany, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_NC_SA_2_0_FR -- ^ @CC-BY-NC-SA-2.0-FR@, Creative Commons Attribution-NonCommercial-ShareAlike 2.0 France, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_NC_SA_2_0_UK -- ^ @CC-BY-NC-SA-2.0-UK@, Creative Commons Attribution Non Commercial Share Alike 2.0 England and Wales, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_NC_SA_2_0 -- ^ @CC-BY-NC-SA-2.0@, Creative Commons Attribution Non Commercial Share Alike 2.0 Generic | CC_BY_NC_SA_2_5 -- ^ @CC-BY-NC-SA-2.5@, Creative Commons Attribution Non Commercial Share Alike 2.5 Generic - | CC_BY_NC_SA_3_0_DE -- ^ @CC-BY-NC-SA-3.0-DE@, Creative Commons Attribution Non Commercial Share Alike 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23 - | CC_BY_NC_SA_3_0_IGO -- ^ @CC-BY-NC-SA-3.0-IGO@, Creative Commons Attribution Non Commercial Share Alike 3.0 IGO, SPDX License List 3.16, SPDX License List 3.23 + | CC_BY_NC_SA_3_0_DE -- ^ @CC-BY-NC-SA-3.0-DE@, Creative Commons Attribution Non Commercial Share Alike 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_NC_SA_3_0_IGO -- ^ @CC-BY-NC-SA-3.0-IGO@, Creative Commons Attribution Non Commercial Share Alike 3.0 IGO, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_NC_SA_3_0 -- ^ @CC-BY-NC-SA-3.0@, Creative Commons Attribution Non Commercial Share Alike 3.0 Unported | CC_BY_NC_SA_4_0 -- ^ @CC-BY-NC-SA-4.0@, Creative Commons Attribution Non Commercial Share Alike 4.0 International | CC_BY_ND_1_0 -- ^ @CC-BY-ND-1.0@, Creative Commons Attribution No Derivatives 1.0 Generic | CC_BY_ND_2_0 -- ^ @CC-BY-ND-2.0@, Creative Commons Attribution No Derivatives 2.0 Generic | CC_BY_ND_2_5 -- ^ @CC-BY-ND-2.5@, Creative Commons Attribution No Derivatives 2.5 Generic - | CC_BY_ND_3_0_DE -- ^ @CC-BY-ND-3.0-DE@, Creative Commons Attribution No Derivatives 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23 + | CC_BY_ND_3_0_DE -- ^ @CC-BY-ND-3.0-DE@, Creative Commons Attribution No Derivatives 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_ND_3_0 -- ^ @CC-BY-ND-3.0@, Creative Commons Attribution No Derivatives 3.0 Unported | CC_BY_ND_4_0 -- ^ @CC-BY-ND-4.0@, Creative Commons Attribution No Derivatives 4.0 International | CC_BY_SA_1_0 -- ^ @CC-BY-SA-1.0@, Creative Commons Attribution Share Alike 1.0 Generic - | CC_BY_SA_2_0_UK -- ^ @CC-BY-SA-2.0-UK@, Creative Commons Attribution Share Alike 2.0 England and Wales, SPDX License List 3.16, SPDX License List 3.23 + | CC_BY_SA_2_0_UK -- ^ @CC-BY-SA-2.0-UK@, Creative Commons Attribution Share Alike 2.0 England and Wales, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_SA_2_0 -- ^ @CC-BY-SA-2.0@, Creative Commons Attribution Share Alike 2.0 Generic - | CC_BY_SA_2_1_JP -- ^ @CC-BY-SA-2.1-JP@, Creative Commons Attribution Share Alike 2.1 Japan, SPDX License List 3.16, SPDX License List 3.23 + | CC_BY_SA_2_1_JP -- ^ @CC-BY-SA-2.1-JP@, Creative Commons Attribution Share Alike 2.1 Japan, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_SA_2_5 -- ^ @CC-BY-SA-2.5@, Creative Commons Attribution Share Alike 2.5 Generic - | CC_BY_SA_3_0_AT -- ^ @CC-BY-SA-3.0-AT@, Creative Commons Attribution Share Alike 3.0 Austria, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | CC_BY_SA_3_0_DE -- ^ @CC-BY-SA-3.0-DE@, Creative Commons Attribution Share Alike 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23 - | CC_BY_SA_3_0_IGO -- ^ @CC-BY-SA-3.0-IGO@, Creative Commons Attribution-ShareAlike 3.0 IGO, SPDX License List 3.23 + | CC_BY_SA_3_0_AT -- ^ @CC-BY-SA-3.0-AT@, Creative Commons Attribution Share Alike 3.0 Austria, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_SA_3_0_DE -- ^ @CC-BY-SA-3.0-DE@, Creative Commons Attribution Share Alike 3.0 Germany, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CC_BY_SA_3_0_IGO -- ^ @CC-BY-SA-3.0-IGO@, Creative Commons Attribution-ShareAlike 3.0 IGO, SPDX License List 3.23, SPDX License List 3.25 | CC_BY_SA_3_0 -- ^ @CC-BY-SA-3.0@, Creative Commons Attribution Share Alike 3.0 Unported | CC_BY_SA_4_0 -- ^ @CC-BY-SA-4.0@, Creative Commons Attribution Share Alike 4.0 International - | CC_PDDC -- ^ @CC-PDDC@, Creative Commons Public Domain Dedication and Certification, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | CC_PDDC -- ^ @CC-PDDC@, Creative Commons Public Domain Dedication and Certification, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CC0_1_0 -- ^ @CC0-1.0@, Creative Commons Zero v1.0 Universal | CDDL_1_0 -- ^ @CDDL-1.0@, Common Development and Distribution License 1.0 | CDDL_1_1 -- ^ @CDDL-1.1@, Common Development and Distribution License 1.1 - | CDL_1_0 -- ^ @CDL-1.0@, Common Documentation License 1.0, SPDX License List 3.16, SPDX License List 3.23 + | CDL_1_0 -- ^ @CDL-1.0@, Common Documentation License 1.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CDLA_Permissive_1_0 -- ^ @CDLA-Permissive-1.0@, Community Data License Agreement Permissive 1.0 - | CDLA_Permissive_2_0 -- ^ @CDLA-Permissive-2.0@, Community Data License Agreement Permissive 2.0, SPDX License List 3.16, SPDX License List 3.23 + | CDLA_Permissive_2_0 -- ^ @CDLA-Permissive-2.0@, Community Data License Agreement Permissive 2.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | CDLA_Sharing_1_0 -- ^ @CDLA-Sharing-1.0@, Community Data License Agreement Sharing 1.0 | CECILL_1_0 -- ^ @CECILL-1.0@, CeCILL Free Software License Agreement v1.0 | CECILL_1_1 -- ^ @CECILL-1.1@, CeCILL Free Software License Agreement v1.1 @@ -203,105 +208,108 @@ data LicenseId | CECILL_2_1 -- ^ @CECILL-2.1@, CeCILL Free Software License Agreement v2.1 | CECILL_B -- ^ @CECILL-B@, CeCILL-B Free Software License Agreement | CECILL_C -- ^ @CECILL-C@, CeCILL-C Free Software License Agreement - | CERN_OHL_1_1 -- ^ @CERN-OHL-1.1@, CERN Open Hardware Licence v1.1, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | CERN_OHL_1_2 -- ^ @CERN-OHL-1.2@, CERN Open Hardware Licence v1.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | CERN_OHL_P_2_0 -- ^ @CERN-OHL-P-2.0@, CERN Open Hardware Licence Version 2 - Permissive, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | CERN_OHL_S_2_0 -- ^ @CERN-OHL-S-2.0@, CERN Open Hardware Licence Version 2 - Strongly Reciprocal, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | CERN_OHL_W_2_0 -- ^ @CERN-OHL-W-2.0@, CERN Open Hardware Licence Version 2 - Weakly Reciprocal, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | CFITSIO -- ^ @CFITSIO@, CFITSIO License, SPDX License List 3.23 - | Check_cvs -- ^ @check-cvs@, check-cvs License, SPDX License List 3.23 - | Checkmk -- ^ @checkmk@, Checkmk License, SPDX License List 3.23 + | CERN_OHL_1_1 -- ^ @CERN-OHL-1.1@, CERN Open Hardware Licence v1.1, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CERN_OHL_1_2 -- ^ @CERN-OHL-1.2@, CERN Open Hardware Licence v1.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CERN_OHL_P_2_0 -- ^ @CERN-OHL-P-2.0@, CERN Open Hardware Licence Version 2 - Permissive, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CERN_OHL_S_2_0 -- ^ @CERN-OHL-S-2.0@, CERN Open Hardware Licence Version 2 - Strongly Reciprocal, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CERN_OHL_W_2_0 -- ^ @CERN-OHL-W-2.0@, CERN Open Hardware Licence Version 2 - Weakly Reciprocal, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | CFITSIO -- ^ @CFITSIO@, CFITSIO License, SPDX License List 3.23, SPDX License List 3.25 + | Check_cvs -- ^ @check-cvs@, check-cvs License, SPDX License List 3.23, SPDX License List 3.25 + | Checkmk -- ^ @checkmk@, Checkmk License, SPDX License List 3.23, SPDX License List 3.25 | ClArtistic -- ^ @ClArtistic@, Clarified Artistic License - | Clips -- ^ @Clips@, Clips License, SPDX License List 3.23 - | CMU_Mach_nodoc -- ^ @CMU-Mach-nodoc@, CMU Mach - no notices-in-documentation variant, SPDX License List 3.23 - | CMU_Mach -- ^ @CMU-Mach@, CMU Mach License, SPDX License List 3.23 + | Clips -- ^ @Clips@, Clips License, SPDX License List 3.23, SPDX License List 3.25 + | CMU_Mach_nodoc -- ^ @CMU-Mach-nodoc@, CMU Mach - no notices-in-documentation variant, SPDX License List 3.23, SPDX License List 3.25 + | CMU_Mach -- ^ @CMU-Mach@, CMU Mach License, SPDX License List 3.23, SPDX License List 3.25 | CNRI_Jython -- ^ @CNRI-Jython@, CNRI Jython License | CNRI_Python_GPL_Compatible -- ^ @CNRI-Python-GPL-Compatible@, CNRI Python Open Source GPL Compatible License Agreement | CNRI_Python -- ^ @CNRI-Python@, CNRI Python License - | COIL_1_0 -- ^ @COIL-1.0@, Copyfree Open Innovation License, SPDX License List 3.16, SPDX License List 3.23 - | Community_Spec_1_0 -- ^ @Community-Spec-1.0@, Community Specification License 1.0, SPDX License List 3.16, SPDX License List 3.23 + | COIL_1_0 -- ^ @COIL-1.0@, Copyfree Open Innovation License, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Community_Spec_1_0 -- ^ @Community-Spec-1.0@, Community Specification License 1.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Condor_1_1 -- ^ @Condor-1.1@, Condor Public License v1.1 - | Copyleft_next_0_3_0 -- ^ @copyleft-next-0.3.0@, copyleft-next 0.3.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Copyleft_next_0_3_1 -- ^ @copyleft-next-0.3.1@, copyleft-next 0.3.1, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Cornell_Lossless_JPEG -- ^ @Cornell-Lossless-JPEG@, Cornell Lossless JPEG License, SPDX License List 3.23 + | Copyleft_next_0_3_0 -- ^ @copyleft-next-0.3.0@, copyleft-next 0.3.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Copyleft_next_0_3_1 -- ^ @copyleft-next-0.3.1@, copyleft-next 0.3.1, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Cornell_Lossless_JPEG -- ^ @Cornell-Lossless-JPEG@, Cornell Lossless JPEG License, SPDX License List 3.23, SPDX License List 3.25 | CPAL_1_0 -- ^ @CPAL-1.0@, Common Public Attribution License 1.0 | CPL_1_0 -- ^ @CPL-1.0@, Common Public License 1.0 | CPOL_1_02 -- ^ @CPOL-1.02@, Code Project Open License 1.02 - | Cronyx -- ^ @Cronyx@, Cronyx License, SPDX License List 3.23 + | Cronyx -- ^ @Cronyx@, Cronyx License, SPDX License List 3.23, SPDX License List 3.25 | Crossword -- ^ @Crossword@, Crossword License | CrystalStacker -- ^ @CrystalStacker@, CrystalStacker License | CUA_OPL_1_0 -- ^ @CUA-OPL-1.0@, CUA Office Public License v1.0 | Cube -- ^ @Cube@, Cube License | Curl -- ^ @curl@, curl License + | Cve_tou -- ^ @cve-tou@, Common Vulnerability Enumeration ToU License, SPDX License List 3.25 | D_FSL_1_0 -- ^ @D-FSL-1.0@, Deutsche Freie Software Lizenz - | DEC_3_Clause -- ^ @DEC-3-Clause@, DEC 3-Clause License, SPDX License List 3.23 + | DEC_3_Clause -- ^ @DEC-3-Clause@, DEC 3-Clause License, SPDX License List 3.23, SPDX License List 3.25 | Diffmark -- ^ @diffmark@, diffmark license - | DL_DE_BY_2_0 -- ^ @DL-DE-BY-2.0@, Data licence Germany – attribution – version 2.0, SPDX License List 3.16, SPDX License List 3.23 - | DL_DE_ZERO_2_0 -- ^ @DL-DE-ZERO-2.0@, Data licence Germany – zero – version 2.0, SPDX License List 3.23 + | DL_DE_BY_2_0 -- ^ @DL-DE-BY-2.0@, Data licence Germany – attribution – version 2.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | DL_DE_ZERO_2_0 -- ^ @DL-DE-ZERO-2.0@, Data licence Germany – zero – version 2.0, SPDX License List 3.23, SPDX License List 3.25 + | DocBook_Schema -- ^ @DocBook-Schema@, DocBook Schema License, SPDX License List 3.25 + | DocBook_XML -- ^ @DocBook-XML@, DocBook XML License, SPDX License List 3.25 | DOC -- ^ @DOC@, DOC License | Dotseqn -- ^ @Dotseqn@, Dotseqn License - | DRL_1_0 -- ^ @DRL-1.0@, Detection Rule License 1.0, SPDX License List 3.16, SPDX License List 3.23 - | DRL_1_1 -- ^ @DRL-1.1@, Detection Rule License 1.1, SPDX License List 3.23 + | DRL_1_0 -- ^ @DRL-1.0@, Detection Rule License 1.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | DRL_1_1 -- ^ @DRL-1.1@, Detection Rule License 1.1, SPDX License List 3.23, SPDX License List 3.25 | DSDP -- ^ @DSDP@, DSDP License - | Dtoa -- ^ @dtoa@, David M. Gay dtoa License, SPDX License List 3.23 + | Dtoa -- ^ @dtoa@, David M. Gay dtoa License, SPDX License List 3.23, SPDX License List 3.25 | Dvipdfm -- ^ @dvipdfm@, dvipdfm License | ECL_1_0 -- ^ @ECL-1.0@, Educational Community License v1.0 | ECL_2_0 -- ^ @ECL-2.0@, Educational Community License v2.0 | EFL_1_0 -- ^ @EFL-1.0@, Eiffel Forum License v1.0 | EFL_2_0 -- ^ @EFL-2.0@, Eiffel Forum License v2.0 | EGenix -- ^ @eGenix@, eGenix.com Public License 1.1.0 - | Elastic_2_0 -- ^ @Elastic-2.0@, Elastic License 2.0, SPDX License List 3.16, SPDX License List 3.23 + | Elastic_2_0 -- ^ @Elastic-2.0@, Elastic License 2.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Entessa -- ^ @Entessa@, Entessa Public License v1.0 - | EPICS -- ^ @EPICS@, EPICS Open License, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | EPICS -- ^ @EPICS@, EPICS Open License, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | EPL_1_0 -- ^ @EPL-1.0@, Eclipse Public License 1.0 | EPL_2_0 -- ^ @EPL-2.0@, Eclipse Public License 2.0 | ErlPL_1_1 -- ^ @ErlPL-1.1@, Erlang Public License v1.1 - | Etalab_2_0 -- ^ @etalab-2.0@, Etalab Open License 2.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | Etalab_2_0 -- ^ @etalab-2.0@, Etalab Open License 2.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | EUDatagrid -- ^ @EUDatagrid@, EU DataGrid Software License | EUPL_1_0 -- ^ @EUPL-1.0@, European Union Public License 1.0 | EUPL_1_1 -- ^ @EUPL-1.1@, European Union Public License 1.1 | EUPL_1_2 -- ^ @EUPL-1.2@, European Union Public License 1.2 | Eurosym -- ^ @Eurosym@, Eurosym License | Fair -- ^ @Fair@, Fair License - | FBM -- ^ @FBM@, Fuzzy Bitmap License, SPDX License List 3.23 - | FDK_AAC -- ^ @FDK-AAC@, Fraunhofer FDK AAC Codec Library, SPDX License List 3.16, SPDX License List 3.23 - | Ferguson_Twofish -- ^ @Ferguson-Twofish@, Ferguson Twofish License, SPDX License List 3.23 + | FBM -- ^ @FBM@, Fuzzy Bitmap License, SPDX License List 3.23, SPDX License List 3.25 + | FDK_AAC -- ^ @FDK-AAC@, Fraunhofer FDK AAC Codec Library, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Ferguson_Twofish -- ^ @Ferguson-Twofish@, Ferguson Twofish License, SPDX License List 3.23, SPDX License List 3.25 | Frameworx_1_0 -- ^ @Frameworx-1.0@, Frameworx Open License 1.0 - | FreeBSD_DOC -- ^ @FreeBSD-DOC@, FreeBSD Documentation License, SPDX License List 3.16, SPDX License List 3.23 + | FreeBSD_DOC -- ^ @FreeBSD-DOC@, FreeBSD Documentation License, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | FreeImage -- ^ @FreeImage@, FreeImage Public License v1.0 - | FSFAP_no_warranty_disclaimer -- ^ @FSFAP-no-warranty-disclaimer@, FSF All Permissive License (without Warranty), SPDX License List 3.23 + | FSFAP_no_warranty_disclaimer -- ^ @FSFAP-no-warranty-disclaimer@, FSF All Permissive License (without Warranty), SPDX License List 3.23, SPDX License List 3.25 | FSFAP -- ^ @FSFAP@, FSF All Permissive License - | FSFULLRWD -- ^ @FSFULLRWD@, FSF Unlimited License (With License Retention and Warranty Disclaimer), SPDX License List 3.23 + | FSFULLRWD -- ^ @FSFULLRWD@, FSF Unlimited License (With License Retention and Warranty Disclaimer), SPDX License List 3.23, SPDX License List 3.25 | FSFULLR -- ^ @FSFULLR@, FSF Unlimited License (with License Retention) | FSFUL -- ^ @FSFUL@, FSF Unlimited License | FTL -- ^ @FTL@, Freetype Project License - | Furuseth -- ^ @Furuseth@, Furuseth License, SPDX License List 3.23 - | Fwlw -- ^ @fwlw@, fwlw License, SPDX License List 3.23 - | GCR_docs -- ^ @GCR-docs@, Gnome GCR Documentation License, SPDX License List 3.23 - | GD -- ^ @GD@, GD License, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_1_invariants_only -- ^ @GFDL-1.1-invariants-only@, GNU Free Documentation License v1.1 only - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_1_invariants_or_later -- ^ @GFDL-1.1-invariants-or-later@, GNU Free Documentation License v1.1 or later - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_1_no_invariants_only -- ^ @GFDL-1.1-no-invariants-only@, GNU Free Documentation License v1.1 only - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_1_no_invariants_or_later -- ^ @GFDL-1.1-no-invariants-or-later@, GNU Free Documentation License v1.1 or later - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | Furuseth -- ^ @Furuseth@, Furuseth License, SPDX License List 3.23, SPDX License List 3.25 + | Fwlw -- ^ @fwlw@, fwlw License, SPDX License List 3.23, SPDX License List 3.25 + | GCR_docs -- ^ @GCR-docs@, Gnome GCR Documentation License, SPDX License List 3.23, SPDX License List 3.25 + | GD -- ^ @GD@, GD License, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_1_invariants_only -- ^ @GFDL-1.1-invariants-only@, GNU Free Documentation License v1.1 only - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_1_invariants_or_later -- ^ @GFDL-1.1-invariants-or-later@, GNU Free Documentation License v1.1 or later - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_1_no_invariants_only -- ^ @GFDL-1.1-no-invariants-only@, GNU Free Documentation License v1.1 only - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_1_no_invariants_or_later -- ^ @GFDL-1.1-no-invariants-or-later@, GNU Free Documentation License v1.1 or later - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | GFDL_1_1_only -- ^ @GFDL-1.1-only@, GNU Free Documentation License v1.1 only | GFDL_1_1_or_later -- ^ @GFDL-1.1-or-later@, GNU Free Documentation License v1.1 or later - | GFDL_1_2_invariants_only -- ^ @GFDL-1.2-invariants-only@, GNU Free Documentation License v1.2 only - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_2_invariants_or_later -- ^ @GFDL-1.2-invariants-or-later@, GNU Free Documentation License v1.2 or later - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_2_no_invariants_only -- ^ @GFDL-1.2-no-invariants-only@, GNU Free Documentation License v1.2 only - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_2_no_invariants_or_later -- ^ @GFDL-1.2-no-invariants-or-later@, GNU Free Documentation License v1.2 or later - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | GFDL_1_2_invariants_only -- ^ @GFDL-1.2-invariants-only@, GNU Free Documentation License v1.2 only - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_2_invariants_or_later -- ^ @GFDL-1.2-invariants-or-later@, GNU Free Documentation License v1.2 or later - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_2_no_invariants_only -- ^ @GFDL-1.2-no-invariants-only@, GNU Free Documentation License v1.2 only - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_2_no_invariants_or_later -- ^ @GFDL-1.2-no-invariants-or-later@, GNU Free Documentation License v1.2 or later - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | GFDL_1_2_only -- ^ @GFDL-1.2-only@, GNU Free Documentation License v1.2 only | GFDL_1_2_or_later -- ^ @GFDL-1.2-or-later@, GNU Free Documentation License v1.2 or later - | GFDL_1_3_invariants_only -- ^ @GFDL-1.3-invariants-only@, GNU Free Documentation License v1.3 only - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_3_invariants_or_later -- ^ @GFDL-1.3-invariants-or-later@, GNU Free Documentation License v1.3 or later - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_3_no_invariants_only -- ^ @GFDL-1.3-no-invariants-only@, GNU Free Documentation License v1.3 only - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | GFDL_1_3_no_invariants_or_later -- ^ @GFDL-1.3-no-invariants-or-later@, GNU Free Documentation License v1.3 or later - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | GFDL_1_3_invariants_only -- ^ @GFDL-1.3-invariants-only@, GNU Free Documentation License v1.3 only - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_3_invariants_or_later -- ^ @GFDL-1.3-invariants-or-later@, GNU Free Documentation License v1.3 or later - invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_3_no_invariants_only -- ^ @GFDL-1.3-no-invariants-only@, GNU Free Documentation License v1.3 only - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | GFDL_1_3_no_invariants_or_later -- ^ @GFDL-1.3-no-invariants-or-later@, GNU Free Documentation License v1.3 or later - no invariants, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | GFDL_1_3_only -- ^ @GFDL-1.3-only@, GNU Free Documentation License v1.3 only | GFDL_1_3_or_later -- ^ @GFDL-1.3-or-later@, GNU Free Documentation License v1.3 or later | Giftware -- ^ @Giftware@, Giftware License | GL2PS -- ^ @GL2PS@, GL2PS License | Glide -- ^ @Glide@, 3dfx Glide License | Glulxe -- ^ @Glulxe@, Glulxe License - | GLWTPL -- ^ @GLWTPL@, Good Luck With That Public License, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | GLWTPL -- ^ @GLWTPL@, Good Luck With That Public License, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Gnuplot -- ^ @gnuplot@, gnuplot License | GPL_1_0_only -- ^ @GPL-1.0-only@, GNU General Public License v1.0 only | GPL_1_0_or_later -- ^ @GPL-1.0-or-later@, GNU General Public License v1.0 or later @@ -309,60 +317,69 @@ data LicenseId | GPL_2_0_or_later -- ^ @GPL-2.0-or-later@, GNU General Public License v2.0 or later | GPL_3_0_only -- ^ @GPL-3.0-only@, GNU General Public License v3.0 only | GPL_3_0_or_later -- ^ @GPL-3.0-or-later@, GNU General Public License v3.0 or later - | Graphics_Gems -- ^ @Graphics-Gems@, Graphics Gems License, SPDX License List 3.23 + | Graphics_Gems -- ^ @Graphics-Gems@, Graphics Gems License, SPDX License List 3.23, SPDX License List 3.25 | GSOAP_1_3b -- ^ @gSOAP-1.3b@, gSOAP Public License v1.3b - | Gtkbook -- ^ @gtkbook@, gtkbook License, SPDX License List 3.23 + | Gtkbook -- ^ @gtkbook@, gtkbook License, SPDX License List 3.23, SPDX License List 3.25 + | Gutmann -- ^ @Gutmann@, Gutmann License, SPDX License List 3.25 | HaskellReport -- ^ @HaskellReport@, Haskell Language Report License - | Hdparm -- ^ @hdparm@, hdparm License, SPDX License List 3.23 - | Hippocratic_2_1 -- ^ @Hippocratic-2.1@, Hippocratic License 2.1, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | HP_1986 -- ^ @HP-1986@, Hewlett-Packard 1986 License, SPDX License List 3.23 - | HP_1989 -- ^ @HP-1989@, Hewlett-Packard 1989 License, SPDX License List 3.23 - | HPND_DEC -- ^ @HPND-DEC@, Historical Permission Notice and Disclaimer - DEC variant, SPDX License List 3.23 - | HPND_doc_sell -- ^ @HPND-doc-sell@, Historical Permission Notice and Disclaimer - documentation sell variant, SPDX License List 3.23 - | HPND_doc -- ^ @HPND-doc@, Historical Permission Notice and Disclaimer - documentation variant, SPDX License List 3.23 - | HPND_export_US_modify -- ^ @HPND-export-US-modify@, HPND with US Government export control warning and modification rqmt, SPDX License List 3.23 - | HPND_export_US -- ^ @HPND-export-US@, HPND with US Government export control warning, SPDX License List 3.23 - | HPND_Fenneberg_Livingston -- ^ @HPND-Fenneberg-Livingston@, Historical Permission Notice and Disclaimer - Fenneberg-Livingston variant, SPDX License List 3.23 - | HPND_INRIA_IMAG -- ^ @HPND-INRIA-IMAG@, Historical Permission Notice and Disclaimer - INRIA-IMAG variant, SPDX License List 3.23 - | HPND_Kevlin_Henney -- ^ @HPND-Kevlin-Henney@, Historical Permission Notice and Disclaimer - Kevlin Henney variant, SPDX License List 3.23 - | HPND_Markus_Kuhn -- ^ @HPND-Markus-Kuhn@, Historical Permission Notice and Disclaimer - Markus Kuhn variant, SPDX License List 3.23 - | HPND_MIT_disclaimer -- ^ @HPND-MIT-disclaimer@, Historical Permission Notice and Disclaimer with MIT disclaimer, SPDX License List 3.23 - | HPND_Pbmplus -- ^ @HPND-Pbmplus@, Historical Permission Notice and Disclaimer - Pbmplus variant, SPDX License List 3.23 - | HPND_sell_MIT_disclaimer_xserver -- ^ @HPND-sell-MIT-disclaimer-xserver@, Historical Permission Notice and Disclaimer - sell xserver variant with MIT disclaimer, SPDX License List 3.23 - | HPND_sell_regexpr -- ^ @HPND-sell-regexpr@, Historical Permission Notice and Disclaimer - sell regexpr variant, SPDX License List 3.23 - | HPND_sell_variant_MIT_disclaimer -- ^ @HPND-sell-variant-MIT-disclaimer@, HPND sell variant with MIT disclaimer, SPDX License List 3.23 - | HPND_sell_variant -- ^ @HPND-sell-variant@, Historical Permission Notice and Disclaimer - sell variant, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | HPND_UC -- ^ @HPND-UC@, Historical Permission Notice and Disclaimer - University of California variant, SPDX License List 3.23 + | Hdparm -- ^ @hdparm@, hdparm License, SPDX License List 3.23, SPDX License List 3.25 + | HIDAPI -- ^ @HIDAPI@, HIDAPI License, SPDX License List 3.25 + | Hippocratic_2_1 -- ^ @Hippocratic-2.1@, Hippocratic License 2.1, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | HP_1986 -- ^ @HP-1986@, Hewlett-Packard 1986 License, SPDX License List 3.23, SPDX License List 3.25 + | HP_1989 -- ^ @HP-1989@, Hewlett-Packard 1989 License, SPDX License List 3.23, SPDX License List 3.25 + | HPND_DEC -- ^ @HPND-DEC@, Historical Permission Notice and Disclaimer - DEC variant, SPDX License List 3.23, SPDX License List 3.25 + | HPND_doc_sell -- ^ @HPND-doc-sell@, Historical Permission Notice and Disclaimer - documentation sell variant, SPDX License List 3.23, SPDX License List 3.25 + | HPND_doc -- ^ @HPND-doc@, Historical Permission Notice and Disclaimer - documentation variant, SPDX License List 3.23, SPDX License List 3.25 + | HPND_export_US_acknowledgement -- ^ @HPND-export-US-acknowledgement@, HPND with US Government export control warning and acknowledgment, SPDX License List 3.25 + | HPND_export_US_modify -- ^ @HPND-export-US-modify@, HPND with US Government export control warning and modification rqmt, SPDX License List 3.23, SPDX License List 3.25 + | HPND_export_US -- ^ @HPND-export-US@, HPND with US Government export control warning, SPDX License List 3.23, SPDX License List 3.25 + | HPND_export2_US -- ^ @HPND-export2-US@, HPND with US Government export control and 2 disclaimers, SPDX License List 3.25 + | HPND_Fenneberg_Livingston -- ^ @HPND-Fenneberg-Livingston@, Historical Permission Notice and Disclaimer - Fenneberg-Livingston variant, SPDX License List 3.23, SPDX License List 3.25 + | HPND_INRIA_IMAG -- ^ @HPND-INRIA-IMAG@, Historical Permission Notice and Disclaimer - INRIA-IMAG variant, SPDX License List 3.23, SPDX License List 3.25 + | HPND_Intel -- ^ @HPND-Intel@, Historical Permission Notice and Disclaimer - Intel variant, SPDX License List 3.25 + | HPND_Kevlin_Henney -- ^ @HPND-Kevlin-Henney@, Historical Permission Notice and Disclaimer - Kevlin Henney variant, SPDX License List 3.23, SPDX License List 3.25 + | HPND_Markus_Kuhn -- ^ @HPND-Markus-Kuhn@, Historical Permission Notice and Disclaimer - Markus Kuhn variant, SPDX License List 3.23, SPDX License List 3.25 + | HPND_merchantability_variant -- ^ @HPND-merchantability-variant@, Historical Permission Notice and Disclaimer - merchantability variant, SPDX License List 3.25 + | HPND_MIT_disclaimer -- ^ @HPND-MIT-disclaimer@, Historical Permission Notice and Disclaimer with MIT disclaimer, SPDX License List 3.23, SPDX License List 3.25 + | HPND_Netrek -- ^ @HPND-Netrek@, Historical Permission Notice and Disclaimer - Netrek variant, SPDX License List 3.25 + | HPND_Pbmplus -- ^ @HPND-Pbmplus@, Historical Permission Notice and Disclaimer - Pbmplus variant, SPDX License List 3.23, SPDX License List 3.25 + | HPND_sell_MIT_disclaimer_xserver -- ^ @HPND-sell-MIT-disclaimer-xserver@, Historical Permission Notice and Disclaimer - sell xserver variant with MIT disclaimer, SPDX License List 3.23, SPDX License List 3.25 + | HPND_sell_regexpr -- ^ @HPND-sell-regexpr@, Historical Permission Notice and Disclaimer - sell regexpr variant, SPDX License List 3.23, SPDX License List 3.25 + | HPND_sell_variant_MIT_disclaimer_rev -- ^ @HPND-sell-variant-MIT-disclaimer-rev@, HPND sell variant with MIT disclaimer - reverse, SPDX License List 3.25 + | HPND_sell_variant_MIT_disclaimer -- ^ @HPND-sell-variant-MIT-disclaimer@, HPND sell variant with MIT disclaimer, SPDX License List 3.23, SPDX License List 3.25 + | HPND_sell_variant -- ^ @HPND-sell-variant@, Historical Permission Notice and Disclaimer - sell variant, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | HPND_UC_export_US -- ^ @HPND-UC-export-US@, Historical Permission Notice and Disclaimer - University of California, US export warning, SPDX License List 3.25 + | HPND_UC -- ^ @HPND-UC@, Historical Permission Notice and Disclaimer - University of California variant, SPDX License List 3.23, SPDX License List 3.25 | HPND -- ^ @HPND@, Historical Permission Notice and Disclaimer - | HTMLTIDY -- ^ @HTMLTIDY@, HTML Tidy License, SPDX License List 3.16, SPDX License List 3.23 + | HTMLTIDY -- ^ @HTMLTIDY@, HTML Tidy License, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | IBM_pibs -- ^ @IBM-pibs@, IBM PowerPC Initialization and Boot Software | ICU -- ^ @ICU@, ICU License - | IEC_Code_Components_EULA -- ^ @IEC-Code-Components-EULA@, IEC Code Components End-user licence agreement, SPDX License List 3.23 - | IJG_short -- ^ @IJG-short@, Independent JPEG Group License - short, SPDX License List 3.23 + | IEC_Code_Components_EULA -- ^ @IEC-Code-Components-EULA@, IEC Code Components End-user licence agreement, SPDX License List 3.23, SPDX License List 3.25 + | IJG_short -- ^ @IJG-short@, Independent JPEG Group License - short, SPDX License List 3.23, SPDX License List 3.25 | IJG -- ^ @IJG@, Independent JPEG Group License | ImageMagick -- ^ @ImageMagick@, ImageMagick License | IMatix -- ^ @iMatix@, iMatix Standard Function Library Agreement | Imlib2 -- ^ @Imlib2@, Imlib2 License | Info_ZIP -- ^ @Info-ZIP@, Info-ZIP License - | Inner_Net_2_0 -- ^ @Inner-Net-2.0@, Inner Net License v2.0, SPDX License List 3.23 + | Inner_Net_2_0 -- ^ @Inner-Net-2.0@, Inner Net License v2.0, SPDX License List 3.23, SPDX License List 3.25 | Intel_ACPI -- ^ @Intel-ACPI@, Intel ACPI Software License Agreement | Intel -- ^ @Intel@, Intel Open Source License | Interbase_1_0 -- ^ @Interbase-1.0@, Interbase Public License v1.0 | IPA -- ^ @IPA@, IPA Font License | IPL_1_0 -- ^ @IPL-1.0@, IBM Public License v1.0 - | ISC_Veillard -- ^ @ISC-Veillard@, ISC Veillard variant, SPDX License List 3.23 + | ISC_Veillard -- ^ @ISC-Veillard@, ISC Veillard variant, SPDX License List 3.23, SPDX License List 3.25 | ISC -- ^ @ISC@, ISC License - | Jam -- ^ @Jam@, Jam License, SPDX License List 3.16, SPDX License List 3.23 + | Jam -- ^ @Jam@, Jam License, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | JasPer_2_0 -- ^ @JasPer-2.0@, JasPer License - | JPL_image -- ^ @JPL-image@, JPL Image Use Policy, SPDX License List 3.23 - | JPNIC -- ^ @JPNIC@, Japan Network Information Center License, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | JPL_image -- ^ @JPL-image@, JPL Image Use Policy, SPDX License List 3.23, SPDX License List 3.25 + | JPNIC -- ^ @JPNIC@, Japan Network Information Center License, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | JSON -- ^ @JSON@, JSON License - | Kastrup -- ^ @Kastrup@, Kastrup License, SPDX License List 3.23 - | Kazlib -- ^ @Kazlib@, Kazlib License, SPDX License List 3.23 - | Knuth_CTAN -- ^ @Knuth-CTAN@, Knuth CTAN License, SPDX License List 3.23 + | Kastrup -- ^ @Kastrup@, Kastrup License, SPDX License List 3.23, SPDX License List 3.25 + | Kazlib -- ^ @Kazlib@, Kazlib License, SPDX License List 3.23, SPDX License List 3.25 + | Knuth_CTAN -- ^ @Knuth-CTAN@, Knuth CTAN License, SPDX License List 3.23, SPDX License List 3.25 | LAL_1_2 -- ^ @LAL-1.2@, Licence Art Libre 1.2 | LAL_1_3 -- ^ @LAL-1.3@, Licence Art Libre 1.3 - | Latex2e_translated_notice -- ^ @Latex2e-translated-notice@, Latex2e with translated notice permission, SPDX License List 3.23 + | Latex2e_translated_notice -- ^ @Latex2e-translated-notice@, Latex2e with translated notice permission, SPDX License List 3.23, SPDX License List 3.25 | Latex2e -- ^ @Latex2e@, Latex2e License | Leptonica -- ^ @Leptonica@, Leptonica License | LGPL_2_0_only -- ^ @LGPL-2.0-only@, GNU Library General Public License v2 only @@ -372,21 +389,21 @@ data LicenseId | LGPL_3_0_only -- ^ @LGPL-3.0-only@, GNU Lesser General Public License v3.0 only | LGPL_3_0_or_later -- ^ @LGPL-3.0-or-later@, GNU Lesser General Public License v3.0 or later | LGPLLR -- ^ @LGPLLR@, Lesser General Public License For Linguistic Resources - | Libpng_2_0 -- ^ @libpng-2.0@, PNG Reference Library version 2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | Libpng_2_0 -- ^ @libpng-2.0@, PNG Reference Library version 2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Libpng -- ^ @Libpng@, libpng License - | Libselinux_1_0 -- ^ @libselinux-1.0@, libselinux public domain notice, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | Libselinux_1_0 -- ^ @libselinux-1.0@, libselinux public domain notice, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Libtiff -- ^ @libtiff@, libtiff License - | Libutil_David_Nugent -- ^ @libutil-David-Nugent@, libutil David Nugent License, SPDX License List 3.23 + | Libutil_David_Nugent -- ^ @libutil-David-Nugent@, libutil David Nugent License, SPDX License List 3.23, SPDX License List 3.25 | LiLiQ_P_1_1 -- ^ @LiLiQ-P-1.1@, Licence Libre du Québec – Permissive version 1.1 | LiLiQ_R_1_1 -- ^ @LiLiQ-R-1.1@, Licence Libre du Québec – Réciprocité version 1.1 | LiLiQ_Rplus_1_1 -- ^ @LiLiQ-Rplus-1.1@, Licence Libre du Québec – Réciprocité forte version 1.1 - | Linux_man_pages_1_para -- ^ @Linux-man-pages-1-para@, Linux man-pages - 1 paragraph, SPDX License List 3.23 - | Linux_man_pages_copyleft_2_para -- ^ @Linux-man-pages-copyleft-2-para@, Linux man-pages Copyleft - 2 paragraphs, SPDX License List 3.23 - | Linux_man_pages_copyleft_var -- ^ @Linux-man-pages-copyleft-var@, Linux man-pages Copyleft Variant, SPDX License List 3.23 - | Linux_man_pages_copyleft -- ^ @Linux-man-pages-copyleft@, Linux man-pages Copyleft, SPDX License List 3.16, SPDX License List 3.23 - | Linux_OpenIB -- ^ @Linux-OpenIB@, Linux Kernel Variant of OpenIB.org license, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | LOOP -- ^ @LOOP@, Common Lisp LOOP License, SPDX License List 3.23 - | LPD_document -- ^ @LPD-document@, LPD Documentation License, SPDX License List 3.23 + | Linux_man_pages_1_para -- ^ @Linux-man-pages-1-para@, Linux man-pages - 1 paragraph, SPDX License List 3.23, SPDX License List 3.25 + | Linux_man_pages_copyleft_2_para -- ^ @Linux-man-pages-copyleft-2-para@, Linux man-pages Copyleft - 2 paragraphs, SPDX License List 3.23, SPDX License List 3.25 + | Linux_man_pages_copyleft_var -- ^ @Linux-man-pages-copyleft-var@, Linux man-pages Copyleft Variant, SPDX License List 3.23, SPDX License List 3.25 + | Linux_man_pages_copyleft -- ^ @Linux-man-pages-copyleft@, Linux man-pages Copyleft, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Linux_OpenIB -- ^ @Linux-OpenIB@, Linux Kernel Variant of OpenIB.org license, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | LOOP -- ^ @LOOP@, Common Lisp LOOP License, SPDX License List 3.23, SPDX License List 3.25 + | LPD_document -- ^ @LPD-document@, LPD Documentation License, SPDX License List 3.23, SPDX License List 3.25 | LPL_1_02 -- ^ @LPL-1.02@, Lucent Public License v1.02 | LPL_1_0 -- ^ @LPL-1.0@, Lucent Public License Version 1.0 | LPPL_1_0 -- ^ @LPPL-1.0@, LaTeX Project Public License v1.0 @@ -394,66 +411,69 @@ data LicenseId | LPPL_1_2 -- ^ @LPPL-1.2@, LaTeX Project Public License v1.2 | LPPL_1_3a -- ^ @LPPL-1.3a@, LaTeX Project Public License v1.3a | LPPL_1_3c -- ^ @LPPL-1.3c@, LaTeX Project Public License v1.3c - | Lsof -- ^ @lsof@, lsof License, SPDX License List 3.23 - | Lucida_Bitmap_Fonts -- ^ @Lucida-Bitmap-Fonts@, Lucida Bitmap Fonts License, SPDX License List 3.23 - | LZMA_SDK_9_11_to_9_20 -- ^ @LZMA-SDK-9.11-to-9.20@, LZMA SDK License (versions 9.11 to 9.20), SPDX License List 3.23 - | LZMA_SDK_9_22 -- ^ @LZMA-SDK-9.22@, LZMA SDK License (versions 9.22 and beyond), SPDX License List 3.23 - | Mackerras_3_Clause_acknowledgment -- ^ @Mackerras-3-Clause-acknowledgment@, Mackerras 3-Clause - acknowledgment variant, SPDX License List 3.23 - | Mackerras_3_Clause -- ^ @Mackerras-3-Clause@, Mackerras 3-Clause License, SPDX License List 3.23 - | Magaz -- ^ @magaz@, magaz License, SPDX License List 3.23 - | Mailprio -- ^ @mailprio@, mailprio License, SPDX License List 3.23 + | Lsof -- ^ @lsof@, lsof License, SPDX License List 3.23, SPDX License List 3.25 + | Lucida_Bitmap_Fonts -- ^ @Lucida-Bitmap-Fonts@, Lucida Bitmap Fonts License, SPDX License List 3.23, SPDX License List 3.25 + | LZMA_SDK_9_11_to_9_20 -- ^ @LZMA-SDK-9.11-to-9.20@, LZMA SDK License (versions 9.11 to 9.20), SPDX License List 3.23, SPDX License List 3.25 + | LZMA_SDK_9_22 -- ^ @LZMA-SDK-9.22@, LZMA SDK License (versions 9.22 and beyond), SPDX License List 3.23, SPDX License List 3.25 + | Mackerras_3_Clause_acknowledgment -- ^ @Mackerras-3-Clause-acknowledgment@, Mackerras 3-Clause - acknowledgment variant, SPDX License List 3.23, SPDX License List 3.25 + | Mackerras_3_Clause -- ^ @Mackerras-3-Clause@, Mackerras 3-Clause License, SPDX License List 3.23, SPDX License List 3.25 + | Magaz -- ^ @magaz@, magaz License, SPDX License List 3.23, SPDX License List 3.25 + | Mailprio -- ^ @mailprio@, mailprio License, SPDX License List 3.23, SPDX License List 3.25 | MakeIndex -- ^ @MakeIndex@, MakeIndex License - | Martin_Birgmeier -- ^ @Martin-Birgmeier@, Martin Birgmeier License, SPDX License List 3.23 - | McPhee_slideshow -- ^ @McPhee-slideshow@, McPhee Slideshow License, SPDX License List 3.23 - | Metamail -- ^ @metamail@, metamail License, SPDX License List 3.23 - | Minpack -- ^ @Minpack@, Minpack License, SPDX License List 3.23 + | Martin_Birgmeier -- ^ @Martin-Birgmeier@, Martin Birgmeier License, SPDX License List 3.23, SPDX License List 3.25 + | McPhee_slideshow -- ^ @McPhee-slideshow@, McPhee Slideshow License, SPDX License List 3.23, SPDX License List 3.25 + | Metamail -- ^ @metamail@, metamail License, SPDX License List 3.23, SPDX License List 3.25 + | Minpack -- ^ @Minpack@, Minpack License, SPDX License List 3.23, SPDX License List 3.25 | MirOS -- ^ @MirOS@, The MirOS Licence - | MIT_0 -- ^ @MIT-0@, MIT No Attribution, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | MIT_0 -- ^ @MIT-0@, MIT No Attribution, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | MIT_advertising -- ^ @MIT-advertising@, Enlightenment License (e16) | MIT_CMU -- ^ @MIT-CMU@, CMU License | MIT_enna -- ^ @MIT-enna@, enna License | MIT_feh -- ^ @MIT-feh@, feh License - | MIT_Festival -- ^ @MIT-Festival@, MIT Festival Variant, SPDX License List 3.23 - | MIT_Modern_Variant -- ^ @MIT-Modern-Variant@, MIT License Modern Variant, SPDX License List 3.16, SPDX License List 3.23 - | MIT_open_group -- ^ @MIT-open-group@, MIT Open Group variant, SPDX License List 3.16, SPDX License List 3.23 - | MIT_testregex -- ^ @MIT-testregex@, MIT testregex Variant, SPDX License List 3.23 - | MIT_Wu -- ^ @MIT-Wu@, MIT Tom Wu Variant, SPDX License List 3.23 + | MIT_Festival -- ^ @MIT-Festival@, MIT Festival Variant, SPDX License List 3.23, SPDX License List 3.25 + | MIT_Khronos_old -- ^ @MIT-Khronos-old@, MIT Khronos - old variant, SPDX License List 3.25 + | MIT_Modern_Variant -- ^ @MIT-Modern-Variant@, MIT License Modern Variant, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | MIT_open_group -- ^ @MIT-open-group@, MIT Open Group variant, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | MIT_testregex -- ^ @MIT-testregex@, MIT testregex Variant, SPDX License List 3.23, SPDX License List 3.25 + | MIT_Wu -- ^ @MIT-Wu@, MIT Tom Wu Variant, SPDX License List 3.23, SPDX License List 3.25 | MITNFA -- ^ @MITNFA@, MIT +no-false-attribs license | MIT -- ^ @MIT@, MIT License - | MMIXware -- ^ @MMIXware@, MMIXware License, SPDX License List 3.23 + | MMIXware -- ^ @MMIXware@, MMIXware License, SPDX License List 3.23, SPDX License List 3.25 | Motosoto -- ^ @Motosoto@, Motosoto License - | MPEG_SSG -- ^ @MPEG-SSG@, MPEG Software Simulation, SPDX License List 3.23 - | Mpi_permissive -- ^ @mpi-permissive@, mpi Permissive License, SPDX License List 3.23 + | MPEG_SSG -- ^ @MPEG-SSG@, MPEG Software Simulation, SPDX License List 3.23, SPDX License List 3.25 + | Mpi_permissive -- ^ @mpi-permissive@, mpi Permissive License, SPDX License List 3.23, SPDX License List 3.25 | Mpich2 -- ^ @mpich2@, mpich2 License | MPL_1_0 -- ^ @MPL-1.0@, Mozilla Public License 1.0 | MPL_1_1 -- ^ @MPL-1.1@, Mozilla Public License 1.1 | MPL_2_0_no_copyleft_exception -- ^ @MPL-2.0-no-copyleft-exception@, Mozilla Public License 2.0 (no copyleft exception) | MPL_2_0 -- ^ @MPL-2.0@, Mozilla Public License 2.0 - | Mplus -- ^ @mplus@, mplus Font License, SPDX License List 3.23 - | MS_LPL -- ^ @MS-LPL@, Microsoft Limited Public License, SPDX License List 3.23 + | Mplus -- ^ @mplus@, mplus Font License, SPDX License List 3.23, SPDX License List 3.25 + | MS_LPL -- ^ @MS-LPL@, Microsoft Limited Public License, SPDX License List 3.23, SPDX License List 3.25 | MS_PL -- ^ @MS-PL@, Microsoft Public License | MS_RL -- ^ @MS-RL@, Microsoft Reciprocal License | MTLL -- ^ @MTLL@, Matrix Template Library License - | MulanPSL_1_0 -- ^ @MulanPSL-1.0@, Mulan Permissive Software License, Version 1, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | MulanPSL_2_0 -- ^ @MulanPSL-2.0@, Mulan Permissive Software License, Version 2, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | MulanPSL_1_0 -- ^ @MulanPSL-1.0@, Mulan Permissive Software License, Version 1, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | MulanPSL_2_0 -- ^ @MulanPSL-2.0@, Mulan Permissive Software License, Version 2, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Multics -- ^ @Multics@, Multics License | Mup -- ^ @Mup@, Mup License - | NAIST_2003 -- ^ @NAIST-2003@, Nara Institute of Science and Technology License (2003), SPDX License List 3.16, SPDX License List 3.23 + | NAIST_2003 -- ^ @NAIST-2003@, Nara Institute of Science and Technology License (2003), SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | NASA_1_3 -- ^ @NASA-1.3@, NASA Open Source Agreement 1.3 | Naumen -- ^ @Naumen@, Naumen Public License | NBPL_1_0 -- ^ @NBPL-1.0@, Net Boolean Public License v1 - | NCGL_UK_2_0 -- ^ @NCGL-UK-2.0@, Non-Commercial Government Licence, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | NCBI_PD -- ^ @NCBI-PD@, NCBI Public Domain Notice, SPDX License List 3.25 + | NCGL_UK_2_0 -- ^ @NCGL-UK-2.0@, Non-Commercial Government Licence, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | NCL -- ^ @NCL@, NCL Source Code License, SPDX License List 3.25 | NCSA -- ^ @NCSA@, University of Illinois/NCSA Open Source License - | Net_SNMP -- ^ @Net-SNMP@, Net-SNMP License + | Net_SNMP -- ^ @Net-SNMP@, Net-SNMP License, SPDX License List 3.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 | NetCDF -- ^ @NetCDF@, NetCDF license | Newsletr -- ^ @Newsletr@, Newsletr License | NGPL -- ^ @NGPL@, Nethack General Public License - | NICTA_1_0 -- ^ @NICTA-1.0@, NICTA Public Software License, Version 1.0, SPDX License List 3.23 - | NIST_PD_fallback -- ^ @NIST-PD-fallback@, NIST Public Domain Notice with license fallback, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | NIST_PD -- ^ @NIST-PD@, NIST Public Domain Notice, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | NIST_Software -- ^ @NIST-Software@, NIST Software License, SPDX License List 3.23 + | NICTA_1_0 -- ^ @NICTA-1.0@, NICTA Public Software License, Version 1.0, SPDX License List 3.23, SPDX License List 3.25 + | NIST_PD_fallback -- ^ @NIST-PD-fallback@, NIST Public Domain Notice with license fallback, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | NIST_PD -- ^ @NIST-PD@, NIST Public Domain Notice, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | NIST_Software -- ^ @NIST-Software@, NIST Software License, SPDX License List 3.23, SPDX License List 3.25 | NLOD_1_0 -- ^ @NLOD-1.0@, Norwegian Licence for Open Government Data (NLOD) 1.0 - | NLOD_2_0 -- ^ @NLOD-2.0@, Norwegian Licence for Open Government Data (NLOD) 2.0, SPDX License List 3.16, SPDX License List 3.23 + | NLOD_2_0 -- ^ @NLOD-2.0@, Norwegian Licence for Open Government Data (NLOD) 2.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | NLPL -- ^ @NLPL@, No Limit Public License | Nokia -- ^ @Nokia@, Nokia Open Source License | NOSL -- ^ @NOSL@, Netizen Open Source License @@ -462,26 +482,27 @@ data LicenseId | NPL_1_1 -- ^ @NPL-1.1@, Netscape Public License v1.1 | NPOSL_3_0 -- ^ @NPOSL-3.0@, Non-Profit Open Software License 3.0 | NRL -- ^ @NRL@, NRL License - | NTP_0 -- ^ @NTP-0@, NTP No Attribution, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | NTP_0 -- ^ @NTP-0@, NTP No Attribution, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | NTP -- ^ @NTP@, NTP License - | O_UDA_1_0 -- ^ @O-UDA-1.0@, Open Use of Data Agreement v1.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | O_UDA_1_0 -- ^ @O-UDA-1.0@, Open Use of Data Agreement v1.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | OAR -- ^ @OAR@, OAR License, SPDX License List 3.25 | OCCT_PL -- ^ @OCCT-PL@, Open CASCADE Technology Public License | OCLC_2_0 -- ^ @OCLC-2.0@, OCLC Research Public License 2.0 | ODbL_1_0 -- ^ @ODbL-1.0@, Open Data Commons Open Database License v1.0 - | ODC_By_1_0 -- ^ @ODC-By-1.0@, Open Data Commons Attribution License v1.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | OFFIS -- ^ @OFFIS@, OFFIS License, SPDX License List 3.23 - | OFL_1_0_no_RFN -- ^ @OFL-1.0-no-RFN@, SIL Open Font License 1.0 with no Reserved Font Name, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | OFL_1_0_RFN -- ^ @OFL-1.0-RFN@, SIL Open Font License 1.0 with Reserved Font Name, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | ODC_By_1_0 -- ^ @ODC-By-1.0@, Open Data Commons Attribution License v1.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | OFFIS -- ^ @OFFIS@, OFFIS License, SPDX License List 3.23, SPDX License List 3.25 + | OFL_1_0_no_RFN -- ^ @OFL-1.0-no-RFN@, SIL Open Font License 1.0 with no Reserved Font Name, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | OFL_1_0_RFN -- ^ @OFL-1.0-RFN@, SIL Open Font License 1.0 with Reserved Font Name, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | OFL_1_0 -- ^ @OFL-1.0@, SIL Open Font License 1.0 - | OFL_1_1_no_RFN -- ^ @OFL-1.1-no-RFN@, SIL Open Font License 1.1 with no Reserved Font Name, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | OFL_1_1_RFN -- ^ @OFL-1.1-RFN@, SIL Open Font License 1.1 with Reserved Font Name, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | OFL_1_1_no_RFN -- ^ @OFL-1.1-no-RFN@, SIL Open Font License 1.1 with no Reserved Font Name, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | OFL_1_1_RFN -- ^ @OFL-1.1-RFN@, SIL Open Font License 1.1 with Reserved Font Name, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | OFL_1_1 -- ^ @OFL-1.1@, SIL Open Font License 1.1 - | OGC_1_0 -- ^ @OGC-1.0@, OGC Software License, Version 1.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | OGDL_Taiwan_1_0 -- ^ @OGDL-Taiwan-1.0@, Taiwan Open Government Data License, version 1.0, SPDX License List 3.16, SPDX License List 3.23 - | OGL_Canada_2_0 -- ^ @OGL-Canada-2.0@, Open Government Licence - Canada, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | OGL_UK_1_0 -- ^ @OGL-UK-1.0@, Open Government Licence v1.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | OGL_UK_2_0 -- ^ @OGL-UK-2.0@, Open Government Licence v2.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | OGL_UK_3_0 -- ^ @OGL-UK-3.0@, Open Government Licence v3.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | OGC_1_0 -- ^ @OGC-1.0@, OGC Software License, Version 1.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | OGDL_Taiwan_1_0 -- ^ @OGDL-Taiwan-1.0@, Taiwan Open Government Data License, version 1.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | OGL_Canada_2_0 -- ^ @OGL-Canada-2.0@, Open Government Licence - Canada, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | OGL_UK_1_0 -- ^ @OGL-UK-1.0@, Open Government Licence v1.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | OGL_UK_2_0 -- ^ @OGL-UK-2.0@, Open Government Licence v2.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | OGL_UK_3_0 -- ^ @OGL-UK-3.0@, Open Government Licence v3.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | OGTSL -- ^ @OGTSL@, Open Group Test Suite License | OLDAP_1_1 -- ^ @OLDAP-1.1@, Open LDAP Public License v1.1 | OLDAP_1_2 -- ^ @OLDAP-1.2@, Open LDAP Public License v1.2 @@ -499,43 +520,45 @@ data LicenseId | OLDAP_2_6 -- ^ @OLDAP-2.6@, Open LDAP Public License v2.6 | OLDAP_2_7 -- ^ @OLDAP-2.7@, Open LDAP Public License v2.7 | OLDAP_2_8 -- ^ @OLDAP-2.8@, Open LDAP Public License v2.8 - | OLFL_1_3 -- ^ @OLFL-1.3@, Open Logistics Foundation License Version 1.3, SPDX License List 3.23 + | OLFL_1_3 -- ^ @OLFL-1.3@, Open Logistics Foundation License Version 1.3, SPDX License List 3.23, SPDX License List 3.25 | OML -- ^ @OML@, Open Market License - | OpenPBS_2_3 -- ^ @OpenPBS-2.3@, OpenPBS v2.3 Software License, SPDX License List 3.23 - | OpenSSL_standalone -- ^ @OpenSSL-standalone@, OpenSSL License - standalone, SPDX License List 3.23 + | OpenPBS_2_3 -- ^ @OpenPBS-2.3@, OpenPBS v2.3 Software License, SPDX License List 3.23, SPDX License List 3.25 + | OpenSSL_standalone -- ^ @OpenSSL-standalone@, OpenSSL License - standalone, SPDX License List 3.23, SPDX License List 3.25 | OpenSSL -- ^ @OpenSSL@, OpenSSL License - | OpenVision -- ^ @OpenVision@, OpenVision License, SPDX License List 3.23 + | OpenVision -- ^ @OpenVision@, OpenVision License, SPDX License List 3.23, SPDX License List 3.25 | OPL_1_0 -- ^ @OPL-1.0@, Open Public License v1.0 - | OPL_UK_3_0 -- ^ @OPL-UK-3.0@, United Kingdom Open Parliament Licence v3.0, SPDX License List 3.23 - | OPUBL_1_0 -- ^ @OPUBL-1.0@, Open Publication License v1.0, SPDX License List 3.16, SPDX License List 3.23 + | OPL_UK_3_0 -- ^ @OPL-UK-3.0@, United Kingdom Open Parliament Licence v3.0, SPDX License List 3.23, SPDX License List 3.25 + | OPUBL_1_0 -- ^ @OPUBL-1.0@, Open Publication License v1.0, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | OSET_PL_2_1 -- ^ @OSET-PL-2.1@, OSET Public License version 2.1 | OSL_1_0 -- ^ @OSL-1.0@, Open Software License 1.0 | OSL_1_1 -- ^ @OSL-1.1@, Open Software License 1.1 | OSL_2_0 -- ^ @OSL-2.0@, Open Software License 2.0 | OSL_2_1 -- ^ @OSL-2.1@, Open Software License 2.1 | OSL_3_0 -- ^ @OSL-3.0@, Open Software License 3.0 - | PADL -- ^ @PADL@, PADL License, SPDX License List 3.23 - | Parity_6_0_0 -- ^ @Parity-6.0.0@, The Parity Public License 6.0.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Parity_7_0_0 -- ^ @Parity-7.0.0@, The Parity Public License 7.0.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | PADL -- ^ @PADL@, PADL License, SPDX License List 3.23, SPDX License List 3.25 + | Parity_6_0_0 -- ^ @Parity-6.0.0@, The Parity Public License 6.0.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Parity_7_0_0 -- ^ @Parity-7.0.0@, The Parity Public License 7.0.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | PDDL_1_0 -- ^ @PDDL-1.0@, Open Data Commons Public Domain Dedication & License 1.0 | PHP_3_01 -- ^ @PHP-3.01@, PHP License v3.01 | PHP_3_0 -- ^ @PHP-3.0@, PHP License v3.0 - | Pixar -- ^ @Pixar@, Pixar License, SPDX License List 3.23 + | Pixar -- ^ @Pixar@, Pixar License, SPDX License List 3.23, SPDX License List 3.25 + | Pkgconf -- ^ @pkgconf@, pkgconf License, SPDX License List 3.25 | Plexus -- ^ @Plexus@, Plexus Classworlds License - | Pnmstitch -- ^ @pnmstitch@, pnmstitch License, SPDX License List 3.23 - | PolyForm_Noncommercial_1_0_0 -- ^ @PolyForm-Noncommercial-1.0.0@, PolyForm Noncommercial License 1.0.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | PolyForm_Small_Business_1_0_0 -- ^ @PolyForm-Small-Business-1.0.0@, PolyForm Small Business License 1.0.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | Pnmstitch -- ^ @pnmstitch@, pnmstitch License, SPDX License List 3.23, SPDX License List 3.25 + | PolyForm_Noncommercial_1_0_0 -- ^ @PolyForm-Noncommercial-1.0.0@, PolyForm Noncommercial License 1.0.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | PolyForm_Small_Business_1_0_0 -- ^ @PolyForm-Small-Business-1.0.0@, PolyForm Small Business License 1.0.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | PostgreSQL -- ^ @PostgreSQL@, PostgreSQL License - | PSF_2_0 -- ^ @PSF-2.0@, Python Software Foundation License 2.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | PPL -- ^ @PPL@, Peer Production License, SPDX License List 3.25 + | PSF_2_0 -- ^ @PSF-2.0@, Python Software Foundation License 2.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Psfrag -- ^ @psfrag@, psfrag License | Psutils -- ^ @psutils@, psutils License - | Python_2_0_1 -- ^ @Python-2.0.1@, Python License 2.0.1, SPDX License List 3.23 + | Python_2_0_1 -- ^ @Python-2.0.1@, Python License 2.0.1, SPDX License List 3.23, SPDX License List 3.25 | Python_2_0 -- ^ @Python-2.0@, Python License 2.0 - | Python_ldap -- ^ @python-ldap@, Python ldap License, SPDX License List 3.23 + | Python_ldap -- ^ @python-ldap@, Python ldap License, SPDX License List 3.23, SPDX License List 3.25 | Qhull -- ^ @Qhull@, Qhull License - | QPL_1_0_INRIA_2004 -- ^ @QPL-1.0-INRIA-2004@, Q Public License 1.0 - INRIA 2004 variant, SPDX License List 3.23 + | QPL_1_0_INRIA_2004 -- ^ @QPL-1.0-INRIA-2004@, Q Public License 1.0 - INRIA 2004 variant, SPDX License List 3.23, SPDX License List 3.25 | QPL_1_0 -- ^ @QPL-1.0@, Q Public License 1.0 - | Radvd -- ^ @radvd@, radvd License, SPDX License List 3.23 + | Radvd -- ^ @radvd@, radvd License, SPDX License List 3.23, SPDX License List 3.25 | Rdisc -- ^ @Rdisc@, Rdisc License | RHeCos_1_1 -- ^ @RHeCos-1.1@, Red Hat eCos Public License v1.1 | RPL_1_1 -- ^ @RPL-1.1@, Reciprocal Public License 1.1 @@ -543,100 +566,106 @@ data LicenseId | RPSL_1_0 -- ^ @RPSL-1.0@, RealNetworks Public Source License v1.0 | RSA_MD -- ^ @RSA-MD@, RSA Message-Digest License | RSCPL -- ^ @RSCPL@, Ricoh Source Code Public License + | Ruby_pty -- ^ @Ruby-pty@, Ruby pty extension license, SPDX License List 3.25 | Ruby -- ^ @Ruby@, Ruby License - | SAX_PD_2_0 -- ^ @SAX-PD-2.0@, Sax Public Domain Notice 2.0, SPDX License List 3.23 + | SAX_PD_2_0 -- ^ @SAX-PD-2.0@, Sax Public Domain Notice 2.0, SPDX License List 3.23, SPDX License List 3.25 | SAX_PD -- ^ @SAX-PD@, Sax Public Domain Notice | Saxpath -- ^ @Saxpath@, Saxpath License | SCEA -- ^ @SCEA@, SCEA Shared Source License - | SchemeReport -- ^ @SchemeReport@, Scheme Language Report License, SPDX License List 3.16, SPDX License List 3.23 - | Sendmail_8_23 -- ^ @Sendmail-8.23@, Sendmail License 8.23, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | SchemeReport -- ^ @SchemeReport@, Scheme Language Report License, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Sendmail_8_23 -- ^ @Sendmail-8.23@, Sendmail License 8.23, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | Sendmail -- ^ @Sendmail@, Sendmail License | SGI_B_1_0 -- ^ @SGI-B-1.0@, SGI Free Software License B v1.0 | SGI_B_1_1 -- ^ @SGI-B-1.1@, SGI Free Software License B v1.1 | SGI_B_2_0 -- ^ @SGI-B-2.0@, SGI Free Software License B v2.0 - | SGI_OpenGL -- ^ @SGI-OpenGL@, SGI OpenGL License, SPDX License List 3.23 - | SGP4 -- ^ @SGP4@, SGP4 Permission Notice, SPDX License List 3.23 - | SHL_0_51 -- ^ @SHL-0.51@, Solderpad Hardware License, Version 0.51, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | SHL_0_5 -- ^ @SHL-0.5@, Solderpad Hardware License v0.5, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | SGI_OpenGL -- ^ @SGI-OpenGL@, SGI OpenGL License, SPDX License List 3.23, SPDX License List 3.25 + | SGP4 -- ^ @SGP4@, SGP4 Permission Notice, SPDX License List 3.23, SPDX License List 3.25 + | SHL_0_51 -- ^ @SHL-0.51@, Solderpad Hardware License, Version 0.51, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | SHL_0_5 -- ^ @SHL-0.5@, Solderpad Hardware License v0.5, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | SimPL_2_0 -- ^ @SimPL-2.0@, Simple Public License 2.0 | SISSL_1_2 -- ^ @SISSL-1.2@, Sun Industry Standards Source License v1.2 | SISSL -- ^ @SISSL@, Sun Industry Standards Source License v1.1 | Sleepycat -- ^ @Sleepycat@, Sleepycat License - | SL -- ^ @SL@, SL License, SPDX License List 3.23 + | SL -- ^ @SL@, SL License, SPDX License List 3.23, SPDX License List 3.25 | SMLNJ -- ^ @SMLNJ@, Standard ML of New Jersey License | SMPPL -- ^ @SMPPL@, Secure Messaging Protocol Public License | SNIA -- ^ @SNIA@, SNIA Public License 1.1 - | Snprintf -- ^ @snprintf@, snprintf License, SPDX License List 3.23 - | SoftSurfer -- ^ @softSurfer@, softSurfer License, SPDX License List 3.23 - | Soundex -- ^ @Soundex@, Soundex License, SPDX License List 3.23 + | Snprintf -- ^ @snprintf@, snprintf License, SPDX License List 3.23, SPDX License List 3.25 + | SoftSurfer -- ^ @softSurfer@, softSurfer License, SPDX License List 3.23, SPDX License List 3.25 + | Soundex -- ^ @Soundex@, Soundex License, SPDX License List 3.23, SPDX License List 3.25 | Spencer_86 -- ^ @Spencer-86@, Spencer License 86 | Spencer_94 -- ^ @Spencer-94@, Spencer License 94 | Spencer_99 -- ^ @Spencer-99@, Spencer License 99 | SPL_1_0 -- ^ @SPL-1.0@, Sun Public License v1.0 - | Ssh_keyscan -- ^ @ssh-keyscan@, ssh-keyscan License, SPDX License List 3.23 - | SSH_OpenSSH -- ^ @SSH-OpenSSH@, SSH OpenSSH license, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | SSH_short -- ^ @SSH-short@, SSH short notice, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | SSLeay_standalone -- ^ @SSLeay-standalone@, SSLeay License - standalone, SPDX License List 3.23 - | SSPL_1_0 -- ^ @SSPL-1.0@, Server Side Public License, v 1, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | Ssh_keyscan -- ^ @ssh-keyscan@, ssh-keyscan License, SPDX License List 3.23, SPDX License List 3.25 + | SSH_OpenSSH -- ^ @SSH-OpenSSH@, SSH OpenSSH license, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | SSH_short -- ^ @SSH-short@, SSH short notice, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | SSLeay_standalone -- ^ @SSLeay-standalone@, SSLeay License - standalone, SPDX License List 3.23, SPDX License List 3.25 + | SSPL_1_0 -- ^ @SSPL-1.0@, Server Side Public License, v 1, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | SugarCRM_1_1_3 -- ^ @SugarCRM-1.1.3@, SugarCRM Public License v1.1.3 - | Sun_PPP -- ^ @Sun-PPP@, Sun PPP License, SPDX License List 3.23 - | SunPro -- ^ @SunPro@, SunPro License, SPDX License List 3.23 + | Sun_PPP_2000 -- ^ @Sun-PPP-2000@, Sun PPP License (2000), SPDX License List 3.25 + | Sun_PPP -- ^ @Sun-PPP@, Sun PPP License, SPDX License List 3.23, SPDX License List 3.25 + | SunPro -- ^ @SunPro@, SunPro License, SPDX License List 3.23, SPDX License List 3.25 | SWL -- ^ @SWL@, Scheme Widget Library (SWL) Software License Agreement - | Swrule -- ^ @swrule@, swrule License, SPDX License List 3.23 - | Symlinks -- ^ @Symlinks@, Symlinks License, SPDX License List 3.23 - | TAPR_OHL_1_0 -- ^ @TAPR-OHL-1.0@, TAPR Open Hardware License v1.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 + | Swrule -- ^ @swrule@, swrule License, SPDX License List 3.23, SPDX License List 3.25 + | Symlinks -- ^ @Symlinks@, Symlinks License, SPDX License List 3.23, SPDX License List 3.25 + | TAPR_OHL_1_0 -- ^ @TAPR-OHL-1.0@, TAPR Open Hardware License v1.0, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 | TCL -- ^ @TCL@, TCL/TK License | TCP_wrappers -- ^ @TCP-wrappers@, TCP Wrappers License - | TermReadKey -- ^ @TermReadKey@, TermReadKey License, SPDX License List 3.23 - | TGPPL_1_0 -- ^ @TGPPL-1.0@, Transitive Grace Period Public Licence 1.0, SPDX License List 3.23 + | TermReadKey -- ^ @TermReadKey@, TermReadKey License, SPDX License List 3.23, SPDX License List 3.25 + | TGPPL_1_0 -- ^ @TGPPL-1.0@, Transitive Grace Period Public Licence 1.0, SPDX License List 3.23, SPDX License List 3.25 + | Threeparttable -- ^ @threeparttable@, threeparttable License, SPDX License List 3.25 | TMate -- ^ @TMate@, TMate Open Source License | TORQUE_1_1 -- ^ @TORQUE-1.1@, TORQUE v2.5+ Software License v1.1 | TOSL -- ^ @TOSL@, Trusster Open Source License - | TPDL -- ^ @TPDL@, Time::ParseDate License, SPDX License List 3.23 - | TPL_1_0 -- ^ @TPL-1.0@, THOR Public License 1.0, SPDX License List 3.23 - | TTWL -- ^ @TTWL@, Text-Tabs+Wrap License, SPDX License List 3.23 - | TTYP0 -- ^ @TTYP0@, TTYP0 License, SPDX License List 3.23 - | TU_Berlin_1_0 -- ^ @TU-Berlin-1.0@, Technische Universitaet Berlin License 1.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | TU_Berlin_2_0 -- ^ @TU-Berlin-2.0@, Technische Universitaet Berlin License 2.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | UCAR -- ^ @UCAR@, UCAR License, SPDX License List 3.23 - | UCL_1_0 -- ^ @UCL-1.0@, Upstream Compatibility License v1.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23 - | Ulem -- ^ @ulem@, ulem License, SPDX License List 3.23 - | UMich_Merit -- ^ @UMich-Merit@, Michigan/Merit Networks License, SPDX License List 3.23 - | Unicode_3_0 -- ^ @Unicode-3.0@, Unicode License v3, SPDX License List 3.23 + | TPDL -- ^ @TPDL@, Time::ParseDate License, SPDX License List 3.23, SPDX License List 3.25 + | TPL_1_0 -- ^ @TPL-1.0@, THOR Public License 1.0, SPDX License List 3.23, SPDX License List 3.25 + | TTWL -- ^ @TTWL@, Text-Tabs+Wrap License, SPDX License List 3.23, SPDX License List 3.25 + | TTYP0 -- ^ @TTYP0@, TTYP0 License, SPDX License List 3.23, SPDX License List 3.25 + | TU_Berlin_1_0 -- ^ @TU-Berlin-1.0@, Technische Universitaet Berlin License 1.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | TU_Berlin_2_0 -- ^ @TU-Berlin-2.0@, Technische Universitaet Berlin License 2.0, SPDX License List 3.2, SPDX License List 3.6, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Ubuntu_font_1_0 -- ^ @Ubuntu-font-1.0@, Ubuntu Font Licence v1.0, SPDX License List 3.25 + | UCAR -- ^ @UCAR@, UCAR License, SPDX License List 3.23, SPDX License List 3.25 + | UCL_1_0 -- ^ @UCL-1.0@, Upstream Compatibility License v1.0, SPDX License List 3.9, SPDX License List 3.10, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | Ulem -- ^ @ulem@, ulem License, SPDX License List 3.23, SPDX License List 3.25 + | UMich_Merit -- ^ @UMich-Merit@, Michigan/Merit Networks License, SPDX License List 3.23, SPDX License List 3.25 + | Unicode_3_0 -- ^ @Unicode-3.0@, Unicode License v3, SPDX License List 3.23, SPDX License List 3.25 | Unicode_DFS_2015 -- ^ @Unicode-DFS-2015@, Unicode License Agreement - Data Files and Software (2015) | Unicode_DFS_2016 -- ^ @Unicode-DFS-2016@, Unicode License Agreement - Data Files and Software (2016) | Unicode_TOU -- ^ @Unicode-TOU@, Unicode Terms of Use - | UnixCrypt -- ^ @UnixCrypt@, UnixCrypt License, SPDX License List 3.23 + | UnixCrypt -- ^ @UnixCrypt@, UnixCrypt License, SPDX License List 3.23, SPDX License List 3.25 | Unlicense -- ^ @Unlicense@, The Unlicense | UPL_1_0 -- ^ @UPL-1.0@, Universal Permissive License v1.0 - | URT_RLE -- ^ @URT-RLE@, Utah Raster Toolkit Run Length Encoded License, SPDX License List 3.23 + | URT_RLE -- ^ @URT-RLE@, Utah Raster Toolkit Run Length Encoded License, SPDX License List 3.23, SPDX License List 3.25 | Vim -- ^ @Vim@, Vim License | VOSTROM -- ^ @VOSTROM@, VOSTROM Public License for Open Source | VSL_1_0 -- ^ @VSL-1.0@, Vovida Software License v1.0 | W3C_19980720 -- ^ @W3C-19980720@, W3C Software Notice and License (1998-07-20) | W3C_20150513 -- ^ @W3C-20150513@, W3C Software Notice and Document License (2015-05-13) | W3C -- ^ @W3C@, W3C Software Notice and License (2002-12-31) - | W3m -- ^ @w3m@, w3m License, SPDX License List 3.23 + | W3m -- ^ @w3m@, w3m License, SPDX License List 3.23, SPDX License List 3.25 | Watcom_1_0 -- ^ @Watcom-1.0@, Sybase Open Watcom Public License 1.0 - | Widget_Workshop -- ^ @Widget-Workshop@, Widget Workshop License, SPDX License List 3.23 + | Widget_Workshop -- ^ @Widget-Workshop@, Widget Workshop License, SPDX License List 3.23, SPDX License List 3.25 | Wsuipa -- ^ @Wsuipa@, Wsuipa License | WTFPL -- ^ @WTFPL@, Do What The F*ck You Want To Public License - | X11_distribute_modifications_variant -- ^ @X11-distribute-modifications-variant@, X11 License Distribution Modification Variant, SPDX License List 3.16, SPDX License List 3.23 + | X11_distribute_modifications_variant -- ^ @X11-distribute-modifications-variant@, X11 License Distribution Modification Variant, SPDX License List 3.16, SPDX License List 3.23, SPDX License List 3.25 + | X11_swapped -- ^ @X11-swapped@, X11 swapped final paragraphs, SPDX License List 3.25 | X11 -- ^ @X11@, X11 License - | Xdebug_1_03 -- ^ @Xdebug-1.03@, Xdebug License v 1.03, SPDX License List 3.23 + | Xdebug_1_03 -- ^ @Xdebug-1.03@, Xdebug License v 1.03, SPDX License List 3.23, SPDX License List 3.25 | Xerox -- ^ @Xerox@, Xerox License - | Xfig -- ^ @Xfig@, Xfig License, SPDX License List 3.23 + | Xfig -- ^ @Xfig@, Xfig License, SPDX License List 3.23, SPDX License List 3.25 | XFree86_1_1 -- ^ @XFree86-1.1@, XFree86 License 1.1 | Xinetd -- ^ @xinetd@, xinetd License - | Xkeyboard_config_Zinoviev -- ^ @xkeyboard-config-Zinoviev@, xkeyboard-config Zinoviev License, SPDX License List 3.23 - | Xlock -- ^ @xlock@, xlock License, SPDX License List 3.23 + | Xkeyboard_config_Zinoviev -- ^ @xkeyboard-config-Zinoviev@, xkeyboard-config Zinoviev License, SPDX License List 3.23, SPDX License List 3.25 + | Xlock -- ^ @xlock@, xlock License, SPDX License List 3.23, SPDX License List 3.25 | Xnet -- ^ @Xnet@, X.Net License | Xpp -- ^ @xpp@, XPP License | XSkat -- ^ @XSkat@, XSkat License + | Xzoom -- ^ @xzoom@, xzoom License, SPDX License List 3.25 | YPL_1_0 -- ^ @YPL-1.0@, Yahoo! Public License v1.0 | YPL_1_1 -- ^ @YPL-1.1@, Yahoo! Public License v1.1 | Zed -- ^ @Zed@, Zed License - | Zeeff -- ^ @Zeeff@, Zeeff License, SPDX License List 3.23 + | Zeeff -- ^ @Zeeff@, Zeeff License, SPDX License List 3.23, SPDX License List 3.25 | Zend_2_0 -- ^ @Zend-2.0@, Zend License v2.0 | Zimbra_1_3 -- ^ @Zimbra-1.3@, Zimbra Public License v1.3 | Zimbra_1_4 -- ^ @Zimbra-1.4@, Zimbra Public License v1.4 @@ -645,10 +674,10 @@ data LicenseId | ZPL_1_1 -- ^ @ZPL-1.1@, Zope Public License 1.1 | ZPL_2_0 -- ^ @ZPL-2.0@, Zope Public License 2.0 | ZPL_2_1 -- ^ @ZPL-2.1@, Zope Public License 2.1 - deriving (Eq, Ord, Enum, Bounded, Show, Read, Typeable, Data) + deriving (Eq, Ord, Enum, Bounded, Show, Read, Data) instance Binary LicenseId where - -- Word16 is encoded in big endianess + -- Word16 is encoded in big endianness -- https://github.com/kolmodin/binary/blob/master/src/Data/Binary/Class.hs#L220-LL227 put = Binary.putWord16be . fromIntegral . fromEnum get = do @@ -727,7 +756,8 @@ licenseIdMigrationMessage = go where -- | License SPDX identifier, e.g. @"BSD-3-Clause"@. licenseId :: LicenseId -> String -licenseId NullBSD = "0BSD" +licenseId N_0BSD = "0BSD" +licenseId N_3D_Slicer_1_0 = "3D-Slicer-1.0" licenseId AAL = "AAL" licenseId Abstyles = "Abstyles" licenseId AdaCore_doc = "AdaCore-doc" @@ -748,12 +778,14 @@ licenseId AGPL_1_0_or_later = "AGPL-1.0-or-later" licenseId AGPL_3_0_only = "AGPL-3.0-only" licenseId AGPL_3_0_or_later = "AGPL-3.0-or-later" licenseId Aladdin = "Aladdin" +licenseId AMD_newlib = "AMD-newlib" licenseId AMDPLPA = "AMDPLPA" licenseId AML_glslang = "AML-glslang" licenseId AML = "AML" licenseId AMPAS = "AMPAS" licenseId ANTLR_PD_fallback = "ANTLR-PD-fallback" licenseId ANTLR_PD = "ANTLR-PD" +licenseId Any_OSI = "any-OSI" licenseId Apache_1_0 = "Apache-1.0" licenseId Apache_1_1 = "Apache-1.1" licenseId Apache_2_0 = "Apache-2.0" @@ -790,6 +822,7 @@ licenseId BSD_1_Clause = "BSD-1-Clause" licenseId BSD_2_Clause_FreeBSD = "BSD-2-Clause-FreeBSD" licenseId BSD_2_Clause_NetBSD = "BSD-2-Clause-NetBSD" licenseId BSD_2_Clause_Darwin = "BSD-2-Clause-Darwin" +licenseId BSD_2_Clause_first_lines = "BSD-2-Clause-first-lines" licenseId BSD_2_Clause_Patent = "BSD-2-Clause-Patent" licenseId BSD_2_Clause_Views = "BSD-2-Clause-Views" licenseId BSD_2_Clause = "BSD-2-Clause" @@ -829,6 +862,7 @@ licenseId CAL_1_0_Combined_Work_Exception = "CAL-1.0-Combined-Work-Exception" licenseId CAL_1_0 = "CAL-1.0" licenseId Caldera_no_preamble = "Caldera-no-preamble" licenseId Caldera = "Caldera" +licenseId Catharon = "Catharon" licenseId CATOSL_1_1 = "CATOSL-1.1" licenseId CC_BY_1_0 = "CC-BY-1.0" licenseId CC_BY_2_0 = "CC-BY-2.0" @@ -925,11 +959,14 @@ licenseId CrystalStacker = "CrystalStacker" licenseId CUA_OPL_1_0 = "CUA-OPL-1.0" licenseId Cube = "Cube" licenseId Curl = "curl" +licenseId Cve_tou = "cve-tou" licenseId D_FSL_1_0 = "D-FSL-1.0" licenseId DEC_3_Clause = "DEC-3-Clause" licenseId Diffmark = "diffmark" licenseId DL_DE_BY_2_0 = "DL-DE-BY-2.0" licenseId DL_DE_ZERO_2_0 = "DL-DE-ZERO-2.0" +licenseId DocBook_Schema = "DocBook-Schema" +licenseId DocBook_XML = "DocBook-XML" licenseId DOC = "DOC" licenseId Dotseqn = "Dotseqn" licenseId DRL_1_0 = "DRL-1.0" @@ -1004,26 +1041,35 @@ licenseId GPL_3_0_or_later = "GPL-3.0-or-later" licenseId Graphics_Gems = "Graphics-Gems" licenseId GSOAP_1_3b = "gSOAP-1.3b" licenseId Gtkbook = "gtkbook" +licenseId Gutmann = "Gutmann" licenseId HaskellReport = "HaskellReport" licenseId Hdparm = "hdparm" +licenseId HIDAPI = "HIDAPI" licenseId Hippocratic_2_1 = "Hippocratic-2.1" licenseId HP_1986 = "HP-1986" licenseId HP_1989 = "HP-1989" licenseId HPND_DEC = "HPND-DEC" licenseId HPND_doc_sell = "HPND-doc-sell" licenseId HPND_doc = "HPND-doc" +licenseId HPND_export_US_acknowledgement = "HPND-export-US-acknowledgement" licenseId HPND_export_US_modify = "HPND-export-US-modify" licenseId HPND_export_US = "HPND-export-US" +licenseId HPND_export2_US = "HPND-export2-US" licenseId HPND_Fenneberg_Livingston = "HPND-Fenneberg-Livingston" licenseId HPND_INRIA_IMAG = "HPND-INRIA-IMAG" +licenseId HPND_Intel = "HPND-Intel" licenseId HPND_Kevlin_Henney = "HPND-Kevlin-Henney" licenseId HPND_Markus_Kuhn = "HPND-Markus-Kuhn" +licenseId HPND_merchantability_variant = "HPND-merchantability-variant" licenseId HPND_MIT_disclaimer = "HPND-MIT-disclaimer" +licenseId HPND_Netrek = "HPND-Netrek" licenseId HPND_Pbmplus = "HPND-Pbmplus" licenseId HPND_sell_MIT_disclaimer_xserver = "HPND-sell-MIT-disclaimer-xserver" licenseId HPND_sell_regexpr = "HPND-sell-regexpr" +licenseId HPND_sell_variant_MIT_disclaimer_rev = "HPND-sell-variant-MIT-disclaimer-rev" licenseId HPND_sell_variant_MIT_disclaimer = "HPND-sell-variant-MIT-disclaimer" licenseId HPND_sell_variant = "HPND-sell-variant" +licenseId HPND_UC_export_US = "HPND-UC-export-US" licenseId HPND_UC = "HPND-UC" licenseId HPND = "HPND" licenseId HTMLTIDY = "HTMLTIDY" @@ -1106,6 +1152,7 @@ licenseId MIT_CMU = "MIT-CMU" licenseId MIT_enna = "MIT-enna" licenseId MIT_feh = "MIT-feh" licenseId MIT_Festival = "MIT-Festival" +licenseId MIT_Khronos_old = "MIT-Khronos-old" licenseId MIT_Modern_Variant = "MIT-Modern-Variant" licenseId MIT_open_group = "MIT-open-group" licenseId MIT_testregex = "MIT-testregex" @@ -1134,7 +1181,9 @@ licenseId NAIST_2003 = "NAIST-2003" licenseId NASA_1_3 = "NASA-1.3" licenseId Naumen = "Naumen" licenseId NBPL_1_0 = "NBPL-1.0" +licenseId NCBI_PD = "NCBI-PD" licenseId NCGL_UK_2_0 = "NCGL-UK-2.0" +licenseId NCL = "NCL" licenseId NCSA = "NCSA" licenseId Net_SNMP = "Net-SNMP" licenseId NetCDF = "NetCDF" @@ -1157,6 +1206,7 @@ licenseId NRL = "NRL" licenseId NTP_0 = "NTP-0" licenseId NTP = "NTP" licenseId O_UDA_1_0 = "O-UDA-1.0" +licenseId OAR = "OAR" licenseId OCCT_PL = "OCCT-PL" licenseId OCLC_2_0 = "OCLC-2.0" licenseId ODbL_1_0 = "ODbL-1.0" @@ -1213,11 +1263,13 @@ licenseId PDDL_1_0 = "PDDL-1.0" licenseId PHP_3_01 = "PHP-3.01" licenseId PHP_3_0 = "PHP-3.0" licenseId Pixar = "Pixar" +licenseId Pkgconf = "pkgconf" licenseId Plexus = "Plexus" licenseId Pnmstitch = "pnmstitch" licenseId PolyForm_Noncommercial_1_0_0 = "PolyForm-Noncommercial-1.0.0" licenseId PolyForm_Small_Business_1_0_0 = "PolyForm-Small-Business-1.0.0" licenseId PostgreSQL = "PostgreSQL" +licenseId PPL = "PPL" licenseId PSF_2_0 = "PSF-2.0" licenseId Psfrag = "psfrag" licenseId Psutils = "psutils" @@ -1235,6 +1287,7 @@ licenseId RPL_1_5 = "RPL-1.5" licenseId RPSL_1_0 = "RPSL-1.0" licenseId RSA_MD = "RSA-MD" licenseId RSCPL = "RSCPL" +licenseId Ruby_pty = "Ruby-pty" licenseId Ruby = "Ruby" licenseId SAX_PD_2_0 = "SAX-PD-2.0" licenseId SAX_PD = "SAX-PD" @@ -1271,6 +1324,7 @@ licenseId SSH_short = "SSH-short" licenseId SSLeay_standalone = "SSLeay-standalone" licenseId SSPL_1_0 = "SSPL-1.0" licenseId SugarCRM_1_1_3 = "SugarCRM-1.1.3" +licenseId Sun_PPP_2000 = "Sun-PPP-2000" licenseId Sun_PPP = "Sun-PPP" licenseId SunPro = "SunPro" licenseId SWL = "SWL" @@ -1281,6 +1335,7 @@ licenseId TCL = "TCL" licenseId TCP_wrappers = "TCP-wrappers" licenseId TermReadKey = "TermReadKey" licenseId TGPPL_1_0 = "TGPPL-1.0" +licenseId Threeparttable = "threeparttable" licenseId TMate = "TMate" licenseId TORQUE_1_1 = "TORQUE-1.1" licenseId TOSL = "TOSL" @@ -1290,6 +1345,7 @@ licenseId TTWL = "TTWL" licenseId TTYP0 = "TTYP0" licenseId TU_Berlin_1_0 = "TU-Berlin-1.0" licenseId TU_Berlin_2_0 = "TU-Berlin-2.0" +licenseId Ubuntu_font_1_0 = "Ubuntu-font-1.0" licenseId UCAR = "UCAR" licenseId UCL_1_0 = "UCL-1.0" licenseId Ulem = "ulem" @@ -1314,6 +1370,7 @@ licenseId Widget_Workshop = "Widget-Workshop" licenseId Wsuipa = "Wsuipa" licenseId WTFPL = "WTFPL" licenseId X11_distribute_modifications_variant = "X11-distribute-modifications-variant" +licenseId X11_swapped = "X11-swapped" licenseId X11 = "X11" licenseId Xdebug_1_03 = "Xdebug-1.03" licenseId Xerox = "Xerox" @@ -1325,6 +1382,7 @@ licenseId Xlock = "xlock" licenseId Xnet = "Xnet" licenseId Xpp = "xpp" licenseId XSkat = "XSkat" +licenseId Xzoom = "xzoom" licenseId YPL_1_0 = "YPL-1.0" licenseId YPL_1_1 = "YPL-1.1" licenseId Zed = "Zed" @@ -1340,7 +1398,8 @@ licenseId ZPL_2_1 = "ZPL-2.1" -- | License name, e.g. @"GNU General Public License v2.0 only"@ licenseName :: LicenseId -> String -licenseName NullBSD = "BSD Zero Clause License" +licenseName N_0BSD = "BSD Zero Clause License" +licenseName N_3D_Slicer_1_0 = "3D Slicer License v1.0" licenseName AAL = "Attribution Assurance License" licenseName Abstyles = "Abstyles License" licenseName AdaCore_doc = "AdaCore Doc License" @@ -1361,12 +1420,14 @@ licenseName AGPL_1_0_or_later = "Affero General Public License v1.0 or later" licenseName AGPL_3_0_only = "GNU Affero General Public License v3.0 only" licenseName AGPL_3_0_or_later = "GNU Affero General Public License v3.0 or later" licenseName Aladdin = "Aladdin Free Public License" +licenseName AMD_newlib = "AMD newlib License" licenseName AMDPLPA = "AMD's plpa_map.c License" licenseName AML_glslang = "AML glslang variant License" licenseName AML = "Apple MIT License" licenseName AMPAS = "Academy of Motion Picture Arts and Sciences BSD" licenseName ANTLR_PD_fallback = "ANTLR Software Rights Notice with license fallback" licenseName ANTLR_PD = "ANTLR Software Rights Notice" +licenseName Any_OSI = "Any OSI License" licenseName Apache_1_0 = "Apache License 1.0" licenseName Apache_1_1 = "Apache License 1.1" licenseName Apache_2_0 = "Apache License 2.0" @@ -1403,6 +1464,7 @@ licenseName BSD_1_Clause = "BSD 1-Clause License" licenseName BSD_2_Clause_FreeBSD = "BSD 2-Clause FreeBSD License" licenseName BSD_2_Clause_NetBSD = "BSD 2-Clause NetBSD License" licenseName BSD_2_Clause_Darwin = "BSD 2-Clause - Ian Darwin variant" +licenseName BSD_2_Clause_first_lines = "BSD 2-Clause - first lines requirement" licenseName BSD_2_Clause_Patent = "BSD-2-Clause Plus Patent License" licenseName BSD_2_Clause_Views = "BSD 2-Clause with views sentence" licenseName BSD_2_Clause = "BSD 2-Clause \"Simplified\" License" @@ -1442,6 +1504,7 @@ licenseName CAL_1_0_Combined_Work_Exception = "Cryptographic Autonomy License 1. licenseName CAL_1_0 = "Cryptographic Autonomy License 1.0" licenseName Caldera_no_preamble = "Caldera License (without preamble)" licenseName Caldera = "Caldera License" +licenseName Catharon = "Catharon License" licenseName CATOSL_1_1 = "Computer Associates Trusted Open Source License 1.1" licenseName CC_BY_1_0 = "Creative Commons Attribution 1.0 Generic" licenseName CC_BY_2_0 = "Creative Commons Attribution 2.0 Generic" @@ -1538,11 +1601,14 @@ licenseName CrystalStacker = "CrystalStacker License" licenseName CUA_OPL_1_0 = "CUA Office Public License v1.0" licenseName Cube = "Cube License" licenseName Curl = "curl License" +licenseName Cve_tou = "Common Vulnerability Enumeration ToU License" licenseName D_FSL_1_0 = "Deutsche Freie Software Lizenz" licenseName DEC_3_Clause = "DEC 3-Clause License" licenseName Diffmark = "diffmark license" licenseName DL_DE_BY_2_0 = "Data licence Germany \8211 attribution \8211 version 2.0" licenseName DL_DE_ZERO_2_0 = "Data licence Germany \8211 zero \8211 version 2.0" +licenseName DocBook_Schema = "DocBook Schema License" +licenseName DocBook_XML = "DocBook XML License" licenseName DOC = "DOC License" licenseName Dotseqn = "Dotseqn License" licenseName DRL_1_0 = "Detection Rule License 1.0" @@ -1617,26 +1683,35 @@ licenseName GPL_3_0_or_later = "GNU General Public License v3.0 or later" licenseName Graphics_Gems = "Graphics Gems License" licenseName GSOAP_1_3b = "gSOAP Public License v1.3b" licenseName Gtkbook = "gtkbook License" +licenseName Gutmann = "Gutmann License" licenseName HaskellReport = "Haskell Language Report License" licenseName Hdparm = "hdparm License" +licenseName HIDAPI = "HIDAPI License" licenseName Hippocratic_2_1 = "Hippocratic License 2.1" licenseName HP_1986 = "Hewlett-Packard 1986 License" licenseName HP_1989 = "Hewlett-Packard 1989 License" licenseName HPND_DEC = "Historical Permission Notice and Disclaimer - DEC variant" licenseName HPND_doc_sell = "Historical Permission Notice and Disclaimer - documentation sell variant" licenseName HPND_doc = "Historical Permission Notice and Disclaimer - documentation variant" +licenseName HPND_export_US_acknowledgement = "HPND with US Government export control warning and acknowledgment" licenseName HPND_export_US_modify = "HPND with US Government export control warning and modification rqmt" licenseName HPND_export_US = "HPND with US Government export control warning" +licenseName HPND_export2_US = "HPND with US Government export control and 2 disclaimers" licenseName HPND_Fenneberg_Livingston = "Historical Permission Notice and Disclaimer - Fenneberg-Livingston variant" licenseName HPND_INRIA_IMAG = "Historical Permission Notice and Disclaimer - INRIA-IMAG variant" +licenseName HPND_Intel = "Historical Permission Notice and Disclaimer - Intel variant" licenseName HPND_Kevlin_Henney = "Historical Permission Notice and Disclaimer - Kevlin Henney variant" licenseName HPND_Markus_Kuhn = "Historical Permission Notice and Disclaimer - Markus Kuhn variant" +licenseName HPND_merchantability_variant = "Historical Permission Notice and Disclaimer - merchantability variant" licenseName HPND_MIT_disclaimer = "Historical Permission Notice and Disclaimer with MIT disclaimer" +licenseName HPND_Netrek = "Historical Permission Notice and Disclaimer - Netrek variant" licenseName HPND_Pbmplus = "Historical Permission Notice and Disclaimer - Pbmplus variant" licenseName HPND_sell_MIT_disclaimer_xserver = "Historical Permission Notice and Disclaimer - sell xserver variant with MIT disclaimer" licenseName HPND_sell_regexpr = "Historical Permission Notice and Disclaimer - sell regexpr variant" +licenseName HPND_sell_variant_MIT_disclaimer_rev = "HPND sell variant with MIT disclaimer - reverse" licenseName HPND_sell_variant_MIT_disclaimer = "HPND sell variant with MIT disclaimer" licenseName HPND_sell_variant = "Historical Permission Notice and Disclaimer - sell variant" +licenseName HPND_UC_export_US = "Historical Permission Notice and Disclaimer - University of California, US export warning" licenseName HPND_UC = "Historical Permission Notice and Disclaimer - University of California variant" licenseName HPND = "Historical Permission Notice and Disclaimer" licenseName HTMLTIDY = "HTML Tidy License" @@ -1719,6 +1794,7 @@ licenseName MIT_CMU = "CMU License" licenseName MIT_enna = "enna License" licenseName MIT_feh = "feh License" licenseName MIT_Festival = "MIT Festival Variant" +licenseName MIT_Khronos_old = "MIT Khronos - old variant" licenseName MIT_Modern_Variant = "MIT License Modern Variant" licenseName MIT_open_group = "MIT Open Group variant" licenseName MIT_testregex = "MIT testregex Variant" @@ -1747,7 +1823,9 @@ licenseName NAIST_2003 = "Nara Institute of Science and Technology License (2003 licenseName NASA_1_3 = "NASA Open Source Agreement 1.3" licenseName Naumen = "Naumen Public License" licenseName NBPL_1_0 = "Net Boolean Public License v1" +licenseName NCBI_PD = "NCBI Public Domain Notice" licenseName NCGL_UK_2_0 = "Non-Commercial Government Licence" +licenseName NCL = "NCL Source Code License" licenseName NCSA = "University of Illinois/NCSA Open Source License" licenseName Net_SNMP = "Net-SNMP License" licenseName NetCDF = "NetCDF license" @@ -1770,6 +1848,7 @@ licenseName NRL = "NRL License" licenseName NTP_0 = "NTP No Attribution" licenseName NTP = "NTP License" licenseName O_UDA_1_0 = "Open Use of Data Agreement v1.0" +licenseName OAR = "OAR License" licenseName OCCT_PL = "Open CASCADE Technology Public License" licenseName OCLC_2_0 = "OCLC Research Public License 2.0" licenseName ODbL_1_0 = "Open Data Commons Open Database License v1.0" @@ -1826,11 +1905,13 @@ licenseName PDDL_1_0 = "Open Data Commons Public Domain Dedication & License 1.0 licenseName PHP_3_01 = "PHP License v3.01" licenseName PHP_3_0 = "PHP License v3.0" licenseName Pixar = "Pixar License" +licenseName Pkgconf = "pkgconf License" licenseName Plexus = "Plexus Classworlds License" licenseName Pnmstitch = "pnmstitch License" licenseName PolyForm_Noncommercial_1_0_0 = "PolyForm Noncommercial License 1.0.0" licenseName PolyForm_Small_Business_1_0_0 = "PolyForm Small Business License 1.0.0" licenseName PostgreSQL = "PostgreSQL License" +licenseName PPL = "Peer Production License" licenseName PSF_2_0 = "Python Software Foundation License 2.0" licenseName Psfrag = "psfrag License" licenseName Psutils = "psutils License" @@ -1848,6 +1929,7 @@ licenseName RPL_1_5 = "Reciprocal Public License 1.5" licenseName RPSL_1_0 = "RealNetworks Public Source License v1.0" licenseName RSA_MD = "RSA Message-Digest License" licenseName RSCPL = "Ricoh Source Code Public License" +licenseName Ruby_pty = "Ruby pty extension license" licenseName Ruby = "Ruby License" licenseName SAX_PD_2_0 = "Sax Public Domain Notice 2.0" licenseName SAX_PD = "Sax Public Domain Notice" @@ -1884,6 +1966,7 @@ licenseName SSH_short = "SSH short notice" licenseName SSLeay_standalone = "SSLeay License - standalone" licenseName SSPL_1_0 = "Server Side Public License, v 1" licenseName SugarCRM_1_1_3 = "SugarCRM Public License v1.1.3" +licenseName Sun_PPP_2000 = "Sun PPP License (2000)" licenseName Sun_PPP = "Sun PPP License" licenseName SunPro = "SunPro License" licenseName SWL = "Scheme Widget Library (SWL) Software License Agreement" @@ -1894,6 +1977,7 @@ licenseName TCL = "TCL/TK License" licenseName TCP_wrappers = "TCP Wrappers License" licenseName TermReadKey = "TermReadKey License" licenseName TGPPL_1_0 = "Transitive Grace Period Public Licence 1.0" +licenseName Threeparttable = "threeparttable License" licenseName TMate = "TMate Open Source License" licenseName TORQUE_1_1 = "TORQUE v2.5+ Software License v1.1" licenseName TOSL = "Trusster Open Source License" @@ -1903,6 +1987,7 @@ licenseName TTWL = "Text-Tabs+Wrap License" licenseName TTYP0 = "TTYP0 License" licenseName TU_Berlin_1_0 = "Technische Universitaet Berlin License 1.0" licenseName TU_Berlin_2_0 = "Technische Universitaet Berlin License 2.0" +licenseName Ubuntu_font_1_0 = "Ubuntu Font Licence v1.0" licenseName UCAR = "UCAR License" licenseName UCL_1_0 = "Upstream Compatibility License v1.0" licenseName Ulem = "ulem License" @@ -1927,6 +2012,7 @@ licenseName Widget_Workshop = "Widget Workshop License" licenseName Wsuipa = "Wsuipa License" licenseName WTFPL = "Do What The F*ck You Want To Public License" licenseName X11_distribute_modifications_variant = "X11 License Distribution Modification Variant" +licenseName X11_swapped = "X11 swapped final paragraphs" licenseName X11 = "X11 License" licenseName Xdebug_1_03 = "Xdebug License v 1.03" licenseName Xerox = "Xerox License" @@ -1938,6 +2024,7 @@ licenseName Xlock = "xlock License" licenseName Xnet = "X.Net License" licenseName Xpp = "XPP License" licenseName XSkat = "XSkat License" +licenseName Xzoom = "xzoom License" licenseName YPL_1_0 = "Yahoo! Public License v1.0" licenseName YPL_1_1 = "Yahoo! Public License v1.1" licenseName Zed = "Zed License" @@ -1955,7 +2042,7 @@ licenseName ZPL_2_1 = "Zope Public License 2.1" -- -- See . licenseIsOsiApproved :: LicenseId -> Bool -licenseIsOsiApproved NullBSD = True +licenseIsOsiApproved N_0BSD = True licenseIsOsiApproved AAL = True licenseIsOsiApproved AFL_1_1 = True licenseIsOsiApproved AFL_1_2 = True @@ -2080,6 +2167,7 @@ licenseIsOsiApproved Unicode_DFS_2016 = True licenseIsOsiApproved Unlicense = True licenseIsOsiApproved UPL_1_0 = True licenseIsOsiApproved VSL_1_0 = True +licenseIsOsiApproved W3C_20150513 = True licenseIsOsiApproved W3C = True licenseIsOsiApproved Watcom_1_0 = True licenseIsOsiApproved Xnet = True @@ -2218,6 +2306,7 @@ licenseIdList LicenseListVersion_3_0 = , BSD_2_Clause_FreeBSD , BSD_2_Clause_NetBSD , Bzip2_1_0_5 + , Net_SNMP ] ++ bulkOfLicenses licenseIdList LicenseListVersion_3_2 = @@ -2228,6 +2317,7 @@ licenseIdList LicenseListVersion_3_2 = , Bzip2_1_0_5 , Linux_OpenIB , MIT_0 + , Net_SNMP , ODC_By_1_0 , TU_Berlin_1_0 , TU_Berlin_2_0 @@ -2252,6 +2342,7 @@ licenseIdList LicenseListVersion_3_6 = , Libpng_2_0 , Linux_OpenIB , MIT_0 + , Net_SNMP , ODC_By_1_0 , OGL_UK_1_0 , OGL_UK_2_0 @@ -2295,6 +2386,7 @@ licenseIdList LicenseListVersion_3_9 = , MulanPSL_1_0 , MulanPSL_2_0 , NCGL_UK_2_0 + , Net_SNMP , NTP_0 , O_UDA_1_0 , ODC_By_1_0 @@ -2370,6 +2462,7 @@ licenseIdList LicenseListVersion_3_10 = , MulanPSL_1_0 , MulanPSL_2_0 , NCGL_UK_2_0 + , Net_SNMP , NIST_PD_fallback , NIST_PD , NTP_0 @@ -2483,6 +2576,7 @@ licenseIdList LicenseListVersion_3_16 = , MulanPSL_2_0 , NAIST_2003 , NCGL_UK_2_0 + , Net_SNMP , NIST_PD_fallback , NIST_PD , NLOD_2_0 @@ -2707,6 +2801,298 @@ licenseIdList LicenseListVersion_3_23 = , MulanPSL_2_0 , NAIST_2003 , NCGL_UK_2_0 + , Net_SNMP + , NICTA_1_0 + , NIST_PD_fallback + , NIST_PD + , NIST_Software + , NLOD_2_0 + , NTP_0 + , O_UDA_1_0 + , ODC_By_1_0 + , OFFIS + , OFL_1_0_no_RFN + , OFL_1_0_RFN + , OFL_1_1_no_RFN + , OFL_1_1_RFN + , OGC_1_0 + , OGDL_Taiwan_1_0 + , OGL_Canada_2_0 + , OGL_UK_1_0 + , OGL_UK_2_0 + , OGL_UK_3_0 + , OLFL_1_3 + , OpenPBS_2_3 + , OpenSSL_standalone + , OpenVision + , OPL_UK_3_0 + , OPUBL_1_0 + , PADL + , Parity_6_0_0 + , Parity_7_0_0 + , Pixar + , Pnmstitch + , PolyForm_Noncommercial_1_0_0 + , PolyForm_Small_Business_1_0_0 + , PSF_2_0 + , Python_2_0_1 + , Python_ldap + , QPL_1_0_INRIA_2004 + , Radvd + , SAX_PD_2_0 + , SchemeReport + , Sendmail_8_23 + , SGI_OpenGL + , SGP4 + , SHL_0_51 + , SHL_0_5 + , SL + , Snprintf + , SoftSurfer + , Soundex + , Ssh_keyscan + , SSH_OpenSSH + , SSH_short + , SSLeay_standalone + , SSPL_1_0 + , Sun_PPP + , SunPro + , Swrule + , Symlinks + , TAPR_OHL_1_0 + , TermReadKey + , TGPPL_1_0 + , TPDL + , TPL_1_0 + , TTWL + , TTYP0 + , TU_Berlin_1_0 + , TU_Berlin_2_0 + , UCAR + , UCL_1_0 + , Ulem + , UMich_Merit + , Unicode_3_0 + , UnixCrypt + , URT_RLE + , W3m + , Widget_Workshop + , X11_distribute_modifications_variant + , Xdebug_1_03 + , Xfig + , Xkeyboard_config_Zinoviev + , Xlock + , Zeeff + ] + ++ bulkOfLicenses +licenseIdList LicenseListVersion_3_25 = + [ N_3D_Slicer_1_0 + , AdaCore_doc + , Adobe_Display_PostScript + , Adobe_Utopia + , AGPL_1_0_only + , AGPL_1_0_or_later + , AMD_newlib + , AML_glslang + , ANTLR_PD_fallback + , Any_OSI + , App_s2p + , Arphic_1999 + , ASWF_Digital_Assets_1_0 + , ASWF_Digital_Assets_1_1 + , Baekmuk + , Bcrypt_Solar_Designer + , Bitstream_Charter + , Bitstream_Vera + , Blessing + , BlueOak_1_0_0 + , Boehm_GC + , Brian_Gladman_2_Clause + , Brian_Gladman_3_Clause + , BSD_2_Clause_Darwin + , BSD_2_Clause_first_lines + , BSD_2_Clause_Views + , BSD_3_Clause_acpica + , BSD_3_Clause_flex + , BSD_3_Clause_HP + , BSD_3_Clause_Modification + , BSD_3_Clause_No_Military_License + , BSD_3_Clause_Open_MPI + , BSD_3_Clause_Sun + , BSD_4_Clause_Shortened + , BSD_4_3RENO + , BSD_4_3TAHOE + , BSD_Advertising_Acknowledgement + , BSD_Attribution_HPND_disclaimer + , BSD_Inferno_Nettverk + , BSD_Source_beginning_file + , BSD_Systemics_W3Works + , BSD_Systemics + , BUSL_1_1 + , C_UDA_1_0 + , CAL_1_0_Combined_Work_Exception + , CAL_1_0 + , Caldera_no_preamble + , Catharon + , CC_BY_2_5_AU + , CC_BY_3_0_AT + , CC_BY_3_0_AU + , CC_BY_3_0_DE + , CC_BY_3_0_IGO + , CC_BY_3_0_NL + , CC_BY_3_0_US + , CC_BY_NC_3_0_DE + , CC_BY_NC_ND_3_0_DE + , CC_BY_NC_ND_3_0_IGO + , CC_BY_NC_SA_2_0_DE + , CC_BY_NC_SA_2_0_FR + , CC_BY_NC_SA_2_0_UK + , CC_BY_NC_SA_3_0_DE + , CC_BY_NC_SA_3_0_IGO + , CC_BY_ND_3_0_DE + , CC_BY_SA_2_0_UK + , CC_BY_SA_2_1_JP + , CC_BY_SA_3_0_AT + , CC_BY_SA_3_0_DE + , CC_BY_SA_3_0_IGO + , CC_PDDC + , CDL_1_0 + , CDLA_Permissive_2_0 + , CERN_OHL_1_1 + , CERN_OHL_1_2 + , CERN_OHL_P_2_0 + , CERN_OHL_S_2_0 + , CERN_OHL_W_2_0 + , CFITSIO + , Check_cvs + , Checkmk + , Clips + , CMU_Mach_nodoc + , CMU_Mach + , COIL_1_0 + , Community_Spec_1_0 + , Copyleft_next_0_3_0 + , Copyleft_next_0_3_1 + , Cornell_Lossless_JPEG + , Cronyx + , Cve_tou + , DEC_3_Clause + , DL_DE_BY_2_0 + , DL_DE_ZERO_2_0 + , DocBook_Schema + , DocBook_XML + , DRL_1_0 + , DRL_1_1 + , Dtoa + , Elastic_2_0 + , EPICS + , Etalab_2_0 + , FBM + , FDK_AAC + , Ferguson_Twofish + , FreeBSD_DOC + , FSFAP_no_warranty_disclaimer + , FSFULLRWD + , Furuseth + , Fwlw + , GCR_docs + , GD + , GFDL_1_1_invariants_only + , GFDL_1_1_invariants_or_later + , GFDL_1_1_no_invariants_only + , GFDL_1_1_no_invariants_or_later + , GFDL_1_2_invariants_only + , GFDL_1_2_invariants_or_later + , GFDL_1_2_no_invariants_only + , GFDL_1_2_no_invariants_or_later + , GFDL_1_3_invariants_only + , GFDL_1_3_invariants_or_later + , GFDL_1_3_no_invariants_only + , GFDL_1_3_no_invariants_or_later + , GLWTPL + , Graphics_Gems + , Gtkbook + , Gutmann + , Hdparm + , HIDAPI + , Hippocratic_2_1 + , HP_1986 + , HP_1989 + , HPND_DEC + , HPND_doc_sell + , HPND_doc + , HPND_export_US_acknowledgement + , HPND_export_US_modify + , HPND_export_US + , HPND_export2_US + , HPND_Fenneberg_Livingston + , HPND_INRIA_IMAG + , HPND_Intel + , HPND_Kevlin_Henney + , HPND_Markus_Kuhn + , HPND_merchantability_variant + , HPND_MIT_disclaimer + , HPND_Netrek + , HPND_Pbmplus + , HPND_sell_MIT_disclaimer_xserver + , HPND_sell_regexpr + , HPND_sell_variant_MIT_disclaimer_rev + , HPND_sell_variant_MIT_disclaimer + , HPND_sell_variant + , HPND_UC_export_US + , HPND_UC + , HTMLTIDY + , IEC_Code_Components_EULA + , IJG_short + , Inner_Net_2_0 + , ISC_Veillard + , Jam + , JPL_image + , JPNIC + , Kastrup + , Kazlib + , Knuth_CTAN + , Latex2e_translated_notice + , Libpng_2_0 + , Libselinux_1_0 + , Libutil_David_Nugent + , Linux_man_pages_1_para + , Linux_man_pages_copyleft_2_para + , Linux_man_pages_copyleft_var + , Linux_man_pages_copyleft + , Linux_OpenIB + , LOOP + , LPD_document + , Lsof + , Lucida_Bitmap_Fonts + , LZMA_SDK_9_11_to_9_20 + , LZMA_SDK_9_22 + , Mackerras_3_Clause_acknowledgment + , Mackerras_3_Clause + , Magaz + , Mailprio + , Martin_Birgmeier + , McPhee_slideshow + , Metamail + , Minpack + , MIT_0 + , MIT_Festival + , MIT_Khronos_old + , MIT_Modern_Variant + , MIT_open_group + , MIT_testregex + , MIT_Wu + , MMIXware + , MPEG_SSG + , Mpi_permissive + , Mplus + , MS_LPL + , MulanPSL_1_0 + , MulanPSL_2_0 + , NAIST_2003 + , NCBI_PD + , NCGL_UK_2_0 + , NCL , NICTA_1_0 , NIST_PD_fallback , NIST_PD @@ -2714,6 +3100,7 @@ licenseIdList LicenseListVersion_3_23 = , NLOD_2_0 , NTP_0 , O_UDA_1_0 + , OAR , ODC_By_1_0 , OFFIS , OFL_1_0_no_RFN @@ -2736,14 +3123,17 @@ licenseIdList LicenseListVersion_3_23 = , Parity_6_0_0 , Parity_7_0_0 , Pixar + , Pkgconf , Pnmstitch , PolyForm_Noncommercial_1_0_0 , PolyForm_Small_Business_1_0_0 + , PPL , PSF_2_0 , Python_2_0_1 , Python_ldap , QPL_1_0_INRIA_2004 , Radvd + , Ruby_pty , SAX_PD_2_0 , SchemeReport , Sendmail_8_23 @@ -2760,6 +3150,7 @@ licenseIdList LicenseListVersion_3_23 = , SSH_short , SSLeay_standalone , SSPL_1_0 + , Sun_PPP_2000 , Sun_PPP , SunPro , Swrule @@ -2767,12 +3158,14 @@ licenseIdList LicenseListVersion_3_23 = , TAPR_OHL_1_0 , TermReadKey , TGPPL_1_0 + , Threeparttable , TPDL , TPL_1_0 , TTWL , TTYP0 , TU_Berlin_1_0 , TU_Berlin_2_0 + , Ubuntu_font_1_0 , UCAR , UCL_1_0 , Ulem @@ -2783,10 +3176,12 @@ licenseIdList LicenseListVersion_3_23 = , W3m , Widget_Workshop , X11_distribute_modifications_variant + , X11_swapped , Xdebug_1_03 , Xfig , Xkeyboard_config_Zinoviev , Xlock + , Xzoom , Zeeff ] ++ bulkOfLicenses @@ -2800,6 +3195,7 @@ mkLicenseId LicenseListVersion_3_9 s = Map.lookup s stringLookup_3_9 mkLicenseId LicenseListVersion_3_10 s = Map.lookup s stringLookup_3_10 mkLicenseId LicenseListVersion_3_16 s = Map.lookup s stringLookup_3_16 mkLicenseId LicenseListVersion_3_23 s = Map.lookup s stringLookup_3_23 +mkLicenseId LicenseListVersion_3_25 s = Map.lookup s stringLookup_3_25 stringLookup_3_0 :: Map String LicenseId stringLookup_3_0 = Map.fromList $ map (\i -> (licenseId i, i)) $ @@ -2829,10 +3225,14 @@ stringLookup_3_23 :: Map String LicenseId stringLookup_3_23 = Map.fromList $ map (\i -> (licenseId i, i)) $ licenseIdList LicenseListVersion_3_23 +stringLookup_3_25 :: Map String LicenseId +stringLookup_3_25 = Map.fromList $ map (\i -> (licenseId i, i)) $ + licenseIdList LicenseListVersion_3_25 + -- | Licenses in all SPDX License lists bulkOfLicenses :: [LicenseId] bulkOfLicenses = - [ NullBSD + [ N_0BSD , AAL , Abstyles , Adobe_2006 @@ -3050,7 +3450,6 @@ bulkOfLicenses = , Naumen , NBPL_1_0 , NCSA - , Net_SNMP , NetCDF , Newsletr , NGPL diff --git a/Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs b/Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs index 88280ca56f9..cf12323d275 100644 --- a/Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs +++ b/Cabal-syntax/src/Distribution/SPDX/LicenseListVersion.hs @@ -14,10 +14,11 @@ data LicenseListVersion | LicenseListVersion_3_10 | LicenseListVersion_3_16 | LicenseListVersion_3_23 + | LicenseListVersion_3_25 deriving (Eq, Ord, Show, Enum, Bounded) cabalSpecVersionToSPDXListVersion :: CabalSpecVersion -> LicenseListVersion -cabalSpecVersionToSPDXListVersion CabalSpecV3_14 = LicenseListVersion_3_23 +cabalSpecVersionToSPDXListVersion CabalSpecV3_14 = LicenseListVersion_3_25 cabalSpecVersionToSPDXListVersion CabalSpecV3_12 = LicenseListVersion_3_23 cabalSpecVersionToSPDXListVersion CabalSpecV3_8 = LicenseListVersion_3_16 cabalSpecVersionToSPDXListVersion CabalSpecV3_6 = LicenseListVersion_3_10 diff --git a/Cabal-syntax/src/Distribution/SPDX/LicenseReference.hs b/Cabal-syntax/src/Distribution/SPDX/LicenseReference.hs index 949d6c4d15d..38f83432692 100644 --- a/Cabal-syntax/src/Distribution/SPDX/LicenseReference.hs +++ b/Cabal-syntax/src/Distribution/SPDX/LicenseReference.hs @@ -24,7 +24,7 @@ data LicenseRef = LicenseRef { _lrDocument :: !(Maybe String) , _lrLicense :: !String } - deriving (Show, Read, Eq, Ord, Typeable, Data, Generic) + deriving (Show, Read, Eq, Ord, Data, Generic) -- | License reference. licenseRef :: LicenseRef -> String diff --git a/Cabal-syntax/src/Distribution/System.hs b/Cabal-syntax/src/Distribution/System.hs index e1e75aa2315..1903ae40fc8 100644 --- a/Cabal-syntax/src/Distribution/System.hs +++ b/Cabal-syntax/src/Distribution/System.hs @@ -46,10 +46,6 @@ import Control.Applicative (Applicative (..)) import Distribution.Compat.Prelude hiding (Applicative (..)) import Prelude () -#if !MIN_VERSION_base(4,10,0) -import Control.Applicative (liftA2) -#endif - import Distribution.Utils.Generic (lowercase) import qualified System.Info (arch, os) @@ -114,7 +110,7 @@ data OS | Wasi | Haiku | OtherOS String - deriving (Eq, Generic, Ord, Show, Read, Typeable, Data) + deriving (Eq, Generic, Ord, Show, Read, Data) instance Binary OS instance Structured OS @@ -217,7 +213,7 @@ data Arch | JavaScript | Wasm32 | OtherArch String - deriving (Eq, Generic, Ord, Show, Read, Typeable, Data) + deriving (Eq, Generic, Ord, Show, Read, Data) instance Binary Arch instance Structured Arch @@ -288,7 +284,7 @@ buildArch = classifyArch Permissive System.Info.arch -- ------------------------------------------------------------ data Platform = Platform Arch OS - deriving (Eq, Generic, Ord, Show, Read, Typeable, Data) + deriving (Eq, Generic, Ord, Show, Read, Data) instance Binary Platform instance Structured Platform diff --git a/Cabal-syntax/src/Distribution/Types/AbiDependency.hs b/Cabal-syntax/src/Distribution/Types/AbiDependency.hs index 2f380d15af2..54871978605 100644 --- a/Cabal-syntax/src/Distribution/Types/AbiDependency.hs +++ b/Cabal-syntax/src/Distribution/Types/AbiDependency.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Types.AbiDependency where @@ -27,7 +26,7 @@ data AbiDependency = AbiDependency { depUnitId :: Package.UnitId , depAbiHash :: Package.AbiHash } - deriving (Eq, Generic, Read, Show, Typeable) + deriving (Eq, Generic, Read, Show) instance Pretty AbiDependency where pretty (AbiDependency uid abi) = diff --git a/Cabal-syntax/src/Distribution/Types/AbiHash.hs b/Cabal-syntax/src/Distribution/Types/AbiHash.hs index a1be416c4ba..0fa8f03cfd8 100644 --- a/Cabal-syntax/src/Distribution/Types/AbiHash.hs +++ b/Cabal-syntax/src/Distribution/Types/AbiHash.hs @@ -1,6 +1,4 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Distribution.Types.AbiHash ( AbiHash @@ -27,7 +25,7 @@ import Text.PrettyPrint (text) -- -- @since 2.0.0.2 newtype AbiHash = AbiHash ShortText - deriving (Eq, Show, Read, Generic, Typeable) + deriving (Eq, Show, Read, Generic) -- | Convert 'AbiHash' to 'String' -- diff --git a/Cabal-syntax/src/Distribution/Types/Benchmark.hs b/Cabal-syntax/src/Distribution/Types/Benchmark.hs index 13e5fe104e5..6da7ef9dcae 100644 --- a/Cabal-syntax/src/Distribution/Types/Benchmark.hs +++ b/Cabal-syntax/src/Distribution/Types/Benchmark.hs @@ -27,7 +27,7 @@ data Benchmark = Benchmark , benchmarkInterface :: BenchmarkInterface , benchmarkBuildInfo :: BuildInfo } - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Binary Benchmark instance Structured Benchmark diff --git a/Cabal-syntax/src/Distribution/Types/BenchmarkInterface.hs b/Cabal-syntax/src/Distribution/Types/BenchmarkInterface.hs index 02b20864479..d963404a91e 100644 --- a/Cabal-syntax/src/Distribution/Types/BenchmarkInterface.hs +++ b/Cabal-syntax/src/Distribution/Types/BenchmarkInterface.hs @@ -27,7 +27,7 @@ data BenchmarkInterface | -- | A benchmark that does not conform to one of the above -- interfaces for the given reason (e.g. unknown benchmark type). BenchmarkUnsupported BenchmarkType - deriving (Eq, Ord, Generic, Read, Show, Typeable, Data) + deriving (Eq, Ord, Generic, Read, Show, Data) instance Binary BenchmarkInterface instance Structured BenchmarkInterface diff --git a/Cabal-syntax/src/Distribution/Types/BenchmarkType.hs b/Cabal-syntax/src/Distribution/Types/BenchmarkType.hs index 9dd3fad3ff9..56fc49e1b63 100644 --- a/Cabal-syntax/src/Distribution/Types/BenchmarkType.hs +++ b/Cabal-syntax/src/Distribution/Types/BenchmarkType.hs @@ -22,7 +22,7 @@ data BenchmarkType BenchmarkTypeExe Version | -- | Some unknown benchmark type e.g. \"type: foo\" BenchmarkTypeUnknown String Version - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Binary BenchmarkType instance Structured BenchmarkType diff --git a/Cabal-syntax/src/Distribution/Types/BuildInfo.hs b/Cabal-syntax/src/Distribution/Types/BuildInfo.hs index da1f8aea88f..2d7a5edeae1 100644 --- a/Cabal-syntax/src/Distribution/Types/BuildInfo.hs +++ b/Cabal-syntax/src/Distribution/Types/BuildInfo.hs @@ -12,6 +12,7 @@ module Distribution.Types.BuildInfo , hcOptions , hcProfOptions , hcSharedOptions + , hcProfSharedOptions , hcStaticOptions ) where @@ -133,6 +134,7 @@ data BuildInfo = BuildInfo , options :: PerCompilerFlavor [String] , profOptions :: PerCompilerFlavor [String] , sharedOptions :: PerCompilerFlavor [String] + , profSharedOptions :: PerCompilerFlavor [String] , staticOptions :: PerCompilerFlavor [String] , customFieldsBI :: [(String, String)] -- ^ Custom fields starting @@ -142,7 +144,7 @@ data BuildInfo = BuildInfo -- ^ Dependencies specific to a library or executable target , mixins :: [Mixin] } - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Binary BuildInfo instance Structured BuildInfo @@ -193,6 +195,7 @@ instance Monoid BuildInfo where , options = mempty , profOptions = mempty , sharedOptions = mempty + , profSharedOptions = mempty , staticOptions = mempty , customFieldsBI = [] , targetBuildDepends = [] @@ -245,6 +248,7 @@ instance Semigroup BuildInfo where , options = combine options , profOptions = combine profOptions , sharedOptions = combine sharedOptions + , profSharedOptions = combine profSharedOptions , staticOptions = combine staticOptions , customFieldsBI = combine customFieldsBI , targetBuildDepends = combineNub targetBuildDepends @@ -295,6 +299,9 @@ hcProfOptions = lookupHcOptions profOptions hcSharedOptions :: CompilerFlavor -> BuildInfo -> [String] hcSharedOptions = lookupHcOptions sharedOptions +hcProfSharedOptions :: CompilerFlavor -> BuildInfo -> [String] +hcProfSharedOptions = lookupHcOptions profSharedOptions + hcStaticOptions :: CompilerFlavor -> BuildInfo -> [String] hcStaticOptions = lookupHcOptions staticOptions diff --git a/Cabal-syntax/src/Distribution/Types/BuildInfo/Lens.hs b/Cabal-syntax/src/Distribution/Types/BuildInfo/Lens.hs index 19453a671b9..ac99f3c65a5 100644 --- a/Cabal-syntax/src/Distribution/Types/BuildInfo/Lens.hs +++ b/Cabal-syntax/src/Distribution/Types/BuildInfo/Lens.hs @@ -195,6 +195,10 @@ class HasBuildInfo a where sharedOptions = buildInfo . sharedOptions {-# INLINE sharedOptions #-} + profSharedOptions :: Lens' a (PerCompilerFlavor [String]) + profSharedOptions = buildInfo . profSharedOptions + {-# INLINE profSharedOptions #-} + staticOptions :: Lens' a (PerCompilerFlavor [String]) staticOptions = buildInfo . staticOptions {-# INLINE staticOptions #-} @@ -341,6 +345,9 @@ instance HasBuildInfo BuildInfo where sharedOptions f s = fmap (\x -> s{T.sharedOptions = x}) (f (T.sharedOptions s)) {-# INLINE sharedOptions #-} + profSharedOptions f s = fmap (\x -> s{T.profSharedOptions = x}) (f (T.profSharedOptions s)) + {-# INLINE profSharedOptions #-} + staticOptions f s = fmap (\x -> s{T.staticOptions = x}) (f (T.staticOptions s)) {-# INLINE staticOptions #-} diff --git a/Cabal-syntax/src/Distribution/Types/BuildType.hs b/Cabal-syntax/src/Distribution/Types/BuildType.hs index b94279eaf2e..eba66ec5d1d 100644 --- a/Cabal-syntax/src/Distribution/Types/BuildType.hs +++ b/Cabal-syntax/src/Distribution/Types/BuildType.hs @@ -30,7 +30,7 @@ data BuildType | -- | uses user-supplied @Setup.hs@ or @Setup.lhs@ (default) Custom | Hooks - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Binary BuildType instance Structured BuildType diff --git a/Cabal-syntax/src/Distribution/Types/ComponentId.hs b/Cabal-syntax/src/Distribution/Types/ComponentId.hs index 47cf1d97ee3..fa770448363 100644 --- a/Cabal-syntax/src/Distribution/Types/ComponentId.hs +++ b/Cabal-syntax/src/Distribution/Types/ComponentId.hs @@ -1,6 +1,5 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Distribution.Types.ComponentId ( ComponentId @@ -32,7 +31,7 @@ import Text.PrettyPrint (text) -- -- @since 2.0.0.2 newtype ComponentId = ComponentId ShortText - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) -- | Construct a 'ComponentId' from a 'String' -- diff --git a/Cabal-syntax/src/Distribution/Types/ComponentName.hs b/Cabal-syntax/src/Distribution/Types/ComponentName.hs index 01ed6f7655f..b66a5a03867 100644 --- a/Cabal-syntax/src/Distribution/Types/ComponentName.hs +++ b/Cabal-syntax/src/Distribution/Types/ComponentName.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE PatternSynonyms #-} @@ -25,14 +24,14 @@ import qualified Text.PrettyPrint as Disp data ComponentName = CLibName LibraryName | CNotLibName NotLibComponentName - deriving (Eq, Generic, Ord, Read, Show, Typeable) + deriving (Eq, Generic, Ord, Read, Show) data NotLibComponentName = CNLFLibName {toCompName :: UnqualComponentName} | CNLExeName {toCompName :: UnqualComponentName} | CNLTestName {toCompName :: UnqualComponentName} | CNLBenchName {toCompName :: UnqualComponentName} - deriving (Eq, Generic, Ord, Read, Show, Typeable) + deriving (Eq, Generic, Ord, Read, Show) pattern CFLibName :: UnqualComponentName -> ComponentName pattern CFLibName n = CNotLibName (CNLFLibName n) diff --git a/Cabal-syntax/src/Distribution/Types/ComponentRequestedSpec.hs b/Cabal-syntax/src/Distribution/Types/ComponentRequestedSpec.hs index 224b38c839d..3adcb7ea1da 100644 --- a/Cabal-syntax/src/Distribution/Types/ComponentRequestedSpec.hs +++ b/Cabal-syntax/src/Distribution/Types/ComponentRequestedSpec.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Types.ComponentRequestedSpec @@ -67,7 +66,7 @@ data ComponentRequestedSpec , benchmarksRequested :: Bool } | OneComponentRequestedSpec ComponentName - deriving (Generic, Read, Show, Eq, Typeable) + deriving (Generic, Read, Show, Eq) instance Binary ComponentRequestedSpec instance Structured ComponentRequestedSpec diff --git a/Cabal-syntax/src/Distribution/Types/CondTree.hs b/Cabal-syntax/src/Distribution/Types/CondTree.hs index 08a4d691faf..c74ffdf6395 100644 --- a/Cabal-syntax/src/Distribution/Types/CondTree.hs +++ b/Cabal-syntax/src/Distribution/Types/CondTree.hs @@ -1,6 +1,4 @@ {-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -61,7 +59,7 @@ data CondTree v c a = CondNode , condTreeConstraints :: c , condTreeComponents :: [CondBranch v c a] } - deriving (Show, Eq, Typeable, Data, Generic, Functor, Foldable, Traversable) + deriving (Show, Eq, Data, Generic, Functor, Foldable, Traversable) instance (Binary v, Binary c, Binary a) => Binary (CondTree v c a) instance (Structured v, Structured c, Structured a) => Structured (CondTree v c a) @@ -82,7 +80,7 @@ data CondBranch v c a = CondBranch , condBranchIfTrue :: CondTree v c a , condBranchIfFalse :: Maybe (CondTree v c a) } - deriving (Show, Eq, Typeable, Data, Generic, Functor, Traversable) + deriving (Show, Eq, Data, Generic, Functor, Traversable) -- This instance is written by hand because GHC 8.0.1/8.0.2 infinite -- loops when trying to derive it with optimizations. See diff --git a/Cabal-syntax/src/Distribution/Types/Condition.hs b/Cabal-syntax/src/Distribution/Types/Condition.hs index 114c25afa66..b7bcead95ac 100644 --- a/Cabal-syntax/src/Distribution/Types/Condition.hs +++ b/Cabal-syntax/src/Distribution/Types/Condition.hs @@ -19,7 +19,7 @@ data Condition c | CNot (Condition c) | COr (Condition c) (Condition c) | CAnd (Condition c) (Condition c) - deriving (Show, Eq, Typeable, Data, Generic) + deriving (Show, Eq, Data, Generic) -- | Boolean negation of a 'Condition' value. cNot :: Condition a -> Condition a diff --git a/Cabal-syntax/src/Distribution/Types/ConfVar.hs b/Cabal-syntax/src/Distribution/Types/ConfVar.hs index 220a6556fbd..bea2d21db52 100644 --- a/Cabal-syntax/src/Distribution/Types/ConfVar.hs +++ b/Cabal-syntax/src/Distribution/Types/ConfVar.hs @@ -19,7 +19,7 @@ data ConfVar | Arch Arch | PackageFlag FlagName | Impl CompilerFlavor VersionRange - deriving (Eq, Show, Typeable, Data, Generic) + deriving (Eq, Show, Data, Generic) instance Binary ConfVar instance Structured ConfVar diff --git a/Cabal-syntax/src/Distribution/Types/Dependency.hs b/Cabal-syntax/src/Distribution/Types/Dependency.hs index 10d0506b57e..d0d5627002b 100644 --- a/Cabal-syntax/src/Distribution/Types/Dependency.hs +++ b/Cabal-syntax/src/Distribution/Types/Dependency.hs @@ -33,10 +33,6 @@ import qualified Text.PrettyPrint as PP -- -- /Invariant:/ package name does not appear as 'LSubLibName' in -- set of library names. --- --- /Note:/ 'Dependency' is not an instance of 'Ord', and so it cannot be used --- in 'Set' or as the key to a 'Map'. For these and similar use cases see --- 'DependencyMap'. data Dependency = -- | The set of libraries required from the package. -- Only the selected libraries will be built. @@ -45,7 +41,7 @@ data Dependency PackageName VersionRange (NonEmptySet LibraryName) - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) depPkgName :: Dependency -> PackageName depPkgName (Dependency pn _ _) = pn @@ -82,31 +78,21 @@ instance NFData Dependency where rnf = genericRnf -- "pkg" -- -- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib") mainLibSet --- "pkg:{pkg, sublib}" +-- "pkg:{pkg,sublib}" -- -- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib") -- "pkg:sublib" -- -- >>> prettyShow $ Dependency (mkPackageName "pkg") anyVersion $ NES.insert (LSubLibName $ mkUnqualComponentName "sublib-b") $ NES.singleton (LSubLibName $ mkUnqualComponentName "sublib-a") --- "pkg:{sublib-a, sublib-b}" +-- "pkg:{sublib-a,sublib-b}" instance Pretty Dependency where - pretty (Dependency name ver sublibs) = withSubLibs (pretty name) <+> pver + pretty (Dependency name ver sublibs) = prettyLibraryNames name (NES.toNonEmpty sublibs) <+> pver where -- TODO: change to isAnyVersion after #6736 pver | isAnyVersionLight ver = PP.empty | otherwise = pretty ver - withSubLibs doc = case NES.toList sublibs of - [LMainLibName] -> doc - [LSubLibName uq] -> doc <<>> PP.colon <<>> pretty uq - _ -> doc <<>> PP.colon <<>> PP.braces prettySublibs - - prettySublibs = PP.hsep $ PP.punctuate PP.comma $ prettySublib <$> NES.toList sublibs - - prettySublib LMainLibName = PP.text $ unPackageName name - prettySublib (LSubLibName un) = PP.text $ unUnqualComponentName un - -- | -- -- >>> simpleParsec "mylib:sub" :: Maybe Dependency diff --git a/Cabal-syntax/src/Distribution/Types/DependencySatisfaction.hs b/Cabal-syntax/src/Distribution/Types/DependencySatisfaction.hs new file mode 100644 index 00000000000..56ce74c1c45 --- /dev/null +++ b/Cabal-syntax/src/Distribution/Types/DependencySatisfaction.hs @@ -0,0 +1,14 @@ +module Distribution.Types.DependencySatisfaction + ( DependencySatisfaction (..) + ) where + +import Distribution.Types.MissingDependencyReason (MissingDependencyReason) + +-- | Whether or not a dependency constraint is satisfied. +data DependencySatisfaction + = -- | The dependency constraint is satisfied. + Satisfied + | -- | The dependency constraint is not satisfied. + -- + -- Includes a reason for explanation. + Unsatisfied MissingDependencyReason diff --git a/Cabal-syntax/src/Distribution/Types/ExeDependency.hs b/Cabal-syntax/src/Distribution/Types/ExeDependency.hs index 17a79703fcc..849debdbf90 100644 --- a/Cabal-syntax/src/Distribution/Types/ExeDependency.hs +++ b/Cabal-syntax/src/Distribution/Types/ExeDependency.hs @@ -25,7 +25,7 @@ data ExeDependency PackageName UnqualComponentName -- name of executable component of package VersionRange - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary ExeDependency instance Structured ExeDependency diff --git a/Cabal-syntax/src/Distribution/Types/Executable.hs b/Cabal-syntax/src/Distribution/Types/Executable.hs index a2140e074a7..2017a9ba8d2 100644 --- a/Cabal-syntax/src/Distribution/Types/Executable.hs +++ b/Cabal-syntax/src/Distribution/Types/Executable.hs @@ -26,7 +26,7 @@ data Executable = Executable , exeScope :: ExecutableScope , buildInfo :: BuildInfo } - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance L.HasBuildInfo Executable where buildInfo f l = (\x -> l{buildInfo = x}) <$> f (buildInfo l) diff --git a/Cabal-syntax/src/Distribution/Types/ExecutableScope.hs b/Cabal-syntax/src/Distribution/Types/ExecutableScope.hs index 1221fae1c1a..5857fb436c2 100644 --- a/Cabal-syntax/src/Distribution/Types/ExecutableScope.hs +++ b/Cabal-syntax/src/Distribution/Types/ExecutableScope.hs @@ -18,7 +18,7 @@ import qualified Text.PrettyPrint as Disp data ExecutableScope = ExecutablePublic | ExecutablePrivate - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Pretty ExecutableScope where pretty ExecutablePublic = Disp.text "public" diff --git a/Cabal-syntax/src/Distribution/Types/ExposedModule.hs b/Cabal-syntax/src/Distribution/Types/ExposedModule.hs index 4afd03a3263..66eede651a4 100644 --- a/Cabal-syntax/src/Distribution/Types/ExposedModule.hs +++ b/Cabal-syntax/src/Distribution/Types/ExposedModule.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Types.ExposedModule where @@ -18,7 +17,7 @@ data ExposedModule = ExposedModule { exposedName :: ModuleName , exposedReexport :: Maybe OpenModule } - deriving (Eq, Generic, Read, Show, Typeable) + deriving (Eq, Generic, Read, Show) instance Pretty ExposedModule where pretty (ExposedModule m reexport) = diff --git a/Cabal-syntax/src/Distribution/Types/Flag.hs b/Cabal-syntax/src/Distribution/Types/Flag.hs index eff71748d9f..9ba76ecd4c4 100644 --- a/Cabal-syntax/src/Distribution/Types/Flag.hs +++ b/Cabal-syntax/src/Distribution/Types/Flag.hs @@ -56,7 +56,7 @@ data PackageFlag = MkPackageFlag , flagDefault :: Bool , flagManual :: Bool } - deriving (Show, Eq, Typeable, Data, Generic) + deriving (Show, Eq, Data, Generic) instance Binary PackageFlag instance Structured PackageFlag @@ -80,7 +80,7 @@ emptyFlag name = -- -- @since 2.0.0.2 newtype FlagName = FlagName ShortText - deriving (Eq, Generic, Ord, Show, Read, Typeable, Data, NFData) + deriving (Eq, Generic, Ord, Show, Read, Data, NFData) -- | Construct a 'FlagName' from a 'String' -- @@ -127,7 +127,7 @@ instance Parsec FlagName where -- -- TODO: Why we record the multiplicity of the flag? newtype FlagAssignment = FlagAssignment {getFlagAssignment :: Map.Map FlagName (Int, Bool)} - deriving (Binary, Generic, NFData, Typeable) + deriving (Binary, Generic, NFData) instance Structured FlagAssignment diff --git a/Cabal-syntax/src/Distribution/Types/ForeignLib.hs b/Cabal-syntax/src/Distribution/Types/ForeignLib.hs index 0da75b06cc6..c8a1472ca56 100644 --- a/Cabal-syntax/src/Distribution/Types/ForeignLib.hs +++ b/Cabal-syntax/src/Distribution/Types/ForeignLib.hs @@ -61,9 +61,9 @@ data ForeignLib = ForeignLib -- This is a list rather than a maybe field so that we can flatten -- the condition trees (for instance, when creating an sdist) } - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) -data LibVersionInfo = LibVersionInfo Int Int Int deriving (Data, Eq, Generic, Typeable) +data LibVersionInfo = LibVersionInfo Int Int Int deriving (Data, Eq, Generic) instance Ord LibVersionInfo where LibVersionInfo c r _ `compare` LibVersionInfo c' r' _ = diff --git a/Cabal-syntax/src/Distribution/Types/ForeignLibOption.hs b/Cabal-syntax/src/Distribution/Types/ForeignLibOption.hs index 5ed65410e70..e56afb7a45b 100644 --- a/Cabal-syntax/src/Distribution/Types/ForeignLibOption.hs +++ b/Cabal-syntax/src/Distribution/Types/ForeignLibOption.hs @@ -22,7 +22,7 @@ data ForeignLibOption -- This option is compulsory on Windows and unsupported -- on other platforms. ForeignLibStandalone - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Pretty ForeignLibOption where pretty ForeignLibStandalone = Disp.text "standalone" diff --git a/Cabal-syntax/src/Distribution/Types/ForeignLibType.hs b/Cabal-syntax/src/Distribution/Types/ForeignLibType.hs index 23617b80c48..6ab73d9e2fb 100644 --- a/Cabal-syntax/src/Distribution/Types/ForeignLibType.hs +++ b/Cabal-syntax/src/Distribution/Types/ForeignLibType.hs @@ -27,7 +27,7 @@ data ForeignLibType ForeignLibNativeStatic | -- TODO: Maybe this should record a string? ForeignLibTypeUnknown - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Pretty ForeignLibType where pretty ForeignLibNativeShared = Disp.text "native-shared" diff --git a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs index 55ec8652304..97f4ed8cccb 100644 --- a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs +++ b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs @@ -71,7 +71,7 @@ data GenericPackageDescription = GenericPackageDescription ) ] } - deriving (Show, Eq, Typeable, Data, Generic) + deriving (Show, Eq, Data, Generic) instance Package GenericPackageDescription where packageId = packageId . packageDescription diff --git a/Cabal-syntax/src/Distribution/Types/HookedBuildInfo.hs b/Cabal-syntax/src/Distribution/Types/HookedBuildInfo.hs index a57d9f8c852..5d0067478f7 100644 --- a/Cabal-syntax/src/Distribution/Types/HookedBuildInfo.hs +++ b/Cabal-syntax/src/Distribution/Types/HookedBuildInfo.hs @@ -1,6 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveGeneric #-} - module Distribution.Types.HookedBuildInfo ( HookedBuildInfo , emptyHookedBuildInfo diff --git a/Cabal-syntax/src/Distribution/Types/IncludeRenaming.hs b/Cabal-syntax/src/Distribution/Types/IncludeRenaming.hs index c8cb70d91f1..411b46d6ce4 100644 --- a/Cabal-syntax/src/Distribution/Types/IncludeRenaming.hs +++ b/Cabal-syntax/src/Distribution/Types/IncludeRenaming.hs @@ -26,7 +26,7 @@ data IncludeRenaming = IncludeRenaming { includeProvidesRn :: ModuleRenaming , includeRequiresRn :: ModuleRenaming } - deriving (Show, Read, Eq, Ord, Typeable, Data, Generic) + deriving (Show, Read, Eq, Ord, Data, Generic) instance Binary IncludeRenaming instance Structured IncludeRenaming diff --git a/Cabal-syntax/src/Distribution/Types/InstalledPackageInfo.hs b/Cabal-syntax/src/Distribution/Types/InstalledPackageInfo.hs index b3e353876eb..f57457d2e5b 100644 --- a/Cabal-syntax/src/Distribution/Types/InstalledPackageInfo.hs +++ b/Cabal-syntax/src/Distribution/Types/InstalledPackageInfo.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeFamilies #-} @@ -95,7 +94,7 @@ data InstalledPackageInfo = InstalledPackageInfo , haddockHTMLs :: [FilePath] , pkgRoot :: Maybe FilePath } - deriving (Eq, Generic, Typeable, Read, Show) + deriving (Eq, Generic, Read, Show) instance Binary InstalledPackageInfo instance Structured InstalledPackageInfo diff --git a/Cabal-syntax/src/Distribution/Types/LegacyExeDependency.hs b/Cabal-syntax/src/Distribution/Types/LegacyExeDependency.hs index 7acf028d0b3..f5c08ac2747 100644 --- a/Cabal-syntax/src/Distribution/Types/LegacyExeDependency.hs +++ b/Cabal-syntax/src/Distribution/Types/LegacyExeDependency.hs @@ -26,7 +26,7 @@ data LegacyExeDependency = LegacyExeDependency String VersionRange - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary LegacyExeDependency instance Structured LegacyExeDependency diff --git a/Cabal-syntax/src/Distribution/Types/Library.hs b/Cabal-syntax/src/Distribution/Types/Library.hs index 738965ea167..fd4b89b6a6a 100644 --- a/Cabal-syntax/src/Distribution/Types/Library.hs +++ b/Cabal-syntax/src/Distribution/Types/Library.hs @@ -31,7 +31,7 @@ data Library = Library -- ^ Whether this multilib can be used as a dependency for other packages. , libBuildInfo :: BuildInfo } - deriving (Generic, Show, Eq, Ord, Read, Typeable, Data) + deriving (Generic, Show, Eq, Ord, Read, Data) instance L.HasBuildInfo Library where buildInfo f l = (\x -> l{libBuildInfo = x}) <$> f (libBuildInfo l) diff --git a/Cabal-syntax/src/Distribution/Types/LibraryName.hs b/Cabal-syntax/src/Distribution/Types/LibraryName.hs index 2b8f53f4f89..6813e8b6c68 100644 --- a/Cabal-syntax/src/Distribution/Types/LibraryName.hs +++ b/Cabal-syntax/src/Distribution/Types/LibraryName.hs @@ -10,6 +10,7 @@ module Distribution.Types.LibraryName , libraryNameString -- * Pretty & Parse + , prettyLibraryNames , prettyLibraryNameComponent , parsecLibraryNameComponent ) where @@ -21,13 +22,14 @@ import Distribution.Parsec import Distribution.Pretty import Distribution.Types.UnqualComponentName +import qualified Data.List.NonEmpty as NEL import qualified Distribution.Compat.CharParsing as P import qualified Text.PrettyPrint as Disp data LibraryName = LMainLibName | LSubLibName UnqualComponentName - deriving (Eq, Generic, Ord, Read, Show, Typeable, Data) + deriving (Eq, Generic, Ord, Read, Show, Data) instance Binary LibraryName instance Structured LibraryName @@ -42,6 +44,22 @@ prettyLibraryNameComponent :: LibraryName -> Disp.Doc prettyLibraryNameComponent LMainLibName = Disp.text "lib" prettyLibraryNameComponent (LSubLibName str) = Disp.text "lib:" <<>> pretty str +-- | Pretty print a 'LibraryName' after a package name. +-- +-- Produces output like @foo@, @foo:bar@, or @foo:{bar,baz}@ +prettyLibraryNames :: Pretty a => a -> NonEmpty LibraryName -> Disp.Doc +prettyLibraryNames package libraries = + let doc = pretty package + + prettyComponent LMainLibName = pretty package + prettyComponent (LSubLibName component) = Disp.text $ unUnqualComponentName component + + prettyComponents = commaSep $ prettyComponent <$> NEL.toList libraries + in case libraries of + LMainLibName :| [] -> doc + LSubLibName component :| [] -> doc <<>> Disp.colon <<>> pretty component + _ -> doc <<>> Disp.colon <<>> Disp.braces prettyComponents + parsecLibraryNameComponent :: CabalParsing m => m LibraryName parsecLibraryNameComponent = do _ <- P.string "lib" diff --git a/Cabal-syntax/src/Distribution/Types/LibraryVisibility.hs b/Cabal-syntax/src/Distribution/Types/LibraryVisibility.hs index bf113488a5c..8ebd7d2a19d 100644 --- a/Cabal-syntax/src/Distribution/Types/LibraryVisibility.hs +++ b/Cabal-syntax/src/Distribution/Types/LibraryVisibility.hs @@ -23,7 +23,7 @@ data LibraryVisibility LibraryVisibilityPublic | -- | Internal library, default LibraryVisibilityPrivate - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Pretty LibraryVisibility where pretty LibraryVisibilityPublic = Disp.text "public" diff --git a/Cabal-syntax/src/Distribution/Types/MissingDependency.hs b/Cabal-syntax/src/Distribution/Types/MissingDependency.hs new file mode 100644 index 00000000000..57d90276d8c --- /dev/null +++ b/Cabal-syntax/src/Distribution/Types/MissingDependency.hs @@ -0,0 +1,34 @@ +module Distribution.Types.MissingDependency + ( MissingDependency (..) + ) where + +import Distribution.Compat.Prelude +import Distribution.Pretty +import Distribution.Types.Dependency + ( Dependency + , simplifyDependency + ) +import Distribution.Types.LibraryName + ( prettyLibraryNames + ) +import Distribution.Types.MissingDependencyReason + ( MissingDependencyReason (..) + ) + +import qualified Text.PrettyPrint as PP + +-- | A missing dependency and information on why it's missing. +data MissingDependency = MissingDependency Dependency MissingDependencyReason + deriving (Show) + +instance Pretty MissingDependency where + pretty (MissingDependency dependency reason) = + let prettyReason = + case reason of + MissingLibrary libraries -> + PP.text "missing" <+> prettyLibraryNames PP.empty libraries + MissingPackage -> PP.text "missing" + MissingComponent name -> PP.text "missing component" <+> pretty name + WrongVersion versions -> + PP.text "installed:" <+> commaSpaceSep versions + in pretty (simplifyDependency dependency) <+> PP.parens prettyReason diff --git a/Cabal-syntax/src/Distribution/Types/MissingDependencyReason.hs b/Cabal-syntax/src/Distribution/Types/MissingDependencyReason.hs new file mode 100644 index 00000000000..a42befd9ccf --- /dev/null +++ b/Cabal-syntax/src/Distribution/Types/MissingDependencyReason.hs @@ -0,0 +1,25 @@ +module Distribution.Types.MissingDependencyReason + ( MissingDependencyReason (..) + ) where + +import Data.List.NonEmpty (NonEmpty) +import Distribution.Types.LibraryName (LibraryName) +import Distribution.Types.PackageName (PackageName) +import Distribution.Types.Version (Version) + +-- | A reason for a dependency failing to solve. +-- +-- This helps pinpoint dependencies that are installed with an incorrect +-- version vs. dependencies that are not installed at all. +data MissingDependencyReason + = -- | One or more libraries is missing. + MissingLibrary (NonEmpty LibraryName) + | -- | A package is not installed. + MissingPackage + | -- | A package is installed, but the versions don't match. + -- + -- Contains the available versions. + WrongVersion [Version] + | -- | A component is not installed. + MissingComponent PackageName + deriving (Show) diff --git a/Cabal-syntax/src/Distribution/Types/Mixin.hs b/Cabal-syntax/src/Distribution/Types/Mixin.hs index 63fa6e30fd5..726651d3292 100644 --- a/Cabal-syntax/src/Distribution/Types/Mixin.hs +++ b/Cabal-syntax/src/Distribution/Types/Mixin.hs @@ -31,7 +31,7 @@ data Mixin = Mixin , mixinLibraryName :: LibraryName , mixinIncludeRenaming :: IncludeRenaming } - deriving (Show, Read, Eq, Ord, Typeable, Data, Generic) + deriving (Show, Read, Eq, Ord, Data, Generic) instance Binary Mixin instance Structured Mixin diff --git a/Cabal-syntax/src/Distribution/Types/Module.hs b/Cabal-syntax/src/Distribution/Types/Module.hs index e9febeff070..b04510c8037 100644 --- a/Cabal-syntax/src/Distribution/Types/Module.hs +++ b/Cabal-syntax/src/Distribution/Types/Module.hs @@ -1,6 +1,5 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Distribution.Types.Module ( Module (..) @@ -26,7 +25,7 @@ import qualified Text.PrettyPrint as Disp -- the 'InstalledPackageInfo'. data Module = Module DefUnitId ModuleName - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary Module instance Structured Module diff --git a/Cabal-syntax/src/Distribution/Types/ModuleReexport.hs b/Cabal-syntax/src/Distribution/Types/ModuleReexport.hs index 0dae6002c3c..f7aa1e0a2fe 100644 --- a/Cabal-syntax/src/Distribution/Types/ModuleReexport.hs +++ b/Cabal-syntax/src/Distribution/Types/ModuleReexport.hs @@ -24,7 +24,7 @@ data ModuleReexport = ModuleReexport , moduleReexportOriginalName :: ModuleName , moduleReexportName :: ModuleName } - deriving (Eq, Ord, Generic, Read, Show, Typeable, Data) + deriving (Eq, Ord, Generic, Read, Show, Data) instance Binary ModuleReexport instance Structured ModuleReexport diff --git a/Cabal-syntax/src/Distribution/Types/ModuleRenaming.hs b/Cabal-syntax/src/Distribution/Types/ModuleRenaming.hs index 022a321a055..d0317205f6a 100644 --- a/Cabal-syntax/src/Distribution/Types/ModuleRenaming.hs +++ b/Cabal-syntax/src/Distribution/Types/ModuleRenaming.hs @@ -40,7 +40,7 @@ data ModuleRenaming | -- | Hiding renaming, e.g., @hiding (A, B)@, bringing all -- exported modules into scope except the hidden ones. HidingRenaming [ModuleName] - deriving (Show, Read, Eq, Ord, Typeable, Data, Generic) + deriving (Show, Read, Eq, Ord, Data, Generic) -- | Interpret a 'ModuleRenaming' as a partial map from 'ModuleName' -- to 'ModuleName'. For efficiency, you should partially apply it diff --git a/Cabal-syntax/src/Distribution/Types/MungedPackageId.hs b/Cabal-syntax/src/Distribution/Types/MungedPackageId.hs index f1e0904586d..8e879620478 100644 --- a/Cabal-syntax/src/Distribution/Types/MungedPackageId.hs +++ b/Cabal-syntax/src/Distribution/Types/MungedPackageId.hs @@ -28,7 +28,7 @@ data MungedPackageId = MungedPackageId , mungedVersion :: Version -- ^ The version of this package / component, eg 1.2 } - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary MungedPackageId instance Structured MungedPackageId diff --git a/Cabal-syntax/src/Distribution/Types/MungedPackageName.hs b/Cabal-syntax/src/Distribution/Types/MungedPackageName.hs index 78b648993d4..25a0f055362 100644 --- a/Cabal-syntax/src/Distribution/Types/MungedPackageName.hs +++ b/Cabal-syntax/src/Distribution/Types/MungedPackageName.hs @@ -31,7 +31,7 @@ import qualified Text.PrettyPrint as Disp -- -- @since 2.0.0.2 data MungedPackageName = MungedPackageName !PackageName !LibraryName - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary MungedPackageName instance Structured MungedPackageName diff --git a/Cabal-syntax/src/Distribution/Types/PackageDescription.hs b/Cabal-syntax/src/Distribution/Types/PackageDescription.hs index a3f1d0c33da..4b00a8ef526 100644 --- a/Cabal-syntax/src/Distribution/Types/PackageDescription.hs +++ b/Cabal-syntax/src/Distribution/Types/PackageDescription.hs @@ -149,8 +149,9 @@ data PackageDescription = PackageDescription , extraSrcFiles :: [RelativePath Pkg File] , extraTmpFiles :: [RelativePath Pkg File] , extraDocFiles :: [RelativePath Pkg File] + , extraFiles :: [RelativePath Pkg File] } - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Binary PackageDescription instance Structured PackageDescription @@ -235,6 +236,7 @@ emptyPackageDescription = , extraSrcFiles = [] , extraTmpFiles = [] , extraDocFiles = [] + , extraFiles = [] } -- --------------------------------------------------------------------------- @@ -491,6 +493,7 @@ instance L.HasBuildInfos PackageDescription where a22 a23 a24 + a25 ) = PackageDescription a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 <$> (traverse . L.buildInfo) f x1 -- library @@ -504,3 +507,4 @@ instance L.HasBuildInfos PackageDescription where <*> pure a22 -- extra src files <*> pure a23 -- extra temp files <*> pure a24 -- extra doc files + <*> pure a25 -- extra files diff --git a/Cabal-syntax/src/Distribution/Types/PackageDescription/Lens.hs b/Cabal-syntax/src/Distribution/Types/PackageDescription/Lens.hs index 201b10d859f..a9a669c5e73 100644 --- a/Cabal-syntax/src/Distribution/Types/PackageDescription/Lens.hs +++ b/Cabal-syntax/src/Distribution/Types/PackageDescription/Lens.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} module Distribution.Types.PackageDescription.Lens @@ -159,6 +158,10 @@ extraDocFiles :: Lens' PackageDescription [RelativePath Pkg File] extraDocFiles f s = fmap (\x -> s{T.extraDocFiles = x}) (f (T.extraDocFiles s)) {-# INLINE extraDocFiles #-} +extraFiles :: Lens' PackageDescription [RelativePath Pkg File] +extraFiles f s = fmap (\x -> s{T.extraFiles = x}) (f (T.extraFiles s)) +{-# INLINE extraFiles #-} + -- | @since 3.0.0.0 allLibraries :: Traversal' PackageDescription Library allLibraries f pd = mk <$> traverse f (T.library pd) <*> traverse f (T.subLibraries pd) diff --git a/Cabal-syntax/src/Distribution/Types/PackageId.hs b/Cabal-syntax/src/Distribution/Types/PackageId.hs index b5c4764ad22..9cd88a2f810 100644 --- a/Cabal-syntax/src/Distribution/Types/PackageId.hs +++ b/Cabal-syntax/src/Distribution/Types/PackageId.hs @@ -28,7 +28,7 @@ data PackageIdentifier = PackageIdentifier , pkgVersion :: Version -- ^ the version of this package, eg 1.2 } - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary PackageIdentifier instance Structured PackageIdentifier diff --git a/Cabal-syntax/src/Distribution/Types/PackageName.hs b/Cabal-syntax/src/Distribution/Types/PackageName.hs index 4cf9d1aeb59..8a22662d672 100644 --- a/Cabal-syntax/src/Distribution/Types/PackageName.hs +++ b/Cabal-syntax/src/Distribution/Types/PackageName.hs @@ -1,6 +1,5 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Distribution.Types.PackageName ( PackageName @@ -27,7 +26,7 @@ import qualified Text.PrettyPrint as Disp -- -- @since 2.0.0.2 newtype PackageName = PackageName ShortText - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) -- | Convert 'PackageName' to 'String' unPackageName :: PackageName -> String diff --git a/Cabal-syntax/src/Distribution/Types/PackageVersionConstraint.hs b/Cabal-syntax/src/Distribution/Types/PackageVersionConstraint.hs index 9c328378d07..013226ca2d5 100644 --- a/Cabal-syntax/src/Distribution/Types/PackageVersionConstraint.hs +++ b/Cabal-syntax/src/Distribution/Types/PackageVersionConstraint.hs @@ -26,7 +26,7 @@ import qualified Distribution.Compat.CharParsing as P -- There are a few places in the codebase where 'Dependency' was used where -- 'PackageVersionConstraint' is not used instead (#5570). data PackageVersionConstraint = PackageVersionConstraint PackageName VersionRange - deriving (Generic, Read, Show, Eq, Typeable, Data) + deriving (Generic, Read, Show, Eq, Data) instance Binary PackageVersionConstraint instance Structured PackageVersionConstraint diff --git a/Cabal-syntax/src/Distribution/Types/PkgconfigDependency.hs b/Cabal-syntax/src/Distribution/Types/PkgconfigDependency.hs index 695d3a3a184..54c8da7f66d 100644 --- a/Cabal-syntax/src/Distribution/Types/PkgconfigDependency.hs +++ b/Cabal-syntax/src/Distribution/Types/PkgconfigDependency.hs @@ -23,7 +23,7 @@ data PkgconfigDependency = PkgconfigDependency PkgconfigName PkgconfigVersionRange - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary PkgconfigDependency instance Structured PkgconfigDependency diff --git a/Cabal-syntax/src/Distribution/Types/PkgconfigName.hs b/Cabal-syntax/src/Distribution/Types/PkgconfigName.hs index c3a93dd27c1..0057a947614 100644 --- a/Cabal-syntax/src/Distribution/Types/PkgconfigName.hs +++ b/Cabal-syntax/src/Distribution/Types/PkgconfigName.hs @@ -1,6 +1,5 @@ {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} module Distribution.Types.PkgconfigName ( PkgconfigName @@ -24,7 +23,7 @@ import qualified Text.PrettyPrint as Disp -- -- @since 2.0.0.2 newtype PkgconfigName = PkgconfigName ShortText - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) -- | Convert 'PkgconfigName' to 'String' -- diff --git a/Cabal-syntax/src/Distribution/Types/PkgconfigVersion.hs b/Cabal-syntax/src/Distribution/Types/PkgconfigVersion.hs index dc328c44dda..d8db5b39bad 100644 --- a/Cabal-syntax/src/Distribution/Types/PkgconfigVersion.hs +++ b/Cabal-syntax/src/Distribution/Types/PkgconfigVersion.hs @@ -26,7 +26,7 @@ import qualified Text.PrettyPrint as PP -- -- @since 3.0 newtype PkgconfigVersion = PkgconfigVersion BS.ByteString - deriving (Generic, Read, Show, Typeable, Data) + deriving (Generic, Read, Show, Data) instance Eq PkgconfigVersion where PkgconfigVersion a == PkgconfigVersion b = rpmvercmp a b == EQ diff --git a/Cabal-syntax/src/Distribution/Types/PkgconfigVersionRange.hs b/Cabal-syntax/src/Distribution/Types/PkgconfigVersionRange.hs index fe74f70c7be..0699768409e 100644 --- a/Cabal-syntax/src/Distribution/Types/PkgconfigVersionRange.hs +++ b/Cabal-syntax/src/Distribution/Types/PkgconfigVersionRange.hs @@ -37,7 +37,7 @@ data PkgconfigVersionRange | PcOrEarlierVersion PkgconfigVersion -- =< version | PcUnionVersionRanges PkgconfigVersionRange PkgconfigVersionRange | PcIntersectVersionRanges PkgconfigVersionRange PkgconfigVersionRange - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data) + deriving (Generic, Read, Show, Eq, Ord, Data) instance Binary PkgconfigVersionRange instance Structured PkgconfigVersionRange diff --git a/Cabal-syntax/src/Distribution/Types/SetupBuildInfo.hs b/Cabal-syntax/src/Distribution/Types/SetupBuildInfo.hs index 18a01523a9e..9feffbf71e6 100644 --- a/Cabal-syntax/src/Distribution/Types/SetupBuildInfo.hs +++ b/Cabal-syntax/src/Distribution/Types/SetupBuildInfo.hs @@ -25,7 +25,7 @@ data SetupBuildInfo = SetupBuildInfo -- internally, and doesn't correspond to anything in the .cabal -- file. See #3199. } - deriving (Generic, Show, Eq, Ord, Read, Typeable, Data) + deriving (Generic, Show, Eq, Ord, Read, Data) instance Binary SetupBuildInfo instance Structured SetupBuildInfo diff --git a/Cabal-syntax/src/Distribution/Types/SourceRepo.hs b/Cabal-syntax/src/Distribution/Types/SourceRepo.hs index 16a0fc60e0e..10ab9c16e63 100644 --- a/Cabal-syntax/src/Distribution/Types/SourceRepo.hs +++ b/Cabal-syntax/src/Distribution/Types/SourceRepo.hs @@ -77,7 +77,7 @@ data SourceRepo = SourceRepo -- relative to the root of the repository. This field is optional. If not -- given the default is \".\" ie no subdirectory. } - deriving (Eq, Ord, Generic, Read, Show, Typeable, Data) + deriving (Eq, Ord, Generic, Read, Show, Data) emptySourceRepo :: RepoKind -> SourceRepo emptySourceRepo kind = @@ -106,7 +106,7 @@ data RepoKind -- information to re-create the exact sources. RepoThis | RepoKindUnknown String - deriving (Eq, Generic, Ord, Read, Show, Typeable, Data) + deriving (Eq, Generic, Ord, Read, Show, Data) instance Binary RepoKind instance Structured RepoKind @@ -126,7 +126,7 @@ data KnownRepoType | Monotone | -- | @since 3.4.0.0 Pijul - deriving (Eq, Generic, Ord, Read, Show, Typeable, Data, Enum, Bounded) + deriving (Eq, Generic, Ord, Read, Show, Data, Enum, Bounded) instance Binary KnownRepoType instance Structured KnownRepoType @@ -146,7 +146,7 @@ instance Pretty KnownRepoType where data RepoType = KnownRepoType KnownRepoType | OtherRepoType String - deriving (Eq, Generic, Ord, Read, Show, Typeable, Data) + deriving (Eq, Generic, Ord, Read, Show, Data) instance Binary RepoType instance Structured RepoType diff --git a/Cabal-syntax/src/Distribution/Types/TestSuite.hs b/Cabal-syntax/src/Distribution/Types/TestSuite.hs index 6b3107cae71..129e17dabfb 100644 --- a/Cabal-syntax/src/Distribution/Types/TestSuite.hs +++ b/Cabal-syntax/src/Distribution/Types/TestSuite.hs @@ -28,7 +28,7 @@ data TestSuite = TestSuite , testBuildInfo :: BuildInfo , testCodeGenerators :: [String] } - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance L.HasBuildInfo TestSuite where buildInfo f l = (\x -> l{testBuildInfo = x}) <$> f (testBuildInfo l) diff --git a/Cabal-syntax/src/Distribution/Types/TestSuiteInterface.hs b/Cabal-syntax/src/Distribution/Types/TestSuiteInterface.hs index 37e87155e48..a64d2f61f62 100644 --- a/Cabal-syntax/src/Distribution/Types/TestSuiteInterface.hs +++ b/Cabal-syntax/src/Distribution/Types/TestSuiteInterface.hs @@ -30,7 +30,7 @@ data TestSuiteInterface | -- | A test suite that does not conform to one of the above interfaces for -- the given reason (e.g. unknown test type). TestSuiteUnsupported TestType - deriving (Eq, Ord, Generic, Read, Show, Typeable, Data) + deriving (Eq, Ord, Generic, Read, Show, Data) instance Binary TestSuiteInterface instance Structured TestSuiteInterface diff --git a/Cabal-syntax/src/Distribution/Types/TestType.hs b/Cabal-syntax/src/Distribution/Types/TestType.hs index 6ac0866d6f1..88d3b3892f8 100644 --- a/Cabal-syntax/src/Distribution/Types/TestType.hs +++ b/Cabal-syntax/src/Distribution/Types/TestType.hs @@ -25,7 +25,7 @@ data TestType TestTypeLib Version | -- | Some unknown test type e.g. \"type: foo\" TestTypeUnknown String Version - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Binary TestType instance Structured TestType diff --git a/Cabal-syntax/src/Distribution/Types/UnitId.hs b/Cabal-syntax/src/Distribution/Types/UnitId.hs index 36a1d003b2e..0b5ca4bdf7b 100644 --- a/Cabal-syntax/src/Distribution/Types/UnitId.hs +++ b/Cabal-syntax/src/Distribution/Types/UnitId.hs @@ -64,7 +64,7 @@ import Text.PrettyPrint (text) -- flag, use the 'display' function, which will work on all -- versions of Cabal. newtype UnitId = UnitId ShortText - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data, NFData) + deriving (Generic, Read, Show, Eq, Ord, Data, NFData) instance Binary UnitId instance Structured UnitId @@ -118,7 +118,7 @@ getHSLibraryName uid = "HS" ++ prettyShow uid -- that a 'UnitId' identified this way is definite; i.e., it has no -- unfilled holes. newtype DefUnitId = DefUnitId {unDefUnitId :: UnitId} - deriving (Generic, Read, Show, Eq, Ord, Typeable, Data, Binary, NFData, Pretty) + deriving (Generic, Read, Show, Eq, Ord, Data, Binary, NFData, Pretty) instance Structured DefUnitId diff --git a/Cabal-syntax/src/Distribution/Types/UnqualComponentName.hs b/Cabal-syntax/src/Distribution/Types/UnqualComponentName.hs index 3879cdd2169..f671759b42f 100644 --- a/Cabal-syntax/src/Distribution/Types/UnqualComponentName.hs +++ b/Cabal-syntax/src/Distribution/Types/UnqualComponentName.hs @@ -33,7 +33,6 @@ newtype UnqualComponentName = UnqualComponentName ShortText , Show , Eq , Ord - , Typeable , Data , Semigroup , Monoid -- TODO: bad enabler of bad monoids diff --git a/Cabal-syntax/src/Distribution/Types/Version.hs b/Cabal-syntax/src/Distribution/Types/Version.hs index 90ad33b1048..efb2d497b49 100644 --- a/Cabal-syntax/src/Distribution/Types/Version.hs +++ b/Cabal-syntax/src/Distribution/Types/Version.hs @@ -47,7 +47,7 @@ data Version -- which all fall into the [0..0xfffe] range), then PV0 -- MUST be used. This is essential for the 'Eq' instance -- to work. - deriving (Data, Eq, Generic, Typeable) + deriving (Data, Eq, Generic) instance Ord Version where compare (PV0 x) (PV0 y) = compare x y diff --git a/Cabal-syntax/src/Distribution/Types/VersionInterval.hs b/Cabal-syntax/src/Distribution/Types/VersionInterval.hs index afd9d665631..517c1049113 100644 --- a/Cabal-syntax/src/Distribution/Types/VersionInterval.hs +++ b/Cabal-syntax/src/Distribution/Types/VersionInterval.hs @@ -1,5 +1,4 @@ {-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DeriveDataTypeable #-} -- | This module implements a view of a 'VersionRange' as a finite -- list of separated version intervals. @@ -65,7 +64,7 @@ import Distribution.Types.VersionRange.Internal -- predicates for translation into foreign packaging systems that do not -- support complex version range expressions. newtype VersionIntervals = VersionIntervals [VersionInterval] - deriving (Eq, Show, Typeable) + deriving (Eq, Show) -- | Inspect the list of version intervals. unVersionIntervals :: VersionIntervals -> [VersionInterval] @@ -95,7 +94,7 @@ isVersion0 = (==) version0 stage1 :: VersionRange -> [VersionInterval] stage1 = cataVersionRange alg where - -- version range leafs transform into singleton intervals + -- version range leaves transform into singleton intervals alg (ThisVersionF v) = [VersionInterval (LowerBound v InclusiveBound) (UpperBound v InclusiveBound)] alg (LaterVersionF v) = [VersionInterval (LowerBound v ExclusiveBound) NoUpperBound] alg (OrLaterVersionF v) = [VersionInterval (LowerBound v InclusiveBound) NoUpperBound] diff --git a/Cabal-syntax/src/Distribution/Types/VersionInterval/Legacy.hs b/Cabal-syntax/src/Distribution/Types/VersionInterval/Legacy.hs index f5e86d4a429..57e725b66d5 100644 --- a/Cabal-syntax/src/Distribution/Types/VersionInterval/Legacy.hs +++ b/Cabal-syntax/src/Distribution/Types/VersionInterval/Legacy.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} - -- | This module implements a view of a 'VersionRange' as a finite -- list of separated version intervals and provides the Boolean -- algebra operations union, intersection, and complement. @@ -96,7 +94,7 @@ asVersionIntervals = versionIntervals . toVersionIntervals -- predicates for translation into foreign packaging systems that do not -- support complex version range expressions. newtype VersionIntervals = VersionIntervals [VersionInterval] - deriving (Eq, Show, Typeable) + deriving (Eq, Show) -- | Inspect the list of version intervals. versionIntervals :: VersionIntervals -> [VersionInterval] diff --git a/Cabal-syntax/src/Distribution/Types/VersionRange.hs b/Cabal-syntax/src/Distribution/Types/VersionRange.hs index c470b93c0d2..c1e72f728ac 100644 --- a/Cabal-syntax/src/Distribution/Types/VersionRange.hs +++ b/Cabal-syntax/src/Distribution/Types/VersionRange.hs @@ -1,7 +1,26 @@ +{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE ViewPatterns #-} + module Distribution.Types.VersionRange - ( -- * Version ranges + ( -- * Version Range VersionRange + -- ** Predicates + -- $predicate-examples + + -- *** Lower Bound + , hasLowerBound + , hasGTLowerBound + + -- *** Upper Bound + , hasUpperBound + , hasLEUpperBound + , hasTrailingZeroUpperBound + + -- *** Any Version + , isAnyVersion + , isAnyVersionLight + -- ** Constructing , anyVersion , noVersion @@ -16,32 +35,31 @@ module Distribution.Types.VersionRange , withinVersion , majorBoundVersion - -- ** Inspection + -- ** Modification + , normaliseVersionRange + , stripParensVersionRange - -- - -- See "Distribution.Version" for more utilities. + -- ** Inspection , withinRange , foldVersionRange - , normaliseVersionRange - , stripParensVersionRange - , hasUpperBound - , hasLowerBound - -- ** Cata & ana + -- ** Parser + , versionRangeParser + + -- * Version F-Algebra , VersionRangeF (..) + , projectVersionRange + , embedVersionRange , cataVersionRange , anaVersionRange , hyloVersionRange - , projectVersionRange - , embedVersionRange - -- ** Utilities - , isAnyVersion - , isAnyVersionLight + -- * Version Utilities + + -- See "Distribution.Version" for more utilities. , wildcardUpperBound , majorUpperBound , isWildcardRange - , versionRangeParser ) where import Distribution.Compat.Prelude @@ -172,6 +190,9 @@ isWildcardRange ver1 ver2 = check (versionNumbers ver1) (versionNumbers ver2) -- | Does the version range have an upper bound? -- -- @since 1.24.0.0 +-- +-- >>> forM ["< 1", ">= 0 && < 1", ">= 0 || < 1", "^>= 4.20.0.0"] (fmap hasUpperBound . simpleParsec) +-- Just [True,True,False,True] hasUpperBound :: VersionRange -> Bool hasUpperBound = foldVersionRange @@ -188,6 +209,9 @@ hasUpperBound = -- the implicit >=0 lower bound. -- -- @since 1.24.0.0 +-- +-- >>> forM ["< 1", ">= 0 && < 1", ">= 0 || < 1", "^>= 4.20.0.0"] (fmap hasLowerBound . simpleParsec) +-- Just [False,True,False,True] hasLowerBound :: VersionRange -> Bool hasLowerBound = foldVersionRange @@ -197,3 +221,50 @@ hasLowerBound = (const False) (&&) (||) + +-- | Is the upper bound version range (less than or equal (LE, <=)? +-- +-- >>> forM ["< 1", "<= 1", ">= 0 && < 1", ">= 0 || < 1", ">= 0 && <= 1", ">= 0 || <= 1", "^>= 4.20.0.0"] (fmap hasLEUpperBound . simpleParsec) +-- Just [False,True,False,False,True,True,False] +hasLEUpperBound :: VersionRange -> Bool +hasLEUpperBound = queryVersionRange (\case LEUpperBound -> True; _ -> False) hasLEUpperBound + +-- | Is the lower bound version range greater than (GT, >)? +-- +-- >>> forM ["< 1", ">= 0 && < 1", ">= 0 || < 1", "> 0 && < 1", "> 0 || < 1", "^>= 4.20.0.0"] (fmap hasGTLowerBound . simpleParsec) +-- Just [False,False,False,True,True,False] +hasGTLowerBound :: VersionRange -> Bool +hasGTLowerBound = queryVersionRange (\case GTLowerBound -> True; _ -> False) hasGTLowerBound + +-- | Does the upper bound version range have a trailing zero? +-- +-- >>> forM ["< 1", "< 1.1", "< 1.0", "< 1.1.0", "^>= 4.20.0.0"] (fmap hasTrailingZeroUpperBound . simpleParsec) +-- Just [False,False,True,True,False] +hasTrailingZeroUpperBound :: VersionRange -> Bool +hasTrailingZeroUpperBound = queryVersionRange (\case TZUpperBound -> True; _ -> False) hasTrailingZeroUpperBound + +queryVersionRange :: (VersionRangeF VersionRange -> Bool) -> (VersionRange -> Bool) -> VersionRange -> Bool +queryVersionRange pf p (projectVersionRange -> v) = + let f = queryVersionRange pf p + in pf v || case v of + IntersectVersionRangesF x y -> f x || f y + UnionVersionRangesF x y -> f x || f y + _ -> False + +-- $setup +-- >>> import Distribution.Parsec +-- >>> import Data.Traversable + +-- $predicate-examples +-- +-- The parsed 'VersionRange' of each version constraint used in the examples for +-- 'hasUpperBound' and 'hasLowerBound' are: +-- +-- >>> simpleParsec "< 1" :: Maybe VersionRange +-- Just (EarlierVersion (mkVersion [1])) +-- >>> simpleParsec ">= 0 && < 1" :: Maybe VersionRange +-- Just (IntersectVersionRanges (OrLaterVersion (mkVersion [0])) (EarlierVersion (mkVersion [1]))) +-- >>> simpleParsec ">= 0 || < 1" :: Maybe VersionRange +-- Just (UnionVersionRanges (OrLaterVersion (mkVersion [0])) (EarlierVersion (mkVersion [1]))) +-- >>> simpleParsec "^>= 4.20.0.0" :: Maybe VersionRange +-- Just (MajorBoundVersion (mkVersion [4,20,0,0])) diff --git a/Cabal-syntax/src/Distribution/Types/VersionRange/Internal.hs b/Cabal-syntax/src/Distribution/Types/VersionRange/Internal.hs index 7d7101d8660..69d9b8124ee 100644 --- a/Cabal-syntax/src/Distribution/Types/VersionRange/Internal.hs +++ b/Cabal-syntax/src/Distribution/Types/VersionRange/Internal.hs @@ -1,11 +1,11 @@ {-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE ViewPatterns #-} -- | The only purpose of this module is to prevent the export of -- 'VersionRange' constructors from @@ -25,7 +25,7 @@ module Distribution.Types.VersionRange.Internal , intersectVersionRanges , withinVersion , majorBoundVersion - , VersionRangeF (..) + , VersionRangeF (.., LEUpperBound, GTLowerBound, TZUpperBound) , projectVersionRange , embedVersionRange , cataVersionRange @@ -58,7 +58,7 @@ data VersionRange | MajorBoundVersion Version -- @^>= ver@ (same as >= ver && < MAJ(ver)+1) | UnionVersionRanges VersionRange VersionRange | IntersectVersionRanges VersionRange VersionRange - deriving (Data, Eq, Ord, Generic, Read, Show, Typeable) + deriving (Data, Eq, Ord, Generic, Read, Show) instance Binary VersionRange instance Structured VersionRange @@ -181,12 +181,27 @@ data VersionRangeF a , Generic , Read , Show - , Typeable , Functor , Foldable , Traversable ) +pattern LEUpperBound, GTLowerBound, TZUpperBound :: VersionRangeF a +pattern LEUpperBound <- OrEarlierVersionF _ +pattern GTLowerBound <- LaterVersionF _ +pattern TZUpperBound <- (upperTrailingZero -> True) + +upperTrailingZero :: VersionRangeF a -> Bool +upperTrailingZero (OrEarlierVersionF x) = trailingZero x +upperTrailingZero (EarlierVersionF x) = trailingZero x +upperTrailingZero _ = False + +trailingZero :: Version -> Bool +trailingZero (versionNumbers -> vs) + | [0] <- vs = False + | 0 : _ <- reverse vs = True + | otherwise = False + -- | Generic destructor for 'VersionRange'. -- -- @since 2.2 diff --git a/Cabal-syntax/src/Distribution/Utils/Generic.hs b/Cabal-syntax/src/Distribution/Utils/Generic.hs index 997e0132f5a..30cf8f7d75a 100644 --- a/Cabal-syntax/src/Distribution/Utils/Generic.hs +++ b/Cabal-syntax/src/Distribution/Utils/Generic.hs @@ -1,6 +1,5 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -100,11 +99,13 @@ import qualified Data.Set as Set import qualified Control.Exception as Exception import System.Directory - ( removeFile + ( copyFile + , getTemporaryDirectory + , removeFile , renameFile ) import System.FilePath - ( splitFileName + ( takeFileName , (<.>) ) import System.IO @@ -153,8 +154,8 @@ wrapLine width = wrap 0 [] -- | Gets the contents of a file, but guarantee that it gets closed. -- --- The file is read lazily but if it is not fully consumed by the action then --- the remaining input is truncated and the file is closed. +-- The file is read lazily; if it is not fully consumed by the action then an +-- exception is thrown. withFileContents :: FilePath -> (String -> IO a) -> IO a withFileContents name action = withFile @@ -167,18 +168,38 @@ withFileContents name action = -- The file is either written successfully or an IO exception is raised and -- the original file is left unchanged. -- --- On windows it is not possible to delete a file that is open by a process. --- This case will give an IO exception but the atomic property is not affected. +-- On Unix: +-- +-- - If the temp directory (@$TMPDIR@) is in a filesystem different than the +-- destination path, the renaming will be emulated via 'copyFile' then +-- 'deleteFile'. +-- +-- On Windows: +-- +-- - This operation is not guaranteed to be atomic, see 'renameFile'. +-- +-- - It is not possible to delete a file that is open by a process. This case +-- will give an IO exception but the atomic property is not affected. +-- +-- - If the temp directory (@TMP@/@TEMP@/..., see haddocks on +-- 'getTemporaryDirectory') is in a different drive than the destination path, +-- the write will be emulated via 'copyFile', then 'deleteFile'. writeFileAtomic :: FilePath -> LBS.ByteString -> IO () writeFileAtomic targetPath content = do - let (targetDir, targetFile) = splitFileName targetPath + let targetFile = takeFileName targetPath + tmpDir <- getTemporaryDirectory Exception.bracketOnError - (openBinaryTempFileWithDefaultPermissions targetDir $ targetFile <.> "tmp") + (openBinaryTempFileWithDefaultPermissions tmpDir $ targetFile <.> "tmp") (\(tmpPath, handle) -> hClose handle >> removeFile tmpPath) ( \(tmpPath, handle) -> do LBS.hPut handle content hClose handle - renameFile tmpPath targetPath + Exception.catch + (renameFile tmpPath targetPath) + ( \(_ :: Exception.SomeException) -> do + copyFile tmpPath targetPath + removeFile tmpPath + ) ) -- ------------------------------------------------------------ diff --git a/Cabal-syntax/src/Distribution/Utils/Path.hs b/Cabal-syntax/src/Distribution/Utils/Path.hs index 765b0ac6143..a0f18a1dfdd 100644 --- a/Cabal-syntax/src/Distribution/Utils/Path.hs +++ b/Cabal-syntax/src/Distribution/Utils/Path.hs @@ -30,14 +30,17 @@ module Distribution.Utils.Path , Tix , Tmp , Response + , PkgConf -- * Symbolic paths , RelativePath , SymbolicPath + , AbsolutePath (..) , SymbolicPathX -- NB: constructor not exposed, to retain type safety. -- ** Symbolic path API , getSymbolicPath + , getAbsolutePath , sameDirectory , makeRelativePathEx , makeSymbolicPath @@ -47,6 +50,7 @@ module Distribution.Utils.Path , relativeSymbolicPath , symbolicPathRelative_maybe , interpretSymbolicPath + , interpretSymbolicPathAbsolute -- ** General filepath API , () @@ -59,7 +63,7 @@ module Distribution.Utils.Path -- ** Working directory handling , interpretSymbolicPathCWD , absoluteWorkingDir - , tryMakeRelativeToWorkingDir + , tryMakeRelative -- ** Module names , moduleNameSymbolicPath @@ -197,7 +201,7 @@ data AllowAbsolute -- until we interpret them (using e.g. 'interpretSymbolicPath'). newtype SymbolicPathX (allowAbsolute :: AllowAbsolute) (from :: Type) (to :: FileOrDir) = SymbolicPath FilePath - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) type role SymbolicPathX nominal nominal nominal @@ -214,6 +218,11 @@ type RelativePath = SymbolicPathX 'OnlyRelative -- until we interpret them (using e.g. 'interpretSymbolicPath'). type SymbolicPath = SymbolicPathX 'AllowAbsolute +newtype AbsolutePath (to :: FileOrDir) = AbsolutePath (forall from. SymbolicPath from to) + +unsafeMakeAbsolutePath :: FilePath -> AbsolutePath to +unsafeMakeAbsolutePath fp = AbsolutePath (makeSymbolicPath fp) + instance Binary (SymbolicPathX allowAbsolute from to) instance (Typeable allowAbsolute, Typeable from, Typeable to) @@ -289,7 +298,7 @@ moduleNameSymbolicPath modNm = SymbolicPath $ ModuleName.toFilePath modNm -- (because the program might expect certain paths to be relative). -- -- See Note [Symbolic paths] in Distribution.Utils.Path. -interpretSymbolicPath :: Maybe (SymbolicPath CWD (Dir Pkg)) -> SymbolicPathX allowAbsolute Pkg to -> FilePath +interpretSymbolicPath :: Maybe (SymbolicPath CWD (Dir from)) -> SymbolicPathX allowAbsolute from to -> FilePath interpretSymbolicPath mbWorkDir (SymbolicPath p) = -- Note that this properly handles an absolute symbolic path, -- because if @q@ is absolute, then @p q = q@. @@ -316,9 +325,15 @@ interpretSymbolicPath mbWorkDir (SymbolicPath p) = -- appropriate to use 'interpretSymbolicPathCWD' to provide its arguments. -- -- See Note [Symbolic paths] in Distribution.Utils.Path. -interpretSymbolicPathCWD :: SymbolicPathX allowAbsolute Pkg to -> FilePath +interpretSymbolicPathCWD :: SymbolicPathX allowAbsolute from to -> FilePath interpretSymbolicPathCWD (SymbolicPath p) = p +getAbsolutePath :: AbsolutePath to -> FilePath +getAbsolutePath (AbsolutePath p) = getSymbolicPath p + +interpretSymbolicPathAbsolute :: AbsolutePath (Dir Pkg) -> SymbolicPathX allowAbsolute Pkg to -> FilePath +interpretSymbolicPathAbsolute (AbsolutePath p) sym = interpretSymbolicPath (Just p) sym + -- | Change what a symbolic path is pointing to. coerceSymbolicPath :: SymbolicPathX allowAbsolute from to1 -> SymbolicPathX allowAbsolute from to2 coerceSymbolicPath = coerce @@ -342,17 +357,19 @@ symbolicPathRelative_maybe (SymbolicPath fp) = else Just $ SymbolicPath fp -- | Absolute path to the current working directory. -absoluteWorkingDir :: Maybe (SymbolicPath CWD to) -> IO FilePath -absoluteWorkingDir Nothing = Directory.getCurrentDirectory -absoluteWorkingDir (Just wd) = Directory.makeAbsolute $ getSymbolicPath wd +absoluteWorkingDir :: Maybe (SymbolicPath CWD to) -> IO (AbsolutePath to) +absoluteWorkingDir Nothing = unsafeMakeAbsolutePath <$> Directory.getCurrentDirectory +absoluteWorkingDir (Just wd) = unsafeMakeAbsolutePath <$> Directory.makeAbsolute (getSymbolicPath wd) --- | Try to make a path relative to the current working directory. +-- | Try to make a symbolic path relative. +-- +-- This function does nothing if the path is already relative. -- -- NB: this function may fail to make the path relative. -tryMakeRelativeToWorkingDir :: Maybe (SymbolicPath CWD (Dir dir)) -> SymbolicPath dir to -> IO (SymbolicPath dir to) -tryMakeRelativeToWorkingDir mbWorkDir (SymbolicPath fp) = do - wd <- absoluteWorkingDir mbWorkDir - return $ SymbolicPath (FilePath.makeRelative wd fp) +tryMakeRelative :: Maybe (SymbolicPath CWD (Dir dir)) -> SymbolicPath dir to -> IO (SymbolicPath dir to) +tryMakeRelative mbWorkDir (SymbolicPath fp) = do + AbsolutePath wd <- absoluteWorkingDir mbWorkDir + return $ SymbolicPath (FilePath.makeRelative (getSymbolicPath wd) fp) ------------------------------------------------------------------------------- @@ -422,6 +439,16 @@ instance where SymbolicPath p1 SymbolicPath p2 = SymbolicPath (p1 p2) +instance + (b1 ~ 'Dir b2, c2 ~ c3, midAbsolute ~ OnlyRelative) + => PathLike + (AbsolutePath b1) + (SymbolicPathX midAbsolute b2 c2) + (AbsolutePath c3) + where + AbsolutePath (SymbolicPath p1) SymbolicPath p2 = + unsafeMakeAbsolutePath (p1 p2) + -------------------------------------------------------------------------------- -- Abstract directory locations. @@ -499,3 +526,8 @@ data Tmp -- -- See Note [Symbolic paths] in Distribution.Utils.Path. data Response + +-- | Abstract directory: directory for pkg-config files. +-- +-- See Note [Symbolic paths] in Distribution.Utils.Path. +data PkgConf diff --git a/Cabal-syntax/src/Distribution/Utils/ShortText.hs b/Cabal-syntax/src/Distribution/Utils/ShortText.hs index 0b128de9698..e1aa36ff236 100644 --- a/Cabal-syntax/src/Distribution/Utils/ShortText.hs +++ b/Cabal-syntax/src/Distribution/Utils/ShortText.hs @@ -93,7 +93,7 @@ null :: ShortText -> Bool -- @since 2.0.0.2 #if HAVE_SHORTBYTESTRING newtype ShortText = ST { unST :: BS.Short.ShortByteString } - deriving (Eq,Ord,Generic,Data,Typeable) + deriving (Eq,Ord,Generic,Data) # if MIN_VERSION_binary(0,8,1) instance Binary ShortText where @@ -115,7 +115,7 @@ unsafeFromUTF8BS = ST . BS.Short.toShort null = BS.Short.null . unST #else newtype ShortText = ST { unST :: String } - deriving (Eq,Ord,Generic,Data,Typeable) + deriving (Eq,Ord,Generic,Data) instance Binary ShortText where put = put . encodeStringUtf8 . unST diff --git a/Cabal-syntax/src/Distribution/Utils/Structured.hs b/Cabal-syntax/src/Distribution/Utils/Structured.hs index ba10212bca1..630566ef648 100644 --- a/Cabal-syntax/src/Distribution/Utils/Structured.hs +++ b/Cabal-syntax/src/Distribution/Utils/Structured.hs @@ -2,9 +2,9 @@ {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE PolyKinds #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE TypeApplications #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-} @@ -106,8 +106,8 @@ import qualified Data.Aeson as Aeson #endif import Data.Kind (Type) +import Data.Typeable (TypeRep, Typeable, typeRep) -import Distribution.Compat.Typeable (TypeRep, Typeable, typeRep) import Distribution.Utils.MD5 import Data.Monoid (mconcat) @@ -276,7 +276,7 @@ structuredDecodeOrFailIO :: (Binary.Binary a, Structured a) => LBS.ByteString -> structuredDecodeOrFailIO bs = catch (evaluate (structuredDecode bs) >>= return . Right) handler where - handler (ErrorCallWithLocation str _) = return $ Left str + handler (ErrorCall str) = return $ Left str -- | Lazily reconstruct a value previously written to a file. structuredDecodeFileOrFail :: (Binary.Binary a, Structured a) => FilePath -> IO (Either String a) @@ -418,12 +418,42 @@ instance Structured a => Structured (Ratio a) where structure = containerStructu instance Structured a => Structured [a] where structure = containerStructure instance Structured a => Structured (NonEmpty a) where structure = containerStructure -instance (Structured a1, Structured a2) => Structured (a1, a2) -instance (Structured a1, Structured a2, Structured a3) => Structured (a1, a2, a3) -instance (Structured a1, Structured a2, Structured a3, Structured a4) => Structured (a1, a2, a3, a4) -instance (Structured a1, Structured a2, Structured a3, Structured a4, Structured a5) => Structured (a1, a2, a3, a4, a5) -instance (Structured a1, Structured a2, Structured a3, Structured a4, Structured a5, Structured a6) => Structured (a1, a2, a3, a4, a5, a6) -instance (Structured a1, Structured a2, Structured a3, Structured a4, Structured a5, Structured a6, Structured a7) => Structured (a1, a2, a3, a4, a5, a6, a7) +-- These instances are defined directly because the generic names for tuples changed +-- in 9.6 (https://gitlab.haskell.org/ghc/ghc/-/issues/24291). +-- +-- By defining our own instances the STuple2 identifier will be used in the hash and +-- hence the same on all GHC versions. + +data STuple2 a b = STuple2 a b deriving (Generic) +data STuple3 a b c = STuple3 a b c deriving (Generic) +data STuple4 a b c d = STuple4 a b c d deriving (Generic) +data STuple5 a b c d e = STuple5 a b c d e deriving (Generic) +data STuple6 a b c d e f = STuple6 a b c d e f deriving (Generic) +data STuple7 a b c d e f g = STuple7 a b c d e f g deriving (Generic) + +instance (Structured a1, Structured a2) => Structured (STuple2 a1 a2) +instance (Structured a1, Structured a2) => Structured (a1, a2) where + structure Proxy = structure @(STuple2 a1 a2) Proxy + +instance (Structured a1, Structured a2, Structured a3) => Structured (STuple3 a1 a2 a3) +instance (Structured a1, Structured a2, Structured a3) => Structured (a1, a2, a3) where + structure Proxy = structure @(STuple3 a1 a2 a3) Proxy + +instance (Structured a1, Structured a2, Structured a3, Structured a4) => Structured (STuple4 a1 a2 a3 a4) +instance (Structured a1, Structured a2, Structured a3, Structured a4) => Structured (a1, a2, a3, a4) where + structure Proxy = structure @(STuple4 a1 a2 a3 a4) Proxy + +instance (Structured a1, Structured a2, Structured a3, Structured a4, Structured a5) => Structured (STuple5 a1 a2 a3 a4 a5) +instance (Structured a1, Structured a2, Structured a3, Structured a4, Structured a5) => Structured (a1, a2, a3, a4, a5) where + structure Proxy = structure @(STuple5 a1 a2 a3 a4 a5) Proxy + +instance (Structured a1, Structured a2, Structured a3, Structured a4, Structured a5, Structured a6) => Structured (STuple6 a1 a2 a3 a4 a5 a6) +instance (Structured a1, Structured a2, Structured a3, Structured a4, Structured a5, Structured a6) => Structured (a1, a2, a3, a4, a5, a6) where + structure Proxy = structure @(STuple6 a1 a2 a3 a4 a5 a6) Proxy + +instance (Structured a1, Structured a2, Structured a3, Structured a4, Structured a5, Structured a6, Structured a7) => Structured (STuple7 a1 a2 a3 a4 a5 a6 a7) +instance (Structured a1, Structured a2, Structured a3, Structured a4, Structured a5, Structured a6, Structured a7) => Structured (a1, a2, a3, a4, a5, a6, a7) where + structure Proxy = structure @(STuple7 a1 a2 a3 a4 a5 a6 a7) Proxy instance Structured BS.ByteString where structure = nominalStructure instance Structured LBS.ByteString where structure = nominalStructure diff --git a/Cabal-syntax/src/Distribution/Version.hs b/Cabal-syntax/src/Distribution/Version.hs index 80383358037..76aed461228 100644 --- a/Cabal-syntax/src/Distribution/Version.hs +++ b/Cabal-syntax/src/Distribution/Version.hs @@ -50,6 +50,9 @@ module Distribution.Version , stripParensVersionRange , hasUpperBound , hasLowerBound + , hasLEUpperBound + , hasTrailingZeroUpperBound + , hasGTLowerBound -- ** Cata & ana , VersionRangeF (..) diff --git a/Cabal-syntax/src/Language/Haskell/Extension.hs b/Cabal-syntax/src/Language/Haskell/Extension.hs index 22082d6d0b3..c2a83f77aca 100644 --- a/Cabal-syntax/src/Language/Haskell/Extension.hs +++ b/Cabal-syntax/src/Language/Haskell/Extension.hs @@ -59,7 +59,7 @@ data Language GHC2024 | -- | An unknown language, identified by its name. UnknownLanguage String - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Binary Language instance Structured Language @@ -115,7 +115,7 @@ data Extension | -- | An unknown extension, identified by the name of its @LANGUAGE@ -- pragma. UnknownExtension String - deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) + deriving (Generic, Show, Read, Eq, Ord, Data) instance Binary Extension instance Structured Extension @@ -551,7 +551,12 @@ data KnownExtension | -- | Allow the use of built-in syntax for list, tuple and sum type constructors -- rather than being exclusive to data constructors. ListTuplePuns - deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded, Typeable, Data) + | -- | Support multiline strings. + MultilineStrings + | -- | Allow use of or-pattern syntax, condensing multiple patterns + -- into a single one. + OrPatterns + deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded, Data) instance Binary KnownExtension instance Structured KnownExtension diff --git a/Cabal-tests/Cabal-tests.cabal b/Cabal-tests/Cabal-tests.cabal index f48222332f4..60ae8828610 100644 --- a/Cabal-tests/Cabal-tests.cabal +++ b/Cabal-tests/Cabal-tests.cabal @@ -52,12 +52,11 @@ test-suite unit-tests UnitTests.Distribution.Utils.ShortText UnitTests.Distribution.Utils.Structured UnitTests.Distribution.Version - UnitTests.Orphans main-is: UnitTests.hs build-depends: array - , base >=4.11 && <5 + , base >=4.13 && <5 , bytestring , Cabal , Cabal-described @@ -71,7 +70,7 @@ test-suite unit-tests , QuickCheck >=2.14 && <2.15 , tasty >=1.2.3 && <1.6 , tasty-hunit - , tasty-quickcheck + , tasty-quickcheck <0.12 , temporary , text @@ -150,6 +149,7 @@ test-suite hackage-tests , deepseq , directory , filepath + , time build-depends: base-compat >=0.11.0 && <0.14 @@ -176,7 +176,7 @@ test-suite rpmvercmp QuickCheck , tasty >=1.2.3 && <1.6 , tasty-hunit - , tasty-quickcheck + , tasty-quickcheck <0.12 c-sources: tests/cbits/rpmvercmp.c cc-options: -Wall diff --git a/Cabal-tests/lib/Test/Utils/TempTestDir.hs b/Cabal-tests/lib/Test/Utils/TempTestDir.hs index a4b0b08cba4..7d1ca76e04f 100644 --- a/Cabal-tests/lib/Test/Utils/TempTestDir.hs +++ b/Cabal-tests/lib/Test/Utils/TempTestDir.hs @@ -2,11 +2,12 @@ module Test.Utils.TempTestDir ( withTestDir + , withTestDir' , removeDirectoryRecursiveHack ) where import Distribution.Compat.Internal.TempFile (createTempDirectory) -import Distribution.Simple.Utils (warn) +import Distribution.Simple.Utils (warn, TempFileOptions (..), defaultTempFileOptions) import Distribution.Verbosity import Control.Concurrent (threadDelay) @@ -23,12 +24,26 @@ import qualified System.Info (os) -- | Much like 'withTemporaryDirectory' but with a number of hacks to make -- sure on windows that we can clean up the directory at the end. withTestDir :: (MonadIO m, MonadMask m) => Verbosity -> String -> (FilePath -> m a) -> m a -withTestDir verbosity template action = do - systmpdir <- liftIO getTemporaryDirectory +withTestDir verbosity template action = withTestDir' verbosity defaultTempFileOptions template action + +withTestDir' :: (MonadIO m, MonadMask m) => Verbosity -> TempFileOptions -> String -> (FilePath -> m a) -> m a +withTestDir' verbosity tempFileOpts template action = do + systmpdir <- + -- MacOS returns /var/folders/... which is a symlink (/var -> /private/var), + -- so the test-suite struggles to make the build cwd-agnostic in particular + -- for the ShowBuildInfo tests. This canonicalizePath call makes it + -- /private/var/folders/... which will work. + liftIO $ canonicalizePath =<< getTemporaryDirectory bracket ( do { tmpRelDir <- liftIO $ createTempDirectory systmpdir template ; return $ systmpdir tmpRelDir } ) - (liftIO . removeDirectoryRecursiveHack verbosity) + (liftIO + -- This ensures that the temp files are not deleted at the end of the test. + -- It replicates the behavior of @withTempDirectoryEx@. + . when (not (optKeepTempFiles tempFileOpts)) + -- This is the bit that helps with Windows deleting all files. + . removeDirectoryRecursiveHack verbosity + ) action -- | On Windows, file locks held by programs we run (in this case VCSs) diff --git a/Cabal-tests/tests/HackageTests.hs b/Cabal-tests/tests/HackageTests.hs index 9bff0ce05cc..e400e73629d 100644 --- a/Cabal-tests/tests/HackageTests.hs +++ b/Cabal-tests/tests/HackageTests.hs @@ -33,6 +33,7 @@ import System.FilePath (()) import Data.Orphans () import qualified Codec.Archive.Tar as Tar +import qualified Codec.Archive.Tar.Entry as Tar import qualified Data.ByteString as B import qualified Data.ByteString.Char8 as B8 import qualified Data.ByteString.Lazy as BSL @@ -56,11 +57,14 @@ import Data.TreeDiff.Instances.Cabal () import Data.TreeDiff.Pretty (ansiWlEditExprCompact) #endif +import Data.Time.Clock.System +import Data.Time.Format + ------------------------------------------------------------------------------- -- parseIndex: Index traversal ------------------------------------------------------------------------------- -parseIndex :: (Monoid a, NFData a) => (FilePath -> Bool) +parseIndex :: (Monoid a, NFData a) => (Tar.EpochTime -> FilePath -> Bool) -> (FilePath -> B.ByteString -> IO a) -> IO a parseIndex predicate action = do configPath <- getCabalConfigPath @@ -99,7 +103,7 @@ parseIndex predicate action = do parseIndex' :: (Monoid a, NFData a) - => (FilePath -> Bool) + => (Tar.EpochTime -> FilePath -> Bool) -> (FilePath -> B.ByteString -> IO a) -> FilePath -> IO a parseIndex' predicate action path = do putStrLn $ "Reading index from: " ++ path @@ -110,7 +114,7 @@ parseIndex' predicate action path = do where cons entry entries - | predicate (Tar.entryPath entry) = entry : entries + | predicate (Tar.entryTime entry) (Tar.entryPath entry) = entry : entries | otherwise = entries f entry = case Tar.entryContent entry of @@ -320,6 +324,13 @@ main = join (O.execParser opts) , O.progDesc "tests using Hackage's index" ] + indexP = + fmap cvt <$> O.optional (O.strOption (O.long "index-state" <> O.metavar "YYYY-MM-DD")) + where + cvt = + systemSeconds . utcToSystemTime . + parseTimeOrError False defaultTimeLocale "%Y-%m-%d" + optsP = subparser [ command "read-fields" readFieldsP "Parse outer format (to '[Field]', TODO: apply Quirks)" @@ -330,20 +341,20 @@ main = join (O.execParser opts) defaultA = do putStrLn "Default action: parsec k" - parsecA (mkPredicate ["k"]) False + parsecA ["k"] False Nothing - readFieldsP = readFieldsA <$> prefixP - readFieldsA pfx = parseIndex pfx readFieldTest + readFieldsP = readFieldsA <$> prefixP <*> indexP + readFieldsA pfx idx = parseIndex (mkPredicate pfx idx) readFieldTest - parsecP = parsecA <$> prefixP <*> keepGoingP + parsecP = parsecA <$> prefixP <*> keepGoingP <*> indexP keepGoingP = O.flag' True (O.long "keep-going") <|> O.flag' False (O.long "no-keep-going") <|> pure False - parsecA pfx keepGoing = do + parsecA pfx keepGoing idx = do begin <- Clock.getTime Clock.Monotonic - ParsecResult n w f <- parseIndex pfx (parseParsecTest keepGoing) + ParsecResult n w f <- parseIndex (mkPredicate pfx idx) (parseParsecTest keepGoing) end <- Clock.getTime Clock.Monotonic let diff = Clock.toNanoSecs $ Clock.diffTimeSpec end begin @@ -353,14 +364,14 @@ main = join (O.execParser opts) putStrLn $ showFFloat (Just 6) (fromInteger diff / 1e9 :: Double) " seconds elapsed" putStrLn $ showFFloat (Just 6) (fromInteger diff / 1e6 / fromIntegral n :: Double) " milliseconds per file" - roundtripP = roundtripA <$> prefixP <*> testFieldsP - roundtripA pfx testFieldsTransform = do - Sum n <- parseIndex pfx (roundtripTest testFieldsTransform) + roundtripP = roundtripA <$> prefixP <*> testFieldsP <*> indexP + roundtripA pfx testFieldsTransform idx = do + Sum n <- parseIndex (mkPredicate pfx idx) (roundtripTest testFieldsTransform) putStrLn $ show n ++ " files processed" - checkP = checkA <$> prefixP - checkA pfx = do - CheckResult n w x a b c d e <- parseIndex pfx parseCheckTest + checkP = checkA <$> prefixP <*> indexP + checkA pfx idx = do + CheckResult n w x a b c d e <- parseIndex (mkPredicate pfx idx) parseCheckTest putStrLn $ show n ++ " files processed" putStrLn $ show w ++ " files have lexer/parser warnings" putStrLn $ show x ++ " files have check warnings" @@ -370,7 +381,7 @@ main = join (O.execParser opts) putStrLn $ show d ++ " build dist suspicious warning" putStrLn $ show e ++ " build dist inexcusable" - prefixP = fmap mkPredicate $ many $ O.strArgument $ mconcat + prefixP = many $ O.strArgument $ mconcat [ O.metavar "PREFIX" , O.help "Check only files starting with a prefix" ] @@ -380,8 +391,14 @@ main = join (O.execParser opts) , O.help "Test also 'showFields . fromParsecFields . readFields' transform" ] - mkPredicate [] = const True - mkPredicate pfxs = \n -> any (`isPrefixOf` n) pfxs + indexPredicate :: Maybe Tar.EpochTime -> (k -> Bool) -> (Tar.EpochTime -> k -> Bool) + indexPredicate Nothing k = const k + indexPredicate (Just indexDate) k = + \e -> if (e <= indexDate) then k else const False + + mkPredicate :: [String] -> Maybe Tar.EpochTime -> (Tar.EpochTime -> FilePath -> Bool) + mkPredicate [] idx = indexPredicate idx (const True) + mkPredicate pfxs idx = indexPredicate idx (\n -> any (`isPrefixOf` n) pfxs) command name p desc = O.command name (O.info (p <**> O.helper) (O.progDesc desc)) diff --git a/Cabal-tests/tests/ParserTests.hs b/Cabal-tests/tests/ParserTests.hs index 981be3b4cce..3a87df99481 100644 --- a/Cabal-tests/tests/ParserTests.hs +++ b/Cabal-tests/tests/ParserTests.hs @@ -140,7 +140,7 @@ errorTest fp = cabalGoldenTest fp correct $ do return $ toUTF8BS $ case x of Right gpd -> - "UNXPECTED SUCCESS\n" ++ + "UNEXPECTED SUCCESS\n" ++ showGenericPackageDescription gpd Left (v, errs) -> unlines $ ("VERSION: " ++ show v) : map (showPError fp) (NE.toList errs) diff --git a/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr b/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr index 3d03421210b..04f54ea5d93 100644 --- a/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr +++ b/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr @@ -66,7 +66,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -132,6 +133,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -238,6 +241,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -339,6 +344,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/anynone.expr b/Cabal-tests/tests/ParserTests/regressions/anynone.expr index 3191425d609..919f554180a 100644 --- a/Cabal-tests/tests/ParserTests/regressions/anynone.expr +++ b/Cabal-tests/tests/ParserTests/regressions/anynone.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -95,6 +96,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/big-version.expr b/Cabal-tests/tests/ParserTests/regressions/big-version.expr index e677de20626..c219ac95241 100644 --- a/Cabal-tests/tests/ParserTests/regressions/big-version.expr +++ b/Cabal-tests/tests/ParserTests/regressions/big-version.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -96,6 +97,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr b/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr index f6ffe291e59..8969ff6f5fa 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr @@ -44,7 +44,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { @@ -112,6 +113,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -187,6 +190,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -278,6 +283,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -356,6 +363,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -432,6 +441,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -501,6 +512,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -593,6 +606,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -670,6 +685,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/common.expr b/Cabal-tests/tests/ParserTests/regressions/common.expr index e0eb4a1dde7..e39820ec833 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common.expr @@ -47,7 +47,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -110,6 +111,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -186,6 +189,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/common2.expr b/Cabal-tests/tests/ParserTests/regressions/common2.expr index b3cb004eecb..ae85c83ea2b 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common2.expr @@ -43,7 +43,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -106,6 +107,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -205,6 +208,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -285,6 +290,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -386,6 +393,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -462,6 +471,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -562,6 +573,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -639,6 +652,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -716,6 +731,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/common3.expr b/Cabal-tests/tests/ParserTests/regressions/common3.expr index 21b200baa7b..5436936b3a2 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common3.expr @@ -47,7 +47,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -110,6 +111,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -186,6 +189,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/elif.expr b/Cabal-tests/tests/ParserTests/regressions/elif.expr index 1315d689467..5bf616b7c15 100644 --- a/Cabal-tests/tests/ParserTests/regressions/elif.expr +++ b/Cabal-tests/tests/ParserTests/regressions/elif.expr @@ -42,7 +42,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -105,6 +106,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -172,6 +175,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/elif2.expr b/Cabal-tests/tests/ParserTests/regressions/elif2.expr index 61f2177cbaa..f0ecd6bb111 100644 --- a/Cabal-tests/tests/ParserTests/regressions/elif2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/elif2.expr @@ -42,7 +42,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -105,6 +106,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -172,6 +175,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -245,6 +250,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -312,6 +319,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -385,6 +394,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr b/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr index e1b125e7a32..4e45a86b8c4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr +++ b/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr @@ -47,7 +47,8 @@ GenericPackageDescription { SymbolicPath "--", SymbolicPath "--"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -114,6 +115,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr b/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr index 9084371a614..60be619bd16 100644 --- a/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr +++ b/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr @@ -123,7 +123,8 @@ GenericPackageDescription { extraSrcFiles = [ SymbolicPath "CHANGELOG.md"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -242,6 +243,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -373,6 +376,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -457,6 +462,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -561,6 +568,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -631,6 +640,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -702,6 +713,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [ @@ -798,6 +811,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr b/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr index 346af927d1b..7eea76ce8c1 100644 --- a/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr +++ b/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr @@ -54,7 +54,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { @@ -322,6 +323,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -642,6 +645,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -884,6 +889,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1084,6 +1091,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1438,6 +1447,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -2740,6 +2751,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -2829,6 +2842,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -5072,6 +5087,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -6424,6 +6441,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -6514,6 +6533,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -8182,6 +8203,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -8670,6 +8693,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -9433,6 +9458,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -9554,6 +9581,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -9659,6 +9688,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -9764,6 +9795,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -9858,6 +9891,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -9978,6 +10013,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr b/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr index fba99528b53..3e67f519199 100644 --- a/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr +++ b/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -97,6 +98,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation.expr b/Cabal-tests/tests/ParserTests/regressions/indentation.expr index e5b106dc5cd..ea8c219ca0a 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation.expr @@ -44,7 +44,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -106,6 +107,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation2.expr b/Cabal-tests/tests/ParserTests/regressions/indentation2.expr index 46f24105f0f..f26c9a4e005 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation2.expr @@ -37,7 +37,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -99,6 +100,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation3.expr b/Cabal-tests/tests/ParserTests/regressions/indentation3.expr index 0191d063f6e..08db6b1fec6 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation3.expr @@ -39,7 +39,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -101,6 +102,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr b/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr index 07c04ec6cb9..03fab0246e4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Nothing, @@ -100,6 +101,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -183,6 +186,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -267,6 +272,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr b/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr index 2ff7de7917e..0d031503a53 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -94,6 +95,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-5846.format b/Cabal-tests/tests/ParserTests/regressions/issue-5846.format index 749a9c20524..93e53fc48bd 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-5846.format +++ b/Cabal-tests/tests/ParserTests/regressions/issue-5846.format @@ -5,7 +5,7 @@ version: 5846 library default-language: Haskell2010 build-depends: - lib1:{a, b}, + lib1:{a,b}, lib2:c, lib3:d >=1, - lib4:{a, b} >=1 + lib4:{a,b} >=1 diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr index 43c345dd170..bbe56f81a5c 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -94,6 +95,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -189,6 +192,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -255,6 +260,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -335,6 +342,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr index e6606851627..17b9f8319bb 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -94,6 +95,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -189,6 +192,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -255,6 +260,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -345,6 +352,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr index 7435b0d59b4..8db694b7389 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -94,6 +95,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -189,6 +192,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr index a221632efa4..26a3c260959 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -94,6 +95,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-774.expr b/Cabal-tests/tests/ParserTests/regressions/issue-774.expr index e1ffb85dceb..a9b2fc7bcc3 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-774.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-774.expr @@ -41,7 +41,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -108,6 +109,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-8646.cabal b/Cabal-tests/tests/ParserTests/regressions/issue-8646.cabal index d631357925f..c7576037132 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-8646.cabal +++ b/Cabal-tests/tests/ParserTests/regressions/issue-8646.cabal @@ -11,6 +11,6 @@ license: BSD-3-Clause executable test main-is: ExeMain.hs - build-depends: base > 4 && < 5 + build-depends: base >= 4 && < 5 default-language: Haskell2010 ghc-options: -main-is ExeMain diff --git a/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr b/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr index c9e675ceb76..fd9b1fa3a28 100644 --- a/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr +++ b/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr @@ -73,7 +73,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -139,6 +140,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -238,6 +241,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -403,6 +408,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr b/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr index 0bb5556b2f4..37bb5adfea5 100644 --- a/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -104,6 +105,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr b/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr index b1ba1b282f4..6b31a91ecc4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr +++ b/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -97,6 +98,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/libpq1.expr b/Cabal-tests/tests/ParserTests/regressions/libpq1.expr index 8906a91f63b..db39305d20f 100644 --- a/Cabal-tests/tests/ParserTests/regressions/libpq1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/libpq1.expr @@ -111,7 +111,8 @@ GenericPackageDescription { "cbits/noticehandlers.h", SymbolicPath "CHANGELOG.md"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { @@ -190,6 +191,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -289,6 +292,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -373,6 +378,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -464,6 +471,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -529,6 +538,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -596,6 +607,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -661,6 +674,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -728,6 +743,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/libpq2.expr b/Cabal-tests/tests/ParserTests/regressions/libpq2.expr index 3c26ece45ad..80b558d0b91 100644 --- a/Cabal-tests/tests/ParserTests/regressions/libpq2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/libpq2.expr @@ -115,7 +115,8 @@ GenericPackageDescription { "cbits/noticehandlers.h", SymbolicPath "CHANGELOG.md"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { @@ -195,6 +196,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -294,6 +297,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -378,6 +383,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -466,6 +473,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -531,6 +540,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -598,6 +609,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -663,6 +676,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -730,6 +745,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr index de8a15f04c0..b8372437dd6 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Nothing, @@ -98,6 +99,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr index 3bf06bc9c3b..a4d3459be3d 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Nothing, @@ -98,6 +99,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr index 0c0fc57a8b8..2b1d37c79e9 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Nothing, @@ -98,6 +99,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/monad-param.expr b/Cabal-tests/tests/ParserTests/regressions/monad-param.expr index 28d57c1e3b0..aaeb1af1044 100644 --- a/Cabal-tests/tests/ParserTests/regressions/monad-param.expr +++ b/Cabal-tests/tests/ParserTests/regressions/monad-param.expr @@ -42,7 +42,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -120,6 +121,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr b/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr index a8c6b0c0c4a..dc6371bc75c 100644 --- a/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -97,6 +98,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -175,6 +178,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/noVersion.expr b/Cabal-tests/tests/ParserTests/regressions/noVersion.expr index 8187272c2c0..0d5bf636569 100644 --- a/Cabal-tests/tests/ParserTests/regressions/noVersion.expr +++ b/Cabal-tests/tests/ParserTests/regressions/noVersion.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -97,6 +98,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr b/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr index 2f2663733c6..f6a8c64a566 100644 --- a/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr +++ b/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr @@ -44,7 +44,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { @@ -112,6 +113,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -179,6 +182,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/shake.expr b/Cabal-tests/tests/ParserTests/regressions/shake.expr index 8dd849d75bd..560c38e1dc4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/shake.expr +++ b/Cabal-tests/tests/ParserTests/regressions/shake.expr @@ -149,7 +149,8 @@ GenericPackageDescription { extraTmpFiles = [], extraDocFiles = [ SymbolicPath "CHANGES.txt", - SymbolicPath "README.md"]}, + SymbolicPath "README.md"], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { @@ -306,6 +307,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -519,6 +522,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -586,6 +591,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -660,6 +667,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -727,6 +736,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -805,6 +816,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -982,6 +995,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1206,6 +1221,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1271,6 +1288,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1335,6 +1354,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1406,6 +1427,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1470,6 +1493,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1545,6 +1570,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1764,6 +1791,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -1992,6 +2021,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -2061,6 +2092,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -2130,6 +2163,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -2198,6 +2233,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -2273,6 +2310,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -2341,6 +2380,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -2420,6 +2461,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr index 2ca07bf2322..24f0aff227a 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr @@ -33,7 +33,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -95,6 +96,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr index 9c50edd4864..992486c3be5 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr @@ -37,7 +37,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -99,6 +100,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr index 944faa4c0c0..f38e0b24b30 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr @@ -37,7 +37,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -99,6 +100,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr b/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr index 8f2edf09a36..fa6fd5ee308 100644 --- a/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr +++ b/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr @@ -61,7 +61,8 @@ GenericPackageDescription { SymbolicPath ".vim.custom", SymbolicPath "README.md"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -127,6 +128,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -298,6 +301,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -473,6 +478,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -577,6 +584,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/version-sets.expr b/Cabal-tests/tests/ParserTests/regressions/version-sets.expr index b134e4584ad..8983fa4ea73 100644 --- a/Cabal-tests/tests/ParserTests/regressions/version-sets.expr +++ b/Cabal-tests/tests/ParserTests/regressions/version-sets.expr @@ -59,7 +59,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -121,6 +122,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr b/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr index 03959b195c0..a8b4fa3c604 100644 --- a/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr +++ b/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr @@ -51,7 +51,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just @@ -114,6 +115,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], @@ -202,6 +205,8 @@ GenericPackageDescription { [], sharedOptions = PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], staticOptions = PerCompilerFlavor [] [], customFieldsBI = [], diff --git a/Cabal-tests/tests/UnitTests.hs b/Cabal-tests/tests/UnitTests.hs index cc0099175a8..4c26e3e92a8 100644 --- a/Cabal-tests/tests/UnitTests.hs +++ b/Cabal-tests/tests/UnitTests.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} module Main ( main ) where @@ -7,7 +6,6 @@ import Test.Tasty import Test.Tasty.Options import Data.Proxy -import Data.Typeable import Distribution.Simple.Utils import Distribution.Verbosity @@ -90,7 +88,6 @@ extraOptions = ] newtype OptionMtimeChangeDelay = OptionMtimeChangeDelay Int - deriving Typeable instance IsOption OptionMtimeChangeDelay where defaultValue = OptionMtimeChangeDelay 0 @@ -100,7 +97,6 @@ instance IsOption OptionMtimeChangeDelay where ++ "file modification, in microseconds" newtype GhcPath = GhcPath FilePath - deriving Typeable instance IsOption GhcPath where defaultValue = GhcPath "ghc" diff --git a/Cabal-tests/tests/UnitTests/Distribution/PkgconfigVersion.hs b/Cabal-tests/tests/UnitTests/Distribution/PkgconfigVersion.hs index bccc25f7a72..8f2d32e0779 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/PkgconfigVersion.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/PkgconfigVersion.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE StandaloneDeriving #-} module UnitTests.Distribution.PkgconfigVersion (pkgconfigVersionTests) where import Test.Tasty diff --git a/Cabal-tests/tests/UnitTests/Distribution/SPDX.hs b/Cabal-tests/tests/UnitTests/Distribution/SPDX.hs index c0b339e83af..b9454c20d20 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/SPDX.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/SPDX.hs @@ -91,7 +91,7 @@ shouldReject = map License -- -- * "WITH exc" exceptions are rejected -- --- * There should be a way to interpert license as (conjunction of) +-- * There should be a way to interpret license as (conjunction of) -- OSI-accepted licenses or CC0 -- isAcceptableLicense :: License -> Bool diff --git a/Cabal-tests/tests/UnitTests/Distribution/Simple/Glob.hs b/Cabal-tests/tests/UnitTests/Distribution/Simple/Glob.hs index fce1ffbc050..c07fbb38623 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Simple/Glob.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Simple/Glob.hs @@ -107,13 +107,13 @@ testMatchesVersion version pat expected = do -- check can't identify that kind of match. expected' = filter (\case GlobMatchesDirectory _ -> False; _ -> True) expected unless (sort expected' == sort actual) $ - assertFailure $ "Unexpected result (pure matcher): " ++ show actual + assertFailure $ "Unexpected result (pure matcher): " ++ show actual ++ "\nExpected: " ++ show expected checkIO globPat = withSystemTempDirectory "globstar-sample" $ \tmpdir -> do makeSampleFiles tmpdir actual <- runDirFileGlob Verbosity.normal (Just version) tmpdir globPat unless (isEqual actual expected) $ - assertFailure $ "Unexpected result (impure matcher): " ++ show actual + assertFailure $ "Unexpected result (impure matcher): " ++ show actual ++ "\nExpected: " ++ show expected testFailParseVersion :: CabalSpecVersion -> FilePath -> GlobSyntaxError -> Assertion testFailParseVersion version pat expected = diff --git a/Cabal-tests/tests/UnitTests/Distribution/Simple/Utils.hs b/Cabal-tests/tests/UnitTests/Distribution/Simple/Utils.hs index 2e544c8c52d..48e8aae9c1d 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Simple/Utils.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Simple/Utils.hs @@ -23,16 +23,14 @@ import Test.Tasty.HUnit withTempFileTest :: Assertion withTempFileTest = do fileName <- newIORef "" - tempDir <- getTemporaryDirectory - withTempFile tempDir ".foo" $ \fileName' _handle -> do + withTempFile ".foo" $ \fileName' _handle -> do writeIORef fileName fileName' fileExists <- readIORef fileName >>= doesFileExist assertBool "Temporary file not deleted by 'withTempFile'!" (not fileExists) withTempFileRemovedTest :: Assertion withTempFileRemovedTest = do - tempDir <- getTemporaryDirectory - withTempFile tempDir ".foo" $ \fileName handle -> do + withTempFile ".foo" $ \fileName handle -> do hClose handle removeFile fileName @@ -58,9 +56,8 @@ rawSystemStdInOutTextDecodingTest ghcPath -- so skip the test if it's not. | show localeEncoding /= "UTF-8" = return () | otherwise = do - tempDir <- getTemporaryDirectory - res <- withTempFile tempDir ".hs" $ \filenameHs handleHs -> do - withTempFile tempDir ".exe" $ \filenameExe handleExe -> do + res <- withTempFile ".hs" $ \filenameHs handleHs -> do + withTempFile ".exe" $ \filenameExe handleExe -> do -- Small program printing not utf8 hPutStrLn handleHs "import Data.ByteString" hPutStrLn handleHs "main = Data.ByteString.putStr (Data.ByteString.pack [32, 32, 255])" diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs index c2180b630b7..a7d629ccb08 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/CharSet.hs @@ -1,8 +1,4 @@ {-# LANGUAGE CPP #-} --- isAlpha and isAlphaNum definitions change from base to base -#if MIN_VERSION_base(4,12,0) && !MIN_VERSION_base(4,13,0) -#define HAS_TESTS -#endif module UnitTests.Distribution.Utils.CharSet where import Prelude hiding (Foldable(..)) diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs index 641551473e8..7daee1b53f8 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs @@ -13,8 +13,6 @@ import Distribution.Types.VersionRange (VersionRange) import Distribution.Types.GenericPackageDescription (GenericPackageDescription) import Distribution.Types.LocalBuildInfo (LocalBuildInfo) -import UnitTests.Orphans () - tests :: TestTree tests = testGroup "Distribution.Utils.Structured" -- This test also verifies that structureHash doesn't loop. @@ -32,16 +30,8 @@ md5Check proxy md5Int = structureHash proxy @?= md5FromInteger md5Int md5CheckGenericPackageDescription :: Proxy GenericPackageDescription -> Assertion md5CheckGenericPackageDescription proxy = md5Check proxy -#if MIN_VERSION_base(4,19,0) - 0x4acd7857947385180d814f36dc1a759e -#else - 0x3ff3fa6c3c570bcafa10b457b1208cc8 -#endif + 0x09251b46ffc5178a7526d31e794d9c62 md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion md5CheckLocalBuildInfo proxy = md5Check proxy -#if MIN_VERSION_base(4,19,0) - 0x552eca9ce2e4a34e74deff571f279fc4 -#else - 0x48497d6b3f15df06f1107b81b98febe1 -#endif + 0x8fa7b2c8cc611407bfdcb734ecb460a2 diff --git a/Cabal-tests/tests/UnitTests/Distribution/Version.hs b/Cabal-tests/tests/UnitTests/Distribution/Version.hs index 27d9f440af8..9bfcfc0e143 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Version.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Version.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE StandaloneDeriving #-} {-# OPTIONS_GHC -fno-warn-incomplete-patterns -fno-warn-deprecations -fno-warn-unused-binds #-} --FIXME diff --git a/Cabal-tests/tests/UnitTests/Orphans.hs b/Cabal-tests/tests/UnitTests/Orphans.hs deleted file mode 100644 index d6b49a91929..00000000000 --- a/Cabal-tests/tests/UnitTests/Orphans.hs +++ /dev/null @@ -1,10 +0,0 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE StandaloneDeriving #-} -{-# OPTIONS_GHC -fno-warn-orphans #-} -module UnitTests.Orphans where - -#if !MIN_VERSION_base(4,7,0) -import GHC.Fingerprint (Fingerprint (..)) - -deriving instance Show Fingerprint -#endif diff --git a/Cabal-tests/tests/custom-setup/CabalDoctestSetup.hs b/Cabal-tests/tests/custom-setup/CabalDoctestSetup.hs index a89ce9b36e7..a6a59c144c9 100644 --- a/Cabal-tests/tests/custom-setup/CabalDoctestSetup.hs +++ b/Cabal-tests/tests/custom-setup/CabalDoctestSetup.hs @@ -103,7 +103,7 @@ import Distribution.Simple (UserHooks (..), autoconfUserHooks, defaultMainWithHooks, simpleUserHooks) import Distribution.Simple.Compiler - (CompilerFlavor (GHC), CompilerId (..), PackageDB (..), compilerId) + (CompilerFlavor (GHC), CompilerId (..), PackageDB, PackageDBX (..), compilerId) import Distribution.Simple.LocalBuildInfo (ComponentLocalBuildInfo (componentPackageDeps), LocalBuildInfo, compiler, withExeLBI, withLibLBI, withPackageDB, withTestLBI @@ -119,8 +119,6 @@ import Distribution.Simple.Utils import Distribution.Text (display) import Distribution.Verbosity -import System.FilePath - (()) import qualified Data.Foldable as F (for_) @@ -160,7 +158,9 @@ import Distribution.Package import Distribution.Utils.Path ( SymbolicPathX , makeSymbolicPath - , makeRelativePathEx ) + , makeRelativePathEx + , interpretSymbolicPathCWD + , ()) import qualified Distribution.Utils.Path as Cabal (getSymbolicPath) import Distribution.Simple.Utils @@ -336,7 +336,7 @@ generateBuildModule testSuiteName flags pkg lbi = do let distPref = fromFlag (buildDistPref flags) -- Package DBs & environments - let dbStack = withPackageDB lbi ++ [ SpecificPackageDB $ toFilePath distPref "package.conf.inplace" ] + let dbStack = withPackageDB lbi ++ [ SpecificPackageDB $ distPref makeRelativePathEx "package.conf.inplace" ] let dbFlags = "-hide-all-packages" : packageDbArgs dbStack let envFlags | ghcCanBeToldToIgnorePkgEnvs = [ "-package-env=-" ] @@ -539,7 +539,7 @@ generateBuildModule testSuiteName flags pkg lbi = do : concatMap specific dbs _ -> ierror where - specific (SpecificPackageDB db) = [ "-package-conf=" ++ db ] + specific (SpecificPackageDB db) = [ "-package-conf=" ++ interpretSymbolicPathCWD db ] specific _ = ierror ierror = error $ "internal error: unexpected package db stack: " ++ show dbstack @@ -557,7 +557,7 @@ generateBuildModule testSuiteName flags pkg lbi = do dbs -> "-clear-package-db" : concatMap single dbs where - single (SpecificPackageDB db) = [ "-package-db=" ++ db ] + single (SpecificPackageDB db) = [ "-package-db=" ++ interpretSymbolicPathCWD db ] single GlobalPackageDB = [ "-global-package-db" ] single UserPackageDB = [ "-user-package-db" ] isSpecific (SpecificPackageDB _) = True diff --git a/Cabal-tests/tests/custom-setup/IdrisSetup.hs b/Cabal-tests/tests/custom-setup/IdrisSetup.hs index 952be052961..339f9fd9c38 100644 --- a/Cabal-tests/tests/custom-setup/IdrisSetup.hs +++ b/Cabal-tests/tests/custom-setup/IdrisSetup.hs @@ -45,10 +45,6 @@ module IdrisSetup (main) where # define MIN_VERSION_Cabal(x,y,z) 0 #endif -#if !defined(MIN_VERSION_base) -# define MIN_VERSION_base(x,y,z) 0 -#endif - import Control.Monad import Data.IORef import Control.Exception (SomeException, catch) @@ -85,11 +81,6 @@ configConfigurationsFlags = unFlagAssignment . S.configConfigurationsFlags configConfigurationsFlags = S.configConfigurationsFlags #endif -#if !MIN_VERSION_base(4,6,0) -lookupEnv :: String -> IO (Maybe String) -lookupEnv v = lookup v `fmap` getEnvironment -#endif - -- After Idris is built, we need to check and install the prelude and other libs -- ----------------------------------------------------------------------------- diff --git a/Cabal-tree-diff/Cabal-tree-diff.cabal b/Cabal-tree-diff/Cabal-tree-diff.cabal index a6f65532b1c..d7703621f8d 100644 --- a/Cabal-tree-diff/Cabal-tree-diff.cabal +++ b/Cabal-tree-diff/Cabal-tree-diff.cabal @@ -1,6 +1,6 @@ cabal-version: 2.2 name: Cabal-tree-diff -version: 3.13.0.0 +version: 3.15.0.0 synopsis: QuickCheck instances for types in Cabal category: Testing description: Provides tree-diff ToExpr instances for some types in Cabal @@ -11,8 +11,8 @@ library ghc-options: -Wall build-depends: , base - , Cabal-syntax ^>=3.13.0.0 - , Cabal ^>=3.13.0.0 + , Cabal-syntax ^>=3.15.0.0 + , Cabal ^>=3.15.0.0 , tree-diff ^>=0.1 || ^>=0.2 || ^>=0.3 exposed-modules: Data.TreeDiff.Instances.Cabal diff --git a/Cabal/Cabal.cabal b/Cabal/Cabal.cabal index 829a6397c9c..f630898d448 100644 --- a/Cabal/Cabal.cabal +++ b/Cabal/Cabal.cabal @@ -1,6 +1,6 @@ -cabal-version: 2.2 +cabal-version: 3.0 name: Cabal -version: 3.13.0.0 +version: 3.15.0.0 copyright: 2003-2024, Cabal Development Team (see AUTHORS file) license: BSD-3-Clause license-file: LICENSE @@ -29,17 +29,22 @@ source-repository head location: https://github.com/haskell/cabal/ subdir: Cabal +flag git-rev + description: include Git revision hash in version + default: False + manual: True + library default-language: Haskell2010 hs-source-dirs: src build-depends: - Cabal-syntax ^>= 3.13, + Cabal-syntax ^>= 3.15, array >= 0.4.0.1 && < 0.6, - base >= 4.11 && < 5, + base >= 4.13 && < 5, bytestring >= 0.10.0.0 && < 0.13, containers >= 0.5.0.0 && < 0.8, - deepseq >= 1.3.0.1 && < 1.6, + deepseq >= 1.3.0.1 && < 1.7, directory >= 1.2 && < 1.4, filepath >= 1.3.0.1 && < 1.6, pretty >= 1.1.1 && < 1.2, @@ -49,7 +54,11 @@ library if os(windows) build-depends: Win32 >= 2.3.0.0 && < 2.15 else - build-depends: unix >= 2.6.0.0 && < 2.9 + build-depends: unix >= 2.8.6.0 && < 2.9 + + if flag(git-rev) + build-depends: githash ^>= 0.1.7.0 + cpp-options: -DGIT_REV ghc-options: -Wall @@ -101,6 +110,7 @@ library Distribution.Simple.BuildPaths Distribution.Simple.BuildTarget Distribution.Simple.BuildToolDepends + Distribution.Simple.BuildWay Distribution.Simple.CCompiler Distribution.Simple.Command Distribution.Simple.Compiler @@ -188,7 +198,6 @@ library Distribution.Compat.Parsing, Distribution.Compat.Prelude, Distribution.Compat.Semigroup, - Distribution.Compat.Typeable, Distribution.Compiler, Distribution.FieldGrammar, Distribution.FieldGrammar.Class, @@ -248,6 +257,7 @@ library Distribution.Types.ConfVar, Distribution.Types.Dependency, Distribution.Types.DependencyMap, + Distribution.Types.DependencySatisfaction, Distribution.Types.ExeDependency, Distribution.Types.Executable, Distribution.Types.Executable.Lens, @@ -271,6 +281,8 @@ library Distribution.Types.Library.Lens, Distribution.Types.LibraryName, Distribution.Types.LibraryVisibility, + Distribution.Types.MissingDependency, + Distribution.Types.MissingDependencyReason, Distribution.Types.Mixin, Distribution.Types.Module, Distribution.Types.ModuleReexport, diff --git a/Cabal/ChangeLog.md b/Cabal/ChangeLog.md index 7aebc02edda..f72ee48266e 100644 --- a/Cabal/ChangeLog.md +++ b/Cabal/ChangeLog.md @@ -1,5 +1,13 @@ +# 3.14.1.0 [Hécate](mailto:hecate+github@glitchbra.in) November 2024 +* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.14.1.0.md + +# 3.14.0.0 [Hécate](mailto:hecate+github@glitchbra.in) September 2024 +* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.14.0.0.md + +# 3.12.1.0 [Artem Pelenitsyn](mailto:a.pelenitsyn@gmail.com) June 2024 +* See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.12.1.0.md + # 3.12.0.0 [Francesco Ariis](mailto:fa-ml@ariis.it) May 2024 -# 3.12.0.0 [Francesco Ariis](mailto:fa-ml@ariis.it) March 2024 * See https://github.com/haskell/cabal/blob/master/release-notes/Cabal-3.12.0.0.md # 3.10.3.0 [Hécate](mailto:hecate+github@glitchbra.in) January 2024 @@ -765,7 +773,7 @@ * Many checks added for common mistakes * New `--package-db=` option for specific package databases * Many internal changes to support cabal-install - * Stricter parsing for version strings, eg dissalows "1.05" + * Stricter parsing for version strings, eg disallows "1.05" * Improved user guide introduction * Programatica support removed * New options `--program-prefix/suffix` allows eg versioned programs diff --git a/Cabal/Makefile b/Cabal/Makefile index a99f4edaeb5..e74ee82079d 100644 --- a/Cabal/Makefile +++ b/Cabal/Makefile @@ -1,4 +1,4 @@ -VERSION=3.13.0.0 +VERSION=3.15.0.0 #KIND=devel KIND=rc diff --git a/Cabal/src/Distribution/Backpack/Configure.hs b/Cabal/src/Distribution/Backpack/Configure.hs index 8e9eb18ae6a..d4c00b75c7b 100644 --- a/Cabal/src/Distribution/Backpack/Configure.hs +++ b/Cabal/src/Distribution/Backpack/Configure.hs @@ -1,8 +1,6 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE NondecreasingIndentation #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE PatternGuards #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE NoMonoLocalBinds #-} @@ -37,7 +35,7 @@ import Distribution.InstalledPackageInfo import qualified Distribution.InstalledPackageInfo as Installed import Distribution.ModuleName import Distribution.Package -import Distribution.PackageDescription +import Distribution.PackageDescription (FlagAssignment, PackageDescription (..), libName) import Distribution.Simple.Compiler import Distribution.Simple.Flag import Distribution.Simple.LocalBuildInfo @@ -70,7 +68,7 @@ configureComponentLocalBuildInfos -> Flag String -- configIPID -> Flag ComponentId -- configCID -> PackageDescription - -> ([PreExistingComponent], [PromisedComponent]) + -> ([PreExistingComponent], [ConfiguredPromisedComponent]) -> FlagAssignment -- configConfigurationsFlags -> [(ModuleName, Module)] -- configInstantiateWith -> InstalledPackageIndex @@ -118,7 +116,7 @@ configureComponentLocalBuildInfos `Map.union` Map.fromListWith Map.union [ (pkg, Map.singleton (ann_cname aid) aid) - | PromisedComponent pkg aid <- promisedPkgDeps + | ConfiguredPromisedComponent pkg aid <- promisedPkgDeps ] graph1 <- toConfiguredComponents @@ -151,7 +149,7 @@ configureComponentLocalBuildInfos , emptyModuleShape ) ) - | PromisedComponent _ aid <- promisedPkgDeps + | ConfiguredPromisedComponent _ aid <- promisedPkgDeps ] uid_lookup def_uid | Just pkg <- PackageIndex.lookupUnitId installedPackageSet uid = @@ -208,7 +206,7 @@ configureComponentLocalBuildInfos toComponentLocalBuildInfos :: Compiler -> InstalledPackageIndex -- FULL set - -> [PromisedComponent] + -> [ConfiguredPromisedComponent] -> PackageDescription -> [PreExistingComponent] -- external package deps -> [ReadyComponent] diff --git a/Cabal/src/Distribution/Backpack/ConfiguredComponent.hs b/Cabal/src/Distribution/Backpack/ConfiguredComponent.hs index 9bfaefb7e0b..947c370f16f 100644 --- a/Cabal/src/Distribution/Backpack/ConfiguredComponent.hs +++ b/Cabal/src/Distribution/Backpack/ConfiguredComponent.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE PatternGuards #-} - -- | See module Distribution.Backpack.ConfiguredComponent ( ConfiguredComponent (..) diff --git a/Cabal/src/Distribution/Backpack/ModuleScope.hs b/Cabal/src/Distribution/Backpack/ModuleScope.hs index 5e18766a15d..1a864a8f8a2 100644 --- a/Cabal/src/Distribution/Backpack/ModuleScope.hs +++ b/Cabal/src/Distribution/Backpack/ModuleScope.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveTraversable #-} -- | See diff --git a/Cabal/src/Distribution/Backpack/ModuleShape.hs b/Cabal/src/Distribution/Backpack/ModuleShape.hs index 039a6a30239..aceb14d5bc4 100644 --- a/Cabal/src/Distribution/Backpack/ModuleShape.hs +++ b/Cabal/src/Distribution/Backpack/ModuleShape.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} -- | See @@ -31,7 +30,7 @@ data ModuleShape = ModuleShape { modShapeProvides :: OpenModuleSubst , modShapeRequires :: Set ModuleName } - deriving (Eq, Show, Generic, Typeable) + deriving (Eq, Show, Generic) instance Binary ModuleShape instance Structured ModuleShape diff --git a/Cabal/src/Distribution/Backpack/PreExistingComponent.hs b/Cabal/src/Distribution/Backpack/PreExistingComponent.hs index 5f937de9062..0fba79bcb87 100644 --- a/Cabal/src/Distribution/Backpack/PreExistingComponent.hs +++ b/Cabal/src/Distribution/Backpack/PreExistingComponent.hs @@ -1,7 +1,7 @@ -- | See module Distribution.Backpack.PreExistingComponent ( PreExistingComponent (..) - , PromisedComponent (..) + , ConfiguredPromisedComponent (..) , ipiToPreExistingComponent ) where @@ -24,12 +24,12 @@ import Distribution.Types.AnnotatedId -- These components are promised to @configure@ but are not yet built. -- -- In other words this is 'PreExistingComponent' which doesn't yet exist. -data PromisedComponent = PromisedComponent +data ConfiguredPromisedComponent = ConfiguredPromisedComponent { pr_pkgname :: PackageName , pr_cid :: AnnotatedId ComponentId } -instance Package PromisedComponent where +instance Package ConfiguredPromisedComponent where packageId = packageId . pr_cid -- | Stripped down version of 'LinkedComponent' for things diff --git a/Cabal/src/Distribution/Backpack/PreModuleShape.hs b/Cabal/src/Distribution/Backpack/PreModuleShape.hs index 1a26e59be5d..b337b91ad50 100644 --- a/Cabal/src/Distribution/Backpack/PreModuleShape.hs +++ b/Cabal/src/Distribution/Backpack/PreModuleShape.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Backpack.PreModuleShape diff --git a/Cabal/src/Distribution/Compat/Async.hs b/Cabal/src/Distribution/Compat/Async.hs index dbc22c58359..c0052b01185 100644 --- a/Cabal/src/Distribution/Compat/Async.hs +++ b/Cabal/src/Distribution/Compat/Async.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} -- | 'Async', yet using 'MVar's. -- @@ -29,6 +28,8 @@ import Control.Exception ( BlockedIndefinitelyOnMVar (..) , Exception (..) , SomeException (..) + , asyncExceptionFromException + , asyncExceptionToException , catch , evaluate , mask @@ -38,13 +39,8 @@ import Control.Exception , uninterruptibleMask_ ) import Control.Monad (void) -import Data.Typeable (Typeable) import GHC.Exts (inline) -#if MIN_VERSION_base(4,7,0) -import Control.Exception (asyncExceptionFromException, asyncExceptionToException) -#endif - -- | Async, but based on 'MVar', as we don't depend on @stm@. data AsyncM a = Async { asyncThreadId :: {-# UNPACK #-} !ThreadId @@ -145,18 +141,13 @@ data AsyncCancelled = AsyncCancelled deriving ( Show , Eq - , Typeable ) -{- FOURMOLU_DISABLE -} instance Exception AsyncCancelled where -#if MIN_VERSION_base(4,7,0) -- wraps in SomeAsyncException -- See https://github.com/ghc/ghc/commit/756a970eacbb6a19230ee3ba57e24999e4157b09 fromException = asyncExceptionFromException toException = asyncExceptionToException -#endif -{- FOURMOLU_ENABLE -} -- | Cancel an asynchronous action -- diff --git a/Cabal/src/Distribution/Compat/ResponseFile.hs b/Cabal/src/Distribution/Compat/ResponseFile.hs index 189a423bd08..8619ae56962 100644 --- a/Cabal/src/Distribution/Compat/ResponseFile.hs +++ b/Cabal/src/Distribution/Compat/ResponseFile.hs @@ -8,63 +8,15 @@ module Distribution.Compat.ResponseFile (expandResponse, escapeArgs) where import Distribution.Compat.Prelude + +import GHC.ResponseFile (escapeArgs, unescapeArgs) + import Prelude () import System.FilePath import System.IO (hPutStrLn, stderr) import System.IO.Error -#if MIN_VERSION_base(4,12,0) -import GHC.ResponseFile (unescapeArgs, escapeArgs) -#else - -unescapeArgs :: String -> [String] -unescapeArgs = filter (not . null) . unescape - -data Quoting = NoneQ | SngQ | DblQ - -unescape :: String -> [String] -unescape args = reverse . map reverse $ go args NoneQ False [] [] - where - -- n.b., the order of these cases matters; these are cribbed from gcc - -- case 1: end of input - go [] _q _bs a as = a:as - -- case 2: back-slash escape in progress - go (c:cs) q True a as = go cs q False (c:a) as - -- case 3: no back-slash escape in progress, but got a back-slash - go (c:cs) q False a as - | '\\' == c = go cs q True a as - -- case 4: single-quote escaping in progress - go (c:cs) SngQ False a as - | '\'' == c = go cs NoneQ False a as - | otherwise = go cs SngQ False (c:a) as - -- case 5: double-quote escaping in progress - go (c:cs) DblQ False a as - | '"' == c = go cs NoneQ False a as - | otherwise = go cs DblQ False (c:a) as - -- case 6: no escaping is in progress - go (c:cs) NoneQ False a as - | isSpace c = go cs NoneQ False [] (a:as) - | '\'' == c = go cs SngQ False a as - | '"' == c = go cs DblQ False a as - | otherwise = go cs NoneQ False (c:a) as - -escapeArgs :: [String] -> String -escapeArgs = unlines . map escapeArg - -escapeArg :: String -> String -escapeArg = reverse . foldl' escape [] - -escape :: String -> Char -> String -escape cs c - | isSpace c - || '\\' == c - || '\'' == c - || '"' == c = c:'\\':cs -- n.b., our caller must reverse the result - | otherwise = c:cs - -#endif - -- | The arg file / response file parser. -- -- This is not a well-documented capability, and is a bit eccentric diff --git a/Cabal/src/Distribution/Compat/Stack.hs b/Cabal/src/Distribution/Compat/Stack.hs index 41d4ff8b460..616a66d090d 100644 --- a/Cabal/src/Distribution/Compat/Stack.hs +++ b/Cabal/src/Distribution/Compat/Stack.hs @@ -13,91 +13,31 @@ module Distribution.Compat.Stack , parentSrcLocPrefix ) where -import System.IO.Error - -#ifdef MIN_VERSION_base -#if MIN_VERSION_base(4,8,1) -#define GHC_STACK_SUPPORTED 1 -#endif -#endif - -#ifdef GHC_STACK_SUPPORTED import GHC.Stack -#endif - -#ifdef GHC_STACK_SUPPORTED +import System.IO.Error -#if MIN_VERSION_base(4,9,0) type WithCallStack a = HasCallStack => a -#elif MIN_VERSION_base(4,8,1) -type WithCallStack a = (?callStack :: CallStack) => a -#endif - -#if !MIN_VERSION_base(4,9,0) --- NB: Can't say WithCallStack (WithCallStack a -> a); --- Haskell doesn't support this kind of implicit parameter! --- See https://mail.haskell.org/pipermail/ghc-devs/2016-January/011096.html --- Since this function doesn't do anything, it's OK to --- give it a less good type. -withFrozenCallStack :: WithCallStack (a -> a) -withFrozenCallStack x = x - -callStack :: (?callStack :: CallStack) => CallStack -callStack = ?callStack - -prettyCallStack :: CallStack -> String -prettyCallStack = showCallStack -#endif -- | Give the *parent* of the person who invoked this; -- so it's most suitable for being called from a utility function. -- You probably want to call this using 'withFrozenCallStack'; otherwise -- it's not very useful. We didn't implement this for base-4.8.1 -- because we cannot rely on freezing to have taken place. --- parentSrcLocPrefix :: WithCallStack String -#if MIN_VERSION_base(4,9,0) parentSrcLocPrefix = case getCallStack callStack of - (_:(_, loc):_) -> showLoc loc + (_ : (_, loc) : _) -> showLoc loc [(_, loc)] -> showLoc loc [] -> error "parentSrcLocPrefix: empty call stack" - where - showLoc loc = - srcLocFile loc ++ ":" ++ show (srcLocStartLine loc) ++ ": " -#else -parentSrcLocPrefix = "Call sites not available with base < 4.9.0.0 (GHC 8.0): " -#endif + where + showLoc loc = + srcLocFile loc ++ ":" ++ show (srcLocStartLine loc) ++ ": " -- Yeah, this uses skivvy implementation details. withLexicalCallStack :: (a -> WithCallStack (IO b)) -> WithCallStack (a -> IO b) withLexicalCallStack f = - let stk = ?callStack - in \x -> let ?callStack = stk in f x - -#else - -data CallStack = CallStack - deriving (Eq, Show) - -type WithCallStack a = a - -withFrozenCallStack :: a -> a -withFrozenCallStack x = x - -callStack :: CallStack -callStack = CallStack - -prettyCallStack :: CallStack -> String -prettyCallStack _ = "Call stacks not available with base < 4.8.1.0 (GHC 7.10)" - -parentSrcLocPrefix :: String -parentSrcLocPrefix = "Call sites not available with base < 4.9.0.0 (GHC 8.0): " - -withLexicalCallStack :: (a -> IO b) -> a -> IO b -withLexicalCallStack f = f - -#endif + let stk = ?callStack + in \x -> let ?callStack = stk in f x -- | This function is for when you *really* want to add a call -- stack to raised IO, but you don't have a diff --git a/Cabal/src/Distribution/Compat/Time.hs b/Cabal/src/Distribution/Compat/Time.hs index 9af0500fae1..088c01950c0 100644 --- a/Cabal/src/Distribution/Compat/Time.hs +++ b/Cabal/src/Distribution/Compat/Time.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} @@ -34,11 +33,7 @@ import Data.Time.Clock.POSIX (POSIXTime, getPOSIXTime, posixDayLength) import qualified Prelude import Data.Bits ((.|.), unsafeShiftL) -#if MIN_VERSION_base(4,7,0) import Data.Bits (finiteBitSize) -#else -import Data.Bits (bitSize) -#endif import Foreign ( allocaBytes, peekByteOff ) import System.IO.Error ( mkIOError, doesNotExistErrorType ) @@ -59,7 +54,7 @@ import System.Posix.Files ( modificationTime ) -- | An opaque type representing a file's modification time, represented -- internally as a 64-bit unsigned integer in the Windows UTC format. newtype ModTime = ModTime Word64 - deriving (Binary, Generic, Bounded, Eq, Ord, Typeable) + deriving (Binary, Generic, Bounded, Eq, Ord) instance Structured ModTime @@ -92,15 +87,9 @@ getModTime path = allocaBytes size_WIN32_FILE_ATTRIBUTE_DATA $ \info -> do index_WIN32_FILE_ATTRIBUTE_DATA_ftLastWriteTime_dwLowDateTime dwHigh <- peekByteOff info index_WIN32_FILE_ATTRIBUTE_DATA_ftLastWriteTime_dwHighDateTime -#if MIN_VERSION_base(4,7,0) let qwTime = (fromIntegral (dwHigh :: DWORD) `unsafeShiftL` finiteBitSize dwHigh) .|. (fromIntegral (dwLow :: DWORD)) -#else - let qwTime = - (fromIntegral (dwHigh :: DWORD) `unsafeShiftL` bitSize dwHigh) - .|. (fromIntegral (dwLow :: DWORD)) -#endif return $! ModTime (qwTime :: Word64) {- FOURMOLU_DISABLE -} diff --git a/Cabal/src/Distribution/GetOpt.hs b/Cabal/src/Distribution/GetOpt.hs index 7e31fa165f4..bd9ee4ac65c 100644 --- a/Cabal/src/Distribution/GetOpt.hs +++ b/Cabal/src/Distribution/GetOpt.hs @@ -134,11 +134,11 @@ zipDefault ad bd (a : as) (b : bs) = (a, b) : zipDefault ad bd as bs -- | Pretty printing of short options. -- * With required arguments can be given as: -- @-w PATH or -wPATH (but not -w=PATH)@ --- This is dislayed as: +-- This is displayed as: -- @-w PATH or -wPATH@ -- * With optional but default arguments can be given as: -- @-j or -jNUM (but not -j=NUM or -j NUM)@ --- This is dislayed as: +-- This is displayed as: -- @-j[NUM]@ fmtShort :: ArgDescr a -> Char -> String fmtShort (NoArg _) so = "-" ++ [so] @@ -152,11 +152,11 @@ fmtShort (OptArg _ _ ad) so = -- | Pretty printing of long options. -- * With required arguments can be given as: -- @--with-compiler=PATH (but not --with-compiler PATH)@ --- This is dislayed as: +-- This is displayed as: -- @--with-compiler=PATH@ -- * With optional but default arguments can be given as: -- @--jobs or --jobs=NUM (but not --jobs NUM)@ --- This is dislayed as: +-- This is displayed as: -- @--jobs[=NUM]@ fmtLong :: ArgDescr a -> String -> String fmtLong (NoArg _) lo = "--" ++ lo diff --git a/Cabal/src/Distribution/PackageDescription/Check.hs b/Cabal/src/Distribution/PackageDescription/Check.hs index ef97b0d23be..2d9750de77d 100644 --- a/Cabal/src/Distribution/PackageDescription/Check.hs +++ b/Cabal/src/Distribution/PackageDescription/Check.hs @@ -409,6 +409,7 @@ checkPackageDescription extraSrcFiles_ extraTmpFiles_ extraDocFiles_ + extraFiles_ ) = do -- § Sanity checks. checkPackageId package_ @@ -456,6 +457,7 @@ checkPackageDescription mapM_ (checkPath False "extra-source-files" PathKindGlob . getSymbolicPath) extraSrcFiles_ mapM_ (checkPath False "extra-tmp-files" PathKindFile . getSymbolicPath) extraTmpFiles_ mapM_ (checkPath False "extra-doc-files" PathKindGlob . getSymbolicPath) extraDocFiles_ + mapM_ (checkPath False "extra-files" PathKindGlob . getSymbolicPath) extraFiles_ mapM_ (checkPath False "data-files" PathKindGlob . getSymbolicPath) dataFiles_ let rawDataDir = getSymbolicPath dataDir_ checkPath True "data-dir" PathKindDirectory rawDataDir @@ -465,15 +467,17 @@ checkPackageDescription -- § Globs. dataGlobs <- mapM (checkGlob "data-files" . getSymbolicPath) dataFiles_ - extraGlobs <- mapM (checkGlob "extra-source-files" . getSymbolicPath) extraSrcFiles_ + extraSrcGlobs <- mapM (checkGlob "extra-source-files" . getSymbolicPath) extraSrcFiles_ docGlobs <- mapM (checkGlob "extra-doc-files" . getSymbolicPath) extraDocFiles_ + extraGlobs <- mapM (checkGlob "extra-files" . getSymbolicPath) extraFiles_ -- We collect globs to feed them to checkMissingDocs. -- § Missing documentation. checkMissingDocs (catMaybes dataGlobs) - (catMaybes extraGlobs) + (catMaybes extraSrcGlobs) (catMaybes docGlobs) + (catMaybes extraGlobs) -- § Datafield checks. checkSetupBuildInfo setupBuildInfo_ @@ -519,6 +523,7 @@ checkPackageDescription checkCabalFile (packageName pkg) mapM_ (checkGlobFile specVersion_ "." "extra-source-files" . getSymbolicPath) extraSrcFiles_ mapM_ (checkGlobFile specVersion_ "." "extra-doc-files" . getSymbolicPath) extraDocFiles_ + mapM_ (checkGlobFile specVersion_ "." "extra-files" . getSymbolicPath) extraFiles_ mapM_ (checkGlobFile specVersion_ rawDataDir "data-files" . getSymbolicPath) dataFiles_ where checkNull @@ -563,8 +568,20 @@ checkSetupBuildInfo (Just (SetupBuildInfo ds _)) = do rck = PackageDistSuspiciousWarn . MissingUpperBounds CETSetup - checkPVP ick is - checkPVPs rck rs + leuck = + PackageDistSuspiciousWarn + . LEUpperBounds CETSetup + tzuck = + PackageDistSuspiciousWarn + . TrailingZeroUpperBounds CETSetup + gtlck = + PackageDistSuspiciousWarn + . GTLowerBounds CETSetup + checkPVP (checkDependencyVersionRange $ not . hasUpperBound) ick is + checkPVPs (checkDependencyVersionRange $ not . hasUpperBound) rck rs + checkPVPs (checkDependencyVersionRange hasLEUpperBound) leuck ds + checkPVPs (checkDependencyVersionRange hasTrailingZeroUpperBound) tzuck ds + checkPVPs (checkDependencyVersionRange hasGTLowerBound) gtlck ds checkPackageId :: Monad m => PackageIdentifier -> CheckM m () checkPackageId (PackageIdentifier pkgName_ _pkgVersion_) = do @@ -679,6 +696,7 @@ checkSourceRepos rs = do checkP (isNothing repoLocation_) (PackageDistInexcusable MissingLocation) + checkGitProtocol repoLocation_ checkP ( repoType_ == Just (KnownRepoType CVS) && isNothing repoModule_ @@ -717,6 +735,17 @@ checkMissingVcsInfo rs = repoTypeDirname Monotone = ["_MTN"] repoTypeDirname Pijul = [".pijul"] +-- git:// lacks TLS or other encryption, see +-- https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_the_cons_4 +checkGitProtocol + :: Monad m + => Maybe String -- Repository location + -> CheckM m () +checkGitProtocol mloc = + checkP + (fmap (isPrefixOf "git://") mloc == Just True) + (PackageBuildWarning GitProtocol) + -- ------------------------------------------------------------ -- Package and distribution checks -- ------------------------------------------------------------ @@ -985,8 +1014,9 @@ checkMissingDocs => [Glob] -- data-files globs. -> [Glob] -- extra-source-files globs. -> [Glob] -- extra-doc-files globs. + -> [Glob] -- extra-files globs. -> CheckM m () -checkMissingDocs dgs esgs edgs = do +checkMissingDocs dgs esgs edgs efgs = do extraDocSupport <- (>= CabalSpecV1_18) <$> asksCM ccSpecVersion -- Everything in this block uses CheckPreDistributionOps interface. @@ -1005,9 +1035,10 @@ checkMissingDocs dgs esgs edgs = do rgs <- realGlob dgs res <- realGlob esgs red <- realGlob edgs + ref <- realGlob efgs -- 3. Check if anything in 1. is missing in 2. - let mcs = checkDoc extraDocSupport des (rgs ++ res ++ red) + let mcs = checkDoc extraDocSupport des (rgs ++ res ++ red ++ ref) -- 4. Check if files are present but in the wrong field. let pcsData = checkDocMove extraDocSupport "data-files" des rgs diff --git a/Cabal/src/Distribution/PackageDescription/Check/Common.hs b/Cabal/src/Distribution/PackageDescription/Check/Common.hs index 4c528831430..87ad55d7ade 100644 --- a/Cabal/src/Distribution/PackageDescription/Check/Common.hs +++ b/Cabal/src/Distribution/PackageDescription/Check/Common.hs @@ -16,6 +16,7 @@ module Distribution.PackageDescription.Check.Common , partitionDeps , checkPVP , checkPVPs + , checkDependencyVersionRange ) where import Distribution.Compat.Prelude @@ -79,7 +80,7 @@ partitionDeps ads ns ds = do -- shared targets that match fads = filter (flip elem dqs . fst) ads -- the names of such targets - inNam = nub $ map fst fads :: [UnqualComponentName] + inName = nub $ map fst fads :: [UnqualComponentName] -- the dependencies of such targets inDep = concatMap snd fads :: [Dependency] @@ -96,7 +97,7 @@ partitionDeps ads ns ds = do -- text, ← no warning, inherited -- monadacme ← warning! let fFun d = - notElem (unqualName d) inNam + notElem (unqualName d) inName && notElem (unqualName d) (map unqualName inDep) @@ -116,34 +117,32 @@ partitionDeps ads ns ds = do -- for important dependencies like base). checkPVP :: Monad m - => (String -> PackageCheck) -- Warn message dependend on name + => (Dependency -> Bool) + -> (String -> PackageCheck) -- Warn message depends on name -- (e.g. "base", "Cabal"). -> [Dependency] -> CheckM m () -checkPVP ckf ds = do - let ods = checkPVPPrim ds +checkPVP p ckf ds = do + let ods = filter p ds mapM_ (tellP . ckf . unPackageName . depPkgName) ods -- PVP dependency check for a list of dependencies. Some code duplication -- is sadly needed to provide more ergonimic error messages. checkPVPs :: Monad m - => ( [String] + => (Dependency -> Bool) + -> ( [String] -> PackageCheck -- Grouped error message, depends on a -- set of names. ) -> [Dependency] -- Deps to analyse. -> CheckM m () -checkPVPs cf ds +checkPVPs p cf ds | null ns = return () | otherwise = tellP (cf ns) where - ods = checkPVPPrim ds + ods = filter p ds ns = map (unPackageName . depPkgName) ods --- Returns dependencies without upper bounds. -checkPVPPrim :: [Dependency] -> [Dependency] -checkPVPPrim ds = filter withoutUpper ds - where - withoutUpper :: Dependency -> Bool - withoutUpper (Dependency _ ver _) = not . hasUpperBound $ ver +checkDependencyVersionRange :: (VersionRange -> Bool) -> Dependency -> Bool +checkDependencyVersionRange p (Dependency _ ver _) = p ver diff --git a/Cabal/src/Distribution/PackageDescription/Check/Monad.hs b/Cabal/src/Distribution/PackageDescription/Check/Monad.hs index 23d37570800..979826567b6 100644 --- a/Cabal/src/Distribution/PackageDescription/Check/Monad.hs +++ b/Cabal/src/Distribution/PackageDescription/Check/Monad.hs @@ -242,7 +242,7 @@ tellCM ck = do -- There are some errors which, even though severe, will -- be allowed by Hackage *if* under a non-default flag. isErrAllowable :: PackageCheck -> Bool - isErrAllowable c = case extractCheckExplantion c of + isErrAllowable c = case extractCheckExplanation c of (WErrorUnneeded _) -> True (JUnneeded _) -> True (FDeferTypeErrorsUnneeded _) -> True diff --git a/Cabal/src/Distribution/PackageDescription/Check/Target.hs b/Cabal/src/Distribution/PackageDescription/Check/Target.hs index fdafa89b6e5..0bf173cb980 100644 --- a/Cabal/src/Distribution/PackageDescription/Check/Target.hs +++ b/Cabal/src/Distribution/PackageDescription/Check/Target.hs @@ -331,17 +331,30 @@ checkBuildInfo cet ams ads bi = do checkAutogenModules ams bi -- PVP: we check for base and all other deps. + let ds = mergeDependencies $ targetBuildDepends bi (ids, rds) <- partitionDeps ads [mkUnqualComponentName "base"] - (mergeDependencies $ targetBuildDepends bi) + ds let ick = const (PackageDistInexcusable BaseNoUpperBounds) rck = PackageDistSuspiciousWarn . MissingUpperBounds cet - checkPVP ick ids + leuck = PackageDistSuspiciousWarn . LEUpperBounds cet + tzuck = PackageDistSuspiciousWarn . TrailingZeroUpperBounds cet + gtlck = PackageDistSuspiciousWarn . GTLowerBounds cet + checkPVP (checkDependencyVersionRange $ not . hasUpperBound) ick ids unless (isInternalTarget cet) - (checkPVPs rck rds) + (checkPVPs (checkDependencyVersionRange $ not . hasUpperBound) rck rds) + unless + (isInternalTarget cet) + (checkPVPs (checkDependencyVersionRange hasLEUpperBound) leuck ds) + unless + (isInternalTarget cet) + (checkPVPs (checkDependencyVersionRange hasTrailingZeroUpperBound) tzuck ds) + unless + (isInternalTarget cet) + (checkPVPs (checkDependencyVersionRange hasGTLowerBound) gtlck ds) -- Custom fields well-formedness (ASCII). mapM_ checkCustomField (customFieldsBI bi) @@ -825,9 +838,10 @@ checkGHCOptions title t opts = do checkFlags ["-prof"] (PackageBuildWarning $ OptProf title) - -- Does not apply to scripts. - -- Why do we need this? See #8963. pid <- asksCM (pnPackageId . ccNames) + -- Scripts add the -o flag in the fake-package.cabal in order to have the + -- executable name match the script name even when there are characters + -- in the script name which are illegal to have as a target name. unless (pid == fakePackageId) $ checkFlags ["-o"] @@ -859,14 +873,14 @@ checkGHCOptions title t opts = do let ghcNoRts = rmRtsOpts opts checkAlternatives title - "extensions" + "default-extensions" [ (flag, prettyShow extension) | flag <- ghcNoRts , Just extension <- [ghcExtension flag] ] checkAlternatives title - "extensions" + "default-extensions" [ (flag, extension) | flag@('-' : 'X' : extension) <- ghcNoRts ] diff --git a/Cabal/src/Distribution/PackageDescription/Check/Warning.hs b/Cabal/src/Distribution/PackageDescription/Check/Warning.hs index 859b3f12c50..897137bda2b 100644 --- a/Cabal/src/Distribution/PackageDescription/Check/Warning.hs +++ b/Cabal/src/Distribution/PackageDescription/Check/Warning.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -25,7 +24,7 @@ module Distribution.PackageDescription.Check.Warning , ppPackageCheck , ppCheckExplanationId , isHackageDistError - , extractCheckExplantion + , extractCheckExplanation , filterPackageChecksById , filterPackageChecksByIdString ) where @@ -47,7 +46,7 @@ import Distribution.Types.PackageName (PackageName) import Distribution.Types.TestType (TestType, knownTestTypes) import Distribution.Types.UnqualComponentName import Distribution.Types.Version (Version) -import Distribution.Utils.Path +import Distribution.Utils.Path (FileOrDir (..), Pkg, RelativePath, getSymbolicPath) import Language.Haskell.Extension (Extension) import qualified Data.Either as Either @@ -124,7 +123,7 @@ filterPackageChecksById cs is = filter ff cs ff c = flip notElem is . checkExplanationId - . extractCheckExplantion + . extractCheckExplanation $ c -- | Filter Package Check by Check explanation /string/. @@ -193,6 +192,7 @@ data CheckExplanation | UnrecognisedSourceRepo String | MissingType | MissingLocation + | GitProtocol | MissingModule | MissingTag | SubdirRelPath @@ -255,6 +255,9 @@ data CheckExplanation | UnknownCompiler [String] | BaseNoUpperBounds | MissingUpperBounds CEType [String] + | LEUpperBounds CEType [String] + | TrailingZeroUpperBounds CEType [String] + | GTLowerBounds CEType [String] | SuspiciousFlagName [String] | DeclaredUsedFlags (Set.Set FlagName) (Set.Set FlagName) | NonASCIICustomField [String] @@ -292,14 +295,14 @@ data CheckExplanation -- to be a ad hoc monoid. -- Convenience. -extractCheckExplantion :: PackageCheck -> CheckExplanation -extractCheckExplantion (PackageBuildImpossible e) = e -extractCheckExplantion (PackageBuildWarning e) = e -extractCheckExplantion (PackageDistSuspicious e) = e -extractCheckExplantion (PackageDistSuspiciousWarn e) = e -extractCheckExplantion (PackageDistInexcusable e) = e +extractCheckExplanation :: PackageCheck -> CheckExplanation +extractCheckExplanation (PackageBuildImpossible e) = e +extractCheckExplanation (PackageBuildWarning e) = e +extractCheckExplanation (PackageDistSuspicious e) = e +extractCheckExplanation (PackageDistSuspiciousWarn e) = e +extractCheckExplanation (PackageDistInexcusable e) = e --- | Identifier for the speficic 'CheckExplanation'. This ensures `--ignore` +-- | Identifier for the specific 'CheckExplanation'. This ensures `--ignore` -- can output a warning on unrecognised values. -- ☞ N.B.: should be kept in sync with 'CheckExplanation'. data CheckExplanationID @@ -355,6 +358,7 @@ data CheckExplanationID | CIUnrecognisedSourceRepo | CIMissingType | CIMissingLocation + | CIGitProtocol | CIMissingModule | CIMissingTag | CISubdirRelPath @@ -417,6 +421,9 @@ data CheckExplanationID | CIUnknownCompiler | CIBaseNoUpperBounds | CIMissingUpperBounds + | CILEUpperBounds + | CITrailingZeroUpperBounds + | CIGTLowerBounds | CISuspiciousFlagName | CIDeclaredUsedFlags | CINonASCIICustomField @@ -496,6 +503,7 @@ checkExplanationId (NoLicenseFile{}) = CINoLicenseFile checkExplanationId (UnrecognisedSourceRepo{}) = CIUnrecognisedSourceRepo checkExplanationId (MissingType{}) = CIMissingType checkExplanationId (MissingLocation{}) = CIMissingLocation +checkExplanationId (GitProtocol{}) = CIGitProtocol checkExplanationId (MissingModule{}) = CIMissingModule checkExplanationId (MissingTag{}) = CIMissingTag checkExplanationId (SubdirRelPath{}) = CISubdirRelPath @@ -558,6 +566,9 @@ checkExplanationId (UnknownArch{}) = CIUnknownArch checkExplanationId (UnknownCompiler{}) = CIUnknownCompiler checkExplanationId (BaseNoUpperBounds{}) = CIBaseNoUpperBounds checkExplanationId (MissingUpperBounds{}) = CIMissingUpperBounds +checkExplanationId (LEUpperBounds{}) = CILEUpperBounds +checkExplanationId (TrailingZeroUpperBounds{}) = CITrailingZeroUpperBounds +checkExplanationId (GTLowerBounds{}) = CIGTLowerBounds checkExplanationId (SuspiciousFlagName{}) = CISuspiciousFlagName checkExplanationId (DeclaredUsedFlags{}) = CIDeclaredUsedFlags checkExplanationId (NonASCIICustomField{}) = CINonASCIICustomField @@ -585,11 +596,13 @@ checkExplanationId (WrongFieldForExpectedDocFiles{}) = CIWrongFieldForExpectedDo type CheckExplanationIDString = String --- A one-word identifier for each CheckExplanation --- --- ☞ N.B: if you modify anything here, remeber to change the documentation --- in @doc/cabal-commands.rst@! +-- | A one-word identifier for each @CheckExplanation@. ppCheckExplanationId :: CheckExplanationID -> CheckExplanationIDString +-- NOTE: If you modify anything here, remember to change the documentation +-- in @doc/cabal-commands.rst@! +-- NOTE: These strings will have to satisfy a test that these messages don't +-- have too many dashes: +-- $ cabal run Cabal-tests:unit-tests -- --pattern=Parsimonious ppCheckExplanationId CIParseWarning = "parser-warning" ppCheckExplanationId CINoNameField = "no-name-field" ppCheckExplanationId CINoVersionField = "no-version-field" @@ -642,6 +655,7 @@ ppCheckExplanationId CINoLicenseFile = "no-license-file" ppCheckExplanationId CIUnrecognisedSourceRepo = "unrecognised-repo-type" ppCheckExplanationId CIMissingType = "repo-no-type" ppCheckExplanationId CIMissingLocation = "repo-no-location" +ppCheckExplanationId CIGitProtocol = "git-protocol" ppCheckExplanationId CIMissingModule = "repo-no-module" ppCheckExplanationId CIMissingTag = "repo-no-tag" ppCheckExplanationId CISubdirRelPath = "repo-relative-dir" @@ -704,6 +718,9 @@ ppCheckExplanationId CIUnknownArch = "unknown-arch" ppCheckExplanationId CIUnknownCompiler = "unknown-compiler" ppCheckExplanationId CIBaseNoUpperBounds = "missing-bounds-important" ppCheckExplanationId CIMissingUpperBounds = "missing-upper-bounds" +ppCheckExplanationId CILEUpperBounds = "le-upper-bounds" +ppCheckExplanationId CITrailingZeroUpperBounds = "tz-upper-bounds" +ppCheckExplanationId CIGTLowerBounds = "gt-lower-bounds" ppCheckExplanationId CISuspiciousFlagName = "suspicious-flag" ppCheckExplanationId CIDeclaredUsedFlags = "unused-flag" ppCheckExplanationId CINonASCIICustomField = "non-ascii" @@ -964,6 +981,10 @@ ppExplanation MissingType = "The source-repository 'type' is a required field." ppExplanation MissingLocation = "The source-repository 'location' is a required field." +ppExplanation GitProtocol = + "Cloning over git:// might lead to an arbitrary code execution " + ++ "vulnerability. Furthermore, popular forges like GitHub do " + ++ "not support it. Use https:// or ssh:// instead." ppExplanation MissingModule = "For a CVS source-repository, the 'module' is a required field." ppExplanation MissingTag = @@ -1293,15 +1314,33 @@ ppExplanation BaseNoUpperBounds = ++ "version. For example if you have tested your package with 'base' " ++ "version 4.5 and 4.6 then use 'build-depends: base >= 4.5 && < 4.7'." ppExplanation (MissingUpperBounds ct names) = - let separator = "\n - " - in "On " - ++ ppCET ct - ++ ", " - ++ "these packages miss upper bounds:" - ++ separator - ++ List.intercalate separator names - ++ "\n" - ++ "Please add them. There is more information at https://pvp.haskell.org/" + "On " + ++ ppCET ct + ++ ", " + ++ "these packages miss upper bounds:" + ++ listSep names + ++ "Please add them. There is more information at https://pvp.haskell.org/" +ppExplanation (LEUpperBounds ct names) = + "On " + ++ ppCET ct + ++ ", " + ++ "these packages have less than or equals (<=) upper bounds:" + ++ listSep names + ++ "Please use less than (<) for upper bounds." +ppExplanation (TrailingZeroUpperBounds ct names) = + "On " + ++ ppCET ct + ++ ", " + ++ "these packages have upper bounds with trailing zeros:" + ++ listSep names + ++ "Please avoid trailing zeros for upper bounds." +ppExplanation (GTLowerBounds ct names) = + "On " + ++ ppCET ct + ++ ", " + ++ "these packages have greater than (>) lower bounds:" + ++ listSep names + ++ "Please use greater than or equals (>=) for lower bounds." ppExplanation (SuspiciousFlagName invalidFlagNames) = "Suspicious flag names: " ++ unwords invalidFlagNames @@ -1463,6 +1502,11 @@ ppExplanation (WrongFieldForExpectedDocFiles extraDocFileSupport field paths) = -- * Formatting utilities +listSep :: [String] -> String +listSep names = + let separator = "\n - " + in separator ++ List.intercalate separator names ++ "\n" + commaSep :: [String] -> String commaSep = List.intercalate ", " diff --git a/Cabal/src/Distribution/Simple.hs b/Cabal/src/Distribution/Simple.hs index 85eabcbe93c..985d85419db 100644 --- a/Cabal/src/Distribution/Simple.hs +++ b/Cabal/src/Distribution/Simple.hs @@ -1,8 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -67,6 +65,7 @@ module Distribution.Simple -- ** Standard sets of hooks , simpleUserHooks , autoconfUserHooks + , autoconfSetupHooks , emptyUserHooks ) where @@ -110,6 +109,7 @@ import Distribution.Simple.SetupHooks.Internal ) import Distribution.Simple.Test import Distribution.Simple.Utils +import qualified Distribution.Types.LocalBuildConfig as LBC import Distribution.Utils.Path import Distribution.Verbosity import Distribution.Version @@ -548,7 +548,7 @@ cleanAction globalFlags hooks flags args = do flags' = flags{cleanCommonFlags = common'} - mbWorkDirFlag = cleanWorkingDir flags + mbWorkDirFlag = cleanWorkingDir flags' mbWorkDir = flagToMaybe mbWorkDirFlag pbi <- preClean hooks args flags' @@ -935,16 +935,11 @@ autoconfUserHooks = let common = configCommonFlags flags verbosity = fromFlag $ setupVerbosity common mbWorkDir = flagToMaybe $ setupWorkingDir common - baseDir = packageRoot common - confExists <- doesFileExist $ baseDir "configure" - if confExists - then - runConfigureScript - verbosity - flags - lbi - else dieWithException verbosity ConfigureScriptNotFound - + runConfigureScript + flags + (flagAssignment lbi) + (withPrograms lbi) + (hostPlatform lbi) pbi <- getHookedBuildInfo verbosity mbWorkDir (buildDir lbi) sanityCheckHookedBuildInfo verbosity pkg_descr pbi let pkg_descr' = updatePackageDescription pbi pkg_descr @@ -991,6 +986,65 @@ getHookedBuildInfo verbosity mbWorkDir build_dir = do info verbosity $ "Reading parameters from " ++ getSymbolicPath infoFile readHookedBuildInfo verbosity mbWorkDir infoFile +autoconfSetupHooks :: SetupHooks +autoconfSetupHooks = + SetupHooks.noSetupHooks + { SetupHooks.configureHooks = + SetupHooks.noConfigureHooks + { SetupHooks.postConfPackageHook = Just post_conf_pkg + , SetupHooks.preConfComponentHook = Just pre_conf_comp + } + } + where + post_conf_pkg + :: SetupHooks.PostConfPackageInputs + -> IO () + post_conf_pkg + ( SetupHooks.PostConfPackageInputs + { SetupHooks.localBuildConfig = + LBC.LocalBuildConfig{LBC.withPrograms = progs} + , SetupHooks.packageBuildDescr = + LBC.PackageBuildDescr + { LBC.configFlags = cfg + , LBC.flagAssignment = flags + , LBC.hostPlatform = plat + } + } + ) = runConfigureScript cfg flags progs plat + + pre_conf_comp + :: SetupHooks.PreConfComponentInputs + -> IO SetupHooks.PreConfComponentOutputs + pre_conf_comp + ( SetupHooks.PreConfComponentInputs + { SetupHooks.packageBuildDescr = + LBC.PackageBuildDescr + { LBC.configFlags = cfg + , localPkgDescr = pkg_descr + } + , SetupHooks.component = component + } + ) = do + let verbosity = fromFlag $ configVerbosity cfg + mbWorkDir = flagToMaybe $ configWorkingDir cfg + distPref = configDistPref cfg + dist_dir <- findDistPrefOrDefault distPref + -- Read the ".buildinfo" file and use that to update + -- the components (main library + executables only). + hbi <- getHookedBuildInfo verbosity mbWorkDir (dist_dir makeRelativePathEx "build") + sanityCheckHookedBuildInfo verbosity pkg_descr hbi + -- SetupHooks TODO: we are reading getHookedBuildInfo once + -- for each component. I think this is inherent to the SetupHooks + -- approach. + let comp_name = componentName component + diff <- case SetupHooks.hookedBuildInfoComponentDiff_maybe hbi comp_name of + Nothing -> return $ SetupHooks.emptyComponentDiff comp_name + Just do_diff -> do_diff + return $ + SetupHooks.PreConfComponentOutputs + { SetupHooks.componentDiff = diff + } + defaultTestHook :: Args -> PackageDescription @@ -1038,6 +1092,7 @@ defaultInstallHook_setupHooks inst_hooks pkg_descr localbuildinfo _ flags = do defaultRegisterFlags { regInPlace = installInPlace flags , regPackageDB = installPackageDB flags + , registerCommonFlags = installCommonFlags flags } when (hasLibs pkg_descr) $ register pkg_descr localbuildinfo registerFlags diff --git a/Cabal/src/Distribution/Simple/Bench.hs b/Cabal/src/Distribution/Simple/Bench.hs index dc4cf97a5bb..c3b3802876f 100644 --- a/Cabal/src/Distribution/Simple/Bench.hs +++ b/Cabal/src/Distribution/Simple/Bench.hs @@ -1,6 +1,5 @@ {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} ----------------------------------------------------------------------------- diff --git a/Cabal/src/Distribution/Simple/Build.hs b/Cabal/src/Distribution/Simple/Build.hs index f22b5790239..0ebd51e48ef 100644 --- a/Cabal/src/Distribution/Simple/Build.hs +++ b/Cabal/src/Distribution/Simple/Build.hs @@ -2,7 +2,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TupleSections #-} @@ -275,7 +274,6 @@ dumpBuildInfo -- ^ Flags that the user passed to build -> IO () dumpBuildInfo verbosity distPref dumpBuildInfoFlag pkg_descr lbi flags = do - let mbWorkDir = flagToMaybe $ buildWorkingDir flags when shouldDumpBuildInfo $ do -- Changing this line might break consumers of the dumped build info. -- Announce changes on mailing lists! @@ -289,13 +287,12 @@ dumpBuildInfo verbosity distPref dumpBuildInfoFlag pkg_descr lbi flags = do activeTargets ) - wdir <- absoluteWorkingDir mbWorkDir - (compilerProg, _) <- case flavorToProgram (compilerFlavor (compiler lbi)) of Nothing -> dieWithException verbosity $ UnknownCompilerFlavor (compilerFlavor (compiler lbi)) Just program -> requireProgram verbosity program (withPrograms lbi) + wdir <- absoluteWorkingDirLBI lbi let (warns, json) = mkBuildInfo wdir pkg_descr lbi flags (compilerProg, compiler lbi) activeTargets buildInfoText = renderJson json unless (null warns) $ @@ -791,7 +788,7 @@ testSuiteLibV09AsLibAndExe -> TestSuite -> ComponentLocalBuildInfo -> LocalBuildInfo - -> FilePath + -> AbsolutePath (Dir Pkg) -- ^ absolute inplace dir -> SymbolicPath Pkg (Dir Dist) -> ( PackageDescription @@ -911,7 +908,7 @@ createInternalPackageDB verbosity lbi distPref = do existsAlready <- doesPackageDBExist dbPath when existsAlready $ deletePackageDB dbPath createPackageDB verbosity (compiler lbi) (withPrograms lbi) False dbPath - return (SpecificPackageDB dbPath) + return (SpecificPackageDB dbRelPath) where dbRelPath = internalPackageDBPath lbi distPref dbPath = interpretSymbolicPathLBI lbi dbRelPath diff --git a/Cabal/src/Distribution/Simple/Build/Inputs.hs b/Cabal/src/Distribution/Simple/Build/Inputs.hs index bb984bfb8ab..7fc6faeb192 100644 --- a/Cabal/src/Distribution/Simple/Build/Inputs.hs +++ b/Cabal/src/Distribution/Simple/Build/Inputs.hs @@ -1,7 +1,3 @@ -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PatternSynonyms #-} - module Distribution.Simple.Build.Inputs ( -- * Inputs of actions for building components PreBuildComponentInputs (..) diff --git a/Cabal/src/Distribution/Simple/Build/Macros.hs b/Cabal/src/Distribution/Simple/Build/Macros.hs index 3dbce8616fc..f3c51d71c96 100644 --- a/Cabal/src/Distribution/Simple/Build/Macros.hs +++ b/Cabal/src/Distribution/Simple/Build/Macros.hs @@ -58,7 +58,7 @@ generateCabalMacrosHeader pkg_descr lbi clbi = , let (major1, major2, minor) = majorMinor ver ] , Z.zPackageKey = case clbi of - LibComponentLocalBuildInfo{} -> componentCompatPackageKey clbi + LibComponentLocalBuildInfo{componentCompatPackageKey = compatPackageKey} -> compatPackageKey _ -> "" , Z.zComponentId = prettyShow (componentComponentId clbi) , Z.zPackageVersion = pkgVersion (package pkg_descr) diff --git a/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs b/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs index 66b4af7b05b..be5aa378796 100644 --- a/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs +++ b/Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs @@ -10,7 +10,7 @@ -- Generating the PackageInfo_pkgname module. -- -- This is a module that Cabal generates for the benefit of packages. It --- enables them to find their package informations. +-- enables them to find their package information. module Distribution.Simple.Build.PackageInfoModule ( generatePackageInfoModule ) where diff --git a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs index 25c924720ec..ad979c42951 100644 --- a/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs +++ b/Cabal/src/Distribution/Simple/Build/PathsModule/Z.hs @@ -69,7 +69,6 @@ render z_root = execWriter $ do return () tell "\n" tell "import qualified Control.Exception as Exception\n" - tell "import qualified Data.List as List\n" tell "import Data.Version (Version(..))\n" tell "import System.Environment (getEnv)\n" tell "import Prelude\n" @@ -306,9 +305,14 @@ render z_root = execWriter $ do tell "joinFileName \"\" fname = fname\n" tell "joinFileName \".\" fname = fname\n" tell "joinFileName dir \"\" = dir\n" - tell "joinFileName dir fname\n" - tell " | isPathSeparator (List.last dir) = dir ++ fname\n" + tell "joinFileName dir@(c:cs) fname\n" + tell " | isPathSeparator (lastChar c cs) = dir ++ fname\n" tell " | otherwise = dir ++ pathSeparator : fname\n" + tell " where\n" + tell " -- We do not use Data.List.NonEmpty.last, as that would limit the module to\n" + tell " -- base >= 4.9.0.0 (GHC >= 8.0.1).\n" + tell " lastChar x [] = x\n" + tell " lastChar _ (x:xs) = lastChar x xs\n" tell "\n" tell "pathSeparator :: Char\n" if (zIsWindows z_root) diff --git a/Cabal/src/Distribution/Simple/BuildPaths.hs b/Cabal/src/Distribution/Simple/BuildPaths.hs index 4c44bd380f2..0875de87c91 100644 --- a/Cabal/src/Distribution/Simple/BuildPaths.hs +++ b/Cabal/src/Distribution/Simple/BuildPaths.hs @@ -19,6 +19,9 @@ module Distribution.Simple.BuildPaths , srcPref , buildInfoPref , haddockDirName + , haddockLibraryDirPath + , haddockTestDirPath + , haddockBenchmarkDirPath , hscolourPref , haddockPref , autogenPackageModulesDir @@ -26,12 +29,17 @@ module Distribution.Simple.BuildPaths , autogenPathsModuleName , autogenPackageInfoModuleName , cppHeaderName - , haddockName + , haddockPath + , haddockPackageLibraryName + , haddockPackageLibraryName' + , haddockLibraryName + , haddockLibraryPath , mkGenericStaticLibName , mkLibName , mkProfLibName , mkGenericSharedLibName , mkSharedLibName + , mkProfSharedLibName , mkStaticLibName , mkGenericSharedBundledLibName , exeExtension @@ -43,6 +51,8 @@ module Distribution.Simple.BuildPaths , getSourceFiles , getLibSourceFiles , getExeSourceFiles + , getTestSourceFiles + , getBenchmarkSourceFiles , getFLibSourceFiles , exeBuildDir , flibBuildDir @@ -91,10 +101,44 @@ buildInfoPref distPref = distPref makeRelativePathEx "build-info.json" -- | This is the name of the directory in which the generated haddocks -- should be stored. It does not include the @/doc/html@ prefix. +-- +-- It is also used by `haddock-project` when constructing its output directory. haddockDirName :: HaddockTarget -> PackageDescription -> FilePath haddockDirName ForDevelopment = prettyShow . packageName haddockDirName ForHackage = (++ "-docs") . prettyShow . packageId +-- | This is the name of the directory in which the generated haddocks for +-- a (sub)library should be stored. It does not include the @/doc/html@ +-- prefix. +-- +-- It is also used by `haddock-project` when constructing its output directory. +haddockLibraryDirPath + :: HaddockTarget + -> PackageDescription + -> Library + -> FilePath +haddockLibraryDirPath haddockTarget pkg_descr lib = + case libName lib of + LSubLibName sublib_name -> + haddockDirName haddockTarget pkg_descr prettyShow sublib_name + _ -> haddockDirName haddockTarget pkg_descr + +haddockTestDirPath + :: HaddockTarget + -> PackageDescription + -> TestSuite + -> FilePath +haddockTestDirPath haddockTarget pkg_descr test = + haddockDirName haddockTarget pkg_descr prettyShow (testName test) + +haddockBenchmarkDirPath + :: HaddockTarget + -> PackageDescription + -> Benchmark + -> FilePath +haddockBenchmarkDirPath haddockTarget pkg_descr bench = + haddockDirName haddockTarget pkg_descr prettyShow (benchmarkName bench) + -- | The directory to which generated haddock documentation should be written. haddockPref :: HaddockTarget @@ -138,8 +182,35 @@ autogenPackageInfoModuleName pkg_descr = fixchar '-' = '_' fixchar c = c -haddockName :: PackageDescription -> FilePath -haddockName pkg_descr = prettyShow (packageName pkg_descr) <.> "haddock" +haddockPath :: PackageDescription -> FilePath +haddockPath pkg_descr = prettyShow (packageName pkg_descr) <.> "haddock" + +-- | A name of a (sub)library used by haddock, in the form +-- `:` if it is a sublibrary, or `` if it is the +-- main library. +-- +-- Used by `haddock-project` and `Distribution.Simple.Haddock`. +haddockPackageLibraryName :: PackageDescription -> Library -> String +haddockPackageLibraryName pkg_descr lib = + haddockPackageLibraryName' (packageName pkg_descr) (libName lib) + +haddockPackageLibraryName' :: PackageName -> LibraryName -> String +haddockPackageLibraryName' pkg_name lib_name = + case lib_name of + LSubLibName sublib_name -> + prettyShow pkg_name ++ ":" ++ prettyShow sublib_name + LMainLibName -> prettyShow pkg_name + +-- | A name of a (sub)library used by haddock. +haddockLibraryName :: PackageDescription -> Library -> String +haddockLibraryName pkg_descr lib = + case libName lib of + LSubLibName sublib_name -> prettyShow sublib_name + LMainLibName -> prettyShow (packageName pkg_descr) + +-- | File path of the ".haddock" file. +haddockLibraryPath :: PackageDescription -> Library -> FilePath +haddockLibraryPath pkg_descr lib = haddockLibraryName pkg_descr lib <.> "haddock" -- ----------------------------------------------------------------------------- -- Source File helper @@ -183,6 +254,48 @@ getExeSourceFiles verbosity lbi exe clbi = do : coerceSymbolicPath (exeBuildDir lbi exe) : hsSourceDirs bi +getTestSourceFiles + :: Verbosity + -> LocalBuildInfo + -> TestSuite + -> ComponentLocalBuildInfo + -> IO [(ModuleName.ModuleName, SymbolicPath Pkg 'File)] +getTestSourceFiles verbosity lbi test@TestSuite{testInterface = TestSuiteExeV10 _ path} clbi = do + moduleFiles <- getSourceFiles verbosity mbWorkDir searchpaths modules + srcMainPath <- findFileCwd verbosity mbWorkDir (hsSourceDirs bi) path + return ((ModuleName.main, srcMainPath) : moduleFiles) + where + mbWorkDir = mbWorkDirLBI lbi + bi = testBuildInfo test + modules = otherModules bi + searchpaths = + autogenComponentModulesDir lbi clbi + : autogenPackageModulesDir lbi + : coerceSymbolicPath (testBuildDir lbi test) + : hsSourceDirs bi +getTestSourceFiles _ _ _ _ = return [] + +getBenchmarkSourceFiles + :: Verbosity + -> LocalBuildInfo + -> Benchmark + -> ComponentLocalBuildInfo + -> IO [(ModuleName.ModuleName, SymbolicPath Pkg 'File)] +getBenchmarkSourceFiles verbosity lbi bench@Benchmark{benchmarkInterface = BenchmarkExeV10 _ path} clbi = do + moduleFiles <- getSourceFiles verbosity mbWorkDir searchpaths modules + srcMainPath <- findFileCwd verbosity mbWorkDir (hsSourceDirs bi) path + return ((ModuleName.main, srcMainPath) : moduleFiles) + where + mbWorkDir = mbWorkDirLBI lbi + bi = benchmarkBuildInfo bench + modules = otherModules bi + searchpaths = + autogenComponentModulesDir lbi clbi + : autogenPackageModulesDir lbi + : coerceSymbolicPath (benchmarkBuildDir lbi bench) + : hsSourceDirs bi +getBenchmarkSourceFiles _ _ _ _ = return [] + getFLibSourceFiles :: Verbosity -> LocalBuildInfo @@ -283,6 +396,10 @@ mkSharedLibName :: Platform -> CompilerId -> UnitId -> String mkSharedLibName platform comp lib = mkGenericSharedLibName platform comp (getHSLibraryName lib) +mkProfSharedLibName :: Platform -> CompilerId -> UnitId -> String +mkProfSharedLibName platform comp lib = + mkGenericSharedLibName platform comp (getHSLibraryName lib ++ "_p") + -- Static libs are named the same as shared libraries, only with -- a different extension. mkStaticLibName :: Platform -> CompilerId -> UnitId -> String diff --git a/Cabal/src/Distribution/Simple/BuildTarget.hs b/Cabal/src/Distribution/Simple/BuildTarget.hs index cb5293b18b3..ffa7a609e6b 100644 --- a/Cabal/src/Distribution/Simple/BuildTarget.hs +++ b/Cabal/src/Distribution/Simple/BuildTarget.hs @@ -2,7 +2,6 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} ----------------------------------------------------------------------------- diff --git a/Cabal/src/Distribution/Simple/BuildToolDepends.hs b/Cabal/src/Distribution/Simple/BuildToolDepends.hs index 01592a0970e..2a663ac74fd 100644 --- a/Cabal/src/Distribution/Simple/BuildToolDepends.hs +++ b/Cabal/src/Distribution/Simple/BuildToolDepends.hs @@ -13,7 +13,7 @@ import qualified Data.Map as Map import Distribution.Package import Distribution.PackageDescription --- | Same as 'desugarBuildTool', but requires atomic informations (package +-- | Same as 'desugarBuildTool', but requires atomic information (package -- name, executable names) instead of a whole 'PackageDescription'. desugarBuildToolSimple :: PackageName diff --git a/Cabal/src/Distribution/Simple/BuildWay.hs b/Cabal/src/Distribution/Simple/BuildWay.hs new file mode 100644 index 00000000000..614c229d462 --- /dev/null +++ b/Cabal/src/Distribution/Simple/BuildWay.hs @@ -0,0 +1,14 @@ +{-# LANGUAGE LambdaCase #-} + +module Distribution.Simple.BuildWay where + +data BuildWay = StaticWay | DynWay | ProfWay | ProfDynWay + deriving (Eq, Ord, Show, Read, Enum) + +-- | Returns the object/interface extension prefix for the given build way (e.g. "dyn_" for 'DynWay') +buildWayPrefix :: BuildWay -> String +buildWayPrefix = \case + StaticWay -> "" + ProfWay -> "p_" + DynWay -> "dyn_" + ProfDynWay -> "p_dyn_" diff --git a/Cabal/src/Distribution/Simple/Command.hs b/Cabal/src/Distribution/Simple/Command.hs index b403bb4c01a..e7c9fbd17ea 100644 --- a/Cabal/src/Distribution/Simple/Command.hs +++ b/Cabal/src/Distribution/Simple/Command.hs @@ -624,8 +624,8 @@ data Command action -- | Mark command as hidden. Hidden commands don't show up in the 'progname -- help' or 'progname --help' output. hiddenCommand :: Command action -> Command action -hiddenCommand (Command name synopsys f _cmdType) = - Command name synopsys f HiddenCommand +hiddenCommand (Command name synopsis f _cmdType) = + Command name synopsis f HiddenCommand commandAddAction :: CommandUI flags diff --git a/Cabal/src/Distribution/Simple/Compiler.hs b/Cabal/src/Distribution/Simple/Compiler.hs index ae8d1c05136..c24de767172 100644 --- a/Cabal/src/Distribution/Simple/Compiler.hs +++ b/Cabal/src/Distribution/Simple/Compiler.hs @@ -1,6 +1,6 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE DeriveTraversable #-} ----------------------------------------------------------------------------- @@ -35,11 +35,21 @@ module Distribution.Simple.Compiler , compilerInfo -- * Support for package databases - , PackageDB (..) + , PackageDB , PackageDBStack + , PackageDBCWD + , PackageDBStackCWD + , PackageDBX (..) + , PackageDBStackX + , PackageDBS + , PackageDBStackS , registrationPackageDB , absolutePackageDBPaths , absolutePackageDBPath + , interpretPackageDB + , interpretPackageDBStack + , coercePackageDB + , coercePackageDBStack -- * Support for optimisation levels , OptimisationLevel (..) @@ -63,6 +73,11 @@ module Distribution.Simple.Compiler , unitIdSupported , coverageSupported , profilingSupported + , profilingDynamicSupported + , profilingDynamicSupportedOrUnknown + , profilingVanillaSupported + , profilingVanillaSupportedOrUnknown + , dynamicSupported , backpackSupported , arResponseFilesSupported , arDashLSupported @@ -90,7 +105,6 @@ import Language.Haskell.Extension import qualified Data.Map as Map (lookup) import System.Directory (canonicalizePath) -import System.FilePath (isRelative) data Compiler = Compiler { compilerId :: CompilerId @@ -108,7 +122,7 @@ data Compiler = Compiler , compilerProperties :: Map String String -- ^ A key-value map for properties not covered by the above fields. } - deriving (Eq, Generic, Typeable, Show, Read) + deriving (Eq, Generic, Show, Read) instance Binary Compiler instance Structured Compiler @@ -176,15 +190,17 @@ compilerInfo c = -- the file system. This can be used to build isolated environments of -- packages, for example to build a collection of related packages -- without installing them globally. -data PackageDB +-- +-- Abstracted over +data PackageDBX fp = GlobalPackageDB | UserPackageDB | -- | NB: the path might be relative or it might be absolute - SpecificPackageDB FilePath - deriving (Eq, Generic, Ord, Show, Read, Typeable) + SpecificPackageDB fp + deriving (Eq, Generic, Ord, Show, Read, Functor, Foldable, Traversable) -instance Binary PackageDB -instance Structured PackageDB +instance Binary fp => Binary (PackageDBX fp) +instance Structured fp => Structured (PackageDBX fp) -- | We typically get packages from several databases, and stack them -- together. This type lets us be explicit about that stacking. For example @@ -201,11 +217,20 @@ instance Structured PackageDB -- we can use several custom package dbs and the user package db together. -- -- When it comes to writing, the top most (last) package is used. -type PackageDBStack = [PackageDB] +type PackageDBStackX from = [PackageDBX from] + +type PackageDB = PackageDBX (SymbolicPath Pkg (Dir PkgDB)) +type PackageDBStack = PackageDBStackX (SymbolicPath Pkg (Dir PkgDB)) + +type PackageDBS from = PackageDBX (SymbolicPath from (Dir PkgDB)) +type PackageDBStackS from = PackageDBStackX (SymbolicPath from (Dir PkgDB)) + +type PackageDBCWD = PackageDBX FilePath +type PackageDBStackCWD = PackageDBStackX FilePath -- | Return the package that we should register into. This is the package db at -- the top of the stack. -registrationPackageDB :: PackageDBStack -> PackageDB +registrationPackageDB :: PackageDBStackX from -> PackageDBX from registrationPackageDB dbs = case safeLast dbs of Nothing -> error "internal error: empty package db set" Just p -> p @@ -225,10 +250,30 @@ absolutePackageDBPath _ GlobalPackageDB = return GlobalPackageDB absolutePackageDBPath _ UserPackageDB = return UserPackageDB absolutePackageDBPath mbWorkDir (SpecificPackageDB db) = do let db' = - if isRelative db - then interpretSymbolicPath mbWorkDir (makeRelativePathEx db) - else db - SpecificPackageDB <$> canonicalizePath db' + case symbolicPathRelative_maybe db of + Nothing -> getSymbolicPath db + Just rel_path -> interpretSymbolicPath mbWorkDir rel_path + SpecificPackageDB . makeSymbolicPath <$> canonicalizePath db' + +interpretPackageDB :: Maybe (SymbolicPath CWD (Dir Pkg)) -> PackageDB -> PackageDBCWD +interpretPackageDB _ GlobalPackageDB = GlobalPackageDB +interpretPackageDB _ UserPackageDB = UserPackageDB +interpretPackageDB mbWorkDir (SpecificPackageDB db) = + SpecificPackageDB (interpretSymbolicPath mbWorkDir db) + +interpretPackageDBStack :: Maybe (SymbolicPath CWD (Dir Pkg)) -> PackageDBStack -> PackageDBStackCWD +interpretPackageDBStack mbWorkDir = map (interpretPackageDB mbWorkDir) + +-- | Transform a package db using a FilePath into one using symbolic paths. +coercePackageDB :: PackageDBCWD -> PackageDBX (SymbolicPath CWD (Dir PkgDB)) +coercePackageDB GlobalPackageDB = GlobalPackageDB +coercePackageDB UserPackageDB = UserPackageDB +coercePackageDB (SpecificPackageDB db) = SpecificPackageDB (makeSymbolicPath db) + +coercePackageDBStack + :: [PackageDBCWD] + -> [PackageDBX (SymbolicPath CWD (Dir PkgDB))] +coercePackageDBStack = map coercePackageDB -- ------------------------------------------------------------ @@ -243,7 +288,7 @@ data OptimisationLevel = NoOptimisation | NormalOptimisation | MaximumOptimisation - deriving (Bounded, Enum, Eq, Generic, Read, Show, Typeable) + deriving (Bounded, Enum, Eq, Generic, Read, Show) instance Binary OptimisationLevel instance Structured OptimisationLevel @@ -276,7 +321,7 @@ data DebugInfoLevel | MinimalDebugInfo | NormalDebugInfo | MaximalDebugInfo - deriving (Bounded, Enum, Eq, Generic, Read, Show, Typeable) + deriving (Bounded, Enum, Eq, Generic, Read, Show) instance Binary DebugInfoLevel instance Structured DebugInfoLevel @@ -428,6 +473,49 @@ profilingSupported comp = GHCJS -> True _ -> False +-- | Returns Just if we can certainly determine whether a way is supported +-- if we don't know, return Nothing +waySupported :: String -> Compiler -> Maybe Bool +waySupported way comp = + case compilerFlavor comp of + GHC -> + -- Information about compiler ways is only accurately reported after + -- 9.10.1. Which is useful as this is before profiling dynamic support + -- was introduced. (See GHC #24881) + if compilerVersion comp >= mkVersion [9, 10, 1] + then case Map.lookup "RTS ways" (compilerProperties comp) of + Just ways -> Just (way `elem` words ways) + Nothing -> Just False + else Nothing + _ -> Nothing + +-- | Either profiling is definitely supported or we don't know (so assume +-- it is) +profilingVanillaSupportedOrUnknown :: Compiler -> Bool +profilingVanillaSupportedOrUnknown comp = profilingVanillaSupported comp `elem` [Just True, Nothing] + +-- | Is the compiler distributed with profiling libraries +profilingVanillaSupported :: Compiler -> Maybe Bool +profilingVanillaSupported comp = waySupported "p" comp + +-- | Is the compiler distributed with profiling dynamic libraries +profilingDynamicSupported :: Compiler -> Maybe Bool +profilingDynamicSupported comp = + -- Certainly not before this version, as it was not implemented yet. + if compilerVersion comp <= mkVersion [9, 11, 0] + then Just False + else waySupported "p_dyn" comp + +-- | Either profiling dynamic is definitely supported or we don't know (so assume +-- it is) +profilingDynamicSupportedOrUnknown :: Compiler -> Bool +profilingDynamicSupportedOrUnknown comp = + profilingDynamicSupported comp `elem` [Just True, Nothing] + +-- | Is the compiler distributed with dynamic libraries +dynamicSupported :: Compiler -> Maybe Bool +dynamicSupported comp = waySupported "dyn" comp + -- | Does this compiler support a package database entry with: -- "visibility"? libraryVisibilitySupported :: Compiler -> Bool @@ -470,7 +558,7 @@ data ProfDetailLevel | ProfDetailAllFunctions | ProfDetailTopLate | ProfDetailOther String - deriving (Eq, Generic, Read, Show, Typeable) + deriving (Eq, Generic, Read, Show) instance Binary ProfDetailLevel instance Structured ProfDetailLevel diff --git a/Cabal/src/Distribution/Simple/Configure.hs b/Cabal/src/Distribution/Simple/Configure.hs index 9e561e791c6..7c96efb33fc 100644 --- a/Cabal/src/Distribution/Simple/Configure.hs +++ b/Cabal/src/Distribution/Simple/Configure.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} @@ -81,6 +80,7 @@ import Distribution.PackageDescription.Configuration import Distribution.PackageDescription.PrettyPrint import Distribution.Simple.BuildTarget import Distribution.Simple.BuildToolDepends +import Distribution.Simple.BuildWay import Distribution.Simple.Compiler import Distribution.Simple.LocalBuildInfo import Distribution.Simple.PackageIndex (InstalledPackageIndex, lookupUnitId) @@ -105,12 +105,15 @@ import qualified Distribution.Simple.SetupHooks.Internal as SetupHooks import Distribution.Simple.Utils import Distribution.System import Distribution.Types.ComponentRequestedSpec +import Distribution.Types.DependencySatisfaction (DependencySatisfaction (..)) import Distribution.Types.GivenComponent import qualified Distribution.Types.LocalBuildConfig as LBC import Distribution.Types.LocalBuildInfo +import Distribution.Types.MissingDependencyReason (MissingDependencyReason (..)) import Distribution.Types.PackageVersionConstraint import Distribution.Utils.LogProgress import Distribution.Utils.NubList +import Distribution.Utils.String (trim) import Distribution.Verbosity import Distribution.Version @@ -153,7 +156,6 @@ import System.Directory ( canonicalizePath , createDirectoryIfMissing , doesFileExist - , getTemporaryDirectory , removeFile ) import System.FilePath @@ -201,26 +203,25 @@ data ConfigStateFileError PackageIdentifier PackageIdentifier (Either ConfigStateFileError LocalBuildInfo) - deriving (Typeable) -- | Format a 'ConfigStateFileError' as a user-facing error message. dispConfigStateFileError :: ConfigStateFileError -> Doc dispConfigStateFileError ConfigStateFileNoHeader = text "Saved package config file header is missing." - <+> text "Re-run the 'configure' command." + <+> text "Re-run the 'Setup configure' command." dispConfigStateFileError ConfigStateFileBadHeader = text "Saved package config file header is corrupt." - <+> text "Re-run the 'configure' command." + <+> text "Re-run the 'Setup configure' command." dispConfigStateFileError ConfigStateFileNoParse = text "Saved package config file is corrupt." - <+> text "Re-run the 'configure' command." + <+> text "Re-run the 'Setup configure' command." dispConfigStateFileError ConfigStateFileMissing{} = - text "Run the 'configure' command first." + text "Run the 'Setup configure' command first." dispConfigStateFileError (ConfigStateFileBadVersion oldCabal oldCompiler _) = text "Saved package config file is outdated:" $+$ badCabal $+$ badCompiler - $+$ text "Re-run the 'configure' command." + $+$ text "Re-run the 'Setup configure' command." where badCabal = text "• the Cabal version changed from" @@ -709,7 +710,7 @@ computeLocalBuildConfig cfg comp programDb = do -- rely on them. By the time that bug was fixed, ghci had -- been changed to read shared libraries instead of archive -- files (see next code block). - not (GHC.isDynamic comp) + not (GHC.compilerBuildWay comp `elem` [DynWay, ProfDynWay]) CompilerId GHCJS _ -> not (GHCJS.isDynamic comp) _ -> False @@ -734,7 +735,7 @@ computeLocalBuildConfig cfg comp programDb = do CompilerId GHC _ -> -- if ghc is dynamic, then ghci needs a shared -- library, so we build one by default. - GHC.isDynamic comp + GHC.compilerBuildWay comp == DynWay CompilerId GHCJS _ -> GHCJS.isDynamic comp _ -> False @@ -754,12 +755,6 @@ computeLocalBuildConfig cfg comp programDb = do withFullyStaticExe_ = fromFlag $ configFullyStaticExe cfg - when (withDynExe_ && not withSharedLib_) $ - warn verbosity $ - "Executables will use dynamic linking, but a shared library " - ++ "is not being built. Linking will fail if any executables " - ++ "depend on the library." - setProfiling <- configureProfiling verbosity cfg comp setCoverage <- configureCoverage verbosity cfg comp @@ -792,6 +787,7 @@ computeLocalBuildConfig cfg comp programDb = do , withDynExe = withDynExe_ , withFullyStaticExe = withFullyStaticExe_ , withProfLib = False + , withProfLibShared = False , withProfLibDetail = ProfDetailNone , withProfExe = False , withProfExeDetail = ProfDetailNone @@ -807,6 +803,20 @@ computeLocalBuildConfig cfg comp programDb = do , relocatable = fromFlagOrDefault False $ configRelocatable cfg } + -- Dynamic executable, but no shared vanilla libraries + when (LBC.withDynExe buildOptions && not (LBC.withProfExe buildOptions) && not (LBC.withSharedLib buildOptions)) $ + warn verbosity $ + "Executables will use dynamic linking, but a shared library " + ++ "is not being built. Linking will fail if any executables " + ++ "depend on the library." + + -- Profiled dynamic executable, but no shared profiling libraries + when (LBC.withDynExe buildOptions && LBC.withProfExe buildOptions && not (LBC.withProfLibShared buildOptions)) $ + warn verbosity $ + "Executables will use profiled dynamic linking, but a profiled shared library " + ++ "is not being built. Linking will fail if any executables " + ++ "depend on the library." + return $ LBC.LocalBuildConfig { extraConfigArgs = [] -- Currently configure does not @@ -818,7 +828,7 @@ computeLocalBuildConfig cfg comp programDb = do data PackageInfo = PackageInfo { internalPackageSet :: Set LibraryName - , promisedDepsSet :: Map (PackageName, ComponentName) ComponentId + , promisedDepsSet :: Map (PackageName, ComponentName) PromisedComponent , installedPackageSet :: InstalledPackageIndex , requiredDepsMap :: Map (PackageName, ComponentName) InstalledPackageInfo } @@ -848,29 +858,33 @@ configurePackage cfg lbc0 pkg_descr00 flags enabled comp platform programDb0 pac -- right before calling configurePackage? -- Configure certain external build tools, see below for which ones. - let requiredBuildTools = do - bi <- enabledBuildInfos pkg_descr0 enabled - -- First, we collect any tool dep that we know is external. This is, - -- in practice: - -- - -- 1. `build-tools` entries on the whitelist - -- - -- 2. `build-tool-depends` that aren't from the current package. - let externBuildToolDeps = - [ LegacyExeDependency (unUnqualComponentName eName) versionRange - | buildTool@(ExeDependency _ eName versionRange) <- - getAllToolDependencies pkg_descr0 bi - , not $ isInternal pkg_descr0 buildTool - ] - -- Second, we collect any build-tools entry we don't know how to - -- desugar. We'll never have any idea how to build them, so we just - -- hope they are already on the PATH. - let unknownBuildTools = - [ buildTool - | buildTool <- buildTools bi - , Nothing == desugarBuildTool pkg_descr0 buildTool - ] - externBuildToolDeps ++ unknownBuildTools + let requiredBuildTools + -- If --ignore-build-tools is set, no build tool is required: + | fromFlagOrDefault False $ configIgnoreBuildTools cfg = + [] + | otherwise = do + bi <- enabledBuildInfos pkg_descr0 enabled + -- First, we collect any tool dep that we know is external. This is, + -- in practice: + -- + -- 1. `build-tools` entries on the whitelist + -- + -- 2. `build-tool-depends` that aren't from the current package. + let externBuildToolDeps = + [ LegacyExeDependency (unUnqualComponentName eName) versionRange + | buildTool@(ExeDependency _ eName versionRange) <- + getAllToolDependencies pkg_descr0 bi + , not $ isInternal pkg_descr0 buildTool + ] + -- Second, we collect any build-tools entry we don't know how to + -- desugar. We'll never have any idea how to build them, so we just + -- hope they are already on the PATH. + let unknownBuildTools = + [ buildTool + | buildTool <- buildTools bi + , Nothing == desugarBuildTool pkg_descr0 buildTool + ] + externBuildToolDeps ++ unknownBuildTools programDb1 <- configureAllKnownPrograms (lessVerbose verbosity) programDb0 @@ -1099,7 +1113,7 @@ finalCheckPackage -> LBC.PackageBuildDescr -> HookedBuildInfo -> PackageInfo - -> IO ([PreExistingComponent], [PromisedComponent]) + -> IO ([PreExistingComponent], [ConfiguredPromisedComponent]) finalCheckPackage g_pkg_descr ( LBC.PackageBuildDescr @@ -1196,7 +1210,7 @@ configureComponents :: LBC.LocalBuildConfig -> LBC.PackageBuildDescr -> PackageInfo - -> ([PreExistingComponent], [PromisedComponent]) + -> ([PreExistingComponent], [ConfiguredPromisedComponent]) -> IO LocalBuildInfo configureComponents lbc@(LBC.LocalBuildConfig{withPrograms = programDb}) @@ -1266,7 +1280,9 @@ configureComponents extraCoverageUnitIds = case enabled of -- Whole package configure, add package libs ComponentRequestedSpec{} -> mapMaybe mbCompUnitId buildComponents - -- Component configure, no need to do anything + -- Component configure, no need to do anything since + -- extra-coverage-for will be passed for all other components that + -- should be covered. OneComponentRequestedSpec{} -> [] mbCompUnitId LibComponentLocalBuildInfo{componentUnitId} = Just componentUnitId mbCompUnitId _ = Nothing @@ -1291,6 +1307,9 @@ configureComponents when (LBC.relocatable $ LBC.withBuildOptions lbc) $ checkRelocatable verbosity pkg_descr lbi + when (LBC.withDynExe $ LBC.withBuildOptions lbc) $ + checkSharedExes verbosity lbi + -- TODO: This is not entirely correct, because the dirs may vary -- across libraries/executables let dirs = absoluteInstallDirs pkg_descr lbi NoCopyDest @@ -1354,8 +1373,8 @@ configureComponents return lbi -mkPromisedDepsSet :: [GivenComponent] -> Map (PackageName, ComponentName) ComponentId -mkPromisedDepsSet comps = Map.fromList [((pn, CLibName ln), cid) | GivenComponent pn ln cid <- comps] +mkPromisedDepsSet :: [PromisedComponent] -> Map (PackageName, ComponentName) PromisedComponent +mkPromisedDepsSet comps = Map.fromList [((packageName pn, CLibName ln), p) | p@(PromisedComponent pn ln _) <- comps] -- | Adds the extra program paths from the flags provided to @configure@ as -- well as specified locations for certain known programs and their default @@ -1458,10 +1477,10 @@ dependencySatisfiable -- ^ installed set -> Set LibraryName -- ^ library components - -> Map (PackageName, ComponentName) ComponentId + -> Map (PackageName, ComponentName) PromisedComponent -> Map (PackageName, ComponentName) InstalledPackageInfo -- ^ required dependencies - -> (Dependency -> Bool) + -> (Dependency -> DependencySatisfaction) dependencySatisfiable use_external_internal_deps exact_config @@ -1487,16 +1506,14 @@ dependencySatisfiable internalDepSatisfiable else -- Backward compatibility for the old sublibrary syntax - ( sublibs == mainLibSet - && Map.member - ( pn - , CLibName $ - LSubLibName $ - packageNameToUnqualComponentName depName - ) - requiredDepsMap - ) - || all visible sublibs + let depComponentName = + CLibName $ LSubLibName $ packageNameToUnqualComponentName depName + invisibleLibraries = NES.filter (not . visible) sublibs + in if sublibs == mainLibSet && Map.member (pn, depComponentName) requiredDepsMap + then Satisfied + else case nonEmpty $ Set.toList invisibleLibraries of + Nothing -> Satisfied + Just invisibleLibraries' -> Unsatisfied $ MissingLibrary invisibleLibraries' | isInternalDep = if use_external_internal_deps then -- When we are doing per-component configure, we now need to @@ -1513,12 +1530,31 @@ dependencySatisfiable isInternalDep = pn == depName depSatisfiable = - not . null $ PackageIndex.lookupDependency installedPackageSet depName vr + let allVersions = PackageIndex.lookupPackageName installedPackageSet depName + eligibleVersions = + [ version + | (version, _infos) <- PackageIndex.eligibleDependencies allVersions + ] + in if null $ PackageIndex.matchingDependencies vr allVersions + then + if null eligibleVersions + then Unsatisfied $ MissingPackage + else Unsatisfied $ WrongVersion eligibleVersions + else Satisfied internalDepSatisfiable = - Set.isSubsetOf (NES.toSet sublibs) packageLibraries + let missingLibraries = (NES.toSet sublibs) `Set.difference` packageLibraries + in case nonEmpty $ Set.toList missingLibraries of + Nothing -> Satisfied + Just missingLibraries' -> Unsatisfied $ MissingLibrary missingLibraries' + internalDepSatisfiableExternally = - all (\ln -> not $ null $ PackageIndex.lookupInternalDependency installedPackageSet pn vr ln) sublibs + -- TODO: Might need to propagate information on which versions _are_ available, if any... + let missingLibraries = + NES.filter (null . PackageIndex.lookupInternalDependency installedPackageSet pn vr) sublibs + in case nonEmpty $ Set.toList missingLibraries of + Nothing -> Satisfied + Just missingLibraries' -> Unsatisfied $ MissingLibrary missingLibraries' -- Check whether a library exists and is visible. -- We don't disambiguate between dependency on non-existent or private @@ -1553,7 +1589,7 @@ configureFinalizedPackage -> ConfigFlags -> ComponentRequestedSpec -> [PackageVersionConstraint] - -> (Dependency -> Bool) + -> (Dependency -> DependencySatisfaction) -- ^ tests if a dependency is satisfiable. -- Might say it's satisfiable even when not. -> Compiler @@ -1620,14 +1656,14 @@ configureDependencies :: Verbosity -> UseExternalInternalDeps -> Set LibraryName - -> Map (PackageName, ComponentName) ComponentId + -> Map (PackageName, ComponentName) PromisedComponent -> InstalledPackageIndex -- ^ installed packages -> Map (PackageName, ComponentName) InstalledPackageInfo -- ^ required deps -> PackageDescription -> ComponentRequestedSpec - -> IO ([PreExistingComponent], [PromisedComponent]) + -> IO ([PreExistingComponent], [ConfiguredPromisedComponent]) configureDependencies verbosity use_external_internal_deps @@ -1732,7 +1768,7 @@ configureCoverage verbosity cfg comp = do -- -- Note that @--enable-executable-profiling@ also affects profiling -- of benchmarks and (non-detailed) test suites. -computeEffectiveProfiling :: ConfigFlags -> (Bool {- lib -}, Bool {- exe -}) +computeEffectiveProfiling :: ConfigFlags -> (Bool {- lib vanilla-}, Bool {- lib shared -}, Bool {- exe -}) computeEffectiveProfiling cfg = -- The --profiling flag sets the default for both libs and exes, -- but can be overridden by --library-profiling, or the old deprecated @@ -1740,15 +1776,20 @@ computeEffectiveProfiling cfg = -- -- The --profiling-detail and --library-profiling-detail flags behave -- similarly - let tryExeProfiling = + let dynamicExe = fromFlagOrDefault False (configDynExe cfg) + tryExeProfiling = fromFlagOrDefault False (mappend (configProf cfg) (configProfExe cfg)) tryLibProfiling = fromFlagOrDefault - tryExeProfiling - (mappend (configProf cfg) (configProfLib cfg)) - in (tryLibProfiling, tryExeProfiling) + (tryExeProfiling && not dynamicExe) + (configProfLib cfg) + tryLibProfilingShared = + fromFlagOrDefault + (tryExeProfiling && dynamicExe) + (configProfShared cfg) + in (tryLibProfiling, tryLibProfilingShared, tryExeProfiling) -- | Select and apply profiling settings for the build based on the -- 'ConfigFlags' and 'Compiler'. @@ -1758,7 +1799,7 @@ configureProfiling -> Compiler -> IO (LBC.BuildOptions -> LBC.BuildOptions) configureProfiling verbosity cfg comp = do - let (tryLibProfiling, tryExeProfiling) = computeEffectiveProfiling cfg + let (tryLibProfiling, tryLibProfilingShared, tryExeProfiling) = computeEffectiveProfiling cfg tryExeProfileLevel = fromFlagOrDefault @@ -1785,8 +1826,8 @@ configureProfiling verbosity cfg comp = do return ProfDetailDefault checkProfileLevel other = return other - (exeProfWithoutLibProf, applyProfiling) <- - if profilingSupported comp + applyProfiling <- + if profilingSupported comp && (profilingVanillaSupportedOrUnknown comp || profilingDynamicSupportedOrUnknown comp) then do exeLevel <- checkProfileLevel tryExeProfileLevel libLevel <- checkProfileLevel tryLibProfileLevel @@ -1797,11 +1838,46 @@ configureProfiling verbosity cfg comp = do , LBC.withProfExe = tryExeProfiling , LBC.withProfExeDetail = exeLevel } - return (tryExeProfiling && not tryLibProfiling, apply) + let compilerSupportsProfilingDynamic = profilingDynamicSupportedOrUnknown comp + apply2 <- + if compilerSupportsProfilingDynamic + then -- Case 1: We support profiled shared libraries so turn on shared profiling + -- libraries if the user asked for it. + return $ \buildOptions -> apply buildOptions{LBC.withProfLibShared = tryLibProfilingShared} + else -- Case 2: Compiler doesn't support profiling shared so turn them off + do + -- If we wanted to enable profiling shared libraries.. tell the + -- user we couldn't. + when (profilingVanillaSupportedOrUnknown comp && tryLibProfilingShared) $ + warn + verbosity + ( "The compiler " + ++ showCompilerId comp + ++ " does not support " + ++ "profiling shared objects. Static profiled objects " + ++ "will be built." + ) + return $ \buildOptions -> + let original_options = apply buildOptions + in original_options + { LBC.withProfLibShared = False + , LBC.withProfLib = profilingVanillaSupportedOrUnknown comp && (tryLibProfilingShared || LBC.withProfLib original_options) + , LBC.withDynExe = if LBC.withProfExe original_options then False else LBC.withDynExe original_options + } + + when (tryExeProfiling && not (tryLibProfiling || tryLibProfilingShared)) $ do + warn + verbosity + ( "Executables will be built with profiling, but library " + ++ "profiling is disabled. Linking will fail if any executables " + ++ "depend on the library." + ) + return apply2 else do let apply buildOptions = buildOptions { LBC.withProfLib = False + , LBC.withProfLibShared = False , LBC.withProfLibDetail = ProfDetailNone , LBC.withProfExe = False , LBC.withProfExeDetail = ProfDetailNone @@ -1814,15 +1890,7 @@ configureProfiling verbosity cfg comp = do ++ " does not support " ++ "profiling. Profiling has been disabled." ) - return (False, apply) - - when exeProfWithoutLibProf $ - warn - verbosity - ( "Executables will be built with profiling, but library " - ++ "profiling is disabled. Linking will fail if any executables " - ++ "depend on the library." - ) + return apply return applyProfiling @@ -1861,7 +1929,7 @@ data DependencyResolution -- we need to build packages in the interactive ghci session, no matter -- whether they have been built before. -- Building them in the configure phase is then redundant and costs time. - PromisedDependency PromisedComponent + PromisedDependency ConfiguredPromisedComponent | -- | An internal dependency ('PackageId' should be a library name) -- which we are going to have to build. (The -- 'PackageId' here is a hack to get a modest amount of @@ -1874,7 +1942,7 @@ selectDependency -- ^ Package id of current package -> Set LibraryName -- ^ package libraries - -> Map (PackageName, ComponentName) ComponentId + -> Map (PackageName, ComponentName) PromisedComponent -- ^ Set of components that are promised, i.e. are not installed already. See 'PromisedDependency' for more details. -> InstalledPackageIndex -- ^ Installed packages @@ -1926,8 +1994,8 @@ selectDependency -- We have to look it up externally do_external_external :: LibraryName -> Either FailedDependency DependencyResolution do_external_external lib - | Just cid <- Map.lookup (dep_pkgname, CLibName lib) promisedIndex = - return $ PromisedDependency (PromisedComponent dep_pkgname (AnnotatedId currentCabalId (CLibName lib) cid)) + | Just pc <- Map.lookup (dep_pkgname, CLibName lib) promisedIndex = + return $ PromisedDependency (ConfiguredPromisedComponent dep_pkgname (AnnotatedId (promisedComponentPackage pc) (CLibName lib) (promisedComponentId pc))) do_external_external lib = do ipi <- case Map.lookup (dep_pkgname, CLibName lib) requiredDepsMap of -- If we know the exact pkg to use, then use it. @@ -1940,8 +2008,8 @@ selectDependency do_external_internal :: LibraryName -> Either FailedDependency DependencyResolution do_external_internal lib - | Just cid <- Map.lookup (dep_pkgname, CLibName lib) promisedIndex = - return $ PromisedDependency (PromisedComponent dep_pkgname (AnnotatedId currentCabalId (CLibName lib) cid)) + | Just pc <- Map.lookup (dep_pkgname, CLibName lib) promisedIndex = + return $ PromisedDependency (ConfiguredPromisedComponent dep_pkgname (AnnotatedId (promisedComponentPackage pc) (CLibName lib) (promisedComponentId pc))) do_external_internal lib = do ipi <- case Map.lookup (dep_pkgname, CLibName lib) requiredDepsMap of -- If we know the exact pkg to use, then use it. @@ -1985,8 +2053,8 @@ reportFailedDependencies verbosity failed = getInstalledPackages :: Verbosity -> Compiler - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDBStack + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBStackX (SymbolicPath from (Dir PkgDB)) -- ^ The stack of package databases. -> ProgramDb -> IO InstalledPackageIndex @@ -2000,14 +2068,14 @@ getInstalledPackages verbosity comp mbWorkDir packageDBs progdb = do case compilerFlavor comp of GHC -> GHC.getInstalledPackages verbosity comp mbWorkDir packageDBs' progdb GHCJS -> GHCJS.getInstalledPackages verbosity mbWorkDir packageDBs' progdb - UHC -> UHC.getInstalledPackages verbosity comp packageDBs' progdb + UHC -> UHC.getInstalledPackages verbosity comp mbWorkDir packageDBs' progdb HaskellSuite{} -> HaskellSuite.getInstalledPackages verbosity packageDBs' progdb flv -> dieWithException verbosity $ HowToFindInstalledPackages flv where packageDBExists (SpecificPackageDB path0) = do - let path = interpretSymbolicPath mbWorkDir $ makeSymbolicPath path0 + let path = interpretSymbolicPath mbWorkDir path0 exists <- doesPathExist path unless exists $ warn verbosity $ @@ -2045,8 +2113,8 @@ getPackageDBContents verbosity comp mbWorkDir packageDB progdb = do getInstalledPackagesMonitorFiles :: Verbosity -> Compiler - -> Maybe (SymbolicPath CWD ('Dir Pkg)) - -> PackageDBStack + -> Maybe (SymbolicPath CWD ('Dir from)) + -> PackageDBStackS from -> ProgramDb -> Platform -> IO [FilePath] @@ -2093,7 +2161,7 @@ getInstalledPackagesById verbosity lbi@LocalBuildInfo{compiler = comp, withPacka -- @--global@, @--user@ and @--package-db=global|user|clear|$file@. -- This function combines the global/user flag and interprets the package-db -- flag into a single package db stack. -interpretPackageDbFlags :: Bool -> [Maybe PackageDB] -> PackageDBStack +interpretPackageDbFlags :: Bool -> [Maybe (PackageDBX fp)] -> PackageDBStackX fp interpretPackageDbFlags userInstall specificDBs = extra initialStack specificDBs where @@ -2210,55 +2278,77 @@ configureRequiredProgram verbosity progdb (LegacyExeDependency progName verRange) = - case lookupKnownProgram progName progdb of - Nothing -> - -- Try to configure it as a 'simpleProgram' automatically - -- - -- There's a bit of a story behind this line. In old versions - -- of Cabal, there were only internal build-tools dependencies. So the - -- behavior in this case was: - -- - -- - If a build-tool dependency was internal, don't do - -- any checking. + case lookupProgramByName progName progdb of + Just prog -> + -- If the program has already been configured, use it + -- (as long as the version is compatible). -- - -- - If it was external, call 'configureRequiredProgram' to - -- "configure" the executable. In particular, if - -- the program was not "known" (present in 'ProgramDb'), - -- then we would just error. This was fine, because - -- the only way a program could be executed from 'ProgramDb' - -- is if some library code from Cabal actually called it, - -- and the pre-existing Cabal code only calls known - -- programs from 'defaultProgramDb', and so if it - -- is calling something else, you have a Custom setup - -- script, and in that case you are expected to register - -- the program you want to call in the ProgramDb. - -- - -- OK, so that was fine, until I (ezyang, in 2016) refactored - -- Cabal to support per-component builds. In this case, what - -- was previously an internal build-tool dependency now became - -- an external one, and now previously "internal" dependencies - -- are now external. But these are permitted to exist even - -- when they are not previously configured (something that - -- can only occur by a Custom script.) - -- - -- So, I decided, "Fine, let's just accept these in any - -- case." Thus this line. The alternative would have been to - -- somehow detect when a build-tools dependency was "internal" (by - -- looking at the unflattened package description) but this - -- would also be incompatible with future work to support - -- external executable dependencies: we definitely cannot - -- assume they will be preinitialized in the 'ProgramDb'. - configureProgram verbosity (simpleProgram progName) progdb - Just prog - -- requireProgramVersion always requires the program have a version - -- but if the user says "build-depends: foo" ie no version constraint - -- then we should not fail if we cannot discover the program version. - | verRange == anyVersion -> do - (_, progdb') <- requireProgram verbosity prog progdb - return progdb' - | otherwise -> do - (_, _, progdb') <- requireProgramVersion verbosity prog verRange progdb - return progdb' + -- Not doing so means falling back to the "simpleProgram" path below, + -- which might fail if the program has custom logic to find a version + -- (such as hsc2hs). + let loc = locationPath $ programLocation prog + in case programVersion prog of + Nothing + | verRange == anyVersion -> + return progdb + | otherwise -> + dieWithException verbosity $! + UnknownVersionDb (programId prog) verRange loc + Just version + | withinRange version verRange -> + return progdb + | otherwise -> + dieWithException verbosity $! + BadVersionDb (programId prog) version verRange loc + Nothing -> + -- Otherwise, try to configure it as a 'simpleProgram' automatically + case lookupKnownProgram progName progdb of + Nothing -> + -- There's a bit of a story behind this line. In old versions + -- of Cabal, there were only internal build-tools dependencies. So the + -- behavior in this case was: + -- + -- - If a build-tool dependency was internal, don't do + -- any checking. + -- + -- - If it was external, call 'configureRequiredProgram' to + -- "configure" the executable. In particular, if + -- the program was not "known" (present in 'ProgramDb'), + -- then we would just error. This was fine, because + -- the only way a program could be executed from 'ProgramDb' + -- is if some library code from Cabal actually called it, + -- and the pre-existing Cabal code only calls known + -- programs from 'defaultProgramDb', and so if it + -- is calling something else, you have a Custom setup + -- script, and in that case you are expected to register + -- the program you want to call in the ProgramDb. + -- + -- OK, so that was fine, until I (ezyang, in 2016) refactored + -- Cabal to support per-component builds. In this case, what + -- was previously an internal build-tool dependency now became + -- an external one, and now previously "internal" dependencies + -- are now external. But these are permitted to exist even + -- when they are not previously configured (something that + -- can only occur by a Custom script.) + -- + -- So, I decided, "Fine, let's just accept these in any + -- case." Thus this line. The alternative would have been to + -- somehow detect when a build-tools dependency was "internal" (by + -- looking at the unflattened package description) but this + -- would also be incompatible with future work to support + -- external executable dependencies: we definitely cannot + -- assume they will be preinitialized in the 'ProgramDb'. + configureProgram verbosity (simpleProgram progName) progdb + Just prog + -- requireProgramVersion always requires the program have a version + -- but if the user says "build-depends: foo" ie no version constraint + -- then we should not fail if we cannot discover the program version. + | verRange == anyVersion -> do + (_, progdb') <- requireProgram verbosity prog progdb + return progdb' + | otherwise -> do + (_, _, progdb') <- requireProgramVersion verbosity prog verRange progdb + return progdb' -- ----------------------------------------------------------------------------- -- Configuring pkg-config package dependencies @@ -2306,7 +2396,6 @@ configurePkgconfigPackages verbosity pkg_descr progdb enabled pkgconfig ["--modversion", pkg] `catchIO` (\_ -> dieWithException verbosity $ PkgConfigNotFound pkg versionRequirement) `catchExit` (\_ -> dieWithException verbosity $ PkgConfigNotFound pkg versionRequirement) - let trim = dropWhile isSpace . dropWhileEnd isSpace let v = PkgconfigVersion (toUTF8BS $ trim version) if not (withinPkgconfigVersionRange v range) then dieWithException verbosity $ BadVersion pkg versionRequirement v @@ -2601,10 +2690,9 @@ checkForeignDeps pkg lbi verbosity = builds :: String -> [ProgArg] -> IO Bool builds program args = - do - tempDir <- makeSymbolicPath <$> getTemporaryDirectory - withTempFileCwd mbWorkDir tempDir ".c" $ \cName cHnd -> - withTempFileCwd mbWorkDir tempDir "" $ \oNname oHnd -> do + withTempFileCwd ".c" $ \cName cHnd -> + withTempFileCwd "" $ \oNname oHnd -> + do hPutStrLn cHnd program hClose cHnd hClose oHnd @@ -2616,8 +2704,8 @@ checkForeignDeps pkg lbi verbosity = (withPrograms lbi) (getSymbolicPath cName : "-o" : getSymbolicPath oNname : args) return True - `catchIO` (\_ -> return False) - `catchExit` (\_ -> return False) + `catchIO` (\_ -> return False) + `catchExit` (\_ -> return False) explainErrors Nothing [] = return () -- should be impossible! explainErrors _ _ @@ -2651,6 +2739,18 @@ checkPackageProblems verbosity dir gpkg pkg = do classEW (PackageDistSuspiciousWarn _) = Nothing classEW (PackageDistInexcusable _) = Nothing +-- | Perform checks if a shared executable can be built +checkSharedExes + :: Verbosity + -> LocalBuildInfo + -> IO () +checkSharedExes verbosity lbi = + when (os == Windows) $ + dieWithException verbosity $ + NoOSSupport os "shared executables" + where + (Platform _ os) = hostPlatform lbi + -- | Preform checks if a relocatable build is allowed checkRelocatable :: Verbosity @@ -2673,7 +2773,7 @@ checkRelocatable verbosity pkg lbi = checkOS = unless (os `elem` [OSX, Linux]) $ dieWithException verbosity $ - NoOSSupport os + NoOSSupport os "relocatable builds" where (Platform _ os) = hostPlatform lbi diff --git a/Cabal/src/Distribution/Simple/ConfigureScript.hs b/Cabal/src/Distribution/Simple/ConfigureScript.hs index 3661c683ceb..cf2a18297ee 100644 --- a/Cabal/src/Distribution/Simple/ConfigureScript.hs +++ b/Cabal/src/Distribution/Simple/ConfigureScript.hs @@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} @@ -23,6 +24,7 @@ import Prelude () -- local import Distribution.PackageDescription import Distribution.Pretty +import Distribution.Simple.Configure (findDistPrefOrDefault) import Distribution.Simple.Errors import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Program @@ -30,12 +32,12 @@ import Distribution.Simple.Program.Db import Distribution.Simple.Setup.Common import Distribution.Simple.Setup.Config import Distribution.Simple.Utils -import Distribution.System (buildPlatform) +import Distribution.System (Platform, buildPlatform) import Distribution.Utils.NubList import Distribution.Utils.Path -import Distribution.Verbosity -- Base +import System.Directory (createDirectoryIfMissing, doesFileExist) import qualified System.FilePath as FilePath #ifdef mingw32_HOST_OS import System.FilePath (normalise, splitDrive) @@ -48,14 +50,25 @@ import qualified Data.List.NonEmpty as NonEmpty import qualified Data.Map as Map runConfigureScript - :: Verbosity - -> ConfigFlags - -> LocalBuildInfo + :: ConfigFlags + -> FlagAssignment + -> ProgramDb + -> Platform + -- ^ host platform -> IO () -runConfigureScript verbosity flags lbi = do +runConfigureScript cfg flags programDb hp = do + let commonCfg = configCommonFlags cfg + verbosity = fromFlag $ setupVerbosity commonCfg + dist_dir <- findDistPrefOrDefault $ setupDistPref commonCfg + let build_dir = dist_dir makeRelativePathEx "build" + mbWorkDir = flagToMaybe $ setupWorkingDir commonCfg + configureScriptPath = packageRoot commonCfg "configure" + confExists <- doesFileExist configureScriptPath + unless confExists $ + dieWithException verbosity (ConfigureScriptNotFound configureScriptPath) + configureFile <- + makeAbsolute $ configureScriptPath env <- getEnvironment - let commonFlags = configCommonFlags flags - programDb = withPrograms lbi (ccProg, ccFlags) <- configureCCompiler verbosity programDb ccProgShort <- getShortPathName ccProg -- The C compiler's compilation and linker flags (e.g. @@ -64,8 +77,8 @@ runConfigureScript verbosity flags lbi = do -- to ccFlags -- We don't try and tell configure which ld to use, as we don't have -- a way to pass its flags too - configureFile <- - makeAbsolute $ packageRoot commonFlags "configure" + + let configureFile' = toUnix configureFile -- autoconf is fussy about filenames, and has a set of forbidden -- characters that can't appear in the build directory, etc: -- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions @@ -79,7 +92,6 @@ runConfigureScript verbosity flags lbi = do -- TODO: We don't check for colons, tildes or leading dashes. We -- also should check the builddir's path, destdir, and all other -- paths as well. - let configureFile' = toUnix configureFile for_ badAutoconfCharacters $ \(c, cname) -> when (c `elem` FilePath.dropDrive configureFile') $ warn verbosity $ @@ -111,7 +123,7 @@ runConfigureScript verbosity flags lbi = do Map.fromListWith (<>) [ (flagEnvVar flag, (flag, bool) :| []) - | (flag, bool) <- unFlagAssignment $ flagAssignment lbi + | (flag, bool) <- unFlagAssignment flags ] -- A map from env vars to flag names to the single flag we will go with cabalFlagMapDeconflicted :: Map String (FlagName, Bool) <- @@ -143,10 +155,10 @@ runConfigureScript verbosity flags lbi = do ] ++ [ ( "CABAL_FLAGS" - , Just $ unwords [showFlagValue fv | fv <- unFlagAssignment $ flagAssignment lbi] + , Just $ unwords [showFlagValue fv | fv <- unFlagAssignment flags] ) ] - let extraPath = fromNubList $ configProgramPathExtra flags + let extraPath = fromNubList $ configProgramPathExtra cfg let cflagsEnv = maybe (unwords ccFlags) (++ (" " ++ unwords ccFlags)) $ lookup "CFLAGS" env @@ -160,7 +172,6 @@ runConfigureScript verbosity flags lbi = do ("CFLAGS", Just cflagsEnv) : [("PATH", Just pathEnv) | not (null extraPath)] ++ cabalFlagEnv - hp = hostPlatform lbi maybeHostFlag = if hp == buildPlatform then [] else ["--host=" ++ show (pretty hp)] args' = configureFile' : args ++ ["CC=" ++ ccProgShort] ++ maybeHostFlag shProg = simpleProgram "sh" @@ -169,14 +180,16 @@ runConfigureScript verbosity flags lbi = do lookupProgram shProg `fmap` configureProgram verbosity shProg progDb case shConfiguredProg of - Just sh -> + Just sh -> do + let build_in = interpretSymbolicPath mbWorkDir build_dir + createDirectoryIfMissing True build_in runProgramInvocation verbosity $ (programInvocation (sh{programOverrideEnv = overEnv}) args') - { progInvokeCwd = Just (interpretSymbolicPathLBI lbi $ buildDir lbi) + { progInvokeCwd = Just build_in } Nothing -> dieWithException verbosity NotFoundMsg where - args = configureArgs backwardsCompatHack flags + args = configureArgs backwardsCompatHack cfg backwardsCompatHack = False -- | Convert Windows path to Unix ones diff --git a/Cabal/src/Distribution/Simple/Errors.hs b/Cabal/src/Distribution/Simple/Errors.hs index 8513f92c7b9..1ce4f7ca06a 100644 --- a/Cabal/src/Distribution/Simple/Errors.hs +++ b/Cabal/src/Distribution/Simple/Errors.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE LambdaCase #-} - ----------------------------------------------------------------------------- -- Module : Distribution.Simple.Errors @@ -31,6 +29,7 @@ import Distribution.Simple.InstallDirs import Distribution.Simple.PreProcess.Types (Suffix) import Distribution.Simple.SetupHooks.Errors import Distribution.System (OS) +import Distribution.Types.MissingDependency (MissingDependency) import Distribution.Types.VersionRange.Internal () import Distribution.Version import Text.PrettyPrint @@ -115,7 +114,7 @@ data CabalException | CheckSemaphoreSupport | NoLibraryForPackage | SanityCheckHookedBuildInfo UnqualComponentName - | ConfigureScriptNotFound + | ConfigureScriptNotFound FilePath | NoValidComponent | ConfigureEitherSingleOrAll | ConfigCIDValidForPreComponent @@ -126,7 +125,7 @@ data CabalException | CantFindForeignLibraries [String] | ExpectedAbsoluteDirectory FilePath | FlagsNotSpecified [FlagName] - | EncounteredMissingDependency [Dependency] + | EncounteredMissingDependency [MissingDependency] | CompilerDoesn'tSupportThinning | CompilerDoesn'tSupportReexports | CompilerDoesn'tSupportBackpack @@ -138,7 +137,7 @@ data CabalException | BadVersion String String PkgconfigVersion | UnknownCompilerException | NoWorkingGcc - | NoOSSupport OS + | NoOSSupport OS String | NoCompilerSupport String | InstallDirsNotPrefixRelative (InstallDirs FilePath) | ExplainErrors (Maybe (Either [Char] [Char])) [String] @@ -172,7 +171,7 @@ data CabalException | UnknownVersionDb String VersionRange FilePath | MissingCoveredInstalledLibrary UnitId | SetupHooksException SetupHooksException - deriving (Show, Typeable) + deriving (Show) exceptionCode :: CabalException -> Int exceptionCode e = case e of @@ -314,7 +313,7 @@ versionRequirement range exceptionMessage :: CabalException -> String exceptionMessage e = case e of NoBenchMarkProgram cmd -> "Could not find benchmark program \"" ++ cmd ++ "\". Did you build the package first?" - EnableBenchMark -> "No benchmarks enabled. Did you remember to configure with " ++ "\'--enable-benchmarks\'?" + EnableBenchMark -> "No benchmarks enabled. Did you remember to \'Setup configure\' with " ++ "\'--enable-benchmarks\'?" BenchMarkNameDisabled bmName -> "Package configured with benchmark " ++ bmName ++ " disabled." NoBenchMark bmName -> "no such benchmark: " ++ bmName NoLibraryFound -> "No executables and no library found. Nothing to do." @@ -331,8 +330,8 @@ exceptionMessage e = case e of ++ ".\n" ++ "If the module " ++ "is autogenerated it should be added to 'autogen-modules'." - RegMultipleInstancePkg -> "HcPkg.register: the compiler does not support,registering multiple instances of packages." - SuppressingChecksOnFile -> "HcPkg.register: the compiler does not support ,suppressing checks on files." + RegMultipleInstancePkg -> "HcPkg.register: the compiler does not support registering multiple instances of packages." + SuppressingChecksOnFile -> "HcPkg.register: the compiler does not support suppressing checks on files." NoSupportDirStylePackageDb -> "HcPkg.writeRegistrationFileDirectly: compiler does not support dir style package dbs" OnlySupportSpecificPackageDb -> "HcPkg.writeRegistrationFileDirectly: only supports SpecificPackageDB for now" FailedToParseOutputDescribe programId pkgId -> "failed to parse output of '" ++ programId ++ " describe " ++ prettyShow pkgId ++ "'" @@ -353,7 +352,7 @@ exceptionMessage e = case e of ++ " but " ++ "haddock is using GHC version " ++ prettyShow haddockGhcVersion - MustHaveSharedLibraries -> "Must have vanilla or shared libraries " ++ "enabled in order to run haddock" + MustHaveSharedLibraries -> "Must have vanilla or shared libraries enabled in order to run haddock" HaddockPackageFlags inf -> "internal error when calculating transitive " ++ "package dependencies.\nDebug info: " @@ -391,7 +390,7 @@ exceptionMessage e = case e of GlobalPackageDBLimitation -> "With current ghc versions the global package db is always used " ++ "and must be listed first. This ghc limitation may be lifted in " - ++ "future, see https://gitlab.haskell.org/ghc/ghc/-/issues/5977" + ++ "the future, see https://gitlab.haskell.org/ghc/ghc/-/issues/5977" GlobalPackageDBSpecifiedFirst -> "If the global package db is specified, it must be " ++ "specified first and cannot be specified multiple times" @@ -487,8 +486,7 @@ exceptionMessage e = case e of ++ "suite type " ++ prettyShow tt NoSupportForPreProcessingBenchmark tt -> - "No support for preprocessing benchmark " - ++ "type " + "No support for preprocessing benchmark type " ++ prettyShow tt CantFindSourceForPreProcessFile errorStr -> errorStr NoSupportPreProcessingTestExtras tt -> @@ -511,11 +509,11 @@ exceptionMessage e = case e of SanityCheckHookedBuildInfo exe1 -> "The buildinfo contains info for an executable called '" ++ prettyShow exe1 - ++ "' but the package does not have a " + ++ "' but the package does not have an " ++ "executable with that name." - ConfigureScriptNotFound -> "configure script not found." + ConfigureScriptNotFound fp -> "configure script not found at " ++ fp ++ "." NoValidComponent -> "No valid component targets found" - ConfigureEitherSingleOrAll -> "Can only configure either single component or all of them" + ConfigureEitherSingleOrAll -> "Can only configure either a single component or all of them" ConfigCIDValidForPreComponent -> "--cid is only supported for per-component configure" SanityCheckForEnableComponents -> "--enable-tests/--enable-benchmarks are incompatible with" @@ -525,23 +523,23 @@ exceptionMessage e = case e of ++ " are incompatible with each other." UnsupportedLanguages pkgId compilerId langs -> "The package " - ++ prettyShow (pkgId) + ++ prettyShow pkgId ++ " requires the following languages which are not " ++ "supported by " - ++ prettyShow (compilerId) + ++ prettyShow compilerId ++ ": " ++ intercalate ", " langs UnsupportedLanguageExtension pkgId compilerId exts -> "The package " - ++ prettyShow (pkgId) + ++ prettyShow pkgId ++ " requires the following language extensions which are not " ++ "supported by " - ++ prettyShow (compilerId) + ++ prettyShow compilerId ++ ": " ++ intercalate ", " exts CantFindForeignLibraries unsupportedFLibs -> "Cannot build some foreign libraries: " - ++ intercalate "," unsupportedFLibs + ++ intercalate ", " unsupportedFLibs ExpectedAbsoluteDirectory fPath -> "expected an absolute directory name for --prefix: " ++ fPath FlagsNotSpecified diffFlags -> "'--exact-configuration' was given, " @@ -553,7 +551,7 @@ exceptionMessage e = case e of . nest 4 . sep . punctuate comma - . map (pretty . simplifyDependency) + . map pretty $ missing ) CompilerDoesn'tSupportThinning -> @@ -572,7 +570,7 @@ exceptionMessage e = case e of ++ "' refers to a library which is defined within the same " ++ "package. To use this feature the package must specify at " ++ "least 'cabal-version: >= 1.8'." - ReportFailedDependencies failed hackageUrl -> (intercalate "\n\n" (map reportFailedDependency failed)) + ReportFailedDependencies failed hackageUrl -> intercalate "\n\n" (map reportFailedDependency failed) where reportFailedDependency (DependencyNotExists pkgname) = "there is no version of " @@ -617,15 +615,16 @@ exceptionMessage e = case e of NoWorkingGcc -> unlines [ "No working gcc" - , "This package depends on foreign library but we cannot " + , "This package depends on a foreign library but we cannot " ++ "find a working C compiler. If you have it in a " ++ "non-standard location you can use the --with-gcc " ++ "flag to specify it." ] - NoOSSupport os -> + NoOSSupport os what -> "Operating system: " ++ prettyShow os - ++ ", does not support relocatable builds" + ++ ", does not support " + ++ what NoCompilerSupport comp -> "Compiler: " ++ comp @@ -673,8 +672,8 @@ exceptionMessage e = case e of ++ "where it is." ++ "If the library file does exist, it may contain errors that " ++ "are caught by the C compiler at the preprocessing stage. " - ++ "In this case you can re-run configure with the verbosity " - ++ "flag -v3 to see the error messages." + ++ "In this case you can re-run 'Setup configure' with the " + ++ "verbosity flag -v3 to see the error messages." messagePlural = "This problem can usually be solved by installing the system " ++ "packages that provide these libraries (you may need the " @@ -684,18 +683,18 @@ exceptionMessage e = case e of ++ "where they are." ++ "If the library files do exist, it may contain errors that " ++ "are caught by the C compiler at the preprocessing stage. " - ++ "In this case you can re-run configure with the verbosity " - ++ "flag -v3 to see the error messages." + ++ "In this case you can re-run 'Setup configure' with the " + ++ "verbosity flag -v3 to see the error messages." headerCppMessage = "If the header file does exist, it may contain errors that " ++ "are caught by the C compiler at the preprocessing stage. " - ++ "In this case you can re-run configure with the verbosity " - ++ "flag -v3 to see the error messages." + ++ "In this case you can re-run 'Setup configure' with the " + ++ "verbosity flag -v3 to see the error messages." headerCcMessage = "The header file contains a compile error. " - ++ "You can re-run configure with the verbosity flag " + ++ "You can re-run 'Setup configure' with the verbosity flag " ++ "-v3 to see the error messages from the C compiler." - CheckPackageProblems errors -> (intercalate "\n\n" $ errors) + CheckPackageProblems errors -> intercalate "\n\n" errors LibDirDepsPrefixNotRelative l p -> "Library directory of a dependency: " ++ show l @@ -756,7 +755,7 @@ exceptionMessage e = case e of RegisMultiplePkgNotSupported -> "Registering multiple package instances is not yet supported for this compiler" RegisteringNotImplemented -> "Registering is not implemented for this compiler" NoTestSuitesEnabled -> - "No test suites enabled. Did you remember to configure with " + "No test suites enabled. Did you remember to 'Setup configure' with " ++ "\'--enable-tests\'?" TestNameDisabled tName -> "Package configured with test suite " diff --git a/Cabal/src/Distribution/Simple/Flag.hs b/Cabal/src/Distribution/Simple/Flag.hs index f8598697028..744a7da1331 100644 --- a/Cabal/src/Distribution/Simple/Flag.hs +++ b/Cabal/src/Distribution/Simple/Flag.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveFoldable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} @@ -62,7 +61,7 @@ import Prelude () -- 'NoFlag' and later flags override earlier ones. -- -- Isomorphic to 'Maybe' a. -data Flag a = Flag a | NoFlag deriving (Eq, Generic, Show, Read, Typeable, Foldable, Traversable) +data Flag a = Flag a | NoFlag deriving (Eq, Generic, Show, Read, Foldable, Traversable) instance Binary a => Binary (Flag a) instance Structured a => Structured (Flag a) diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index 095e657264e..728d5c5ef9b 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -4,7 +4,7 @@ {-# LANGUAGE MultiWayIf #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TupleSections #-} +{-# LANGUAGE ScopedTypeVariables #-} ----------------------------------------------------------------------------- @@ -61,7 +61,7 @@ module Distribution.Simple.GHC , Internal.componentCcGhcOptions , getGhcAppDir , getLibDir - , isDynamic + , compilerBuildWay , getGlobalPackageDB , pkgRoot @@ -98,6 +98,7 @@ import Distribution.Simple.BuildPaths import Distribution.Simple.Compiler import Distribution.Simple.Errors import qualified Distribution.Simple.GHC.Build as GHC +import Distribution.Simple.GHC.Build.Modules (BuildWay (..)) import Distribution.Simple.GHC.Build.Utils import Distribution.Simple.GHC.EnvironmentParser import Distribution.Simple.GHC.ImplInfo @@ -162,14 +163,16 @@ configure verbosity hcPath hcPkgPath conf0 = do (userMaybeSpecifyPath "ghc" hcPath conf0) let implInfo = ghcVersionImplInfo ghcVersion - -- Cabal currently supports ghc >= 7.0.1 && < 9.12 - -- ... and the following odd development version - unless (ghcVersion < mkVersion [9, 12]) $ + -- Cabal currently supports GHC less than `maxGhcVersion` + let maxGhcVersion = mkVersion [9, 14] + unless (ghcVersion < maxGhcVersion) $ warn verbosity $ "Unknown/unsupported 'ghc' version detected " ++ "(Cabal " ++ prettyShow cabalVersion - ++ " supports 'ghc' version < 9.12): " + ++ " supports 'ghc' version < " + ++ prettyShow maxGhcVersion + ++ "): " ++ programPath ghcProg ++ " is version " ++ prettyShow ghcVersion @@ -393,8 +396,8 @@ getGhcInfo verbosity ghcProg = Internal.getGhcInfo verbosity implInfo ghcProg -- | Given a single package DB, return all installed packages. getPackageDBContents :: Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDB + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBX (SymbolicPath from (Dir PkgDB)) -> ProgramDb -> IO InstalledPackageIndex getPackageDBContents verbosity mbWorkDir packagedb progdb = do @@ -405,8 +408,8 @@ getPackageDBContents verbosity mbWorkDir packagedb progdb = do getInstalledPackages :: Verbosity -> Compiler - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDBStack + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBStackX (SymbolicPath from (Dir PkgDB)) -> ProgramDb -> IO InstalledPackageIndex getInstalledPackages verbosity comp mbWorkDir packagedbs progdb = do @@ -428,7 +431,7 @@ getInstalledPackages verbosity comp mbWorkDir packagedbs progdb = do -- 'getInstalledPackages'. toPackageIndex :: Verbosity - -> [(PackageDB, [InstalledPackageInfo])] + -> [(PackageDBX a, [InstalledPackageInfo])] -> ProgramDb -> IO InstalledPackageIndex toPackageIndex verbosity pkgss progdb = do @@ -491,7 +494,7 @@ checkPackageDbEnvVar :: Verbosity -> IO () checkPackageDbEnvVar verbosity = Internal.checkPackageDbEnvVar verbosity "GHC" "GHC_PACKAGE_PATH" -checkPackageDbStack :: Verbosity -> Compiler -> PackageDBStack -> IO () +checkPackageDbStack :: Eq fp => Verbosity -> Compiler -> PackageDBStackX fp -> IO () checkPackageDbStack verbosity comp = if flagPackageConf implInfo then checkPackageDbStackPre76 verbosity @@ -499,7 +502,7 @@ checkPackageDbStack verbosity comp = where implInfo = ghcVersionImplInfo (compilerVersion comp) -checkPackageDbStackPost76 :: Verbosity -> PackageDBStack -> IO () +checkPackageDbStackPost76 :: Eq fp => Verbosity -> PackageDBStackX fp -> IO () checkPackageDbStackPost76 _ (GlobalPackageDB : rest) | GlobalPackageDB `notElem` rest = return () checkPackageDbStackPost76 verbosity rest @@ -507,7 +510,7 @@ checkPackageDbStackPost76 verbosity rest dieWithException verbosity CheckPackageDbStackPost76 checkPackageDbStackPost76 _ _ = return () -checkPackageDbStackPre76 :: Verbosity -> PackageDBStack -> IO () +checkPackageDbStackPre76 :: Eq fp => Verbosity -> PackageDBStackX fp -> IO () checkPackageDbStackPre76 _ (GlobalPackageDB : rest) | GlobalPackageDB `notElem` rest = return () checkPackageDbStackPre76 verbosity rest @@ -528,10 +531,10 @@ removeMingwIncludeDir pkg = -- | Get the packages from specific PackageDBs, not cumulative. getInstalledPackages' :: Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> [PackageDB] + -> Maybe (SymbolicPath CWD (Dir from)) + -> [PackageDBX (SymbolicPath from (Dir PkgDB))] -> ProgramDb - -> IO [(PackageDB, [InstalledPackageInfo])] + -> IO [(PackageDBX (SymbolicPath from (Dir PkgDB)), [InstalledPackageInfo])] getInstalledPackages' verbosity mbWorkDir packagedbs progdb = sequenceA [ do @@ -541,21 +544,22 @@ getInstalledPackages' verbosity mbWorkDir packagedbs progdb = ] getInstalledPackagesMonitorFiles - :: Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) + :: forall from + . Verbosity + -> Maybe (SymbolicPath CWD (Dir from)) -> Platform -> ProgramDb - -> [PackageDB] + -> [PackageDBS from] -> IO [FilePath] getInstalledPackagesMonitorFiles verbosity mbWorkDir platform progdb = traverse getPackageDBPath where - getPackageDBPath :: PackageDB -> IO FilePath + getPackageDBPath :: PackageDBS from -> IO FilePath getPackageDBPath GlobalPackageDB = selectMonitorFile =<< getGlobalPackageDB verbosity ghcProg getPackageDBPath UserPackageDB = selectMonitorFile =<< getUserPackageDB verbosity ghcProg platform - getPackageDBPath (SpecificPackageDB path) = selectMonitorFile path + getPackageDBPath (SpecificPackageDB path) = selectMonitorFile (interpretSymbolicPath mbWorkDir path) -- GHC has old style file dbs, and new style directory dbs. -- Note that for dir style dbs, we only need to monitor the cache file, not @@ -624,6 +628,8 @@ startInterpreter verbosity progdb comp platform packageDBs = do } checkPackageDbStack verbosity comp packageDBs (ghcProg, _) <- requireProgram verbosity ghcProgram progdb + -- This doesn't pass source file arguments to GHC, so we don't have to worry + -- about using a response file here. runGHC verbosity ghcProg comp platform Nothing replOpts -- ----------------------------------------------------------------------------- @@ -733,7 +739,7 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do , ghcOptFPic = toFlag True , ghcOptHiSuffix = toFlag "dyn_hi" , ghcOptObjSuffix = toFlag "dyn_o" - , ghcOptExtra = hcSharedOptions GHC libBi + , ghcOptExtra = hcOptions GHC libBi ++ hcSharedOptions GHC libBi } profArgs = vanillaArgs @@ -745,13 +751,30 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do (withProfLibDetail lbi) , ghcOptHiSuffix = toFlag "p_hi" , ghcOptObjSuffix = toFlag "p_o" - , ghcOptExtra = hcProfOptions GHC libBi + , ghcOptExtra = hcOptions GHC libBi ++ hcProfOptions GHC libBi + } + profDynArgs = + vanillaArgs + `mappend` mempty + { ghcOptProfilingMode = toFlag True + , ghcOptProfilingAuto = + Internal.profDetailLevelFlag + True + (withProfLibDetail lbi) + , ghcOptDynLinkMode = toFlag GhcDynamicOnly + , ghcOptFPic = toFlag True + , ghcOptHiSuffix = toFlag "p_dyn_hi" + , ghcOptObjSuffix = toFlag "p_dyn_o" + , ghcOptExtra = hcOptions GHC libBi ++ hcProfSharedOptions GHC libBi } - ghcArgs - | withVanillaLib lbi = vanillaArgs - | withSharedLib lbi = sharedArgs - | withProfLib lbi = profArgs - | otherwise = error "libAbiHash: Can't find an enabled library way" + ghcArgs = + let (libWays, _, _) = buildWays lbi + in case libWays (componentIsIndefinite clbi) of + (ProfDynWay : _) -> profDynArgs + (ProfWay : _) -> profArgs + (StaticWay : _) -> vanillaArgs + (DynWay : _) -> sharedArgs + _ -> error "libAbiHash: Can't find an enabled library way" (ghcProg, _) <- requireProgram verbosity ghcProgram (withPrograms lbi) @@ -870,75 +893,91 @@ installLib -> ComponentLocalBuildInfo -> IO () installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do + let + (wantedLibWays, _, _) = buildWays lbi + isIndef = componentIsIndefinite clbi + libWays = wantedLibWays isIndef + + info verbosity ("Wanted install ways: " ++ show libWays) + -- copy .hi files over: - whenVanilla $ copyModuleFiles $ Suffix "hi" - whenProf $ copyModuleFiles $ Suffix "p_hi" - whenShared $ copyModuleFiles $ Suffix "dyn_hi" + forM_ (wantedLibWays isIndef) $ \w -> case w of + StaticWay -> copyModuleFiles (Suffix "hi") + DynWay -> copyModuleFiles (Suffix "dyn_hi") + ProfWay -> copyModuleFiles (Suffix "p_hi") + ProfDynWay -> copyModuleFiles (Suffix "p_dyn_hi") -- copy extra compilation artifacts that ghc plugins may produce copyDirectoryIfExists extraCompilationArtifacts -- copy the built library files over: - whenHasCode $ do - whenVanilla $ do - sequence_ - [ installOrdinary + when (has_code && hasLib) $ do + forM_ libWays $ \w -> case w of + StaticWay -> do + sequence_ + [ installOrdinary + builtDir + targetDir + (mkGenericStaticLibName (l ++ f)) + | l <- + getHSLibraryName + (componentUnitId clbi) + : (extraBundledLibs (libBuildInfo lib)) + , f <- "" : extraLibFlavours (libBuildInfo lib) + ] + whenGHCi $ installOrdinary builtDir targetDir ghciLibName + ProfWay -> do + installOrdinary builtDir targetDir profileLibName + whenGHCi $ installOrdinary builtDir targetDir ghciProfLibName + ProfDynWay -> do + installShared builtDir - targetDir - (mkGenericStaticLibName (l ++ f)) - | l <- - getHSLibraryName - (componentUnitId clbi) - : (extraBundledLibs (libBuildInfo lib)) - , f <- "" : extraLibFlavours (libBuildInfo lib) - ] - whenGHCi $ installOrdinary builtDir targetDir ghciLibName - whenProf $ do - installOrdinary builtDir targetDir profileLibName - whenGHCi $ installOrdinary builtDir targetDir ghciProfLibName - whenShared $ - if - -- The behavior for "extra-bundled-libraries" changed in version 2.5.0. - -- See ghc issue #15837 and Cabal PR #5855. - | specVersion pkg < CabalSpecV3_0 -> do - sequence_ - [ installShared - builtDir - dynlibTargetDir - (mkGenericSharedLibName platform compiler_id (l ++ f)) - | l <- getHSLibraryName uid : extraBundledLibs (libBuildInfo lib) - , f <- "" : extraDynLibFlavours (libBuildInfo lib) - ] - | otherwise -> do - sequence_ - [ installShared - builtDir - dynlibTargetDir - ( mkGenericSharedLibName - platform - compiler_id - (getHSLibraryName uid ++ f) - ) - | f <- "" : extraDynLibFlavours (libBuildInfo lib) - ] - sequence_ - [ do - files <- getDirectoryContents (i builtDir) - let l' = - mkGenericSharedBundledLibName - platform - compiler_id - l - forM_ files $ \file -> - when (l' `isPrefixOf` file) $ do - isFile <- doesFileExist (i $ builtDir makeRelativePathEx file) - when isFile $ do - installShared - builtDir - dynlibTargetDir - file - | l <- extraBundledLibs (libBuildInfo lib) - ] + dynlibTargetDir + (mkProfSharedLibName platform compiler_id uid) + DynWay -> do + if + -- The behavior for "extra-bundled-libraries" changed in version 2.5.0. + -- See ghc issue #15837 and Cabal PR #5855. + | specVersion pkg < CabalSpecV3_0 -> do + sequence_ + [ installShared + builtDir + dynlibTargetDir + (mkGenericSharedLibName platform compiler_id (l ++ f)) + | l <- getHSLibraryName uid : extraBundledLibs (libBuildInfo lib) + , f <- "" : extraDynLibFlavours (libBuildInfo lib) + ] + | otherwise -> do + sequence_ + [ installShared + builtDir + dynlibTargetDir + ( mkGenericSharedLibName + platform + compiler_id + (getHSLibraryName uid ++ f) + ) + | f <- "" : extraDynLibFlavours (libBuildInfo lib) + ] + sequence_ + [ do + files <- getDirectoryContents (i builtDir) + let l' = + mkGenericSharedBundledLibName + platform + compiler_id + (l ++ f) + forM_ files $ \file -> + when (l' `isPrefixOf` file) $ do + isFile <- doesFileExist (i $ builtDir makeRelativePathEx file) + when isFile $ do + installShared + builtDir + dynlibTargetDir + file + | l <- extraBundledLibs (libBuildInfo lib) + , f <- "" : extraDynLibFlavours (libBuildInfo lib) + ] where -- See Note [Symbolic paths] in Distribution.Utils.Path i = interpretSymbolicPathLBI lbi @@ -997,11 +1036,7 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do Platform JavaScript _ -> True _ -> False has_code = not (componentIsIndefinite clbi) - whenHasCode = when has_code - whenVanilla = when (hasLib && withVanillaLib lbi) - whenProf = when (hasLib && withProfLib lbi && has_code) whenGHCi = when (hasLib && withGHCiLib lbi && has_code) - whenShared = when (hasLib && withSharedLib lbi && has_code) -- ----------------------------------------------------------------------------- -- Registering @@ -1027,8 +1062,8 @@ hcPkgInfo progdb = registerPackage :: Verbosity -> ProgramDb - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDBStack + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBStackS from -> InstalledPackageInfo -> HcPkg.RegisterOptions -> IO () @@ -1066,4 +1101,4 @@ pkgRoot verbosity lbi = fmap makeSymbolicPath . pkgRoot' pkgRoot' (SpecificPackageDB fp) = return $ takeDirectory $ - interpretSymbolicPathLBI lbi (unsafeMakeSymbolicPath fp) + interpretSymbolicPathLBI lbi fp diff --git a/Cabal/src/Distribution/Simple/GHC/Build.hs b/Cabal/src/Distribution/Simple/GHC/Build.hs index 51f7d650338..0993e916886 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build.hs @@ -6,19 +6,20 @@ import Distribution.Compat.Prelude import Prelude () import Control.Monad.IO.Class -import qualified Data.Set as Set import Distribution.PackageDescription as PD hiding (buildInfo) import Distribution.Simple.Build.Inputs import Distribution.Simple.Flag (Flag) import Distribution.Simple.GHC.Build.ExtraSources import Distribution.Simple.GHC.Build.Link import Distribution.Simple.GHC.Build.Modules -import Distribution.Simple.GHC.Build.Utils (withDynFLib) +import Distribution.Simple.GHC.Build.Utils (compilerBuildWay, isHaskell, withDynFLib) import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Program.Builtin (ghcProgram) import Distribution.Simple.Program.Db (requireProgram) import Distribution.Simple.Utils -import Distribution.Types.ComponentLocalBuildInfo (componentIsIndefinite) + +import Distribution.Types.ComponentLocalBuildInfo +import Distribution.Types.PackageName.Magic (fakePackageId) import Distribution.Types.ParStrat import Distribution.Utils.NubList (fromNubListR) import Distribution.Utils.Path @@ -70,10 +71,11 @@ build build numJobs pkg_descr pbci = do let verbosity = buildVerbosity pbci - component = buildComponent pbci isLib = buildIsLib pbci lbi = localBuildInfo pbci + bi = buildBI pbci clbi = buildCLBI pbci + isIndef = componentIsIndefinite clbi mbWorkDir = mbWorkDirLBI lbi i = interpretSymbolicPathLBI lbi -- See Note [Symbolic paths] in Distribution.Utils.Path @@ -100,7 +102,7 @@ build numJobs pkg_descr pbci = do if isLib then -- NB: this might fail to make the buildTargetDir relative, -- as noted in #9776. Oh well. - tryMakeRelativeToWorkingDir mbWorkDir buildTargetDir0 + tryMakeRelative mbWorkDir buildTargetDir0 else return buildTargetDir0 -- To preserve the previous behaviour, we don't use relative dirs for -- executables. Historically, this isn't needed to reduce the CLI limit @@ -110,41 +112,40 @@ build numJobs pkg_descr pbci = do (ghcProg, _) <- liftIO $ requireProgram verbosity ghcProgram (withPrograms lbi) - -- Determine in which ways we want to build the component - let - wantVanilla = if isLib then withVanillaLib lbi else False - -- Arguably, wantStatic should be "withFullyStaticExe lbi" for executables, - -- but it was not before the refactor. - wantStatic = if isLib then withStaticLib lbi else not (wantDynamic || wantProf) - wantDynamic = case component of - CLib{} -> withSharedLib lbi - CFLib flib -> withDynFLib flib - CExe{} -> withDynExe lbi - CTest{} -> withDynExe lbi - CBench{} -> withDynExe lbi - wantProf = if isLib then withProfLib lbi else withProfExe lbi - - -- See also Note [Building Haskell Modules accounting for TH] in Distribution.Simple.GHC.Build.Modules - -- We build static by default if no other way is wanted. - -- For executables and foreign libraries, there should only be one wanted way. - wantedWays = - Set.fromList $ - -- If building a library, we accumulate all the ways, - -- otherwise, we take just one. - (if isLib then id else take 1) $ - [ProfWay | wantProf] - -- I don't see why we shouldn't build with dynamic - -- indefinite components. - <> [DynWay | wantDynamic && not (componentIsIndefinite clbi)] - <> [StaticWay | wantStatic || wantVanilla || not (wantDynamic || wantProf)] - - liftIO $ info verbosity ("Wanted build ways: " ++ show (Set.toList wantedWays)) - + -- Ways which are wanted from configuration flags + let wantedWays@(wantedLibWays, wantedFLibWay, wantedExeWay) = buildWays lbi + + -- Ways which are needed due to the compiler configuration + let doingTH = usesTemplateHaskellOrQQ bi + defaultGhcWay = compilerBuildWay (buildCompiler pbci) + wantedModBuildWays = case buildComponent pbci of + CLib _ -> wantedLibWays isIndef + CFLib fl -> [wantedFLibWay (withDynFLib fl)] + CExe _ -> [wantedExeWay] + CTest _ -> [wantedExeWay] + CBench _ -> [wantedExeWay] + finalModBuildWays = + wantedModBuildWays + ++ [defaultGhcWay | doingTH && defaultGhcWay `notElem` wantedModBuildWays] + compNameStr = showComponentName $ componentName $ buildComponent pbci + + liftIO $ info verbosity ("Wanted module build ways(" ++ compNameStr ++ "): " ++ show wantedModBuildWays) + liftIO $ info verbosity ("Final module build ways(" ++ compNameStr ++ "): " ++ show finalModBuildWays) -- We need a separate build and link phase, and C sources must be compiled -- after Haskell modules, because C sources may depend on stub headers -- generated from compiling Haskell modules (#842, #3294). - buildOpts <- buildHaskellModules numJobs ghcProg pkg_descr buildTargetDir wantedWays pbci - extraSources <- buildAllExtraSources ghcProg buildTargetDir pbci + (mbMainFile, inputModules) <- componentInputs buildTargetDir pkg_descr pbci + let (hsMainFile, nonHsMainFile) = + case mbMainFile of + Just mainFile + | PD.package pkg_descr == fakePackageId + || isHaskell (getSymbolicPath mainFile) -> + (Just mainFile, Nothing) + | otherwise -> + (Nothing, Just mainFile) + Nothing -> (Nothing, Nothing) + buildOpts <- buildHaskellModules numJobs ghcProg hsMainFile inputModules buildTargetDir finalModBuildWays pbci + extraSources <- buildAllExtraSources nonHsMainFile ghcProg buildTargetDir wantedWays pbci linkOrLoadComponent ghcProg pkg_descr diff --git a/Cabal/src/Distribution/Simple/GHC/Build/ExtraSources.hs b/Cabal/src/Distribution/Simple/GHC/Build/ExtraSources.hs index fc204cda30a..f2ca9aba02f 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build/ExtraSources.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build/ExtraSources.hs @@ -19,22 +19,27 @@ import Distribution.Types.Component import Distribution.Types.TargetInfo import Distribution.Simple.Build.Inputs +import Distribution.Simple.GHC.Build.Modules import Distribution.Simple.GHC.Build.Utils import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Program.Types +import Distribution.Simple.Setup.Common (commonSetupTempFileOptions) import Distribution.System (Arch (JavaScript), Platform (..)) import Distribution.Types.ComponentLocalBuildInfo -import Distribution.Types.Executable import Distribution.Utils.Path import Distribution.Verbosity (Verbosity) -- | An action that builds all the extra build sources of a component, i.e. C, -- C++, Js, Asm, C-- sources. buildAllExtraSources - :: ConfiguredProgram + :: Maybe (SymbolicPath Pkg File) + -- ^ An optional non-Haskell Main file + -> ConfiguredProgram -- ^ The GHC configured program -> SymbolicPath Pkg (Dir Artifacts) -- ^ The build directory for this target + -> (Bool -> [BuildWay], Bool -> BuildWay, BuildWay) + -- ^ Needed build ways -> PreBuildComponentInputs -- ^ The context and component being built in it. -> IO (NubListR (SymbolicPath Pkg File)) @@ -53,53 +58,50 @@ buildCSources , buildJsSources , buildAsmSources , buildCmmSources - :: ConfiguredProgram + :: Maybe (SymbolicPath Pkg File) + -- ^ An optional non-Haskell Main file + -> ConfiguredProgram -- ^ The GHC configured program -> SymbolicPath Pkg (Dir Artifacts) -- ^ The build directory for this target + -> (Bool -> [BuildWay], Bool -> BuildWay, BuildWay) + -- ^ Needed build ways -> PreBuildComponentInputs -- ^ The context and component being built in it. -> IO (NubListR (SymbolicPath Pkg File)) -- ^ Returns the list of extra sources that were built -buildCSources = +buildCSources mbMainFile = buildExtraSources "C Sources" Internal.componentCcGhcOptions - True ( \c -> do let cFiles = cSources (componentBuildInfo c) case c of - CExe exe - | let mainPath = getSymbolicPath $ modulePath exe - , isC mainPath -> - cFiles ++ [makeSymbolicPath mainPath] - -- NB: Main.hs is relative to hs-source-dirs, but Main.c - -- is relative to the package. + CExe{} + | Just main <- mbMainFile + , isC $ getSymbolicPath main -> + cFiles ++ [main] _otherwise -> cFiles ) -buildCxxSources = +buildCxxSources mbMainFile = buildExtraSources "C++ Sources" Internal.componentCxxGhcOptions - True ( \c -> do let cxxFiles = cxxSources (componentBuildInfo c) case c of - CExe exe - | let mainPath = getSymbolicPath $ modulePath exe - , isCxx mainPath -> - do cxxFiles ++ [makeSymbolicPath mainPath] - -- NB: Main.hs is relative to hs-source-dirs, but Main.c++ - -- is relative to the package. + CExe{} + | Just main <- mbMainFile + , isCxx $ getSymbolicPath main -> + cxxFiles ++ [main] _otherwise -> cxxFiles ) -buildJsSources ghcProg buildTargetDir = do +buildJsSources _mbMainFile ghcProg buildTargetDir neededWays = do Platform hostArch _ <- hostPlatform <$> localBuildInfo let hasJsSupport = hostArch == JavaScript buildExtraSources "JS Sources" Internal.componentJsGhcOptions - False ( \c -> if hasJsSupport then -- JS files are C-like with GHC's JS backend: they are @@ -111,17 +113,16 @@ buildJsSources ghcProg buildTargetDir = do ) ghcProg buildTargetDir -buildAsmSources = + neededWays +buildAsmSources _mbMainFile = buildExtraSources "Assembler Sources" Internal.componentAsmGhcOptions - True (asmSources . componentBuildInfo) -buildCmmSources = +buildCmmSources _mbMainFile = buildExtraSources "C-- Sources" Internal.componentCmmGhcOptions - True (cmmSources . componentBuildInfo) -- | Create 'PreBuildComponentRules' for a given type of extra build sources @@ -142,10 +143,6 @@ buildExtraSources -- invocation of GHC when compiling these extra sources (e.g. -- @'Internal.componentCxxGhcOptions'@, -- @'Internal.componentCmmGhcOptions'@) - -> Bool - -- ^ Some types of build sources should not be built in the dynamic way, namely, JS sources. - -- I'm not entirely sure this remains true after we migrate to supporting GHC's JS backend rather than GHCJS. - -- Boolean for "do we allow building these sources the dynamic way?" -> (Component -> [SymbolicPath Pkg File]) -- ^ View the extra sources of a component, typically from -- the build info (e.g. @'asmSources'@, @'cSources'@). @@ -156,108 +153,120 @@ buildExtraSources -- ^ The GHC configured program -> SymbolicPath Pkg (Dir Artifacts) -- ^ The build directory for this target + -> (Bool -> [BuildWay], Bool -> BuildWay, BuildWay) + -- ^ Needed build ways -> PreBuildComponentInputs -- ^ The context and component being built in it. -> IO (NubListR (SymbolicPath Pkg File)) -- ^ Returns the list of extra sources that were built -buildExtraSources description componentSourceGhcOptions wantDyn viewSources ghcProg buildTargetDir = - \PreBuildComponentInputs{buildingWhat, localBuildInfo = lbi, targetInfo} -> do - let - bi = componentBuildInfo (targetComponent targetInfo) - verbosity = buildingWhatVerbosity buildingWhat - clbi = targetCLBI targetInfo - mbWorkDir = mbWorkDirLBI lbi - i = interpretSymbolicPath mbWorkDir - sources = viewSources (targetComponent targetInfo) - comp = compiler lbi - platform = hostPlatform lbi - -- Instead of keeping this logic here, we really just want to - -- receive as an input the `neededWays` from GHC/Build.build and build - -- accordingly, since we've already determined the extra needed ways - -- needed for e.g. template haskell. Although we'd have to account for 'wantDyn'. - isGhcDynamic = isDynamic comp - doingTH = usesTemplateHaskellOrQQ bi - forceSharedLib = doingTH && isGhcDynamic - runGhcProg = runGHC verbosity ghcProg comp platform +buildExtraSources + description + componentSourceGhcOptions + viewSources + ghcProg + buildTargetDir + (neededLibWays, neededFLibWay, neededExeWay) = + \PreBuildComponentInputs{buildingWhat, localBuildInfo = lbi, targetInfo} -> do + let + bi = componentBuildInfo (targetComponent targetInfo) + verbosity = buildingWhatVerbosity buildingWhat + clbi = targetCLBI targetInfo + isIndef = componentIsIndefinite clbi + mbWorkDir = mbWorkDirLBI lbi + i = interpretSymbolicPath mbWorkDir + sources = viewSources (targetComponent targetInfo) + comp = compiler lbi + platform = hostPlatform lbi + tempFileOptions = commonSetupTempFileOptions $ buildingWhatCommonFlags buildingWhat + runGhcProg = + runGHCWithResponseFile + "ghc.rsp" + Nothing + tempFileOptions + verbosity + ghcProg + comp + platform + mbWorkDir - buildAction :: SymbolicPath Pkg File -> IO () - buildAction sourceFile = do - let baseSrcOpts = - componentSourceGhcOptions - verbosity - lbi - bi - clbi - buildTargetDir - sourceFile - vanillaSrcOpts - -- Dynamic GHC requires C sources to be built - -- with -fPIC for REPL to work. See #2207. - | isGhcDynamic && wantDyn = baseSrcOpts{ghcOptFPic = toFlag True} - | otherwise = baseSrcOpts - profSrcOpts = - vanillaSrcOpts - `mappend` mempty - { ghcOptProfilingMode = toFlag True - } - sharedSrcOpts = - vanillaSrcOpts - `mappend` mempty - { ghcOptFPic = toFlag True - , ghcOptDynLinkMode = toFlag GhcDynamicOnly - } - -- TODO: Placing all Haskell, C, & C++ objects in a single directory - -- Has the potential for file collisions. In general we would - -- consider this a user error. However, we should strive to - -- add a warning if this occurs. - odir = fromFlag (ghcOptObjDir vanillaSrcOpts) + buildAction :: SymbolicPath Pkg File -> IO () + buildAction sourceFile = do + let baseSrcOpts = + componentSourceGhcOptions + verbosity + lbi + bi + clbi + buildTargetDir + sourceFile + vanillaSrcOpts = + -- -fPIC is used in case you are using the repl + -- of a dynamically linked GHC + baseSrcOpts{ghcOptFPic = toFlag True} + profSrcOpts = + vanillaSrcOpts + `mappend` mempty + { ghcOptProfilingMode = toFlag True + } + sharedSrcOpts = + vanillaSrcOpts + `mappend` mempty + { ghcOptFPic = toFlag True + , ghcOptDynLinkMode = toFlag GhcDynamicOnly + } + profSharedSrcOpts = + vanillaSrcOpts + `mappend` mempty + { ghcOptProfilingMode = toFlag True + , ghcOptFPic = toFlag True + , ghcOptDynLinkMode = toFlag GhcDynamicOnly + } + -- TODO: Placing all Haskell, C, & C++ objects in a single directory + -- Has the potential for file collisions. In general we would + -- consider this a user error. However, we should strive to + -- add a warning if this occurs. + odir = fromFlag (ghcOptObjDir vanillaSrcOpts) - compileIfNeeded :: GhcOptions -> IO () - compileIfNeeded opts = do - needsRecomp <- checkNeedsRecompilation mbWorkDir sourceFile opts - when needsRecomp $ runGhcProg mbWorkDir opts + compileIfNeeded :: GhcOptions -> IO () + compileIfNeeded opts = do + needsRecomp <- checkNeedsRecompilation mbWorkDir sourceFile opts + when needsRecomp $ runGhcProg opts - -- TODO: This whole section can be streamlined to the - -- wantedWays+neededWays logic used in Build/Modules.hs - createDirectoryIfMissingVerbose verbosity True (i odir) - case targetComponent targetInfo of - -- For libraries, we compile extra objects in the three ways: vanilla, shared, and profiled. - -- We suffix shared objects with .dyn_o and profiled ones with .p_o. - CLib _lib - -- Unless for repl, in which case we only need the vanilla way - | BuildRepl _ <- buildingWhat -> - compileIfNeeded vanillaSrcOpts - | otherwise -> - do + createDirectoryIfMissingVerbose verbosity True (i odir) + case targetComponent targetInfo of + -- For libraries, we compile extra objects in the four ways: vanilla, shared, profiled and profiled shared. + -- We suffix shared objects with `.dyn_o`, profiled ones with `.p_o` and profiled shared ones with `.p_dyn_o`. + CLib _lib + -- Unless for repl, in which case we only need the vanilla way + | BuildRepl _ <- buildingWhat -> compileIfNeeded vanillaSrcOpts - when (wantDyn && (forceSharedLib || withSharedLib lbi)) $ - compileIfNeeded sharedSrcOpts{ghcOptObjSuffix = toFlag "dyn_o"} - when (withProfLib lbi) $ - compileIfNeeded profSrcOpts{ghcOptObjSuffix = toFlag "p_o"} + | otherwise -> + do + forM_ (neededLibWays isIndef) $ \case + StaticWay -> compileIfNeeded vanillaSrcOpts + DynWay -> compileIfNeeded sharedSrcOpts{ghcOptObjSuffix = toFlag "dyn_o"} + ProfWay -> compileIfNeeded profSrcOpts{ghcOptObjSuffix = toFlag "p_o"} + ProfDynWay -> compileIfNeeded profSharedSrcOpts{ghcOptObjSuffix = toFlag "p_dyn_o"} + CFLib flib -> + case neededFLibWay (withDynFLib flib) of + StaticWay -> compileIfNeeded vanillaSrcOpts + DynWay -> compileIfNeeded sharedSrcOpts + ProfWay -> compileIfNeeded profSrcOpts + ProfDynWay -> compileIfNeeded profSharedSrcOpts + -- For the remaining component types (Exec, Test, Bench), we also + -- determine with which options to build the objects (vanilla vs shared vs + -- profiled), but predicate is the same for the three kinds. + _exeLike -> + case neededExeWay of + StaticWay -> compileIfNeeded vanillaSrcOpts + DynWay -> compileIfNeeded sharedSrcOpts + ProfWay -> compileIfNeeded profSrcOpts + ProfDynWay -> compileIfNeeded profSharedSrcOpts - -- For foreign libraries, we determine with which options to build the - -- objects (vanilla vs shared vs profiled) - CFLib flib - | withProfExe lbi -> -- It doesn't sound right to query "ProfExe" for a foreign library... - compileIfNeeded profSrcOpts - | withDynFLib flib && wantDyn -> - compileIfNeeded sharedSrcOpts - | otherwise -> - compileIfNeeded vanillaSrcOpts - -- For the remaining component types (Exec, Test, Bench), we also - -- determine with which options to build the objects (vanilla vs shared vs - -- profiled), but predicate is the same for the three kinds. - _exeLike - | withProfExe lbi -> - compileIfNeeded profSrcOpts - | withDynExe lbi && wantDyn -> - compileIfNeeded sharedSrcOpts - | otherwise -> - compileIfNeeded vanillaSrcOpts - -- build any sources - if (null sources || componentIsIndefinite clbi) - then return mempty - else do - info verbosity ("Building " ++ description ++ "...") - traverse_ buildAction sources - return (toNubListR sources) + -- build any sources + if (null sources || componentIsIndefinite clbi) + then return mempty + else do + info verbosity ("Building " ++ description ++ "...") + traverse_ buildAction sources + return (toNubListR sources) diff --git a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs index 9f454e0ea5f..e26e3890ba3 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs @@ -1,15 +1,12 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TypeApplications #-} module Distribution.Simple.GHC.Build.Link where import Distribution.Compat.Prelude import Prelude () -import Control.Exception (assert) -import Control.Monad (forM_) import Control.Monad.IO.Class import qualified Data.ByteString.Lazy.Char8 as BS import qualified Data.Set as Set @@ -76,128 +73,164 @@ linkOrLoadComponent -> (SymbolicPath Pkg (Dir Artifacts), SymbolicPath Pkg (Dir Build)) -- ^ The build target dir, and the target dir. -- See Note [Build Target Dir vs Target Dir] in Distribution.Simple.GHC.Build - -> (Set.Set BuildWay, BuildWay -> GhcOptions) + -> ((Bool -> [BuildWay], Bool -> BuildWay, BuildWay), BuildWay -> GhcOptions) -- ^ The set of build ways wanted based on the user opts, and a function to -- convert a build way into the set of ghc options that were used to build -- that way. -> PreBuildComponentInputs -- ^ The context and component being built in it. -> IO () -linkOrLoadComponent ghcProg pkg_descr extraSources (buildTargetDir, targetDir) (wantedWays, buildOpts) pbci = do - let - verbosity = buildVerbosity pbci - target = targetInfo pbci - component = buildComponent pbci - what = buildingWhat pbci - lbi = localBuildInfo pbci - bi = buildBI pbci - clbi = buildCLBI pbci - mbWorkDir = mbWorkDirLBI lbi +linkOrLoadComponent + ghcProg + pkg_descr + extraSources + (buildTargetDir, targetDir) + ((wantedLibWays, wantedFLibWay, wantedExeWay), buildOpts) + pbci = do + let + verbosity = buildVerbosity pbci + target = targetInfo pbci + component = buildComponent pbci + what = buildingWhat pbci + lbi = localBuildInfo pbci + bi = buildBI pbci + clbi = buildCLBI pbci + isIndef = componentIsIndefinite clbi + mbWorkDir = mbWorkDirLBI lbi + tempFileOptions = commonSetupTempFileOptions $ buildingWhatCommonFlags what - -- See Note [Symbolic paths] in Distribution.Utils.Path - i = interpretSymbolicPathLBI lbi + -- See Note [Symbolic paths] in Distribution.Utils.Path + i = interpretSymbolicPathLBI lbi - -- ensure extra lib dirs exist before passing to ghc - cleanedExtraLibDirs <- liftIO $ filterM (doesDirectoryExist . i) (extraLibDirs bi) - cleanedExtraLibDirsStatic <- liftIO $ filterM (doesDirectoryExist . i) (extraLibDirsStatic bi) + -- ensure extra lib dirs exist before passing to ghc + cleanedExtraLibDirs <- liftIO $ filterM (doesDirectoryExist . i) (extraLibDirs bi) + cleanedExtraLibDirsStatic <- liftIO $ filterM (doesDirectoryExist . i) (extraLibDirsStatic bi) - let - extraSourcesObjs :: [RelativePath Artifacts File] - extraSourcesObjs = - [ makeRelativePathEx $ getSymbolicPath src `replaceExtension` objExtension - | src <- extraSources - ] - - -- TODO: Shouldn't we use withStaticLib for libraries and something else - -- for foreign libs in the three cases where we use `withFullyStaticExe` below? - linkerOpts rpaths = - mempty - { ghcOptLinkOptions = - PD.ldOptions bi - ++ [ "-static" - | withFullyStaticExe lbi - ] - -- Pass extra `ld-options` given - -- through to GHC's linker. - ++ maybe - [] - programOverrideArgs - (lookupProgram ldProgram (withPrograms lbi)) - , ghcOptLinkLibs = - if withFullyStaticExe lbi - then extraLibsStatic bi - else extraLibs bi - , ghcOptLinkLibPath = - toNubListR $ + let + extraSourcesObjs :: [RelativePath Artifacts File] + extraSourcesObjs = + [ makeRelativePathEx $ getSymbolicPath src `replaceExtension` objExtension + | src <- extraSources + ] + + -- TODO: Shouldn't we use withStaticLib for libraries and something else + -- for foreign libs in the three cases where we use `withFullyStaticExe` below? + linkerOpts rpaths = + mempty + { ghcOptLinkOptions = + PD.ldOptions bi + ++ [ "-static" + | withFullyStaticExe lbi + ] + -- Pass extra `ld-options` given + -- through to GHC's linker. + ++ maybe + [] + programOverrideArgs + (lookupProgram ldProgram (withPrograms lbi)) + , ghcOptLinkLibs = if withFullyStaticExe lbi - then cleanedExtraLibDirsStatic - else cleanedExtraLibDirs - , ghcOptLinkFrameworks = toNubListR $ map getSymbolicPath $ PD.frameworks bi - , ghcOptLinkFrameworkDirs = toNubListR $ PD.extraFrameworkDirs bi - , ghcOptInputFiles = - toNubListR - [ coerceSymbolicPath $ buildTargetDir obj - | obj <- extraSourcesObjs - ] - , ghcOptNoLink = Flag False - , ghcOptRPaths = rpaths - } - case what of - BuildRepl replFlags -> liftIO $ do - let - -- For repl we use the vanilla (static) ghc options - staticOpts = buildOpts StaticWay - replOpts = - staticOpts - { -- Repl options use Static as the base, but doesn't need to pass -static. - -- However, it maybe should, for uniformity. - ghcOptDynLinkMode = NoFlag - , ghcOptExtra = - Internal.filterGhciFlags - (ghcOptExtra staticOpts) - <> replOptionsFlags (replReplOptions replFlags) - , ghcOptInputModules = replNoLoad (replReplOptions replFlags) (ghcOptInputModules staticOpts) - , ghcOptInputFiles = replNoLoad (replReplOptions replFlags) (ghcOptInputFiles staticOpts) - } - -- For a normal compile we do separate invocations of ghc for - -- compiling as for linking. But for repl we have to do just - -- the one invocation, so that one has to include all the - -- linker stuff too, like -l flags and any .o files from C - -- files etc. - -- - -- TODO: The repl doesn't use the runtime paths from linkerOpts - -- (ghcOptRPaths), which looks like a bug. After the refactor we - -- can fix this. - `mappend` linkerOpts mempty - `mappend` mempty - { ghcOptMode = toFlag GhcModeInteractive - , ghcOptOptimisation = toFlag GhcNoOptimisation + then extraLibsStatic bi + else extraLibs bi + , ghcOptLinkLibPath = + toNubListR $ + if withFullyStaticExe lbi + then cleanedExtraLibDirsStatic + else cleanedExtraLibDirs + , ghcOptLinkFrameworks = toNubListR $ map getSymbolicPath $ PD.frameworks bi + , ghcOptLinkFrameworkDirs = toNubListR $ PD.extraFrameworkDirs bi + , ghcOptInputFiles = + toNubListR + [ coerceSymbolicPath $ buildTargetDir obj + | obj <- extraSourcesObjs + ] + , ghcOptNoLink = Flag False + , ghcOptRPaths = rpaths + } + + case what of + BuildRepl replFlags -> liftIO $ do + let + -- For repl we use the vanilla (static) ghc options + staticOpts = buildOpts StaticWay + replOpts = + staticOpts + { -- Repl options use Static as the base, but doesn't need to pass -static. + -- However, it maybe should, for uniformity. + ghcOptDynLinkMode = NoFlag + , ghcOptExtra = + Internal.filterGhciFlags + (ghcOptExtra staticOpts) + <> replOptionsFlags (replReplOptions replFlags) + } + -- For a normal compile we do separate invocations of ghc for + -- compiling as for linking. But for repl we have to do just + -- the one invocation, so that one has to include all the + -- linker stuff too, like -l flags and any .o files from C + -- files etc. + -- + -- TODO: The repl doesn't use the runtime paths from linkerOpts + -- (ghcOptRPaths), which looks like a bug. After the refactor we + -- can fix this. + `mappend` linkerOpts mempty + `mappend` mempty + { ghcOptMode = toFlag GhcModeInteractive + , ghcOptOptimisation = toFlag GhcNoOptimisation + } + replOpts_final = + replOpts + { ghcOptInputModules = replNoLoad (replReplOptions replFlags) (ghcOptInputModules replOpts) + , ghcOptInputFiles = replNoLoad (replReplOptions replFlags) (ghcOptInputFiles replOpts) } - -- TODO: problem here is we need the .c files built first, so we can load them - -- with ghci, but .c files can depend on .h files generated by ghc by ffi - -- exports. - when (case component of CLib lib -> null (allLibModules lib clbi); _ -> False) $ - warn verbosity "No exposed modules" - runReplOrWriteFlags ghcProg lbi replFlags replOpts (pkgName (PD.package pkg_descr)) target - _otherwise -> - let - runGhcProg = runGHC verbosity ghcProg comp platform mbWorkDir - platform = hostPlatform lbi - comp = compiler lbi - in - when (not $ componentIsIndefinite clbi) $ do - -- If not building dynamically, we don't pass any runtime paths. - rpaths <- if DynWay `Set.member` wantedWays then getRPaths pbci else return (toNubListR []) - liftIO $ do - info verbosity "Linking..." - let linkExeLike name = linkExecutable (linkerOpts rpaths) (wantedWays, buildOpts) targetDir name runGhcProg lbi - case component of - CLib lib -> linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays - CFLib flib -> linkFLib flib bi lbi (linkerOpts rpaths) (wantedWays, buildOpts) targetDir runGhcProg - CExe exe -> linkExeLike (exeName exe) - CTest test -> linkExeLike (testName test) - CBench bench -> linkExeLike (benchmarkName bench) + -- TODO: problem here is we need the .c files built first, so we can load them + -- with ghci, but .c files can depend on .h files generated by ghc by ffi + -- exports. + when (case component of CLib lib -> null (allLibModules lib clbi); _ -> False) $ + warn verbosity "No exposed modules" + runReplOrWriteFlags + ghcProg + lbi + replFlags + replOpts_final + (pkgName (PD.package pkg_descr)) + target + _otherwise -> + let + runGhcProg = + runGHCWithResponseFile + "ghc.rsp" + Nothing + tempFileOptions + verbosity + ghcProg + comp + platform + mbWorkDir + platform = hostPlatform lbi + comp = compiler lbi + get_rpaths ways = + if DynWay `Set.member` ways then getRPaths pbci else return (toNubListR []) + in + when (not $ componentIsIndefinite clbi) $ do + -- If not building dynamically, we don't pass any runtime paths. + liftIO $ do + info verbosity "Linking..." + let linkExeLike name = do + rpaths <- get_rpaths (Set.singleton wantedExeWay) + linkExecutable (linkerOpts rpaths) (wantedExeWay, buildOpts) targetDir name runGhcProg lbi + case component of + CLib lib -> do + let libWays = wantedLibWays isIndef + rpaths <- get_rpaths (Set.fromList libWays) + linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths libWays + CFLib flib -> do + let flib_way = wantedFLibWay (withDynFLib flib) + rpaths <- get_rpaths (Set.singleton flib_way) + linkFLib flib bi lbi (linkerOpts rpaths) (flib_way, buildOpts) targetDir runGhcProg + CExe exe -> linkExeLike (exeName exe) + CTest test -> linkExeLike (testName test) + CBench bench -> linkExeLike (benchmarkName bench) -- | Link a library component linkLibrary @@ -217,7 +250,7 @@ linkLibrary -- ^ Extra build sources (that were compiled to objects) -> NubListR FilePath -- ^ A list with the runtime-paths (rpaths), or empty if not linking dynamically - -> Set.Set BuildWay + -> [BuildWay] -- ^ Wanted build ways and corresponding build options -> IO () linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg lib lbi clbi extraSources rpaths wantedWays = do @@ -237,6 +270,9 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li sharedLibFilePath = buildTargetDir makeRelativePathEx (mkSharedLibName (hostPlatform lbi) compiler_id uid) + profSharedLibFilePath = + buildTargetDir + makeRelativePathEx (mkProfSharedLibName (hostPlatform lbi) compiler_id uid) staticLibFilePath = buildTargetDir makeRelativePathEx (mkStaticLibName (hostPlatform lbi) compiler_id uid) @@ -252,6 +288,9 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li sharedLibInstallPath = libInstallPath mkSharedLibName (hostPlatform lbi) compiler_id uid + profSharedLibInstallPath = + libInstallPath + mkProfSharedLibName (hostPlatform lbi) compiler_id uid getObjFiles :: BuildWay -> IO [SymbolicPath Pkg File] getObjFiles way = @@ -358,6 +397,32 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li toNubListR $ PD.extraFrameworkDirs libBi , ghcOptRPaths = rpaths } + ghcProfSharedLinkArgs pdynObjectFiles = + ghcBaseLinkArgs + { ghcOptShared = toFlag True + , ghcOptProfilingMode = toFlag True + , ghcOptProfilingAuto = + Internal.profDetailLevelFlag + True + (withProfLibDetail lbi) + , ghcOptDynLinkMode = toFlag GhcDynamicOnly + , ghcOptInputFiles = toNubListR pdynObjectFiles + , ghcOptOutputFile = toFlag profSharedLibFilePath + , -- For dynamic libs, Mac OS/X needs to know the install location + -- at build time. This only applies to GHC < 7.8 - see the + -- discussion in #1660. + ghcOptDylibName = + if hostOS == OSX + && ghcVersion < mkVersion [7, 8] + then toFlag profSharedLibInstallPath + else mempty + , ghcOptLinkLibs = extraLibs libBi + , ghcOptLinkLibPath = toNubListR $ cleanedExtraLibDirs + , ghcOptLinkFrameworks = toNubListR $ map getSymbolicPath $ PD.frameworks libBi + , ghcOptLinkFrameworkDirs = + toNubListR $ PD.extraFrameworkDirs libBi + , ghcOptRPaths = rpaths + } ghcStaticLinkArgs staticObjectFiles = ghcBaseLinkArgs { ghcOptStaticLib = toFlag True @@ -371,6 +436,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li staticObjectFiles <- getObjFiles StaticWay profObjectFiles <- getObjFiles ProfWay dynamicObjectFiles <- getObjFiles DynWay + profDynamicObjectFiles <- getObjFiles ProfDynWay let linkWay = \case @@ -384,6 +450,8 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li ldProg ghciProfLibFilePath profObjectFiles + ProfDynWay -> do + runGhcProg $ ghcProfSharedLinkArgs profDynamicObjectFiles DynWay -> do runGhcProg $ ghcSharedLinkArgs dynamicObjectFiles StaticWay -> do @@ -413,7 +481,7 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li linkExecutable :: (GhcOptions) -- ^ The linker-specific GHC options - -> (Set.Set BuildWay, BuildWay -> GhcOptions) + -> (BuildWay, BuildWay -> GhcOptions) -- ^ The wanted build ways and corresponding GhcOptions that were -- used to compile the modules in that way. -> SymbolicPath Pkg (Dir Build) @@ -425,30 +493,27 @@ linkExecutable -- ^ Run the configured GHC program -> LocalBuildInfo -> IO () -linkExecutable linkerOpts (wantedWays, buildOpts) targetDir targetName runGhcProg lbi = do - -- When building an executable, we should only "want" one build way. - assert (Set.size wantedWays == 1) $ - forM_ wantedWays $ \way -> do - let baseOpts = buildOpts way - linkOpts = - baseOpts - `mappend` linkerOpts - `mappend` mempty - { -- If there are no input Haskell files we pass -no-hs-main, and - -- assume there is a main function in another non-haskell object - ghcOptLinkNoHsMain = toFlag (ghcOptInputFiles baseOpts == mempty && ghcOptInputScripts baseOpts == mempty) - } - comp = compiler lbi +linkExecutable linkerOpts (way, buildOpts) targetDir targetName runGhcProg lbi = do + let baseOpts = buildOpts way + linkOpts = + baseOpts + `mappend` linkerOpts + `mappend` mempty + { -- If there are no input Haskell files we pass -no-hs-main, and + -- assume there is a main function in another non-haskell object + ghcOptLinkNoHsMain = toFlag (ghcOptInputFiles baseOpts == mempty && ghcOptInputScripts baseOpts == mempty) + } + comp = compiler lbi - -- Work around old GHCs not relinking in this - -- situation, see #3294 - let target = - targetDir makeRelativePathEx (exeTargetName (hostPlatform lbi) targetName) - when (compilerVersion comp < mkVersion [7, 7]) $ do - let targetPath = interpretSymbolicPathLBI lbi target - e <- doesFileExist targetPath - when e (removeFile targetPath) - runGhcProg linkOpts{ghcOptOutputFile = toFlag target} + -- Work around old GHCs not relinking in this + -- situation, see #3294 + let target = + targetDir makeRelativePathEx (exeTargetName (hostPlatform lbi) targetName) + when (compilerVersion comp < mkVersion [7, 7]) $ do + let targetPath = interpretSymbolicPathLBI lbi target + e <- doesFileExist targetPath + when e (removeFile targetPath) + runGhcProg linkOpts{ghcOptOutputFile = toFlag target} -- | Link a foreign library component linkFLib @@ -457,7 +522,7 @@ linkFLib -> LocalBuildInfo -> (GhcOptions) -- ^ The linker-specific GHC options - -> (Set.Set BuildWay, BuildWay -> GhcOptions) + -> (BuildWay, BuildWay -> GhcOptions) -- ^ The wanted build ways and corresponding GhcOptions that were -- used to compile the modules in that way. -> SymbolicPath Pkg (Dir Build) @@ -466,7 +531,7 @@ linkFLib -> (GhcOptions -> IO ()) -- ^ Run the configured GHC program -> IO () -linkFLib flib bi lbi linkerOpts (wantedWays, buildOpts) targetDir runGhcProg = do +linkFLib flib bi lbi linkerOpts (way, buildOpts) targetDir runGhcProg = do let comp = compiler lbi @@ -498,8 +563,8 @@ linkFLib flib bi lbi linkerOpts (wantedWays, buildOpts) targetDir runGhcProg = d else statRtsVanillaLib (rtsStaticInfo rtsInfo) ] - linkOpts :: BuildWay -> GhcOptions - linkOpts way = case foreignLibType flib of + linkOpts :: GhcOptions + linkOpts = case foreignLibType flib of ForeignLibNativeShared -> (buildOpts way) `mappend` linkerOpts @@ -521,13 +586,10 @@ linkFLib flib bi lbi linkerOpts (wantedWays, buildOpts) targetDir runGhcProg = d -- soname on supported platforms. See also the note for -- @flibBuildName@. let buildName = flibBuildName lbi flib - -- There should not be more than one wanted way when building an flib - assert (Set.size wantedWays == 1) $ - forM_ wantedWays $ \way -> do - let outFile = targetDir makeRelativePathEx buildName - runGhcProg (linkOpts way){ghcOptOutputFile = toFlag outFile} - let i = interpretSymbolicPathLBI lbi - renameFile (i outFile) (i targetDir flibTargetName lbi flib) + let outFile = targetDir makeRelativePathEx buildName + runGhcProg linkOpts{ghcOptOutputFile = toFlag outFile} + let i = interpretSymbolicPathLBI lbi + renameFile (i outFile) (i targetDir flibTargetName lbi flib) -- | Calculate the RPATHs for the component we are building. -- @@ -683,12 +745,25 @@ runReplOrWriteFlags ghcProg lbi rflags ghcOpts pkg_name target = common = configCommonFlags $ configFlags lbi mbWorkDir = mbWorkDirLBI lbi verbosity = fromFlag $ setupVerbosity common + tempFileOptions = commonSetupTempFileOptions common in case replOptionsFlagOutput (replReplOptions rflags) of - NoFlag -> runGHC verbosity ghcProg comp platform mbWorkDir ghcOpts + NoFlag -> + runGHCWithResponseFile + "ghc.rsp" + Nothing + tempFileOptions + verbosity + ghcProg + comp + platform + mbWorkDir + ghcOpts Flag out_dir -> do let uid = componentUnitId clbi this_unit = prettyShow uid - reexported_modules = [mn | LibComponentLocalBuildInfo{} <- [clbi], IPI.ExposedModule mn (Just{}) <- componentExposedModules clbi] + reexported_modules = + [ mn | LibComponentLocalBuildInfo{componentExposedModules = exposed_mods} <- [clbi], IPI.ExposedModule mn (Just{}) <- exposed_mods + ] hidden_modules = otherModules bi extra_opts = concat $ @@ -711,7 +786,9 @@ runReplOrWriteFlags ghcProg lbi rflags ghcOpts pkg_name target = writeFileAtomic (out_dir this_unit) $ BS.pack $ escapeArgs $ - extra_opts ++ renderGhcOptions comp platform (ghcOpts{ghcOptMode = NoFlag}) + extra_opts + ++ renderGhcOptions comp platform (ghcOpts{ghcOptMode = NoFlag}) + ++ programOverrideArgs ghcProg replNoLoad :: Ord a => ReplOptions -> NubListR a -> NubListR a replNoLoad replFlags l diff --git a/Cabal/src/Distribution/Simple/GHC/Build/Modules.hs b/Cabal/src/Distribution/Simple/GHC/Build/Modules.hs index 9c9e55a03bf..ad1e55451a1 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build/Modules.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build/Modules.hs @@ -1,11 +1,14 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE LambdaCase #-} -{-# LANGUAGE MultiWayIf #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TupleSections #-} -module Distribution.Simple.GHC.Build.Modules (buildHaskellModules, BuildWay (..), buildWayPrefix) where +module Distribution.Simple.GHC.Build.Modules + ( buildHaskellModules + , BuildWay (..) + , buildWayPrefix + , componentInputs + ) where import Control.Monad.IO.Class import Distribution.Compat.Prelude @@ -17,6 +20,7 @@ import Distribution.ModuleName (ModuleName) import qualified Distribution.PackageDescription as PD import Distribution.Pretty import Distribution.Simple.Build.Inputs +import Distribution.Simple.BuildWay import Distribution.Simple.Compiler import Distribution.Simple.GHC.Build.Utils import qualified Distribution.Simple.GHC.Internal as Internal @@ -97,13 +101,15 @@ buildHaskellModules -- ^ The parallelism strategy (e.g. num of jobs) -> ConfiguredProgram -- ^ The GHC configured program - -> PD.PackageDescription - -- ^ The package description + -> Maybe (SymbolicPath Pkg File) + -- ^ Optional path to a Haskell Main file to build + -> [ModuleName] + -- ^ The Haskell modules to build -> SymbolicPath Pkg ('Dir Artifacts) -- ^ The path to the build directory for this target, which -- has already been created. - -> Set.Set BuildWay - -- ^ The set of wanted build ways according to user options + -> [BuildWay] + -- ^ The set of needed build ways according to user options -> PreBuildComponentInputs -- ^ The context and component being built in it. -> IO (BuildWay -> GhcOptions) @@ -111,7 +117,7 @@ buildHaskellModules -- invocation used to compile the component in that 'BuildWay'. -- This can be useful in, eg, a linker invocation, in which we want to use the -- same options and list the same inputs as those used for building. -buildHaskellModules numJobs ghcProg pkg_descr buildTargetDir wantedWays pbci = do +buildHaskellModules numJobs ghcProg mbMainFile inputModules buildTargetDir neededLibWays pbci = do -- See Note [Building Haskell Modules accounting for TH] let @@ -129,26 +135,33 @@ buildHaskellModules numJobs ghcProg pkg_descr buildTargetDir wantedWays pbci = d | BuildRepl{} <- what = True | otherwise = False - -- TODO: do we need to put hs-boot files into place for mutually recursive - -- modules? FIX: what about exeName.hi-boot? - - -- Determine if program coverage should be enabled and if so, what - -- '-hpcdir' should be. - let isCoverageEnabled = if isLib then libCoverage lbi else exeCoverage lbi - hpcdir way - | forRepl = mempty -- HPC is not supported in ghci - | isCoverageEnabled = Flag $ Hpc.mixDir (coerceSymbolicPath $ coerceSymbolicPath buildTargetDir extraCompilationArtifacts) way - | otherwise = mempty + -- TODO: do we need to put hs-boot files into place for mutually recursive + -- modules? FIX: what about exeName.hi-boot? - (inputFiles, inputModules) <- componentInputs buildTargetDir pkg_descr pbci + -- Determine if program coverage should be enabled and if so, what + -- '-hpcdir' should be. + isCoverageEnabled = if isLib then libCoverage lbi else exeCoverage lbi + hpcdir way + | forRepl = mempty -- HPC is not supported in ghci + | isCoverageEnabled = Flag $ Hpc.mixDir (coerceSymbolicPath $ coerceSymbolicPath buildTargetDir extraCompilationArtifacts) way + | otherwise = mempty - let mbWorkDir = mbWorkDirLBI lbi - runGhcProg = runGHC verbosity ghcProg comp platform mbWorkDir + tempFileOptions = commonSetupTempFileOptions $ buildingWhatCommonFlags what + runGhcProg = + runGHCWithResponseFile + "ghc.rsp" + Nothing + tempFileOptions + verbosity + ghcProg + comp + platform + mbWorkDir platform = hostPlatform lbi - -- See Note [Building Haskell Modules accounting for TH] - doingTH = usesTemplateHaskellOrQQ bi + (hsMains, scriptMains) = + partition (isHaskell . getSymbolicPath) (maybeToList mbMainFile) -- We define the base opts which are shared across different build ways in -- 'buildHaskellModules' @@ -163,16 +176,8 @@ buildHaskellModules numJobs ghcProg pkg_descr buildTargetDir wantedWays pbci = d ghcOptNoLink = if isLib then NoFlag else toFlag True , ghcOptNumJobs = numJobs , ghcOptInputModules = toNubListR inputModules - , ghcOptInputFiles = - toNubListR $ - if PD.package pkg_descr == fakePackageId - then filter (isHaskell . getSymbolicPath) inputFiles - else inputFiles - , ghcOptInputScripts = - toNubListR $ - if PD.package pkg_descr == fakePackageId - then filter (not . isHaskell . getSymbolicPath) inputFiles - else [] + , ghcOptInputFiles = toNubListR hsMains + , ghcOptInputScripts = toNubListR scriptMains , ghcOptExtra = buildWayExtraHcOptions way GHC bi , ghcOptHiSuffix = optSuffixFlag (buildWayPrefix way) "hi" , ghcOptObjSuffix = optSuffixFlag (buildWayPrefix way) "o" @@ -200,6 +205,18 @@ buildHaskellModules numJobs ghcProg pkg_descr buildTargetDir wantedWays pbci = d (if isLib then True else False) ((if isLib then withProfLibDetail else withProfExeDetail) lbi) } + profDynOpts = + (baseOpts ProfDynWay) + { ghcOptDynLinkMode = toFlag GhcDynamicOnly -- use -dynamic + , -- TODO: Does it hurt to set -fPIC for executables? + ghcOptFPic = toFlag True -- use -fPIC + , ghcOptProfilingMode = toFlag True + , ghcOptProfilingAuto = + Internal.profDetailLevelFlag + (if isLib then True else False) + ((if isLib then withProfLibDetail else withProfExeDetail) lbi) + } + -- Options for building both static and dynamic way at the same time, using -- the GHC flag -static and -dynamic-too dynTooOpts = @@ -212,45 +229,84 @@ buildHaskellModules numJobs ghcProg pkg_descr buildTargetDir wantedWays pbci = d -- (Note that `baseOtps StaticWay = hcStaticOptions`, not hcSharedOpts) } + profDynTooOpts = + (baseOpts ProfWay) + { ghcOptDynLinkMode = toFlag GhcStaticAndDynamic -- use -dynamic-too + , -- TODO: Does it hurt to set -fPIC for executables? + ghcOptFPic = toFlag True -- use -fPIC + , ghcOptProfilingMode = toFlag True + , ghcOptProfilingAuto = + Internal.profDetailLevelFlag + (if isLib then True else False) + ((if isLib then withProfLibDetail else withProfExeDetail) lbi) + , ghcOptDynHiSuffix = toFlag (buildWayPrefix ProfDynWay ++ "hi") + , ghcOptDynObjSuffix = toFlag (buildWayPrefix ProfDynWay ++ "o") + , ghcOptHPCDir = hpcdir Hpc.ProfDyn + -- Should we pass hcSharedOpts in the -dynamic-too ghc invocation? + -- (Note that `baseOtps StaticWay = hcStaticOptions`, not hcSharedOpts) + } + -- Determines how to build for each way, also serves as the base options -- for loading modules in 'linkOrLoadComponent' buildOpts way = case way of StaticWay -> staticOpts DynWay -> dynOpts ProfWay -> profOpts - - defaultGhcWay = if isDynamic comp then DynWay else StaticWay + ProfDynWay -> profDynOpts -- If there aren't modules, or if we're loading the modules in repl, don't build. - unless (forRepl || (null inputFiles && null inputModules)) $ liftIO $ do + unless (forRepl || (isNothing mbMainFile && null inputModules)) $ liftIO $ do -- See Note [Building Haskell Modules accounting for TH] let - neededWays = - wantedWays - <> Set.fromList - -- TODO: You also don't need to build the GHC way when doing TH if - -- you are using an external interpreter!! - [defaultGhcWay | doingTH && defaultGhcWay `Set.notMember` wantedWays] + neededLibWaysSet = Set.fromList neededLibWays -- If we need both static and dynamic, use dynamic-too instead of -- compiling twice (if we support it) useDynamicToo = - StaticWay `Set.member` neededWays - && DynWay `Set.member` neededWays + StaticWay `Set.member` neededLibWaysSet + && DynWay `Set.member` neededLibWaysSet && supportsDynamicToo comp && null (hcSharedOptions GHC bi) + useProfDynamicToo = + ProfWay `Set.member` neededLibWaysSet + && ProfDynWay `Set.member` neededLibWaysSet + && supportsDynamicToo comp + && null (hcSharedOptions GHC bi) + + defaultGhcWay = compilerBuildWay comp + + order w + | w == defaultGhcWay = 0 + | otherwise = fromEnum w + 1 + -- The ways we'll build, in order orderedBuilds - -- If we can use dynamic-too, do it first. The default GHC way can only - -- be static or dynamic, so, if we build both right away, any modules - -- possibly needed by TH later (e.g. if building profiled) are already built. + -- We need to make sure that the way which is the way the compiler is built + -- is built first so that Template Haskell works. + | useProfDynamicToo && useDynamicToo = + if defaultGhcWay `elem` [ProfDynWay, ProfWay] + then [buildProfAndProfDynamicToo, buildStaticAndDynamicToo] + else [buildStaticAndDynamicToo, buildProfAndProfDynamicToo] + | useProfDynamicToo && not useDynamicToo = + if defaultGhcWay `elem` [ProfDynWay, ProfWay] + then + [buildProfAndProfDynamicToo] + ++ (runGhcProg . buildOpts <$> neededLibWays \\ [ProfDynWay, ProfWay]) + else + (runGhcProg . buildOpts <$> neededLibWays \\ [ProfDynWay, ProfWay]) + ++ [buildProfAndProfDynamicToo] | useDynamicToo = - [buildStaticAndDynamicToo] - ++ (runGhcProg . buildOpts <$> Set.toList neededWays \\ [StaticWay, DynWay]) + if defaultGhcWay `elem` [StaticWay, DynWay] + then + [buildStaticAndDynamicToo] + ++ (runGhcProg . buildOpts <$> neededLibWays \\ [StaticWay, DynWay]) + else + (runGhcProg . buildOpts <$> neededLibWays \\ [StaticWay, DynWay]) + ++ [buildStaticAndDynamicToo] -- Otherwise, we need to ensure the defaultGhcWay is built first | otherwise = - runGhcProg . buildOpts <$> sortOn (\w -> if w == defaultGhcWay then 0 else fromEnum w + 1) (Set.toList neededWays) + runGhcProg . buildOpts <$> sortOn order neededLibWays buildStaticAndDynamicToo = do runGhcProg dynTooOpts @@ -264,27 +320,31 @@ buildHaskellModules numJobs ghcProg pkg_descr buildTargetDir wantedWays pbci = d -- both ways. copyDirectoryRecursive verbosity (i dynDir) (i vanillaDir) _ -> return () + + buildProfAndProfDynamicToo = do + runGhcProg profDynTooOpts + case (hpcdir Hpc.ProfDyn, hpcdir Hpc.Prof) of + (Flag profDynDir, Flag profDir) -> + -- When the vanilla and shared library builds are done + -- in one pass, only one set of HPC module interfaces + -- are generated. This set should suffice for both + -- static and dynamically linked executables. We copy + -- the modules interfaces so they are available under + -- both ways. + copyDirectoryRecursive verbosity (i profDynDir) (i profDir) + _ -> return () in -- REVIEW:ADD? info verbosity "Building Haskell Sources..." sequence_ orderedBuilds return buildOpts -data BuildWay = StaticWay | DynWay | ProfWay - deriving (Eq, Ord, Show, Enum) - --- | Returns the object/interface extension prefix for the given build way (e.g. "dyn_" for 'DynWay') -buildWayPrefix :: BuildWay -> String -buildWayPrefix = \case - StaticWay -> "" - ProfWay -> "p_" - DynWay -> "dyn_" - -- | Returns the corresponding 'Hpc.Way' for a 'BuildWay' buildWayHpcWay :: BuildWay -> Hpc.Way buildWayHpcWay = \case StaticWay -> Hpc.Vanilla ProfWay -> Hpc.Prof DynWay -> Hpc.Dyn + ProfDynWay -> Hpc.ProfDyn -- | Returns a function to extract the extra haskell compiler options from a -- 'BuildInfo' and 'CompilerFlavor' @@ -293,26 +353,28 @@ buildWayExtraHcOptions = \case StaticWay -> hcStaticOptions ProfWay -> hcProfOptions DynWay -> hcSharedOptions + ProfDynWay -> hcProfSharedOptions --- | Returns a pair of the Haskell input files and Haskell modules of the --- component being built. +-- | Returns a pair of the main file and Haskell modules of the component being +-- built. The main file is not necessarily a Haskell file. It could also be +-- e.g. a C source, or, a Haskell repl script (that does not necessarily have +-- an extension). -- --- The "input files" are either the path to the main Haskell module, or a repl --- script (that does not necessarily have an extension). +-- The main file is Nothing if the component is not executable. componentInputs :: SymbolicPath Pkg (Dir Artifacts) -- ^ Target build dir -> PD.PackageDescription -> PreBuildComponentInputs -- ^ The context and component being built in it. - -> IO ([SymbolicPath Pkg File], [ModuleName]) - -- ^ The Haskell input files, and the Haskell modules + -> IO (Maybe (SymbolicPath Pkg File), [ModuleName]) + -- ^ The main input file, and the Haskell modules componentInputs buildTargetDir pkg_descr pbci = case component of CLib lib -> - pure ([], allLibModules lib clbi) + pure (Nothing, allLibModules lib clbi) CFLib flib -> - pure ([], foreignLibModules flib) + pure (Nothing, foreignLibModules flib) CExe Executable{buildInfo = bi', modulePath} -> exeLikeInputs bi' modulePath CTest TestSuite{testBuildInfo = bi', testInterface = TestSuiteExeV10 _ mainFile} -> @@ -351,6 +413,6 @@ componentInputs buildTargetDir pkg_descr pbci = "Enabling workaround for Main module '" ++ prettyShow mainModName ++ "' listed in 'other-modules' illegally!" - return ([main], filter (/= mainModName) otherModNames) - else return ([main], otherModNames) - else return ([], otherModNames) + return (Just main, filter (/= mainModName) otherModNames) + else return (Just main, otherModNames) + else return (Just main, otherModNames) diff --git a/Cabal/src/Distribution/Simple/GHC/Build/Utils.hs b/Cabal/src/Distribution/Simple/GHC/Build/Utils.hs index fb8bd21351a..e61fc50c9c4 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build/Utils.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build/Utils.hs @@ -13,6 +13,7 @@ import qualified Distribution.ModuleName as ModuleName import Distribution.PackageDescription as PD import Distribution.PackageDescription.Utils (cabalBug) import Distribution.Simple.BuildPaths +import Distribution.Simple.BuildWay import Distribution.Simple.Compiler import qualified Distribution.Simple.GHC.Internal as Internal import Distribution.Simple.Program.GHC @@ -30,7 +31,7 @@ import System.FilePath ) -- | Find the path to the entry point of an executable (typically specified in --- @main-is@, and found in @hs-source-dirs@). +-- @main-is@, and found in @hs-source-dirs@ -- yes, even when @main-is@ is not a Haskell file). findExecutableMain :: Verbosity -> Maybe (SymbolicPath CWD (Dir Pkg)) @@ -47,10 +48,21 @@ findExecutableMain verbosity mbWorkDir buildDir (bnfo, modPath) = supportsDynamicToo :: Compiler -> Bool supportsDynamicToo = Internal.ghcLookupProperty "Support dynamic-too" +compilerBuildWay :: Compiler -> BuildWay +compilerBuildWay c = + case (isDynamic c, isProfiled c) of + (True, True) -> ProfDynWay + (True, False) -> DynWay + (False, True) -> ProfWay + (False, False) -> StaticWay + -- | Is this compiler's RTS dynamically linked? isDynamic :: Compiler -> Bool isDynamic = Internal.ghcLookupProperty "GHC Dynamic" +isProfiled :: Compiler -> Bool +isProfiled = Internal.ghcLookupProperty "GHC Profiled" + -- | Should we dynamically link the foreign library, based on its 'foreignLibType'? withDynFLib :: ForeignLib -> Bool withDynFLib flib = diff --git a/Cabal/src/Distribution/Simple/GHC/EnvironmentParser.hs b/Cabal/src/Distribution/Simple/GHC/EnvironmentParser.hs index 38ec484fe28..19981f51c3b 100644 --- a/Cabal/src/Distribution/Simple/GHC/EnvironmentParser.hs +++ b/Cabal/src/Distribution/Simple/GHC/EnvironmentParser.hs @@ -1,9 +1,5 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} module Distribution.Simple.GHC.EnvironmentParser (parseGhcEnvironmentFile, readGhcEnvironmentFile, ParseErrorExc (..)) where @@ -11,8 +7,6 @@ import Distribution.Compat.Prelude import Prelude () import Distribution.Simple.Compiler - ( PackageDB (..) - ) import Distribution.Simple.GHC.Internal ( GhcEnvironmentFileEntry (..) ) @@ -26,7 +20,7 @@ import Text.Parsec.String , parseFromFile ) -parseEnvironmentFileLine :: Parser GhcEnvironmentFileEntry +parseEnvironmentFileLine :: Parser (GhcEnvironmentFileEntry FilePath) parseEnvironmentFileLine = GhcEnvFileComment <$> comment <|> GhcEnvFilePackageId <$> unitId @@ -46,14 +40,14 @@ parseEnvironmentFileLine = clearDb = P.string "clear-package-db" newtype ParseErrorExc = ParseErrorExc P.ParseError - deriving (Show, Typeable) + deriving (Show) instance Exception ParseErrorExc -parseGhcEnvironmentFile :: Parser [GhcEnvironmentFileEntry] +parseGhcEnvironmentFile :: Parser [GhcEnvironmentFileEntry FilePath] parseGhcEnvironmentFile = parseEnvironmentFileLine `P.sepEndBy` P.endOfLine <* P.eof -readGhcEnvironmentFile :: FilePath -> IO [GhcEnvironmentFileEntry] +readGhcEnvironmentFile :: FilePath -> IO [GhcEnvironmentFileEntry FilePath] readGhcEnvironmentFile path = either (throwIO . ParseErrorExc) return =<< parseFromFile parseGhcEnvironmentFile path diff --git a/Cabal/src/Distribution/Simple/GHC/Internal.hs b/Cabal/src/Distribution/Simple/GHC/Internal.hs index a4b75cdb6d3..6e27b41bc83 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -75,8 +75,8 @@ import Distribution.Simple.Program.GHC import Distribution.Simple.Setup.Common (extraCompilationArtifacts) import Distribution.Simple.Utils import Distribution.System -import Distribution.Types.ComponentId (ComponentId) import Distribution.Types.ComponentLocalBuildInfo +import Distribution.Types.GivenComponent import Distribution.Types.LocalBuildInfo import Distribution.Types.TargetInfo import Distribution.Types.UnitId @@ -85,7 +85,7 @@ import Distribution.Utils.Path import Distribution.Verbosity import Distribution.Version (Version) import Language.Haskell.Extension -import System.Directory (getDirectoryContents, getTemporaryDirectory) +import System.Directory (getDirectoryContents) import System.Environment (getEnv) import System.FilePath ( takeDirectory @@ -221,9 +221,8 @@ configureToolchain _implInfo ghcProg ghcInfo = -- we need to find out if ld supports the -x flag configureLd' :: Verbosity -> ConfiguredProgram -> IO ConfiguredProgram configureLd' verbosity ldProg = do - tempDir <- getTemporaryDirectory - ldx <- withTempFile tempDir ".c" $ \testcfile testchnd -> - withTempFile tempDir ".o" $ \testofile testohnd -> do + ldx <- withTempFile ".c" $ \testcfile testchnd -> + withTempFile ".o" $ \testofile testohnd -> do hPutStrLn testchnd "int foo() { return 0; }" hClose testchnd hClose testohnd @@ -236,7 +235,7 @@ configureToolchain _implInfo ghcProg ghcInfo = , "-o" , testofile ] - withTempFile tempDir ".o" $ \testofile' testohnd' -> + withTempFile ".o" $ \testofile' testohnd' -> do hClose testohnd' _ <- @@ -672,7 +671,7 @@ getHaskellObjects _implInfo lib lbi clbi pref wanted_obj_ext allow_split_objs -- and is a hack to avoid passing bogus `-package` arguments to GHC. The assumption being that -- in 99% of cases we will include the right `-package` so that the C file finds the right headers. mkGhcOptPackages - :: Map (PackageName, ComponentName) ComponentId + :: Map (PackageName, ComponentName) PromisedComponent -> ComponentLocalBuildInfo -> [(OpenUnitId, ModuleRenaming)] mkGhcOptPackages promisedPkgsMap clbi = @@ -680,7 +679,7 @@ mkGhcOptPackages promisedPkgsMap clbi = ] where -- Promised deps are going to be simple UnitIds - promised_cids = Set.fromList (map newSimpleUnitId (Map.elems promisedPkgsMap)) + promised_cids = Set.fromList (map (newSimpleUnitId . promisedComponentId) (Map.elems promisedPkgsMap)) substTopDir :: FilePath -> IPI.InstalledPackageInfo -> IPI.InstalledPackageInfo substTopDir topDir ipo = @@ -766,7 +765,7 @@ ghcPlatformAndVersionString (Platform arch os) version = -- Constructing GHC environment files -- | The kinds of entries we can stick in a @.ghc.environment@ file. -data GhcEnvironmentFileEntry +data GhcEnvironmentFileEntry fp = -- | @-- a comment@ GhcEnvFileComment String | -- | @package-id foo-1.0-4fe301a...@ @@ -774,7 +773,7 @@ data GhcEnvironmentFileEntry | -- | @global-package-db@, -- @user-package-db@ or -- @package-db blah/package.conf.d/@ - GhcEnvFilePackageDb PackageDB + GhcEnvFilePackageDb (PackageDBX fp) | -- | @clear-package-db@ GhcEnvFileClearPackageDbStack deriving (Eq, Ord, Show) @@ -785,9 +784,9 @@ data GhcEnvironmentFileEntry -- If you need to do anything more complicated then either use this as a basis -- and add more entries, or just make all the entries directly. simpleGhcEnvironmentFile - :: PackageDBStack + :: PackageDBStackX fp -> [UnitId] - -> [GhcEnvironmentFileEntry] + -> [GhcEnvironmentFileEntry fp] simpleGhcEnvironmentFile packageDBs pkgids = GhcEnvFileClearPackageDbStack : map GhcEnvFilePackageDb packageDBs @@ -805,7 +804,7 @@ writeGhcEnvironmentFile -- ^ the GHC target platform -> Version -- ^ the GHC version - -> [GhcEnvironmentFileEntry] + -> [GhcEnvironmentFileEntry FilePath] -- ^ the content -> IO FilePath writeGhcEnvironmentFile directory platform ghcversion entries = do @@ -820,12 +819,12 @@ ghcEnvironmentFileName platform ghcversion = ".ghc.environment." ++ ghcPlatformAndVersionString platform ghcversion -- | Render a bunch of GHC environment file entries -renderGhcEnvironmentFile :: [GhcEnvironmentFileEntry] -> String +renderGhcEnvironmentFile :: [GhcEnvironmentFileEntry FilePath] -> String renderGhcEnvironmentFile = unlines . map renderGhcEnvironmentFileEntry -- | Render an individual GHC environment file entry -renderGhcEnvironmentFileEntry :: GhcEnvironmentFileEntry -> String +renderGhcEnvironmentFileEntry :: GhcEnvironmentFileEntry FilePath -> String renderGhcEnvironmentFileEntry entry = case entry of GhcEnvFileComment comment -> format comment where diff --git a/Cabal/src/Distribution/Simple/GHCJS.hs b/Cabal/src/Distribution/Simple/GHCJS.hs index 973230ee3c7..eb8400f7f37 100644 --- a/Cabal/src/Distribution/Simple/GHCJS.hs +++ b/Cabal/src/Distribution/Simple/GHCJS.hs @@ -2,7 +2,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TupleSections #-} module Distribution.Simple.GHCJS ( getGhcInfo @@ -313,8 +312,8 @@ getGhcInfo verbosity ghcjsProg = Internal.getGhcInfo verbosity implInfo ghcjsPro -- | Given a single package DB, return all installed packages. getPackageDBContents :: Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDB + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBX (SymbolicPath from (Dir PkgDB)) -> ProgramDb -> IO InstalledPackageIndex getPackageDBContents verbosity mbWorkDir packagedb progdb = do @@ -324,8 +323,8 @@ getPackageDBContents verbosity mbWorkDir packagedb progdb = do -- | Given a package DB stack, return all installed packages. getInstalledPackages :: Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDBStack + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBStackX (SymbolicPath from (Dir PkgDB)) -> ProgramDb -> IO InstalledPackageIndex getInstalledPackages verbosity mbWorkDir packagedbs progdb = do @@ -337,7 +336,7 @@ getInstalledPackages verbosity mbWorkDir packagedbs progdb = do toPackageIndex :: Verbosity - -> [(PackageDB, [InstalledPackageInfo])] + -> [(PackageDBX a, [InstalledPackageInfo])] -> ProgramDb -> IO InstalledPackageIndex toPackageIndex verbosity pkgss progdb = do @@ -393,7 +392,7 @@ checkPackageDbEnvVar :: Verbosity -> IO () checkPackageDbEnvVar verbosity = Internal.checkPackageDbEnvVar verbosity "GHCJS" "GHCJS_PACKAGE_PATH" -checkPackageDbStack :: Verbosity -> PackageDBStack -> IO () +checkPackageDbStack :: Eq fp => Verbosity -> PackageDBStackX fp -> IO () checkPackageDbStack _ (GlobalPackageDB : rest) | GlobalPackageDB `notElem` rest = return () checkPackageDbStack verbosity rest @@ -404,10 +403,10 @@ checkPackageDbStack verbosity _ = getInstalledPackages' :: Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> [PackageDB] + -> Maybe (SymbolicPath CWD (Dir from)) + -> [PackageDBX (SymbolicPath from (Dir PkgDB))] -> ProgramDb - -> IO [(PackageDB, [InstalledPackageInfo])] + -> IO [(PackageDBX (SymbolicPath from (Dir PkgDB)), [InstalledPackageInfo])] getInstalledPackages' verbosity mbWorkDir packagedbs progdb = sequenceA [ do @@ -432,7 +431,7 @@ getInstalledPackagesMonitorFiles verbosity platform mbWorkDir progdb = selectMonitorFile =<< getGlobalPackageDB verbosity ghcjsProg getPackageDBPath UserPackageDB = selectMonitorFile =<< getUserPackageDB verbosity ghcjsProg platform - getPackageDBPath (SpecificPackageDB path) = selectMonitorFile path + getPackageDBPath (SpecificPackageDB path) = selectMonitorFile (interpretSymbolicPath mbWorkDir path) -- GHC has old style file dbs, and new style directory dbs. -- Note that for dir style dbs, we only need to monitor the cache file, not @@ -583,7 +582,7 @@ buildOrReplLib mReplFlags verbosity numJobs _pkg_descr lbi lib clbi = do , ghcOptFPic = toFlag True , -- ghcOptHiSuffix = toFlag "dyn_hi", -- ghcOptObjSuffix = toFlag "dyn_o", - ghcOptExtra = hcSharedOptions GHC libBi + ghcOptExtra = hcOptions GHC libBi ++ hcSharedOptions GHC libBi , ghcOptHPCDir = hpcdir Hpc.Dyn } @@ -772,7 +771,7 @@ buildOrReplLib mReplFlags verbosity numJobs _pkg_descr lbi lib clbi = do , ghcOptDynLinkMode = toFlag GhcDynamicOnly , ghcOptInputFiles = toNubListR dynamicObjectFiles , ghcOptOutputFile = toFlag sharedLibFilePath - , ghcOptExtra = hcSharedOptions GHC libBi + , ghcOptExtra = hcOptions GHC libBi ++ hcSharedOptions GHC libBi , -- For dynamic libs, Mac OS/X needs to know the install location -- at build time. This only applies to GHC < 7.8 - see the -- discussion in #1660. @@ -1330,7 +1329,7 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do ghcOptFPic = toFlag True , ghcOptHiSuffix = toFlag "dyn_hi" , ghcOptObjSuffix = toFlag "dyn_o" - , ghcOptExtra = hcSharedOptions GHC bnfo + , ghcOptExtra = hcOptions GHC bnfo ++ hcSharedOptions GHC bnfo , ghcOptHPCDir = hpcdir Hpc.Dyn } dynTooOpts = @@ -1781,7 +1780,7 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do , ghcOptFPic = toFlag True , ghcOptHiSuffix = toFlag "js_dyn_hi" , ghcOptObjSuffix = toFlag "js_dyn_o" - , ghcOptExtra = hcSharedOptions GHC libBi + , ghcOptExtra = hcOptions GHC libBi ++ hcSharedOptions GHC libBi } profArgs = vanillaArgs @@ -1850,7 +1849,7 @@ installExe exeFileName = exeName' fixedExeBaseName = progprefix ++ exeName' ++ progsuffix installBinary dest = do - runDbProgram verbosity ghcjsProgram (withPrograms lbi) $ + runDbProgramCwd verbosity (mbWorkDirLBI lbi) ghcjsProgram (withPrograms lbi) $ [ "--install-executable" , buildPref exeName' exeFileName , "-o" @@ -2026,8 +2025,8 @@ hcPkgInfo progdb = registerPackage :: Verbosity -> ProgramDb - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDBStack + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBStackS from -> InstalledPackageInfo -> HcPkg.RegisterOptions -> IO () @@ -2066,7 +2065,7 @@ pkgRoot verbosity lbi = pkgRoot' pkgRoot' (SpecificPackageDB fp) = return $ takeDirectory $ - interpretSymbolicPathLBI lbi (unsafeMakeSymbolicPath fp) + interpretSymbolicPathLBI lbi fp -- | Get the JavaScript file name and command and arguments to run a -- program compiled by GHCJS diff --git a/Cabal/src/Distribution/Simple/Glob.hs b/Cabal/src/Distribution/Simple/Glob.hs index 8798d7a8578..65973e9e2ac 100644 --- a/Cabal/src/Distribution/Simple/Glob.hs +++ b/Cabal/src/Distribution/Simple/Glob.hs @@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveFunctor #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} @@ -370,7 +369,6 @@ runDirFileGlob verbosity mspec rawRoot pat = do "Null dir passed to runDirFileGlob; interpreting it " ++ "as '.'. This is probably an internal error." let root = if null rawRoot then "." else rawRoot - debug verbosity $ "Expanding glob '" ++ show (pretty pat) ++ "' in directory '" ++ root ++ "'." -- This function might be called from the project root with dir as -- ".". Walking the tree starting there involves going into .git/ -- and dist-newstyle/, which is a lot of work for no reward, so @@ -379,7 +377,7 @@ runDirFileGlob verbosity mspec rawRoot pat = do -- the whole directory if *, and just the specific file if it's a -- literal. let - (prefixSegments, variablePattern) = splitConstantPrefix pat + (prefixSegments, pathOrVariablePattern) = splitConstantPrefix pat joinedPrefix = joinPath prefixSegments -- The glob matching function depends on whether we care about the cabal version or not @@ -431,17 +429,37 @@ runDirFileGlob verbosity mspec rawRoot pat = do concat <$> traverse (\subdir -> go globPath (dir subdir)) subdirs go GlobDirTrailing dir = return [GlobMatch dir] - directoryExists <- doesDirectoryExist (root joinedPrefix) - if directoryExists - then go variablePattern joinedPrefix - else return [GlobMissingDirectory joinedPrefix] + case pathOrVariablePattern of + Left filename -> do + let filepath = joinedPrefix filename + debug verbosity $ "Treating glob as filepath literal '" ++ filepath ++ "' in directory '" ++ root ++ "'." + directoryExists <- doesDirectoryExist (root filepath) + if directoryExists + then pure [GlobMatchesDirectory filepath] + else do + exist <- doesFileExist (root filepath) + pure $ + if exist + then [GlobMatch filepath] + else [] + Right variablePattern -> do + debug verbosity $ "Expanding glob '" ++ show (pretty pat) ++ "' in directory '" ++ root ++ "'." + directoryExists <- doesDirectoryExist (root joinedPrefix) + if directoryExists + then go variablePattern joinedPrefix + else return [GlobMissingDirectory joinedPrefix] where -- \| Extract the (possibly null) constant prefix from the pattern. -- This has the property that, if @(pref, final) = splitConstantPrefix pat@, -- then @pat === foldr GlobDir final pref@. - splitConstantPrefix :: Glob -> ([FilePath], Glob) - splitConstantPrefix = unfoldr' step + splitConstantPrefix :: Glob -> ([FilePath], Either FilePath Glob) + splitConstantPrefix = fmap literalize . unfoldr' step where + literalize (GlobFile [Literal filename]) = + Left filename + literalize glob = + Right glob + step (GlobDir [Literal seg] pat') = Right (seg, pat') step pat' = Left pat' diff --git a/Cabal/src/Distribution/Simple/Glob/Internal.hs b/Cabal/src/Distribution/Simple/Glob/Internal.hs index 13661cf97d5..0d87a5a2ff9 100644 --- a/Cabal/src/Distribution/Simple/Glob/Internal.hs +++ b/Cabal/src/Distribution/Simple/Glob/Internal.hs @@ -1,6 +1,4 @@ -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE LambdaCase #-} ----------------------------------------------------------------------------- diff --git a/Cabal/src/Distribution/Simple/Haddock.hs b/Cabal/src/Distribution/Simple/Haddock.hs index 2429362d72e..ee2b88e76af 100644 --- a/Cabal/src/Distribution/Simple/Haddock.hs +++ b/Cabal/src/Distribution/Simple/Haddock.hs @@ -5,7 +5,6 @@ {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} ----------------------------------------------------------------------------- @@ -67,12 +66,9 @@ import Distribution.Simple.Program.GHC import qualified Distribution.Simple.Program.HcPkg as HcPkg import Distribution.Simple.Program.ResponseFile import Distribution.Simple.Register -import Distribution.Simple.Setup.Common -import Distribution.Simple.Setup.Haddock -import Distribution.Simple.Setup.Hscolour +import Distribution.Simple.Setup import Distribution.Simple.SetupHooks.Internal ( BuildHooks (..) - , BuildingWhat (..) , noBuildHooks ) import qualified Distribution.Simple.SetupHooks.Internal as SetupHooks @@ -83,7 +79,6 @@ import Distribution.Types.ComponentLocalBuildInfo import Distribution.Types.ExposedModule import Distribution.Types.LocalBuildInfo import Distribution.Types.TargetInfo -import Distribution.Utils.NubList import Distribution.Utils.Path hiding ( Dir ) @@ -92,9 +87,8 @@ import qualified Distribution.Utils.ShortText as ShortText import Distribution.Verbosity import Distribution.Version -import Language.Haskell.Extension - import Control.Monad +import Data.Bool (bool) import Data.Either (rights) import System.Directory (doesDirectoryExist, doesFileExist) import System.FilePath (isAbsolute, normalise) @@ -110,6 +104,9 @@ data HaddockArgs = HaddockArgs -- ^ Path to the interface file, relative to argOutputDir, required. , argPackageName :: Flag PackageIdentifier -- ^ Package name, required. + , argComponentName :: Flag String + -- ^ Optional name used to construct haddock's `--package-name` option for + -- various components (tests suites, sublibriaries, etc). , argHideModules :: (All, [ModuleName.ModuleName]) -- ^ (Hide modules ?, modules to hide) , argIgnoreExports :: Any @@ -153,8 +150,10 @@ data HaddockArgs = HaddockArgs -- ^ Re-exported modules , argTargets :: [FilePath] -- ^ Modules to process. - , argLib :: Flag String + , argResourcesDir :: Flag String -- ^ haddock's static \/ auxiliary files. + , argUseUnicode :: Flag Bool + -- ^ haddock's `--use-unicode` flag } deriving (Generic) @@ -262,6 +261,7 @@ haddock_setupHooks mbWorkDir = flagToMaybe $ haddockWorkingDir flags comp = compiler lbi platform = hostPlatform lbi + config = configFlags lbi quickJmpFlag = haddockQuickJump flags' flags = case haddockTarget of @@ -279,9 +279,7 @@ haddock_setupHooks flag f = fromFlag $ f flags tmpFileOpts = - defaultTempFileOptions - { optKeepTempFiles = flag haddockKeepTempFiles - } + commonSetupTempFileOptions $ configCommonFlags config htmlTemplate = fmap toPathTemplate . flagToMaybe . haddockHtmlLocation $ flags @@ -357,123 +355,186 @@ haddock_setupHooks in for_ mbPbcRules $ \pbcRules -> do (ruleFromId, _mons) <- SetupHooks.computeRules verbosity inputs pbcRules SetupHooks.executeRules verbosity lbi2 tgt ruleFromId - preBuildComponent runPreBuildHooks verbosity lbi' target - preprocessComponent pkg_descr component lbi' clbi False verbosity suffixes - let - doExe com = case (compToExe com) of - Just exe -> do - withTempDirectoryCwdEx verbosity tmpFileOpts mbWorkDir (buildDir lbi') "tmp" $ - \tmp -> do - exeArgs <- - fromExecutable - verbosity - tmp - lbi' - clbi - htmlTemplate - version - exe - let exeArgs' = commonArgs `mappend` exeArgs - runHaddock + + -- See Note [Hi Haddock Recompilation Avoidance] + reusingGHCCompilationArtifacts verbosity tmpFileOpts mbWorkDir lbi bi clbi version $ \haddockArtifactsDirs -> do + preBuildComponent runPreBuildHooks verbosity lbi' target + preprocessComponent pkg_descr component lbi' clbi False verbosity suffixes + let + doExe com = case (compToExe com) of + Just exe -> do + exeArgs <- + fromExecutable verbosity - mbWorkDir - tmpFileOpts - comp - platform - haddockProg - True - exeArgs' - Nothing -> do - warn + haddockArtifactsDirs + lbi' + clbi + htmlTemplate + haddockTarget + pkg_descr + exe + commonArgs + runHaddock + verbosity + mbWorkDir + tmpFileOpts + comp + platform + haddockProg + True + exeArgs + Nothing -> do + warn + verbosity + "Unsupported component, skipping..." + return () + -- We define 'smsg' once and then reuse it inside the case, so that + -- we don't say we are running Haddock when we actually aren't + -- (e.g., Haddock is not run on non-libraries) + smsg :: IO () + smsg = + setupMessage' verbosity - "Unsupported component, skipping..." - return () - -- We define 'smsg' once and then reuse it inside the case, so that - -- we don't say we are running Haddock when we actually aren't - -- (e.g., Haddock is not run on non-libraries) - smsg :: IO () - smsg = - setupMessage' - verbosity - "Running Haddock on" - (packageId pkg_descr) - (componentLocalName clbi) - (maybeComponentInstantiatedWith clbi) - ipi <- case component of - CLib lib -> do - withTempDirectoryCwdEx verbosity tmpFileOpts mbWorkDir (buildDir lbi) "tmp" $ - \tmp -> do + "Running Haddock on" + (packageId pkg_descr) + (componentLocalName clbi) + (maybeComponentInstantiatedWith clbi) + ipi <- case component of + CLib lib -> do + smsg + libArgs <- + fromLibrary + verbosity + haddockArtifactsDirs + lbi' + clbi + htmlTemplate + haddockTarget + pkg_descr + lib + commonArgs + runHaddock + verbosity + mbWorkDir + tmpFileOpts + comp + platform + haddockProg + True + libArgs + inplaceDir <- absoluteWorkingDirLBI lbi + + let + ipi = + inplaceInstalledPackageInfo + inplaceDir + (flag $ setupDistPref . haddockCommonFlags) + pkg_descr + (mkAbiHash "inplace") + lib + lbi' + clbi + + debug verbosity $ + "Registering inplace:\n" + ++ (InstalledPackageInfo.showInstalledPackageInfo ipi) + + registerPackage + verbosity + (compiler lbi') + (withPrograms lbi') + mbWorkDir + (withPackageDB lbi') + ipi + HcPkg.defaultRegisterOptions + { HcPkg.registerMultiInstance = True + } + + return $ PackageIndex.insert ipi index + CFLib flib -> + when + (flag haddockForeignLibs) + ( do + smsg + flibArgs <- + fromForeignLib + verbosity + haddockArtifactsDirs + lbi' + clbi + htmlTemplate + haddockTarget + pkg_descr + flib + commonArgs + runHaddock + verbosity + mbWorkDir + tmpFileOpts + comp + platform + haddockProg + True + flibArgs + ) + >> return index + CExe _ -> when (flag haddockExecutables) (smsg >> doExe component) >> return index + CTest test -> do + when (flag haddockTestSuites) $ do smsg - libArgs <- - fromLibrary + testArgs <- + fromTest verbosity - tmp + haddockArtifactsDirs lbi' clbi htmlTemplate - version - lib - let libArgs' = commonArgs `mappend` libArgs - runHaddock verbosity mbWorkDir tmpFileOpts comp platform haddockProg True libArgs' - inplaceDir <- absoluteWorkingDirLBI lbi - - let - ipi = - inplaceInstalledPackageInfo - inplaceDir - (flag $ setupDistPref . haddockCommonFlags) - pkg_descr - (mkAbiHash "inplace") - lib - lbi' - clbi - - debug verbosity $ - "Registering inplace:\n" - ++ (InstalledPackageInfo.showInstalledPackageInfo ipi) - - registerPackage + haddockTarget + pkg_descr + test + commonArgs + runHaddock verbosity - (compiler lbi') - (withPrograms lbi') mbWorkDir - (withPackageDB lbi') - ipi - HcPkg.defaultRegisterOptions - { HcPkg.registerMultiInstance = True - } - - return $ PackageIndex.insert ipi index - CFLib flib -> - when - (flag haddockForeignLibs) - ( do - withTempDirectoryCwdEx verbosity tmpFileOpts mbWorkDir (buildDir lbi') "tmp" $ - \tmp -> do - smsg - flibArgs <- - fromForeignLib - verbosity - tmp - lbi' - clbi - htmlTemplate - version - flib - let libArgs' = commonArgs `mappend` flibArgs - runHaddock verbosity mbWorkDir tmpFileOpts comp platform haddockProg True libArgs' - ) - >> return index - CExe _ -> when (flag haddockExecutables) (smsg >> doExe component) >> return index - CTest _ -> when (flag haddockTestSuites) (smsg >> doExe component) >> return index - CBench _ -> when (flag haddockBenchmarks) (smsg >> doExe component) >> return index + tmpFileOpts + comp + platform + haddockProg + True + testArgs + return index + CBench bench -> do + when (flag haddockBenchmarks) $ do + smsg + benchArgs <- + fromBenchmark + verbosity + haddockArtifactsDirs + lbi' + clbi + htmlTemplate + haddockTarget + pkg_descr + bench + commonArgs + runHaddock + verbosity + mbWorkDir + tmpFileOpts + comp + platform + haddockProg + True + benchArgs + return index - return ipi + return ipi for_ (extraDocFiles pkg_descr) $ \fpath -> do files <- matchDirFileGlob verbosity (specVersion pkg_descr) mbWorkDir fpath + let targetDir = Dir $ unDir' (argOutputDir commonArgs) haddockDirName haddockTarget pkg_descr for_ files $ - copyFileToCwd verbosity mbWorkDir (unDir $ argOutputDir commonArgs) + copyFileToCwd verbosity mbWorkDir (unDir targetDir) -- | Execute 'Haddock' configured with 'HaddocksFlags'. It is used to build -- index and contents for documentation of multiple packages. @@ -487,9 +548,11 @@ createHaddockIndex -> IO () createHaddockIndex verbosity programDb comp platform mbWorkDir flags = do let args = fromHaddockProjectFlags flags + tmpFileOpts = + commonSetupTempFileOptions $ haddockProjectCommonFlags $ flags (haddockProg, _version) <- getHaddockProg verbosity programDb comp args (Flag True) - runHaddock verbosity mbWorkDir defaultTempFileOptions comp platform haddockProg False args + runHaddock verbosity mbWorkDir tmpFileOpts comp platform haddockProg False args -- ------------------------------------------------------------------------------ -- Contributions to HaddockArgs (see also Doctest.hs for very similar code). @@ -525,7 +588,7 @@ fromFlags env flags = (haddockIndex flags) , argGenIndex = Flag False , argBaseUrl = haddockBaseUrl flags - , argLib = haddockLib flags + , argResourcesDir = haddockResourcesDir flags , argVerbose = maybe mempty (Any . (>= deafening)) . flagToMaybe @@ -537,6 +600,7 @@ fromFlags env flags = os -> os , argOutputDir = maybe mempty (Dir . getSymbolicPath) . flagToMaybe $ setupDistPref commonFlags , argGhcOptions = mempty{ghcOptExtra = ghcArgs} + , argUseUnicode = haddockUseUnicode flags } where ghcArgs = fromMaybe [] . lookup "ghc" . haddockProgramArgs $ flags @@ -552,17 +616,16 @@ fromHaddockProjectFlags flags = , argPrologueFile = haddockProjectPrologue flags , argInterfaces = fromFlagOrDefault [] (haddockProjectInterfaces flags) , argLinkedSource = Flag True - , argLib = haddockProjectLib flags + , argResourcesDir = haddockProjectResourcesDir flags + , argCssFile = haddockProjectCss flags } fromPackageDescription :: HaddockTarget -> PackageDescription -> HaddockArgs -fromPackageDescription haddockTarget pkg_descr = +fromPackageDescription _haddockTarget pkg_descr = mempty - { argInterfaceFile = Flag $ haddockName pkg_descr + { argInterfaceFile = Flag $ haddockPath pkg_descr , argPackageName = Flag $ packageId $ pkg_descr - , argOutputDir = - Dir $ - "doc" "html" haddockDirName haddockTarget pkg_descr + , argOutputDir = Dir $ "doc" "html" , argPrologue = Flag $ ShortText.fromShortText $ @@ -595,38 +658,70 @@ componentGhcOptions verbosity lbi bi clbi odir = ++ "haddock only supports GHC and GHCJS" in f verbosity lbi bi clbi odir +{- +Note [Hi Haddock Recompilation Avoidance] +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Starting with Haddock 2.28, we no longer want to run Haddock's GHC session in +an arbitrary temporary directory. Doing so always causes recompilation during +documentation generation, which can now be avoided thanks to Hi Haddock. + +Instead, we want to re-use the interface and object files produced by GHC. +We copy these intermediate files produced by GHC to temporary directories and +point haddock to them. + +The reason why we can't use the GHC files /inplace/ is that haddock may have to +recompile (e.g. because of `haddock-options`). In that case, we want to be sure +the files produced by GHC do not get overwritten. + +See https://github.com/haskell/cabal/pull/9177 for discussion. + +(W.1) As it turns out, -stubdir is included in GHC's recompilation fingerprint. +This means that if we use a temporary directory for stubfiles produced by GHC +for the haddock invocation, haddock will trigger full recompilation since the +stubdir would be different. + +So we don't use a temporary stubdir, despite the tmp o-dir and hi-dir: + +We want to avoid at all costs haddock accidentally overwriting o-files and +hi-files (e.g. if a user specified haddock-option triggers recompilation), and +thus copy them to a temporary directory to pass them on to haddock. However, +stub files are much less problematic since ABI-incompatibility isn't at play +here, that is, there doesn't seem to be a GHC flag that could accidentally make +a stub file incompatible with the one produced by GHC from the same module. +-} + mkHaddockArgs :: Verbosity - -> SymbolicPath Pkg (Path.Dir Tmp) + -> (SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts)) + -- ^ Directories for -hidir, -odir, and -stubdir to GHC through Haddock. + -- See Note [Hi Haddock Recompilation Avoidance] -> LocalBuildInfo -> ComponentLocalBuildInfo -> Maybe PathTemplate -- ^ template for HTML location - -> Version -> [SymbolicPath Pkg File] -> BuildInfo -> IO HaddockArgs -mkHaddockArgs verbosity tmp lbi clbi htmlTemplate haddockVersion inFiles bi = do +mkHaddockArgs verbosity (tmpObjDir, tmpHiDir, tmpStubDir) lbi clbi htmlTemplate inFiles bi = do + let + vanillaOpts' = + componentGhcOptions normal lbi bi clbi (buildDir lbi) + vanillaOpts = + vanillaOpts' + { -- See Note [Hi Haddock Recompilation Avoidance] + ghcOptObjDir = toFlag tmpObjDir + , ghcOptHiDir = toFlag tmpHiDir + , ghcOptStubDir = toFlag tmpStubDir + } + sharedOpts = + vanillaOpts + { ghcOptDynLinkMode = toFlag GhcDynamicOnly + , ghcOptFPic = toFlag True + , ghcOptHiSuffix = toFlag "dyn_hi" + , ghcOptObjSuffix = toFlag "dyn_o" + , ghcOptExtra = hcSharedOptions GHC bi + } ifaceArgs <- getInterfaces verbosity lbi clbi htmlTemplate - let vanillaOpts = - (componentGhcOptions normal lbi bi clbi (buildDir lbi)) - { -- Noooooooooo!!!!!111 - -- haddock stomps on our precious .hi - -- and .o files. Workaround by telling - -- haddock to write them elsewhere. - ghcOptObjDir = toFlag $ coerceSymbolicPath tmp - , ghcOptHiDir = toFlag $ coerceSymbolicPath tmp - , ghcOptStubDir = toFlag $ coerceSymbolicPath tmp - } - `mappend` getGhcCppOpts haddockVersion bi - sharedOpts = - vanillaOpts - { ghcOptDynLinkMode = toFlag GhcDynamicOnly - , ghcOptFPic = toFlag True - , ghcOptHiSuffix = toFlag "dyn_hi" - , ghcOptObjSuffix = toFlag "dyn_o" - , ghcOptExtra = hcSharedOptions GHC bi - } opts <- if withVanillaLib lbi then return vanillaOpts @@ -644,85 +739,251 @@ mkHaddockArgs verbosity tmp lbi clbi htmlTemplate haddockVersion inFiles bi = do fromLibrary :: Verbosity - -> SymbolicPath Pkg (Path.Dir Tmp) + -> (SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts)) + -- ^ Directories for -hidir, -odir, and -stubdir to GHC through Haddock. + -- See Note [Hi Haddock Recompilation Avoidance] -> LocalBuildInfo -> ComponentLocalBuildInfo -> Maybe PathTemplate -- ^ template for HTML location - -> Version + -> HaddockTarget + -> PackageDescription -> Library + -> HaddockArgs + -- ^ common args -> IO HaddockArgs -fromLibrary verbosity tmp lbi clbi htmlTemplate haddockVersion lib = do +fromLibrary verbosity haddockArtifactsDirs lbi clbi htmlTemplate haddockTarget pkg_descr lib commonArgs = do inFiles <- map snd `fmap` getLibSourceFiles verbosity lbi lib clbi args <- mkHaddockArgs verbosity - tmp + haddockArtifactsDirs lbi clbi htmlTemplate - haddockVersion inFiles (libBuildInfo lib) - return - args - { argHideModules = (mempty, otherModules (libBuildInfo lib)) - } + let args' = + commonArgs + <> args + { argOutputDir = + Dir $ haddockLibraryDirPath haddockTarget pkg_descr lib + , argInterfaceFile = Flag $ haddockLibraryPath pkg_descr lib + } + args'' = + args' + { argHideModules = (mempty, otherModules (libBuildInfo lib)) + , argTitle = Flag $ haddockPackageLibraryName pkg_descr lib + , argComponentName = toFlag (haddockPackageLibraryName' (pkgName (package pkg_descr)) (libName lib)) + , -- we need to accommodate for `argOutputDir`, see `haddockLibraryPath` + argBaseUrl = case (libName lib, argBaseUrl args') of + (LSubLibName _, Flag url) -> Flag $ ".." url + (_, a) -> a + , argContents = case (libName lib, argContents args') of + (LSubLibName _, Flag url) -> Flag $ ".." url + (_, a) -> a + , argIndex = case (libName lib, argIndex args') of + (LSubLibName _, Flag url) -> Flag $ ".." url + (_, a) -> a + } + return args'' fromExecutable :: Verbosity - -> SymbolicPath Pkg (Path.Dir Tmp) + -> (SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts)) + -- ^ Directories for -hidir, -odir, and -stubdir to GHC through Haddock. + -- See Note [Hi Haddock Recompilation Avoidance] -> LocalBuildInfo -> ComponentLocalBuildInfo -> Maybe PathTemplate -- ^ template for HTML location - -> Version + -> HaddockTarget + -> PackageDescription -> Executable + -> HaddockArgs + -- ^ common args -> IO HaddockArgs -fromExecutable verbosity tmp lbi clbi htmlTemplate haddockVersion exe = do +fromExecutable verbosity haddockArtifactsDirs lbi clbi htmlTemplate haddockTarget pkg_descr exe commonArgs = do inFiles <- map snd `fmap` getExeSourceFiles verbosity lbi exe clbi args <- mkHaddockArgs verbosity - tmp + haddockArtifactsDirs lbi clbi htmlTemplate - haddockVersion inFiles (buildInfo exe) + let args' = + commonArgs + <> args + { argOutputDir = + Dir $ + haddockDirName haddockTarget pkg_descr + unUnqualComponentName (exeName exe) + } + return + args' + { argTitle = Flag $ unUnqualComponentName $ exeName exe + , -- we need to accommodate `argOutputDir` + argBaseUrl = case argBaseUrl args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + , argContents = case argContents args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + , argIndex = case argIndex args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + } + +fromTest + :: Verbosity + -> (SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts)) + -- ^ Directories for -hidir, -odir, and -stubdir to GHC through Haddock. + -- See Note [Hi Haddock Recompilation Avoidance] + -> LocalBuildInfo + -> ComponentLocalBuildInfo + -> Maybe PathTemplate + -- ^ template for HTML location + -> HaddockTarget + -> PackageDescription + -> TestSuite + -> HaddockArgs + -- ^ common args + -> IO HaddockArgs +fromTest verbosity haddockArtifactsDirs lbi clbi htmlTemplate haddockTarget pkg_descr test commonArgs = do + inFiles <- map snd `fmap` getTestSourceFiles verbosity lbi test clbi + args <- + mkHaddockArgs + verbosity + haddockArtifactsDirs + lbi + clbi + htmlTemplate + inFiles + (testBuildInfo test) + let args' = + commonArgs + <> args + { argOutputDir = + Dir $ + haddockDirName haddockTarget pkg_descr + unUnqualComponentName (testName test) + } return - args - { argOutputDir = Dir $ unUnqualComponentName $ exeName exe - , argTitle = Flag $ unUnqualComponentName $ exeName exe + args' + { argTitle = Flag $ prettyShow (packageName pkg_descr) + , argComponentName = Flag $ prettyShow (packageName pkg_descr) ++ ":" ++ unUnqualComponentName (testName test) + , -- we need to accommodate `argOutputDir` + argBaseUrl = case argBaseUrl args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + , argContents = case argContents args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + , argIndex = case argIndex args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + } + +fromBenchmark + :: Verbosity + -> (SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts)) + -- ^ Directories for -hidir, -odir, and -stubdir to GHC through Haddock. + -- See Note [Hi Haddock Recompilation Avoidance] + -> LocalBuildInfo + -> ComponentLocalBuildInfo + -> Maybe PathTemplate + -- ^ template for HTML location + -> HaddockTarget + -> PackageDescription + -> Benchmark + -> HaddockArgs + -- ^ common args + -> IO HaddockArgs +fromBenchmark verbosity haddockArtifactsDirs lbi clbi htmlTemplate haddockTarget pkg_descr bench commonArgs = do + inFiles <- map snd `fmap` getBenchmarkSourceFiles verbosity lbi bench clbi + args <- + mkHaddockArgs + verbosity + haddockArtifactsDirs + lbi + clbi + htmlTemplate + inFiles + (benchmarkBuildInfo bench) + let args' = + commonArgs + <> args + { argOutputDir = + Dir $ + haddockDirName haddockTarget pkg_descr + unUnqualComponentName (benchmarkName bench) + } + return + args' + { argTitle = Flag $ prettyShow (packageName pkg_descr) + , argComponentName = Flag $ prettyShow (packageName pkg_descr) ++ ":" ++ unUnqualComponentName (benchmarkName bench) + , -- we need to accommodate `argOutputDir` + argBaseUrl = case argBaseUrl args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + , argContents = case argContents args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + , argIndex = case argIndex args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag } fromForeignLib :: Verbosity - -> SymbolicPath Pkg (Path.Dir Tmp) + -> (SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts)) + -- ^ Directories for -hidir, -odir, and -stubdir to GHC through Haddock. + -- See Note [Hi Haddock Recompilation Avoidance] -> LocalBuildInfo -> ComponentLocalBuildInfo -> Maybe PathTemplate -- ^ template for HTML location - -> Version + -> HaddockTarget + -> PackageDescription -> ForeignLib + -> HaddockArgs + -- ^ common args -> IO HaddockArgs -fromForeignLib verbosity tmp lbi clbi htmlTemplate haddockVersion flib = do +fromForeignLib verbosity haddockArtifactsDirs lbi clbi htmlTemplate haddockTarget pkg_descr flib commonArgs = do inFiles <- map snd `fmap` getFLibSourceFiles verbosity lbi flib clbi args <- mkHaddockArgs verbosity - tmp + haddockArtifactsDirs lbi clbi htmlTemplate - haddockVersion inFiles (foreignLibBuildInfo flib) + let args' = + commonArgs + <> args + { argOutputDir = + Dir $ + haddockDirName haddockTarget pkg_descr + unUnqualComponentName (foreignLibName flib) + } return - args - { argOutputDir = Dir $ unUnqualComponentName $ foreignLibName flib - , argTitle = Flag $ unUnqualComponentName $ foreignLibName flib + args' + { argTitle = Flag $ unUnqualComponentName $ foreignLibName flib + , -- we need to accommodate `argOutputDir` + argBaseUrl = case argBaseUrl args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + , argContents = case argContents args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag + , argIndex = case argIndex args' of + Flag url -> Flag $ ".." url + NoFlag -> NoFlag } compToExe :: Component -> Maybe Executable @@ -767,28 +1028,6 @@ getReexports LibComponentLocalBuildInfo{componentExposedModules = mods} = mapMaybe exposedReexport mods getReexports _ = [] -getGhcCppOpts - :: Version - -> BuildInfo - -> GhcOptions -getGhcCppOpts haddockVersion bi = - mempty - { ghcOptExtensions = toNubListR [EnableExtension CPP | needsCpp] - , ghcOptCppOptions = defines - } - where - needsCpp = EnableExtension CPP `elem` usedExtensions bi - defines = [haddockVersionMacro] - haddockVersionMacro = - "-D__HADDOCK_VERSION__=" - ++ show (v1 * 1000 + v2 * 10 + v3) - where - (v1, v2, v3) = case versionNumbers haddockVersion of - [] -> (0, 0, 0) - [x] -> (x, 0, 0) - [x, y] -> (x, y, 0) - (x : y : z : _) -> (x, y, z) - getGhcLibDir :: Verbosity -> LocalBuildInfo @@ -800,6 +1039,47 @@ getGhcLibDir verbosity lbi = do _ -> error "haddock only supports GHC and GHCJS" return $ mempty{argGhcLibDir = Flag l} +-- | If Hi Haddock is supported, this function creates temporary directories +-- and copies existing interface and object files produced by GHC into them, +-- then passes them off to the given continuation. +-- +-- If Hi Haddock is _not_ supported, we can't re-use GHC's compilation files. +-- Instead, we use a clean temporary directory to the continuation, +-- with no hope for recompilation avoidance. +-- +-- See Note [Hi Haddock Recompilation Avoidance] +reusingGHCCompilationArtifacts + :: Verbosity + -> TempFileOptions + -> Maybe (SymbolicPath CWD (Path.Dir Pkg)) + -- ^ Working directory + -> LocalBuildInfo + -> BuildInfo + -> ComponentLocalBuildInfo + -> Version + -- ^ Haddock's version + -> ((SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts), SymbolicPath Pkg (Path.Dir Artifacts)) -> IO r) + -- ^ Continuation + -> IO r +reusingGHCCompilationArtifacts verbosity tmpFileOpts mbWorkDir lbi bi clbi version act + | version >= mkVersion [2, 28, 0] = do + withTempDirectoryCwdEx verbosity tmpFileOpts mbWorkDir (distPrefLBI lbi) "haddock-objs" $ \tmpObjDir -> + withTempDirectoryCwdEx verbosity tmpFileOpts mbWorkDir (distPrefLBI lbi) "haddock-his" $ \tmpHiDir -> do + -- Re-use ghc's interface and obj files, but first copy them to + -- somewhere where it is safe if haddock overwrites them + let + vanillaOpts = componentGhcOptions normal lbi bi clbi (buildDir lbi) + i = interpretSymbolicPath mbWorkDir + copyDir ghcDir tmpDir = copyDirectoryRecursive verbosity (i $ fromFlag $ ghcDir vanillaOpts) (i tmpDir) + copyDir ghcOptObjDir tmpObjDir + copyDir ghcOptHiDir tmpHiDir + -- copyDir ghcOptStubDir tmpStubDir -- (see W.1 in Note [Hi Haddock Recompilation Avoidance]) + + act (tmpObjDir, tmpHiDir, fromFlag $ ghcOptHiDir vanillaOpts) + | otherwise = do + withTempDirectoryCwdEx verbosity tmpFileOpts mbWorkDir (distPrefLBI lbi) "tmp" $ + \tmpFallback -> act (tmpFallback, tmpFallback, tmpFallback) + -- ------------------------------------------------------------------------------ -- | Call haddock with the specified arguments. @@ -851,27 +1131,23 @@ renderArgs verbosity mbWorkDir tmpFileOpts version comp platform args k = do withResponseFile verbosity tmpFileOpts - mbWorkDir - outputDir "haddock-response.txt" (if haddockSupportsUTF8 then Just utf8 else Nothing) renderedArgs (\responseFileName -> k ["@" ++ responseFileName] result) else k renderedArgs result - case argPrologue args of - Flag prologueText -> - withTempFileEx tmpFileOpts mbWorkDir outputDir "haddock-prologue.txt" $ + case (argPrologueFile args, argPrologue args) of + (Flag pfile, _) -> + withPrologueArgs ["--prologue=" ++ pfile] + (_, Flag prologueText) -> + withTempFileEx tmpFileOpts "haddock-prologue.txt" $ \prologueFileName h -> do when haddockSupportsUTF8 (hSetEncoding h utf8) hPutStrLn h prologueText hClose h withPrologueArgs ["--prologue=" ++ u prologueFileName] - _ -> - withPrologueArgs - ( case argPrologueFile args of - Flag pfile -> ["--prologue=" ++ pfile] - _ -> [] - ) + (NoFlag, NoFlag) -> + withPrologueArgs [] where -- See Note [Symbolic paths] in Distribution.Utils.Path i = interpretSymbolicPath mbWorkDir @@ -920,7 +1196,10 @@ renderPureArgs version comp platform args = maybe [] ( \pkg -> - [ "--package-name=" ++ prettyShow (pkgName pkg) + [ "--package-name=" + ++ case argComponentName args of + Flag name -> name + _ -> prettyShow (pkgName pkg) , "--package-version=" ++ prettyShow (pkgVersion pkg) ] ) @@ -932,10 +1211,10 @@ renderPureArgs version comp platform args = , [ "--quickjump" | isVersion 2 19, True <- flagToList . argQuickJump $ args ] , ["--hyperlinked-source" | isHyperlinkedSource] - , (\(All b, xs) -> bool (map (("--hide=" ++) . prettyShow) xs) [] b) + , (\(All b, xs) -> bool [] (map (("--hide=" ++) . prettyShow) xs) b) . argHideModules $ args - , bool ["--ignore-all-exports"] [] . getAny . argIgnoreExports $ args + , bool [] ["--ignore-all-exports"] . getAny . argIgnoreExports $ args , -- Haddock's --source-* options are ignored once --hyperlinked-source is -- set. -- See https://haskell-haddock.readthedocs.io/en/latest/invoking.html#cmdoption-hyperlinked-source @@ -959,11 +1238,11 @@ renderPureArgs version comp platform args = $ args , maybe [] ((: []) . ("--css=" ++)) . flagToMaybe . argCssFile $ args , maybe [] ((: []) . ("--use-contents=" ++)) . flagToMaybe . argContents $ args - , bool ["--gen-contents"] [] . fromFlagOrDefault False . argGenContents $ args + , bool [] ["--gen-contents"] . fromFlagOrDefault False . argGenContents $ args , maybe [] ((: []) . ("--use-index=" ++)) . flagToMaybe . argIndex $ args - , bool ["--gen-index"] [] . fromFlagOrDefault False . argGenIndex $ args + , bool [] ["--gen-index"] . fromFlagOrDefault False . argGenIndex $ args , maybe [] ((: []) . ("--base-url=" ++)) . flagToMaybe . argBaseUrl $ args - , bool [] [verbosityFlag] . getAny . argVerbose $ args + , bool [verbosityFlag] [] . getAny . argVerbose $ args , map (\o -> case o of Hoogle -> "--hoogle"; Html -> "--html") . fromFlagOrDefault [] . argOutput @@ -975,8 +1254,8 @@ renderPureArgs version comp platform args = ( (: []) . ("--title=" ++) . ( bool - (++ " (internal documentation)") id + (++ " (internal documentation)") (getAny $ argIgnoreExports args) ) ) @@ -993,7 +1272,12 @@ renderPureArgs version comp platform args = , isVersion 2 19 ] , argTargets $ args - , maybe [] ((: []) . ("--lib=" ++)) . flagToMaybe . argLib $ args + , maybe [] ((: []) . (resourcesDirFlag ++)) . flagToMaybe . argResourcesDir $ args + , -- Do not re-direct compilation output to a temporary directory (--no-tmp-comp-dir) + -- We pass this option by default to haddock to avoid recompilation + -- See Note [Hi Haddock Recompilation Avoidance] + ["--no-tmp-comp-dir" | version >= mkVersion [2, 28, 0]] + , bool [] ["--use-unicode"] . fromFlagOrDefault False . argUseUnicode $ args ] where -- See Note [Symbolic paths] in Distribution.Utils.Path @@ -1032,11 +1316,13 @@ renderPureArgs version comp platform args = ] ) - bool a b c = if c then a else b isVersion major minor = version >= mkVersion [major, minor] verbosityFlag | isVersion 2 5 = "--verbosity=1" | otherwise = "--verbose" + resourcesDirFlag + | isVersion 2 29 = "--resources-dir=" + | otherwise = "--lib=" haddockSupportsVisibility = version >= mkVersion [2, 26, 1] haddockSupportsPackageName = version > mkVersion [2, 16] haddockSupportsHyperlinkedSource = isVersion 2 17 @@ -1068,7 +1354,8 @@ haddockPackagePaths ipkgs mkHtmlPath = do interfaces <- sequenceA [ case interfaceAndHtmlPath ipkg of - Nothing -> return (Left (packageId ipkg)) + Nothing -> do + return (Left (packageId ipkg)) Just (interface, html) -> do (html', hypsrc') <- case html of @@ -1309,7 +1596,8 @@ hscolour' where outFile m = i outputDir - intercalate "-" (ModuleName.components m) <.> "html" + intercalate "-" (ModuleName.components m) + <.> "html" haddockToHscolour :: HaddockFlags -> HscolourFlags haddockToHscolour flags = diff --git a/Cabal/src/Distribution/Simple/HaskellSuite.hs b/Cabal/src/Distribution/Simple/HaskellSuite.hs index d3f43f65904..0e66e17e3d7 100644 --- a/Cabal/src/Distribution/Simple/HaskellSuite.hs +++ b/Cabal/src/Distribution/Simple/HaskellSuite.hs @@ -23,6 +23,7 @@ import Distribution.Simple.Program import Distribution.Simple.Program.Builtin import Distribution.Simple.Utils import Distribution.System (Platform) +import Distribution.Utils.Path import Distribution.Verbosity import Distribution.Version import Language.Haskell.Extension @@ -129,7 +130,8 @@ getLanguages verbosity prog = do -- if we need something like that as well. getInstalledPackages :: Verbosity - -> PackageDBStack + -- Not migrated to work with --working-dir but this is legacy dead code + -> PackageDBStackX (SymbolicPath from (Dir PkgDB)) -> ProgramDb -> IO InstalledPackageIndex getInstalledPackages verbosity packagedbs progdb = @@ -179,23 +181,23 @@ buildLib verbosity pkg_descr lbi lib clbi = do let odir = buildDir lbi bi = libBuildInfo lib - srcDirs = map i (hsSourceDirs bi) ++ [i odir] + srcDirs = map u (hsSourceDirs bi) ++ [u odir] dbStack = withPackageDB lbi language = fromMaybe Haskell98 (defaultLanguage bi) progdb = withPrograms lbi pkgid = packageId pkg_descr - i = interpretSymbolicPathLBI lbi -- See Note [Symbolic paths] in Distribution.Utils.Path - runDbProgram verbosity haskellSuiteProgram progdb $ - ["compile", "--build-dir", i odir] + u = interpretSymbolicPathCWD -- See Note [Symbolic paths] in Distribution.Utils.Path + runDbProgramCwd verbosity (mbWorkDirLBI lbi) haskellSuiteProgram progdb $ + ["compile", "--build-dir", u odir] ++ concat [["-i", d] | d <- srcDirs] ++ concat [ ["-I", d] | d <- - [ i $ autogenComponentModulesDir lbi clbi - , i $ autogenPackageModulesDir lbi - , i odir + [ u $ autogenComponentModulesDir lbi clbi + , u $ autogenPackageModulesDir lbi + , u odir ] - ++ map i (includeDirs bi) + ++ map u (includeDirs bi) ] ++ [packageDbOpt pkgDb | pkgDb <- dbStack] ++ ["--package-name", prettyShow pkgid] @@ -223,7 +225,8 @@ installLib -> IO () installLib verbosity lbi targetDir dynlibTargetDir builtDir pkg lib clbi = do let progdb = withPrograms lbi - runDbProgram verbosity haskellSuitePkgProgram progdb $ + wdir = mbWorkDirLBI lbi + runDbProgramCwd verbosity wdir haskellSuitePkgProgram progdb $ [ "install-library" , "--build-dir" , builtDir @@ -239,7 +242,7 @@ installLib verbosity lbi targetDir dynlibTargetDir builtDir pkg lib clbi = do registerPackage :: Verbosity -> ProgramDb - -> PackageDBStack + -> PackageDBStackS from -> InstalledPackageInfo -> IO () registerPackage verbosity progdb packageDbs installedPkgInfo = do @@ -261,7 +264,7 @@ initPackageDB verbosity progdb dbPath = progdb ["init", dbPath] -packageDbOpt :: PackageDB -> String +packageDbOpt :: PackageDBX (SymbolicPath from (Dir PkgDB)) -> String packageDbOpt GlobalPackageDB = "--global" packageDbOpt UserPackageDB = "--user" -packageDbOpt (SpecificPackageDB db) = "--package-db=" ++ db +packageDbOpt (SpecificPackageDB db) = "--package-db=" ++ interpretSymbolicPathCWD db diff --git a/Cabal/src/Distribution/Simple/Hpc.hs b/Cabal/src/Distribution/Simple/Hpc.hs index ea1c1368057..4198d7a66ba 100644 --- a/Cabal/src/Distribution/Simple/Hpc.hs +++ b/Cabal/src/Distribution/Simple/Hpc.hs @@ -58,7 +58,7 @@ import System.Directory (createDirectoryIfMissing, doesFileExist) -- ------------------------------------------------------------------------- -- Haskell Program Coverage -data Way = Vanilla | Prof | Dyn +data Way = Vanilla | Prof | Dyn | ProfDyn deriving (Bounded, Enum, Eq, Read, Show) hpcDir @@ -73,6 +73,7 @@ hpcDir distPref way = distPref makeRelativePathEx ("hpc" wayDir) Vanilla -> "vanilla" Prof -> "prof" Dyn -> "dyn" + ProfDyn -> "prof_dyn" mixDir :: SymbolicPath Pkg (Dir Dist) diff --git a/Cabal/src/Distribution/Simple/Install.hs b/Cabal/src/Distribution/Simple/Install.hs index c46f28b3529..435d3fbbebc 100644 --- a/Cabal/src/Distribution/Simple/Install.hs +++ b/Cabal/src/Distribution/Simple/Install.hs @@ -38,7 +38,7 @@ import Distribution.Types.UnqualComponentName import Distribution.Package import Distribution.PackageDescription -import Distribution.Simple.BuildPaths (haddockName, haddockPref) +import Distribution.Simple.BuildPaths (haddockPath, haddockPref) import Distribution.Simple.BuildTarget import Distribution.Simple.Compiler ( CompilerFlavor (..) @@ -199,8 +199,8 @@ copyPackage verbosity pkg_descr lbi distPref copydest = do -- copy in htmlPref first. let haddockInterfaceFileSrc = haddockPref ForDevelopment distPref pkg_descr - makeRelativePathEx (haddockName pkg_descr) - haddockInterfaceFileDest = interfacePref haddockName pkg_descr + makeRelativePathEx (haddockPath pkg_descr) + haddockInterfaceFileDest = interfacePref haddockPath pkg_descr -- We only generate the haddock interface file for libs, So if the -- package consists only of executables there will not be one: exists <- doesFileExist $ i haddockInterfaceFileSrc diff --git a/Cabal/src/Distribution/Simple/InstallDirs.hs b/Cabal/src/Distribution/Simple/InstallDirs.hs index b478aefe511..86e6fa08777 100644 --- a/Cabal/src/Distribution/Simple/InstallDirs.hs +++ b/Cabal/src/Distribution/Simple/InstallDirs.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} @@ -101,7 +100,7 @@ data InstallDirs dir = InstallDirs , haddockdir :: dir , sysconfdir :: dir } - deriving (Eq, Read, Show, Functor, Generic, Typeable) + deriving (Eq, Read, Show, Functor, Generic) instance Binary dir => Binary (InstallDirs dir) instance Structured dir => Structured (InstallDirs dir) @@ -389,7 +388,7 @@ prefixRelativeInstallDirs pkgId libname compilerId platform dirs = -- | An abstract path, possibly containing variables that need to be -- substituted for to get a real 'FilePath'. newtype PathTemplate = PathTemplate [PathComponent] - deriving (Eq, Ord, Generic, Typeable) + deriving (Eq, Ord, Generic) instance Binary PathTemplate instance Structured PathTemplate diff --git a/Cabal/src/Distribution/Simple/InstallDirs/Internal.hs b/Cabal/src/Distribution/Simple/InstallDirs/Internal.hs index 9c411b7dcc1..a65c706af20 100644 --- a/Cabal/src/Distribution/Simple/InstallDirs/Internal.hs +++ b/Cabal/src/Distribution/Simple/InstallDirs/Internal.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Simple.InstallDirs.Internal @@ -12,7 +11,7 @@ import Prelude () data PathComponent = Ordinary FilePath | Variable PathTemplateVariable - deriving (Eq, Ord, Generic, Typeable) + deriving (Eq, Ord, Generic) instance Binary PathComponent instance Structured PathComponent @@ -65,7 +64,7 @@ data PathTemplateVariable TestSuiteResultVar | -- | The name of the benchmark being run BenchmarkNameVar - deriving (Eq, Ord, Generic, Typeable) + deriving (Eq, Ord, Generic) instance Binary PathTemplateVariable instance Structured PathTemplateVariable diff --git a/Cabal/src/Distribution/Simple/LocalBuildInfo.hs b/Cabal/src/Distribution/Simple/LocalBuildInfo.hs index 35681ee5908..ccd3765f9d3 100644 --- a/Cabal/src/Distribution/Simple/LocalBuildInfo.hs +++ b/Cabal/src/Distribution/Simple/LocalBuildInfo.hs @@ -1,8 +1,6 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} ----------------------------------------------------------------------------- @@ -36,6 +34,7 @@ module Distribution.Simple.LocalBuildInfo , interpretSymbolicPathLBI , mbWorkDirLBI , absoluteWorkingDirLBI + , buildWays -- * Buildable package components , Component (..) @@ -161,7 +160,7 @@ mbWorkDirLBI = flagToMaybe . setupWorkingDir . configCommonFlags . configFlags -- | Absolute path to the current working directory. -absoluteWorkingDirLBI :: LocalBuildInfo -> IO FilePath +absoluteWorkingDirLBI :: LocalBuildInfo -> IO (AbsolutePath (Dir Pkg)) absoluteWorkingDirLBI lbi = absoluteWorkingDir (mbWorkDirLBI lbi) -- | Perform the action on each enabled 'library' in the package diff --git a/Cabal/src/Distribution/Simple/PackageIndex.hs b/Cabal/src/Distribution/Simple/PackageIndex.hs index 927e10ae878..a7d23962b72 100644 --- a/Cabal/src/Distribution/Simple/PackageIndex.hs +++ b/Cabal/src/Distribution/Simple/PackageIndex.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} @@ -68,6 +67,7 @@ module Distribution.Simple.PackageIndex , lookupSourcePackageId , lookupPackageId , lookupPackageName + , lookupInternalPackageName , lookupDependency , lookupInternalDependency @@ -93,6 +93,10 @@ module Distribution.Simple.PackageIndex , dependencyCycles , dependencyGraph , moduleNameIndex + + -- ** Filters on lookup results + , eligibleDependencies + , matchingDependencies ) where import qualified Data.Map.Strict as Map @@ -142,7 +146,7 @@ data PackageIndex a = PackageIndex -- preserved. See #1463 for discussion. packageIdIndex :: !(Map (PackageName, LibraryName) (Map Version [a])) } - deriving (Eq, Generic, Show, Read, Typeable) + deriving (Eq, Generic, Show, Read) instance Binary a => Binary (PackageIndex a) instance Structured a => Structured (PackageIndex a) @@ -474,7 +478,18 @@ lookupPackageName -> [(Version, [a])] lookupPackageName index name = -- Do not match internal libraries - case Map.lookup (name, LMainLibName) (packageIdIndex index) of + lookupInternalPackageName index name LMainLibName + +-- | Does a lookup by source package name and library name. +-- +-- Also looks up internal packages. +lookupInternalPackageName + :: PackageIndex a + -> PackageName + -> LibraryName + -> [(Version, [a])] +lookupInternalPackageName index name library = + case Map.lookup (name, library) (packageIdIndex index) of Nothing -> [] Just pvers -> Map.toList pvers @@ -509,23 +524,46 @@ lookupInternalDependency -> LibraryName -> [(Version, [IPI.InstalledPackageInfo])] lookupInternalDependency index name versionRange libn = - case Map.lookup (name, libn) (packageIdIndex index) of - Nothing -> [] - Just pvers -> - [ (ver, pkgs') - | (ver, pkgs) <- Map.toList pvers - , ver `withinRange` versionRange - , let pkgs' = filter eligible pkgs - , -- Enforce the invariant - not (null pkgs') - ] + matchingDependencies versionRange $ + lookupInternalPackageName index name libn + +-- | Filter a set of installed packages to ones eligible as dependencies. +-- +-- When we select for dependencies, we ONLY want to pick up indefinite +-- packages, or packages with no instantiations. We'll do mix-in linking to +-- improve any such package into an instantiated one later. +-- +-- INVARIANT: List of eligible 'IPI.InstalledPackageInfo' is non-empty. +eligibleDependencies + :: [(Version, [IPI.InstalledPackageInfo])] + -> [(Version, [IPI.InstalledPackageInfo])] +eligibleDependencies versions = + [ (ver, pkgs') + | (ver, pkgs) <- versions + , let pkgs' = filter eligible pkgs + , -- Enforce the invariant + not (null pkgs') + ] where - -- When we select for dependencies, we ONLY want to pick up indefinite - -- packages, or packages with no instantiations. We'll do mix-in - -- linking to improve any such package into an instantiated one - -- later. eligible pkg = IPI.indefinite pkg || null (IPI.instantiatedWith pkg) +-- | Get eligible dependencies from a list of versions. +-- +-- This can be used to filter the output of 'lookupPackageName' or +-- 'lookupInternalPackageName'. +-- +-- INVARIANT: List of eligible 'IPI.InstalledPackageInfo' is non-empty. +matchingDependencies + :: VersionRange + -> [(Version, [IPI.InstalledPackageInfo])] + -> [(Version, [IPI.InstalledPackageInfo])] +matchingDependencies versionRange versions = + let eligibleVersions = eligibleDependencies versions + in [ (ver, pkgs) + | (ver, pkgs) <- eligibleVersions + , ver `withinRange` versionRange + ] + -- -- * Case insensitive name lookups diff --git a/Cabal/src/Distribution/Simple/PreProcess.hs b/Cabal/src/Distribution/Simple/PreProcess.hs index 00e6e68cb5c..9675d431b9c 100644 --- a/Cabal/src/Distribution/Simple/PreProcess.hs +++ b/Cabal/src/Distribution/Simple/PreProcess.hs @@ -1,7 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TypeApplications #-} ----------------------------------------------------------------------------- @@ -347,8 +346,8 @@ preprocessFile mbWorkDir searchLoc buildLoc forSDist baseFile verbosity builtinS createDirectoryIfMissingVerbose verbosity True destDir runPreProcessorWithHsBootHack pp - (i psrcLoc, getSymbolicPath $ psrcRelFile) - (i buildLoc, srcStem <.> "hs") + (getSymbolicPath $ psrcLoc, getSymbolicPath $ psrcRelFile) + (getSymbolicPath $ buildLoc, srcStem <.> "hs") where i = interpretSymbolicPath mbWorkDir -- See Note [Symbolic paths] in Distribution.Utils.Path buildAsSrcLoc :: SymbolicPath Pkg (Dir Source) @@ -390,8 +389,9 @@ ppGreenCard _ lbi _ = { platformIndependent = False , ppOrdering = unsorted , runPreProcessor = mkSimplePreProcessor $ \inFile outFile verbosity -> - runDbProgram + runDbProgramCwd verbosity + (mbWorkDirLBI lbi) greencardProgram (withPrograms lbi) (["-tffi", "-o" ++ outFile, inFile]) @@ -510,8 +510,6 @@ ppHsc2hs bi lbi clbi = withResponseFile verbosity defaultTempFileOptions - mbWorkDir - (makeSymbolicPath $ takeDirectory outFile) "hsc2hs-response.txt" Nothing pureArgs @@ -863,8 +861,9 @@ standardPP lbi prog args = { platformIndependent = False , ppOrdering = unsorted , runPreProcessor = mkSimplePreProcessor $ \inFile outFile verbosity -> - runDbProgram + runDbProgramCwd verbosity + (mbWorkDirLBI lbi) prog (withPrograms lbi) (args ++ ["-o", outFile, inFile]) diff --git a/Cabal/src/Distribution/Simple/PreProcess/Types.hs b/Cabal/src/Distribution/Simple/PreProcess/Types.hs index 5b865349e78..85e35dc2b57 100644 --- a/Cabal/src/Distribution/Simple/PreProcess/Types.hs +++ b/Cabal/src/Distribution/Simple/PreProcess/Types.hs @@ -44,11 +44,12 @@ import qualified Text.PrettyPrint as Disp -- > ppTestHandler = -- > PreProcessor { -- > platformIndependent = True, +-- > ppOrdering = \_ _ -> return, -- > runPreProcessor = mkSimplePreProcessor $ \inFile outFile verbosity -> -- > do info verbosity (inFile++" has been preprocessed to "++outFile) -- > stuff <- readFile inFile -- > writeFile outFile ("-- preprocessed as a test\n\n" ++ stuff) --- > return ExitSuccess +-- > return () -- -- We split the input and output file names into a base directory and the -- rest of the file name. The input base dir is the path in the list of search diff --git a/Cabal/src/Distribution/Simple/Program.hs b/Cabal/src/Distribution/Simple/Program.hs index f5a609f3b7e..e81501d2c39 100644 --- a/Cabal/src/Distribution/Simple/Program.hs +++ b/Cabal/src/Distribution/Simple/Program.hs @@ -1,3 +1,10 @@ +{- FUTUREWORK: + - + - Currently the logic in this module is not tested. + - + - Ideally, a set of unit tests that check whether certain + - flags trigger recompilation should be added. + - -} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} diff --git a/Cabal/src/Distribution/Simple/Program/Ar.hs b/Cabal/src/Distribution/Simple/Program/Ar.hs index 004b02cca1a..2e9b432385f 100644 --- a/Cabal/src/Distribution/Simple/Program/Ar.hs +++ b/Cabal/src/Distribution/Simple/Program/Ar.hs @@ -154,7 +154,7 @@ createArLibArchive verbosity lbi targetPath files = do (initial, middle, final) (map getSymbolicPath files) ] - else withResponseFile verbosity defaultTempFileOptions mbWorkDir tmpDir "ar.rsp" Nothing (map getSymbolicPath files) $ + else withResponseFile verbosity defaultTempFileOptions "ar.rsp" Nothing (map getSymbolicPath files) $ \path -> runProgramInvocation verbosity $ invokeWithResponseFile path unless diff --git a/Cabal/src/Distribution/Simple/Program/Builtin.hs b/Cabal/src/Distribution/Simple/Program/Builtin.hs index e79e676d8cc..65501111a7e 100644 --- a/Cabal/src/Distribution/Simple/Program/Builtin.hs +++ b/Cabal/src/Distribution/Simple/Program/Builtin.hs @@ -226,21 +226,13 @@ hpcProgram = -- during the configure phase. haskellSuiteProgram :: Program haskellSuiteProgram = - (simpleProgram "haskell-suite") - { -- pretend that the program exists, otherwise it won't be in the - -- "configured" state - programFindLocation = \_verbosity _searchPath -> - return $ Just ("haskell-suite-dummy-location", []) - } + simpleProgram "haskell-suite" -- This represent a haskell-suite package manager. See the comments for -- haskellSuiteProgram. haskellSuitePkgProgram :: Program haskellSuitePkgProgram = - (simpleProgram "haskell-suite-pkg") - { programFindLocation = \_verbosity _searchPath -> - return $ Just ("haskell-suite-pkg-dummy-location", []) - } + simpleProgram "haskell-suite-pkg" happyProgram :: Program happyProgram = diff --git a/Cabal/src/Distribution/Simple/Program/Db.hs b/Cabal/src/Distribution/Simple/Program/Db.hs index a9aefa7d649..c76b38e9923 100644 --- a/Cabal/src/Distribution/Simple/Program/Db.hs +++ b/Cabal/src/Distribution/Simple/Program/Db.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} @@ -106,7 +105,6 @@ data ProgramDb = ProgramDb , progOverrideEnv :: [(String, Maybe String)] , configuredProgs :: ConfiguredProgs } - deriving (Typeable) type UnconfiguredProgram = (Program, Maybe FilePath, [ProgArg]) type UnconfiguredProgs = Map.Map String UnconfiguredProgram diff --git a/Cabal/src/Distribution/Simple/Program/Find.hs b/Cabal/src/Distribution/Simple/Program/Find.hs index 446382e0e52..323f71631be 100644 --- a/Cabal/src/Distribution/Simple/Program/Find.hs +++ b/Cabal/src/Distribution/Simple/Program/Find.hs @@ -1,6 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} diff --git a/Cabal/src/Distribution/Simple/Program/GHC.hs b/Cabal/src/Distribution/Simple/Program/GHC.hs index 84d6b0ccfaa..8613653cba6 100644 --- a/Cabal/src/Distribution/Simple/Program/GHC.hs +++ b/Cabal/src/Distribution/Simple/Program/GHC.hs @@ -1,10 +1,10 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE MultiWayIf #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} module Distribution.Simple.Program.GHC ( GhcOptions (..) @@ -15,6 +15,7 @@ module Distribution.Simple.Program.GHC , ghcInvocation , renderGhcOptions , runGHC + , runGHCWithResponseFile , packageDbArgsDb , normaliseGhcArgs ) where @@ -31,8 +32,10 @@ import Distribution.Simple.Compiler import Distribution.Simple.Flag import Distribution.Simple.GHC.ImplInfo import Distribution.Simple.Program.Find (getExtraPathEnv) +import Distribution.Simple.Program.ResponseFile import Distribution.Simple.Program.Run import Distribution.Simple.Program.Types +import Distribution.Simple.Utils (TempFileOptions, infoNoWrap) import Distribution.System import Distribution.Types.ComponentId import Distribution.Types.ParStrat @@ -41,17 +44,19 @@ import Distribution.Utils.Path import Distribution.Verbosity import Distribution.Version +import GHC.IO.Encoding (TextEncoding) import Language.Haskell.Extension import Data.List (stripPrefix) import qualified Data.Map as Map import Data.Monoid (All (..), Any (..), Endo (..)) import qualified Data.Set as Set +import qualified System.Process as Process normaliseGhcArgs :: Maybe Version -> PackageDescription -> [String] -> [String] normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs | ghcVersion `withinRange` supportedGHCVersions = - argumentFilters . filter simpleFilters . filterRtsOpts $ ghcArgs + argumentFilters . filter simpleFilters . filterRtsArgs $ ghcArgs where supportedGHCVersions :: VersionRange supportedGHCVersions = orLaterVersion (mkVersion [8, 0]) @@ -161,18 +166,9 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs flagArgumentFilter ["-ghci-script", "-H", "-interactive-print"] - filterRtsOpts :: [String] -> [String] - filterRtsOpts = go False - where - go :: Bool -> [String] -> [String] - go _ [] = [] - go _ ("+RTS" : opts) = go True opts - go _ ("-RTS" : opts) = go False opts - go isRTSopts (opt : opts) = addOpt $ go isRTSopts opts - where - addOpt - | isRTSopts = id - | otherwise = (opt :) + -- \| Remove RTS arguments from a list. + filterRtsArgs :: [String] -> [String] + filterRtsArgs = snd . splitRTSArgs simpleFilters :: String -> Bool simpleFilters = @@ -227,8 +223,27 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs , "keep-going" -- try harder, the build will still fail if it's erroneous , "print-axiom-incomps" -- print more debug info for closed type families ] + , from + [9, 2] + [ "family-application-cache" + ] + , from + [9, 6] + [ "print-redundant-promotion-ticks" + , "show-error-context" + ] + , from + [9, 8] + [ "unoptimized-core-for-interpreter" + ] + , from + [9, 10] + [ "diagnostics-as-json" + , "print-error-index-links" + , "break-points" + ] ] - , flagIn . invertibleFlagSet "-d" $ ["ppr-case-as-let", "ppr-ticks"] + , flagIn $ invertibleFlagSet "-d" ["ppr-case-as-let", "ppr-ticks"] , isOptIntFlag , isIntFlag , if safeToFilterWarnings @@ -289,6 +304,7 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs , from [8, 6] ["-dhex-word-literals"] , from [8, 8] ["-fshow-docs-of-hole-fits", "-fno-show-docs-of-hole-fits"] , from [9, 0] ["-dlinear-core-lint"] + , from [9, 10] ["-dipe-stats"] ] isOptIntFlag :: String -> Any @@ -303,9 +319,12 @@ normaliseGhcArgs (Just ghcVersion) PackageDescription{..} ghcArgs , "-ddpr-cols" , "-dtrace-level" , "-fghci-hist-size" + , "-dinitial-unique" + , "-dunique-increment" ] , from [8, 2] ["-fmax-uncovered-patterns", "-fmax-errors"] , from [8, 4] $ to [8, 6] ["-fmax-valid-substitutions"] + , from [9, 12] ["-fmax-forced-spec-args", "-fwrite-if-compression"] ] dropIntFlag :: Bool -> String -> String -> Any @@ -623,6 +642,81 @@ runGHC verbosity ghcProg comp platform mbWorkDir opts = do runProgramInvocation verbosity =<< ghcInvocation verbosity ghcProg comp platform mbWorkDir opts +runGHCWithResponseFile + :: FilePath + -> Maybe TextEncoding + -> TempFileOptions + -> Verbosity + -> ConfiguredProgram + -> Compiler + -> Platform + -> Maybe (SymbolicPath CWD (Dir Pkg)) + -> GhcOptions + -> IO () +runGHCWithResponseFile fileNameTemplate encoding tempFileOptions verbosity ghcProg comp platform maybeWorkDir opts = do + invocation <- ghcInvocation verbosity ghcProg comp platform maybeWorkDir opts + + let compilerSupportsResponseFiles = + case compilerCompatVersion GHC comp of + -- GHC 9.4 is the first version which supports response files. + Just version -> version >= mkVersion [9, 4] + Nothing -> False + + args = progInvokeArgs invocation + + -- Don't use response files if the first argument is `--interactive`, for + -- two related reasons. + -- + -- `hie-bios` relies on a hack to intercept the command-line that `Cabal` + -- supplies to `ghc`. Specifically, `hie-bios` creates a script around + -- `ghc` that detects if the first option is `--interactive` and if so then + -- instead of running `ghc` it prints the command-line that `ghc` was given + -- instead of running the command: + -- + -- https://github.com/haskell/hie-bios/blob/ce863dba7b57ded20160b4f11a487e4ff8372c08/wrappers/cabal#L7 + -- + -- … so we can't store that flag in the response file, otherwise that will + -- break. However, even if we were to add a special-case to keep that flag + -- out of the response file things would still break because `hie-bios` + -- stores the arguments to `ghc` that the wrapper script outputs and reuses + -- them later. That breaks if you use a response file because it will + -- store an argument like `@…/ghc36000-0.rsp` which is a temporary path + -- that no longer exists after the wrapper script completes. + -- + -- The work-around here is that we don't use a response file at all if the + -- first argument (and only the first argument) to `ghc` is + -- `--interactive`. This ensures that `hie-bios` and all downstream + -- utilities (e.g. `haskell-language-server`) continue working. + -- + -- + useResponseFile = + case args of + "--interactive" : _ -> False + _ -> compilerSupportsResponseFiles + + if not useResponseFile + then runProgramInvocation verbosity invocation + else do + let (rtsArgs, otherArgs) = splitRTSArgs args + + withResponseFile + verbosity + tempFileOptions + fileNameTemplate + encoding + otherArgs + $ \responseFile -> do + let newInvocation = + invocation{progInvokeArgs = ('@' : responseFile) : rtsArgs} + + infoNoWrap verbosity $ + "GHC response file arguments: " + <> case otherArgs of + [] -> "" + arg : args' -> Process.showCommandForUser arg args' + + runProgramInvocation verbosity newInvocation + ghcInvocation :: Verbosity -> ConfiguredProgram @@ -709,7 +803,10 @@ renderGhcOptions comp _platform@(Platform _arch os) opts | flagProfAuto implInfo -> ["-fprof-auto-exported"] | otherwise -> ["-auto"] , ["-split-sections" | flagBool ghcOptSplitSections] - , ["-split-objs" | flagBool ghcOptSplitObjs] + , case compilerCompatVersion GHC comp of + -- the -split-objs flag was removed in GHC 9.8 + Just ver | ver >= mkVersion [9, 8] -> [] + _ -> ["-split-objs" | flagBool ghcOptSplitObjs] , case flagToMaybe (ghcOptHPCDir opts) of Nothing -> [] Just hpcdir -> ["-fhpc", "-hpcdir", u hpcdir] @@ -799,8 +896,7 @@ renderGhcOptions comp _platform@(Platform _arch os) opts -- Packages concat - [ [ case () of - _ + [ [ if | unitIdSupported comp -> "-this-unit-id" | packageKeySupported comp -> "-this-package-key" | otherwise -> "-package-name" @@ -831,7 +927,7 @@ renderGhcOptions comp _platform@(Platform _arch os) opts , ["-hide-all-packages" | flagBool ghcOptHideAllPackages] , ["-Wmissing-home-modules" | flagBool ghcOptWarnMissingHomeModules] , ["-no-auto-link-packages" | flagBool ghcOptNoAutoLinkPackages] - , packageDbArgs implInfo (ghcOptPackageDBs opts) + , packageDbArgs implInfo (interpretPackageDBStack Nothing (ghcOptPackageDBs opts)) , concat $ let space "" = "" space xs = ' ' : xs @@ -893,7 +989,7 @@ verbosityOpts verbosity | otherwise = ["-w", "-v0"] -- | GHC <7.6 uses '-package-conf' instead of '-package-db'. -packageDbArgsConf :: PackageDBStack -> [String] +packageDbArgsConf :: PackageDBStackCWD -> [String] packageDbArgsConf dbstack = case dbstack of (GlobalPackageDB : UserPackageDB : dbs) -> concatMap specific dbs (GlobalPackageDB : dbs) -> @@ -910,7 +1006,7 @@ packageDbArgsConf dbstack = case dbstack of -- | GHC >= 7.6 uses the '-package-db' flag. See -- https://gitlab.haskell.org/ghc/ghc/-/issues/5977. -packageDbArgsDb :: PackageDBStack -> [String] +packageDbArgsDb :: PackageDBStackCWD -> [String] -- special cases to make arguments prettier in common scenarios packageDbArgsDb dbstack = case dbstack of (GlobalPackageDB : UserPackageDB : dbs) @@ -929,11 +1025,31 @@ packageDbArgsDb dbstack = case dbstack of isSpecific (SpecificPackageDB _) = True isSpecific _ = False -packageDbArgs :: GhcImplInfo -> PackageDBStack -> [String] +packageDbArgs :: GhcImplInfo -> PackageDBStackCWD -> [String] packageDbArgs implInfo | flagPackageConf implInfo = packageDbArgsConf | otherwise = packageDbArgsDb +-- | Split a list of command-line arguments into RTS arguments and non-RTS +-- arguments. +splitRTSArgs :: [String] -> ([String], [String]) +splitRTSArgs args = + let addRTSArg arg ~(rtsArgs, nonRTSArgs) = (arg : rtsArgs, nonRTSArgs) + addNonRTSArg arg ~(rtsArgs, nonRTSArgs) = (rtsArgs, arg : nonRTSArgs) + + go _ [] = ([], []) + go isRTSArg (arg : rest) = + case arg of + "+RTS" -> addRTSArg arg $ go True rest + "-RTS" -> addRTSArg arg $ go False rest + "--RTS" -> ([arg], rest) + "--" -> ([], arg : rest) + _ -> + if isRTSArg + then addRTSArg arg $ go isRTSArg rest + else addNonRTSArg arg $ go isRTSArg rest + in go False args + -- ----------------------------------------------------------------------------- -- Boilerplate Monoid instance for GhcOptions diff --git a/Cabal/src/Distribution/Simple/Program/HcPkg.hs b/Cabal/src/Distribution/Simple/Program/HcPkg.hs index 710020d9f6d..a494bc63f02 100644 --- a/Cabal/src/Distribution/Simple/Program/HcPkg.hs +++ b/Cabal/src/Distribution/Simple/Program/HcPkg.hs @@ -154,8 +154,8 @@ defaultRegisterOptions = register :: HcPkgInfo -> Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDBStack + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBStackS from -> InstalledPackageInfo -> RegisterOptions -> IO () @@ -179,7 +179,7 @@ register hpi verbosity mbWorkDir packagedbs pkgInfo registerOptions , recacheMultiInstance hpi = do let pkgdb = registrationPackageDB packagedbs - writeRegistrationFileDirectly verbosity hpi pkgdb pkgInfo + writeRegistrationFileDirectly verbosity hpi mbWorkDir pkgdb pkgInfo recache hpi verbosity mbWorkDir pkgdb | otherwise = runProgramInvocation @@ -189,17 +189,18 @@ register hpi verbosity mbWorkDir packagedbs pkgInfo registerOptions writeRegistrationFileDirectly :: Verbosity -> HcPkgInfo - -> PackageDB + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBS from -> InstalledPackageInfo -> IO () -writeRegistrationFileDirectly verbosity hpi (SpecificPackageDB dir) pkgInfo +writeRegistrationFileDirectly verbosity hpi mbWorkDir (SpecificPackageDB dir) pkgInfo | supportsDirDbs hpi = do - let pkgfile = dir prettyShow (installedUnitId pkgInfo) <.> "conf" + let pkgfile = interpretSymbolicPath mbWorkDir dir prettyShow (installedUnitId pkgInfo) <.> "conf" writeUTF8File pkgfile (showInstalledPackageInfo pkgInfo) | otherwise = dieWithException verbosity NoSupportDirStylePackageDb -writeRegistrationFileDirectly verbosity _ _ _ = +writeRegistrationFileDirectly verbosity _ _ _ _ = -- We don't know here what the dir for the global or user dbs are, -- if that's needed it'll require a bit more plumbing to support. dieWithException verbosity OnlySupportSpecificPackageDb @@ -216,7 +217,7 @@ unregister hpi verbosity mbWorkDir packagedb pkgid = -- | Call @hc-pkg@ to recache the registered packages. -- -- > hc-pkg recache [--user | --global | --package-db] -recache :: HcPkgInfo -> Verbosity -> Maybe (SymbolicPath CWD (Dir Pkg)) -> PackageDB -> IO () +recache :: HcPkgInfo -> Verbosity -> Maybe (SymbolicPath CWD (Dir from)) -> PackageDBS from -> IO () recache hpi verbosity mbWorkDir packagedb = runProgramInvocation verbosity @@ -278,8 +279,8 @@ hide hpi verbosity mbWorkDir packagedb pkgid = dump :: HcPkgInfo -> Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDB + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBX (SymbolicPath from (Dir PkgDB)) -> IO [InstalledPackageInfo] dump hpi verbosity mbWorkDir packagedb = do output <- @@ -432,8 +433,8 @@ initInvocation hpi verbosity path = registerInvocation :: HcPkgInfo -> Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDBStack + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBStackS from -> InstalledPackageInfo -> RegisterOptions -> ProgramInvocation @@ -474,8 +475,8 @@ unregisterInvocation hpi verbosity mbWorkDir packagedb pkgid = recacheInvocation :: HcPkgInfo -> Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDB + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBS from -> ProgramInvocation recacheInvocation hpi verbosity mbWorkDir packagedb = programInvocationCwd mbWorkDir (hcPkgProgram hpi) $ @@ -522,8 +523,8 @@ hideInvocation hpi verbosity mbWorkDir packagedb pkgid = dumpInvocation :: HcPkgInfo -> Verbosity - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDB + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBX (SymbolicPath from (Dir PkgDB)) -> ProgramInvocation dumpInvocation hpi _verbosity mbWorkDir packagedb = (programInvocationCwd mbWorkDir (hcPkgProgram hpi) args) @@ -555,7 +556,7 @@ listInvocation hpi _verbosity mbWorkDir packagedb = -- We use verbosity level 'silent' because it is important that we -- do not contaminate the output with info/debug messages. -packageDbStackOpts :: HcPkgInfo -> PackageDBStack -> [String] +packageDbStackOpts :: HcPkgInfo -> PackageDBStackS from -> [String] packageDbStackOpts hpi dbstack | noPkgDbStack hpi = [packageDbOpts hpi (registrationPackageDB dbstack)] | otherwise = case dbstack of @@ -569,7 +570,7 @@ packageDbStackOpts hpi dbstack : map specific dbs _ -> ierror where - specific (SpecificPackageDB db) = "--" ++ packageDbFlag hpi ++ "=" ++ db + specific (SpecificPackageDB db) = "--" ++ packageDbFlag hpi ++ "=" ++ interpretSymbolicPathCWD db specific _ = ierror ierror :: a ierror = error ("internal error: unexpected package db stack: " ++ show dbstack) @@ -581,10 +582,10 @@ packageDbFlag hpi | otherwise = "package-db" -packageDbOpts :: HcPkgInfo -> PackageDB -> String +packageDbOpts :: HcPkgInfo -> PackageDBX (SymbolicPath from (Dir PkgDB)) -> String packageDbOpts _ GlobalPackageDB = "--global" packageDbOpts _ UserPackageDB = "--user" -packageDbOpts hpi (SpecificPackageDB db) = "--" ++ packageDbFlag hpi ++ "=" ++ db +packageDbOpts hpi (SpecificPackageDB db) = "--" ++ packageDbFlag hpi ++ "=" ++ interpretSymbolicPathCWD db verbosityOpts :: HcPkgInfo -> Verbosity -> [String] verbosityOpts hpi v diff --git a/Cabal/src/Distribution/Simple/Program/Hpc.hs b/Cabal/src/Distribution/Simple/Program/Hpc.hs index c508900814d..fd181d32176 100644 --- a/Cabal/src/Distribution/Simple/Program/Hpc.hs +++ b/Cabal/src/Distribution/Simple/Program/Hpc.hs @@ -70,7 +70,7 @@ markup mbWorkDir hpc hpcVer verbosity tixFile hpcDirs destDir included = do return passedDirs -- Prior to GHC 8.0, hpc assumes all .mix paths are relative. - hpcDirs'' <- traverse (tryMakeRelativeToWorkingDir mbWorkDir) hpcDirs' + hpcDirs'' <- traverse (tryMakeRelative mbWorkDir) hpcDirs' runProgramInvocation verbosity diff --git a/Cabal/src/Distribution/Simple/Program/Ld.hs b/Cabal/src/Distribution/Simple/Program/Ld.hs index 5c2a33809ae..00ed5d182d7 100644 --- a/Cabal/src/Distribution/Simple/Program/Ld.hs +++ b/Cabal/src/Distribution/Simple/Program/Ld.hs @@ -83,8 +83,6 @@ combineObjectFiles verbosity lbi ldProg target files = do middle = ld middleArgs final = ld finalArgs - targetDir = takeDirectorySymbolicPath target - invokeWithResponseFile :: FilePath -> ProgramInvocation invokeWithResponseFile atFile = ld $ simpleArgs ++ ['@' : atFile] @@ -106,7 +104,7 @@ combineObjectFiles verbosity lbi ldProg target files = do if oldVersionManualOverride || responseArgumentsNotSupported then run $ multiStageProgramInvocation simple (initial, middle, final) (map getSymbolicPath files) - else withResponseFile verbosity defaultTempFileOptions mbWorkDir targetDir "ld.rsp" Nothing (map getSymbolicPath files) $ + else withResponseFile verbosity defaultTempFileOptions "ld.rsp" Nothing (map getSymbolicPath files) $ \path -> runProgramInvocation verbosity $ invokeWithResponseFile path where tmpfile = target <.> "tmp" -- perhaps should use a proper temp file diff --git a/Cabal/src/Distribution/Simple/Program/ResponseFile.hs b/Cabal/src/Distribution/Simple/Program/ResponseFile.hs index ee8271545f1..51b0d3b4131 100644 --- a/Cabal/src/Distribution/Simple/Program/ResponseFile.hs +++ b/Cabal/src/Distribution/Simple/Program/ResponseFile.hs @@ -1,7 +1,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TypeApplications #-} ---------------------------------------------------------------------------- @@ -27,10 +26,6 @@ import Distribution.Verbosity withResponseFile :: Verbosity -> TempFileOptions - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -- ^ Working directory - -> SymbolicPath Pkg (Dir Response) - -- ^ Directory to create response file in. -> String -- ^ Template for response file name. -> Maybe TextEncoding @@ -39,8 +34,8 @@ withResponseFile -- ^ Arguments to put into response file. -> (FilePath -> IO a) -> IO a -withResponseFile verbosity tmpFileOpts mbWorkDir responseDir fileNameTemplate encoding arguments f = - withTempFileEx tmpFileOpts mbWorkDir responseDir fileNameTemplate $ \responsePath hf -> do +withResponseFile verbosity tmpFileOpts fileNameTemplate encoding arguments f = + withTempFileEx tmpFileOpts fileNameTemplate $ \responsePath hf -> do let responseFileName = getSymbolicPath responsePath traverse_ (hSetEncoding hf) encoding let responseContents = diff --git a/Cabal/src/Distribution/Simple/Program/Run.hs b/Cabal/src/Distribution/Simple/Program/Run.hs index 88afef0af91..0a9ddb0e7b5 100644 --- a/Cabal/src/Distribution/Simple/Program/Run.hs +++ b/Cabal/src/Distribution/Simple/Program/Run.hs @@ -3,7 +3,6 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} ----------------------------------------------------------------------------- @@ -61,6 +60,7 @@ data ProgramInvocation = ProgramInvocation , progInvokeInputEncoding :: IOEncoding -- ^ TODO: remove this, make user decide when constructing 'progInvokeInput'. , progInvokeOutputEncoding :: IOEncoding + , progInvokeWhen :: IO Bool } data IOEncoding @@ -82,6 +82,7 @@ emptyProgramInvocation = , progInvokeInput = Nothing , progInvokeInputEncoding = IOEncodingText , progInvokeOutputEncoding = IOEncodingText + , progInvokeWhen = pure True } simpleProgramInvocation diff --git a/Cabal/src/Distribution/Simple/Program/Strip.hs b/Cabal/src/Distribution/Simple/Program/Strip.hs index bb43e5ed47d..af7bbfc9754 100644 --- a/Cabal/src/Distribution/Simple/Program/Strip.hs +++ b/Cabal/src/Distribution/Simple/Program/Strip.hs @@ -58,6 +58,10 @@ stripLib verbosity (Platform arch os) progdb path = do IOS -> return () AIX -> return () Solaris -> return () + OpenBSD -> + -- '--strip-unneeded' sometimes strips too much on OpenBSD. + -- -- See https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/lang/ghc/patches/patch-libraries_Cabal_Cabal_Distribution_Simple_Program_Strip_hs + return () Windows -> -- Stripping triggers a bug in 'strip.exe' for -- libraries with lots identically named modules. See diff --git a/Cabal/src/Distribution/Simple/Program/Types.hs b/Cabal/src/Distribution/Simple/Program/Types.hs index 630b22580cf..bcbd05c520d 100644 --- a/Cabal/src/Distribution/Simple/Program/Types.hs +++ b/Cabal/src/Distribution/Simple/Program/Types.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} @@ -107,7 +106,7 @@ data ProgramSearchPathEntry ProgramSearchPathDir FilePath | -- | The system default ProgramSearchPathDefault - deriving (Show, Eq, Generic, Typeable) + deriving (Show, Eq, Generic) instance Binary ProgramSearchPathEntry instance Structured ProgramSearchPathEntry @@ -143,11 +142,11 @@ data ConfiguredProgram = ConfiguredProgram , programMonitorFiles :: [FilePath] -- ^ In addition to the 'programLocation' where the program was found, -- these are additional locations that were looked at. The combination - -- of ths found location and these not-found locations can be used to + -- of this found location and these not-found locations can be used to -- monitor to detect when the re-configuring the program might give a -- different result (e.g. found in a different location). } - deriving (Eq, Generic, Read, Show, Typeable) + deriving (Eq, Generic, Read, Show) instance Binary ConfiguredProgram instance Structured ConfiguredProgram @@ -160,7 +159,7 @@ data ProgramLocation UserSpecified {locationPath :: FilePath} | -- | The program was found automatically. FoundOnSystem {locationPath :: FilePath} - deriving (Eq, Generic, Read, Show, Typeable) + deriving (Eq, Generic, Read, Show) instance Binary ProgramLocation instance Structured ProgramLocation diff --git a/Cabal/src/Distribution/Simple/Register.hs b/Cabal/src/Distribution/Simple/Register.hs index 27c80ab9810..0bd7312cbc4 100644 --- a/Cabal/src/Distribution/Simple/Register.hs +++ b/Cabal/src/Distribution/Simple/Register.hs @@ -203,9 +203,10 @@ registerAll pkg lbi regFlags ipis = where modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags)) regFile = - fromMaybe - (prettyShow (packageId pkg) <.> "conf") - (fromFlag (regGenPkgConf regFlags)) + interpretSymbolicPathLBI lbi $ + fromMaybe + (makeSymbolicPath (prettyShow (packageId pkg) <.> "conf")) + (fromFlag (regGenPkgConf regFlags)) modeGenerateRegScript = fromFlag (regGenScript regFlags) @@ -281,7 +282,7 @@ generateRegistrationInfo verbosity pkg lib lbi clbi inplace reloc distPref packa clbi ) else do - abi_hash <- abiHash verbosity pkg inplaceDir distPref lbi lib clbi + abi_hash <- abiHash verbosity pkg distPref lbi lib clbi if reloc then relocRegistrationInfo @@ -308,13 +309,12 @@ generateRegistrationInfo verbosity pkg lib lbi clbi inplace reloc distPref packa abiHash :: Verbosity -> PackageDescription - -> FilePath -> SymbolicPath Pkg (Dir Dist) -> LocalBuildInfo -> Library -> ComponentLocalBuildInfo -> IO AbiHash -abiHash verbosity pkg inplaceDir distPref lbi lib clbi = +abiHash verbosity pkg distPref lbi lib clbi = case compilerFlavor comp of GHC -> do fmap mkAbiHash $ GHC.libAbiHash verbosity pkg lbi' lib clbi @@ -327,7 +327,7 @@ abiHash verbosity pkg inplaceDir distPref lbi lib clbi = lbi { withPackageDB = withPackageDB lbi - ++ [SpecificPackageDB (inplaceDir getSymbolicPath (internalPackageDBPath lbi distPref))] + ++ [SpecificPackageDB (internalPackageDBPath lbi distPref)] } relocRegistrationInfo @@ -427,8 +427,8 @@ registerPackage :: Verbosity -> Compiler -> ProgramDb - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -> PackageDBStack + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBStackS from -> InstalledPackageInfo -> HcPkg.RegisterOptions -> IO () @@ -441,7 +441,7 @@ registerPackage verbosity comp progdb mbWorkDir packageDbs installedPkgInfo regi _ | HcPkg.registerMultiInstance registerOptions -> dieWithException verbosity RegisMultiplePkgNotSupported - UHC -> UHC.registerPackage verbosity comp progdb packageDbs installedPkgInfo + UHC -> UHC.registerPackage verbosity mbWorkDir comp progdb packageDbs installedPkgInfo _ -> dieWithException verbosity RegisteringNotImplemented writeHcPkgRegisterScript @@ -466,14 +466,15 @@ writeHcPkgRegisterScript verbosity mbWorkDir ipis packageDbs hpi = do -- TODO: Do something more robust here regScript = unlines scripts - info verbosity ("Creating package registration script: " ++ regScriptFileName) - writeUTF8File regScriptFileName regScript - setFileExecutable regScriptFileName + let out_file = interpretSymbolicPath mbWorkDir regScriptFileName + info verbosity ("Creating package registration script: " ++ out_file) + writeUTF8File out_file regScript + setFileExecutable out_file -regScriptFileName :: FilePath +regScriptFileName :: SymbolicPath Pkg File regScriptFileName = case buildOS of - Windows -> "register.bat" - _ -> "register.sh" + Windows -> makeSymbolicPath "register.bat" + _ -> makeSymbolicPath "register.sh" -- ----------------------------------------------------------------------------- -- Making the InstalledPackageInfo @@ -496,9 +497,9 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi { IPI.sourcePackageId = packageId pkg , IPI.installedUnitId = componentUnitId clbi , IPI.installedComponentId_ = componentComponentId clbi - , IPI.instantiatedWith = componentInstantiatedWith clbi + , IPI.instantiatedWith = expectLibraryComponent (maybeComponentInstantiatedWith clbi) , IPI.sourceLibName = libName lib - , IPI.compatPackageKey = componentCompatPackageKey clbi + , IPI.compatPackageKey = expectLibraryComponent (maybeComponentCompatPackageKey clbi) , -- If GHC >= 8.4 we register with SDPX, otherwise with legacy license IPI.license = if ghc84 @@ -517,7 +518,7 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi , IPI.indefinite = componentIsIndefinite clbi , IPI.exposed = libExposed lib , IPI.exposedModules = - componentExposedModules clbi + expectLibraryComponent (maybeComponentExposedModules clbi) -- add virtual modules into the list of exposed modules for the -- package database as well. ++ map (\name -> IPI.ExposedModule name Nothing) (virtualModules bi) @@ -548,7 +549,7 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi , IPI.ldOptions = ldOptions bi , IPI.frameworks = map getSymbolicPath $ frameworks bi , IPI.frameworkDirs = map getSymbolicPath $ extraFrameworkDirs bi - , IPI.haddockInterfaces = [haddockdir installDirs haddockName pkg | hasModules] + , IPI.haddockInterfaces = [haddockdir installDirs haddockLibraryPath pkg lib | hasModules] , IPI.haddockHTMLs = [htmldir installDirs | hasModules] , IPI.pkgRoot = Nothing , IPI.libVisibility = libVisibility lib @@ -600,6 +601,8 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi ) | otherwise = (libdir installDirs : dynlibdir installDirs : extraLibDirs', []) + expectLibraryComponent (Just attribute) = attribute + expectLibraryComponent Nothing = (error "generalInstalledPackageInfo: Expected a library component, got something else.") -- the compiler doesn't understand the dynamic-library-dirs field so we -- add the dyn directory to the "normal" list in the library-dirs field @@ -609,8 +612,7 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi -- -- This function knows about the layout of in place packages. inplaceInstalledPackageInfo - :: FilePath - -- ^ top of the build tree (absolute path) + :: AbsolutePath (Dir Pkg) -> SymbolicPath Pkg (Dir Dist) -- ^ location of the dist tree -> PackageDescription @@ -629,7 +631,7 @@ inplaceInstalledPackageInfo inplaceDir distPref pkg abi_hash lib lbi clbi = clbi installDirs where - i = interpretSymbolicPath (Just $ makeSymbolicPath inplaceDir) -- See Note [Symbolic paths] in Distribution.Utils.Path + i = interpretSymbolicPathAbsolute inplaceDir -- See Note [Symbolic paths] in Distribution.Utils.Path adjustRelativeIncludeDirs = concatMap $ \d -> [ i $ makeRelativePathEx d -- local include-dir , i $ libTargetDir makeRelativePathEx d -- autogen include-dir diff --git a/Cabal/src/Distribution/Simple/Setup.hs b/Cabal/src/Distribution/Simple/Setup.hs index dfde4466b30..5430b5bd7ec 100644 --- a/Cabal/src/Distribution/Simple/Setup.hs +++ b/Cabal/src/Distribution/Simple/Setup.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE LambdaCase #-} @@ -41,6 +40,7 @@ module Distribution.Simple.Setup , globalCommand , CommonSetupFlags (..) , defaultCommonSetupFlags + , commonSetupTempFileOptions , ConfigFlags (..) , emptyConfigFlags , defaultConfigFlags diff --git a/Cabal/src/Distribution/Simple/Setup/Benchmark.hs b/Cabal/src/Distribution/Simple/Setup/Benchmark.hs index 36fc446b5a1..a46073ba434 100644 --- a/Cabal/src/Distribution/Simple/Setup/Benchmark.hs +++ b/Cabal/src/Distribution/Simple/Setup/Benchmark.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -56,7 +55,7 @@ data BenchmarkFlags = BenchmarkFlags { benchmarkCommonFlags :: !CommonSetupFlags , benchmarkOptions :: [PathTemplate] } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) pattern BenchmarkCommonFlags :: Flag Verbosity diff --git a/Cabal/src/Distribution/Simple/Setup/Build.hs b/Cabal/src/Distribution/Simple/Setup/Build.hs index 09aad42bdc8..c0aedc25bd0 100644 --- a/Cabal/src/Distribution/Simple/Setup/Build.hs +++ b/Cabal/src/Distribution/Simple/Setup/Build.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -62,7 +61,7 @@ data BuildFlags = BuildFlags , buildNumJobs :: Flag (Maybe Int) , buildUseSemaphore :: Flag String } - deriving (Read, Show, Generic, Typeable) + deriving (Read, Show, Generic) pattern BuildCommonFlags :: Flag Verbosity diff --git a/Cabal/src/Distribution/Simple/Setup/Clean.hs b/Cabal/src/Distribution/Simple/Setup/Clean.hs index 6a1974f323e..8700e32b4a3 100644 --- a/Cabal/src/Distribution/Simple/Setup/Clean.hs +++ b/Cabal/src/Distribution/Simple/Setup/Clean.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -54,7 +53,7 @@ data CleanFlags = CleanFlags { cleanCommonFlags :: !CommonSetupFlags , cleanSaveConf :: Flag Bool } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) pattern CleanCommonFlags :: Flag Verbosity diff --git a/Cabal/src/Distribution/Simple/Setup/Common.hs b/Cabal/src/Distribution/Simple/Setup/Common.hs index 0a1422b327f..f323b05aeff 100644 --- a/Cabal/src/Distribution/Simple/Setup/Common.hs +++ b/Cabal/src/Distribution/Simple/Setup/Common.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} @@ -23,6 +21,7 @@ module Distribution.Simple.Setup.Common ( CommonSetupFlags (..) , defaultCommonSetupFlags , withCommonSetupOptions + , commonSetupTempFileOptions , CopyDest (..) , configureCCompiler , configureLinker @@ -85,6 +84,13 @@ data CommonSetupFlags = CommonSetupFlags -- -- TODO: this one should not be here, it's just that the silly -- UserHooks stop us from passing extra info in other ways + , setupKeepTempFiles :: Flag Bool + -- ^ When this flag is set, temporary files will be kept after building. + -- + -- Note: Keeping temporary files is important functionality for HLS, which + -- runs @cabal repl@ with a fake GHC to get CLI arguments. It will need the + -- temporary files (including multi unit repl response files) to stay, even + -- after the @cabal repl@ command exits. } deriving (Eq, Show, Read, Generic) @@ -106,6 +112,15 @@ defaultCommonSetupFlags = , setupDistPref = NoFlag , setupCabalFilePath = NoFlag , setupTargets = [] + , setupKeepTempFiles = NoFlag + } + +-- | Get `TempFileOptions` that respect the `setupKeepTempFiles` flag. +commonSetupTempFileOptions :: CommonSetupFlags -> TempFileOptions +commonSetupTempFileOptions options = + TempFileOptions + { optKeepTempFiles = + fromFlagOrDefault False (setupKeepTempFiles options) } commonSetupOptions :: ShowOrParseArgs -> [OptionField CommonSetupFlags] @@ -124,6 +139,14 @@ commonSetupOptions showOrParseArgs = setupCabalFilePath (\v flags -> flags{setupCabalFilePath = v}) (reqSymbolicPathArgFlag "PATH") + , option + "" + ["keep-temp-files"] + ( "Keep temporary files." + ) + setupKeepTempFiles + (\keepTempFiles flags -> flags{setupKeepTempFiles = keepTempFiles}) + trueArg -- NB: no --working-dir flag, as that value is populated using the -- global flag (see Distribution.Simple.Setup.Global.globalCommand). ] diff --git a/Cabal/src/Distribution/Simple/Setup/Config.hs b/Cabal/src/Distribution/Simple/Setup/Config.hs index 14e76c7d769..c904ecf2b44 100644 --- a/Cabal/src/Distribution/Simple/Setup/Config.hs +++ b/Cabal/src/Distribution/Simple/Setup/Config.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -127,6 +126,8 @@ data ConfigFlags = ConfigFlags , configProf :: Flag Bool -- ^ Enable profiling in the library -- and executables. + , configProfShared :: Flag Bool + -- ^ Enable shared profiling objects , configProfDetail :: Flag ProfDetailLevel -- ^ Profiling detail level -- in the library and executables. @@ -183,7 +184,7 @@ data ConfigFlags = ConfigFlags -- dependencies. , configDependencies :: [GivenComponent] -- ^ The packages depended on which already exist - , configPromisedDependencies :: [GivenComponent] + , configPromisedDependencies :: [PromisedComponent] -- ^ The packages depended on which doesn't yet exist (i.e. promised). -- Promising dependencies enables us to configure components in parallel, -- and avoids expensive builds if they are not necessary. @@ -228,8 +229,12 @@ data ConfigFlags = ConfigFlags -- testsuites run with @--enable-coverage@. Notably, this list must exclude -- indefinite libraries and instantiations because HPC does not support -- backpack (Nov. 2023). + , configIgnoreBuildTools :: Flag Bool + -- ^ When this flag is set, all tools declared in `build-tool`s and + -- `build-tool-depends` will be ignored. This allows a Cabal package with + -- build-tool-dependencies to be built even if the tool is not found. } - deriving (Generic, Read, Show, Typeable) + deriving (Generic, Read, Show) pattern ConfigCommonFlags :: Flag Verbosity @@ -286,6 +291,7 @@ instance Eq ConfigFlags where && equal configProfExe && equal configProf && equal configProfDetail + && equal configProfShared && equal configProfLibDetail && equal configConfigureArgs && equal configOptimization @@ -319,7 +325,9 @@ instance Eq ConfigFlags where && equal configDebugInfo && equal configDumpBuildInfo && equal configUseResponseFiles + && equal configAllowDependingOnPrivateLibs && equal configCoverageFor + && equal configIgnoreBuildTools where equal f = on (==) f a b @@ -518,6 +526,13 @@ configureOptions showOrParseArgs = configProf (\v flags -> flags{configProf = v}) (boolOpt [] []) + , option + "" + ["profiling-shared"] + "Build profiling shared libraries" + configProfShared + (\v flags -> flags{configProfShared = v}) + (boolOpt [] []) , option "" ["executable-profiling"] @@ -763,13 +778,13 @@ configureOptions showOrParseArgs = , option "" ["promised-dependency"] - "A list of promised dependencies. E.g., --promised-dependency=\"void=void-0.5.8-177d5cdf20962d0581fe2e4932a6c309\"" + "A list of promised dependencies. E.g., --promised-dependency=\"void-0.5.8=void-0.5.8-177d5cdf20962d0581fe2e4932a6c309\"" configPromisedDependencies (\v flags -> flags{configPromisedDependencies = v}) ( reqArg - "NAME[:COMPONENT_NAME]=CID" - (parsecToReadE (const "dependency expected") ((\x -> [x]) `fmap` parsecGivenComponent)) - (map prettyGivenComponent) + "NAME-VER[:COMPONENT_NAME]=CID" + (parsecToReadE (const "dependency expected") ((\x -> [x]) `fmap` parsecPromisedComponent)) + (map prettyPromisedComponent) ) , option "" @@ -856,6 +871,15 @@ configureOptions showOrParseArgs = (Flag . (: []) . fromString) (fmap prettyShow . fromFlagOrDefault []) ) + , option + "" + ["ignore-build-tools"] + ( "Ignore build tool dependencies. " + ++ "If set, declared build tools needn't be found for compilation to proceed." + ) + configIgnoreBuildTools + (\v flags -> flags{configIgnoreBuildTools = v}) + trueArg ] where liftInstallDirs = @@ -880,7 +904,7 @@ readPackageDb :: String -> Maybe PackageDB readPackageDb "clear" = Nothing readPackageDb "global" = Just GlobalPackageDB readPackageDb "user" = Just UserPackageDB -readPackageDb other = Just (SpecificPackageDB other) +readPackageDb other = Just (SpecificPackageDB (makeSymbolicPath other)) showPackageDbList :: [Maybe PackageDB] -> [String] showPackageDbList = map showPackageDb @@ -892,12 +916,35 @@ showPackageDb :: Maybe PackageDB -> String showPackageDb Nothing = "clear" showPackageDb (Just GlobalPackageDB) = "global" showPackageDb (Just UserPackageDB) = "user" -showPackageDb (Just (SpecificPackageDB db)) = db +showPackageDb (Just (SpecificPackageDB db)) = getSymbolicPath db showProfDetailLevelFlag :: Flag ProfDetailLevel -> [String] showProfDetailLevelFlag NoFlag = [] showProfDetailLevelFlag (Flag dl) = [showProfDetailLevel dl] +parsecPromisedComponent :: ParsecParser PromisedComponent +parsecPromisedComponent = do + pn <- parsec + ln <- P.option LMainLibName $ do + _ <- P.char ':' + ucn <- parsec + return $ + if unUnqualComponentName ucn == unPackageName (pkgName pn) + then LMainLibName + else LSubLibName ucn + _ <- P.char '=' + cid <- parsec + return $ PromisedComponent pn ln cid + +prettyPromisedComponent :: PromisedComponent -> String +prettyPromisedComponent (PromisedComponent pn cn cid) = + prettyShow pn + ++ case cn of + LMainLibName -> "" + LSubLibName n -> ":" ++ prettyShow n + ++ "=" + ++ prettyShow cid + parsecGivenComponent :: ParsecParser GivenComponent parsecGivenComponent = do pn <- parsec @@ -1054,7 +1101,7 @@ configureArgs bcHack flags = (Flag hc, NoFlag) -> [hc_flag_name ++ prettyShow hc] (NoFlag, NoFlag) -> [] hc_flag_name - -- TODO kill off thic bc hack when defaultUserHooks is removed. + -- TODO kill off this bc hack when defaultUserHooks is removed. | bcHack = "--with-hc=" | otherwise = "--with-compiler=" optFlag name config_field = case config_field flags of diff --git a/Cabal/src/Distribution/Simple/Setup/Copy.hs b/Cabal/src/Distribution/Simple/Setup/Copy.hs index 719592b656e..65f14e20797 100644 --- a/Cabal/src/Distribution/Simple/Setup/Copy.hs +++ b/Cabal/src/Distribution/Simple/Setup/Copy.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} diff --git a/Cabal/src/Distribution/Simple/Setup/Global.hs b/Cabal/src/Distribution/Simple/Setup/Global.hs index b230289446d..540edab9783 100644 --- a/Cabal/src/Distribution/Simple/Setup/Global.hs +++ b/Cabal/src/Distribution/Simple/Setup/Global.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} @@ -51,7 +50,7 @@ data GlobalFlags = GlobalFlags , globalNumericVersion :: Flag Bool , globalWorkingDir :: Flag (SymbolicPath CWD (Dir Pkg)) } - deriving (Generic, Typeable) + deriving (Generic) defaultGlobalFlags :: GlobalFlags defaultGlobalFlags = diff --git a/Cabal/src/Distribution/Simple/Setup/Haddock.hs b/Cabal/src/Distribution/Simple/Setup/Haddock.hs index bcb2c9dbc5e..f16faf248e9 100644 --- a/Cabal/src/Distribution/Simple/Setup/Haddock.hs +++ b/Cabal/src/Distribution/Simple/Setup/Haddock.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -76,7 +75,7 @@ import qualified Text.PrettyPrint as Disp -- from documentation tarballs, and we might also want to use different -- flags than for development builds, so in this case we store the generated -- documentation in @/doc/html/-docs@. -data HaddockTarget = ForHackage | ForDevelopment deriving (Eq, Show, Generic, Typeable) +data HaddockTarget = ForHackage | ForDevelopment deriving (Eq, Show, Generic) instance Binary HaddockTarget instance Structured HaddockTarget @@ -111,12 +110,12 @@ data HaddockFlags = HaddockFlags , haddockHscolourCss :: Flag FilePath , haddockContents :: Flag PathTemplate , haddockIndex :: Flag PathTemplate - , haddockKeepTempFiles :: Flag Bool , haddockBaseUrl :: Flag String - , haddockLib :: Flag String + , haddockResourcesDir :: Flag String , haddockOutputDir :: Flag FilePath + , haddockUseUnicode :: Flag Bool } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) pattern HaddockCommonFlags :: Flag Verbosity @@ -165,11 +164,11 @@ defaultHaddockFlags = , haddockQuickJump = Flag False , haddockHscolourCss = NoFlag , haddockContents = NoFlag - , haddockKeepTempFiles = Flag False , haddockIndex = NoFlag , haddockBaseUrl = NoFlag - , haddockLib = NoFlag + , haddockResourcesDir = NoFlag , haddockOutputDir = NoFlag + , haddockUseUnicode = Flag False } haddockCommand :: CommandUI HaddockFlags @@ -217,13 +216,6 @@ haddockOptions showOrParseArgs = (\c f -> f{haddockCommonFlags = c}) showOrParseArgs [ option - "" - ["keep-temp-files"] - "Keep temporary files" - haddockKeepTempFiles - (\b flags -> flags{haddockKeepTempFiles = b}) - trueArg - , option "" ["hoogle"] "Generate a hoogle database" @@ -366,10 +358,10 @@ haddockOptions showOrParseArgs = (reqArgFlag "URL") , option "" - ["lib"] + ["resources-dir"] "location of Haddocks static / auxiliary files" - haddockLib - (\v flags -> flags{haddockLib = v}) + haddockResourcesDir + (\v flags -> flags{haddockResourcesDir = v}) (reqArgFlag "DIR") , option "" @@ -378,6 +370,13 @@ haddockOptions showOrParseArgs = haddockOutputDir (\v flags -> flags{haddockOutputDir = v}) (reqArgFlag "DIR") + , option + "" + ["use-unicode"] + "Pass --use-unicode option to haddock" + haddockUseUnicode + (\v flags -> flags{haddockUseUnicode = v}) + trueArg ] emptyHaddockFlags :: HaddockFlags @@ -404,7 +403,8 @@ data Visibility = Visible | Hidden deriving (Eq, Show) data HaddockProjectFlags = HaddockProjectFlags - { haddockProjectHackage :: Flag Bool + { haddockProjectCommonFlags :: !CommonSetupFlags + , haddockProjectHackage :: Flag Bool -- ^ a shortcut option which builds documentation linked to hackage. It implies: -- * `--html-location='https://hackage.haskell.org/package/$prg-$version/docs' -- * `--quickjump` @@ -437,18 +437,17 @@ data HaddockProjectFlags = HaddockProjectFlags , -- haddockContent is not supported, a fixed value is provided -- haddockIndex is not supported, a fixed value is provided -- haddockDistPerf is not supported, note: it changes location of the haddocks - haddockProjectKeepTempFiles :: Flag Bool - , haddockProjectVerbosity :: Flag Verbosity - , -- haddockBaseUrl is not supported, a fixed value is provided - haddockProjectLib :: Flag String - , haddockProjectOutputDir :: Flag FilePath + -- haddockBaseUrl is not supported, a fixed value is provided + haddockProjectResourcesDir :: Flag String + , haddockProjectUseUnicode :: Flag Bool } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) defaultHaddockProjectFlags :: HaddockProjectFlags defaultHaddockProjectFlags = HaddockProjectFlags - { haddockProjectHackage = Flag False + { haddockProjectCommonFlags = defaultCommonSetupFlags + , haddockProjectHackage = Flag False , haddockProjectDir = Flag "./haddocks" , haddockProjectPrologue = NoFlag , haddockProjectTestSuites = Flag False @@ -462,11 +461,9 @@ defaultHaddockProjectFlags = , haddockProjectInternal = Flag False , haddockProjectCss = NoFlag , haddockProjectHscolourCss = NoFlag - , haddockProjectKeepTempFiles = Flag False - , haddockProjectVerbosity = Flag normal - , haddockProjectLib = NoFlag - , haddockProjectOutputDir = NoFlag + , haddockProjectResourcesDir = NoFlag , haddockProjectInterfaces = NoFlag + , haddockProjectUseUnicode = NoFlag } haddockProjectCommand :: CommandUI HaddockProjectFlags @@ -508,119 +505,134 @@ haddockProjectCommand = emptyProgramDb haddockProjectOptions :: ShowOrParseArgs -> [OptionField HaddockProjectFlags] -haddockProjectOptions _showOrParseArgs = - [ option - "" - ["hackage"] - ( concat - [ "A short-cut option to build documentation linked to hackage." - ] - ) - haddockProjectHackage - (\v flags -> flags{haddockProjectHackage = v}) - trueArg - , option - "" - ["output"] - "Output directory" - haddockProjectDir - (\v flags -> flags{haddockProjectDir = v}) - (optArg' "DIRECTORY" maybeToFlag (fmap Just . flagToList)) - , option - "" - ["prologue"] - "File path to a prologue file in haddock format" - haddockProjectPrologue - (\v flags -> flags{haddockProjectPrologue = v}) - (optArg' "PATH" maybeToFlag (fmap Just . flagToList)) - , option - "" - ["hoogle"] - "Generate a hoogle database" - haddockProjectHoogle - (\v flags -> flags{haddockProjectHoogle = v}) - trueArg - , option - "" - ["html-location"] - "Location of HTML documentation for pre-requisite packages" - haddockProjectHtmlLocation - (\v flags -> flags{haddockProjectHtmlLocation = v}) - (reqArgFlag "URL") - , option - "" - ["executables"] - "Run haddock for Executables targets" - haddockProjectExecutables - (\v flags -> flags{haddockProjectExecutables = v}) - trueArg - , option - "" - ["tests"] - "Run haddock for Test Suite targets" - haddockProjectTestSuites - (\v flags -> flags{haddockProjectTestSuites = v}) - trueArg - , option - "" - ["benchmarks"] - "Run haddock for Benchmark targets" - haddockProjectBenchmarks - (\v flags -> flags{haddockProjectBenchmarks = v}) - trueArg - , option - "" - ["foreign-libraries"] - "Run haddock for Foreign Library targets" - haddockProjectForeignLibs - (\v flags -> flags{haddockProjectForeignLibs = v}) - trueArg - , option - "" - ["internal"] - "Run haddock for internal modules and include all symbols" - haddockProjectInternal - (\v flags -> flags{haddockProjectInternal = v}) - trueArg - , option - "" - ["css"] - "Use PATH as the haddock stylesheet" - haddockProjectCss - (\v flags -> flags{haddockProjectCss = v}) - (reqArgFlag "PATH") - , option - "" - ["hscolour-css"] - "Use PATH as the HsColour stylesheet" - haddockProjectHscolourCss - (\v flags -> flags{haddockProjectHscolourCss = v}) - (reqArgFlag "PATH") - , option - "" - ["keep-temp-files"] - "Keep temporary files" - haddockProjectKeepTempFiles - (\b flags -> flags{haddockProjectKeepTempFiles = b}) - trueArg - , optionVerbosity - haddockProjectVerbosity - (\v flags -> flags{haddockProjectVerbosity = v}) - , option - "" - ["lib"] - "location of Haddocks static / auxiliary files" - haddockProjectLib - (\v flags -> flags{haddockProjectLib = v}) - (reqArgFlag "DIR") - , option - "" - ["output-dir"] - "Generate haddock documentation into this directory. This flag is provided as a technology preview and is subject to change in the next releases." - haddockProjectOutputDir - (\v flags -> flags{haddockProjectOutputDir = v}) - (reqArgFlag "DIR") - ] +haddockProjectOptions showOrParseArgs = + withCommonSetupOptions + haddockProjectCommonFlags + (\c f -> f{haddockProjectCommonFlags = c}) + showOrParseArgs + [ option + "" + ["hackage"] + ( concat + [ "A short-cut option to build documentation linked to hackage." + ] + ) + haddockProjectHackage + (\v flags -> flags{haddockProjectHackage = v}) + trueArg + , option + "" + ["output"] + "Output directory" + haddockProjectDir + (\v flags -> flags{haddockProjectDir = v}) + (optArg' "DIRECTORY" maybeToFlag (fmap Just . flagToList)) + , option + "" + ["prologue"] + "File path to a prologue file in haddock format" + haddockProjectPrologue + (\v flags -> flags{haddockProjectPrologue = v}) + (optArg' "PATH" maybeToFlag (fmap Just . flagToList)) + , option + "" + ["hoogle"] + "Generate a hoogle database" + haddockProjectHoogle + (\v flags -> flags{haddockProjectHoogle = v}) + trueArg + , option + "" + ["html-location"] + "Location of HTML documentation for pre-requisite packages" + haddockProjectHtmlLocation + (\v flags -> flags{haddockProjectHtmlLocation = v}) + (reqArgFlag "URL") + , option + "" + ["executables"] + "Run haddock for Executables targets" + haddockProjectExecutables + (\v flags -> flags{haddockProjectExecutables = v}) + trueArg + , option + "" + ["tests"] + "Run haddock for Test Suite targets" + haddockProjectTestSuites + (\v flags -> flags{haddockProjectTestSuites = v}) + trueArg + , option + "" + ["benchmarks"] + "Run haddock for Benchmark targets" + haddockProjectBenchmarks + (\v flags -> flags{haddockProjectBenchmarks = v}) + trueArg + , option + "" + ["foreign-libraries"] + "Run haddock for Foreign Library targets" + haddockProjectForeignLibs + (\v flags -> flags{haddockProjectForeignLibs = v}) + trueArg + , option + "" + ["all", "haddock-all"] + "Run haddock for all targets" + ( \f -> + allFlags + [ haddockProjectExecutables f + , haddockProjectTestSuites f + , haddockProjectBenchmarks f + , haddockProjectForeignLibs f + ] + ) + ( \v flags -> + flags + { haddockProjectExecutables = v + , haddockProjectTestSuites = v + , haddockProjectBenchmarks = v + , haddockProjectForeignLibs = v + } + ) + trueArg + , option + "" + ["internal"] + "Run haddock for internal modules and include all symbols" + haddockProjectInternal + (\v flags -> flags{haddockProjectInternal = v}) + trueArg + , option + "" + ["css"] + "Use PATH as the haddock stylesheet" + haddockProjectCss + (\v flags -> flags{haddockProjectCss = v}) + (reqArgFlag "PATH") + , option + "" + ["hscolour-css"] + "Use PATH as the HsColour stylesheet" + haddockProjectHscolourCss + (\v flags -> flags{haddockProjectHscolourCss = v}) + (reqArgFlag "PATH") + , option + "" + ["resources-dir"] + "location of Haddocks static / auxiliary files" + haddockProjectResourcesDir + (\v flags -> flags{haddockProjectResourcesDir = v}) + (reqArgFlag "DIR") + , option + "" + ["use-unicode"] + "Pass --use-unicode option to haddock" + haddockProjectUseUnicode + (\v flags -> flags{haddockProjectUseUnicode = v}) + trueArg + ] emptyHaddockProjectFlags :: HaddockProjectFlags emptyHaddockProjectFlags = mempty diff --git a/Cabal/src/Distribution/Simple/Setup/Hscolour.hs b/Cabal/src/Distribution/Simple/Setup/Hscolour.hs index 1c62c2dedca..56632d5d2f7 100644 --- a/Cabal/src/Distribution/Simple/Setup/Hscolour.hs +++ b/Cabal/src/Distribution/Simple/Setup/Hscolour.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -58,7 +57,7 @@ data HscolourFlags = HscolourFlags , hscolourBenchmarks :: Flag Bool , hscolourForeignLibs :: Flag Bool } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) pattern HscolourCommonFlags :: Flag Verbosity diff --git a/Cabal/src/Distribution/Simple/Setup/Install.hs b/Cabal/src/Distribution/Simple/Setup/Install.hs index eb909612c6d..627bd8b4b58 100644 --- a/Cabal/src/Distribution/Simple/Setup/Install.hs +++ b/Cabal/src/Distribution/Simple/Setup/Install.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} diff --git a/Cabal/src/Distribution/Simple/Setup/Register.hs b/Cabal/src/Distribution/Simple/Setup/Register.hs index e3eb8d6ac7a..f7b9e80e007 100644 --- a/Cabal/src/Distribution/Simple/Setup/Register.hs +++ b/Cabal/src/Distribution/Simple/Setup/Register.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -58,11 +57,11 @@ data RegisterFlags = RegisterFlags { registerCommonFlags :: !CommonSetupFlags , regPackageDB :: Flag PackageDB , regGenScript :: Flag Bool - , regGenPkgConf :: Flag (Maybe FilePath) + , regGenPkgConf :: Flag (Maybe (SymbolicPath Pkg (Dir PkgConf))) , regInPlace :: Flag Bool , regPrintId :: Flag Bool } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) pattern RegisterCommonFlags :: Flag Verbosity @@ -154,7 +153,7 @@ registerCommand = "instead of registering, generate a package registration file/directory" regGenPkgConf (\v flags -> flags{regGenPkgConf = v}) - (optArg' "PKG" Flag flagToList) + (optArg' "PKG" (Flag . fmap makeSymbolicPath) (flagToList . fmap (fmap getSymbolicPath))) , option "" ["print-ipid"] diff --git a/Cabal/src/Distribution/Simple/Setup/Repl.hs b/Cabal/src/Distribution/Simple/Setup/Repl.hs index 4321a9466cb..fbe15df56eb 100644 --- a/Cabal/src/Distribution/Simple/Setup/Repl.hs +++ b/Cabal/src/Distribution/Simple/Setup/Repl.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -59,7 +58,7 @@ data ReplOptions = ReplOptions , replOptionsNoLoad :: Flag Bool , replOptionsFlagOutput :: Flag FilePath } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) pattern ReplCommonFlags :: Flag Verbosity @@ -102,7 +101,7 @@ data ReplFlags = ReplFlags , replReload :: Flag Bool , replReplOptions :: ReplOptions } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) instance Binary ReplFlags instance Structured ReplFlags @@ -133,8 +132,7 @@ replCommand progDb = , commandDescription = Just $ \pname -> wrapText $ "If the current directory contains no package, ignores COMPONENT " - ++ "parameters and opens an interactive interpreter session; if a " - ++ "sandbox is present, its package database will be used.\n" + ++ "parameters and opens an interactive interpreter session.\n" ++ "\n" ++ "Otherwise, (re)configures with the given or default flags, and " ++ "loads the interpreter with the relevant modules. For executables, " diff --git a/Cabal/src/Distribution/Simple/Setup/SDist.hs b/Cabal/src/Distribution/Simple/Setup/SDist.hs index 6caf8e51e52..218d1e9f209 100644 --- a/Cabal/src/Distribution/Simple/Setup/SDist.hs +++ b/Cabal/src/Distribution/Simple/Setup/SDist.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -57,7 +56,7 @@ data SDistFlags = SDistFlags , sDistDirectory :: Flag FilePath , sDistListSources :: Flag FilePath } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) pattern SDistCommonFlags :: Flag Verbosity diff --git a/Cabal/src/Distribution/Simple/Setup/Test.hs b/Cabal/src/Distribution/Simple/Setup/Test.hs index e4c2706eed6..45f77c938e0 100644 --- a/Cabal/src/Distribution/Simple/Setup/Test.hs +++ b/Cabal/src/Distribution/Simple/Setup/Test.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE PatternSynonyms #-} @@ -61,7 +60,7 @@ import qualified Text.PrettyPrint as Disp -- ------------------------------------------------------------ data TestShowDetails = Never | Failures | Always | Streaming | Direct - deriving (Eq, Ord, Enum, Bounded, Generic, Show, Typeable) + deriving (Eq, Ord, Enum, Bounded, Generic, Show) instance Binary TestShowDetails instance Structured TestShowDetails @@ -102,7 +101,7 @@ data TestFlags = TestFlags , -- TODO: think about if/how options are passed to test exes testOptions :: [PathTemplate] } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) pattern TestCommonFlags :: Flag Verbosity diff --git a/Cabal/src/Distribution/Simple/SetupHooks/Errors.hs b/Cabal/src/Distribution/Simple/SetupHooks/Errors.hs index 11577f3506b..22b070e5d41 100644 --- a/Cabal/src/Distribution/Simple/SetupHooks/Errors.hs +++ b/Cabal/src/Distribution/Simple/SetupHooks/Errors.hs @@ -20,7 +20,6 @@ module Distribution.Simple.SetupHooks.Errors , RulesException (..) , setupHooksExceptionCode , setupHooksExceptionMessage - , showLocs ) where import Distribution.PackageDescription @@ -35,8 +34,6 @@ import Data.List import qualified Data.List.NonEmpty as NE import qualified Data.Tree as Tree -import System.FilePath (normalise, ()) - -------------------------------------------------------------------------------- -- | An error involving the @SetupHooks@ module of a package with @@ -137,7 +134,7 @@ rulesExceptionMessage = \case CantFindSourceForRuleDependencies _r deps -> unlines $ ("Pre-build rules: can't find source for rule " ++ what ++ ":") - : map (\d -> " - " <> locPath d) depsL + : map (\d -> " - " <> show d) depsL where depsL = NE.toList deps what @@ -148,7 +145,7 @@ rulesExceptionMessage = \case MissingRuleOutputs _r reslts -> unlines $ ("Pre-build rule did not generate expected result" <> plural <> ":") - : map (\res -> " - " <> locPath res) resultsL + : map (\res -> " - " <> show res) resultsL where resultsL = NE.toList reslts plural @@ -181,13 +178,7 @@ rulesExceptionMessage = \case where showRule :: RuleBinary -> String showRule (Rule{staticDependencies = deps, results = reslts}) = - "Rule: " ++ showDeps deps ++ " --> " ++ showLocs (NE.toList reslts) - -locPath :: Location -> String -locPath (base, fp) = normalise $ base fp - -showLocs :: [Location] -> String -showLocs locs = "[" ++ intercalate ", " (map locPath locs) ++ "]" + "Rule: " ++ showDeps deps ++ " --> " ++ show (NE.toList reslts) showDeps :: [Rule.Dependency] -> String showDeps deps = "[" ++ intercalate ", " (map showDep deps) ++ "]" @@ -196,7 +187,7 @@ showDep :: Rule.Dependency -> String showDep = \case RuleDependency (RuleOutput{outputOfRule = rId, outputIndex = i}) -> "(" ++ show rId ++ ")[" ++ show i ++ "]" - FileDependency loc -> locPath loc + FileDependency loc -> show loc cannotApplyComponentDiffCode :: CannotApplyComponentDiffReason -> Int cannotApplyComponentDiffCode = \case diff --git a/Cabal/src/Distribution/Simple/SetupHooks/Internal.hs b/Cabal/src/Distribution/Simple/SetupHooks/Internal.hs index 25e2f39b1ad..0057bbee9a1 100644 --- a/Cabal/src/Distribution/Simple/SetupHooks/Internal.hs +++ b/Cabal/src/Distribution/Simple/SetupHooks/Internal.hs @@ -7,7 +7,6 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} -{-# LANGUAGE TupleSections #-} {-# LANGUAGE TypeApplications #-} -- | @@ -89,7 +88,6 @@ import Distribution.Compat.Prelude import Prelude () import Distribution.Compat.Lens ((.~)) -import Distribution.ModuleName import Distribution.PackageDescription import Distribution.Simple.BuildPaths import Distribution.Simple.Compiler (Compiler (..)) @@ -110,7 +108,7 @@ import Distribution.Simple.SetupHooks.Rule import qualified Distribution.Simple.SetupHooks.Rule as Rule import Distribution.Simple.Utils import Distribution.System (Platform (..)) -import Distribution.Utils.Path (getSymbolicPath) +import Distribution.Utils.Path import qualified Distribution.Types.BuildInfo.Lens as BI (buildInfo) import Distribution.Types.LocalBuildConfig as LBC @@ -125,7 +123,6 @@ import qualified Data.Map as Map import qualified Data.Set as Set import System.Directory (doesFileExist) -import System.FilePath (normalise, (<.>), ()) -------------------------------------------------------------------------------- -- SetupHooks @@ -898,12 +895,12 @@ executeRulesUserOrSystem scope runDepsCmdData runCmdData verbosity lbi tgtInfo a -- SetupHooks TODO: maybe requiring all generated modules to appear -- in autogen-modules is excessive; we can look through all modules instead. autogenModPaths = - map (\m -> toFilePath m <.> "hs") $ + map (\m -> moduleNameSymbolicPath m <.> "hs") $ autogenModules $ componentBuildInfo $ targetComponent tgtInfo leafRule_maybe (rId, r) = - if any ((r `ruleOutputsLocation`) . (compAutogenDir,)) autogenModPaths + if any ((r `ruleOutputsLocation`) . (Location compAutogenDir)) autogenModPaths then vertexFromRuleId rId else Nothing leafRules = mapMaybe leafRule_maybe $ Map.toList allRules @@ -927,7 +924,10 @@ executeRulesUserOrSystem scope runDepsCmdData runCmdData verbosity lbi tgtInfo a warn verbosity $ unlines $ "The following rules are not demanded and will not be run:" - : [ " - " ++ show rId ++ ", generating " ++ showLocs (NE.toList $ results r) + : concat + [ [ " - " ++ show rId ++ "," + , " generating " ++ show (NE.toList $ results r) + ] | v <- Set.toList nonDemandedRuleVerts , let (r, rId, _) = ruleFromVertex v ] @@ -935,7 +935,8 @@ executeRulesUserOrSystem scope runDepsCmdData runCmdData verbosity lbi tgtInfo a , " - Some autogenerated modules were not declared" , " (in the package description or in the pre-configure hooks)" , " - The output location for an autogenerated module is incorrect," - , " (e.g. it is not in the appropriate 'autogenComponentModules' directory)" + , " (e.g. the file extension is incorrect, or" + , " it is not in the appropriate 'autogenComponentModules' directory)" ] -- Run all the demanded rules, in dependency order. @@ -955,7 +956,7 @@ executeRulesUserOrSystem scope runDepsCmdData runCmdData verbosity lbi tgtInfo a allDeps = staticDeps ++ fromMaybe [] (fst <$> mbDyn) -- Check that the dependencies the rule expects are indeed present. resolvedDeps <- traverse (resolveDependency verbosity rId allRules) allDeps - missingRuleDeps <- filterM missingDep resolvedDeps + missingRuleDeps <- filterM (missingDep mbWorkDir) resolvedDeps case NE.nonEmpty missingRuleDeps of Just missingDeps -> errorOut $ CantFindSourceForRuleDependencies (toRuleBinary r) missingDeps @@ -965,7 +966,7 @@ executeRulesUserOrSystem scope runDepsCmdData runCmdData verbosity lbi tgtInfo a runCmdData rId execCmd -- Throw an error if running the action did not result in -- the generation of outputs that we expected it to. - missingRuleResults <- filterM missingDep $ NE.toList reslts + missingRuleResults <- filterM (missingDep mbWorkDir) $ NE.toList reslts for_ (NE.nonEmpty missingRuleResults) $ \missingResults -> errorOut $ MissingRuleOutputs (toRuleBinary r) missingResults return () @@ -975,7 +976,8 @@ executeRulesUserOrSystem scope runDepsCmdData runCmdData verbosity lbi tgtInfo a SUser -> ruleBinary SSystem -> id clbi = targetCLBI tgtInfo - compAutogenDir = getSymbolicPath $ autogenComponentModulesDir lbi clbi + mbWorkDir = mbWorkDirLBI lbi + compAutogenDir = autogenComponentModulesDir lbi clbi errorOut e = dieWithException verbosity $ SetupHooksException $ @@ -1016,11 +1018,14 @@ ruleOutputsLocation (Rule{results = rs}) fp = any (\out -> normaliseLocation out == normaliseLocation fp) rs normaliseLocation :: Location -> Location -normaliseLocation (base, rel) = (normalise base, normalise rel) +normaliseLocation (Location base rel) = + Location (normaliseSymbolicPath base) (normaliseSymbolicPath rel) -- | Is the file we depend on missing? -missingDep :: Location -> IO Bool -missingDep (base, fp) = not <$> doesFileExist (base fp) +missingDep :: Maybe (SymbolicPath CWD (Dir Pkg)) -> Location -> IO Bool +missingDep mbWorkDir loc = not <$> doesFileExist fp + where + fp = interpretSymbolicPath mbWorkDir (location loc) -------------------------------------------------------------------------------- -- Compatibility with HookedBuildInfo. diff --git a/Cabal/src/Distribution/Simple/SetupHooks/Rule.hs b/Cabal/src/Distribution/Simple/SetupHooks/Rule.hs index afbabb859f6..70b188cf437 100644 --- a/Cabal/src/Distribution/Simple/SetupHooks/Rule.hs +++ b/Cabal/src/Distribution/Simple/SetupHooks/Rule.hs @@ -9,11 +9,10 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE InstanceSigs #-} -{-# LANGUAGE KindSignatures #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiWayIf #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE PatternSynonyms #-} +{-# LANGUAGE PolyKinds #-} {-# LANGUAGE QuantifiedConstraints #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -65,7 +64,8 @@ module Distribution.Simple.SetupHooks.Rule , noRules -- ** Rule inputs/outputs - , Location + , Location (..) + , location -- ** File/directory monitoring , MonitorFilePath (..) @@ -95,9 +95,22 @@ import Distribution.ModuleName ) import Distribution.Simple.FileMonitor.Types import Distribution.Types.UnitId +import Distribution.Utils.Path + ( FileOrDir (..) + , Pkg + , RelativePath + , SymbolicPath + , getSymbolicPath + , () + ) import Distribution.Utils.ShortText ( ShortText ) +import Distribution.Utils.Structured + ( Structure (..) + , Structured (..) + , nominalStructure + ) import Distribution.Verbosity ( Verbosity ) @@ -130,8 +143,13 @@ import Data.Type.Equality ( (:~~:) (HRefl) , type (==) ) -import GHC.Show (showCommaSpace) +import GHC.Show + ( showCommaSpace + ) import GHC.StaticPtr +import GHC.TypeLits + ( Symbol + ) import System.IO.Unsafe ( unsafePerformIO ) @@ -145,6 +163,10 @@ import qualified Type.Reflection as Typeable , pattern App ) +import System.FilePath + ( normalise + ) + -------------------------------------------------------------------------------- {- Note [Fine-grained hooks] @@ -254,7 +276,7 @@ deriving anyclass instance Binary (RuleData System) -- | Trimmed down 'Show' instance, mostly for error messages. instance Show RuleBinary where show (Rule{staticDependencies = deps, results = reslts, ruleCommands = cmds}) = - what ++ ": " ++ showDeps deps ++ " --> " ++ showLocs (NE.toList reslts) + what ++ ": " ++ showDeps deps ++ " --> " ++ show (NE.toList reslts) where what = case cmds of StaticRuleCommand{} -> "Rule" @@ -266,8 +288,6 @@ instance Show RuleBinary where RuleDependency (RuleOutput{outputOfRule = rId, outputIndex = i}) -> "(" ++ show rId ++ ")[" ++ show i ++ "]" FileDependency loc -> show loc - showLocs :: [Location] -> String - showLocs locs = "[" ++ intercalate ", " (map show locs) ++ "]" -- | A rule with static dependencies. -- @@ -322,13 +342,60 @@ dynamicRule dict depsCmd action dep res = -- consisting of a base directory and of a file path relative to that base -- directory path. -- --- In practice, this will be something like @( dir, toFilePath modName )@, +-- In practice, this will be something like @'Location' dir ('moduleNameSymbolicPath' mod <.> "hs")@, -- where: -- -- - for a file dependency, @dir@ is one of the Cabal search directories, -- - for an output, @dir@ is a directory such as @autogenComponentModulesDir@ -- or @componentBuildDir@. -type Location = (FilePath, FilePath) +data Location where + Location + :: { locationBaseDir :: !(SymbolicPath Pkg (Dir baseDir)) + -- ^ Base directory. + , locationRelPath :: !(RelativePath baseDir File) + -- ^ File path relative to base directory (including file extension). + } + -> Location + +instance Eq Location where + Location b1 l1 == Location b2 l2 = + (getSymbolicPath b1 == getSymbolicPath b2) + && (getSymbolicPath l1 == getSymbolicPath l2) +instance Ord Location where + compare (Location b1 l1) (Location b2 l2) = + compare + (getSymbolicPath b1, getSymbolicPath l1) + (getSymbolicPath b2, getSymbolicPath l2) +instance Binary Location where + put (Location base loc) = put (base, loc) + get = Location <$> get <*> get +instance Structured Location where + structure _ = + Structure + tr + 0 + (show tr) + [ + ( "Location" + , + [ nominalStructure $ Proxy @(SymbolicPath Pkg (Dir (Tok "baseDir"))) + , nominalStructure $ Proxy @(RelativePath (Tok "baseDir") File) + ] + ) + ] + where + tr = Typeable.SomeTypeRep $ Typeable.typeRep @Location + +-- | Get a (relative or absolute) un-interpreted path to a 'Location'. +location :: Location -> SymbolicPath Pkg File +location (Location base rel) = base rel + +instance Show Location where + showsPrec p (Location base rel) = + showParen (p > 5) $ + showString (normalise $ getSymbolicPath base) + . showString " " + . showString (normalise $ getSymbolicPath rel) -- The reason for splitting it up this way is that some pre-processors don't -- simply generate one output @.hs@ file from one input file, but have @@ -543,9 +610,9 @@ mkCommand -> StaticPtr (arg -> res) -> arg -> Command arg res -mkCommand dict actionPtr arg = +mkCommand dict action arg = Command - { actionPtr = UserStatic actionPtr + { actionPtr = UserStatic action , actionArg = ScopedArgument arg , cmdInstances = UserStatic dict } @@ -654,7 +721,7 @@ on the build-system side, we don't have access to any of the types, and thus don how much to read in order to reconstruct the associated opaque 'ByteString'. To ensure we always serialise/deserialise including the length of the data, the 'ScopedArgument' newtype is used, with a custom 'Binary' instance that always -incldues the length. We use this newtype: +includes the length. We use this newtype: - in the definition of 'CommandData', for arguments to rules, - in the definition of 'DepsRes', for the result of dynamic dependency computations. @@ -755,9 +822,9 @@ runRuleDynDepsCmd = \case } | Dict <- deRefStaticPtr instsPtr -> Just $ do - (deps, depsRes) <- runCommand depsCmd + (deps, dynDeps) <- runCommand depsCmd -- See Note [Hooks Binary instances] - return $ (deps, Binary.encode $ ScopedArgument @User depsRes) + return $ (deps, Binary.encode $ ScopedArgument @User dynDeps) -- | Project out the command for running the rule, passing in the result of -- the dependency computation if there was one. @@ -1015,6 +1082,10 @@ instance } _ -> error "internal error when decoding dynamic rule commands" +-- | A token constructor used to define 'Structured' instances on types +-- that involve existential quantification. +data family Tok (arg :: Symbol) :: k + instance ( forall res. Binary (ruleCmd System LBS.ByteString res) , Binary (deps System LBS.ByteString LBS.ByteString) diff --git a/Cabal/src/Distribution/Simple/ShowBuildInfo.hs b/Cabal/src/Distribution/Simple/ShowBuildInfo.hs index 493c972ae8a..ac83518aa38 100644 --- a/Cabal/src/Distribution/Simple/ShowBuildInfo.hs +++ b/Cabal/src/Distribution/Simple/ShowBuildInfo.hs @@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE TypeApplications #-} -- | -- This module defines a simple JSON-based format for exporting basic @@ -91,7 +90,7 @@ import Distribution.Verbosity -- | Construct a JSON document describing the build information for a -- package. mkBuildInfo - :: FilePath + :: AbsolutePath (Dir Pkg) -- ^ The source directory of the package -> PackageDescription -- ^ Mostly information from the .cabal file @@ -139,7 +138,7 @@ mkCompilerInfo compilerProgram compilerInfo = , "path" .= JsonString (programPath compilerProgram) ] -mkComponentInfo :: FilePath -> PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> ([String], Json) +mkComponentInfo :: AbsolutePath (Dir Pkg) -> PackageDescription -> LocalBuildInfo -> ComponentLocalBuildInfo -> ([String], Json) mkComponentInfo wdir pkg_descr lbi clbi = ( warnings , JsonObject $ @@ -150,7 +149,7 @@ mkComponentInfo wdir pkg_descr lbi clbi = , "modules" .= JsonArray (map (JsonString . display) modules) , "src-files" .= JsonArray (map (JsonString . getSymbolicPath) sourceFiles) , "hs-src-dirs" .= JsonArray (map (JsonString . prettyShow) $ hsSourceDirs bi) - , "src-dir" .= JsonString (addTrailingPathSeparator wdir) + , "src-dir" .= JsonString (addTrailingPathSeparator (getAbsolutePath wdir)) ] <> cabalFile ) diff --git a/Cabal/src/Distribution/Simple/SrcDist.hs b/Cabal/src/Distribution/Simple/SrcDist.hs index eb9096271ef..67f901bf7fb 100644 --- a/Cabal/src/Distribution/Simple/SrcDist.hs +++ b/Cabal/src/Distribution/Simple/SrcDist.hs @@ -264,6 +264,10 @@ listPackageSources' verbosity rip mbWorkDir pkg_descr pps = $ \filename -> fmap (coerceSymbolicPath . relativeSymbolicPath) <$> matchDirFileGlobWithDie verbosity rip (specVersion pkg_descr) mbWorkDir filename + , -- Extra files. + fmap concat . for (extraFiles pkg_descr) $ \fpath -> + fmap relativeSymbolicPath + <$> matchDirFileGlobWithDie verbosity rip (specVersion pkg_descr) mbWorkDir fpath , -- License file(s). return (map (relativeSymbolicPath . coerceSymbolicPath) $ licenseFiles pkg_descr) , -- Install-include files, without autogen-include files diff --git a/Cabal/src/Distribution/Simple/Test.hs b/Cabal/src/Distribution/Simple/Test.hs index c994fb3d540..5b7a6daa718 100644 --- a/Cabal/src/Distribution/Simple/Test.hs +++ b/Cabal/src/Distribution/Simple/Test.hs @@ -81,7 +81,7 @@ test args pkg_descr lbi0 flags = do enabledTests = LBI.enabledTestLBIs pkg_descr lbi -- We must add the internalPkgDB to the package database stack to lookup -- the path to HPC dirs of libraries local to this package - internalPkgDb = i $ internalPackageDBPath lbi0 distPref + internalPkgDb = internalPackageDBPath lbi0 distPref lbi = lbi0{withPackageDB = withPackageDB lbi0 ++ [SpecificPackageDB internalPkgDb]} doTest diff --git a/Cabal/src/Distribution/Simple/UHC.hs b/Cabal/src/Distribution/Simple/UHC.hs index af085ef3a7c..aa41388c6d0 100644 --- a/Cabal/src/Distribution/Simple/UHC.hs +++ b/Cabal/src/Distribution/Simple/UHC.hs @@ -113,14 +113,15 @@ uhcLanguageExtensions = getInstalledPackages :: Verbosity -> Compiler - -> PackageDBStack + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBStackX (SymbolicPath from (Dir PkgDB)) -> ProgramDb -> IO InstalledPackageIndex -getInstalledPackages verbosity comp packagedbs progdb = do +getInstalledPackages verbosity comp mbWorkDir packagedbs progdb = do let compilerid = compilerId comp systemPkgDir <- getGlobalPackageDir verbosity progdb userPkgDir <- getUserPackageDir - let pkgDirs = nub (concatMap (packageDbPaths userPkgDir systemPkgDir) packagedbs) + let pkgDirs = nub (concatMap (packageDbPaths userPkgDir systemPkgDir mbWorkDir) packagedbs) -- putStrLn $ "pkgdirs: " ++ show pkgDirs pkgs <- liftM (map addBuiltinVersions . concat) $ @@ -154,12 +155,17 @@ getUserPackageDir = do homeDir <- getHomeDirectory return $ homeDir ".cabal" "lib" -- TODO: determine in some other way -packageDbPaths :: FilePath -> FilePath -> PackageDB -> [FilePath] -packageDbPaths user system db = +packageDbPaths + :: FilePath + -> FilePath + -> Maybe (SymbolicPath CWD (Dir from)) + -> PackageDBX (SymbolicPath from (Dir PkgDB)) + -> [FilePath] +packageDbPaths user system mbWorkDir db = case db of GlobalPackageDB -> [system] UserPackageDB -> [user] - SpecificPackageDB path -> [path] + SpecificPackageDB path -> [interpretSymbolicPath mbWorkDir path] -- | Hack to add version numbers to UHC-built-in packages. This should sooner or -- later be fixed on the UHC side. @@ -209,7 +215,7 @@ buildLib buildLib verbosity pkg_descr lbi lib clbi = do systemPkgDir <- getGlobalPackageDir verbosity (withPrograms lbi) userPkgDir <- getUserPackageDir - let runUhcProg = runDbProgram verbosity uhcProgram (withPrograms lbi) + let runUhcProg = runDbProgramCwd verbosity (mbWorkDirLBI lbi) uhcProgram (withPrograms lbi) let uhcArgs = -- set package name ["--pkg-build=" ++ prettyShow (packageId pkg_descr)] @@ -245,8 +251,8 @@ buildExe verbosity _pkg_descr lbi exe clbi = do userPkgDir <- getUserPackageDir let mbWorkDir = mbWorkDirLBI lbi srcMainPath <- findFileCwd verbosity mbWorkDir (hsSourceDirs $ buildInfo exe) (modulePath exe) - let runUhcProg = runDbProgram verbosity uhcProgram (withPrograms lbi) - i = interpretSymbolicPathLBI lbi -- See Note [Symbolic paths] in Distribution.Utils.Path + let runUhcProg = runDbProgramCwd verbosity (mbWorkDirLBI lbi) uhcProgram (withPrograms lbi) + u = interpretSymbolicPathCWD uhcArgs = -- common flags lib/exe constructUHCCmdLine @@ -258,9 +264,9 @@ buildExe verbosity _pkg_descr lbi exe clbi = do (buildDir lbi) verbosity -- output file - ++ ["--output", i $ buildDir lbi makeRelativePathEx (prettyShow (exeName exe))] + ++ ["--output", u $ buildDir lbi makeRelativePathEx (prettyShow (exeName exe))] -- main source module - ++ [i $ srcMainPath] + ++ [u $ srcMainPath] runUhcProg uhcArgs constructUHCCmdLine @@ -291,14 +297,14 @@ constructUHCCmdLine user system lbi bi clbi odir verbosity = ++ ["--package=uhcbase"] ++ ["--package=" ++ prettyShow (mungedName pkgid) | (_, pkgid) <- componentPackageDeps clbi] -- search paths - ++ ["-i" ++ i odir] - ++ ["-i" ++ i l | l <- nub (hsSourceDirs bi)] - ++ ["-i" ++ i (autogenComponentModulesDir lbi clbi)] - ++ ["-i" ++ i (autogenPackageModulesDir lbi)] + ++ ["-i" ++ u odir] + ++ ["-i" ++ u l | l <- nub (hsSourceDirs bi)] + ++ ["-i" ++ u (autogenComponentModulesDir lbi clbi)] + ++ ["-i" ++ u (autogenPackageModulesDir lbi)] -- cpp options ++ ["--optP=" ++ opt | opt <- cppOptions bi] -- output path - ++ ["--odir=" ++ i odir] + ++ ["--odir=" ++ u odir] -- optimization ++ ( case withOptimization lbi of NoOptimisation -> ["-O0"] @@ -306,13 +312,13 @@ constructUHCCmdLine user system lbi bi clbi odir verbosity = MaximumOptimisation -> ["-O2"] ) where - i = interpretSymbolicPathLBI lbi -- See Note [Symbolic paths] in Distribution.Utils.Path + u = interpretSymbolicPathCWD -- See Note [Symbolic paths] in Distribution.Utils.Path uhcPackageDbOptions :: FilePath -> FilePath -> PackageDBStack -> [String] uhcPackageDbOptions user system db = map (\x -> "--pkg-searchpath=" ++ x) - (concatMap (packageDbPaths user system) db) + (concatMap (packageDbPaths user system Nothing) db) -- ----------------------------------------------------------------------------- -- Installation @@ -348,16 +354,17 @@ uhcPackageSubDir compilerid = compilerid uhcTarget uhcTargetVariant registerPackage :: Verbosity + -> Maybe (SymbolicPath CWD (Dir from)) -> Compiler -> ProgramDb - -> PackageDBStack + -> PackageDBStackS from -> InstalledPackageInfo -> IO () -registerPackage verbosity comp progdb packageDbs installedPkgInfo = do +registerPackage verbosity mbWorkDir comp progdb packageDbs installedPkgInfo = do dbdir <- case registrationPackageDB packageDbs of GlobalPackageDB -> getGlobalPackageDir verbosity progdb UserPackageDB -> getUserPackageDir - SpecificPackageDB dir -> return dir + SpecificPackageDB dir -> return (interpretSymbolicPath mbWorkDir dir) let pkgdir = dbdir uhcPackageDir (prettyShow pkgid) (prettyShow compilerid) createDirectoryIfMissingVerbose verbosity True pkgdir writeUTF8File diff --git a/Cabal/src/Distribution/Simple/Utils.hs b/Cabal/src/Distribution/Simple/Utils.hs index 47caab077af..bdbb72435a3 100644 --- a/Cabal/src/Distribution/Simple/Utils.hs +++ b/Cabal/src/Distribution/Simple/Utils.hs @@ -1,7 +1,5 @@ -{-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE GADTs #-} @@ -9,6 +7,9 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} +#ifdef GIT_REV +{-# LANGUAGE TemplateHaskell #-} +#endif ----------------------------------------------------------------------------- @@ -28,6 +29,7 @@ -- various directory and file functions that do extra logging. module Distribution.Simple.Utils ( cabalVersion + , cabalGitInfo -- * logging and errors , dieNoVerbosity @@ -250,6 +252,7 @@ import System.Directory , getDirectoryContents , getModificationTime , getPermissions + , getTemporaryDirectory , removeDirectoryRecursive , removeFile ) @@ -286,6 +289,16 @@ import System.IO.Unsafe import qualified System.Process as Process import qualified Text.PrettyPrint as Disp +#ifdef GIT_REV +import Data.Either (isLeft) +import GitHash + ( giHash + , giBranch + , giCommitDate + , tGitInfoCwdTry + ) +#endif + -- We only get our own version number when we're building with ourselves cabalVersion :: Version #if defined(BOOTSTRAPPED_CABAL) @@ -296,6 +309,28 @@ cabalVersion = mkVersion [CABAL_VERSION] cabalVersion = mkVersion [3,0] --used when bootstrapping #endif +-- | +-- `Cabal` Git information. Only filled in if built in a Git tree in +-- developmnent mode and Template Haskell is available. +cabalGitInfo :: String +#ifdef GIT_REV +cabalGitInfo = concat [ "(commit " + , giHash' + , branchInfo + , ", " + , either (const "") giCommitDate gi' + , ")" + ] + where + gi' = $$tGitInfoCwdTry + giHash' = take 7 . either (const "") giHash $ gi' + branchInfo | isLeft gi' = "" + | either id giBranch gi' == "master" = "" + | otherwise = " on " <> either id giBranch gi' +#else +cabalGitInfo = "" +#endif + -- ---------------------------------------------------------------------------- -- Exception and logging utils @@ -387,9 +422,9 @@ die' verbosity msg = withFrozenCallStack $ do =<< pure . addErrorPrefix =<< prefixWithProgName msg --- Type which will be a wrapper for cabal -expections and cabal-install exceptions +-- Type which will be a wrapper for cabal -exceptions and cabal-install exceptions data VerboseException a = VerboseException CallStack POSIXTime Verbosity a - deriving (Show, Typeable) + deriving (Show) -- Function which will replace the existing die' call sites dieWithException :: (HasCallStack, Show a1, Typeable a1, Exception (VerboseException a1)) => Verbosity -> a1 -> IO a @@ -533,7 +568,7 @@ verbosityHandle verbosity warn :: Verbosity -> String -> IO () warn verbosity msg = warnMessage "Warning" verbosity msg --- | Like 'warn', but prepend @Error: …@ instead of @Waring: …@ before the +-- | Like 'warn', but prepend @Error: …@ instead of @Warning: …@ before the -- the message. Useful when you want to highlight the condition is an error -- but do not want to quit the program yet. warnError :: Verbosity -> String -> IO () @@ -1733,23 +1768,17 @@ defaultTempFileOptions = TempFileOptions{optKeepTempFiles = False} -- | Use a temporary filename that doesn't already exist withTempFile - :: FilePath - -- ^ Temp dir to create the file in - -> String + :: String -- ^ File name template. See 'openTempFile'. -> (FilePath -> Handle -> IO a) -> IO a -withTempFile tmpDir template f = withFrozenCallStack $ - withTempFileCwd Nothing (makeSymbolicPath tmpDir) template $ +withTempFile template f = withFrozenCallStack $ + withTempFileCwd template $ \fp h -> f (getSymbolicPath fp) h -- | Use a temporary filename that doesn't already exist. withTempFileCwd - :: Maybe (SymbolicPath CWD (Dir Pkg)) - -- ^ Working directory - -> SymbolicPath Pkg (Dir tmpDir) - -- ^ Temp dir to create the file in - -> String + :: String -- ^ File name template. See 'openTempFile'. -> (SymbolicPath Pkg File -> Handle -> IO a) -> IO a @@ -1758,20 +1787,17 @@ withTempFileCwd = withFrozenCallStack $ withTempFileEx defaultTempFileOptions -- | A version of 'withTempFile' that additionally takes a 'TempFileOptions' -- argument. withTempFileEx - :: forall a tmpDir + :: forall a . TempFileOptions - -> Maybe (SymbolicPath CWD (Dir Pkg)) - -- ^ Working directory - -> SymbolicPath Pkg (Dir tmpDir) - -- ^ Temp dir to create the file in -> String -- ^ File name template. See 'openTempFile'. -> (SymbolicPath Pkg File -> Handle -> IO a) -> IO a -withTempFileEx opts mbWorkDir tmpDir template action = +withTempFileEx opts template action = do + tmp <- getTemporaryDirectory withFrozenCallStack $ Exception.bracket - (openTempFile (i tmpDir) template) + (openTempFile tmp template) ( \(name, handle) -> do hClose handle unless (optKeepTempFiles opts) $ @@ -1779,12 +1805,11 @@ withTempFileEx opts mbWorkDir tmpDir template action = removeFile $ name ) - (withLexicalCallStack (\(fn, h) -> action (mkRelToPkg fn) h)) + (withLexicalCallStack (\(fn, h) -> action (mkRelToPkg tmp fn) h)) where - i = interpretSymbolicPath mbWorkDir -- See Note [Symbolic paths] in Distribution.Utils.Path - mkRelToPkg :: FilePath -> SymbolicPath Pkg File - mkRelToPkg fp = - tmpDir makeRelativePathEx (takeFileName fp) + mkRelToPkg :: FilePath -> FilePath -> SymbolicPath Pkg File + mkRelToPkg tmp fp = + makeSymbolicPath tmp makeRelativePathEx (takeFileName fp) -- 'openTempFile' returns a path of the form @i tmpDir fn@, but we -- want 'withTempFileEx' to return @tmpDir fn@. So we split off @@ -1950,6 +1975,13 @@ exeExtensions = case (buildArch, buildOS) of -- Possible improvement: on Windows, read the list of extensions from the -- PATHEXT environment variable. By default PATHEXT is ".com; .exe; .bat; -- .cmd". + -- + -- See also #10179. + -- + -- Also we cannot actually run @.bat@ files as we do now, because of + -- https://github.com/haskell/process/issues/140. If we detect one of those, + -- we should record that the program is a script and run a @Process.shell@ instead + -- of a @Process.proc@. (_, Windows) -> ["", "exe"] (_, Ghcjs) -> ["", "exe"] (Wasm32, _) -> ["", "wasm"] diff --git a/Cabal/src/Distribution/Types/ComponentLocalBuildInfo.hs b/Cabal/src/Distribution/Types/ComponentLocalBuildInfo.hs index 0728656620e..32f4aab473b 100644 --- a/Cabal/src/Distribution/Types/ComponentLocalBuildInfo.hs +++ b/Cabal/src/Distribution/Types/ComponentLocalBuildInfo.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TypeFamilies #-} @@ -6,6 +5,8 @@ module Distribution.Types.ComponentLocalBuildInfo ( ComponentLocalBuildInfo (..) , componentIsIndefinite , maybeComponentInstantiatedWith + , maybeComponentCompatPackageKey + , maybeComponentExposedModules ) where import Distribution.Compat.Prelude @@ -108,7 +109,7 @@ data ComponentLocalBuildInfo , componentExeDeps :: [UnitId] , componentInternalDeps :: [UnitId] } - deriving (Generic, Read, Show, Typeable) + deriving (Generic, Read, Show) instance Binary ComponentLocalBuildInfo instance Structured ComponentLocalBuildInfo @@ -126,3 +127,13 @@ maybeComponentInstantiatedWith :: ComponentLocalBuildInfo -> Maybe [(ModuleName, maybeComponentInstantiatedWith LibComponentLocalBuildInfo{componentInstantiatedWith = insts} = Just insts maybeComponentInstantiatedWith _ = Nothing + +maybeComponentCompatPackageKey :: ComponentLocalBuildInfo -> Maybe String +maybeComponentCompatPackageKey + LibComponentLocalBuildInfo{componentCompatPackageKey = key} = Just key +maybeComponentCompatPackageKey _ = Nothing + +maybeComponentExposedModules :: ComponentLocalBuildInfo -> Maybe [Installed.ExposedModule] +maybeComponentExposedModules + LibComponentLocalBuildInfo{componentExposedModules = exposed} = Just exposed +maybeComponentExposedModules _ = Nothing diff --git a/Cabal/src/Distribution/Types/DumpBuildInfo.hs b/Cabal/src/Distribution/Types/DumpBuildInfo.hs index 2b3dae8888f..99020febc35 100644 --- a/Cabal/src/Distribution/Types/DumpBuildInfo.hs +++ b/Cabal/src/Distribution/Types/DumpBuildInfo.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Types.DumpBuildInfo @@ -10,7 +9,7 @@ import Distribution.Compat.Prelude data DumpBuildInfo = NoDumpBuildInfo | DumpBuildInfo - deriving (Read, Show, Eq, Ord, Enum, Bounded, Generic, Typeable) + deriving (Read, Show, Eq, Ord, Enum, Bounded, Generic) instance Binary DumpBuildInfo instance Structured DumpBuildInfo diff --git a/Cabal/src/Distribution/Types/GivenComponent.hs b/Cabal/src/Distribution/Types/GivenComponent.hs index c8314311d89..c06fcbbfb4e 100644 --- a/Cabal/src/Distribution/Types/GivenComponent.hs +++ b/Cabal/src/Distribution/Types/GivenComponent.hs @@ -1,14 +1,15 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Types.GivenComponent ( GivenComponent (..) + , PromisedComponent (..) ) where import Distribution.Compat.Prelude import Distribution.Types.ComponentId import Distribution.Types.LibraryName +import Distribution.Types.PackageId import Distribution.Types.PackageName -- | A 'GivenComponent' represents a library depended on and explicitly @@ -23,7 +24,24 @@ data GivenComponent = GivenComponent -- only, not for any component , givenComponentId :: ComponentId } - deriving (Generic, Read, Show, Eq, Typeable) + deriving (Generic, Read, Show, Eq) instance Binary GivenComponent instance Structured GivenComponent + +-- | A 'PromisedComponent' represents a promised library depended on and explicitly +-- specified by the user/client with @--promised-dependency@ +-- +-- It enables Cabal to know which 'ComponentId' to associate with a library +-- +-- @since 3.14.0.0 +data PromisedComponent = PromisedComponent + { promisedComponentPackage :: PackageId + , promisedComponentName :: LibraryName -- --dependency is for libraries + -- only, not for any component + , promisedComponentId :: ComponentId + } + deriving (Generic, Read, Show, Eq) + +instance Binary PromisedComponent +instance Structured PromisedComponent diff --git a/Cabal/src/Distribution/Types/LocalBuildConfig.hs b/Cabal/src/Distribution/Types/LocalBuildConfig.hs index 9126d92f1eb..12648a8357b 100644 --- a/Cabal/src/Distribution/Types/LocalBuildConfig.hs +++ b/Cabal/src/Distribution/Types/LocalBuildConfig.hs @@ -2,8 +2,6 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} @@ -22,9 +20,9 @@ module Distribution.Types.LocalBuildConfig import Distribution.Compat.Prelude import Prelude () -import Distribution.Types.ComponentId import Distribution.Types.ComponentLocalBuildInfo import Distribution.Types.ComponentRequestedSpec +import Distribution.Types.GivenComponent import Distribution.Types.PackageDescription import Distribution.Types.UnitId @@ -101,7 +99,7 @@ data ComponentBuildDescr = ComponentBuildDescr -- ^ A map from component name to all matching -- components. These coincide with 'componentGraph' -- There may be more than one matching component because of backpack instantiations - , promisedPkgs :: Map (PackageName, ComponentName) ComponentId + , promisedPkgs :: Map (PackageName, ComponentName) PromisedComponent -- ^ The packages we were promised, but aren't already installed. -- MP: Perhaps this just needs to be a Set UnitId at this stage. , installedPkgs :: InstalledPackageIndex @@ -151,6 +149,8 @@ data BuildOptions = BuildOptions { withVanillaLib :: Bool -- ^ Whether to build normal libs. , withProfLib :: Bool + -- ^ Whether to build normal libs. + , withProfLibShared :: Bool -- ^ Whether to build profiling versions of libs. , withSharedLib :: Bool -- ^ Whether to build shared versions of libs. @@ -211,6 +211,7 @@ buildOptionsConfigFlags (BuildOptions{..}) = , configGHCiLib = toFlag $ withGHCiLib , configProfExe = toFlag $ withProfExe , configProfLib = toFlag $ withProfLib + , configProfShared = toFlag $ withProfLibShared , configProf = mempty , -- configProfDetail is for exe+lib, but overridden by configProfLibDetail -- so we specify both so we can specify independently diff --git a/Cabal/src/Distribution/Types/LocalBuildInfo.hs b/Cabal/src/Distribution/Types/LocalBuildInfo.hs index a5706fff09a..854f454dc87 100644 --- a/Cabal/src/Distribution/Types/LocalBuildInfo.hs +++ b/Cabal/src/Distribution/Types/LocalBuildInfo.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DuplicateRecordFields #-} {-# LANGUAGE FlexibleContexts #-} @@ -28,11 +27,12 @@ module Distribution.Types.LocalBuildInfo , withPackageDB , withVanillaLib , withProfLib - , withSharedLib - , withStaticLib + , withProfLibShared , withDynExe , withFullyStaticExe , withProfExe + , withSharedLib + , withStaticLib , withProfLibDetail , withProfExeDetail , withOptimization @@ -57,6 +57,7 @@ module Distribution.Types.LocalBuildInfo , buildDir , buildDirPBD , setupFlagsBuildDir + , distPrefLBI , packageRoot , progPrefix , progSuffix @@ -81,6 +82,7 @@ module Distribution.Types.LocalBuildInfo , neededTargetsInBuildOrder' , withNeededTargetsInBuildOrder' , testCoverage + , buildWays -- * Functions you SHOULD NOT USE (yet), but are defined here to @@ -100,6 +102,7 @@ import Prelude () import Distribution.Types.ComponentId import Distribution.Types.ComponentLocalBuildInfo import Distribution.Types.ComponentRequestedSpec +import Distribution.Types.GivenComponent import qualified Distribution.Types.LocalBuildConfig as LBC import Distribution.Types.PackageDescription import Distribution.Types.PackageId @@ -110,6 +113,7 @@ import Distribution.Utils.Path import Distribution.PackageDescription import Distribution.Pretty +import Distribution.Simple.BuildWay import Distribution.Simple.Compiler import Distribution.Simple.Flag import Distribution.Simple.InstallDirs hiding @@ -139,7 +143,7 @@ data LocalBuildInfo = NewLocalBuildInfo -- ^ Information about a package configuration -- that can be modified by the user at configuration time. } - deriving (Generic, Read, Show, Typeable) + deriving (Generic, Read, Show) {-# COMPLETE LocalBuildInfo #-} @@ -156,7 +160,7 @@ pattern LocalBuildInfo -> Maybe (SymbolicPath Pkg File) -> Graph ComponentLocalBuildInfo -> Map ComponentName [ComponentLocalBuildInfo] - -> Map (PackageName, ComponentName) ComponentId + -> Map (PackageName, ComponentName) PromisedComponent -> InstalledPackageIndex -> PackageDescription -> ProgramDb @@ -168,6 +172,7 @@ pattern LocalBuildInfo -> Bool -> Bool -> Bool + -> Bool -> ProfDetailLevel -> ProfDetailLevel -> OptimisationLevel @@ -200,6 +205,7 @@ pattern LocalBuildInfo , withPackageDB , withVanillaLib , withProfLib + , withProfLibShared , withSharedLib , withStaticLib , withDynExe @@ -251,6 +257,7 @@ pattern LocalBuildInfo LBC.BuildOptions { withVanillaLib , withProfLib + , withProfLibShared , withSharedLib , withStaticLib , withDynExe @@ -289,6 +296,9 @@ buildDirPBD (LBC.PackageBuildDescr{configFlags = cfg}) = setupFlagsBuildDir :: CommonSetupFlags -> SymbolicPath Pkg (Dir Build) setupFlagsBuildDir cfg = fromFlag (setupDistPref cfg) makeRelativePathEx "build" +distPrefLBI :: LocalBuildInfo -> SymbolicPath Pkg (Dir Dist) +distPrefLBI = fromFlag . setupDistPref . configCommonFlags . LBC.configFlags . LBC.packageBuildDescr . localBuildDescr + -- | The (relative or absolute) path to the package root, based on -- -- - the working directory flag @@ -425,6 +435,49 @@ testCoverage :: LocalBuildInfo -> Bool testCoverage (LocalBuildInfo{exeCoverage = exes, libCoverage = libs}) = exes && libs +-- | Returns a list of ways, in the order which they should be built, and the +-- way we build executable and foreign library components. +-- +-- Ideally all this info should be fixed at configure time and not dependent on +-- additional info but `LocalBuildInfo` is per package (not per component) so it's +-- currently not possible to configure components to be built in certain ways. +buildWays :: LocalBuildInfo -> (Bool -> [BuildWay], Bool -> BuildWay, BuildWay) +buildWays lbi = + let + -- enable-library-profiling (enable (static profiling way)) .p_o + -- enable-shared (enabled dynamic way) .dyn_o + -- enable-profiling-shared (enable dynamic profilng way) .p_dyn_o + -- enable-library-vanilla (enable vanilla way) .o + -- + -- enable-executable-dynamic => build dynamic executables + -- => --enable-profiling + --enable-executable-dynamic => build dynamic profiled executables + -- => --enable-profiling => build vanilla profiled executables + + wantedLibWays is_indef = + [ProfDynWay | withProfLibShared lbi && not is_indef] + <> [ProfWay | withProfLib lbi] + -- I don't see why we shouldn't build with dynamic-- indefinite components. + <> [DynWay | withSharedLib lbi && not is_indef] + -- MP: Ideally we should have `BuildOptions` on a per component basis, in + -- which case this `is_indef` check could be moved to configure time. + <> [StaticWay | withVanillaLib lbi || withStaticLib lbi] + + wantedFLibWay is_dyn_flib = + case (is_dyn_flib, withProfExe lbi) of + (True, True) -> ProfDynWay + (False, True) -> ProfWay + (True, False) -> DynWay + (False, False) -> StaticWay + + wantedExeWay = + case (withDynExe lbi, withProfExe lbi) of + (True, True) -> ProfDynWay + (True, False) -> DynWay + (False, True) -> ProfWay + (False, False) -> StaticWay + in + (wantedLibWays, wantedFLibWay, wantedExeWay) + ------------------------------------------------------------------------------- -- Stub functions to prevent someone from accidentally defining them diff --git a/Cabal/src/Distribution/Utils/IOData.hs b/Cabal/src/Distribution/Utils/IOData.hs index 73e86493d1f..833fc8f4ee3 100644 --- a/Cabal/src/Distribution/Utils/IOData.hs +++ b/Cabal/src/Distribution/Utils/IOData.hs @@ -80,7 +80,7 @@ instance KnownIODataMode LBS.ByteString where -- | 'IOData' Wrapper for 'System.IO.hPutStr' and 'System.IO.hClose' -- --- This is the dual operation ot 'hGetIODataContents', +-- This is the dual operation to 'hGetIODataContents', -- and consequently the handle is closed with `hClose`. -- -- /Note:/ this performs lazy-IO. diff --git a/Cabal/src/Distribution/Utils/LogProgress.hs b/Cabal/src/Distribution/Utils/LogProgress.hs index 114e01ab5a5..33c50f20b5e 100644 --- a/Cabal/src/Distribution/Utils/LogProgress.hs +++ b/Cabal/src/Distribution/Utils/LogProgress.hs @@ -1,5 +1,4 @@ {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE Rank2Types #-} module Distribution.Utils.LogProgress diff --git a/Cabal/src/Distribution/Utils/NubList.hs b/Cabal/src/Distribution/Utils/NubList.hs index 2a7e69a7a85..09da19aa5ae 100644 --- a/Cabal/src/Distribution/Utils/NubList.hs +++ b/Cabal/src/Distribution/Utils/NubList.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -22,7 +21,7 @@ import qualified Text.Read as R -- | NubList : A de-duplicated list that maintains the original order. newtype NubList a = NubList {fromNubList :: [a]} - deriving (Eq, Generic, Typeable) + deriving (Eq, Generic) -- NubList assumes that nub retains the list order while removing duplicate -- elements (keeping the first occurrence). Documentation for "Data.List.nub" diff --git a/Cabal/src/Distribution/Verbosity.hs b/Cabal/src/Distribution/Verbosity.hs index bab48bbed21..c81c6dd8630 100644 --- a/Cabal/src/Distribution/Verbosity.hs +++ b/Cabal/src/Distribution/Verbosity.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} ----------------------------------------------------------------------------- @@ -92,7 +91,7 @@ data Verbosity = Verbosity , vFlags :: Set VerbosityFlag , vQuiet :: Bool } - deriving (Generic, Show, Read, Typeable) + deriving (Generic, Show, Read) mkVerbosity :: VerbosityLevel -> Verbosity mkVerbosity l = Verbosity{vLevel = l, vFlags = Set.empty, vQuiet = False} diff --git a/Cabal/src/Distribution/Verbosity/Internal.hs b/Cabal/src/Distribution/Verbosity/Internal.hs index b8f55cf5b98..9d851f59f07 100644 --- a/Cabal/src/Distribution/Verbosity/Internal.hs +++ b/Cabal/src/Distribution/Verbosity/Internal.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Verbosity.Internal @@ -10,7 +9,7 @@ import Distribution.Compat.Prelude import Prelude () data VerbosityLevel = Silent | Normal | Verbose | Deafening - deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded, Typeable) + deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded) instance Binary VerbosityLevel instance Structured VerbosityLevel @@ -24,7 +23,7 @@ data VerbosityFlag | -- | @since 3.4.0.0 VStderr | VNoWarn - deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded, Typeable) + deriving (Generic, Show, Read, Eq, Ord, Enum, Bounded) instance Binary VerbosityFlag instance Structured VerbosityFlag diff --git a/Makefile b/Makefile index d305ca16353..70e150edebb 100644 --- a/Makefile +++ b/Makefile @@ -5,45 +5,63 @@ CABALBUILD := cabal build CABALRUN := cabal run -# The newer and prefered way to call the doctest tool is: -# $ cabal repl --with-ghc=doctest -# SEE: https://github.com/haskell/cabal/issues/8504 -# There is but one caveat, we have to avoid allow-newer. +# We have to avoid allow-newer. # SEE: https://github.com/haskell/cabal/issues/6859 -DOCTEST := cabal repl --with-ghc=doctest --repl-options="-w" --ghc-options="-Wwarn" --allow-newer=False +DOCTEST := cabal doctest --allow-newer=False # default rules .PHONY: all -all : exe lib +all: help-banner exe lib ## Build the Cabal libraries and cabal-install executables. .PHONY: lib -lib : +lib: ## Builds the Cabal libraries. $(CABALBUILD) Cabal:libs .PHONY: exe -exe : +exe: ## Builds the cabal-install executables. $(CABALBUILD) cabal-install:exes .PHONY: init -init: ## Set up git hooks and ignored revisions +init: ## Set up git hooks and ignored revisions. @git config core.hooksPath .githooks ## TODO .PHONY: style -style: ## Run the code styler - @fourmolu -q -i Cabal Cabal-syntax cabal-install +style: ## Run the code styler. + @fourmolu -q -i Cabal Cabal-syntax cabal-install cabal-validate .PHONY: style-modified -style-modified: ## Run the code styler on modified files - @git ls-files --modified Cabal Cabal-syntax cabal-install \ +style-modified: ## Run the code styler on modified files. + @git ls-files --modified Cabal Cabal-syntax cabal-install cabal-validate \ | grep '.hs$$' | xargs -P $(PROCS) -I {} fourmolu -q -i {} .PHONY: style-commit -style-commit: ## Run the code styler on the previous commit - @git diff --name-only HEAD $(COMMIT) Cabal Cabal-syntax cabal-install \ +style-commit: ## Run the code styler on the previous commit. + @git diff --name-only HEAD $(COMMIT) Cabal Cabal-syntax cabal-install cabal-validate \ | grep '.hs$$' | xargs -P $(PROCS) -I {} fourmolu -q -i {} +.PHONY: whitespace +whitespace: ## Run fix-whitespace in check mode. + fix-whitespace --check --verbose + +.PHONY: fix-whitespace +fix-whitespace: ## Run fix-whitespace in fix mode. + fix-whitespace --verbose + +.PHONY: lint +lint: ## Run HLint. + hlint -j . + +.PHONY: lint-json +lint-json: ## Run HLint in JSON mode. + hlint -j --json -- . + +# local checks + +.PHONY: checks +checks: whitespace users-guide-typos markdown-typos style lint-json ## Run all local checks; whitespace, typos, style, and lint. + # source generation: SPDX SPDX_LICENSE_HS:=Cabal-syntax/src/Distribution/SPDX/LicenseId.hs @@ -55,7 +73,7 @@ SPDX_EXCEPTION_HS:=Cabal-syntax/src/Distribution/SPDX/LicenseExceptionId.hs .PHONY: spdx spdx : $(SPDX_LICENSE_HS) $(SPDX_EXCEPTION_HS) -SPDX_LICENSE_VERSIONS:=3.0 3.2 3.6 3.9 3.10 3.16 3.23 +SPDX_LICENSE_VERSIONS:=3.0 3.2 3.6 3.9 3.10 3.16 3.23 3.25 $(SPDX_LICENSE_HS) : templates/SPDX.LicenseId.template.hs cabal-dev-scripts/src/GenUtils.hs cabal-dev-scripts/src/GenSPDX.hs license-list-data/licenses-3.0.json license-list-data/licenses-3.2.json cabal run --builddir=dist-newstyle-meta --project-file=cabal.meta.project gen-spdx -- templates/SPDX.LicenseId.template.hs $(SPDX_LICENSE_VERSIONS:%=license-list-data/licenses-%.json) $(SPDX_LICENSE_HS) @@ -98,20 +116,20 @@ analyse-imports : # ghcid .PHONY: ghcid-lib -ghcid-lib : +ghcid-lib: ## Run ghcid for the Cabal library. ghcid -c 'cabal repl Cabal' .PHONY: ghcid-cli -ghcid-cli : +ghcid-cli: ## Run ghcid for the cabal-install executable. ghcid -c 'cabal repl cabal-install' .PHONY: doctest -doctest : - $(DOCTEST) Cabal-syntax - $(DOCTEST) Cabal-described - $(DOCTEST) --build-depends=QuickCheck Cabal - $(DOCTEST) cabal-install-solver - $(DOCTEST) cabal-install +doctest: ## Run doctests. + cd Cabal-syntax && $(DOCTEST) + cd Cabal-described && $(DOCTEST) + cd Cabal && $(DOCTEST) + cd cabal-install-solver && $(DOCTEST) + cd cabal-install && $(DOCTEST) # This is not run as part of validate.sh (we need hackage-security, which is tricky to get). .PHONY: doctest-cli @@ -119,8 +137,8 @@ doctest-cli : doctest -D__DOCTEST__ --fast cabal-install/src cabal-install-solver/src cabal-install-solver/src-assertion .PHONY: doctest-install -doctest-install: - cabal install doctest --overwrite-policy=always --ignore-project +doctest-install: ## Install doctest tool needed for running doctests. + cabal install doctest --overwrite-policy=always --ignore-project --flag cabal-doctest # tests @@ -178,14 +196,12 @@ cabal-install-test-accept: .PHONY: validate-via-docker-all validate-via-docker-all : validate-via-docker-8.2.2 validate-via-docker-all : validate-via-docker-8.4.4 -validate-via-docker-all : validate-via-docker-8.6.5 validate-via-docker-all : validate-via-docker-8.8.4 validate-via-docker-all : validate-via-docker-8.10.4 .PHONY: validate-dockerfiles validate-dockerfiles : .docker/validate-8.10.4.dockerfile validate-dockerfiles : .docker/validate-8.8.4.dockerfile -validate-dockerfiles : .docker/validate-8.6.5.dockerfile validate-dockerfiles : .docker/validate-8.4.4.dockerfile validate-dockerfiles : .docker/validate-8.2.2.dockerfile @@ -204,10 +220,6 @@ validate-via-docker-8.2.2: validate-via-docker-8.4.4: docker build $(DOCKERARGS) -t cabal-validate:8.4.4 -f .docker/validate-8.4.4.dockerfile . -.PHONY: validate-via-docker-8.6.5 -validate-via-docker-8.6.5: - docker build $(DOCKERARGS) -t cabal-validate:8.6.5 -f .docker/validate-8.6.5.dockerfile . - .PHONY: validate-via-docker-8.8.4 validate-via-docker-8.8.4: docker build $(DOCKERARGS) -t cabal-validate:8.8.4 -f .docker/validate-8.8.4.dockerfile . @@ -222,7 +234,7 @@ validate-via-docker-old: # tags .PHONY : tags -tags : +tags: ## Generate editor tags, vim ctags and emacs etags. hasktags -b Cabal-syntax/src Cabal/src Cabal-described/src cabal-install/src cabal-testsuite/src # bootstrapping @@ -235,7 +247,7 @@ bootstrap-json-%: phony cd bootstrap && cabal run -v0 cabal-bootstrap-gen -- linux-$*.plan.json \ | python3 -m json.tool > linux-$*.json -BOOTSTRAP_GHC_VERSIONS := 8.10.7 9.0.2 9.2.8 9.4.8 9.6.4 9.8.2 +BOOTSTRAP_GHC_VERSIONS := 9.0.2 9.2.8 9.4.8 9.6.6 9.8.2 .PHONY: bootstrap-jsons bootstrap-jsons: $(BOOTSTRAP_GHC_VERSIONS:%=bootstrap-json-%) @@ -244,11 +256,11 @@ bootstrap-jsons: $(BOOTSTRAP_GHC_VERSIONS:%=bootstrap-json-%) ############################################################################## .PHONY: users-guide -users-guide: +users-guide: ## Build the users guide. $(MAKE) -C doc users-guide .PHONY: users-guide-requirements -users-guide-requirements: +users-guide-requirements: ## Install the requirements for building the users guide. $(MAKE) -C doc users-guide-requirements ifeq ($(shell uname), Darwin) @@ -256,3 +268,38 @@ PROCS := $(shell sysctl -n hw.logicalcpu) else PROCS := $(shell nproc) endif + +PHONY: help +help: ## Show the commented targets. + @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ + sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' + +PHONY: help-banner +help-banner: ## Show the help banner. + @echo "====================================================================" + @echo "§ all make with no arguments also shows this banner" + @echo "§ help make help will list targets with descriptions" + @echo "====================================================================" + +.PHONY: typos-install +typos-install: ## Install typos-cli for typos target using cargo + cargo install typos-cli + +GREP_EXCLUDE := grep -v -E 'dist-|cabal-testsuite|python-' +FIND_NAMED := find . -type f -name + +.PHONY: users-guide-typos +users-guide-typos: ## Find typos in users guide + cd doc && $(FIND_NAMED) '*.rst' | xargs typos + +.PHONY: users-guide-fix-typos +users-guide-fix-typos: ## Fix typos in users guide + cd doc && $(FIND_NAMED) '*.rst' | xargs typos --write-changes + +.PHONY: markdown-typos +markdown-typos: ## Find typos in markdown files + $(FIND_NAMED) '*.md' | $(GREP_EXCLUDE) | xargs typos + +.PHONY: markdown-fix-typos +markdown-fix-typos: ## Fix typos in markdown files + $(FIND_NAMED) '*.md' | $(GREP_EXCLUDE) | xargs typos --write-changes diff --git a/README.md b/README.md index 4697cf2b2c6..d0ebaf3a1ec 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ This Cabal Git repository contains the following main packages: * [Cabal](Cabal/README.md): the Cabal library package ([license](Cabal/LICENSE)) + * [Cabal-hooks](Cabal-hooks/README.md): the library providing an API for the Cabal `Hooks` build type ([license](Cabal-hooks/LICENSE)) * [Cabal-syntax](Cabal-syntax/README.md): the `.cabal` file format library ([license](Cabal-syntax/LICENSE)) * [cabal-install](cabal-install/README.md): the package containing the `cabal` tool ([license](cabal-install/LICENSE)) * [cabal-install-solver](cabal-install-solver): the package containing the solver component of the `cabal` tool ([license](cabal-install-solver/LICENSE)) @@ -63,7 +64,7 @@ Currently, we only provide binaries for `x86_64` platforms. 2. Even more cutting-edge binaries built from pull requests are always available - from the `Validate` worklow page on GitHub, at the very bottom of the page, + from the `Validate` workflow page on GitHub, at the very bottom of the page, or from the `build-alpine` workflow for statically linked Linux builds. Ways to build `cabal-install` for everyday use diff --git a/bootstrap/cabal-bootstrap-gen.cabal b/bootstrap/cabal-bootstrap-gen.cabal index 0b73a1de23e..b2caa03c493 100644 --- a/bootstrap/cabal-bootstrap-gen.cabal +++ b/bootstrap/cabal-bootstrap-gen.cabal @@ -8,11 +8,11 @@ executable cabal-bootstrap-gen ghc-options: -Wall main-is: Main.hs build-depends: - , aeson ^>=1.5.2.0 || ^>=2.0.3.0 || ^>=2.1.0.0 - , base ^>=4.12.0.0 || ^>=4.13.0.0 || ^>=4.14.0.0 || ^>=4.15.0.0 || ^>=4.16.0.0 || ^>=4.17.0.0 || ^>=4.18.0.0 + , aeson ^>=1.5.2.0 || ^>=2.0.3.0 || ^>=2.1.0.0 || ^>=2.2.0.0 + , base ^>=4.12.0.0 || ^>=4.13.0.0 || ^>=4.14.0.0 || ^>=4.15.0.0 || ^>=4.16.0.0 || ^>=4.17.0.0 || ^>=4.18.0.0 || ^>=4.19.0.0 , bytestring ^>=0.10.8.2 || ^>=0.11.0.0 - , Cabal ^>=3.4.1.0 || ^>=3.6.3.0 || ^>=3.10.1.0 || ^>=3.12.1.0 - , Cabal-syntax ^>=3.8.1.0 || ^>=3.10.1.0 || ^>=3.12.1.0 + , Cabal ^>=3.12.1.0 || ^>=3.14.0.0 + , Cabal-syntax ^>=3.12.1.0 || ^>=3.14.0.0 -- For the release process, we need the last *two* Cabal-syntax -- versions here: one to make CI green when release Cabal-syntax is -- not yet on Hackage and we are bumping versions. The second for diff --git a/bootstrap/generate_bootstrap_plans b/bootstrap/generate_bootstrap_plans index 4357a7a9843..de77e9944dd 100755 --- a/bootstrap/generate_bootstrap_plans +++ b/bootstrap/generate_bootstrap_plans @@ -3,14 +3,14 @@ PATH+=:$PWD/jq-bin/bin ghcs_nix="https://gitlab.haskell.org/bgamari/ghcs-nix/-/archive/master/ghcs-nix-master.tar.gz" -nix build -f "$ghcs_nix" ghc-8_10_7 -o boot_ghc +nix build -f "$ghcs_nix" ghc-9_6_5 -o boot_ghc run() { local ver="$1" local drv="ghc-$ver" echo "$ver" nix build -f "$ghcs_nix" $drv - (cd ../; rm -r dist-bootstrap; cabal --distdir=dist-bootstrap build --project-file=cabal.release.project --dry-run cabal-install:exe:cabal -w bootstrap/result/bin/ghc) + (cd ../; rm -r dist-bootstrap; cabal --distdir=dist-bootstrap build --project-file=cabal.bootstrap.project --dry-run cabal-install:exe:cabal -w bootstrap/result/bin/ghc) jq --sort-keys < ../dist-bootstrap/cache/plan.json > "plan-$ver.json" cabal run --with-ghc-pkg $PWD/boot_ghc/bin/ghc-pkg -w $PWD/boot_ghc/bin/ghc -v0 cabal-bootstrap-gen -- "plan-$ver.json" | jq --sort-keys | tee "linux-$(echo $ver | tr "_" ".").json" } diff --git a/bootstrap/linux-9.0.2.json b/bootstrap/linux-9.0.2.json index 8db81ee3aa1..c3d136717fd 100644 --- a/bootstrap/linux-9.0.2.json +++ b/bootstrap/linux-9.0.2.json @@ -63,29 +63,27 @@ ], "dependencies": [ { - "cabal_sha256": "a4a1975fde77e289b605c45a3ef78d731d8c1834e4cef311152d910a1e94d98c", - "component": "lib:data-array-byte", + "cabal_sha256": "3eee5d3658b657371d0f940f1f38feefc2ebdf8592a32d3d0734f28c61f80ba0", + "component": "lib:bytestring", "flags": [], - "package": "data-array-byte", - "revision": 3, + "package": "bytestring", + "revision": 0, "source": "hackage", - "src_sha256": "1bb6eca0b3e02d057fe7f4e14c81ef395216f421ab30fdaa1b18017c9c025600", - "version": "0.1.0.1" + "src_sha256": "6bd8fa536ed6a8278bc98dfa9fdf2c91da662bea58fde929a6ba8a38bbe9d7eb", + "version": "0.11.5.3" }, { - "cabal_sha256": "98e79e1c97117143e4012983509ec95f7e5e4f6adff6914d07812a39f83404b9", - "component": "lib:bytestring", - "flags": [ - "-pure-haskell" - ], - "package": "bytestring", - "revision": 1, + "cabal_sha256": "2efc549644dd418bad537d1601fdd437c440d807265016bd993b6996c679ad2f", + "component": "lib:os-string", + "flags": [], + "package": "os-string", + "revision": 0, "source": "hackage", - "src_sha256": "ebc3b8a6ef74a5cd6ddbb8d447d1c9a5fd4964c7975ebcae0b8ab0bcc406cc8c", - "version": "0.12.1.0" + "src_sha256": "339c35fd3a290522f23de4e33528423cfd0b0a8f22946b0b9816a817b926cba0", + "version": "2.0.7" }, { - "cabal_sha256": "d9e181e1acae0ac505d8b217dec3805c68554878f1e32b3d8351b9ce17061623", + "cabal_sha256": "099c33e0e570dad93390e1c01c1f4bc6e4f13587de8e199df3c94a6cb62c7434", "component": "lib:filepath", "flags": [ "-cpphs" @@ -93,32 +91,44 @@ "package": "filepath", "revision": 0, "source": "hackage", - "src_sha256": "337a0b5bcf0898cb7f51ff327528cf26f4ac38baed7b66b28fbdea334699d8ed", - "version": "1.4.300.1" + "src_sha256": "54aa86c432f593273d7b9f607c5b5e0a1628c2674c6f4e3b5a54eb0c83db5caf", + "version": "1.5.4.0" }, { - "cabal_sha256": "3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06", + "cabal_sha256": "5b7f8afd7a879c3c8c3c636fd3c7543cdd5e0b514b7da90e76907ccd11434031", "component": "lib:unix", "flags": [ - "-os-string" + "+os-string" ], "package": "unix", + "revision": 1, + "source": "hackage", + "src_sha256": "8117599bb3e4aa1d4656710afbc85aef2a75483eddfac5338f8cc88fb505eea2", + "version": "2.8.6.0" + }, + { + "cabal_sha256": "e3e1866eab82cb28f6a5f28507643da3987008b737e66a3c7398f39f16d824dc", + "component": "lib:file-io", + "flags": [ + "+os-string" + ], + "package": "file-io", "revision": 0, "source": "hackage", - "src_sha256": "5ab6c346aef2eb9bf80b4d29ca7e22063fc23e52fd69fbc4d18a9f98b154e424", - "version": "2.8.5.1" + "src_sha256": "e3d9113a015c57e3d8c2294550c41544f84a265291fed96cca697f91b6e86f52", + "version": "0.1.4" }, { - "cabal_sha256": "ae1730011f547153bb52139f217d1d524202b3da730a369660fc539e5dcfff31", + "cabal_sha256": "2490137bb7738bd79392959458ef5f276219ea5ba8a9a56d3e0b06315c1bb917", "component": "lib:directory", "flags": [ - "-os-string" + "+os-string" ], "package": "directory", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "a4e798a4e5339a7aa9577515886271386280bfbc1fe4a29fd4aa6464d4792064", - "version": "1.3.8.4" + "src_sha256": "20a24846117fc5f8751d974b7de07210a161989410467e9adca525381b8e64cc", + "version": "1.3.9.0" }, { "cabal_sha256": "de553eefe0b6548a560e9d8100486310548470a403c1fa21108dd03713da5fc7", @@ -141,18 +151,17 @@ "version": "0.8.9.2" }, { - "cabal_sha256": "aa7a5a92fe430a34d24d33878323c8a010021e05e410fe98b7fac3015c88dc74", + "cabal_sha256": "71b5fa8c64d3c1fd0a08f993463220867b08290a2256e94b0952bf0e8f5a45cc", "component": "lib:text", "flags": [ "-developer", - "-pure-haskell", "+simdutf" ], "package": "text", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "e40cdda8b285f4d72476ed35dc2f5f167d524e6b38bb5ec964d00ee1ff24feab", - "version": "2.1.1" + "src_sha256": "c735be650a898606ce9f2c8642bc6ac6123eea82871d5e90f92797801f59efad", + "version": "2.0.2" }, { "cabal_sha256": "8407cbd428d7f640a0fff8891bd2f7aca13cebe70a5e654856f8abec9a648b56", @@ -172,27 +181,29 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { - "cabal_sha256": "7785a72bc140ae5a9ef2439f10637b5fd104999832f1d93328d4973f37cb8469", + "cabal_sha256": "9a0b2ef8096517fa0e0c7a5e9a5c2ae5744ed824c3331005f9408245810df345", "component": "lib:process", "flags": [], "package": "process", "revision": 0, "source": "hackage", - "src_sha256": "b468355ab46966537eb171ed5593a0a1facc8d2eefc38659e43768f68f5dcb96", - "version": "1.6.19.0" + "src_sha256": "496fe0566c3915b112e9772ac9c967dfeb8d5ca04895e54ae0160522bee76e65", + "version": "1.6.25.0" }, { "cabal_sha256": null, "component": "lib:Cabal", - "flags": [], + "flags": [ + "-git-rev" + ], "package": "Cabal", "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, @@ -202,22 +213,22 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.16" }, { - "cabal_sha256": "60e78b6c60dc32a77ce6c37ed5ca4e838fc5f76f02836ef64d93cd21cc002325", + "cabal_sha256": "276325277350cd2c2c88916ed3ae5cd35b2b4f494ec594fbd9534081eb7fb759", "component": "exe:hsc2hs", "flags": [ "-in-ghc-tree" ], "package": "hsc2hs", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "6f4e34d788fe2ca7091ee0a10307ee8a7c060a1ba890f2bffad16a7d4d5cef76", "version": "0.68.10" }, { - "cabal_sha256": "25440c1bbd5772fdbbeec068f20138121131e1a56453db0adc113dcdf9044105", + "cabal_sha256": "b0fafb2834530084f6406017500ae619f9e5e2049787a6750c68e0d331fd62dc", "component": "lib:network", "flags": [ "-devel" @@ -225,15 +236,15 @@ "package": "network", "revision": 0, "source": "hackage", - "src_sha256": "c45696744dc437d93a56871a3dd869965b7b50eda3fe3c1a90a35e2fbb9cb9ca", - "version": "3.2.0.0" + "src_sha256": "dbd8a10456908294eb5ab9c522bf2da75444d958429a643a821464213698523e", + "version": "3.2.6.0" }, { - "cabal_sha256": "0a6ee328b71119d7dfcd004f0ec8feb77e6e78d8f6de1a281568edd3d3b6d83f", + "cabal_sha256": "129a59ba3ccfcd06192fd6da899e2711ae276a466915a047bd6727e4a0321d2e", "component": "lib:th-compat", "flags": [], "package": "th-compat", - "revision": 1, + "revision": 2, "source": "hackage", "src_sha256": "81f55fafc7afad7763c09cb8b7b4165ca3765edcf70ffa42c7393043a1382a1e", "version": "0.1.5" @@ -264,36 +275,37 @@ "version": "4000.4.1" }, { - "cabal_sha256": "c4733d09f798fc4304e936924a1a7d9fc2425aefad6c46ad4592035254b46051", + "cabal_sha256": "455d863c96cf4b1804772c630a235f535fdb52ca9137a4150967b521ee4734ab", "component": "lib:base-orphans", "flags": [], "package": "base-orphans", "revision": 0, "source": "hackage", - "src_sha256": "5bbf2da382c5b212d6a8be2f8c49edee0eba30f272a15fd32c13e6e4091ef172", - "version": "0.9.1" + "src_sha256": "6211900916955b84687c61b5e4fa98ce110e511a96086b7a93f06dd63c97ba93", + "version": "0.9.2" }, { - "cabal_sha256": "ae22238274c572aa91e90c6c353e7206386708912ac5e6dc40ac61d1dcc553db", + "cabal_sha256": "50b2f002c68fe67730ee7a3cd8607486197dd99b084255005ad51ecd6970a41b", "component": "lib:hashable", "flags": [ + "+containers", "+integer-gmp", "-random-initial-seed" ], "package": "hashable", - "revision": 1, + "revision": 0, "source": "hackage", - "src_sha256": "1fa3d64548440942b2b38b99c76d8dcaa94fa2ea3912cd7a6354ea4ec4af4758", - "version": "1.4.4.0" + "src_sha256": "e1b305c280e66ad827edeaedd6933b9fc4174f626882877eab2a08344e665e87", + "version": "1.4.1.0" }, { - "cabal_sha256": "9d5d9e605f52958d099e13a8b8f30ee56cb137c9192996245e3c533adb682cf8", + "cabal_sha256": "b7648c6165729a973d95cb328f9fd874813a81c727707e8b2552b4f03399763b", "component": "lib:async", "flags": [ "-bench" ], "package": "async", - "revision": 1, + "revision": 3, "source": "hackage", "src_sha256": "1818473ebab9212afad2ed76297aefde5fae8b5d4404daf36939aece6a8f16f7", "version": "2.2.5" @@ -361,17 +373,17 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { - "cabal_sha256": "200d756a7b3bab7ca2bac6eb50ed8252f26de77ac8def490a3ad743f2933acbd", + "cabal_sha256": "acb64f2af52d81b0bb92c266f11d43def726a7a7b74a2c23d219e160b54edec7", "component": "lib:cryptohash-sha256", "flags": [ "-exe", "+use-cbits" ], "package": "cryptohash-sha256", - "revision": 4, + "revision": 5, "source": "hackage", "src_sha256": "73a7dc7163871a80837495039a099967b11f5c4fe70a118277842f7a713c6bf6", "version": "0.11.102.1" @@ -404,70 +416,60 @@ "version": "0.0.5.0" }, { - "cabal_sha256": "17786545dce60c4d5783ba6125c0a6499a1abddd3d7417b15500ccd767c35f07", + "cabal_sha256": "8a3004c2de2a0b5ef0634d3da6eae62ba8d8a734bab9ed8c6cfd749e7ca08997", "component": "lib:lukko", "flags": [ "+ofd-locking" ], "package": "lukko", - "revision": 5, - "source": "hackage", - "src_sha256": "a80efb60cfa3dae18682c01980d76d5f7e413e191cd186992e1bf7388d48ab1f", - "version": "0.1.1.3" - }, - { - "cabal_sha256": "32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e", - "component": "lib:os-string", - "flags": [], - "package": "os-string", "revision": 0, "source": "hackage", - "src_sha256": "0953126e962966719753c98d71f596f5fea07e100bce191b7453735a1ff2caa1", - "version": "2.0.2" + "src_sha256": "72d86f8aa625b461f4397f737346f78a1700a7ffbff55cf6375c5e18916e986d", + "version": "0.1.2" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar-internal", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "64a1925c93e9a26cd4c40c470736950c4b5ea7bae68418cb996c5c7df4873cba", + "cabal_sha256": "85e64a75c0b490506a7edaa2d54950c668e66b65758bb08bb14cd31faf53a206", "component": "lib:zlib", "flags": [ "-bundled-c-zlib", "+non-blocking-ffi", - "-pkg-config" + "+pkg-config" ], "package": "zlib", - "revision": 1, + "revision": 2, "source": "hackage", - "src_sha256": "7e43c205e1e1ff5a4b033086ec8cce82ab658879e977c8ba02a6701946ff7a47", - "version": "0.7.0.0" + "src_sha256": "6edd38b6b81df8d274952aa85affa6968ae86b2231e1d429ce8bc9083e6a55bc", + "version": "0.7.1.0" }, { - "cabal_sha256": "8ff70524314f9ad706f8e5051d7150ee44cb82170147879b245bdab279604b16", + "cabal_sha256": "a7311a70ce2cc820ee430c389f57f82a082f148230b37526c34eac72b7b3ff34", "component": "lib:hackage-security", "flags": [ "+cabal-syntax", "+lukko" ], "package": "hackage-security", - "revision": 1, + "revision": 4, "source": "hackage", "src_sha256": "2e4261576b3e11b9f5175392947f56a638cc1a3584b8acbb962b809d7c69db69", "version": "0.6.2.6" @@ -505,11 +507,11 @@ "version": "0.96.0.1" }, { - "cabal_sha256": "4868265ab5760d2fdeb96625b138c8df25d41b9ee2651fa299ed019a69403045", + "cabal_sha256": "3e196e1362e4d0ec9dfcd7f8d58b24fac91beafaa1c8ee34dc9dee489c362377", "component": "lib:resolv", "flags": [], "package": "resolv", - "revision": 3, + "revision": 4, "source": "hackage", "src_sha256": "880d283df9132a7375fa28670f71e86480a4f49972256dc2a204c648274ae74b", "version": "0.2.0.2" @@ -525,11 +527,11 @@ "version": "0.1.7.4" }, { - "cabal_sha256": "a8f76076a40409a36ee975970c53273c2089aec9d9ece8168dfc736dfec24b9d", + "cabal_sha256": "2de5218cef72b8ef090bd7d0fd930ffa143242a120c62e013b5cf039858f1855", "component": "lib:semaphore-compat", "flags": [], "package": "semaphore-compat", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "1c6e6fab021c2ccee5d86112fb1c0bd016d15e0cf70c489dae5fb5ec156ed9e2", "version": "1.0.0" @@ -538,6 +540,7 @@ "cabal_sha256": null, "component": "lib:cabal-install", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -545,12 +548,13 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, "component": "exe:cabal", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -558,7 +562,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": "e4be4a206f5ab6ddb5ae4fbb39101529196e20af5670c5d33326fea6eff886fd", diff --git a/bootstrap/linux-9.2.8.json b/bootstrap/linux-9.2.8.json index 17293e6b197..8eebe2e44bd 100644 --- a/bootstrap/linux-9.2.8.json +++ b/bootstrap/linux-9.2.8.json @@ -79,7 +79,17 @@ ], "dependencies": [ { - "cabal_sha256": "d9e181e1acae0ac505d8b217dec3805c68554878f1e32b3d8351b9ce17061623", + "cabal_sha256": "2efc549644dd418bad537d1601fdd437c440d807265016bd993b6996c679ad2f", + "component": "lib:os-string", + "flags": [], + "package": "os-string", + "revision": 0, + "source": "hackage", + "src_sha256": "339c35fd3a290522f23de4e33528423cfd0b0a8f22946b0b9816a817b926cba0", + "version": "2.0.7" + }, + { + "cabal_sha256": "099c33e0e570dad93390e1c01c1f4bc6e4f13587de8e199df3c94a6cb62c7434", "component": "lib:filepath", "flags": [ "-cpphs" @@ -87,32 +97,44 @@ "package": "filepath", "revision": 0, "source": "hackage", - "src_sha256": "337a0b5bcf0898cb7f51ff327528cf26f4ac38baed7b66b28fbdea334699d8ed", - "version": "1.4.300.1" + "src_sha256": "54aa86c432f593273d7b9f607c5b5e0a1628c2674c6f4e3b5a54eb0c83db5caf", + "version": "1.5.4.0" }, { - "cabal_sha256": "3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06", + "cabal_sha256": "5b7f8afd7a879c3c8c3c636fd3c7543cdd5e0b514b7da90e76907ccd11434031", "component": "lib:unix", "flags": [ - "-os-string" + "+os-string" ], "package": "unix", + "revision": 1, + "source": "hackage", + "src_sha256": "8117599bb3e4aa1d4656710afbc85aef2a75483eddfac5338f8cc88fb505eea2", + "version": "2.8.6.0" + }, + { + "cabal_sha256": "e3e1866eab82cb28f6a5f28507643da3987008b737e66a3c7398f39f16d824dc", + "component": "lib:file-io", + "flags": [ + "+os-string" + ], + "package": "file-io", "revision": 0, "source": "hackage", - "src_sha256": "5ab6c346aef2eb9bf80b4d29ca7e22063fc23e52fd69fbc4d18a9f98b154e424", - "version": "2.8.5.1" + "src_sha256": "e3d9113a015c57e3d8c2294550c41544f84a265291fed96cca697f91b6e86f52", + "version": "0.1.4" }, { - "cabal_sha256": "ae1730011f547153bb52139f217d1d524202b3da730a369660fc539e5dcfff31", + "cabal_sha256": "2490137bb7738bd79392959458ef5f276219ea5ba8a9a56d3e0b06315c1bb917", "component": "lib:directory", "flags": [ - "-os-string" + "+os-string" ], "package": "directory", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "a4e798a4e5339a7aa9577515886271386280bfbc1fe4a29fd4aa6464d4792064", - "version": "1.3.8.4" + "src_sha256": "20a24846117fc5f8751d974b7de07210a161989410467e9adca525381b8e64cc", + "version": "1.3.9.0" }, { "cabal_sha256": "de553eefe0b6548a560e9d8100486310548470a403c1fa21108dd03713da5fc7", @@ -132,27 +154,29 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { - "cabal_sha256": "7785a72bc140ae5a9ef2439f10637b5fd104999832f1d93328d4973f37cb8469", + "cabal_sha256": "9a0b2ef8096517fa0e0c7a5e9a5c2ae5744ed824c3331005f9408245810df345", "component": "lib:process", "flags": [], "package": "process", "revision": 0, "source": "hackage", - "src_sha256": "b468355ab46966537eb171ed5593a0a1facc8d2eefc38659e43768f68f5dcb96", - "version": "1.6.19.0" + "src_sha256": "496fe0566c3915b112e9772ac9c967dfeb8d5ca04895e54ae0160522bee76e65", + "version": "1.6.25.0" }, { "cabal_sha256": null, "component": "lib:Cabal", - "flags": [], + "flags": [ + "-git-rev" + ], "package": "Cabal", "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, @@ -162,22 +186,22 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.16" }, { - "cabal_sha256": "60e78b6c60dc32a77ce6c37ed5ca4e838fc5f76f02836ef64d93cd21cc002325", + "cabal_sha256": "276325277350cd2c2c88916ed3ae5cd35b2b4f494ec594fbd9534081eb7fb759", "component": "exe:hsc2hs", "flags": [ "-in-ghc-tree" ], "package": "hsc2hs", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "6f4e34d788fe2ca7091ee0a10307ee8a7c060a1ba890f2bffad16a7d4d5cef76", "version": "0.68.10" }, { - "cabal_sha256": "25440c1bbd5772fdbbeec068f20138121131e1a56453db0adc113dcdf9044105", + "cabal_sha256": "b0fafb2834530084f6406017500ae619f9e5e2049787a6750c68e0d331fd62dc", "component": "lib:network", "flags": [ "-devel" @@ -185,15 +209,15 @@ "package": "network", "revision": 0, "source": "hackage", - "src_sha256": "c45696744dc437d93a56871a3dd869965b7b50eda3fe3c1a90a35e2fbb9cb9ca", - "version": "3.2.0.0" + "src_sha256": "dbd8a10456908294eb5ab9c522bf2da75444d958429a643a821464213698523e", + "version": "3.2.6.0" }, { - "cabal_sha256": "0a6ee328b71119d7dfcd004f0ec8feb77e6e78d8f6de1a281568edd3d3b6d83f", + "cabal_sha256": "129a59ba3ccfcd06192fd6da899e2711ae276a466915a047bd6727e4a0321d2e", "component": "lib:th-compat", "flags": [], "package": "th-compat", - "revision": 1, + "revision": 2, "source": "hackage", "src_sha256": "81f55fafc7afad7763c09cb8b7b4165ca3765edcf70ffa42c7393043a1382a1e", "version": "0.1.5" @@ -224,46 +248,37 @@ "version": "4000.4.1" }, { - "cabal_sha256": "a4a1975fde77e289b605c45a3ef78d731d8c1834e4cef311152d910a1e94d98c", + "cabal_sha256": "3a4040018d8f90beef81ecd0ba37f266a9aaad3e902dd790f09056f892ba22fb", "component": "lib:data-array-byte", "flags": [], "package": "data-array-byte", - "revision": 3, + "revision": 4, "source": "hackage", "src_sha256": "1bb6eca0b3e02d057fe7f4e14c81ef395216f421ab30fdaa1b18017c9c025600", "version": "0.1.0.1" }, { - "cabal_sha256": "32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e", - "component": "lib:os-string", - "flags": [], - "package": "os-string", - "revision": 0, - "source": "hackage", - "src_sha256": "0953126e962966719753c98d71f596f5fea07e100bce191b7453735a1ff2caa1", - "version": "2.0.2" - }, - { - "cabal_sha256": "ae22238274c572aa91e90c6c353e7206386708912ac5e6dc40ac61d1dcc553db", + "cabal_sha256": "573f3ab242f75465a0d67ce9d84202650a1606575e6dbd6d31ffcf4767a9a379", "component": "lib:hashable", "flags": [ + "-arch-native", "+integer-gmp", "-random-initial-seed" ], "package": "hashable", - "revision": 1, + "revision": 0, "source": "hackage", - "src_sha256": "1fa3d64548440942b2b38b99c76d8dcaa94fa2ea3912cd7a6354ea4ec4af4758", - "version": "1.4.4.0" + "src_sha256": "3baee4c9027a08830d148ec524cbc0471de645e1e8426d46780ef2758df0e8da", + "version": "1.4.7.0" }, { - "cabal_sha256": "9d5d9e605f52958d099e13a8b8f30ee56cb137c9192996245e3c533adb682cf8", + "cabal_sha256": "b7648c6165729a973d95cb328f9fd874813a81c727707e8b2552b4f03399763b", "component": "lib:async", "flags": [ "-bench" ], "package": "async", - "revision": 1, + "revision": 3, "source": "hackage", "src_sha256": "1818473ebab9212afad2ed76297aefde5fae8b5d4404daf36939aece6a8f16f7", "version": "2.2.5" @@ -331,17 +346,17 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { - "cabal_sha256": "200d756a7b3bab7ca2bac6eb50ed8252f26de77ac8def490a3ad743f2933acbd", + "cabal_sha256": "acb64f2af52d81b0bb92c266f11d43def726a7a7b74a2c23d219e160b54edec7", "component": "lib:cryptohash-sha256", "flags": [ "-exe", "+use-cbits" ], "package": "cryptohash-sha256", - "revision": 4, + "revision": 5, "source": "hackage", "src_sha256": "73a7dc7163871a80837495039a099967b11f5c4fe70a118277842f7a713c6bf6", "version": "0.11.102.1" @@ -374,60 +389,60 @@ "version": "0.0.5.0" }, { - "cabal_sha256": "17786545dce60c4d5783ba6125c0a6499a1abddd3d7417b15500ccd767c35f07", + "cabal_sha256": "8a3004c2de2a0b5ef0634d3da6eae62ba8d8a734bab9ed8c6cfd749e7ca08997", "component": "lib:lukko", "flags": [ "+ofd-locking" ], "package": "lukko", - "revision": 5, + "revision": 0, "source": "hackage", - "src_sha256": "a80efb60cfa3dae18682c01980d76d5f7e413e191cd186992e1bf7388d48ab1f", - "version": "0.1.1.3" + "src_sha256": "72d86f8aa625b461f4397f737346f78a1700a7ffbff55cf6375c5e18916e986d", + "version": "0.1.2" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar-internal", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "64a1925c93e9a26cd4c40c470736950c4b5ea7bae68418cb996c5c7df4873cba", + "cabal_sha256": "85e64a75c0b490506a7edaa2d54950c668e66b65758bb08bb14cd31faf53a206", "component": "lib:zlib", "flags": [ "-bundled-c-zlib", "+non-blocking-ffi", - "-pkg-config" + "+pkg-config" ], "package": "zlib", - "revision": 1, + "revision": 2, "source": "hackage", - "src_sha256": "7e43c205e1e1ff5a4b033086ec8cce82ab658879e977c8ba02a6701946ff7a47", - "version": "0.7.0.0" + "src_sha256": "6edd38b6b81df8d274952aa85affa6968ae86b2231e1d429ce8bc9083e6a55bc", + "version": "0.7.1.0" }, { - "cabal_sha256": "8ff70524314f9ad706f8e5051d7150ee44cb82170147879b245bdab279604b16", + "cabal_sha256": "a7311a70ce2cc820ee430c389f57f82a082f148230b37526c34eac72b7b3ff34", "component": "lib:hackage-security", "flags": [ "+cabal-syntax", "+lukko" ], "package": "hackage-security", - "revision": 1, + "revision": 4, "source": "hackage", "src_sha256": "2e4261576b3e11b9f5175392947f56a638cc1a3584b8acbb962b809d7c69db69", "version": "0.6.2.6" @@ -465,11 +480,11 @@ "version": "0.96.0.1" }, { - "cabal_sha256": "4868265ab5760d2fdeb96625b138c8df25d41b9ee2651fa299ed019a69403045", + "cabal_sha256": "3e196e1362e4d0ec9dfcd7f8d58b24fac91beafaa1c8ee34dc9dee489c362377", "component": "lib:resolv", "flags": [], "package": "resolv", - "revision": 3, + "revision": 4, "source": "hackage", "src_sha256": "880d283df9132a7375fa28670f71e86480a4f49972256dc2a204c648274ae74b", "version": "0.2.0.2" @@ -485,11 +500,11 @@ "version": "0.1.7.4" }, { - "cabal_sha256": "a8f76076a40409a36ee975970c53273c2089aec9d9ece8168dfc736dfec24b9d", + "cabal_sha256": "2de5218cef72b8ef090bd7d0fd930ffa143242a120c62e013b5cf039858f1855", "component": "lib:semaphore-compat", "flags": [], "package": "semaphore-compat", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "1c6e6fab021c2ccee5d86112fb1c0bd016d15e0cf70c489dae5fb5ec156ed9e2", "version": "1.0.0" @@ -498,6 +513,7 @@ "cabal_sha256": null, "component": "lib:cabal-install", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -505,12 +521,13 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, "component": "exe:cabal", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -518,7 +535,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": "e4be4a206f5ab6ddb5ae4fbb39101529196e20af5670c5d33326fea6eff886fd", diff --git a/bootstrap/linux-9.4.8.json b/bootstrap/linux-9.4.8.json index 8a721f76be7..c2986821394 100644 --- a/bootstrap/linux-9.4.8.json +++ b/bootstrap/linux-9.4.8.json @@ -79,7 +79,17 @@ ], "dependencies": [ { - "cabal_sha256": "d9e181e1acae0ac505d8b217dec3805c68554878f1e32b3d8351b9ce17061623", + "cabal_sha256": "2efc549644dd418bad537d1601fdd437c440d807265016bd993b6996c679ad2f", + "component": "lib:os-string", + "flags": [], + "package": "os-string", + "revision": 0, + "source": "hackage", + "src_sha256": "339c35fd3a290522f23de4e33528423cfd0b0a8f22946b0b9816a817b926cba0", + "version": "2.0.7" + }, + { + "cabal_sha256": "099c33e0e570dad93390e1c01c1f4bc6e4f13587de8e199df3c94a6cb62c7434", "component": "lib:filepath", "flags": [ "-cpphs" @@ -87,32 +97,44 @@ "package": "filepath", "revision": 0, "source": "hackage", - "src_sha256": "337a0b5bcf0898cb7f51ff327528cf26f4ac38baed7b66b28fbdea334699d8ed", - "version": "1.4.300.1" + "src_sha256": "54aa86c432f593273d7b9f607c5b5e0a1628c2674c6f4e3b5a54eb0c83db5caf", + "version": "1.5.4.0" }, { - "cabal_sha256": "3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06", + "cabal_sha256": "5b7f8afd7a879c3c8c3c636fd3c7543cdd5e0b514b7da90e76907ccd11434031", "component": "lib:unix", "flags": [ - "-os-string" + "+os-string" ], "package": "unix", + "revision": 1, + "source": "hackage", + "src_sha256": "8117599bb3e4aa1d4656710afbc85aef2a75483eddfac5338f8cc88fb505eea2", + "version": "2.8.6.0" + }, + { + "cabal_sha256": "e3e1866eab82cb28f6a5f28507643da3987008b737e66a3c7398f39f16d824dc", + "component": "lib:file-io", + "flags": [ + "+os-string" + ], + "package": "file-io", "revision": 0, "source": "hackage", - "src_sha256": "5ab6c346aef2eb9bf80b4d29ca7e22063fc23e52fd69fbc4d18a9f98b154e424", - "version": "2.8.5.1" + "src_sha256": "e3d9113a015c57e3d8c2294550c41544f84a265291fed96cca697f91b6e86f52", + "version": "0.1.4" }, { - "cabal_sha256": "ae1730011f547153bb52139f217d1d524202b3da730a369660fc539e5dcfff31", + "cabal_sha256": "2490137bb7738bd79392959458ef5f276219ea5ba8a9a56d3e0b06315c1bb917", "component": "lib:directory", "flags": [ - "-os-string" + "+os-string" ], "package": "directory", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "a4e798a4e5339a7aa9577515886271386280bfbc1fe4a29fd4aa6464d4792064", - "version": "1.3.8.4" + "src_sha256": "20a24846117fc5f8751d974b7de07210a161989410467e9adca525381b8e64cc", + "version": "1.3.9.0" }, { "cabal_sha256": "de553eefe0b6548a560e9d8100486310548470a403c1fa21108dd03713da5fc7", @@ -132,27 +154,29 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { - "cabal_sha256": "7785a72bc140ae5a9ef2439f10637b5fd104999832f1d93328d4973f37cb8469", + "cabal_sha256": "9a0b2ef8096517fa0e0c7a5e9a5c2ae5744ed824c3331005f9408245810df345", "component": "lib:process", "flags": [], "package": "process", "revision": 0, "source": "hackage", - "src_sha256": "b468355ab46966537eb171ed5593a0a1facc8d2eefc38659e43768f68f5dcb96", - "version": "1.6.19.0" + "src_sha256": "496fe0566c3915b112e9772ac9c967dfeb8d5ca04895e54ae0160522bee76e65", + "version": "1.6.25.0" }, { "cabal_sha256": null, "component": "lib:Cabal", - "flags": [], + "flags": [ + "-git-rev" + ], "package": "Cabal", "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, @@ -162,22 +186,22 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.16" }, { - "cabal_sha256": "60e78b6c60dc32a77ce6c37ed5ca4e838fc5f76f02836ef64d93cd21cc002325", + "cabal_sha256": "276325277350cd2c2c88916ed3ae5cd35b2b4f494ec594fbd9534081eb7fb759", "component": "exe:hsc2hs", "flags": [ "-in-ghc-tree" ], "package": "hsc2hs", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "6f4e34d788fe2ca7091ee0a10307ee8a7c060a1ba890f2bffad16a7d4d5cef76", "version": "0.68.10" }, { - "cabal_sha256": "25440c1bbd5772fdbbeec068f20138121131e1a56453db0adc113dcdf9044105", + "cabal_sha256": "b0fafb2834530084f6406017500ae619f9e5e2049787a6750c68e0d331fd62dc", "component": "lib:network", "flags": [ "-devel" @@ -185,15 +209,15 @@ "package": "network", "revision": 0, "source": "hackage", - "src_sha256": "c45696744dc437d93a56871a3dd869965b7b50eda3fe3c1a90a35e2fbb9cb9ca", - "version": "3.2.0.0" + "src_sha256": "dbd8a10456908294eb5ab9c522bf2da75444d958429a643a821464213698523e", + "version": "3.2.6.0" }, { - "cabal_sha256": "0a6ee328b71119d7dfcd004f0ec8feb77e6e78d8f6de1a281568edd3d3b6d83f", + "cabal_sha256": "129a59ba3ccfcd06192fd6da899e2711ae276a466915a047bd6727e4a0321d2e", "component": "lib:th-compat", "flags": [], "package": "th-compat", - "revision": 1, + "revision": 2, "source": "hackage", "src_sha256": "81f55fafc7afad7763c09cb8b7b4165ca3765edcf70ffa42c7393043a1382a1e", "version": "0.1.5" @@ -224,36 +248,27 @@ "version": "4000.4.1" }, { - "cabal_sha256": "32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e", - "component": "lib:os-string", - "flags": [], - "package": "os-string", - "revision": 0, - "source": "hackage", - "src_sha256": "0953126e962966719753c98d71f596f5fea07e100bce191b7453735a1ff2caa1", - "version": "2.0.2" - }, - { - "cabal_sha256": "ae22238274c572aa91e90c6c353e7206386708912ac5e6dc40ac61d1dcc553db", + "cabal_sha256": "573f3ab242f75465a0d67ce9d84202650a1606575e6dbd6d31ffcf4767a9a379", "component": "lib:hashable", "flags": [ + "-arch-native", "+integer-gmp", "-random-initial-seed" ], "package": "hashable", - "revision": 1, + "revision": 0, "source": "hackage", - "src_sha256": "1fa3d64548440942b2b38b99c76d8dcaa94fa2ea3912cd7a6354ea4ec4af4758", - "version": "1.4.4.0" + "src_sha256": "3baee4c9027a08830d148ec524cbc0471de645e1e8426d46780ef2758df0e8da", + "version": "1.4.7.0" }, { - "cabal_sha256": "9d5d9e605f52958d099e13a8b8f30ee56cb137c9192996245e3c533adb682cf8", + "cabal_sha256": "b7648c6165729a973d95cb328f9fd874813a81c727707e8b2552b4f03399763b", "component": "lib:async", "flags": [ "-bench" ], "package": "async", - "revision": 1, + "revision": 3, "source": "hackage", "src_sha256": "1818473ebab9212afad2ed76297aefde5fae8b5d4404daf36939aece6a8f16f7", "version": "2.2.5" @@ -321,17 +336,17 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { - "cabal_sha256": "200d756a7b3bab7ca2bac6eb50ed8252f26de77ac8def490a3ad743f2933acbd", + "cabal_sha256": "acb64f2af52d81b0bb92c266f11d43def726a7a7b74a2c23d219e160b54edec7", "component": "lib:cryptohash-sha256", "flags": [ "-exe", "+use-cbits" ], "package": "cryptohash-sha256", - "revision": 4, + "revision": 5, "source": "hackage", "src_sha256": "73a7dc7163871a80837495039a099967b11f5c4fe70a118277842f7a713c6bf6", "version": "0.11.102.1" @@ -364,60 +379,60 @@ "version": "0.0.5.0" }, { - "cabal_sha256": "17786545dce60c4d5783ba6125c0a6499a1abddd3d7417b15500ccd767c35f07", + "cabal_sha256": "8a3004c2de2a0b5ef0634d3da6eae62ba8d8a734bab9ed8c6cfd749e7ca08997", "component": "lib:lukko", "flags": [ "+ofd-locking" ], "package": "lukko", - "revision": 5, + "revision": 0, "source": "hackage", - "src_sha256": "a80efb60cfa3dae18682c01980d76d5f7e413e191cd186992e1bf7388d48ab1f", - "version": "0.1.1.3" + "src_sha256": "72d86f8aa625b461f4397f737346f78a1700a7ffbff55cf6375c5e18916e986d", + "version": "0.1.2" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar-internal", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "64a1925c93e9a26cd4c40c470736950c4b5ea7bae68418cb996c5c7df4873cba", + "cabal_sha256": "85e64a75c0b490506a7edaa2d54950c668e66b65758bb08bb14cd31faf53a206", "component": "lib:zlib", "flags": [ "-bundled-c-zlib", "+non-blocking-ffi", - "-pkg-config" + "+pkg-config" ], "package": "zlib", - "revision": 1, + "revision": 2, "source": "hackage", - "src_sha256": "7e43c205e1e1ff5a4b033086ec8cce82ab658879e977c8ba02a6701946ff7a47", - "version": "0.7.0.0" + "src_sha256": "6edd38b6b81df8d274952aa85affa6968ae86b2231e1d429ce8bc9083e6a55bc", + "version": "0.7.1.0" }, { - "cabal_sha256": "8ff70524314f9ad706f8e5051d7150ee44cb82170147879b245bdab279604b16", + "cabal_sha256": "a7311a70ce2cc820ee430c389f57f82a082f148230b37526c34eac72b7b3ff34", "component": "lib:hackage-security", "flags": [ "+cabal-syntax", "+lukko" ], "package": "hackage-security", - "revision": 1, + "revision": 4, "source": "hackage", "src_sha256": "2e4261576b3e11b9f5175392947f56a638cc1a3584b8acbb962b809d7c69db69", "version": "0.6.2.6" @@ -455,11 +470,11 @@ "version": "0.96.0.1" }, { - "cabal_sha256": "4868265ab5760d2fdeb96625b138c8df25d41b9ee2651fa299ed019a69403045", + "cabal_sha256": "3e196e1362e4d0ec9dfcd7f8d58b24fac91beafaa1c8ee34dc9dee489c362377", "component": "lib:resolv", "flags": [], "package": "resolv", - "revision": 3, + "revision": 4, "source": "hackage", "src_sha256": "880d283df9132a7375fa28670f71e86480a4f49972256dc2a204c648274ae74b", "version": "0.2.0.2" @@ -475,11 +490,11 @@ "version": "0.1.7.4" }, { - "cabal_sha256": "a8f76076a40409a36ee975970c53273c2089aec9d9ece8168dfc736dfec24b9d", + "cabal_sha256": "2de5218cef72b8ef090bd7d0fd930ffa143242a120c62e013b5cf039858f1855", "component": "lib:semaphore-compat", "flags": [], "package": "semaphore-compat", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "1c6e6fab021c2ccee5d86112fb1c0bd016d15e0cf70c489dae5fb5ec156ed9e2", "version": "1.0.0" @@ -488,6 +503,7 @@ "cabal_sha256": null, "component": "lib:cabal-install", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -495,12 +511,13 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, "component": "exe:cabal", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -508,7 +525,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": "e4be4a206f5ab6ddb5ae4fbb39101529196e20af5670c5d33326fea6eff886fd", diff --git a/bootstrap/linux-9.6.4.json b/bootstrap/linux-9.6.4.json index 7e04a3fd91a..7e806526c3a 100644 --- a/bootstrap/linux-9.6.4.json +++ b/bootstrap/linux-9.6.4.json @@ -132,7 +132,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.16" }, { "cabal_sha256": "60e78b6c60dc32a77ce6c37ed5ca4e838fc5f76f02836ef64d93cd21cc002325", @@ -159,11 +159,11 @@ "version": "3.2.0.0" }, { - "cabal_sha256": "0a6ee328b71119d7dfcd004f0ec8feb77e6e78d8f6de1a281568edd3d3b6d83f", + "cabal_sha256": "129a59ba3ccfcd06192fd6da899e2711ae276a466915a047bd6727e4a0321d2e", "component": "lib:th-compat", "flags": [], "package": "th-compat", - "revision": 1, + "revision": 2, "source": "hackage", "src_sha256": "81f55fafc7afad7763c09cb8b7b4165ca3765edcf70ffa42c7393043a1382a1e", "version": "0.1.5" @@ -194,27 +194,28 @@ "version": "4000.4.1" }, { - "cabal_sha256": "32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e", + "cabal_sha256": "4d4186bb8d711435765253c7dc076c44a1d52896300689507ba135706ab35866", "component": "lib:os-string", "flags": [], "package": "os-string", "revision": 0, "source": "hackage", - "src_sha256": "0953126e962966719753c98d71f596f5fea07e100bce191b7453735a1ff2caa1", - "version": "2.0.2" + "src_sha256": "f6b388b9f9002622901d3f71437b98f95f54fbf7fe10490d319cb801c2a061ea", + "version": "2.0.3" }, { - "cabal_sha256": "ae22238274c572aa91e90c6c353e7206386708912ac5e6dc40ac61d1dcc553db", + "cabal_sha256": "82503a1ef0a625c210e118f2785c4138f8502aacbbfd4e5d987f6baffbb87115", "component": "lib:hashable", "flags": [ + "-arch-native", "+integer-gmp", "-random-initial-seed" ], "package": "hashable", - "revision": 1, + "revision": 0, "source": "hackage", - "src_sha256": "1fa3d64548440942b2b38b99c76d8dcaa94fa2ea3912cd7a6354ea4ec4af4758", - "version": "1.4.4.0" + "src_sha256": "34652a7a1d2fc9e3d764b150bd35bcd2220761c1d4c6b446b0cfac5ad5b778cb", + "version": "1.4.6.0" }, { "cabal_sha256": "9d5d9e605f52958d099e13a8b8f30ee56cb137c9192996245e3c533adb682cf8", @@ -334,50 +335,50 @@ "version": "0.0.5.0" }, { - "cabal_sha256": "17786545dce60c4d5783ba6125c0a6499a1abddd3d7417b15500ccd767c35f07", + "cabal_sha256": "8a3004c2de2a0b5ef0634d3da6eae62ba8d8a734bab9ed8c6cfd749e7ca08997", "component": "lib:lukko", "flags": [ "+ofd-locking" ], "package": "lukko", - "revision": 5, + "revision": 0, "source": "hackage", - "src_sha256": "a80efb60cfa3dae18682c01980d76d5f7e413e191cd186992e1bf7388d48ab1f", - "version": "0.1.1.3" + "src_sha256": "72d86f8aa625b461f4397f737346f78a1700a7ffbff55cf6375c5e18916e986d", + "version": "0.1.2" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "b853b4296cb23386feda17dc0d9065af6709d22d684ec734aab65403d59ed547", "component": "lib:tar-internal", "flags": [], "package": "tar", "revision": 0, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "b853b4296cb23386feda17dc0d9065af6709d22d684ec734aab65403d59ed547", "component": "lib:tar", "flags": [], "package": "tar", "revision": 0, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "64a1925c93e9a26cd4c40c470736950c4b5ea7bae68418cb996c5c7df4873cba", + "cabal_sha256": "d6696f2b55ab4a50b8de57947abca308604eb7cf8287c40bf69cfa26133e24d3", "component": "lib:zlib", "flags": [ "-bundled-c-zlib", "+non-blocking-ffi", - "-pkg-config" + "+pkg-config" ], "package": "zlib", - "revision": 1, + "revision": 0, "source": "hackage", - "src_sha256": "7e43c205e1e1ff5a4b033086ec8cce82ab658879e977c8ba02a6701946ff7a47", - "version": "0.7.0.0" + "src_sha256": "6edd38b6b81df8d274952aa85affa6968ae86b2231e1d429ce8bc9083e6a55bc", + "version": "0.7.1.0" }, { "cabal_sha256": "8ff70524314f9ad706f8e5051d7150ee44cb82170147879b245bdab279604b16", @@ -445,11 +446,11 @@ "version": "0.1.7.4" }, { - "cabal_sha256": "a8f76076a40409a36ee975970c53273c2089aec9d9ece8168dfc736dfec24b9d", + "cabal_sha256": "2de5218cef72b8ef090bd7d0fd930ffa143242a120c62e013b5cf039858f1855", "component": "lib:semaphore-compat", "flags": [], "package": "semaphore-compat", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "1c6e6fab021c2ccee5d86112fb1c0bd016d15e0cf70c489dae5fb5ec156ed9e2", "version": "1.0.0" diff --git a/bootstrap/linux-8.10.7.json b/bootstrap/linux-9.6.6.json similarity index 69% rename from bootstrap/linux-8.10.7.json rename to bootstrap/linux-9.6.6.json index 64f1d42ec7c..c94c6580dc5 100644 --- a/bootstrap/linux-8.10.7.json +++ b/bootstrap/linux-9.6.6.json @@ -2,35 +2,31 @@ "builtin": [ { "package": "rts", - "version": "1.0.1" + "version": "1.0.2" }, { "package": "ghc-prim", - "version": "0.6.1" + "version": "0.10.0" }, { - "package": "integer-gmp", - "version": "1.0.3.0" + "package": "ghc-bignum", + "version": "1.3" }, { "package": "base", - "version": "4.14.3.0" + "version": "4.18.2.1" }, { "package": "array", - "version": "0.5.4.0" + "version": "0.5.6.0" }, { "package": "deepseq", - "version": "1.4.4.0" - }, - { - "package": "containers", - "version": "0.6.5.1" + "version": "1.4.8.1" }, { "package": "ghc-boot-th", - "version": "8.10.7" + "version": "9.6.6" }, { "package": "pretty", @@ -38,87 +34,89 @@ }, { "package": "template-haskell", - "version": "2.16.0.0" + "version": "2.20.0.0" + }, + { + "package": "containers", + "version": "0.6.7" + }, + { + "package": "bytestring", + "version": "0.11.5.3" }, { "package": "transformers", - "version": "0.5.6.2" + "version": "0.6.1.0" }, { "package": "mtl", - "version": "2.2.2" + "version": "2.3.1" }, { "package": "stm", - "version": "2.5.0.1" + "version": "2.5.1.0" }, { "package": "exceptions", - "version": "0.10.4" + "version": "0.10.7" + }, + { + "package": "filepath", + "version": "1.4.300.1" }, { "package": "time", - "version": "1.9.3" - } - ], - "dependencies": [ + "version": "1.12.2" + }, { - "cabal_sha256": "a4a1975fde77e289b605c45a3ef78d731d8c1834e4cef311152d910a1e94d98c", - "component": "lib:data-array-byte", - "flags": [], - "package": "data-array-byte", - "revision": 3, - "source": "hackage", - "src_sha256": "1bb6eca0b3e02d057fe7f4e14c81ef395216f421ab30fdaa1b18017c9c025600", - "version": "0.1.0.1" + "package": "binary", + "version": "0.8.9.1" }, { - "cabal_sha256": "98e79e1c97117143e4012983509ec95f7e5e4f6adff6914d07812a39f83404b9", - "component": "lib:bytestring", - "flags": [ - "-pure-haskell" - ], - "package": "bytestring", - "revision": 1, - "source": "hackage", - "src_sha256": "ebc3b8a6ef74a5cd6ddbb8d447d1c9a5fd4964c7975ebcae0b8ab0bcc406cc8c", - "version": "0.12.1.0" + "package": "text", + "version": "2.0.2" }, { - "cabal_sha256": "d9e181e1acae0ac505d8b217dec3805c68554878f1e32b3d8351b9ce17061623", - "component": "lib:filepath", + "package": "parsec", + "version": "3.1.16.1" + } + ], + "dependencies": [ + { + "cabal_sha256": "5b7f8afd7a879c3c8c3c636fd3c7543cdd5e0b514b7da90e76907ccd11434031", + "component": "lib:unix", "flags": [ - "-cpphs" + "-os-string" ], - "package": "filepath", - "revision": 0, + "package": "unix", + "revision": 1, "source": "hackage", - "src_sha256": "337a0b5bcf0898cb7f51ff327528cf26f4ac38baed7b66b28fbdea334699d8ed", - "version": "1.4.300.1" + "src_sha256": "8117599bb3e4aa1d4656710afbc85aef2a75483eddfac5338f8cc88fb505eea2", + "version": "2.8.6.0" }, { - "cabal_sha256": "3f702a252a313a7bcb56e3908a14e7f9f1b40e41b7bdc8ae8a9605a1a8686f06", - "component": "lib:unix", + "cabal_sha256": "e3e1866eab82cb28f6a5f28507643da3987008b737e66a3c7398f39f16d824dc", + "component": "lib:file-io", "flags": [ "-os-string" ], - "package": "unix", + "package": "file-io", "revision": 0, "source": "hackage", - "src_sha256": "5ab6c346aef2eb9bf80b4d29ca7e22063fc23e52fd69fbc4d18a9f98b154e424", - "version": "2.8.5.1" + "src_sha256": "e3d9113a015c57e3d8c2294550c41544f84a265291fed96cca697f91b6e86f52", + "version": "0.1.4" }, { - "cabal_sha256": "ae1730011f547153bb52139f217d1d524202b3da730a369660fc539e5dcfff31", + "cabal_sha256": "2490137bb7738bd79392959458ef5f276219ea5ba8a9a56d3e0b06315c1bb917", "component": "lib:directory", "flags": [ "-os-string" ], "package": "directory", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "a4e798a4e5339a7aa9577515886271386280bfbc1fe4a29fd4aa6464d4792064", - "version": "1.3.8.4" + "src_sha256": "20a24846117fc5f8751d974b7de07210a161989410467e9adca525381b8e64cc", + "version": "1.3.9.0" }, { "cabal_sha256": "de553eefe0b6548a560e9d8100486310548470a403c1fa21108dd03713da5fc7", @@ -130,40 +128,6 @@ "src_sha256": "c92efe86f8eb959ee03be6c04ee57ebc7e4abc75a6c4b26551215d7443e92a07", "version": "3.5.1.0" }, - { - "cabal_sha256": "03381e511429c44d13990c6d76281c4fc2468371cede4fe684b0c98d9b7d5f5a", - "component": "lib:binary", - "flags": [], - "package": "binary", - "revision": 0, - "source": "hackage", - "src_sha256": "8437116b4eccdba13cb9badb62331c0d4598c3f0252a587e37d8f5990d9bf74c", - "version": "0.8.9.2" - }, - { - "cabal_sha256": "aa7a5a92fe430a34d24d33878323c8a010021e05e410fe98b7fac3015c88dc74", - "component": "lib:text", - "flags": [ - "-developer", - "-pure-haskell", - "+simdutf" - ], - "package": "text", - "revision": 0, - "source": "hackage", - "src_sha256": "e40cdda8b285f4d72476ed35dc2f5f167d524e6b38bb5ec964d00ee1ff24feab", - "version": "2.1.1" - }, - { - "cabal_sha256": "8407cbd428d7f640a0fff8891bd2f7aca13cebe70a5e654856f8abec9a648b56", - "component": "lib:parsec", - "flags": [], - "package": "parsec", - "revision": 1, - "source": "hackage", - "src_sha256": "58c500bec1ec3c849c8243ddfd675a5983b17a8e5da55acea6adade5ae179d36", - "version": "3.1.17.0" - }, { "cabal_sha256": null, "component": "lib:Cabal-syntax", @@ -172,27 +136,29 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { - "cabal_sha256": "7785a72bc140ae5a9ef2439f10637b5fd104999832f1d93328d4973f37cb8469", + "cabal_sha256": "9a0b2ef8096517fa0e0c7a5e9a5c2ae5744ed824c3331005f9408245810df345", "component": "lib:process", "flags": [], "package": "process", "revision": 0, "source": "hackage", - "src_sha256": "b468355ab46966537eb171ed5593a0a1facc8d2eefc38659e43768f68f5dcb96", - "version": "1.6.19.0" + "src_sha256": "496fe0566c3915b112e9772ac9c967dfeb8d5ca04895e54ae0160522bee76e65", + "version": "1.6.25.0" }, { "cabal_sha256": null, "component": "lib:Cabal", - "flags": [], + "flags": [ + "-git-rev" + ], "package": "Cabal", "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, @@ -202,22 +168,22 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.16" }, { - "cabal_sha256": "60e78b6c60dc32a77ce6c37ed5ca4e838fc5f76f02836ef64d93cd21cc002325", + "cabal_sha256": "276325277350cd2c2c88916ed3ae5cd35b2b4f494ec594fbd9534081eb7fb759", "component": "exe:hsc2hs", "flags": [ "-in-ghc-tree" ], "package": "hsc2hs", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "6f4e34d788fe2ca7091ee0a10307ee8a7c060a1ba890f2bffad16a7d4d5cef76", "version": "0.68.10" }, { - "cabal_sha256": "25440c1bbd5772fdbbeec068f20138121131e1a56453db0adc113dcdf9044105", + "cabal_sha256": "b0fafb2834530084f6406017500ae619f9e5e2049787a6750c68e0d331fd62dc", "component": "lib:network", "flags": [ "-devel" @@ -225,15 +191,15 @@ "package": "network", "revision": 0, "source": "hackage", - "src_sha256": "c45696744dc437d93a56871a3dd869965b7b50eda3fe3c1a90a35e2fbb9cb9ca", - "version": "3.2.0.0" + "src_sha256": "dbd8a10456908294eb5ab9c522bf2da75444d958429a643a821464213698523e", + "version": "3.2.6.0" }, { - "cabal_sha256": "0a6ee328b71119d7dfcd004f0ec8feb77e6e78d8f6de1a281568edd3d3b6d83f", + "cabal_sha256": "129a59ba3ccfcd06192fd6da899e2711ae276a466915a047bd6727e4a0321d2e", "component": "lib:th-compat", "flags": [], "package": "th-compat", - "revision": 1, + "revision": 2, "source": "hackage", "src_sha256": "81f55fafc7afad7763c09cb8b7b4165ca3765edcf70ffa42c7393043a1382a1e", "version": "0.1.5" @@ -264,36 +230,36 @@ "version": "4000.4.1" }, { - "cabal_sha256": "c4733d09f798fc4304e936924a1a7d9fc2425aefad6c46ad4592035254b46051", - "component": "lib:base-orphans", + "cabal_sha256": "2efc549644dd418bad537d1601fdd437c440d807265016bd993b6996c679ad2f", + "component": "lib:os-string", "flags": [], - "package": "base-orphans", + "package": "os-string", "revision": 0, "source": "hackage", - "src_sha256": "5bbf2da382c5b212d6a8be2f8c49edee0eba30f272a15fd32c13e6e4091ef172", - "version": "0.9.1" + "src_sha256": "339c35fd3a290522f23de4e33528423cfd0b0a8f22946b0b9816a817b926cba0", + "version": "2.0.7" }, { - "cabal_sha256": "ae22238274c572aa91e90c6c353e7206386708912ac5e6dc40ac61d1dcc553db", + "cabal_sha256": "2f23146cbe0325029927b221647695a4c7d6e97548ff731110979e34361f58ef", "component": "lib:hashable", "flags": [ - "+integer-gmp", + "-arch-native", "-random-initial-seed" ], "package": "hashable", "revision": 1, "source": "hackage", - "src_sha256": "1fa3d64548440942b2b38b99c76d8dcaa94fa2ea3912cd7a6354ea4ec4af4758", - "version": "1.4.4.0" + "src_sha256": "e58b3a8e18da5f6cd7e937e5fd683e500bb1f8276b3768269759119ca0cddb6a", + "version": "1.5.0.0" }, { - "cabal_sha256": "9d5d9e605f52958d099e13a8b8f30ee56cb137c9192996245e3c533adb682cf8", + "cabal_sha256": "b7648c6165729a973d95cb328f9fd874813a81c727707e8b2552b4f03399763b", "component": "lib:async", "flags": [ "-bench" ], "package": "async", - "revision": 1, + "revision": 3, "source": "hackage", "src_sha256": "1818473ebab9212afad2ed76297aefde5fae8b5d4404daf36939aece6a8f16f7", "version": "2.2.5" @@ -361,17 +327,17 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { - "cabal_sha256": "200d756a7b3bab7ca2bac6eb50ed8252f26de77ac8def490a3ad743f2933acbd", + "cabal_sha256": "acb64f2af52d81b0bb92c266f11d43def726a7a7b74a2c23d219e160b54edec7", "component": "lib:cryptohash-sha256", "flags": [ "-exe", "+use-cbits" ], "package": "cryptohash-sha256", - "revision": 4, + "revision": 5, "source": "hackage", "src_sha256": "73a7dc7163871a80837495039a099967b11f5c4fe70a118277842f7a713c6bf6", "version": "0.11.102.1" @@ -404,70 +370,60 @@ "version": "0.0.5.0" }, { - "cabal_sha256": "17786545dce60c4d5783ba6125c0a6499a1abddd3d7417b15500ccd767c35f07", + "cabal_sha256": "8a3004c2de2a0b5ef0634d3da6eae62ba8d8a734bab9ed8c6cfd749e7ca08997", "component": "lib:lukko", "flags": [ "+ofd-locking" ], "package": "lukko", - "revision": 5, - "source": "hackage", - "src_sha256": "a80efb60cfa3dae18682c01980d76d5f7e413e191cd186992e1bf7388d48ab1f", - "version": "0.1.1.3" - }, - { - "cabal_sha256": "32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e", - "component": "lib:os-string", - "flags": [], - "package": "os-string", "revision": 0, "source": "hackage", - "src_sha256": "0953126e962966719753c98d71f596f5fea07e100bce191b7453735a1ff2caa1", - "version": "2.0.2" + "src_sha256": "72d86f8aa625b461f4397f737346f78a1700a7ffbff55cf6375c5e18916e986d", + "version": "0.1.2" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar-internal", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "64a1925c93e9a26cd4c40c470736950c4b5ea7bae68418cb996c5c7df4873cba", + "cabal_sha256": "85e64a75c0b490506a7edaa2d54950c668e66b65758bb08bb14cd31faf53a206", "component": "lib:zlib", "flags": [ "-bundled-c-zlib", "+non-blocking-ffi", - "-pkg-config" + "+pkg-config" ], "package": "zlib", - "revision": 1, + "revision": 2, "source": "hackage", - "src_sha256": "7e43c205e1e1ff5a4b033086ec8cce82ab658879e977c8ba02a6701946ff7a47", - "version": "0.7.0.0" + "src_sha256": "6edd38b6b81df8d274952aa85affa6968ae86b2231e1d429ce8bc9083e6a55bc", + "version": "0.7.1.0" }, { - "cabal_sha256": "8ff70524314f9ad706f8e5051d7150ee44cb82170147879b245bdab279604b16", + "cabal_sha256": "a7311a70ce2cc820ee430c389f57f82a082f148230b37526c34eac72b7b3ff34", "component": "lib:hackage-security", "flags": [ "+cabal-syntax", "+lukko" ], "package": "hackage-security", - "revision": 1, + "revision": 4, "source": "hackage", "src_sha256": "2e4261576b3e11b9f5175392947f56a638cc1a3584b8acbb962b809d7c69db69", "version": "0.6.2.6" @@ -505,11 +461,11 @@ "version": "0.96.0.1" }, { - "cabal_sha256": "4868265ab5760d2fdeb96625b138c8df25d41b9ee2651fa299ed019a69403045", + "cabal_sha256": "3e196e1362e4d0ec9dfcd7f8d58b24fac91beafaa1c8ee34dc9dee489c362377", "component": "lib:resolv", "flags": [], "package": "resolv", - "revision": 3, + "revision": 4, "source": "hackage", "src_sha256": "880d283df9132a7375fa28670f71e86480a4f49972256dc2a204c648274ae74b", "version": "0.2.0.2" @@ -525,11 +481,11 @@ "version": "0.1.7.4" }, { - "cabal_sha256": "a8f76076a40409a36ee975970c53273c2089aec9d9ece8168dfc736dfec24b9d", + "cabal_sha256": "2de5218cef72b8ef090bd7d0fd930ffa143242a120c62e013b5cf039858f1855", "component": "lib:semaphore-compat", "flags": [], "package": "semaphore-compat", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "1c6e6fab021c2ccee5d86112fb1c0bd016d15e0cf70c489dae5fb5ec156ed9e2", "version": "1.0.0" @@ -538,6 +494,7 @@ "cabal_sha256": null, "component": "lib:cabal-install", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -545,12 +502,13 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, "component": "exe:cabal", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -558,7 +516,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": "e4be4a206f5ab6ddb5ae4fbb39101529196e20af5670c5d33326fea6eff886fd", diff --git a/bootstrap/linux-9.8.2.json b/bootstrap/linux-9.8.2.json index 9876089e798..69cb0baa82e 100644 --- a/bootstrap/linux-9.8.2.json +++ b/bootstrap/linux-9.8.2.json @@ -60,22 +60,10 @@ "package": "exceptions", "version": "0.10.7" }, - { - "package": "filepath", - "version": "1.4.200.1" - }, { "package": "time", "version": "1.12.2" }, - { - "package": "unix", - "version": "2.8.4.0" - }, - { - "package": "directory", - "version": "1.3.8.1" - }, { "package": "binary", "version": "0.8.9.1" @@ -87,17 +75,67 @@ { "package": "parsec", "version": "3.1.17.0" + } + ], + "dependencies": [ + { + "cabal_sha256": "2efc549644dd418bad537d1601fdd437c440d807265016bd993b6996c679ad2f", + "component": "lib:os-string", + "flags": [], + "package": "os-string", + "revision": 0, + "source": "hackage", + "src_sha256": "339c35fd3a290522f23de4e33528423cfd0b0a8f22946b0b9816a817b926cba0", + "version": "2.0.7" }, { - "package": "process", - "version": "1.6.18.0" + "cabal_sha256": "099c33e0e570dad93390e1c01c1f4bc6e4f13587de8e199df3c94a6cb62c7434", + "component": "lib:filepath", + "flags": [ + "-cpphs" + ], + "package": "filepath", + "revision": 0, + "source": "hackage", + "src_sha256": "54aa86c432f593273d7b9f607c5b5e0a1628c2674c6f4e3b5a54eb0c83db5caf", + "version": "1.5.4.0" }, { - "package": "semaphore-compat", - "version": "1.0.0" - } - ], - "dependencies": [ + "cabal_sha256": "5b7f8afd7a879c3c8c3c636fd3c7543cdd5e0b514b7da90e76907ccd11434031", + "component": "lib:unix", + "flags": [ + "+os-string" + ], + "package": "unix", + "revision": 1, + "source": "hackage", + "src_sha256": "8117599bb3e4aa1d4656710afbc85aef2a75483eddfac5338f8cc88fb505eea2", + "version": "2.8.6.0" + }, + { + "cabal_sha256": "e3e1866eab82cb28f6a5f28507643da3987008b737e66a3c7398f39f16d824dc", + "component": "lib:file-io", + "flags": [ + "+os-string" + ], + "package": "file-io", + "revision": 0, + "source": "hackage", + "src_sha256": "e3d9113a015c57e3d8c2294550c41544f84a265291fed96cca697f91b6e86f52", + "version": "0.1.4" + }, + { + "cabal_sha256": "2490137bb7738bd79392959458ef5f276219ea5ba8a9a56d3e0b06315c1bb917", + "component": "lib:directory", + "flags": [ + "+os-string" + ], + "package": "directory", + "revision": 1, + "source": "hackage", + "src_sha256": "20a24846117fc5f8751d974b7de07210a161989410467e9adca525381b8e64cc", + "version": "1.3.9.0" + }, { "cabal_sha256": "de553eefe0b6548a560e9d8100486310548470a403c1fa21108dd03713da5fc7", "component": "exe:alex", @@ -116,17 +154,29 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" + }, + { + "cabal_sha256": "9a0b2ef8096517fa0e0c7a5e9a5c2ae5744ed824c3331005f9408245810df345", + "component": "lib:process", + "flags": [], + "package": "process", + "revision": 0, + "source": "hackage", + "src_sha256": "496fe0566c3915b112e9772ac9c967dfeb8d5ca04895e54ae0160522bee76e65", + "version": "1.6.25.0" }, { "cabal_sha256": null, "component": "lib:Cabal", - "flags": [], + "flags": [ + "-git-rev" + ], "package": "Cabal", "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, @@ -136,22 +186,22 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "0.1" + "version": "3.16" }, { - "cabal_sha256": "60e78b6c60dc32a77ce6c37ed5ca4e838fc5f76f02836ef64d93cd21cc002325", + "cabal_sha256": "276325277350cd2c2c88916ed3ae5cd35b2b4f494ec594fbd9534081eb7fb759", "component": "exe:hsc2hs", "flags": [ "-in-ghc-tree" ], "package": "hsc2hs", - "revision": 2, + "revision": 3, "source": "hackage", "src_sha256": "6f4e34d788fe2ca7091ee0a10307ee8a7c060a1ba890f2bffad16a7d4d5cef76", "version": "0.68.10" }, { - "cabal_sha256": "25440c1bbd5772fdbbeec068f20138121131e1a56453db0adc113dcdf9044105", + "cabal_sha256": "b0fafb2834530084f6406017500ae619f9e5e2049787a6750c68e0d331fd62dc", "component": "lib:network", "flags": [ "-devel" @@ -159,15 +209,15 @@ "package": "network", "revision": 0, "source": "hackage", - "src_sha256": "c45696744dc437d93a56871a3dd869965b7b50eda3fe3c1a90a35e2fbb9cb9ca", - "version": "3.2.0.0" + "src_sha256": "dbd8a10456908294eb5ab9c522bf2da75444d958429a643a821464213698523e", + "version": "3.2.6.0" }, { - "cabal_sha256": "0a6ee328b71119d7dfcd004f0ec8feb77e6e78d8f6de1a281568edd3d3b6d83f", + "cabal_sha256": "129a59ba3ccfcd06192fd6da899e2711ae276a466915a047bd6727e4a0321d2e", "component": "lib:th-compat", "flags": [], "package": "th-compat", - "revision": 1, + "revision": 2, "source": "hackage", "src_sha256": "81f55fafc7afad7763c09cb8b7b4165ca3765edcf70ffa42c7393043a1382a1e", "version": "0.1.5" @@ -198,36 +248,26 @@ "version": "4000.4.1" }, { - "cabal_sha256": "32fa47f8345a2c0662fb602fc42e4b674e41ec48079b68bdecb4b6f68032c24e", - "component": "lib:os-string", - "flags": [], - "package": "os-string", - "revision": 0, - "source": "hackage", - "src_sha256": "0953126e962966719753c98d71f596f5fea07e100bce191b7453735a1ff2caa1", - "version": "2.0.2" - }, - { - "cabal_sha256": "ae22238274c572aa91e90c6c353e7206386708912ac5e6dc40ac61d1dcc553db", + "cabal_sha256": "2f23146cbe0325029927b221647695a4c7d6e97548ff731110979e34361f58ef", "component": "lib:hashable", "flags": [ - "+integer-gmp", + "-arch-native", "-random-initial-seed" ], "package": "hashable", "revision": 1, "source": "hackage", - "src_sha256": "1fa3d64548440942b2b38b99c76d8dcaa94fa2ea3912cd7a6354ea4ec4af4758", - "version": "1.4.4.0" + "src_sha256": "e58b3a8e18da5f6cd7e937e5fd683e500bb1f8276b3768269759119ca0cddb6a", + "version": "1.5.0.0" }, { - "cabal_sha256": "9d5d9e605f52958d099e13a8b8f30ee56cb137c9192996245e3c533adb682cf8", + "cabal_sha256": "b7648c6165729a973d95cb328f9fd874813a81c727707e8b2552b4f03399763b", "component": "lib:async", "flags": [ "-bench" ], "package": "async", - "revision": 1, + "revision": 3, "source": "hackage", "src_sha256": "1818473ebab9212afad2ed76297aefde5fae8b5d4404daf36939aece6a8f16f7", "version": "2.2.5" @@ -295,17 +335,17 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { - "cabal_sha256": "200d756a7b3bab7ca2bac6eb50ed8252f26de77ac8def490a3ad743f2933acbd", + "cabal_sha256": "acb64f2af52d81b0bb92c266f11d43def726a7a7b74a2c23d219e160b54edec7", "component": "lib:cryptohash-sha256", "flags": [ "-exe", "+use-cbits" ], "package": "cryptohash-sha256", - "revision": 4, + "revision": 5, "source": "hackage", "src_sha256": "73a7dc7163871a80837495039a099967b11f5c4fe70a118277842f7a713c6bf6", "version": "0.11.102.1" @@ -338,60 +378,60 @@ "version": "0.0.5.0" }, { - "cabal_sha256": "17786545dce60c4d5783ba6125c0a6499a1abddd3d7417b15500ccd767c35f07", + "cabal_sha256": "8a3004c2de2a0b5ef0634d3da6eae62ba8d8a734bab9ed8c6cfd749e7ca08997", "component": "lib:lukko", "flags": [ "+ofd-locking" ], "package": "lukko", - "revision": 5, + "revision": 0, "source": "hackage", - "src_sha256": "a80efb60cfa3dae18682c01980d76d5f7e413e191cd186992e1bf7388d48ab1f", - "version": "0.1.1.3" + "src_sha256": "72d86f8aa625b461f4397f737346f78a1700a7ffbff55cf6375c5e18916e986d", + "version": "0.1.2" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar-internal", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "619828cae098a7b6deeb0316e12f55011101d88f756787ed024ceedb81cf1eba", + "cabal_sha256": "e9f151d9999be8953443e730524b2792e9c0a4fb5b1463097fa1a8230870fd8a", "component": "lib:tar", "flags": [], "package": "tar", - "revision": 0, + "revision": 1, "source": "hackage", - "src_sha256": "08c61e82b59ed6fe7e85e9fe7cceaaf853ba54511d1ec57efa511ddc55ef1998", - "version": "0.6.2.0" + "src_sha256": "50bb660feec8a524416d6934251b996eaa7e39d49ae107ad505ab700d43f6814", + "version": "0.6.3.0" }, { - "cabal_sha256": "64a1925c93e9a26cd4c40c470736950c4b5ea7bae68418cb996c5c7df4873cba", + "cabal_sha256": "85e64a75c0b490506a7edaa2d54950c668e66b65758bb08bb14cd31faf53a206", "component": "lib:zlib", "flags": [ "-bundled-c-zlib", "+non-blocking-ffi", - "-pkg-config" + "+pkg-config" ], "package": "zlib", - "revision": 1, + "revision": 2, "source": "hackage", - "src_sha256": "7e43c205e1e1ff5a4b033086ec8cce82ab658879e977c8ba02a6701946ff7a47", - "version": "0.7.0.0" + "src_sha256": "6edd38b6b81df8d274952aa85affa6968ae86b2231e1d429ce8bc9083e6a55bc", + "version": "0.7.1.0" }, { - "cabal_sha256": "8ff70524314f9ad706f8e5051d7150ee44cb82170147879b245bdab279604b16", + "cabal_sha256": "a7311a70ce2cc820ee430c389f57f82a082f148230b37526c34eac72b7b3ff34", "component": "lib:hackage-security", "flags": [ "+cabal-syntax", "+lukko" ], "package": "hackage-security", - "revision": 1, + "revision": 4, "source": "hackage", "src_sha256": "2e4261576b3e11b9f5175392947f56a638cc1a3584b8acbb962b809d7c69db69", "version": "0.6.2.6" @@ -429,11 +469,11 @@ "version": "0.96.0.1" }, { - "cabal_sha256": "4868265ab5760d2fdeb96625b138c8df25d41b9ee2651fa299ed019a69403045", + "cabal_sha256": "3e196e1362e4d0ec9dfcd7f8d58b24fac91beafaa1c8ee34dc9dee489c362377", "component": "lib:resolv", "flags": [], "package": "resolv", - "revision": 3, + "revision": 4, "source": "hackage", "src_sha256": "880d283df9132a7375fa28670f71e86480a4f49972256dc2a204c648274ae74b", "version": "0.2.0.2" @@ -448,10 +488,21 @@ "src_sha256": "3c51d8d50c9b60ff8bf94f942fd92e3bea9e62c5afa778dfc9f707b79da41ef6", "version": "0.1.7.4" }, + { + "cabal_sha256": "2de5218cef72b8ef090bd7d0fd930ffa143242a120c62e013b5cf039858f1855", + "component": "lib:semaphore-compat", + "flags": [], + "package": "semaphore-compat", + "revision": 3, + "source": "hackage", + "src_sha256": "1c6e6fab021c2ccee5d86112fb1c0bd016d15e0cf70c489dae5fb5ec156ed9e2", + "version": "1.0.0" + }, { "cabal_sha256": null, "component": "lib:cabal-install", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -459,12 +510,13 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": null, "component": "exe:cabal", "flags": [ + "-git-rev", "+lukko", "+native-dns" ], @@ -472,7 +524,7 @@ "revision": null, "source": "local", "src_sha256": null, - "version": "3.13.0.0" + "version": "3.15.0.0" }, { "cabal_sha256": "e4be4a206f5ab6ddb5ae4fbb39101529196e20af5670c5d33326fea6eff886fd", diff --git a/bootstrap/src/Main.hs b/bootstrap/src/Main.hs index 04e3bd59dd1..af3929fe16c 100644 --- a/bootstrap/src/Main.hs +++ b/bootstrap/src/Main.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE LambdaCase #-} {-# OPTIONS_GHC -Wno-deferred-out-of-scope-variables #-} module Main (main) where diff --git a/buildinfo-reference-generator/buildinfo-reference-generator.cabal b/buildinfo-reference-generator/buildinfo-reference-generator.cabal index 667e8346b63..a09fc4dc62c 100644 --- a/buildinfo-reference-generator/buildinfo-reference-generator.cabal +++ b/buildinfo-reference-generator/buildinfo-reference-generator.cabal @@ -8,7 +8,7 @@ executable buildinfo-reference-generator ghc-options: -Wall main-is: Main.hs build-depends: - , base >=4.11 && <4.20 + , base >=4.11 && <4.22 , Cabal , Cabal-described , containers diff --git a/cabal-dev-scripts/cabal-dev-scripts.cabal b/cabal-dev-scripts/cabal-dev-scripts.cabal index 399888dfb8d..5ae899febe1 100644 --- a/cabal-dev-scripts/cabal-dev-scripts.cabal +++ b/cabal-dev-scripts/cabal-dev-scripts.cabal @@ -18,7 +18,7 @@ executable gen-spdx ghc-options: -Wall build-depends: , aeson ^>=1.4.1.0 || ^>=1.5.2.0 || ^>=2.2.1.0 - , base >=4.11 && <4.20 + , base >=4.13 && <4.20 , bytestring , containers , Diff ^>=0.4 @@ -35,7 +35,7 @@ executable gen-spdx-exc ghc-options: -Wall build-depends: , aeson ^>=1.4.1.0 || ^>=1.5.2.0 || ^>=2.2.1.0 - , base >=4.11 && <4.20 + , base >=4.13 && <4.20 , bytestring , containers , Diff ^>=0.4 diff --git a/cabal-dev-scripts/src/GenSPDX.hs b/cabal-dev-scripts/src/GenSPDX.hs index adb3276a1bd..e41ed10bfee 100644 --- a/cabal-dev-scripts/src/GenSPDX.hs +++ b/cabal-dev-scripts/src/GenSPDX.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} module Main (main) where @@ -36,6 +35,7 @@ main = generate =<< O.execParser opts where <*> licenses "3.10" <*> licenses "3.16" <*> licenses "3.23" + <*> licenses "3.25" template = O.strArgument $ mconcat [ O.metavar "SPDX.LicenseId.template.hs" diff --git a/cabal-dev-scripts/src/GenSPDXExc.hs b/cabal-dev-scripts/src/GenSPDXExc.hs index c85438a828b..a9a08717818 100644 --- a/cabal-dev-scripts/src/GenSPDXExc.hs +++ b/cabal-dev-scripts/src/GenSPDXExc.hs @@ -35,6 +35,7 @@ main = generate =<< O.execParser opts where <*> licenses "3.10" <*> licenses "3.16" <*> licenses "3.23" + <*> licenses "3.25" template = O.strArgument $ mconcat [ O.metavar "SPDX.LicenseExceptionId.template.hs" diff --git a/cabal-dev-scripts/src/GenUtils.hs b/cabal-dev-scripts/src/GenUtils.hs index 7d7b39c2add..3e6244ffe7f 100644 --- a/cabal-dev-scripts/src/GenUtils.hs +++ b/cabal-dev-scripts/src/GenUtils.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE FunctionalDependencies #-} @@ -15,6 +13,7 @@ import Data.Text (Text) import GHC.Generics (Generic) import qualified Data.Algorithm.Diff as Diff +import qualified Data.Char as C import qualified Data.Map as Map import qualified Data.Set as Set import qualified Data.Text as T @@ -33,12 +32,14 @@ data SPDXLicenseListVersion | SPDXLicenseListVersion_3_10 | SPDXLicenseListVersion_3_16 | SPDXLicenseListVersion_3_23 + | SPDXLicenseListVersion_3_25 deriving (Eq, Ord, Show, Enum, Bounded) allVers :: Set.Set SPDXLicenseListVersion allVers = Set.fromList [minBound .. maxBound] prettyVer :: SPDXLicenseListVersion -> Text +prettyVer SPDXLicenseListVersion_3_25 = "SPDX License List 3.25" prettyVer SPDXLicenseListVersion_3_23 = "SPDX License List 3.23" prettyVer SPDXLicenseListVersion_3_16 = "SPDX License List 3.16" prettyVer SPDXLicenseListVersion_3_10 = "SPDX License List 3.10" @@ -48,6 +49,7 @@ prettyVer SPDXLicenseListVersion_3_2 = "SPDX License List 3.2" prettyVer SPDXLicenseListVersion_3_0 = "SPDX License List 3.0" suffixVer :: SPDXLicenseListVersion -> String +suffixVer SPDXLicenseListVersion_3_25 = "_3_25" suffixVer SPDXLicenseListVersion_3_23 = "_3_23" suffixVer SPDXLicenseListVersion_3_16 = "_3_16" suffixVer SPDXLicenseListVersion_3_10 = "_3_10" @@ -60,7 +62,7 @@ suffixVer SPDXLicenseListVersion_3_0 = "_3_0" -- Per version ------------------------------------------------------------------------------- -data PerV a = PerV a a a a a a a +data PerV a = PerV a a a a a a a a deriving (Show, Functor, Foldable, Traversable) class Functor f => Representable i f | f -> i where @@ -68,13 +70,14 @@ class Functor f => Representable i f | f -> i where tabulate :: (i -> a) -> f a instance Representable SPDXLicenseListVersion PerV where - index SPDXLicenseListVersion_3_0 (PerV x _ _ _ _ _ _) = x - index SPDXLicenseListVersion_3_2 (PerV _ x _ _ _ _ _) = x - index SPDXLicenseListVersion_3_6 (PerV _ _ x _ _ _ _) = x - index SPDXLicenseListVersion_3_9 (PerV _ _ _ x _ _ _) = x - index SPDXLicenseListVersion_3_10 (PerV _ _ _ _ x _ _) = x - index SPDXLicenseListVersion_3_16 (PerV _ _ _ _ _ x _) = x - index SPDXLicenseListVersion_3_23 (PerV _ _ _ _ _ _ x) = x + index SPDXLicenseListVersion_3_0 (PerV x _ _ _ _ _ _ _) = x + index SPDXLicenseListVersion_3_2 (PerV _ x _ _ _ _ _ _) = x + index SPDXLicenseListVersion_3_6 (PerV _ _ x _ _ _ _ _) = x + index SPDXLicenseListVersion_3_9 (PerV _ _ _ x _ _ _ _) = x + index SPDXLicenseListVersion_3_10 (PerV _ _ _ _ x _ _ _) = x + index SPDXLicenseListVersion_3_16 (PerV _ _ _ _ _ x _ _) = x + index SPDXLicenseListVersion_3_23 (PerV _ _ _ _ _ _ x _) = x + index SPDXLicenseListVersion_3_25 (PerV _ _ _ _ _ _ _ x) = x tabulate f = PerV (f SPDXLicenseListVersion_3_0) @@ -84,6 +87,7 @@ instance Representable SPDXLicenseListVersion PerV where (f SPDXLicenseListVersion_3_10) (f SPDXLicenseListVersion_3_16) (f SPDXLicenseListVersion_3_23) + (f SPDXLicenseListVersion_3_25) ------------------------------------------------------------------------------- -- Sorting @@ -160,9 +164,10 @@ toConstructorName t = t f c = c special :: Text -> Text - special "0BSD" = "NullBSD" - special "389_exception" = "DS389_exception" - special u = u + special u + | Just (c, _) <- T.uncons u + , C.isDigit c = "N_" <> u + special u = u mkList :: [Text] -> Text mkList [] = " []" diff --git a/cabal-install-solver/ChangeLog.md b/cabal-install-solver/ChangeLog.md index 3bfdd653afe..64dfd69e966 100644 --- a/cabal-install-solver/ChangeLog.md +++ b/cabal-install-solver/ChangeLog.md @@ -1 +1 @@ -Please see https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.10.3.0.md +Please see https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.14.1.0.md diff --git a/cabal-install-solver/cabal-install-solver.cabal b/cabal-install-solver/cabal-install-solver.cabal index 0e9bd6e9bff..a96b787f55e 100644 --- a/cabal-install-solver/cabal-install-solver.cabal +++ b/cabal-install-solver/cabal-install-solver.cabal @@ -1,9 +1,9 @@ cabal-version: 2.2 name: cabal-install-solver -version: 3.13.0.0 -synopsis: The command-line interface for Cabal and Hackage. +version: 3.15.0.0 +synopsis: The solver component of cabal-install description: - The solver component used in cabal-install command-line program + The solver component used in the cabal-install command-line program. homepage: http://www.haskell.org/cabal/ bug-reports: https://github.com/haskell/cabal/issues @@ -99,10 +99,10 @@ library build-depends: , array >=0.4 && <0.6 - , base >=4.11 && <4.20 + , base >=4.13 && <4.22 , bytestring >=0.10.6.0 && <0.13 - , Cabal ^>=3.13 - , Cabal-syntax ^>=3.13 + , Cabal ^>=3.15 + , Cabal-syntax ^>=3.15 , containers >=0.5.6.2 && <0.8 , edit-distance ^>= 0.2.2 , directory >= 1.3.7.0 && < 1.4 @@ -131,9 +131,9 @@ Test-Suite unit-tests UnitTests.Distribution.Solver.Modular.MessageUtils build-depends: - , base >= 4.11 && <4.20 + , base >= 4.13 && <4.22 , Cabal-syntax , cabal-install-solver , tasty >= 1.2.3 && <1.6 - , tasty-quickcheck + , tasty-quickcheck <0.12 , tasty-hunit >= 0.10 diff --git a/cabal-install-solver/src/Distribution/Solver/Modular.hs b/cabal-install-solver/src/Distribution/Solver/Modular.hs index 2aac240318f..9111b2d78d0 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular.hs @@ -116,7 +116,7 @@ modularResolver sc (Platform arch os) cinfo iidx sidx pkgConfigDB pprefs pcs pns solve' :: SolverConfig -> CompilerInfo -> Index - -> PkgConfigDb + -> Maybe PkgConfigDb -> (PN -> PackagePreferences) -> Map PN [LabeledPackageConstraint] -> Set PN diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/Message.hs b/cabal-install-solver/src/Distribution/Solver/Modular/Message.hs index e097d3e081c..2bc28286df0 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/Message.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/Message.hs @@ -1,6 +1,5 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE LambdaCase #-} -{-# LANGUAGE ViewPatterns #-} module Distribution.Solver.Modular.Message ( Message(..), @@ -279,6 +278,7 @@ showFR :: ConflictSet -> FailReason -> String showFR _ (UnsupportedExtension ext) = " (conflict: requires " ++ showUnsupportedExtension ext ++ ")" showFR _ (UnsupportedLanguage lang) = " (conflict: requires " ++ showUnsupportedLanguage lang ++ ")" showFR _ (MissingPkgconfigPackage pn vr) = " (conflict: pkg-config package " ++ prettyShow pn ++ prettyShow vr ++ ", not found in the pkg-config database)" +showFR _ (MissingPkgconfigProgram pn vr) = " (pkg-config package " ++ prettyShow pn ++ prettyShow vr ++ " is needed but no pkg-config executable was found or querying it failed)" showFR _ (NewPackageDoesNotMatchExistingConstraint d) = " (conflict: " ++ showConflictingDep d ++ ")" showFR _ (ConflictingConstraints d1 d2) = " (conflict: " ++ L.intercalate ", " (L.map showConflictingDep [d1, d2]) ++ ")" showFR _ (NewPackageIsMissingRequiredComponent comp dr) = " (does not contain " ++ showExposedComponent comp ++ ", which is required by " ++ showDependencyReason dr ++ ")" diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/PSQ.hs b/cabal-install-solver/src/Distribution/Solver/Modular/PSQ.hs index abed96f6b9d..a8c236a9d7b 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/PSQ.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/PSQ.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} +{-# LANGUAGE DeriveTraversable #-} module Distribution.Solver.Modular.PSQ ( PSQ(..) -- Unit test needs constructor access , casePSQ diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs b/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs index 39bd7bf4690..b57f55af1fc 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/Solver.hs @@ -91,7 +91,7 @@ newtype PruneAfterFirstSuccess = PruneAfterFirstSuccess Bool solve :: SolverConfig -- ^ solver parameters -> CompilerInfo -> Index -- ^ all available packages as an index - -> PkgConfigDb -- ^ available pkg-config pkgs + -> Maybe PkgConfigDb -- ^ available pkg-config pkgs -> (PN -> PackagePreferences) -- ^ preferences -> M.Map PN [LabeledPackageConstraint] -- ^ global constraints -> S.Set PN -- ^ global goals diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/Tree.hs b/cabal-install-solver/src/Distribution/Solver/Modular/Tree.hs index 10d372525b1..36aef5ebac7 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/Tree.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/Tree.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} +{-# LANGUAGE DeriveTraversable #-} module Distribution.Solver.Modular.Tree ( POption(..) , Tree(..) @@ -102,6 +102,7 @@ data POption = POption I (Maybe PackagePath) data FailReason = UnsupportedExtension Extension | UnsupportedLanguage Language | MissingPkgconfigPackage PkgconfigName PkgconfigVersionRange + | MissingPkgconfigProgram PkgconfigName PkgconfigVersionRange | NewPackageDoesNotMatchExistingConstraint ConflictingDep | ConflictingConstraints ConflictingDep ConflictingDep | NewPackageIsMissingRequiredComponent ExposedComponent (DependencyReason QPN) diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/Validate.hs b/cabal-install-solver/src/Distribution/Solver/Modular/Validate.hs index cbe6282b6d0..4af149b31cf 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/Validate.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/Validate.hs @@ -90,7 +90,7 @@ import Distribution.Types.PkgconfigVersionRange data ValidateState = VS { supportedExt :: Extension -> Bool, supportedLang :: Language -> Bool, - presentPkgs :: PkgconfigName -> PkgconfigVersionRange -> Bool, + presentPkgs :: Maybe (PkgconfigName -> PkgconfigVersionRange -> Bool), index :: Index, -- Saved, scoped, dependencies. Every time 'validate' makes a package choice, @@ -383,7 +383,7 @@ extractNewDeps v b fa sa = go -- or the successfully extended assignment. extend :: (Extension -> Bool) -- ^ is a given extension supported -> (Language -> Bool) -- ^ is a given language supported - -> (PkgconfigName -> PkgconfigVersionRange -> Bool) -- ^ is a given pkg-config requirement satisfiable + -> Maybe (PkgconfigName -> PkgconfigVersionRange -> Bool) -- ^ is a given pkg-config requirement satisfiable -> [LDep QPN] -> PPreAssignment -> Either Conflict PPreAssignment @@ -398,8 +398,10 @@ extend extSupported langSupported pkgPresent newactives ppa = foldM extendSingle if langSupported lang then Right a else Left (dependencyReasonToConflictSet dr, UnsupportedLanguage lang) extendSingle a (LDep dr (Pkg pn vr)) = - if pkgPresent pn vr then Right a - else Left (dependencyReasonToConflictSet dr, MissingPkgconfigPackage pn vr) + case (\f -> f pn vr) <$> pkgPresent of + Just True -> Right a + Just False -> Left (dependencyReasonToConflictSet dr, MissingPkgconfigPackage pn vr) + Nothing -> Left (dependencyReasonToConflictSet dr, MissingPkgconfigProgram pn vr) extendSingle a (LDep dr (Dep dep@(PkgComponent qpn _) ci)) = let mergedDep = M.findWithDefault (MergedDepConstrained []) qpn a in case (\ x -> M.insert qpn x a) <$> merge mergedDep (PkgDep dr dep ci) of @@ -561,7 +563,7 @@ extendRequiredComponents eqpn available = foldM extendSingle -- | Interface. -validateTree :: CompilerInfo -> Index -> PkgConfigDb -> Tree d c -> Tree d c +validateTree :: CompilerInfo -> Index -> Maybe PkgConfigDb -> Tree d c -> Tree d c validateTree cinfo idx pkgConfigDb t = runValidate (validate t) VS { supportedExt = maybe (const True) -- if compiler has no list of extensions, we assume everything is supported (\ es -> let s = S.fromList es in \ x -> S.member x s) @@ -569,7 +571,7 @@ validateTree cinfo idx pkgConfigDb t = runValidate (validate t) VS { , supportedLang = maybe (const True) (flip L.elem) -- use list lookup because language list is small and no Ord instance (compilerInfoLanguages cinfo) - , presentPkgs = pkgConfigPkgIsPresent pkgConfigDb + , presentPkgs = pkgConfigPkgIsPresent <$> pkgConfigDb , index = idx , saved = M.empty , pa = PA M.empty M.empty M.empty diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/WeightedPSQ.hs b/cabal-install-solver/src/Distribution/Solver/Modular/WeightedPSQ.hs index ec9b242bda9..94def7be196 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/WeightedPSQ.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/WeightedPSQ.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE DeriveFunctor, DeriveFoldable, DeriveTraversable #-} +{-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} module Distribution.Solver.Modular.WeightedPSQ ( diff --git a/cabal-install-solver/src/Distribution/Solver/Types/ConstraintSource.hs b/cabal-install-solver/src/Distribution/Solver/Types/ConstraintSource.hs index 3fdf64bde89..3f171b3c6d7 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/ConstraintSource.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/ConstraintSource.hs @@ -6,7 +6,8 @@ module Distribution.Solver.Types.ConstraintSource import Distribution.Solver.Compat.Prelude import Distribution.Solver.Types.ProjectConfigPath (ProjectConfigPath, docProjectConfigPath) -import Text.PrettyPrint (render) +import Distribution.Pretty (Pretty(pretty), prettyShow) +import Text.PrettyPrint (text) -- | Source of a 'PackageConstraint'. data ConstraintSource = @@ -41,6 +42,10 @@ data ConstraintSource = -- from Cabal >= 3.11 | ConstraintSourceMultiRepl + -- | Constraint introduced by --enable-profiling-shared, which requires features + -- from Cabal >= 3.13 + | ConstraintSourceProfiledDynamic + -- | The source of the constraint is not specified. | ConstraintSourceUnknown @@ -51,29 +56,35 @@ data ConstraintSource = -- | An internal constraint due to compatibility issues with the Setup.hs -- command line interface requires a maximum upper bound on Cabal | ConstraintSetupCabalMaxVersion - deriving (Eq, Show, Generic) + deriving (Show, Eq, Generic) instance Binary ConstraintSource instance Structured ConstraintSource -- | Description of a 'ConstraintSource'. showConstraintSource :: ConstraintSource -> String -showConstraintSource (ConstraintSourceMainConfig path) = - "main config " ++ path -showConstraintSource (ConstraintSourceProjectConfig path) = - "project config " ++ render (docProjectConfigPath path) -showConstraintSource (ConstraintSourceUserConfig path)= "user config " ++ path -showConstraintSource ConstraintSourceCommandlineFlag = "command line flag" -showConstraintSource ConstraintSourceUserTarget = "user target" -showConstraintSource ConstraintSourceNonReinstallablePackage = - "non-reinstallable package" -showConstraintSource ConstraintSourceFreeze = "cabal freeze" -showConstraintSource ConstraintSourceConfigFlagOrTarget = - "config file, command line flag, or user target" -showConstraintSource ConstraintSourceMultiRepl = - "--enable-multi-repl" -showConstraintSource ConstraintSourceUnknown = "unknown source" -showConstraintSource ConstraintSetupCabalMinVersion = - "minimum version of Cabal used by Setup.hs" -showConstraintSource ConstraintSetupCabalMaxVersion = - "maximum version of Cabal used by Setup.hs" +showConstraintSource = prettyShow + +instance Pretty ConstraintSource where + pretty constraintSource = case constraintSource of + (ConstraintSourceMainConfig path) -> + text "main config" <+> text path + (ConstraintSourceProjectConfig path) -> + text "project config" <+> docProjectConfigPath path + (ConstraintSourceUserConfig path)-> text "user config " <+> text path + ConstraintSourceCommandlineFlag -> text "command line flag" + ConstraintSourceUserTarget -> text "user target" + ConstraintSourceNonReinstallablePackage -> + text "non-reinstallable package" + ConstraintSourceFreeze -> text "cabal freeze" + ConstraintSourceConfigFlagOrTarget -> + text "config file, command line flag, or user target" + ConstraintSourceMultiRepl -> + text "--enable-multi-repl" + ConstraintSourceProfiledDynamic -> + text "--enable-profiling-shared" + ConstraintSourceUnknown -> text "unknown source" + ConstraintSetupCabalMinVersion -> + text "minimum version of Cabal used by Setup.hs" + ConstraintSetupCabalMaxVersion -> + text "maximum version of Cabal used by Setup.hs" diff --git a/cabal-install-solver/src/Distribution/Solver/Types/DependencyResolver.hs b/cabal-install-solver/src/Distribution/Solver/Types/DependencyResolver.hs index e773492ae74..139a6d2b33d 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/DependencyResolver.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/DependencyResolver.hs @@ -30,7 +30,7 @@ type DependencyResolver loc = Platform -> CompilerInfo -> InstalledPackageIndex -> PackageIndex (SourcePackage loc) - -> PkgConfigDb + -> Maybe PkgConfigDb -> (PackageName -> PackagePreferences) -> [LabeledPackageConstraint] -> Set PackageName diff --git a/cabal-install-solver/src/Distribution/Solver/Types/OptionalStanza.hs b/cabal-install-solver/src/Distribution/Solver/Types/OptionalStanza.hs index cde029d195b..457cd6c9b13 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/OptionalStanza.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/OptionalStanza.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Solver.Types.OptionalStanza ( -- * OptionalStanza @@ -38,7 +37,7 @@ import Distribution.Utils.Structured (Structured (..), nominalStructure) data OptionalStanza = TestStanzas | BenchStanzas - deriving (Eq, Ord, Enum, Bounded, Show, Generic, Typeable) + deriving (Eq, Ord, Enum, Bounded, Show, Generic) -- | String representation of an OptionalStanza. showStanza :: OptionalStanza -> String diff --git a/cabal-install-solver/src/Distribution/Solver/Types/PackageConstraint.hs b/cabal-install-solver/src/Distribution/Solver/Types/PackageConstraint.hs index fbe56380e81..06c5ae169fa 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/PackageConstraint.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/PackageConstraint.hs @@ -11,9 +11,7 @@ module Distribution.Solver.Types.PackageConstraint ( scopeToPackageName, constraintScopeMatches, PackageProperty(..), - dispPackageProperty, PackageConstraint(..), - dispPackageConstraint, showPackageConstraint, packageConstraintToDependency ) where @@ -23,7 +21,7 @@ import Prelude () import Distribution.Package (PackageName) import Distribution.PackageDescription (FlagAssignment, dispFlagAssignment) -import Distribution.Pretty (flatStyle, pretty) +import Distribution.Pretty (flatStyle, Pretty(pretty)) import Distribution.Types.PackageVersionConstraint (PackageVersionConstraint (..)) import Distribution.Version (VersionRange, simplifyVersionRange) @@ -82,12 +80,11 @@ constraintScopeMatches (ScopeAnySetupQualifier pn) (Q pp pn') = in setup pp && pn == pn' constraintScopeMatches (ScopeAnyQualifier pn) (Q _ pn') = pn == pn' --- | Pretty-prints a constraint scope. -dispConstraintScope :: ConstraintScope -> Disp.Doc -dispConstraintScope (ScopeTarget pn) = pretty pn <<>> Disp.text "." <<>> pretty pn -dispConstraintScope (ScopeQualified q pn) = dispQualifier q <<>> pretty pn -dispConstraintScope (ScopeAnySetupQualifier pn) = Disp.text "setup." <<>> pretty pn -dispConstraintScope (ScopeAnyQualifier pn) = Disp.text "any." <<>> pretty pn +instance Pretty ConstraintScope where + pretty (ScopeTarget pn) = pretty pn <<>> Disp.text "." <<>> pretty pn + pretty (ScopeQualified q pn) = dispQualifier q <<>> pretty pn + pretty (ScopeAnySetupQualifier pn) = Disp.text "setup." <<>> pretty pn + pretty (ScopeAnyQualifier pn) = Disp.text "any." <<>> pretty pn -- | A package property is a logical predicate on packages. data PackageProperty @@ -101,24 +98,22 @@ data PackageProperty instance Binary PackageProperty instance Structured PackageProperty --- | Pretty-prints a package property. -dispPackageProperty :: PackageProperty -> Disp.Doc -dispPackageProperty (PackagePropertyVersion verrange) = pretty verrange -dispPackageProperty PackagePropertyInstalled = Disp.text "installed" -dispPackageProperty PackagePropertySource = Disp.text "source" -dispPackageProperty (PackagePropertyFlags flags) = dispFlagAssignment flags -dispPackageProperty (PackagePropertyStanzas stanzas) = - Disp.hsep $ map (Disp.text . showStanza) stanzas +instance Pretty PackageProperty where + pretty (PackagePropertyVersion verrange) = pretty verrange + pretty PackagePropertyInstalled = Disp.text "installed" + pretty PackagePropertySource = Disp.text "source" + pretty (PackagePropertyFlags flags) = dispFlagAssignment flags + pretty (PackagePropertyStanzas stanzas) = + Disp.hsep $ map (Disp.text . showStanza) stanzas -- | A package constraint consists of a scope plus a property -- that must hold for all packages within that scope. data PackageConstraint = PackageConstraint ConstraintScope PackageProperty deriving (Eq, Show) --- | Pretty-prints a package constraint. -dispPackageConstraint :: PackageConstraint -> Disp.Doc -dispPackageConstraint (PackageConstraint scope prop) = - dispConstraintScope scope <+> dispPackageProperty prop +instance Pretty PackageConstraint where + pretty (PackageConstraint scope prop) = + pretty scope <+> pretty prop -- | Alternative textual representation of a package constraint -- for debugging purposes (slightly more verbose than that @@ -126,7 +121,7 @@ dispPackageConstraint (PackageConstraint scope prop) = -- showPackageConstraint :: PackageConstraint -> String showPackageConstraint pc@(PackageConstraint scope prop) = - Disp.renderStyle flatStyle . postprocess $ dispPackageConstraint pc2 + Disp.renderStyle flatStyle . postprocess $ pretty pc2 where pc2 = case prop of PackagePropertyVersion vr -> diff --git a/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs b/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs index 21845eafdec..6053fbf4f56 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/PkgConfigDb.hs @@ -1,6 +1,4 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE LambdaCase #-} ----------------------------------------------------------------------------- -- | -- Module : Distribution.Solver.Types.PkgConfigDb @@ -47,16 +45,13 @@ import Distribution.Types.PkgconfigVersionRange import Distribution.Verbosity (Verbosity) -- | The list of packages installed in the system visible to --- @pkg-config@. This is an opaque datatype, to be constructed with --- `readPkgConfigDb` and queried with `pkgConfigPkgPresent`. -data PkgConfigDb = PkgConfigDb (M.Map PkgconfigName (Maybe PkgconfigVersion)) - -- ^ If an entry is `Nothing`, this means that the - -- package seems to be present, but we don't know the - -- exact version (because parsing of the version - -- number failed). - | NoPkgConfigDb - -- ^ For when we could not run pkg-config successfully. - deriving (Show, Generic, Typeable) +-- @pkg-config@. +-- +-- If an entry is `Nothing`, this means that the package seems to be present, +-- but we don't know the exact version (because parsing of the version number +-- failed). +newtype PkgConfigDb = PkgConfigDb (M.Map PkgconfigName (Maybe PkgconfigVersion)) + deriving (Show, Generic) instance Binary PkgConfigDb instance Structured PkgConfigDb @@ -64,11 +59,11 @@ instance Structured PkgConfigDb -- | Query pkg-config for the list of installed packages, together -- with their versions. Return a `PkgConfigDb` encapsulating this -- information. -readPkgConfigDb :: Verbosity -> ProgramDb -> IO PkgConfigDb +readPkgConfigDb :: Verbosity -> ProgramDb -> IO (Maybe PkgConfigDb) readPkgConfigDb verbosity progdb = handle ioErrorHandler $ do mpkgConfig <- needProgram verbosity pkgConfigProgram progdb case mpkgConfig of - Nothing -> noPkgConfig "Cannot find pkg-config program" + Nothing -> noPkgConfig "cannot find pkg-config program" Just (pkgConfig, _) -> do -- To prevent malformed Unicode in the descriptions from crashing cabal, -- read without interpreting any encoding first. (#9608) @@ -106,7 +101,7 @@ readPkgConfigDb verbosity progdb = handle ioErrorHandler $ do (programInvocation pkgConfig ("--modversion" : pkgNames)) let pkgVersions = lines outs if exitCode == ExitSuccess && length pkgVersions == length pkgNames - then (return . pkgConfigDbFromList . zip pkgNames) pkgVersions + then (return . Just . pkgConfigDbFromList . zip pkgNames) pkgVersions else -- if there's a single broken pc file the above fails, so we fall back -- into calling it individually @@ -116,17 +111,17 @@ readPkgConfigDb verbosity progdb = handle ioErrorHandler $ do -- requested one, we fall back to querying one by one. do info verbosity ("call to pkg-config --modversion on all packages failed. Falling back to querying pkg-config individually on each package") - pkgConfigDbFromList . catMaybes <$> mapM (getIndividualVersion pkgConfig) pkgNames + Just . pkgConfigDbFromList . catMaybes <$> mapM (getIndividualVersion pkgConfig) pkgNames where -- For when pkg-config invocation fails (possibly because of a -- too long command line). noPkgConfig extra = do - info verbosity ("Failed to query pkg-config, Cabal will continue" - ++ " without solving for pkg-config constraints: " + info verbosity ("Warning: Failed to query pkg-config, Cabal will backtrack " + ++ "if a package from pkg-config is requested. Error message: " ++ extra) - return NoPkgConfigDb + return Nothing - ioErrorHandler :: IOException -> IO PkgConfigDb + ioErrorHandler :: IOException -> IO (Maybe PkgConfigDb) ioErrorHandler e = noPkgConfig (show e) getIndividualVersion :: ConfiguredProgram -> String -> IO (Maybe (String, String)) @@ -162,13 +157,6 @@ pkgConfigPkgIsPresent (PkgConfigDb db) pn vr = Nothing -> False -- Package not present in the DB. Just Nothing -> True -- Package present, but version unknown. Just (Just v) -> withinPkgconfigVersionRange v vr --- If we could not read the pkg-config database successfully we fail. --- The plan found by the solver can't be executed later, because pkg-config itself --- is going to be called in the build phase to get the library location for linking --- so even if there is a library, it would need to be passed manual flags anyway. -pkgConfigPkgIsPresent NoPkgConfigDb _ _ = False - - -- | Query the version of a package in the @pkg-config@ database. -- @Nothing@ indicates the package is not in the database, while @@ -176,12 +164,6 @@ pkgConfigPkgIsPresent NoPkgConfigDb _ _ = False -- but its version is not known. pkgConfigDbPkgVersion :: PkgConfigDb -> PkgconfigName -> Maybe (Maybe PkgconfigVersion) pkgConfigDbPkgVersion (PkgConfigDb db) pn = M.lookup pn db --- NB: Since the solver allows solving to succeed if there is --- NoPkgConfigDb, we should report that we *guess* that there --- is a matching pkg-config configuration, but that we just --- don't know about it. -pkgConfigDbPkgVersion NoPkgConfigDb _ = Just Nothing - -- | Query pkg-config for the locations of pkg-config's package files. Use this -- to monitor for changes in the pkg-config DB. diff --git a/cabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hs b/cabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hs index 48141df39c3..17543b5f2de 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/ProjectConfigPath.hs @@ -1,5 +1,5 @@ {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE LambdaCase #-} +{-# LANGUAGE ViewPatterns #-} module Distribution.Solver.Types.ProjectConfigPath ( @@ -8,29 +8,41 @@ module Distribution.Solver.Types.ProjectConfigPath , projectConfigPathRoot , nullProjectConfigPath , consProjectConfigPath + , unconsProjectConfigPath -- * Messages , docProjectConfigPath + , docProjectConfigFiles , cyclicalImportMsg + , untrimmedUriImportMsg , docProjectConfigPathFailReason -- * Checks and Normalization , isCyclicConfigPath + , isTopLevelConfigPath + , isUntrimmedUriConfigPath , canonicalizeConfigPath ) where import Distribution.Solver.Compat.Prelude hiding (toList, (<>)) +import qualified Distribution.Solver.Compat.Prelude as P ((<>)) import Prelude (sequence) import Data.Coerce (coerce) import Data.List.NonEmpty ((<|)) -import Network.URI (parseURI) +import Network.URI (parseURI, parseAbsoluteURI) import System.Directory -import System.FilePath +import System.FilePath hiding (splitPath) +import qualified System.FilePath as FP (splitPath) +import qualified System.FilePath.Posix as Posix +import qualified System.FilePath.Windows as Windows import qualified Data.List.NonEmpty as NE import Distribution.Solver.Modular.Version (VR) import Distribution.Pretty (prettyShow) +import Distribution.Utils.String (trim) import Text.PrettyPrint +import Distribution.Simple.Utils (ordNub) +import Distribution.System (OS(Windows), buildOS) -- | Path to a configuration file, either a singleton project root, or a longer -- list representing a path to an import. The path is a non-empty list that we @@ -44,27 +56,122 @@ import Text.PrettyPrint -- List elements are relative to each other but once canonicalized, elements are -- relative to the directory of the project root. newtype ProjectConfigPath = ProjectConfigPath (NonEmpty FilePath) - deriving (Eq, Ord, Show, Generic) + deriving (Eq, Show, Generic) + +-- | Sorts URIs after local file paths and longer file paths after shorter ones +-- as measured by the number of path segments. If still equal, then sorting is +-- lexical. +-- +-- The project itself, a single element root path, compared to any of the +-- configuration paths it imports, should always sort first. Comparing one +-- project root path against another is done lexically. +-- +-- For comparison purposes, path separators are normalized to the @buildOS@ +-- platform's path separator. +-- +-- >>> let abFwd = ProjectConfigPath $ "a/b.config" :| [] +-- >>> let abBwd = ProjectConfigPath $ "a\\b.config" :| [] +-- >>> compare abFwd abBwd +-- EQ +instance Ord ProjectConfigPath where + compare pa@(ProjectConfigPath (NE.toList -> as)) pb@(ProjectConfigPath (NE.toList -> bs)) = + case (as, bs) of + -- There should only ever be one root project path, only one path + -- with length 1. Comparing it to itself should be EQ. Don't assume + -- this though, do a comparison anyway when both sides have length + -- 1. The root path, the project itself, should always be the first + -- path in a sorted listing. + ([a], [b]) -> compare (splitPath a) (splitPath b) + ([_], _) -> LT + (_, [_]) -> GT + + (a:_, b:_) -> case (parseAbsoluteURI a, parseAbsoluteURI b) of + (Just ua, Just ub) -> compare ua ub P.<> compare aImporters bImporters + (Just _, Nothing) -> GT + (Nothing, Just _) -> LT + (Nothing, Nothing) -> compare (splitPath a) (splitPath b) P.<> compare aImporters bImporters + _ -> + compare (length as) (length bs) + P.<> compare (length aPaths) (length bPaths) + P.<> compare aPaths bPaths + where + splitPath = FP.splitPath . normSep where + normSep p = + if buildOS == Windows + then + Windows.joinPath $ Windows.splitDirectories + [if Posix.isPathSeparator c then Windows.pathSeparator else c| c <- p] + else + Posix.joinPath $ Posix.splitDirectories + [if Windows.isPathSeparator c then Posix.pathSeparator else c| c <- p] + + aPaths = splitPath <$> as + bPaths = splitPath <$> bs + aImporters = snd $ unconsProjectConfigPath pa + bImporters = snd $ unconsProjectConfigPath pb instance Binary ProjectConfigPath instance Structured ProjectConfigPath -- | Renders the path like this; --- @ --- D.config --- imported by: C.config --- imported by: B.config --- imported by: A.project --- @ --- >>> render . docProjectConfigPath $ ProjectConfigPath $ "D.config" :| ["C.config", "B.config", "A.project" ] +-- +-- >D.config +-- > imported by: C.config +-- > imported by: B.config +-- > imported by: A.project +-- +-- >>> render . docProjectConfigPath $ ProjectConfigPath $ "D.config" :| ["C.config", "B.config", "A.project"] -- "D.config\n imported by: C.config\n imported by: B.config\n imported by: A.project" docProjectConfigPath :: ProjectConfigPath -> Doc -docProjectConfigPath (ProjectConfigPath (p :| [])) = text p -docProjectConfigPath (ProjectConfigPath (p :| ps)) = vcat $ - text p : [ text " " <+> text "imported by:" <+> text l | l <- ps ] +docProjectConfigPath (ProjectConfigPath (p :| [])) = quoteUntrimmed p +docProjectConfigPath (ProjectConfigPath (p :| ps)) = vcat $ quoteUntrimmed p : + [ text " " <+> text "imported by:" <+> quoteUntrimmed l | l <- ps ] + +-- | If the path has leading or trailing spaces then show it quoted. +quoteUntrimmed :: FilePath -> Doc +quoteUntrimmed s = if trim s /= s then quotes (text s) else text s + +-- | Renders the paths as a list without showing which path imports another, +-- like this; +-- +-- >- cabal.project +-- >- project-cabal/constraints.config +-- >- project-cabal/ghc-latest.config +-- >- project-cabal/ghc-options.config +-- >- project-cabal/pkgs.config +-- >- project-cabal/pkgs/benchmarks.config +-- >- project-cabal/pkgs/buildinfo.config +-- >- project-cabal/pkgs/cabal.config +-- >- project-cabal/pkgs/install.config +-- >- project-cabal/pkgs/integration-tests.config +-- >- project-cabal/pkgs/tests.config +-- +-- +-- >>> :{ +-- do +-- let ps = +-- [ ProjectConfigPath ("cabal.project" :| []) +-- , ProjectConfigPath ("project-cabal/constraints.config" :| ["cabal.project"]) +-- , ProjectConfigPath ("project-cabal/ghc-latest.config" :| ["cabal.project"]) +-- , ProjectConfigPath ("project-cabal/ghc-options.config" :| ["cabal.project"]) +-- , ProjectConfigPath ("project-cabal/pkgs.config" :| ["cabal.project"]) +-- , ProjectConfigPath ("project-cabal/pkgs/benchmarks.config" :| ["project-cabal/pkgs.config","cabal.project"]) +-- , ProjectConfigPath ("project-cabal/pkgs/buildinfo.config" :| ["project-cabal/pkgs.config","cabal.project"]) +-- , ProjectConfigPath ("project-cabal/pkgs/cabal.config" :| ["project-cabal/pkgs.config","cabal.project"]) +-- , ProjectConfigPath ("project-cabal/pkgs/install.config" :| ["project-cabal/pkgs.config","cabal.project"]) +-- , ProjectConfigPath ("project-cabal/pkgs/integration-tests.config" :| ["project-cabal/pkgs.config","cabal.project"]) +-- , ProjectConfigPath ("project-cabal/pkgs/tests.config" :| ["project-cabal/pkgs.config","cabal.project"]) +-- ] +-- return . render $ docProjectConfigFiles ps +-- :} +-- "- cabal.project\n- project-cabal/constraints.config\n- project-cabal/ghc-latest.config\n- project-cabal/ghc-options.config\n- project-cabal/pkgs.config\n- project-cabal/pkgs/benchmarks.config\n- project-cabal/pkgs/buildinfo.config\n- project-cabal/pkgs/cabal.config\n- project-cabal/pkgs/install.config\n- project-cabal/pkgs/integration-tests.config\n- project-cabal/pkgs/tests.config" +docProjectConfigFiles :: [ProjectConfigPath] -> Doc +docProjectConfigFiles ps = vcat + [ text "-" <+> text p + | p <- ordNub [ p | ProjectConfigPath (p :| _) <- ps ] + ] --- | A message for a cyclical import, assuming the head of the path is the --- duplicate. +-- | A message for a cyclical import, a "cyclical import of". cyclicalImportMsg :: ProjectConfigPath -> Doc cyclicalImportMsg path@(ProjectConfigPath (duplicate :| _)) = vcat @@ -72,6 +179,14 @@ cyclicalImportMsg path@(ProjectConfigPath (duplicate :| _)) = , nest 2 (docProjectConfigPath path) ] +-- | A message for an import that has leading or trailing spaces. +untrimmedUriImportMsg :: Doc -> ProjectConfigPath -> Doc +untrimmedUriImportMsg intro path = + vcat + [ intro <+> text "import has leading or trailing whitespace" <> semi + , nest 2 (docProjectConfigPath path) + ] + docProjectConfigPathFailReason :: VR -> ProjectConfigPath -> Doc docProjectConfigPathFailReason vr pcp | ProjectConfigPath (p :| []) <- pcp = @@ -100,16 +215,30 @@ nullProjectConfigPath = ProjectConfigPath $ "unused" :| [] isCyclicConfigPath :: ProjectConfigPath -> Bool isCyclicConfigPath (ProjectConfigPath p) = length p /= length (NE.nub p) +-- | Check if the last segment of the path (root or importee) is a URI that has +-- leading or trailing spaces. +isUntrimmedUriConfigPath :: ProjectConfigPath -> Bool +isUntrimmedUriConfigPath (ProjectConfigPath (p :| _)) = let p' = trim p in p' /= p && isURI p' + +-- | Check if the project config path is top-level, meaning it was not included by +-- some other project config. +isTopLevelConfigPath :: ProjectConfigPath -> Bool +isTopLevelConfigPath (ProjectConfigPath p) = NE.length p == 1 + -- | Prepends the path of the importee to the importer path. consProjectConfigPath :: FilePath -> ProjectConfigPath -> ProjectConfigPath consProjectConfigPath p ps = ProjectConfigPath (p <| coerce ps) +-- | Split the path into the importee and the importer path. +unconsProjectConfigPath :: ProjectConfigPath -> (FilePath, Maybe ProjectConfigPath) +unconsProjectConfigPath ps = fmap ProjectConfigPath <$> NE.uncons (coerce ps) + -- | Make paths relative to the directory of the root of the project, not -- relative to the file they were imported from. makeRelativeConfigPath :: FilePath -> ProjectConfigPath -> ProjectConfigPath makeRelativeConfigPath dir (ProjectConfigPath p) = ProjectConfigPath - $ (\segment -> (if isURI segment then segment else makeRelative dir segment)) + $ (\segment@(trim -> trimSegment) -> (if isURI trimSegment then trimSegment else makeRelative dir segment)) <$> p -- | Normalizes and canonicalizes a path removing '.' and '..' indirections. @@ -117,32 +246,30 @@ makeRelativeConfigPath dir (ProjectConfigPath p) = -- instead of relative to the file it was imported from. -- -- It converts paths like this: --- @ --- └─ hops-0.project --- └─ hops/hops-1.config --- └─ ../hops-2.config --- └─ hops/hops-3.config --- └─ ../hops-4.config --- └─ hops/hops-5.config --- └─ ../hops-6.config --- └─ hops/hops-7.config --- └─ ../hops-8.config --- └─ hops/hops-9.config --- @ +-- +-- > hops-0.project +-- > └─ hops/hops-1.config +-- > └─ ../hops-2.config +-- > └─ hops/hops-3.config +-- > └─ ../hops-4.config +-- > └─ hops/hops-5.config +-- > └─ ../hops-6.config +-- > └─ hops/hops-7.config +-- > └─ ../hops-8.config +-- > └─ hops/hops-9.config -- -- Into paths like this: --- @ --- └─ hops-0.project --- └─ hops/hops-1.config --- └─ hops-2.config --- └─ hops/hops-3.config --- └─ hops-4.config --- └─ hops/hops-5.config --- └─ hops-6.config --- └─ hops/hops-7.config --- └─ hops-8.config --- └─ hops/hops-9.config --- @ +-- +-- > hops-0.project +-- > └─ hops/hops-1.config +-- > └─ hops-2.config +-- > └─ hops/hops-3.config +-- > └─ hops-4.config +-- > └─ hops/hops-5.config +-- > └─ hops-6.config +-- > └─ hops/hops-7.config +-- > └─ hops-8.config +-- > └─ hops/hops-9.config -- -- That way we have @hops-8.config@ instead of -- @./hops/../hops/../hops/../hops/../hops-8.config@. @@ -188,11 +315,25 @@ makeRelativeConfigPath dir (ProjectConfigPath p) = -- return $ expected == render (docProjectConfigPath p) ++ "\n" -- :} -- True +-- +-- "A string is a valid URL potentially surrounded by spaces if, after stripping leading and trailing whitespace from it, it is a valid URL." +-- [W3C/HTML5/URLs](https://www.w3.org/TR/2010/WD-html5-20100624/urls.html) +-- +-- Trailing spaces for @ProjectConfigPath@ URLs are trimmed. +-- +-- >>> p <- canonicalizeConfigPath "" (ProjectConfigPath $ ("https://www.stackage.org/nightly-2024-12-05/cabal.config ") :| []) +-- >>> render $ docProjectConfigPath p +-- "https://www.stackage.org/nightly-2024-12-05/cabal.config" +-- +-- >>> let d = testDir +-- >>> p <- canonicalizeConfigPath d (ProjectConfigPath $ ("https://www.stackage.org/nightly-2024-12-05/cabal.config ") :| [d "cabal.project"]) +-- >>> render $ docProjectConfigPath p +-- "https://www.stackage.org/nightly-2024-12-05/cabal.config\n imported by: cabal.project" canonicalizeConfigPath :: FilePath -> ProjectConfigPath -> IO ProjectConfigPath canonicalizeConfigPath d (ProjectConfigPath p) = do - xs <- sequence $ NE.scanr (\importee -> (>>= \importer -> - if isURI importee - then pure importee + xs <- sequence $ NE.scanr (\importee@(trim -> trimImportee) -> (>>= \importer@(trim -> trimImporter) -> + if isURI trimImportee || isURI trimImporter + then pure trimImportee else canonicalizePath $ d takeDirectory importer importee)) (pure ".") p return . makeRelativeConfigPath d . ProjectConfigPath . NE.fromList $ NE.init xs diff --git a/cabal-install-solver/src/Distribution/Solver/Types/SourcePackage.hs b/cabal-install-solver/src/Distribution/Solver/Types/SourcePackage.hs index 35cba9b6e4a..0162f6e7f02 100644 --- a/cabal-install-solver/src/Distribution/Solver/Types/SourcePackage.hs +++ b/cabal-install-solver/src/Distribution/Solver/Types/SourcePackage.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE DeriveDataTypeable #-} module Distribution.Solver.Types.SourcePackage ( PackageDescriptionOverride , SourcePackage(..) @@ -25,7 +24,7 @@ data SourcePackage loc = SourcePackage , srcpkgSource :: loc , srcpkgDescrOverride :: PackageDescriptionOverride } - deriving (Eq, Show, Generic, Typeable) + deriving (Eq, Show, Generic) instance Binary loc => Binary (SourcePackage loc) instance Structured loc => Structured (SourcePackage loc) diff --git a/cabal-install-solver/tests/UnitTests/Distribution/Solver/Modular/MessageUtils.hs b/cabal-install-solver/tests/UnitTests/Distribution/Solver/Modular/MessageUtils.hs index a24d5672ddd..c72c8b5aa6f 100644 --- a/cabal-install-solver/tests/UnitTests/Distribution/Solver/Modular/MessageUtils.hs +++ b/cabal-install-solver/tests/UnitTests/Distribution/Solver/Modular/MessageUtils.hs @@ -58,9 +58,9 @@ isOutOfBounds :: Int -> String -> String -> Bool isOutOfBounds range a b = not $ withinRange range a b testRange :: Int -> [String] -> String -> Assertion -testRange range elems erronousElement = assertBool "String should be out of bounds to make a spelling suggestion" (isOutOfBounds range erronousElement suggestion) +testRange range elems erroneousElement = assertBool "String should be out of bounds to make a spelling suggestion" (isOutOfBounds range erroneousElement suggestion) where - suggestion = mostSimilarElement erronousElement elems + suggestion = mostSimilarElement erroneousElement elems outOfBounds :: [String] outOfBounds = diff --git a/cabal-install/cabal-install.cabal b/cabal-install/cabal-install.cabal index 230e72c533b..cef5fbd8277 100644 --- a/cabal-install/cabal-install.cabal +++ b/cabal-install/cabal-install.cabal @@ -1,7 +1,7 @@ -Cabal-Version: 2.2 +Cabal-Version: 3.0 Name: cabal-install -Version: 3.13.0.0 +Version: 3.15.0.0 Synopsis: The command-line interface for Cabal and Hackage. Description: The \'cabal\' command-line program simplifies the process of managing @@ -39,6 +39,11 @@ Flag lukko default: True manual: True +flag git-rev + description: include Git revision hash in version + default: False + manual: True + common warnings ghc-options: -Wall @@ -52,16 +57,16 @@ common warnings ghc-options: -Wnoncanonical-monadfail-instances common base-dep - build-depends: base >=4.11 && <4.20 + build-depends: base >=4.13 && <4.22 common cabal-dep - build-depends: Cabal ^>=3.13 + build-depends: Cabal ^>=3.15 common cabal-syntax-dep - build-depends: Cabal-syntax ^>=3.13 + build-depends: Cabal-syntax ^>=3.15 common cabal-install-solver-dep - build-depends: cabal-install-solver ^>=3.13 + build-depends: cabal-install-solver ^>=3.15 library import: warnings, base-dep, cabal-dep, cabal-syntax-dep, cabal-install-solver-dep @@ -231,7 +236,6 @@ library edit-distance >= 0.2.2 && < 0.3, exceptions >= 0.10.4 && < 0.11, filepath >= 1.4.0.0 && < 1.6, - hashable >= 1.0 && < 1.5, HTTP >= 4000.1.5 && < 4000.5, mtl >= 2.0 && < 2.4, network-uri >= 2.6.0.2 && < 2.7, @@ -261,7 +265,7 @@ library -- newer directory for symlinks build-depends: Win32 >= 2.8 && < 3, directory >=1.3.1.0 else - build-depends: unix >= 2.5 && < 2.9 + build-depends: unix >= 2.5 && < 2.8 || >= 2.8.6.0 && < 2.9 if flag(lukko) build-depends: lukko >= 0.1 && <0.2 @@ -270,6 +274,9 @@ library if impl(ghc >=8.2) build-depends: process >= 1.6.15.0 + if flag(git-rev) + build-depends: githash ^>= 0.1.7.0 + cpp-options: -DGIT_REV executable cabal import: warnings, base-dep @@ -283,6 +290,9 @@ executable cabal if os(aix) extra-libraries: bsd + if flag(git-rev) + cpp-options: -DGIT_REV + build-depends: cabal-install @@ -350,11 +360,11 @@ test-suite unit-tests zlib, tasty >= 1.2.3 && <1.6, tasty-golden >=2.3.1.1 && <2.4, - tasty-quickcheck, + tasty-quickcheck ^>=0.11, tasty-expected-failure, tasty-hunit >= 0.10, tree-diff, - QuickCheck >= 2.14.3 && <2.15 + QuickCheck >= 2.14.3 && <2.16 -- Tests to run with a limited stack and heap size @@ -393,12 +403,16 @@ test-suite integration-tests2 hs-source-dirs: tests default-language: Haskell2010 + other-modules: + IntegrationTests2.CPP + build-depends: bytestring, cabal-install, containers, directory, filepath, + process, tasty >= 1.2.3 && <1.6, tasty-hunit >= 0.10, tagged @@ -430,7 +444,6 @@ test-suite long-tests containers, directory, filepath, - hashable, mtl, network-uri >= 2.6.2.0 && <2.7, random, @@ -438,6 +451,6 @@ test-suite long-tests tasty >= 1.2.3 && <1.6, tasty-expected-failure, tasty-hunit >= 0.10, - tasty-quickcheck, - QuickCheck >= 2.14 && <2.15, + tasty-quickcheck <0.12, + QuickCheck >= 2.14 && <2.16, pretty-show >= 1.6.15 diff --git a/cabal-install/changelog b/cabal-install/changelog index 3fe99c798e6..47a798c0be1 100644 --- a/cabal-install/changelog +++ b/cabal-install/changelog @@ -1,6 +1,14 @@ -*-change-log-*- -3.10.2.0 Hécate August 2023 +3.14.1.0 Hécate November 2024 + * See https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.14.1.0.md + +3.14.0.0 Hécate September 2024 + * See https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.14.0.0.md + +3.12.1.0 Artem Pelenitsyn June 2024 + * See https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.12.1.0.md + 3.10.3.0 Hécate January 2024 * See https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-3.10.3.0.md diff --git a/cabal-install/src/Distribution/Client/BuildReports/Upload.hs b/cabal-install/src/Distribution/Client/BuildReports/Upload.hs index 0108800932a..061df748365 100644 --- a/cabal-install/src/Distribution/Client/BuildReports/Upload.hs +++ b/cabal-install/src/Distribution/Client/BuildReports/Upload.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE PatternGuards #-} -- This is a quick hack for uploading build reports to Hackage. diff --git a/cabal-install/src/Distribution/Client/Check.hs b/cabal-install/src/Distribution/Client/Check.hs index f8c1d456751..69635ba8ed0 100644 --- a/cabal-install/src/Distribution/Client/Check.hs +++ b/cabal-install/src/Distribution/Client/Check.hs @@ -57,7 +57,7 @@ readGenericPackageDescriptionCheck verbosity fpath = do dieWithException verbosity ParseError Right x -> return (warnings, x) --- | Checks a packge for common errors. Returns @True@ if the package +-- | Checks a package for common errors. Returns @True@ if the package -- is fit to upload to Hackage, @False@ otherwise. -- Note: must be called with the CWD set to the directory containing -- the '.cabal' file. diff --git a/cabal-install/src/Distribution/Client/CmdClean.hs b/cabal-install/src/Distribution/Client/CmdClean.hs index 2ffda4dce6a..a738f38336a 100644 --- a/cabal-install/src/Distribution/Client/CmdClean.hs +++ b/cabal-install/src/Distribution/Client/CmdClean.hs @@ -52,6 +52,10 @@ import Distribution.Simple.Utils , info , wrapText ) +import Distribution.System + ( OS (Windows) + , buildOS + ) import Distribution.Utils.Path hiding ( (<.>) , () @@ -60,6 +64,9 @@ import Distribution.Verbosity ( normal ) +import Control.Exception + ( throw + ) import Control.Monad ( forM , forM_ @@ -74,10 +81,15 @@ import System.Directory , listDirectory , removeDirectoryRecursive , removeFile + , removePathForcibly ) import System.FilePath ( () ) +import System.IO.Error + ( isPermissionError + ) +import qualified System.Process as Process data CleanFlags = CleanFlags { cleanSaveConfig :: Flag Bool @@ -168,7 +180,18 @@ cleanAction (ProjectFlags{..}, CleanFlags{..}) extraArgs _ = do let distRoot = distDirectory distLayout info verbosity ("Deleting dist-newstyle (" ++ distRoot ++ ")") - handleDoesNotExist () $ removeDirectoryRecursive distRoot + handleDoesNotExist () $ do + if buildOS == Windows + then do + -- Windows can't delete some git files #10182 + void $ + Process.createProcess_ "attrib" $ + Process.shell $ + "attrib -s -h -r " <> distRoot <> "\\*.* /s /d" + catch + (removePathForcibly distRoot) + (\e -> if isPermissionError e then removePathForcibly distRoot else throw e) + else removeDirectoryRecursive distRoot removeEnvFiles $ distProjectRootDirectory distLayout diff --git a/cabal-install/src/Distribution/Client/CmdErrorMessages.hs b/cabal-install/src/Distribution/Client/CmdErrorMessages.hs index 8345d9ed59a..7eece5701f5 100644 --- a/cabal-install/src/Distribution/Client/CmdErrorMessages.hs +++ b/cabal-install/src/Distribution/Client/CmdErrorMessages.hs @@ -1,6 +1,4 @@ -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE RecordWildCards #-} -- | Utilities to help format error messages for the various CLI commands. module Distribution.Client.CmdErrorMessages diff --git a/cabal-install/src/Distribution/Client/CmdHaddock.hs b/cabal-install/src/Distribution/Client/CmdHaddock.hs index 8ecc5487798..677589e3e35 100644 --- a/cabal-install/src/Distribution/Client/CmdHaddock.hs +++ b/cabal-install/src/Distribution/Client/CmdHaddock.hs @@ -136,7 +136,8 @@ mkFlagsAbsolute :: NixStyleFlags ClientHaddockFlags -> IO (NixStyleFlags ClientH mkFlagsAbsolute relFlags = do let relHaddockFlags = haddockFlags relFlags absHaddockOutputDir <- traverse makeAbsolute (haddockOutputDir relHaddockFlags) - return (relFlags{haddockFlags = relHaddockFlags{haddockOutputDir = absHaddockOutputDir}}) + absHaddockCss <- traverse makeAbsolute (haddockCss relHaddockFlags) + return (relFlags{haddockFlags = relHaddockFlags{haddockOutputDir = absHaddockOutputDir, haddockCss = absHaddockCss}}) -- | The @haddock@ command is TODO. -- diff --git a/cabal-install/src/Distribution/Client/CmdHaddockProject.hs b/cabal-install/src/Distribution/Client/CmdHaddockProject.hs index bf21de2d352..0635a77d68e 100644 --- a/cabal-install/src/Distribution/Client/CmdHaddockProject.hs +++ b/cabal-install/src/Distribution/Client/CmdHaddockProject.hs @@ -3,6 +3,7 @@ module Distribution.Client.CmdHaddockProject , haddockProjectAction ) where +import Control.Monad (mapM) import Distribution.Client.Compat.Prelude hiding (get) import Prelude () @@ -11,8 +12,8 @@ import qualified Distribution.Client.CmdHaddock as CmdHaddock import Distribution.Client.DistDirLayout ( CabalDirLayout (..) - , DistDirLayout (..) , StoreDirLayout (..) + , distBuildDirectory ) import Distribution.Client.InstallPlan (foldPlanPackage) import qualified Distribution.Client.InstallPlan as InstallPlan @@ -24,7 +25,6 @@ import Distribution.Client.ProjectOrchestration , ProjectBaseContext (..) , ProjectBuildContext (..) , TargetSelector (..) - , printPlan , pruneInstallPlanToTargets , resolveTargets , runProjectPreBuildPhase @@ -52,6 +52,14 @@ import Distribution.Client.Setup ) import Distribution.Client.TargetProblem (TargetProblem (..)) +import Distribution.Simple.BuildPaths + ( haddockBenchmarkDirPath + , haddockDirName + , haddockLibraryDirPath + , haddockLibraryPath + , haddockPath + , haddockTestDirPath + ) import Distribution.Simple.Command ( CommandUI (..) ) @@ -75,8 +83,8 @@ import Distribution.Simple.Program.Db import Distribution.Simple.Setup ( HaddockFlags (..) , HaddockProjectFlags (..) + , HaddockTarget (..) , Visibility (..) - , defaultCommonSetupFlags , defaultHaddockFlags , haddockProjectCommand ) @@ -84,9 +92,11 @@ import Distribution.Simple.Utils ( copyDirectoryRecursive , createDirectoryIfMissingVerbose , dieWithException + , info , warn ) import Distribution.Types.InstalledPackageInfo (InstalledPackageInfo (..)) +import Distribution.Types.PackageDescription (PackageDescription (benchmarks, subLibraries, testSuites)) import Distribution.Types.PackageId (pkgName) import Distribution.Types.PackageName (unPackageName) import Distribution.Types.UnitId (unUnitId) @@ -98,7 +108,7 @@ import Distribution.Verbosity as Verbosity import Distribution.Client.Errors import System.Directory (doesDirectoryExist, doesFileExist) -import System.FilePath (normalise, takeDirectory, (<.>), ()) +import System.FilePath (normalise, takeDirectory, ()) haddockProjectAction :: HaddockProjectFlags -> [String] -> GlobalFlags -> IO () haddockProjectAction flags _extraArgs globalFlags = do @@ -108,58 +118,6 @@ haddockProjectAction flags _extraArgs globalFlags = do warn verbosity "haddock-project command is experimental, it might break in the future" - -- build all packages with appropriate haddock flags - let commonFlags = - defaultCommonSetupFlags - { setupVerbosity = haddockProjectVerbosity flags - } - haddockFlags = - defaultHaddockFlags - { haddockCommonFlags = commonFlags - , haddockHtml = Flag True - , -- one can either use `--haddock-base-url` or - -- `--haddock-html-location`. - haddockBaseUrl = - if localStyle - then Flag ".." - else NoFlag - , haddockProgramPaths = haddockProjectProgramPaths flags - , haddockProgramArgs = haddockProjectProgramArgs flags - , haddockHtmlLocation = - if fromFlagOrDefault False (haddockProjectHackage flags) - then Flag "https://hackage.haskell.org/package/$pkg-$version/docs" - else haddockProjectHtmlLocation flags - , haddockHoogle = haddockProjectHoogle flags - , haddockExecutables = haddockProjectExecutables flags - , haddockTestSuites = haddockProjectTestSuites flags - , haddockBenchmarks = haddockProjectBenchmarks flags - , haddockForeignLibs = haddockProjectForeignLibs flags - , haddockInternal = haddockProjectInternal flags - , haddockCss = haddockProjectCss flags - , haddockLinkedSource = Flag True - , haddockQuickJump = Flag True - , haddockHscolourCss = haddockProjectHscolourCss flags - , haddockContents = - if localStyle - then Flag (toPathTemplate "../index.html") - else NoFlag - , haddockIndex = - if localStyle - then Flag (toPathTemplate "../doc-index.html") - else NoFlag - , haddockKeepTempFiles = haddockProjectKeepTempFiles flags - , haddockLib = haddockProjectLib flags - , haddockOutputDir = haddockProjectOutputDir flags - } - nixFlags = - (commandDefaultFlags CmdHaddock.haddockCommand) - { NixStyleOptions.haddockFlags = haddockFlags - , NixStyleOptions.configFlags = - (NixStyleOptions.configFlags (commandDefaultFlags CmdBuild.buildCommand)) - { configCommonFlags = commonFlags - } - } - -- -- Construct the build plan and infer the list of packages which haddocks -- we need. @@ -199,8 +157,6 @@ haddockProjectAction flags _extraArgs globalFlags = do elaboratedPlan return (elaboratedPlan', targets) - printPlan verbosity baseCtx buildCtx - let elaboratedPlan :: ElaboratedInstallPlan elaboratedPlan = elaboratedPlanOriginal buildCtx @@ -255,61 +211,84 @@ haddockProjectAction flags _extraArgs globalFlags = do packageInfos <- fmap (nub . concat) $ for pkgs $ \pkg -> case pkg of - Left _ - | not localStyle -> - return [] - Left package -> do - -- TODO: this might not work for public packages with sublibraries. - -- Issue #9026. + Left package | localStyle -> do let packageName = unPackageName (pkgName $ sourcePackageId package) destDir = outputDir packageName fmap catMaybes $ for (haddockInterfaces package) $ \interfacePath -> do let docDir = takeDirectory interfacePath a <- doesFileExist interfacePath case a of - True -> + True -> do copyDirectoryRecursive verbosity docDir destDir - >> return - ( Just - ( packageName - , interfacePath - , Hidden - ) - ) + return $ Just $ Right (packageName, interfacePath, Hidden) False -> return Nothing + Left _ -> return [] Right package -> case elabLocalToProject package of True -> do let distDirParams = elabDistDirParams sharedConfig' package - unitId = unUnitId (elabUnitId package) + pkg_descr = elabPkgDescription package + + packageName = pkgName $ elabPkgSourceId package + unitId = elabUnitId package + packageDir = haddockDirName ForDevelopment pkg_descr + destDir = outputDir packageDir + interfacePath = destDir haddockPath pkg_descr + buildDir = distBuildDirectory distLayout distDirParams - packageName = unPackageName (pkgName $ elabPkgSourceId package) - let docDir = + docDir = buildDir "doc" "html" - packageName - destDir = outputDir unitId - interfacePath = - destDir - packageName - <.> "haddock" + packageDir + a <- doesDirectoryExist docDir - case a of - True -> + if a + then do copyDirectoryRecursive verbosity docDir destDir - >> return - [ - ( unitId - , interfacePath - , Visible - ) - ] - False -> do + let infos :: [(String, FilePath, Visibility)] + infos = + (unPackageName packageName, interfacePath, Visible) + : [ (sublibDirPath, sublibInterfacePath, Visible) + | lib <- subLibraries pkg_descr + , let sublibDirPath = haddockLibraryDirPath ForDevelopment pkg_descr lib + sublibInterfacePath = + outputDir + sublibDirPath + haddockLibraryPath pkg_descr lib + ] + ++ [ (testPath, testInterfacePath, Visible) + | test <- testSuites pkg_descr + , let testPath = haddockTestDirPath ForDevelopment pkg_descr test + testInterfacePath = + outputDir + testPath + haddockPath pkg_descr + ] + ++ [ (benchPath, benchInterfacePath, Visible) + | bench <- benchmarks pkg_descr + , let benchPath = haddockBenchmarkDirPath ForDevelopment pkg_descr bench + benchInterfacePath = + outputDir + benchPath + haddockPath pkg_descr + ] + infos' <- + mapM + ( \x@(_, path, _) -> do + e <- doesFileExist path + return $ + if e + then Right x + else Left path + ) + infos + return infos' + else do warn verbosity ( "haddocks of " - ++ show unitId + ++ unUnitId unitId ++ " not found in the store" ) return [] @@ -317,57 +296,53 @@ haddockProjectAction flags _extraArgs globalFlags = do | not localStyle -> return [] False -> do - let packageName = unPackageName (pkgName $ elabPkgSourceId package) + let pkg_descr = elabPkgDescription package unitId = unUnitId (elabUnitId package) packageDir = storePackageDirectory (cabalStoreDirLayout cabalLayout) (pkgConfigCompiler sharedConfig') (elabUnitId package) + -- TODO: use `InstallDirTemplates` docDir = packageDir "share" "doc" "html" - destDir = outputDir packageName - interfacePath = - destDir - packageName - <.> "haddock" + destDir = outputDir haddockDirName ForDevelopment pkg_descr + interfacePath = destDir haddockPath pkg_descr a <- doesDirectoryExist docDir case a of - True -> + True -> do copyDirectoryRecursive verbosity docDir destDir - -- non local packages will be hidden in haddock's - -- generated contents page - >> return - [ - ( unitId - , interfacePath - , Hidden - ) - ] + -- non local packages will be hidden in haddock's + -- generated contents page + return [Right (unitId, interfacePath, Hidden)] False -> do - warn - verbosity - ( "haddocks of " - ++ show unitId - ++ " not found in the store" - ) - return [] + return [Left unitId] -- -- generate index, content, etc. -- + let (missingHaddocks, packageInfos') = partitionEithers packageInfos + when (not (null missingHaddocks)) $ do + warn verbosity "missing haddocks for some packages from the store" + -- Show the package list if `-v1` is passed; it's usually a long list. + -- One needs to add `package` stantza in `cabal.project` file for + -- `cabal` to include a version which has haddocks (or set + -- `documentation: True` in the global config). + info verbosity (intercalate "\n" missingHaddocks) + let flags' = flags { haddockProjectDir = Flag outputDir , haddockProjectInterfaces = Flag [ ( interfacePath - , Just name - , Just name + , Just url + , Just url , visibility ) - | (name, interfacePath, visibility) <- packageInfos + | (url, interfacePath, visibility) <- packageInfos' ] + , haddockProjectUseUnicode = NoFlag } createHaddockIndex verbosity @@ -377,7 +352,61 @@ haddockProjectAction flags _extraArgs globalFlags = do Nothing flags' where - verbosity = fromFlagOrDefault normal (haddockProjectVerbosity flags) + -- build all packages with appropriate haddock flags + commonFlags = haddockProjectCommonFlags flags + + verbosity = fromFlagOrDefault normal (setupVerbosity commonFlags) + + haddockFlags = + defaultHaddockFlags + { haddockCommonFlags = commonFlags + , haddockHtml = Flag True + , -- one can either use `--haddock-base-url` or + -- `--haddock-html-location`. + haddockBaseUrl = + if localStyle + then Flag ".." + else NoFlag + , haddockProgramPaths = haddockProjectProgramPaths flags + , haddockProgramArgs = haddockProjectProgramArgs flags + , haddockHtmlLocation = + if fromFlagOrDefault False (haddockProjectHackage flags) + then Flag "https://hackage.haskell.org/package/$pkg-$version/docs" + else haddockProjectHtmlLocation flags + , haddockHoogle = haddockProjectHoogle flags + , haddockExecutables = haddockProjectExecutables flags + , haddockTestSuites = haddockProjectTestSuites flags + , haddockBenchmarks = haddockProjectBenchmarks flags + , haddockForeignLibs = haddockProjectForeignLibs flags + , haddockInternal = haddockProjectInternal flags + , haddockCss = haddockProjectCss flags + , haddockLinkedSource = Flag True + , haddockQuickJump = Flag True + , haddockHscolourCss = haddockProjectHscolourCss flags + , haddockContents = + if localStyle + then Flag (toPathTemplate "../index.html") + else NoFlag + , haddockIndex = + if localStyle + then Flag (toPathTemplate "../doc-index.html") + else NoFlag + , haddockResourcesDir = haddockProjectResourcesDir flags + , haddockUseUnicode = haddockProjectUseUnicode flags + -- NOTE: we don't pass `haddockOutputDir`. If we do, we'll need to + -- make sure `InstalledPackageInfo` contains the right path to + -- haddock interfaces. Instead we build documentation inside + -- `dist-newstyle` directory and copy it to the output directory. + } + + nixFlags = + (commandDefaultFlags CmdHaddock.haddockCommand) + { NixStyleOptions.haddockFlags = haddockFlags + , NixStyleOptions.configFlags = + (NixStyleOptions.configFlags (commandDefaultFlags CmdBuild.buildCommand)) + { configCommonFlags = commonFlags + } + } -- Build a self contained directory which contains haddocks of all -- transitive dependencies; or depend on `--haddocks-html-location` to diff --git a/cabal-install/src/Distribution/Client/CmdInstall.hs b/cabal-install/src/Distribution/Client/CmdInstall.hs index a154eff3ce9..75e673e895f 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall.hs @@ -131,8 +131,9 @@ import Distribution.Simple.Compiler ( Compiler (..) , CompilerFlavor (..) , CompilerId (..) - , PackageDB (..) - , PackageDBStack + , PackageDBCWD + , PackageDBStackCWD + , PackageDBX (..) ) import Distribution.Simple.Configure ( configCompilerEx @@ -389,7 +390,7 @@ installAction flags@NixStyleFlags{extraFlags, configFlags, installFlags, project -- NOTE: CmdInstall and project local packages. -- -- CmdInstall always installs packages from a source distribution that, in case of unpackage - -- pacakges, is created automatically. This is implemented in getSpecsAndTargetSelectors. + -- packages, is created automatically. This is implemented in getSpecsAndTargetSelectors. -- -- This has the inconvenience that the planner will consider all packages as non-local -- (see `ProjectPlanning.shouldBeLocal`) and that any project or cli configuration will @@ -466,6 +467,7 @@ installAction flags@NixStyleFlags{extraFlags, configFlags, installFlags, project fetchAndReadSourcePackages verbosity distDirLayout + compiler (projectConfigShared config) (projectConfigBuildOnly config) [ProjectPackageRemoteTarball uri | uri <- uris] @@ -540,7 +542,7 @@ installAction flags@NixStyleFlags{extraFlags, configFlags, installFlags, project -- BuildOutcomes because we also need the component names traverseInstall (installCheckUnitExes InstallCheckInstall) installCfg where - configFlags' = disableTestsBenchsByDefault configFlags + configFlags' = disableTestsBenchsByDefault . ignoreProgramAffixes $ configFlags verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags') ignoreProject = flagIgnoreProject projectFlags cliConfig = @@ -958,10 +960,10 @@ installLibraries -> ProjectBuildContext -> PI.PackageIndex InstalledPackageInfo -> Compiler - -> PackageDBStack + -> PackageDBStackCWD -> FilePath -- ^ Environment file - -> [GhcEnvironmentFileEntry] + -> [GhcEnvironmentFileEntry FilePath] -> Bool -- ^ Whether we need to show a warning (i.e. we created a new environment -- file, and the user did not use --package-env) @@ -1029,7 +1031,7 @@ installLibraries -- See ticket #8894. This is safe to include any nonreinstallable boot pkg, -- but the particular package users will always expect to be in scope without specific installation --- is base, so that they can access prelude, regardles of if they specifically asked for it. +-- is base, so that they can access prelude, regardless of if they specifically asked for it. globalPackages :: [PackageName] globalPackages = mkPackageName <$> ["base"] @@ -1064,9 +1066,9 @@ warnIfNoExes verbosity buildCtx = -- | Return the package specifiers and non-global environment file entries. getEnvSpecsAndNonGlobalEntries :: PI.InstalledPackageIndex - -> [GhcEnvironmentFileEntry] + -> [GhcEnvironmentFileEntry FilePath] -> Bool - -> ([PackageSpecifier a], [(PackageName, GhcEnvironmentFileEntry)]) + -> ([PackageSpecifier a], [(PackageName, GhcEnvironmentFileEntry FilePath)]) getEnvSpecsAndNonGlobalEntries installedIndex entries installLibs = if installLibs then (envSpecs, envEntries') @@ -1076,8 +1078,8 @@ getEnvSpecsAndNonGlobalEntries installedIndex entries installLibs = environmentFileToSpecifiers :: PI.InstalledPackageIndex - -> [GhcEnvironmentFileEntry] - -> ([PackageSpecifier a], [(PackageName, GhcEnvironmentFileEntry)]) + -> [GhcEnvironmentFileEntry FilePath] + -> ([PackageSpecifier a], [(PackageName, GhcEnvironmentFileEntry FilePath)]) environmentFileToSpecifiers ipi = foldMap $ \case (GhcEnvFilePackageId unitId) | Just @@ -1101,6 +1103,18 @@ disableTestsBenchsByDefault configFlags = , configBenchmarks = Flag False <> configBenchmarks configFlags } +-- | Disables program prefix and suffix, in order to get the /canonical/ +-- executable name in the store and thus: +-- +-- * avoid making the package hash depend on these options and needless rebuild; +-- * provide the correct executable path to the install methods (copy, symlink). +ignoreProgramAffixes :: ConfigFlags -> ConfigFlags +ignoreProgramAffixes configFlags = + configFlags + { configProgPrefix = NoFlag + , configProgSuffix = NoFlag + } + -- | Prepares a record containing the information needed to either symlink or -- copy an executable. symlink :: OverwritePolicy -> InstallExe -> UnitId -> UnqualComponentName -> Symlink @@ -1113,8 +1127,8 @@ symlink overwritePolicy installDir (mkSourceBinDir unit) - (mkExeName exe) (mkFinalExeName exe) + (mkExeName exe) -- | -- -- * When 'InstallCheckOnly', warn if install would fail overwrite policy @@ -1159,7 +1173,7 @@ installCheckUnitExes errorMessage installdir exe = case overwritePolicy of NeverOverwrite -> "Path '" - <> (installdir prettyShow exe) + <> (installdir mkFinalExeName exe) <> "' already exists. " <> "Use --overwrite-policy=always to overwrite." -- This shouldn't even be possible, but we keep it in case symlinking or @@ -1236,7 +1250,7 @@ installBuiltExe overwrite -- | Create 'GhcEnvironmentFileEntry's for packages with exposed libraries. -entriesForLibraryComponents :: TargetsMap -> [GhcEnvironmentFileEntry] +entriesForLibraryComponents :: TargetsMap -> [GhcEnvironmentFileEntry FilePath] entriesForLibraryComponents = Map.foldrWithKey' (\k v -> mappend (go k v)) [] where hasLib :: (ComponentTarget, NonEmpty TargetSelector) -> Bool @@ -1246,7 +1260,7 @@ entriesForLibraryComponents = Map.foldrWithKey' (\k v -> mappend (go k v)) [] go :: UnitId -> [(ComponentTarget, NonEmpty TargetSelector)] - -> [GhcEnvironmentFileEntry] + -> [GhcEnvironmentFileEntry FilePath] go unitId targets | any hasLib targets = [GhcEnvFilePackageId unitId] | otherwise = [] @@ -1278,7 +1292,7 @@ getEnvFile clientInstallFlags platform compilerVersion = do -- | Returns the list of @GhcEnvFilePackageId@ values already existing in the -- environment being operated on. The @Bool@ is @True@ if we took settings -- from an existing file, @False@ otherwise. -getExistingEnvEntries :: Verbosity -> CompilerFlavor -> Bool -> FilePath -> IO (Bool, [GhcEnvironmentFileEntry]) +getExistingEnvEntries :: Verbosity -> CompilerFlavor -> Bool -> FilePath -> IO (Bool, [GhcEnvironmentFileEntry FilePath]) getExistingEnvEntries verbosity compilerFlavor supportsPkgEnvFiles envFile = do envFileExists <- doesFileExist envFile (usedExisting, allEntries) <- @@ -1322,8 +1336,8 @@ getPackageDbStack :: Compiler -> Flag FilePath -> Flag FilePath - -> [Maybe PackageDB] - -> IO PackageDBStack + -> [Maybe PackageDBCWD] + -> IO PackageDBStackCWD getPackageDbStack compiler storeDirFlag logsDirFlag packageDbs = do mstoreDir <- traverse makeAbsolute $ flagToMaybe storeDirFlag let diff --git a/cabal-install/src/Distribution/Client/CmdInstall/ClientInstallFlags.hs b/cabal-install/src/Distribution/Client/CmdInstall/ClientInstallFlags.hs index d5bbd5309f7..b35cd06fe7a 100644 --- a/cabal-install/src/Distribution/Client/CmdInstall/ClientInstallFlags.hs +++ b/cabal-install/src/Distribution/Client/CmdInstall/ClientInstallFlags.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE LambdaCase #-} module Distribution.Client.CmdInstall.ClientInstallFlags ( InstallMethod (..) diff --git a/cabal-install/src/Distribution/Client/CmdLegacy.hs b/cabal-install/src/Distribution/Client/CmdLegacy.hs index 128d5fb4251..61ae0f7458b 100644 --- a/cabal-install/src/Distribution/Client/CmdLegacy.hs +++ b/cabal-install/src/Distribution/Client/CmdLegacy.hs @@ -2,7 +2,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE ViewPatterns #-} module Distribution.Client.CmdLegacy (legacyCmd, legacyWrapperCmd, newCmd) where @@ -78,7 +77,7 @@ wrapperAction command getCommonFlags = Nothing command' getCommonFlags - (const flags) + (const (return flags)) (const extraArgs) -- diff --git a/cabal-install/src/Distribution/Client/CmdListBin.hs b/cabal-install/src/Distribution/Client/CmdListBin.hs index e53100122e9..df16b98e1a2 100644 --- a/cabal-install/src/Distribution/Client/CmdListBin.hs +++ b/cabal-install/src/Distribution/Client/CmdListBin.hs @@ -1,8 +1,5 @@ -{-# LANGUAGE MultiWayIf #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TupleSections #-} module Distribution.Client.CmdListBin ( listbinCommand diff --git a/cabal-install/src/Distribution/Client/CmdOutdated.hs b/cabal-install/src/Distribution/Client/CmdOutdated.hs index ed40a1a85e6..7674e67286f 100644 --- a/cabal-install/src/Distribution/Client/CmdOutdated.hs +++ b/cabal-install/src/Distribution/Client/CmdOutdated.hs @@ -129,6 +129,9 @@ import Distribution.Types.ComponentRequestedSpec import Distribution.Types.Dependency ( Dependency (..) ) +import Distribution.Types.DependencySatisfaction + ( DependencySatisfaction (..) + ) import Distribution.Types.PackageVersionConstraint ( PackageVersionConstraint (..) , simplifyPackageVersionConstraint @@ -443,7 +446,7 @@ depsFromPkgDesc verbosity comp platform = do finalizePD mempty (ComponentRequestedSpec True True) - (const True) + (const Satisfied) platform cinfo [] diff --git a/cabal-install/src/Distribution/Client/CmdPath.hs b/cabal-install/src/Distribution/Client/CmdPath.hs index 8ca8d6181f1..7c294d0b9a2 100644 --- a/cabal-install/src/Distribution/Client/CmdPath.hs +++ b/cabal-install/src/Distribution/Client/CmdPath.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-} ----------------------------------------------------------------------------- @@ -95,7 +94,7 @@ pathCommand :: CommandUI (NixStyleFlags PathFlags) pathCommand = CommandUI { commandName = "path" - , commandSynopsis = "Query for simple project information" + , commandSynopsis = "Query for simple project information." , commandDescription = Just $ \_ -> wrapText $ "Query for configuration and project information such as project GHC.\n" diff --git a/cabal-install/src/Distribution/Client/CmdRepl.hs b/cabal-install/src/Distribution/Client/CmdRepl.hs index 39468a8e545..a75524bbca6 100644 --- a/cabal-install/src/Distribution/Client/CmdRepl.hs +++ b/cabal-install/src/Distribution/Client/CmdRepl.hs @@ -103,11 +103,11 @@ import Distribution.Simple.Compiler ) import Distribution.Simple.Setup ( ReplOptions (..) + , commonSetupTempFileOptions , setupVerbosity ) import Distribution.Simple.Utils - ( TempFileOptions (..) - , debugNoWrap + ( debugNoWrap , dieWithException , withTempDirectoryEx , wrapText @@ -139,6 +139,7 @@ import Distribution.Types.Library ( Library (..) , emptyLibrary ) +import Distribution.Types.ParStrat import Distribution.Types.Version ( Version , mkVersion @@ -407,10 +408,10 @@ replAction flags@NixStyleFlags{extraFlags = r@ReplFlags{..}, ..} targetStrings g return (buildCtx, compiler, configureReplOptions & lReplOptionsFlags %~ (++ repl_flags), targets) - -- Multi Repl implemention see: https://well-typed.com/blog/2023/03/cabal-multi-unit/ for + -- Multi Repl implementation see: https://well-typed.com/blog/2023/03/cabal-multi-unit/ for -- a high-level overview about how everything fits together. if Set.size (distinctTargetComponents targets) > 1 - then withTempDirectoryEx verbosity (TempFileOptions keepTempFiles) distDir "multi-out" $ \dir' -> do + then withTempDirectoryEx verbosity tempFileOptions distDir "multi-out" $ \dir' -> do -- multi target repl dir <- makeAbsolute dir' -- Modify the replOptions so that the ./Setup repl command will write options @@ -439,7 +440,7 @@ replAction flags@NixStyleFlags{extraFlags = r@ReplFlags{..}, ..} targetStrings g let sp = intercalate [searchPathSeparator] (map fst (sortBy (comparing @Int snd) $ Map.toList (combine_search_paths all_paths))) -- HACK: Just combine together all env overrides, placing the most common things last - -- ghc program with overriden PATH + -- ghc program with overridden PATH (ghcProg, _) <- requireProgram verbosity ghcProgram (pkgConfigCompilerProgs (elaboratedShared buildCtx')) let ghcProg' = ghcProg{programOverrideEnv = [("PATH", Just sp)]} @@ -467,6 +468,10 @@ replAction flags@NixStyleFlags{extraFlags = r@ReplFlags{..}, ..} targetStrings g in -- GHC considers the last unit passed to be the active one other_units ++ active_unit_files + render_j Serial = "1" + render_j (UseSem n) = show @Int n + render_j (NumJobs mn) = maybe "" (show @Int) mn + -- run ghc --interactive with runProgramInvocation verbosity $ programInvocation ghcProg' $ @@ -475,7 +480,7 @@ replAction flags@NixStyleFlags{extraFlags = r@ReplFlags{..}, ..} targetStrings g , "-package-env" , "-" -- to ignore ghc.environment.* files , "-j" - , show (buildSettingNumJobs (buildSettings ctx)) + , render_j (buildSettingNumJobs (buildSettings ctx)) ] : [ ["-unit", "@" ++ dir unit] | unit <- unit_files_ordered @@ -502,7 +507,7 @@ replAction flags@NixStyleFlags{extraFlags = r@ReplFlags{..}, ..} targetStrings g go m _ = m verbosity = fromFlagOrDefault normal (setupVerbosity $ configCommonFlags configFlags) - keepTempFiles = fromFlagOrDefault False replKeepTempFiles + tempFileOptions = commonSetupTempFileOptions $ configCommonFlags configFlags validatedTargets ctx compiler elaboratedPlan targetSelectors = do let multi_repl_enabled = multiReplDecision ctx compiler r diff --git a/cabal-install/src/Distribution/Client/CmdRun.hs b/cabal-install/src/Distribution/Client/CmdRun.hs index 5c481ae1c76..0000a2927a1 100644 --- a/cabal-install/src/Distribution/Client/CmdRun.hs +++ b/cabal-install/src/Distribution/Client/CmdRun.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TupleSections #-} diff --git a/cabal-install/src/Distribution/Client/CmdSdist.hs b/cabal-install/src/Distribution/Client/CmdSdist.hs index 07687bbeb98..ab9e7712bc3 100644 --- a/cabal-install/src/Distribution/Client/CmdSdist.hs +++ b/cabal-install/src/Distribution/Client/CmdSdist.hs @@ -1,10 +1,7 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE MultiWayIf #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} -{-# LANGUAGE TupleSections #-} -{-# LANGUAGE ViewPatterns #-} module Distribution.Client.CmdSdist ( sdistCommand diff --git a/cabal-install/src/Distribution/Client/CmdUpdate.hs b/cabal-install/src/Distribution/Client/CmdUpdate.hs index c388ba39871..33ae77e14e0 100644 --- a/cabal-install/src/Distribution/Client/CmdUpdate.hs +++ b/cabal-install/src/Distribution/Client/CmdUpdate.hs @@ -1,10 +1,7 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE LambdaCase #-} -{-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} -{-# LANGUAGE ViewPatterns #-} -- | cabal-install CLI command: update module Distribution.Client.CmdUpdate diff --git a/cabal-install/src/Distribution/Client/Compat/Orphans.hs b/cabal-install/src/Distribution/Client/Compat/Orphans.hs index 4a2e28a10fb..bbc44bb5c8a 100644 --- a/cabal-install/src/Distribution/Client/Compat/Orphans.hs +++ b/cabal-install/src/Distribution/Client/Compat/Orphans.hs @@ -4,8 +4,8 @@ module Distribution.Client.Compat.Orphans () where import Control.Exception (SomeException) +import Data.Typeable (typeRep) import Distribution.Compat.Binary (Binary (..)) -import Distribution.Compat.Typeable (typeRep) import Distribution.Utils.Structured (Structure (Nominal), Structured (..)) import Network.URI (URI (..), URIAuth (..)) import Prelude (error, return) diff --git a/cabal-install/src/Distribution/Client/Compat/Semaphore.hs b/cabal-install/src/Distribution/Client/Compat/Semaphore.hs index 42c398b5c33..60fda2cf389 100644 --- a/cabal-install/src/Distribution/Client/Compat/Semaphore.hs +++ b/cabal-install/src/Distribution/Client/Compat/Semaphore.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# OPTIONS_GHC -funbox-strict-fields #-} module Distribution.Client.Compat.Semaphore @@ -22,13 +21,12 @@ import Control.Exception (mask_, onException) import Control.Monad (join, unless) import Data.List.NonEmpty (NonEmpty (..)) import qualified Data.List.NonEmpty as NE -import Data.Typeable (Typeable) -- | 'QSem' is a quantity semaphore in which the resource is acquired -- and released in units of one. It provides guaranteed FIFO ordering -- for satisfying blocked `waitQSem` calls. data QSem = QSem !(TVar Int) !(TVar [TVar Bool]) !(TVar [TVar Bool]) - deriving (Eq, Typeable) + deriving (Eq) newQSem :: Int -> IO QSem newQSem i = atomically $ do diff --git a/cabal-install/src/Distribution/Client/Config.hs b/cabal-install/src/Distribution/Client/Config.hs index fd9bd5af432..d4214cc383b 100644 --- a/cabal-install/src/Distribution/Client/Config.hs +++ b/cabal-install/src/Distribution/Client/Config.hs @@ -160,6 +160,7 @@ import qualified Distribution.Deprecated.ParseUtils as ParseUtils import Distribution.Parsec (ParsecParser, parsecFilePath, parsecOptCommaList, parsecToken) import Distribution.Simple.Command ( CommandUI (commandOptions) + , OptionField , ShowOrParseArgs (..) , commandDefaultFlags ) @@ -469,6 +470,7 @@ instance Semigroup SavedConfig where , setupCabalFilePath = combine setupCabalFilePath , setupVerbosity = combine setupVerbosity , setupTargets = lastNonEmpty setupTargets + , setupKeepTempFiles = combine setupKeepTempFiles } where lastNonEmpty = lastNonEmpty' which @@ -490,6 +492,7 @@ instance Semigroup SavedConfig where , configVanillaLib = combine configVanillaLib , configProfLib = combine configProfLib , configProf = combine configProf + , configProfShared = combine configProfShared , configSharedLib = combine configSharedLib , configStaticLib = combine configStaticLib , configDynExe = combine configDynExe @@ -545,6 +548,7 @@ instance Semigroup SavedConfig where , configAllowDependingOnPrivateLibs = combine configAllowDependingOnPrivateLibs , configCoverageFor = combine configCoverageFor + , configIgnoreBuildTools = combine configIgnoreBuildTools } where combine = combine' savedConfigureFlags @@ -627,11 +631,11 @@ instance Semigroup SavedConfig where , haddockQuickJump = combine haddockQuickJump , haddockHscolourCss = combine haddockHscolourCss , haddockContents = combine haddockContents - , haddockKeepTempFiles = combine haddockKeepTempFiles , haddockIndex = combine haddockIndex , haddockBaseUrl = combine haddockBaseUrl - , haddockLib = combine haddockLib + , haddockResourcesDir = combine haddockResourcesDir , haddockOutputDir = combine haddockOutputDir + , haddockUseUnicode = combine haddockUseUnicode } where combine = combine' savedHaddockFlags @@ -1311,6 +1315,19 @@ configFieldDescriptions src = ParseArgs ] where + toSavedConfig + :: (FieldDescr a -> FieldDescr SavedConfig) + -- Lifting function. + -> [OptionField a] + -- Option fields. + -> [String] + -- Fields to exclude, by name. + -> [FieldDescr a] + -- Field replacements. + -- + -- If an option is found with the same name as one of these replacement + -- fields, the replacement field is used instead of the option. + -> [FieldDescr SavedConfig] toSavedConfig lift options exclusions replacements = [ lift (fromMaybe field replacement) | opt <- options @@ -1827,7 +1844,7 @@ haddockFlagsFields = , name `notElem` exclusions ] where - exclusions = ["verbose", "builddir", "for-hackage"] + exclusions = ["verbose", "builddir", "cabal-file", "for-hackage"] -- | Fields for the 'init' section. initFlagsFields :: [FieldDescr IT.InitFlags] diff --git a/cabal-install/src/Distribution/Client/Configure.hs b/cabal-install/src/Distribution/Client/Configure.hs index fc7ea49fe31..5f82329eb52 100644 --- a/cabal-install/src/Distribution/Client/Configure.hs +++ b/cabal-install/src/Distribution/Client/Configure.hs @@ -86,8 +86,8 @@ import Distribution.PackageDescription.Configuration import Distribution.Simple.Compiler ( Compiler , CompilerInfo - , PackageDB (..) - , PackageDBStack + , PackageDBStackCWD + , PackageDBX (..) , compilerInfo ) import Distribution.Simple.PackageDescription @@ -116,6 +116,9 @@ import Distribution.Simple.Utils as Utils import Distribution.System ( Platform ) +import Distribution.Types.DependencySatisfaction + ( DependencySatisfaction (..) + ) import Distribution.Types.GivenComponent ( GivenComponent (..) ) @@ -144,7 +147,7 @@ chooseCabalVersion _configExFlags maybeVersion = -- | Configure the package found in the local directory configure :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Compiler -> Platform @@ -203,7 +206,7 @@ configure Nothing configureCommand configCommonFlags - (const configFlags) + (const (return configFlags)) (const extraArgs) Right installPlan0 -> let installPlan = InstallPlan.configureInstallPlan configFlags installPlan0 @@ -253,7 +256,7 @@ configure logMsg message rest = debug verbosity message >> rest configureSetupScript - :: PackageDBStack + :: PackageDBStackCWD -> Compiler -> Platform -> ProgramDb @@ -308,7 +311,7 @@ configureSetupScript -- finding the Cabal lib when compiling any Setup.hs even if we're doing -- a global install. However we also allow looking in a specific package -- db. - packageDBs' :: PackageDBStack + packageDBs' :: PackageDBStackCWD index' :: Maybe InstalledPackageIndex (packageDBs', index') = case packageDBs of @@ -390,7 +393,7 @@ planLocalPackage -> ConfigExFlags -> InstalledPackageIndex -> SourcePackageDb - -> PkgConfigDb + -> Maybe PkgConfigDb -> IO (Progress String String SolverInstallPlan) planLocalPackage verbosity @@ -505,7 +508,7 @@ configurePackage (Just pkg) configureCommand configCommonFlags - configureFlags + (return . configureFlags) (const extraArgs) where gpkg :: PkgDesc.GenericPackageDescription @@ -555,7 +558,7 @@ configurePackage pkg = case finalizePD flags (enableStanzas stanzas) - (const True) + (const Satisfied) platform comp [] diff --git a/cabal-install/src/Distribution/Client/Dependency.hs b/cabal-install/src/Distribution/Client/Dependency.hs index 66a0a103c23..d59bc611c44 100644 --- a/cabal-install/src/Distribution/Client/Dependency.hs +++ b/cabal-install/src/Distribution/Client/Dependency.hs @@ -64,6 +64,7 @@ module Distribution.Client.Dependency , addDefaultSetupDependencies , addSetupCabalMinVersionConstraint , addSetupCabalMaxVersionConstraint + , addSetupCabalProfiledDynamic ) where import Distribution.Client.Compat.Prelude @@ -126,6 +127,9 @@ import Distribution.System ( Platform ) import Distribution.Types.Dependency +import Distribution.Types.DependencySatisfaction + ( DependencySatisfaction (..) + ) import Distribution.Verbosity ( normal ) @@ -463,6 +467,7 @@ nonReinstallablePackages :: [PackageName] nonReinstallablePackages = [ mkPackageName "base" , mkPackageName "ghc-bignum" + , mkPackageName "ghc-internal" , mkPackageName "ghc-prim" , mkPackageName "ghc" , mkPackageName "integer-gmp" @@ -670,6 +675,22 @@ addSetupCabalMaxVersionConstraint maxVersion = where cabalPkgname = mkPackageName "Cabal" +-- | Add an a lower bound @setup.Cabal >= 3.13@ labeled with 'ConstraintSourceProfiledDynamic' +addSetupCabalProfiledDynamic + :: DepResolverParams + -> DepResolverParams +addSetupCabalProfiledDynamic = + addConstraints + [ LabeledPackageConstraint + ( PackageConstraint + (ScopeAnySetupQualifier cabalPkgname) + (PackagePropertyVersion $ orLaterVersion (mkVersion [3, 13, 0])) + ) + ConstraintSourceProfiledDynamic + ] + where + cabalPkgname = mkPackageName "Cabal" + upgradeDependencies :: DepResolverParams -> DepResolverParams upgradeDependencies = setPreferenceDefault PreferAllLatest @@ -763,7 +784,7 @@ runSolver = modularResolver resolveDependencies :: Platform -> CompilerInfo - -> PkgConfigDb + -> Maybe PkgConfigDb -> DepResolverParams -> Progress String String SolverInstallPlan resolveDependencies platform comp pkgConfigDB params = @@ -1074,7 +1095,7 @@ configuredPackageProblems case finalizePD specifiedFlags compSpec - (const True) + (const Satisfied) platform cinfo [] diff --git a/cabal-install/src/Distribution/Client/DistDirLayout.hs b/cabal-install/src/Distribution/Client/DistDirLayout.hs index 01da7195d51..64140152453 100644 --- a/cabal-install/src/Distribution/Client/DistDirLayout.hs +++ b/cabal-install/src/Distribution/Client/DistDirLayout.hs @@ -43,8 +43,9 @@ import Distribution.Package import Distribution.Simple.Compiler ( Compiler (..) , OptimisationLevel (..) - , PackageDB (..) - , PackageDBStack + , PackageDBCWD + , PackageDBStackCWD + , PackageDBX (..) ) import Distribution.Simple.Configure (interpretPackageDbFlags) import Distribution.System @@ -111,7 +112,7 @@ data DistDirLayout = DistDirLayout , distSdistDirectory :: FilePath , distTempDirectory :: FilePath , distBinDirectory :: FilePath - , distPackageDB :: CompilerId -> PackageDB + , distPackageDB :: CompilerId -> PackageDBCWD , distHaddockOutputDir :: Maybe FilePath -- ^ Is needed when `--haddock-output-dir` flag is used. } @@ -121,8 +122,8 @@ data StoreDirLayout = StoreDirLayout { storeDirectory :: Compiler -> FilePath , storePackageDirectory :: Compiler -> UnitId -> FilePath , storePackageDBPath :: Compiler -> FilePath - , storePackageDB :: Compiler -> PackageDB - , storePackageDBStack :: Compiler -> [Maybe PackageDB] -> PackageDBStack + , storePackageDB :: Compiler -> PackageDBCWD + , storePackageDBStack :: Compiler -> [Maybe PackageDBCWD] -> PackageDBStackCWD , storeIncomingDirectory :: Compiler -> FilePath , storeIncomingLock :: Compiler -> UnitId -> FilePath } @@ -258,7 +259,7 @@ defaultDistDirLayout projectRoot mdistDirectory haddockOutputDir = distPackageDBPath :: CompilerId -> FilePath distPackageDBPath compid = distDirectory "packagedb" prettyShow compid - distPackageDB :: CompilerId -> PackageDB + distPackageDB :: CompilerId -> PackageDBCWD distPackageDB = SpecificPackageDB . distPackageDBPath distHaddockOutputDir :: Maybe FilePath @@ -282,11 +283,11 @@ defaultStoreDirLayout storeRoot = storePackageDBPath compiler = storeDirectory compiler "package.db" - storePackageDB :: Compiler -> PackageDB + storePackageDB :: Compiler -> PackageDBCWD storePackageDB compiler = SpecificPackageDB (storePackageDBPath compiler) - storePackageDBStack :: Compiler -> [Maybe PackageDB] -> PackageDBStack + storePackageDBStack :: Compiler -> [Maybe PackageDBCWD] -> PackageDBStackCWD storePackageDBStack compiler extraPackageDB = (interpretPackageDbFlags False extraPackageDB) ++ [storePackageDB compiler] diff --git a/cabal-install/src/Distribution/Client/Errors.hs b/cabal-install/src/Distribution/Client/Errors.hs index d25c59af41e..b4bff5f3ae1 100644 --- a/cabal-install/src/Distribution/Client/Errors.hs +++ b/cabal-install/src/Distribution/Client/Errors.hs @@ -1,8 +1,6 @@ {-# LANGUAGE ConstraintKinds #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE InstanceSigs #-} -{-# LANGUAGE NamedFieldPuns #-} {-# OPTIONS_GHC -fno-warn-incomplete-uni-patterns #-} ----------------------------------------------------------------------------- @@ -26,8 +24,8 @@ import qualified Data.ByteString.Base16 as Base16 import qualified Data.ByteString.Char8 as BS8 import Data.List (groupBy) import Distribution.Client.IndexUtils.Timestamp -import Distribution.Client.Types.Repo -import Distribution.Client.Types.RepoName (RepoName (..)) +import qualified Distribution.Client.Types.Repo as Repo +import qualified Distribution.Client.Types.RepoName as RepoName import Distribution.Compat.Prelude import Distribution.Deprecated.ParseUtils (PWarning, showPWarning) import Distribution.Package @@ -72,7 +70,7 @@ data CabalInstallException | ReportTargetProblems String | ListBinTargetException String | ResolveWithoutDependency String - | CannotReadCabalFile FilePath + | CannotReadCabalFile FilePath FilePath | ErrorUpdatingIndex FilePath IOException | InternalError FilePath | ReadIndexCache FilePath @@ -182,11 +180,11 @@ data CabalInstallException | FreezeException String | PkgSpecifierException [String] | CorruptedIndexCache String - | UnusableIndexState RemoteRepo Timestamp Timestamp - | MissingPackageList RemoteRepo + | UnusableIndexState Repo.RemoteRepo Timestamp Timestamp + | MissingPackageList Repo.RemoteRepo | CmdPathAcceptsNoTargets | CmdPathCommandDoesn'tSupportDryRun - deriving (Show, Typeable) + deriving (Show) exceptionCodeCabalInstall :: CabalInstallException -> Int exceptionCodeCabalInstall e = case e of @@ -392,7 +390,11 @@ exceptionMessageCabalInstall e = case e of ReportTargetProblems problemsMsg -> problemsMsg ListBinTargetException errorStr -> errorStr ResolveWithoutDependency errorStr -> errorStr - CannotReadCabalFile file -> "Cannot read .cabal file inside " ++ file + CannotReadCabalFile expect file -> + "Failed to read " + ++ expect + ++ " from archive " + ++ file ErrorUpdatingIndex name ioe -> "Error while updating index for " ++ name ++ " repository " ++ show ioe InternalError msg -> "internal error when reading package index: " @@ -841,7 +843,7 @@ exceptionMessageCabalInstall e = case e of CorruptedIndexCache str -> str UnusableIndexState repoRemote maxFound requested -> "Latest known index-state for '" - ++ unRepoName (remoteRepoName repoRemote) + ++ RepoName.unRepoName (Repo.remoteRepoName repoRemote) ++ "' (" ++ prettyShow maxFound ++ ") is older than the requested index-state (" @@ -851,7 +853,7 @@ exceptionMessageCabalInstall e = case e of ++ "." MissingPackageList repoRemote -> "The package list for '" - ++ unRepoName (remoteRepoName repoRemote) + ++ RepoName.unRepoName (Repo.remoteRepoName repoRemote) ++ "' does not exist. Run 'cabal update' to download it." CmdPathAcceptsNoTargets -> "The 'path' command accepts no target arguments." diff --git a/cabal-install/src/Distribution/Client/Fetch.hs b/cabal-install/src/Distribution/Client/Fetch.hs index 54db5ae607b..033d3a01e14 100644 --- a/cabal-install/src/Distribution/Client/Fetch.hs +++ b/cabal-install/src/Distribution/Client/Fetch.hs @@ -44,10 +44,6 @@ import Distribution.Package ( packageId ) import Distribution.Simple.Compiler - ( Compiler - , PackageDBStack - , compilerInfo - ) import Distribution.Simple.PackageIndex (InstalledPackageIndex) import Distribution.Simple.Program ( ProgramDb @@ -88,7 +84,7 @@ import Distribution.System -- | Fetch a list of packages and their dependencies. fetch :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Compiler -> Platform @@ -161,7 +157,7 @@ planPackages -> FetchFlags -> InstalledPackageIndex -> SourcePackageDb - -> PkgConfigDb + -> Maybe PkgConfigDb -> [PackageSpecifier UnresolvedSourcePackage] -> IO [UnresolvedSourcePackage] planPackages diff --git a/cabal-install/src/Distribution/Client/FetchUtils.hs b/cabal-install/src/Distribution/Client/FetchUtils.hs index c804040cab7..62da386573d 100644 --- a/cabal-install/src/Distribution/Client/FetchUtils.hs +++ b/cabal-install/src/Distribution/Client/FetchUtils.hs @@ -25,7 +25,7 @@ module Distribution.Client.FetchUtils -- ** specifically for repo packages , checkRepoTarballFetched , fetchRepoTarball - , verifyFetchedTarball + , verifyFetchedTarballs -- ** fetching packages asynchronously , asyncFetchPackages @@ -98,6 +98,7 @@ import System.IO , openTempFile ) +import Control.Monad (forM) import Distribution.Client.Errors import qualified Hackage.Security.Client as Sec import qualified Hackage.Security.Util.Checked as Sec @@ -152,40 +153,66 @@ checkRepoTarballFetched repo pkgid = do then return (Just file) else return Nothing -verifyFetchedTarball :: Verbosity -> RepoContext -> Repo -> PackageId -> IO Bool -verifyFetchedTarball verbosity repoCtxt repo pkgid = - let file = packageFile repo pkgid - handleError :: IO Bool -> IO Bool - handleError act = do - res <- Safe.try act - case res of - Left e -> warn verbosity ("Error verifying fetched tarball " ++ file ++ ", will redownload: " ++ show (e :: SomeException)) >> pure False - Right b -> pure b - in handleError $ do - exists <- doesFileExist file - if not exists - then return True -- if the file does not exist, it vacuously passes validation, since it will be downloaded as necessary with what we will then check is a valid hash. - else case repo of - -- a secure repo has hashes we can compare against to confirm this is the correct file. - RepoSecure{} -> - repoContextWithSecureRepo repoCtxt repo $ \repoSecure -> - Sec.withIndex repoSecure $ \callbacks -> - let warnAndFail s = warn verbosity ("Fetched tarball " ++ file ++ " does not match server, will redownload: " ++ s) >> return False - in -- the do block in parens is due to dealing with the checked exceptions mechanism. - ( do - fileInfo <- Sec.indexLookupFileInfo callbacks pkgid - sz <- Sec.FileLength . fromInteger <$> getFileSize file - if sz /= Sec.fileInfoLength (Sec.trusted fileInfo) - then warnAndFail "file length mismatch" - else do - res <- Sec.compareTrustedFileInfo (Sec.trusted fileInfo) <$> Sec.computeFileInfo (Sec.Path file :: Sec.Path Sec.Absolute) - if res - then pure True - else warnAndFail "file hash mismatch" - ) - `Sec.catchChecked` (\(e :: Sec.InvalidPackageException) -> warnAndFail (show e)) - `Sec.catchChecked` (\(e :: Sec.VerificationError) -> warnAndFail (show e)) - _ -> pure True +verifyFetchedTarballs + :: Verbosity + -> RepoContext + -> Repo + -> [PackageId] + -> IO + ( [ Either + (Repo, PackageId) -- Verified + (Repo, PackageId) -- unverified) + ] + ) +verifyFetchedTarballs verbosity repoCtxt repo pkgids = + -- Establish the context once per repo (see #10110), this codepath is important + -- to be fast as it can happen when no other building happens. + let establishContext k = + case repo of + RepoSecure{} -> + repoContextWithSecureRepo repoCtxt repo $ \repoSecure -> + Sec.withIndex repoSecure $ \callbacks -> k (Just callbacks) + _ -> k Nothing + in do + establishContext $ \mCallbacks -> + forM pkgids $ \pkgid -> do + let file = packageFile repo pkgid + res <- verifyFetchedTarball verbosity file mCallbacks pkgid + return $ if res then Left (repo, pkgid) else Right (repo, pkgid) + +verifyFetchedTarball :: Verbosity -> FilePath -> Maybe Sec.IndexCallbacks -> PackageId -> IO Bool +verifyFetchedTarball verbosity file mCallbacks pkgid = + let + handleError :: IO Bool -> IO Bool + handleError act = do + res <- Safe.try act + case res of + Left e -> warn verbosity ("Error verifying fetched tarball " ++ file ++ ", will redownload: " ++ show (e :: SomeException)) >> pure False + Right b -> pure b + in + handleError $ do + exists <- doesFileExist file + if not exists + then return True -- if the file does not exist, it vacuously passes validation, since it will be downloaded as necessary with what we will then check is a valid hash. + else case mCallbacks of + -- a secure repo has hashes we can compare against to confirm this is the correct file. + Just callbacks -> + let warnAndFail s = warn verbosity ("Fetched tarball " ++ file ++ " does not match server, will redownload: " ++ s) >> return False + in -- the do block in parens is due to dealing with the checked exceptions mechanism. + ( do + fileInfo <- Sec.indexLookupFileInfo callbacks pkgid + sz <- Sec.FileLength . fromInteger <$> getFileSize file + if sz /= Sec.fileInfoLength (Sec.trusted fileInfo) + then warnAndFail "file length mismatch" + else do + res <- Sec.compareTrustedFileInfo (Sec.trusted fileInfo) <$> Sec.computeFileInfo (Sec.Path file :: Sec.Path Sec.Absolute) + if res + then pure True + else warnAndFail "file hash mismatch" + ) + `Sec.catchChecked` (\(e :: Sec.InvalidPackageException) -> warnAndFail (show e)) + `Sec.catchChecked` (\(e :: Sec.VerificationError) -> warnAndFail (show e)) + _ -> pure True -- | Fetch a package if we don't have it already. fetchPackage diff --git a/cabal-install/src/Distribution/Client/FileMonitor.hs b/cabal-install/src/Distribution/Client/FileMonitor.hs index 59742cc1b80..61607dd1996 100644 --- a/cabal-install/src/Distribution/Client/FileMonitor.hs +++ b/cabal-install/src/Distribution/Client/FileMonitor.hs @@ -35,7 +35,6 @@ import Prelude () import Data.Binary.Get (runGetOrFail) import qualified Data.ByteString.Lazy as BS -import qualified Data.Hashable as Hashable import qualified Data.Map.Strict as Map import Control.Exception @@ -51,6 +50,7 @@ import qualified Control.Monad.State as State import Control.Monad.Trans (MonadIO, liftIO) import Distribution.Client.Glob +import Distribution.Client.HashValue import Distribution.Client.Utils (MergeResult (..), mergeBy) import Distribution.Compat.Time import Distribution.Simple.FileMonitor.Types @@ -83,8 +83,6 @@ data MonitorStateFileSet instance Binary MonitorStateFileSet instance Structured MonitorStateFileSet -type Hash = Int - -- | The state necessary to determine whether a monitored file has changed. -- -- This covers all the cases of 'MonitorFilePath' except for globs which is @@ -107,7 +105,7 @@ data MonitorStateFileStatus | -- | cached file mtime MonitorStateFileModTime !ModTime | -- | cached mtime and content hash - MonitorStateFileHashed !ModTime !Hash + MonitorStateFileHashed !ModTime !HashValue | MonitorStateDirExists | -- | cached dir mtime MonitorStateDirModTime !ModTime @@ -961,21 +959,21 @@ buildMonitorStateGlobRel -- updating a file monitor the set of files is the same or largely the same so -- we can grab the previously known content hashes with their corresponding -- mtimes. -type FileHashCache = Map FilePath (ModTime, Hash) +type FileHashCache = Map FilePath (ModTime, HashValue) -- | We declare it a cache hit if the mtime of a file is the same as before. -lookupFileHashCache :: FileHashCache -> FilePath -> ModTime -> Maybe Hash +lookupFileHashCache :: FileHashCache -> FilePath -> ModTime -> Maybe HashValue lookupFileHashCache hashcache file mtime = do (mtime', hash) <- Map.lookup file hashcache guard (mtime' == mtime) return hash -- | Either get it from the cache or go read the file -getFileHash :: FileHashCache -> FilePath -> FilePath -> ModTime -> IO Hash +getFileHash :: FileHashCache -> FilePath -> FilePath -> ModTime -> IO HashValue getFileHash hashcache relfile absfile mtime = case lookupFileHashCache hashcache relfile mtime of Just hash -> return hash - Nothing -> readFileHash absfile + Nothing -> readFileHashValue absfile -- | Build a 'FileHashCache' from the previous 'MonitorStateFileSet'. While -- in principle we could preserve the structure of the previous state, given @@ -998,7 +996,7 @@ readCacheFileHashes monitor = collectAllFileHashes singlePaths `Map.union` collectAllGlobHashes globPaths - collectAllFileHashes :: [MonitorStateFile] -> Map FilePath (ModTime, Hash) + collectAllFileHashes :: [MonitorStateFile] -> Map FilePath (ModTime, HashValue) collectAllFileHashes singlePaths = Map.fromList [ (fpath, (mtime, hash)) @@ -1010,7 +1008,7 @@ readCacheFileHashes monitor = singlePaths ] - collectAllGlobHashes :: [MonitorStateGlob] -> Map FilePath (ModTime, Hash) + collectAllGlobHashes :: [MonitorStateGlob] -> Map FilePath (ModTime, HashValue) collectAllGlobHashes globPaths = Map.fromList [ (fpath, (mtime, hash)) @@ -1018,7 +1016,7 @@ readCacheFileHashes monitor = , (fpath, (mtime, hash)) <- collectGlobHashes "" gstate ] - collectGlobHashes :: FilePath -> MonitorStateGlobRel -> [(FilePath, (ModTime, Hash))] + collectGlobHashes :: FilePath -> MonitorStateGlobRel -> [(FilePath, (ModTime, HashValue))] collectGlobHashes dir (MonitorStateGlobDirs _ _ _ entries) = [ res | (subdir, fstate) <- entries @@ -1043,13 +1041,13 @@ probeFileModificationTime root file mtime = do unless unchanged (somethingChanged file) -- | Within the @root@ directory, check if @file@ has its 'ModTime' and --- 'Hash' is the same as @mtime@ and @hash@, short-circuiting if it is +-- 'HashValue' is the same as @mtime@ and @hash@, short-circuiting if it is -- different. probeFileModificationTimeAndHash :: FilePath -> FilePath -> ModTime - -> Hash + -> HashValue -> ChangedM () probeFileModificationTimeAndHash root file mtime hash = do unchanged <- @@ -1092,12 +1090,12 @@ checkModificationTimeUnchanged root file mtime = return (mtime == mtime') -- | Returns @True@ if, inside the @root@ directory, @file@ has the --- same 'ModTime' and 'Hash' as @mtime and @chash@. +-- same 'ModTime' and 'HashValue' as @mtime and @chash@. checkFileModificationTimeAndHashUnchanged :: FilePath -> FilePath -> ModTime - -> Hash + -> HashValue -> IO Bool checkFileModificationTimeAndHashUnchanged root file mtime chash = handleIOException False $ do @@ -1105,15 +1103,9 @@ checkFileModificationTimeAndHashUnchanged root file mtime chash = if mtime == mtime' then return True else do - chash' <- readFileHash (root file) + chash' <- readFileHashValue (root file) return (chash == chash') --- | Read a non-cryptographic hash of a @file@. -readFileHash :: FilePath -> IO Hash -readFileHash file = - withBinaryFile file ReadMode $ \hnd -> - evaluate . Hashable.hash =<< BS.hGetContents hnd - -- | Given a directory @dir@, return @Nothing@ if its 'ModTime' -- is the same as @mtime@, and the new 'ModTime' if it is not. checkDirectoryModificationTime :: FilePath -> ModTime -> IO (Maybe ModTime) @@ -1127,12 +1119,9 @@ checkDirectoryModificationTime dir mtime = -- | Run an IO computation, returning the first argument @e@ if there is an 'error' -- call. ('ErrorCall') handleErrorCall :: a -> IO a -> IO a -handleErrorCall e = handle handler where -#if MIN_VERSION_base(4,9,0) - handler (ErrorCallWithLocation _ _) = return e -#else +handleErrorCall e = handle handler + where handler (ErrorCall _) = return e -#endif -- | Run an IO computation, returning @e@ if there is any 'IOException'. -- diff --git a/cabal-install/src/Distribution/Client/Freeze.hs b/cabal-install/src/Distribution/Client/Freeze.hs index 9bc4e3234b5..a03b45b6a2d 100644 --- a/cabal-install/src/Distribution/Client/Freeze.hs +++ b/cabal-install/src/Distribution/Client/Freeze.hs @@ -61,10 +61,6 @@ import Distribution.Package , packageVersion ) import Distribution.Simple.Compiler - ( Compiler - , PackageDBStack - , compilerInfo - ) import Distribution.Simple.PackageIndex (InstalledPackageIndex) import Distribution.Simple.Program ( ProgramDb @@ -98,7 +94,7 @@ import Distribution.Version -- constraining each dependency to an exact version. freeze :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Compiler -> Platform @@ -146,7 +142,7 @@ freeze -- command. getFreezePkgs :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Compiler -> Platform @@ -199,7 +195,7 @@ planPackages -> FreezeFlags -> InstalledPackageIndex -> SourcePackageDb - -> PkgConfigDb + -> Maybe PkgConfigDb -> [PackageSpecifier UnresolvedSourcePackage] -> IO [SolverPlanPackage] planPackages diff --git a/cabal-install/src/Distribution/Client/GenBounds.hs b/cabal-install/src/Distribution/Client/GenBounds.hs index ae78b50c004..2603a75d302 100644 --- a/cabal-install/src/Distribution/Client/GenBounds.hs +++ b/cabal-install/src/Distribution/Client/GenBounds.hs @@ -46,10 +46,6 @@ import Distribution.PackageDescription.Configuration ( finalizePD ) import Distribution.Simple.Compiler - ( Compiler - , PackageDBStack - , compilerInfo - ) import Distribution.Simple.PackageDescription ( readGenericPackageDescription ) @@ -67,6 +63,9 @@ import Distribution.Types.ComponentRequestedSpec ( defaultComponentRequestedSpec ) import Distribution.Types.Dependency +import Distribution.Types.DependencySatisfaction + ( DependencySatisfaction (..) + ) import Distribution.Utils.Path (relativeSymbolicPath) import Distribution.Version ( LowerBound (..) @@ -119,7 +118,7 @@ showBounds padTo p = -- | Entry point for the @gen-bounds@ command. genBounds :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Compiler -> Platform @@ -138,7 +137,7 @@ genBounds verbosity packageDBs repoCtxt comp platform progdb globalFlags freezeF finalizePD mempty defaultComponentRequestedSpec - (const True) + (const Satisfied) platform cinfo [] diff --git a/cabal-install/src/Distribution/Client/Glob.hs b/cabal-install/src/Distribution/Client/Glob.hs index 6aa2da0c29f..c94b91196fa 100644 --- a/cabal-install/src/Distribution/Client/Glob.hs +++ b/cabal-install/src/Distribution/Client/Glob.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveGeneric #-} - module Distribution.Client.Glob ( -- * cabal-install globbing features RootedGlob (..) diff --git a/cabal-install/src/Distribution/Client/HashValue.hs b/cabal-install/src/Distribution/Client/HashValue.hs index e19956b7ed3..c5698f27f1e 100644 --- a/cabal-install/src/Distribution/Client/HashValue.hs +++ b/cabal-install/src/Distribution/Client/HashValue.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} module Distribution.Client.HashValue @@ -38,7 +37,7 @@ import System.IO (IOMode (..), withBinaryFile) -- package ids. newtype HashValue = HashValue BS.ByteString - deriving (Eq, Generic, Show, Typeable) + deriving (Eq, Generic, Show) -- Cannot do any sensible validation here. Although we use SHA256 -- for stuff we hash ourselves, we can also get hashes from TUF diff --git a/cabal-install/src/Distribution/Client/HttpUtils.hs b/cabal-install/src/Distribution/Client/HttpUtils.hs index cad511ef9f8..3cdadf9304c 100644 --- a/cabal-install/src/Distribution/Client/HttpUtils.hs +++ b/cabal-install/src/Distribution/Client/HttpUtils.hs @@ -192,7 +192,7 @@ downloadURI transport verbosity uri path = do -- Only use the external http transports if we actually have to -- (or have been told to do so) let transport' - | uriScheme uri == "http:" + | isHttpURI uri , not (transportManuallySelected transport) = plainHttpTransport | otherwise = @@ -251,20 +251,35 @@ downloadURI transport verbosity uri path = do -- Utilities for repo url management -- +-- | If the remote repo is accessed over HTTPS, ensure that the transport +-- supports HTTPS. remoteRepoCheckHttps :: Verbosity -> HttpTransport -> RemoteRepo -> IO () -remoteRepoCheckHttps verbosity transport repo - | uriScheme (remoteRepoURI repo) == "https:" - , not (transportSupportsHttps transport) = - dieWithException verbosity $ RemoteRepoCheckHttps (unRepoName (remoteRepoName repo)) requiresHttpsErrorMessage - | otherwise = return () +remoteRepoCheckHttps verbosity transport repo = + transportCheckHttpsWithError verbosity transport (remoteRepoURI repo) $ + RemoteRepoCheckHttps (unRepoName (remoteRepoName repo)) requiresHttpsErrorMessage +-- | If the URI scheme is HTTPS, ensure the transport supports HTTPS. transportCheckHttps :: Verbosity -> HttpTransport -> URI -> IO () -transportCheckHttps verbosity transport uri - | uriScheme uri == "https:" +transportCheckHttps verbosity transport uri = + transportCheckHttpsWithError verbosity transport uri $ + TransportCheckHttps uri requiresHttpsErrorMessage + +-- | If the URI scheme is HTTPS, ensure the transport supports HTTPS. +-- If not, fail with the given error. +transportCheckHttpsWithError + :: Verbosity -> HttpTransport -> URI -> CabalInstallException -> IO () +transportCheckHttpsWithError verbosity transport uri err + | isHttpsURI uri , not (transportSupportsHttps transport) = - dieWithException verbosity $ TransportCheckHttps uri requiresHttpsErrorMessage + dieWithException verbosity err | otherwise = return () +isHttpsURI :: URI -> Bool +isHttpsURI uri = uriScheme uri == "https:" + +isHttpURI :: URI -> Bool +isHttpURI uri = uriScheme uri == "http:" + requiresHttpsErrorMessage :: String requiresHttpsErrorMessage = "requires HTTPS however the built-in HTTP implementation " @@ -280,12 +295,12 @@ requiresHttpsErrorMessage = remoteRepoTryUpgradeToHttps :: Verbosity -> HttpTransport -> RemoteRepo -> IO RemoteRepo remoteRepoTryUpgradeToHttps verbosity transport repo | remoteRepoShouldTryHttps repo - , uriScheme (remoteRepoURI repo) == "http:" + , isHttpURI (remoteRepoURI repo) , not (transportSupportsHttps transport) , not (transportManuallySelected transport) = dieWithException verbosity $ TryUpgradeToHttps [name | (name, _, True, _) <- supportedTransports] | remoteRepoShouldTryHttps repo - , uriScheme (remoteRepoURI repo) == "http:" + , isHttpURI (remoteRepoURI repo) , transportSupportsHttps transport = return repo @@ -452,7 +467,6 @@ curlTransport prog = where gethttp verbosity uri etag destPath reqHeaders = do withTempFile - (takeDirectory destPath) "curl-headers.txt" $ \tmpFile tmpHandle -> do hClose tmpHandle @@ -505,12 +519,18 @@ curlTransport prog = (Just (Left (uname, passwd)), _) -> Just $ Left (uname ++ ":" ++ passwd) (Nothing, Just a) -> Just $ Left a (Nothing, Nothing) -> Nothing + let authnSchemeArg + -- When using TLS, we can accept Basic authentication. Let curl + -- decide based on the scheme(s) offered by the server. + | isHttpsURI uri = "--anyauth" + -- When not using TLS, force Digest scheme + | otherwise = "--digest" case mbAuthStringToken of Just (Left up) -> progInvocation { progInvokeInput = Just . IODataText . unlines $ - [ "--digest" + [ authnSchemeArg , "--user " ++ up ] , progInvokeArgs = ["--config", "-"] ++ progInvokeArgs progInvocation @@ -654,10 +674,9 @@ wgetTransport prog = posthttpfile verbosity uri path auth = withTempFile - (takeDirectory path) (takeFileName path) $ \tmpFile tmpHandle -> - withTempFile (takeDirectory path) "response" $ + withTempFile "response" $ \responseFile responseHandle -> do hClose responseHandle (body, boundary) <- generateMultipartBody path @@ -681,7 +700,7 @@ wgetTransport prog = evaluate $ force (code, resp) puthttpfile verbosity uri path auth headers = - withTempFile (takeDirectory path) "response" $ + withTempFile "response" $ \responseFile responseHandle -> do hClose responseHandle let args = @@ -803,7 +822,6 @@ powershellTransport prog = posthttpfile verbosity uri path auth = withTempFile - (takeDirectory path) (takeFileName path) $ \tmpFile tmpHandle -> do (body, boundary) <- generateMultipartBody path diff --git a/cabal-install/src/Distribution/Client/IndexUtils.hs b/cabal-install/src/Distribution/Client/IndexUtils.hs index 5958deca553..828c6ea52c3 100644 --- a/cabal-install/src/Distribution/Client/IndexUtils.hs +++ b/cabal-install/src/Distribution/Client/IndexUtils.hs @@ -1,5 +1,6 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE CPP #-} +{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} @@ -65,6 +66,10 @@ import Distribution.Client.Types import Distribution.Parsec (simpleParsecBS) import Distribution.Verbosity +import Distribution.Client.ProjectConfig + ( CabalFileParseError + , readSourcePackageCabalFile' + ) import Distribution.Client.Setup ( RepoContext (..) ) @@ -82,9 +87,6 @@ import Distribution.PackageDescription , emptyPackageDescription ) import Distribution.Simple.Compiler - ( Compiler - , PackageDBStack - ) import qualified Distribution.Simple.Configure as Configure ( getInstalledPackages , getInstalledPackagesMonitorFiles @@ -99,6 +101,7 @@ import Distribution.Simple.Utils , fromUTF8LBS , info , warn + , warnError ) import Distribution.Types.Dependency import Distribution.Types.PackageName (PackageName) @@ -149,7 +152,7 @@ import System.FilePath , (<.>) , () ) -import qualified System.FilePath.Posix as FilePath.Posix +import qualified System.FilePath as FilePath import System.IO import System.IO.Error (isDoesNotExistError) import System.IO.Unsafe (unsafeInterleaveIO) @@ -162,11 +165,11 @@ import qualified Hackage.Security.Util.Some as Sec getInstalledPackages :: Verbosity -> Compiler - -> PackageDBStack + -> PackageDBStackCWD -> ProgramDb -> IO InstalledPackageIndex getInstalledPackages verbosity comp packageDbs progdb = - Configure.getInstalledPackages verbosity' comp Nothing packageDbs progdb + Configure.getInstalledPackages verbosity' comp Nothing (coercePackageDBStack packageDbs) progdb where verbosity' = lessVerbose verbosity @@ -459,8 +462,8 @@ readRepoIndex verbosity repoCtxt repo idxState = if isDoesNotExistError e then do case repo of - RepoRemote{..} -> dieWithException verbosity $ MissingPackageList repoRemote - RepoSecure{..} -> dieWithException verbosity $ MissingPackageList repoRemote + RepoRemote{..} -> warn verbosity $ exceptionMessageCabalInstall $ MissingPackageList repoRemote + RepoSecure{..} -> warn verbosity $ exceptionMessageCabalInstall $ MissingPackageList repoRemote RepoLocalNoIndex local _ -> warn verbosity $ "Error during construction of local+noindex " @@ -694,7 +697,7 @@ data PreferredVersionsParseError = PreferredVersionsParseError , preferredVersionsOriginalDependency :: String -- ^ Original input that produced the parser error. } - deriving (Generic, Read, Show, Eq, Ord, Typeable) + deriving (Generic, Read, Show, Eq, Ord) -- | Parse `preferred-versions` file, collecting parse errors that can be shown -- in error messages. @@ -882,14 +885,22 @@ withIndexEntries verbosity (RepoIndex _repoCtxt (RepoLocalNoIndex (LocalRepo nam where cabalPath = prettyShow pkgid ++ ".cabal" Just pkgId -> do + let tarFile = localDir file -- check for the right named .cabal file in the compressed tarball - tarGz <- BS.readFile (localDir file) + tarGz <- BS.readFile tarFile let tar = GZip.decompress tarGz entries = Tar.read tar + expectFilename = prettyShow pkgId FilePath. prettyShow (packageName pkgId) ++ ".cabal" - case Tar.foldEntries (readCabalEntry pkgId) Nothing (const Nothing) entries of + tarballPackageDescription <- + Tar.foldEntries + (readCabalEntry tarFile expectFilename) + (pure Nothing) + (handleTarFormatError tarFile) + entries + case tarballPackageDescription of Just ce -> return (Just ce) - Nothing -> dieWithException verbosity $ CannotReadCabalFile file + Nothing -> dieWithException verbosity $ CannotReadCabalFile expectFilename tarFile let (prefs, gpds) = partitionEithers $ @@ -920,16 +931,55 @@ withIndexEntries verbosity (RepoIndex _repoCtxt (RepoLocalNoIndex (LocalRepo nam stripSuffix sfx str = fmap reverse (stripPrefix (reverse sfx) (reverse str)) - -- look for /.cabal inside the tarball - readCabalEntry :: PackageIdentifier -> Tar.Entry -> Maybe NoIndexCacheEntry -> Maybe NoIndexCacheEntry - readCabalEntry pkgId entry Nothing - | filename == Tar.entryPath entry - , Tar.NormalFile contents _ <- Tar.entryContent entry = - let bs = BS.toStrict contents - in ((`CacheGPD` bs) <$> parseGenericPackageDescriptionMaybe bs) - where - filename = prettyShow pkgId FilePath.Posix. prettyShow (packageName pkgId) ++ ".cabal" - readCabalEntry _ _ x = x + handleTarFormatError :: FilePath -> Tar.FormatError -> IO (Maybe NoIndexCacheEntry) + handleTarFormatError tarFile formatError = do + -- This is printed at warning-level because malformed `.tar.gz`s in + -- indexes are unexpected and we want users to tell us about them. + warnError verbosity $ + "Failed to parse " + <> tarFile + <> ": " + <> displayException formatError + pure Nothing + + -- look for `expectFilename` inside the tarball + readCabalEntry + :: FilePath + -> FilePath + -> Tar.Entry + -> IO (Maybe NoIndexCacheEntry) + -> IO (Maybe NoIndexCacheEntry) + readCabalEntry tarFile expectFilename entry previous' = do + previous <- previous' + case previous of + Just _entry -> pure previous + Nothing -> do + if expectFilename /= Tar.entryPath entry + then pure Nothing + else case Tar.entryContent entry of + Tar.NormalFile contents _fileSize -> do + let bytes = BS.toStrict contents + maybePackageDescription + :: Either CabalFileParseError GenericPackageDescription <- + -- Warnings while parsing `.cabal` files are only shown in + -- verbose mode because people are allowed to upload packages + -- with warnings to Hackage (and we may _add_ warnings by + -- shipping new versions of Cabal). You probably don't care + -- if there's a warning in some random package in your + -- transitive dependency tree, as long as it's not causing + -- issues. If it is causing issues, you can add `-v` to see + -- the warnings! + try $ readSourcePackageCabalFile' (info verbosity) expectFilename bytes + case maybePackageDescription of + Left exception -> do + -- Here we show the _failure_ to parse the `.cabal` file as + -- a warning. This will impact which versions/packages are + -- available in your index, so users should know! + warn verbosity $ "In " <> tarFile <> ": " <> displayException exception + pure Nothing + Right genericPackageDescription -> + pure $ Just $ CacheGPD genericPackageDescription bytes + _ -> pure Nothing withIndexEntries verbosity index callback _ = do -- non-secure repositories withFile (indexFile index) ReadMode $ \h -> do diff --git a/cabal-install/src/Distribution/Client/IndexUtils/ActiveRepos.hs b/cabal-install/src/Distribution/Client/IndexUtils/ActiveRepos.hs index daa4ec86355..51079d7c347 100644 --- a/cabal-install/src/Distribution/Client/IndexUtils/ActiveRepos.hs +++ b/cabal-install/src/Distribution/Client/IndexUtils/ActiveRepos.hs @@ -168,7 +168,7 @@ organizeByRepos -> [a] -> Either String [(a, CombineStrategy)] organizeByRepos (ActiveRepos xs0) sel ys0 = - -- here we use lazyness to do only one traversal + -- here we use laziness to do only one traversal let (rest, result) = case go rest xs0 ys0 of Right (rest', result') -> (rest', Right result') Left err -> ([], Left err) diff --git a/cabal-install/src/Distribution/Client/Init.hs b/cabal-install/src/Distribution/Client/Init.hs index 1a8be086a3f..f9cd589f2a9 100644 --- a/cabal-install/src/Distribution/Client/Init.hs +++ b/cabal-install/src/Distribution/Client/Init.hs @@ -31,7 +31,7 @@ import System.IO (BufferMode (NoBuffering), hSetBuffering, stdout) -- | This is the main driver for the init script. initCmd :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Compiler -> ProgramDb @@ -41,8 +41,7 @@ initCmd v packageDBs repoCtxt comp progdb initFlags = do installedPkgIndex <- getInstalledPackages v comp packageDBs progdb sourcePkgDb <- getSourcePackages v repoCtxt hSetBuffering stdout NoBuffering - settings <- createProject v installedPkgIndex sourcePkgDb initFlags - writeProject settings + runPromptIO (writeProject =<< createProject v installedPkgIndex sourcePkgDb initFlags) where -- When no flag is set, default to interactive. -- diff --git a/cabal-install/src/Distribution/Client/Init/Defaults.hs b/cabal-install/src/Distribution/Client/Init/Defaults.hs index a915a5159d3..3852bf835bf 100644 --- a/cabal-install/src/Distribution/Client/Init/Defaults.hs +++ b/cabal-install/src/Distribution/Client/Init/Defaults.hs @@ -165,7 +165,7 @@ myLibHs = myExeHs :: [String] myExeHs = - [ "module Main where" + [ "module Main (main) where" , "" , "main :: IO ()" , "main = putStrLn \"Hello, Haskell!\"" @@ -173,7 +173,7 @@ myExeHs = myLibExeHs :: [String] myLibExeHs = - [ "module Main where" + [ "module Main (main) where" , "" , "import qualified MyLib (someFunc)" , "" diff --git a/cabal-install/src/Distribution/Client/Init/FileCreators.hs b/cabal-install/src/Distribution/Client/Init/FileCreators.hs index f53ce7a6e53..15a03c8a7d0 100644 --- a/cabal-install/src/Distribution/Client/Init/FileCreators.hs +++ b/cabal-install/src/Distribution/Client/Init/FileCreators.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} ----------------------------------------------------------------------------- diff --git a/cabal-install/src/Distribution/Client/Init/Interactive/Command.hs b/cabal-install/src/Distribution/Client/Init/Interactive/Command.hs index 48209d37067..82064d8fbc1 100644 --- a/cabal-install/src/Distribution/Client/Init/Interactive/Command.hs +++ b/cabal-install/src/Distribution/Client/Init/Interactive/Command.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiWayIf #-} ----------------------------------------------------------------------------- @@ -460,14 +459,18 @@ languagePrompt flags pkgType = getLanguage flags $ do ghc2021 = "GHC2021 (requires at least GHC 9.2)" ghc2024 = "GHC2024 (requires at least GHC 9.10)" + lastChosenLanguage <- getLastChosenLanguage + l <- promptList ("Choose a language for your " ++ pkgType) [h2010, h98, ghc2021, ghc2024] - (DefaultPrompt h2010) + (DefaultPrompt (maybe h2010 id lastChosenLanguage)) Nothing True + setLastChosenLanguage (Just l) + if | l == h2010 -> return Haskell2010 | l == h98 -> return Haskell98 diff --git a/cabal-install/src/Distribution/Client/Init/NonInteractive/Command.hs b/cabal-install/src/Distribution/Client/Init/NonInteractive/Command.hs index 7eee9f82f7a..f4b95381454 100644 --- a/cabal-install/src/Distribution/Client/Init/NonInteractive/Command.hs +++ b/cabal-install/src/Distribution/Client/Init/NonInteractive/Command.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE LambdaCase #-} - module Distribution.Client.Init.NonInteractive.Command ( genPkgDescription , genLibTarget diff --git a/cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs b/cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs index 138f9684553..e6838aa2e45 100644 --- a/cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs +++ b/cabal-install/src/Distribution/Client/Init/NonInteractive/Heuristics.hs @@ -165,14 +165,14 @@ guessAuthorEmail = guessGitInfo "user.email" guessGitInfo :: Interactive m => String -> m (Maybe String) guessGitInfo target = do - localInfo <- readProcessWithExitCode "git" ["config", "--local", target] "" - if null $ snd' localInfo - then do - globalInfo <- readProcessWithExitCode "git" ["config", "--global", target] "" - case fst' globalInfo of - ExitSuccess -> return $ Just (trim $ snd' globalInfo) - _ -> return Nothing - else return $ Just (trim $ snd' localInfo) - where - fst' (x, _, _) = x - snd' (_, x, _) = x + localInfo <- maybeReadProcessWithExitCode "git" ["config", "--local", target] "" + case localInfo of + Nothing -> return Nothing + Just (_, localStdout, _) -> + if null localStdout + then do + globalInfo <- maybeReadProcessWithExitCode "git" ["config", "--global", target] "" + case globalInfo of + Just (ExitSuccess, globalStdout, _) -> return $ Just (trim globalStdout) + _ -> return Nothing + else return $ Just (trim localStdout) diff --git a/cabal-install/src/Distribution/Client/Init/Types.hs b/cabal-install/src/Distribution/Client/Init/Types.hs index ee7d7cbe0c3..8da7ba2b52b 100644 --- a/cabal-install/src/Distribution/Client/Init/Types.hs +++ b/cabal-install/src/Distribution/Client/Init/Types.hs @@ -1,7 +1,9 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE LambdaCase #-} +{-# LANGUAGE TypeApplications #-} -- | -- Module : Distribution.Client.Init.Types @@ -39,7 +41,11 @@ module Distribution.Client.Init.Types -- * Typeclasses , Interactive (..) , BreakException (..) - , PurePrompt (..) + , PromptIO + , runPromptIO + , Inputs + , PurePrompt + , runPrompt , evalPrompt , Severity (..) @@ -63,9 +69,12 @@ import qualified Distribution.Client.Compat.Prelude as P import Prelude (read) import Control.Monad.Catch +import Control.Monad.IO.Class +import Control.Monad.Reader import Data.List.NonEmpty (fromList) +import qualified Data.IORef import Distribution.CabalSpecVersion import Distribution.Client.Utils as P import Distribution.Fields.Pretty @@ -282,15 +291,33 @@ mkLiterate _ hs = hs -- -------------------------------------------------------------------- -- -- Interactive prompt monad +newtype PromptIO a = PromptIO (ReaderT (Data.IORef.IORef SessionState) IO a) + deriving (Functor, Applicative, Monad, MonadIO) + +sessionState :: PromptIO (Data.IORef.IORef SessionState) +sessionState = PromptIO ask + +runPromptIO :: PromptIO a -> IO a +runPromptIO (PromptIO pio) = + (Data.IORef.newIORef newSessionState) >>= (runReaderT pio) + +type Inputs = NonEmpty String + newtype PurePrompt a = PurePrompt - { _runPrompt - :: NonEmpty String - -> Either BreakException (a, NonEmpty String) + { runPromptState + :: (Inputs, SessionState) + -> Either BreakException (a, (Inputs, SessionState)) } deriving (Functor) -evalPrompt :: PurePrompt a -> NonEmpty String -> a -evalPrompt act s = case _runPrompt act s of +runPrompt :: PurePrompt a -> Inputs -> Either BreakException (a, Inputs) +runPrompt act args = + fmap + (\(a, (s, _)) -> (a, s)) + (runPromptState act (args, newSessionState)) + +evalPrompt :: PurePrompt a -> Inputs -> a +evalPrompt act s = case runPrompt act s of Left e -> error $ show e Right (a, _) -> a @@ -306,7 +333,7 @@ instance Monad PurePrompt where return = pure PurePrompt a >>= k = PurePrompt $ \s -> case a s of Left e -> Left e - Right (a', s') -> _runPrompt (k a') s' + Right (a', s') -> runPromptState (k a') s' class Monad m => Interactive m where -- input functions @@ -320,6 +347,7 @@ class Monad m => Interactive m where doesFileExist :: FilePath -> m Bool canonicalizePathNoThrow :: FilePath -> m FilePath readProcessWithExitCode :: FilePath -> [String] -> String -> m (ExitCode, String, String) + maybeReadProcessWithExitCode :: FilePath -> [String] -> String -> m (Maybe (ExitCode, String, String)) getEnvironment :: m [(String, String)] getCurrentYear :: m Integer listFilesInside :: (FilePath -> m Bool) -> FilePath -> m [FilePath] @@ -341,36 +369,62 @@ class Monad m => Interactive m where break :: m Bool throwPrompt :: BreakException -> m a -instance Interactive IO where - getLine = P.getLine - readFile = P.readFile - getCurrentDirectory = P.getCurrentDirectory - getHomeDirectory = P.getHomeDirectory - getDirectoryContents = P.getDirectoryContents - listDirectory = P.listDirectory - doesDirectoryExist = P.doesDirectoryExist - doesFileExist = P.doesFileExist - canonicalizePathNoThrow = P.canonicalizePathNoThrow - readProcessWithExitCode = Process.readProcessWithExitCode - getEnvironment = P.getEnvironment - getCurrentYear = P.getCurrentYear - listFilesInside = P.listFilesInside - listFilesRecursive = P.listFilesRecursive - - putStr = P.putStr - putStrLn = P.putStrLn - createDirectory = P.createDirectory - removeDirectory = P.removeDirectoryRecursive - writeFile = P.writeFile - removeExistingFile = P.removeExistingFile - copyFile = P.copyFile - renameDirectory = P.renameDirectory - hFlush = System.IO.hFlush + -- session state functions + getLastChosenLanguage :: m (Maybe String) + setLastChosenLanguage :: (Maybe String) -> m () + +newtype SessionState = SessionState + { lastChosenLanguage :: (Maybe String) + } + +newSessionState :: SessionState +newSessionState = SessionState{lastChosenLanguage = Nothing} + +instance Interactive PromptIO where + getLine = liftIO P.getLine + readFile = liftIO <$> P.readFile + getCurrentDirectory = liftIO P.getCurrentDirectory + getHomeDirectory = liftIO P.getHomeDirectory + getDirectoryContents = liftIO <$> P.getDirectoryContents + listDirectory = liftIO <$> P.listDirectory + doesDirectoryExist = liftIO <$> P.doesDirectoryExist + doesFileExist = liftIO <$> P.doesFileExist + canonicalizePathNoThrow = liftIO <$> P.canonicalizePathNoThrow + readProcessWithExitCode a b c = liftIO $ Process.readProcessWithExitCode a b c + maybeReadProcessWithExitCode a b c = liftIO $ (Just <$> Process.readProcessWithExitCode a b c) `P.catch` const @_ @IOError (pure Nothing) + getEnvironment = liftIO P.getEnvironment + getCurrentYear = liftIO P.getCurrentYear + listFilesInside test dir = do + -- test is run within a new env and not the current env + -- all usages of listFilesInside are pure functions actually + liftIO $ P.listFilesInside (\f -> liftIO $ runPromptIO (test f)) dir + listFilesRecursive = liftIO <$> P.listFilesRecursive + + putStr = liftIO <$> P.putStr + putStrLn = liftIO <$> P.putStrLn + createDirectory = liftIO <$> P.createDirectory + removeDirectory = liftIO <$> P.removeDirectoryRecursive + writeFile a b = liftIO $ P.writeFile a b + removeExistingFile = liftIO <$> P.removeExistingFile + copyFile a b = liftIO $ P.copyFile a b + renameDirectory a b = liftIO $ P.renameDirectory a b + hFlush = liftIO <$> System.IO.hFlush message q severity msg | q == silent = pure () | otherwise = putStrLn $ "[" ++ displaySeverity severity ++ "] " ++ msg break = return False - throwPrompt = throwM + throwPrompt = liftIO <$> throwM + + getLastChosenLanguage = do + stateRef <- sessionState + liftIO $ lastChosenLanguage <$> Data.IORef.readIORef stateRef + + setLastChosenLanguage value = do + stateRef <- sessionState + liftIO $ + Data.IORef.modifyIORef + stateRef + (\state -> state{lastChosenLanguage = value}) instance Interactive PurePrompt where getLine = pop @@ -387,6 +441,7 @@ instance Interactive PurePrompt where readProcessWithExitCode !_ !_ !_ = do input <- pop return (ExitSuccess, input, "") + maybeReadProcessWithExitCode a b c = Just <$> readProcessWithExitCode a b c getEnvironment = fmap (map read) popList getCurrentYear = fmap read pop listFilesInside pred' !_ = do @@ -411,13 +466,18 @@ instance Interactive PurePrompt where _ -> return () break = return True - throwPrompt (BreakException e) = PurePrompt $ \s -> + throwPrompt (BreakException e) = PurePrompt $ \(i, _) -> Left $ BreakException - ("Error: " ++ e ++ "\nStacktrace: " ++ show s) + ("Error: " ++ e ++ "\nStacktrace: " ++ show i) + + getLastChosenLanguage = PurePrompt $ \(i, s) -> + Right (lastChosenLanguage s, (i, s)) + setLastChosenLanguage l = PurePrompt $ \(i, s) -> + Right ((), (i, s{lastChosenLanguage = l})) pop :: PurePrompt String -pop = PurePrompt $ \(p :| ps) -> Right (p, fromList ps) +pop = PurePrompt $ \(i :| is, s) -> Right (i, (fromList is, s)) popAbsolute :: PurePrompt String popAbsolute = do @@ -429,7 +489,7 @@ popBool = pop >>= \case "True" -> pure True "False" -> pure False - s -> throwPrompt $ BreakException $ "popBool: " ++ s + i -> throwPrompt $ BreakException $ "popBool: " ++ i popList :: PurePrompt [String] popList = diff --git a/cabal-install/src/Distribution/Client/Install.hs b/cabal-install/src/Distribution/Client/Install.hs index a31e4d2ce62..635cd7e1689 100644 --- a/cabal-install/src/Distribution/Client/Install.hs +++ b/cabal-install/src/Distribution/Client/Install.hs @@ -57,7 +57,6 @@ import System.FilePath ( equalFilePath , takeDirectory , (<.>) - , () ) import System.IO ( IOMode (AppendMode) @@ -143,6 +142,7 @@ import Distribution.Solver.Types.PkgConfigDb import Distribution.Solver.Types.Settings import Distribution.Solver.Types.SourcePackage as SourcePackage +import Distribution.Client.ProjectConfig import Distribution.Client.Utils ( MergeResult (..) , ProgressPhase (..) @@ -174,8 +174,9 @@ import Distribution.Simple.Compiler ( Compiler (compilerId) , CompilerId (..) , CompilerInfo (..) - , PackageDB (..) - , PackageDBStack + , PackageDBCWD + , PackageDBStackCWD + , PackageDBX (..) , compilerFlavor , compilerInfo ) @@ -222,7 +223,6 @@ import Distribution.Simple.Setup import qualified Distribution.Simple.Setup as Cabal import Distribution.Utils.Path hiding ( (<.>) - , () ) import Distribution.Simple.Utils @@ -245,6 +245,9 @@ import Distribution.System , buildOS , buildPlatform ) +import Distribution.Types.DependencySatisfaction + ( DependencySatisfaction (..) + ) import Distribution.Types.Flag ( FlagAssignment , PackageFlag (..) @@ -301,7 +304,7 @@ import Distribution.Client.Errors -- | Installs the packages needed to satisfy a list of dependencies. install :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Compiler -> Platform @@ -381,7 +384,7 @@ install type InstallContext = ( InstalledPackageIndex , SourcePackageDb - , PkgConfigDb + , Maybe PkgConfigDb , [UserTarget] , [PackageSpecifier UnresolvedSourcePackage] , HttpTransport @@ -392,7 +395,7 @@ type InstallContext = -- | Initial arguments given to 'install' or 'makeInstallContext'. type InstallArgs = - ( PackageDBStack + ( PackageDBStackCWD , RepoContext , Compiler , Platform @@ -567,7 +570,7 @@ planPackages -> InstallFlags -> InstalledPackageIndex -> SourcePackageDb - -> PkgConfigDb + -> Maybe PkgConfigDb -> [PackageSpecifier UnresolvedSourcePackage] -> Progress String String SolverInstallPlan planPackages @@ -1225,7 +1228,7 @@ storeDetailedBuildReports verbosity logsDir reports = regenerateHaddockIndex :: Verbosity - -> [PackageDB] + -> [PackageDBCWD] -> Compiler -> Platform -> ProgramDb @@ -1441,7 +1444,7 @@ performInstallations if parallelInstall then newParallelJobControl numJobs else newSerialJobControl - fetchLimit <- newJobLimit (min numJobs numFetchJobs) + fetchLimit <- newJobLimit (min numJobs maxNumFetchJobs) installLock <- newLock -- serialise installation cacheLock <- newLock -- serialise access to setup exe cache executeInstallPlan @@ -1484,7 +1487,6 @@ performInstallations cinfo = compilerInfo comp numJobs = determineNumJobs (installNumJobs installFlags) - numFetchJobs = 2 parallelInstall = numJobs >= 2 keepGoing = fromFlag (installKeepGoing installFlags) distPref = @@ -1677,7 +1679,7 @@ installReadyPackage pkg = case finalizePD flags (enableStanzas stanzas) - (const True) + (const Satisfied) platform cinfo [] @@ -1914,19 +1916,19 @@ installUnpackedPackage -- Configure phase onFailure ConfigureFailed $ do noticeProgress ProgressStarting - setup configureCommand configCommonFlags configureFlags mLogPath + setup configureCommand configCommonFlags (return . configureFlags) mLogPath -- Build phase onFailure BuildFailed $ do noticeProgress ProgressBuilding - setup buildCommand' buildCommonFlags buildFlags mLogPath + setup buildCommand' buildCommonFlags (return . buildFlags) mLogPath -- Doc generation phase docsResult <- if shouldHaddock then ( do - setup haddockCommand haddockCommonFlags haddockFlags' mLogPath + setup haddockCommand haddockCommonFlags (return . haddockFlags') mLogPath return DocsOk ) `catchIO` (\_ -> return DocsFailed) @@ -1936,7 +1938,7 @@ installUnpackedPackage -- Tests phase onFailure TestsFailed $ do when (testsEnabled && PackageDescription.hasTests pkg) $ - setup Cabal.testCommand testCommonFlags testFlags' mLogPath + setup Cabal.testCommand testCommonFlags (return . testFlags') mLogPath let testsResult | testsEnabled = TestsOk @@ -1953,7 +1955,7 @@ installUnpackedPackage platform pkg $ do - setup Cabal.copyCommand copyCommonFlags copyFlags mLogPath + setup Cabal.copyCommand copyCommonFlags (return . copyFlags) mLogPath -- Capture installed package configuration file, so that -- it can be incorporated into the final InstallPlan @@ -2021,7 +2023,7 @@ installUnpackedPackage genPkgConfs flags mLogPath = do tmp <- getTemporaryDirectory withTempDirectory verbosity tmp (tempTemplate "pkgConf") $ \dir -> do - let pkgConfDest = dir "pkgConf" + let pkgConfDest = makeSymbolicPath dir makeRelativePathEx "pkgConf" registerFlags' version = (flags version) { Cabal.regGenPkgConf = toFlag (Just pkgConfDest) @@ -2029,18 +2031,18 @@ installUnpackedPackage setup Cabal.registerCommand registerCommonFlags - registerFlags' + (return . registerFlags') mLogPath - is_dir <- doesDirectoryExist pkgConfDest + is_dir <- doesDirectoryExist (interpretSymbolicPathCWD pkgConfDest) let notHidden = not . isHidden isHidden name = "." `isPrefixOf` name if is_dir then -- Sort so that each prefix of the package -- configurations is well formed - traverse (readPkgConf pkgConfDest) . sort . filter notHidden - =<< getDirectoryContents pkgConfDest - else fmap (: []) $ readPkgConf "." pkgConfDest + traverse (readPkgConf (getSymbolicPath pkgConfDest)) . sort . filter notHidden + =<< getDirectoryContents (getSymbolicPath pkgConfDest) + else fmap (: []) $ readPkgConf "." (getSymbolicPath pkgConfDest) readPkgConf :: FilePath diff --git a/cabal-install/src/Distribution/Client/InstallPlan.hs b/cabal-install/src/Distribution/Client/InstallPlan.hs index 46212baaccc..df719fa5926 100644 --- a/cabal-install/src/Distribution/Client/InstallPlan.hs +++ b/cabal-install/src/Distribution/Client/InstallPlan.hs @@ -1,6 +1,5 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE ConstraintKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -258,7 +257,6 @@ data GenericInstallPlan ipkg srcpkg = GenericInstallPlan { planGraph :: !(Graph (GenericPlanPackage ipkg srcpkg)) , planIndepGoals :: !IndependentGoals } - deriving (Typeable) -- | 'GenericInstallPlan' specialised to most commonly used types. type InstallPlan = diff --git a/cabal-install/src/Distribution/Client/InstallSymlink.hs b/cabal-install/src/Distribution/Client/InstallSymlink.hs index 1701aa1f652..1a2c1639bd6 100644 --- a/cabal-install/src/Distribution/Client/InstallSymlink.hs +++ b/cabal-install/src/Distribution/Client/InstallSymlink.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-} @@ -74,6 +73,9 @@ import Distribution.Simple.Utils (info, withTempDirectory) import Distribution.System ( Platform ) +import Distribution.Types.DependencySatisfaction + ( DependencySatisfaction (..) + ) import Distribution.Types.UnqualComponentName import System.Directory @@ -99,7 +101,7 @@ import System.IO.Error import Distribution.Client.Compat.Directory (createFileLink, getSymbolicLinkTarget, pathIsSymbolicLink) import Distribution.Client.Init.Prompt (promptYesNo) -import Distribution.Client.Init.Types (DefaultPrompt (MandatoryPrompt)) +import Distribution.Client.Init.Types (DefaultPrompt (MandatoryPrompt), runPromptIO) import Distribution.Client.Types.OverwritePolicy import qualified Data.ByteString as BS @@ -205,7 +207,7 @@ symlinkBinaries case finalizePD flags (enableStanzas stanzas) - (const True) + (const Satisfied) platform cinfo [] @@ -336,7 +338,7 @@ symlinkBinary inputs@Symlink{publicBindir, privateBindir, publicName, privateNam promptRun :: String -> IO Bool -> IO Bool promptRun s m = do - a <- promptYesNo s MandatoryPrompt + a <- runPromptIO $ promptYesNo s MandatoryPrompt if a then m else pure a -- | Check a file path of a symlink that we would like to create to see if it diff --git a/cabal-install/src/Distribution/Client/JobControl.hs b/cabal-install/src/Distribution/Client/JobControl.hs index ec148478512..0d8fa0acf36 100644 --- a/cabal-install/src/Distribution/Client/JobControl.hs +++ b/cabal-install/src/Distribution/Client/JobControl.hs @@ -31,6 +31,11 @@ module Distribution.Client.JobControl , Lock , newLock , criticalSection + + -- * Higher level utils + , newJobControlFromParStrat + , withJobControl + , mapConcurrentWithJobs ) where import Distribution.Client.Compat.Prelude @@ -40,12 +45,14 @@ import Control.Concurrent (forkIO, forkIOWithUnmask, threadDelay) import Control.Concurrent.MVar import Control.Concurrent.STM (STM, TVar, atomically, modifyTVar', newTVarIO, readTVar) import Control.Concurrent.STM.TChan -import Control.Exception (bracket_, mask_, try) +import Control.Exception (bracket, bracket_, mask_, try) import Control.Monad (forever, replicateM_) import Distribution.Client.Compat.Semaphore +import Distribution.Client.Utils (numberOfProcessors) import Distribution.Compat.Stack +import Distribution.Simple.Compiler import Distribution.Simple.Utils -import Distribution.Verbosity +import Distribution.Types.ParStrat import System.Semaphore -- | A simple concurrency abstraction. Jobs can be spawned and can complete @@ -167,17 +174,17 @@ readAllTChan qvar = go [] Nothing -> return (reverse xs) Just x -> go (x : xs) --- | Make a 'JobControl' where the parallism is controlled by a semaphore. +-- | Make a 'JobControl' where the parallelism is controlled by a semaphore. -- -- This uses the GHC -jsem option to allow GHC to take additional semaphore slots -- if we are not using them all. -newSemaphoreJobControl :: WithCallStack (Int -> IO (JobControl IO a)) -newSemaphoreJobControl n +newSemaphoreJobControl :: WithCallStack (Verbosity -> Int -> IO (JobControl IO a)) +newSemaphoreJobControl _ n | n < 1 || n > 1000 = error $ "newParallelJobControl: not a sensible number of jobs: " ++ show n -newSemaphoreJobControl maxJobLimit = do +newSemaphoreJobControl verbosity maxJobLimit = do sem <- freshSemaphore "cabal_semaphore" maxJobLimit - notice normal $ + notice verbosity $ "Created semaphore called " ++ getSemaphoreName (semaphoreName sem) ++ " with " @@ -263,3 +270,38 @@ newLock = fmap Lock $ newMVar () criticalSection :: Lock -> IO a -> IO a criticalSection (Lock lck) act = bracket_ (takeMVar lck) (putMVar lck ()) act + +-------------------------------------------------------------------------------- +-- More high level utils +-------------------------------------------------------------------------------- + +newJobControlFromParStrat + :: Verbosity + -> Compiler + -> ParStratInstall + -- ^ The parallel strategy + -> Maybe Int + -- ^ A cap on the number of jobs (e.g. to force a maximum of 2 concurrent downloads despite a -j8 parallel strategy) + -> IO (JobControl IO a) +newJobControlFromParStrat verbosity compiler parStrat numJobsCap = case parStrat of + Serial -> newSerialJobControl + NumJobs n -> newParallelJobControl (capJobs (fromMaybe numberOfProcessors n)) + UseSem n -> + if jsemSupported compiler + then newSemaphoreJobControl verbosity (capJobs n) + else do + warn verbosity "-jsem is not supported by the selected compiler, falling back to normal parallelism control." + newParallelJobControl (capJobs n) + where + capJobs n = min (fromMaybe maxBound numJobsCap) n + +withJobControl :: IO (JobControl IO a) -> (JobControl IO a -> IO b) -> IO b +withJobControl mkJC = bracket mkJC cleanupJobControl + +-- | Concurrently execute actions on a list using the given JobControl. +-- The maximum number of concurrent jobs is tied to the JobControl instance. +-- The resulting list does /not/ preserve the original order! +mapConcurrentWithJobs :: JobControl IO b -> (a -> IO b) -> [a] -> IO [b] +mapConcurrentWithJobs jobControl f xs = do + traverse_ (spawnJob jobControl . f) xs + traverse (const $ collectJob jobControl) xs diff --git a/cabal-install/src/Distribution/Client/List.hs b/cabal-install/src/Distribution/Client/List.hs index b03211038de..480e2c46fd7 100644 --- a/cabal-install/src/Distribution/Client/List.hs +++ b/cabal-install/src/Distribution/Client/List.hs @@ -43,9 +43,6 @@ import Distribution.Types.Dependency import Distribution.Types.UnqualComponentName import Distribution.Simple.Compiler - ( Compiler - , PackageDBStack - ) import Distribution.Simple.PackageIndex (InstalledPackageIndex) import qualified Distribution.Simple.PackageIndex as InstalledPackageIndex import Distribution.Simple.Program (ProgramDb) @@ -141,7 +138,7 @@ import qualified Text.Regex.Posix.String as Regex -- | Return a list of packages matching given search strings. getPkgList :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Maybe (Compiler, ProgramDb) -> ListFlags @@ -213,7 +210,7 @@ getPkgList verbosity packageDBs repoCtxt mcompprogdb listFlags pats = do -- | Show information about packages. list :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Maybe (Compiler, ProgramDb) -> ListFlags @@ -249,7 +246,7 @@ list verbosity packageDBs repos mcompProgdb listFlags pats = do info :: Verbosity - -> PackageDBStack + -> PackageDBStackCWD -> RepoContext -> Compiler -> ProgramDb diff --git a/cabal-install/src/Distribution/Client/Main.hs b/cabal-install/src/Distribution/Client/Main.hs index de14fc129c9..2f191676c65 100644 --- a/cabal-install/src/Distribution/Client/Main.hs +++ b/cabal-install/src/Distribution/Client/Main.hs @@ -173,7 +173,8 @@ import Distribution.Client.Utils , relaxEncodingErrors ) import Distribution.Client.Version - ( cabalInstallVersion + ( cabalInstallGitInfo + , cabalInstallVersion ) import Distribution.Package (packageId) @@ -206,7 +207,7 @@ import Distribution.Simple.Command , defaultCommandFallback , hiddenCommand ) -import Distribution.Simple.Compiler (PackageDBStack) +import Distribution.Simple.Compiler (PackageDBStack, interpretPackageDBStack) import Distribution.Simple.Configure ( ConfigStateFileError (..) , configCompilerAuxEx @@ -227,7 +228,8 @@ import Distribution.Simple.Program import Distribution.Simple.Program.Db (reconfigurePrograms) import qualified Distribution.Simple.Setup as Cabal import Distribution.Simple.Utils - ( cabalVersion + ( cabalGitInfo + , cabalVersion , createDirectoryIfMissingVerbose , dieNoVerbosity , dieWithException @@ -236,6 +238,7 @@ import Distribution.Simple.Utils , notice , topHandler , tryFindPackageDesc + , warn ) import Distribution.Text ( display @@ -275,7 +278,7 @@ import System.IO , stderr , stdout ) -import System.Process (createProcess, env, proc) +import System.Process (createProcess, env, proc, waitForProcess) -- | Entry point -- @@ -383,7 +386,7 @@ mainWorker args = do result <- try $ createProcess ((proc exec (name : cmdArgs)){env = Just new_env}) case result of Left ex -> printErrors ["Error executing external command: " ++ show (ex :: SomeException)] - Right _ -> return () + Right (_, _, _, ph) -> waitForProcess ph >>= exitWith printCommandHelp help = do pname <- getProgName @@ -413,9 +416,16 @@ mainWorker args = do putStrLn $ "cabal-install version " ++ display cabalInstallVersion + ++ " " + ++ cabalInstallGitInfo ++ "\ncompiled using version " ++ display cabalVersion ++ " of the Cabal library " + ++ cabalGitInfo' + where + cabalGitInfo' + | cabalGitInfo == cabalInstallGitInfo = "(in-tree)" + | otherwise = cabalGitInfo commands = map commandFromSpec commandSpecs commandSpecs = @@ -527,7 +537,7 @@ wrapperAction command getCommonFlags = Nothing command getCommonFlags - (const flags) + (const (return flags)) (const extraArgs) configureAction @@ -560,7 +570,7 @@ configureAction (configFlags, configExFlags) extraArgs globalFlags = do withRepoContext verbosity globalFlags' $ \repoContext -> configure verbosity - packageDBs + (interpretPackageDBStack Nothing packageDBs) repoContext comp platform @@ -636,7 +646,7 @@ build verbosity config distPref buildFlags extraArgs = Nothing (Cabal.buildCommand progDb) buildCommonFlags - mkBuildFlags + (return . mkBuildFlags) (const extraArgs) where progDb = defaultProgramDb @@ -729,7 +739,7 @@ replAction replFlags extraArgs globalFlags = do Nothing (Cabal.replCommand progDb) Cabal.replCommonFlags - (const replFlags') + (const (return replFlags')) (const extraArgs) -- No .cabal file in the current directory: just start the REPL (possibly @@ -776,7 +786,7 @@ installAction (configFlags, _, installFlags, _, _, _) _ globalFlags Nothing installCommand (const common) - (const (mempty, mempty, mempty, mempty, mempty, mempty)) + (const (return (mempty, mempty, mempty, mempty, mempty, mempty))) (const []) installAction ( configFlags @@ -853,7 +863,7 @@ installAction withRepoContext verb globalFlags' $ \repoContext -> install verb - (configPackageDB' configFlags') + (interpretPackageDBStack Nothing (configPackageDB' configFlags')) repoContext comp platform @@ -943,7 +953,7 @@ testAction (buildFlags, testFlags) extraArgs globalFlags = do Nothing Cabal.testCommand Cabal.testCommonFlags - (const testFlags') + (const (return testFlags')) (const extraArgs') data ComponentNames @@ -1064,7 +1074,7 @@ benchmarkAction Nothing Cabal.benchmarkCommand Cabal.benchmarkCommonFlags - (const benchmarkFlags') + (const (return benchmarkFlags')) (const extraArgs') haddockAction :: HaddockFlags -> [String] -> Action @@ -1104,7 +1114,7 @@ haddockAction haddockFlags extraArgs globalFlags = do Nothing haddockCommand haddockCommonFlags - (const haddockFlags') + (const (return haddockFlags')) (const extraArgs) when (haddockForHackage haddockFlags == Flag ForHackage) $ do pkg <- fmap LBI.localPkgDescr (getPersistBuildConfig mbWorkDir distPref) @@ -1139,7 +1149,7 @@ cleanAction cleanFlags extraArgs globalFlags = do Nothing cleanCommand cleanCommonFlags - (const cleanFlags') + (const (return cleanFlags')) (const extraArgs) listAction :: ListFlags -> [String] -> Action @@ -1164,7 +1174,7 @@ listAction listFlags extraArgs globalFlags = do withRepoContext verbosity globalFlags' $ \repoContext -> List.list verbosity - (configPackageDB' configFlags) + (interpretPackageDBStack Nothing (configPackageDB' configFlags)) repoContext compProgdb listFlags @@ -1187,7 +1197,7 @@ infoAction infoFlags extraArgs globalFlags = do withRepoContext verbosity globalFlags' $ \repoContext -> List.info verbosity - (configPackageDB' configFlags) + (interpretPackageDBStack Nothing (configPackageDB' configFlags)) repoContext comp progdb @@ -1206,7 +1216,7 @@ fetchAction fetchFlags extraArgs globalFlags = do withRepoContext verbosity globalFlags' $ \repoContext -> fetch verbosity - (configPackageDB' configFlags) + (interpretPackageDBStack Nothing (configPackageDB' configFlags)) repoContext comp platform @@ -1228,7 +1238,7 @@ freezeAction freezeFlags _extraArgs globalFlags = do withRepoContext verbosity globalFlags' $ \repoContext -> freeze verbosity - (configPackageDB' configFlags) + (interpretPackageDBStack Nothing (configPackageDB' configFlags)) repoContext comp platform @@ -1249,7 +1259,7 @@ genBoundsAction freezeFlags _extraArgs globalFlags = do withRepoContext verbosity globalFlags' $ \repoContext -> genBounds verbosity - (configPackageDB' configFlags) + (interpretPackageDBStack Nothing (configPackageDB' configFlags)) repoContext comp platform @@ -1343,6 +1353,7 @@ checkAction checkFlags extraArgs _globalFlags = do formatAction :: Flag Verbosity -> [String] -> Action formatAction verbosityFlag extraArgs _globalFlags = do let verbosity = fromFlag verbosityFlag + warn verbosity "This command is not a full formatter yet" path <- case extraArgs of [] -> relativeSymbolicPath <$> tryFindPackageDesc verbosity Nothing (p : _) -> return $ makeSymbolicPath p @@ -1433,7 +1444,7 @@ initAction initFlags extraArgs globalFlags = do withRepoContext verbosity globalFlags' $ \repoContext -> initCmd verbosity - (configPackageDB' confFlags') + (interpretPackageDBStack Nothing (configPackageDB' confFlags')) repoContext comp progdb @@ -1470,8 +1481,8 @@ actAsSetupAction actAsSetupFlags args _globalFlags = in case bt of Simple -> Simple.defaultMainArgs args Configure -> - Simple.defaultMainWithHooksArgs - Simple.autoconfUserHooks + Simple.defaultMainWithSetupHooksArgs + Simple.autoconfSetupHooks args Make -> Make.defaultMainArgs args Hooks -> error "actAsSetupAction Hooks" diff --git a/cabal-install/src/Distribution/Client/ManpageFlags.hs b/cabal-install/src/Distribution/Client/ManpageFlags.hs index ba76e314af2..59221252a17 100644 --- a/cabal-install/src/Distribution/Client/ManpageFlags.hs +++ b/cabal-install/src/Distribution/Client/ManpageFlags.hs @@ -1,5 +1,4 @@ {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE LambdaCase #-} module Distribution.Client.ManpageFlags ( ManpageFlags (..) diff --git a/cabal-install/src/Distribution/Client/Nix.hs b/cabal-install/src/Distribution/Client/Nix.hs index 0a8d6a5c195..67282640b96 100644 --- a/cabal-install/src/Distribution/Client/Nix.hs +++ b/cabal-install/src/Distribution/Client/Nix.hs @@ -1,5 +1,4 @@ {-# LANGUAGE LambdaCase #-} -{-# LANGUAGE ViewPatterns #-} module Distribution.Client.Nix ( findNixExpr diff --git a/cabal-install/src/Distribution/Client/NixStyleOptions.hs b/cabal-install/src/Distribution/Client/NixStyleOptions.hs index ff2a010ba1a..d661948b5b7 100644 --- a/cabal-install/src/Distribution/Client/NixStyleOptions.hs +++ b/cabal-install/src/Distribution/Client/NixStyleOptions.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE StandaloneDeriving #-} - -- | Command line options for nix-style / v2 commands. -- -- The commands take a lot of the same options, which affect how install plan diff --git a/cabal-install/src/Distribution/Client/PackageHash.hs b/cabal-install/src/Distribution/Client/PackageHash.hs index f5387a37bd8..e8975b0fc57 100644 --- a/cabal-install/src/Distribution/Client/PackageHash.hs +++ b/cabal-install/src/Distribution/Client/PackageHash.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-} @@ -44,7 +42,7 @@ import Distribution.Simple.Compiler , CompilerId , DebugInfoLevel (..) , OptimisationLevel (..) - , PackageDB + , PackageDBCWD , ProfDetailLevel (..) , showProfDetailLevel ) @@ -221,7 +219,7 @@ data PackageHashConfigInputs = PackageHashConfigInputs , pkgHashExtraIncludeDirs :: [FilePath] , pkgHashProgPrefix :: Maybe PathTemplate , pkgHashProgSuffix :: Maybe PathTemplate - , pkgHashPackageDbs :: [Maybe PackageDB] + , pkgHashPackageDbs :: [Maybe PackageDBCWD] , -- Haddock options pkgHashDocumentation :: Bool , pkgHashHaddockHoogle :: Bool @@ -238,8 +236,9 @@ data PackageHashConfigInputs = PackageHashConfigInputs , pkgHashHaddockContents :: Maybe PathTemplate , pkgHashHaddockIndex :: Maybe PathTemplate , pkgHashHaddockBaseUrl :: Maybe String - , pkgHashHaddockLib :: Maybe String + , pkgHashHaddockResourcesDir :: Maybe String , pkgHashHaddockOutputDir :: Maybe FilePath + , pkgHashHaddockUseUnicode :: Bool -- TODO: [required eventually] pkgHashToolsVersions ? -- TODO: [required eventually] pkgHashToolsExtraOptions ? } @@ -347,8 +346,9 @@ renderPackageHashInputs , opt "haddock-contents-location" Nothing (maybe "" fromPathTemplate) pkgHashHaddockContents , opt "haddock-index-location" Nothing (maybe "" fromPathTemplate) pkgHashHaddockIndex , opt "haddock-base-url" Nothing (fromMaybe "") pkgHashHaddockBaseUrl - , opt "haddock-lib" Nothing (fromMaybe "") pkgHashHaddockLib + , opt "haddock-resources-dir" Nothing (fromMaybe "") pkgHashHaddockResourcesDir , opt "haddock-output-dir" Nothing (fromMaybe "") pkgHashHaddockOutputDir + , opt "haddock-use-unicode" False prettyShow pkgHashHaddockUseUnicode ] ++ Map.foldrWithKey (\prog args acc -> opt (prog ++ "-options") [] unwords args : acc) [] pkgHashProgramArgs where diff --git a/cabal-install/src/Distribution/Client/ParseUtils.hs b/cabal-install/src/Distribution/Client/ParseUtils.hs index 44cdc4ccc22..5d4bd8331a1 100644 --- a/cabal-install/src/Distribution/Client/ParseUtils.hs +++ b/cabal-install/src/Distribution/Client/ParseUtils.hs @@ -1,6 +1,7 @@ {-# LANGUAGE ExistentialQuantification #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RankNTypes #-} +{-# LANGUAGE ScopedTypeVariables #-} ----------------------------------------------------------------------------- @@ -17,6 +18,8 @@ module Distribution.Client.ParseUtils FieldDescr (..) , liftField , liftFields + , addFields + , aliasField , filterFields , mapFieldNames , commandOptionToField @@ -51,6 +54,7 @@ import Distribution.Deprecated.ParseUtils ( Field (..) , FieldDescr (..) , LineNo + , PError (..) , ParseResult (..) , liftField , lineNo @@ -103,9 +107,15 @@ liftFields get set = map (liftField get set) -- | Given a collection of field descriptions, keep only a given list of them, -- identified by name. +-- +-- TODO: This makes it easy to footgun by providing a non-existent field name. filterFields :: [String] -> [FieldDescr a] -> [FieldDescr a] filterFields includeFields = filter ((`elem` includeFields) . fieldName) +-- | Given a collection of field descriptions, get a field with a given name. +getField :: String -> [FieldDescr a] -> Maybe (FieldDescr a) +getField name = find ((== name) . fieldName) + -- | Apply a name mangling function to the field names of all the field -- descriptions. The typical use case is to apply some prefix. mapFieldNames :: (String -> String) -> [FieldDescr a] -> [FieldDescr a] @@ -120,6 +130,30 @@ commandOptionToField = viewAsFieldDescr commandOptionsToFields :: [OptionField a] -> [FieldDescr a] commandOptionsToFields = map viewAsFieldDescr +-- | Add fields to a field list. +addFields + :: [FieldDescr a] + -> ([FieldDescr a] -> [FieldDescr a]) +addFields = (++) + +-- | Add a new field which is identical to an existing field but with a +-- different name. +aliasField + :: String + -- ^ The existing field name. + -> String + -- ^ The new field name. + -> [FieldDescr a] + -> [FieldDescr a] +aliasField oldName newName fields = + let fieldToRename = getField oldName fields + in case fieldToRename of + -- TODO: Should this throw? + Nothing -> fields + Just fieldToRename' -> + let newField = fieldToRename'{fieldName = newName} + in newField : fields + ------------------------------------------ -- SectionDescr definition and utilities -- @@ -260,13 +294,16 @@ parseFieldsAndSections fieldDescrs sectionDescrs fgSectionDescrs = setField a (F line name value) = case Map.lookup name fieldMap of Just (FieldDescr _ _ set) -> set line value a - Nothing -> do - warning $ - "Unrecognized field '" - ++ name - ++ "' on line " - ++ show line - return a + Nothing -> + case Left <$> Map.lookup name sectionMap <|> Right <$> Map.lookup name fgSectionMap of + Just _ -> ParseFailed $ FieldShouldBeStanza name line + Nothing -> do + warning $ + "Unrecognized field '" + ++ name + ++ "' on line " + ++ show line + return a setField a (Section line name param fields) = case Left <$> Map.lookup name sectionMap <|> Right <$> Map.lookup name fgSectionMap of Just (Left (SectionDescr _ fieldDescrs' sectionDescrs' _ set sectionEmpty)) -> do diff --git a/cabal-install/src/Distribution/Client/ProjectBuilding.hs b/cabal-install/src/Distribution/Client/ProjectBuilding.hs index 3c11674de80..e70a89af8a3 100644 --- a/cabal-install/src/Distribution/Client/ProjectBuilding.hs +++ b/cabal-install/src/Distribution/Client/ProjectBuilding.hs @@ -72,10 +72,6 @@ import Distribution.Client.Types hiding import Distribution.Package import Distribution.Simple.Compiler - ( Compiler - , PackageDB (..) - , jsemSupported - ) import Distribution.Simple.Program import qualified Distribution.Simple.Register as Cabal @@ -92,7 +88,7 @@ import qualified Data.Set as Set import qualified Text.PrettyPrint as Disp -import Control.Exception (assert, bracket, handle) +import Control.Exception (assert, handle) import System.Directory (doesDirectoryExist, doesFileExist, renameDirectory) import System.FilePath (makeRelative, normalise, takeDirectory, (<.>), ()) import System.Semaphore (SemaphoreName (..)) @@ -102,7 +98,6 @@ import Distribution.Simple.Flag (fromFlagOrDefault) import Distribution.Client.ProjectBuilding.PackageFileMonitor import Distribution.Client.ProjectBuilding.UnpackedPackage (annotateFailureNoLog, buildAndInstallUnpackedPackage, buildInplaceUnpackedPackage) -import Distribution.Client.Utils (numberOfProcessors) ------------------------------------------------------------------------------ @@ -359,17 +354,6 @@ rebuildTargets } | fromFlagOrDefault False (projectConfigOfflineMode config) && not (null packagesToDownload) = return offlineError | otherwise = do - -- Concurrency control: create the job controller and concurrency limits - -- for downloading, building and installing. - mkJobControl <- case buildSettingNumJobs of - Serial -> newSerialJobControl - NumJobs n -> newParallelJobControl (fromMaybe numberOfProcessors n) - UseSem n -> - if jsemSupported compiler - then newSemaphoreJobControl n - else do - warn verbosity "-jsem is not supported by the selected compiler, falling back to normal parallelism control." - newParallelJobControl n registerLock <- newLock -- serialise registration cacheLock <- newLock -- serialise access to setup exe cache -- TODO: [code cleanup] eliminate setup exe cache @@ -384,7 +368,9 @@ rebuildTargets createDirectoryIfMissingVerbose verbosity True distTempDirectory traverse_ (createPackageDBIfMissing verbosity compiler progdb) packageDBsToUse - bracket (pure mkJobControl) cleanupJobControl $ \jobControl -> do + -- Concurrency control: create the job controller and concurrency limits + -- for downloading, building and installing. + withJobControl (newJobControlFromParStrat verbosity compiler buildSettingNumJobs Nothing) $ \jobControl -> do -- Before traversing the install plan, preemptively find all packages that -- will need to be downloaded and start downloading them. asyncDownloadPackages @@ -395,7 +381,7 @@ rebuildTargets $ \downloadMap -> -- For each package in the plan, in dependency order, but in parallel... InstallPlan.execute - mkJobControl + jobControl keepGoing (BuildFailure Nothing . DependentFailed . packageId) installPlan @@ -478,7 +464,7 @@ createPackageDBIfMissing :: Verbosity -> Compiler -> ProgramDb - -> PackageDB + -> PackageDBCWD -> IO () createPackageDBIfMissing verbosity diff --git a/cabal-install/src/Distribution/Client/ProjectBuilding/PackageFileMonitor.hs b/cabal-install/src/Distribution/Client/ProjectBuilding/PackageFileMonitor.hs index b93064ea7be..71d31cb5926 100644 --- a/cabal-install/src/Distribution/Client/ProjectBuilding/PackageFileMonitor.hs +++ b/cabal-install/src/Distribution/Client/ProjectBuilding/PackageFileMonitor.hs @@ -26,7 +26,7 @@ import Distribution.Simple.LocalBuildInfo ) import qualified Data.Set as Set -import Distribution.Client.Init.Types (removeExistingFile) +import Distribution.Client.Init.Types (removeExistingFile, runPromptIO) ----------------------------- -- Package change detection @@ -291,4 +291,4 @@ updatePackageRegFileMonitor invalidatePackageRegFileMonitor :: PackageFileMonitor -> IO () invalidatePackageRegFileMonitor PackageFileMonitor{pkgFileMonitorReg} = - removeExistingFile (fileMonitorCacheFile pkgFileMonitorReg) + runPromptIO $ removeExistingFile (fileMonitorCacheFile pkgFileMonitorReg) diff --git a/cabal-install/src/Distribution/Client/ProjectBuilding/Types.hs b/cabal-install/src/Distribution/Client/ProjectBuilding/Types.hs index 397a01ee68e..864455cb540 100644 --- a/cabal-install/src/Distribution/Client/ProjectBuilding/Types.hs +++ b/cabal-install/src/Distribution/Client/ProjectBuilding/Types.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} - -- | Types for the "Distribution.Client.ProjectBuilding" -- -- Moved out to avoid module cycles. @@ -156,7 +154,7 @@ data BuildFailure = BuildFailure { buildFailureLogFile :: Maybe FilePath , buildFailureReason :: BuildFailureReason } - deriving (Show, Typeable) + deriving (Show) instance Exception BuildFailure diff --git a/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs b/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs index 7d9f34a8e8b..1d2a86bea46 100644 --- a/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs +++ b/cabal-install/src/Distribution/Client/ProjectBuilding/UnpackedPackage.hs @@ -44,10 +44,14 @@ import Distribution.Client.FileMonitor import Distribution.Client.JobControl import Distribution.Client.Setup ( CommonSetupFlags - , filterCommonFlags + , filterBenchmarkFlags + , filterBuildFlags , filterConfigureFlags + , filterCopyFlags , filterHaddockArgs , filterHaddockFlags + , filterRegisterFlags + , filterReplFlags , filterTestFlags ) import Distribution.Client.SetupWrapper @@ -73,7 +77,8 @@ import qualified Distribution.PackageDescription as PD import Distribution.Simple.BuildPaths (haddockDirName) import Distribution.Simple.Command (CommandUI) import Distribution.Simple.Compiler - ( PackageDBStack + ( PackageDBStackCWD + , coercePackageDBStack ) import qualified Distribution.Simple.InstallDirs as InstallDirs import Distribution.Simple.LocalBuildInfo @@ -99,7 +104,7 @@ import qualified Data.ByteString.Lazy as LBS import qualified Data.ByteString.Lazy.Char8 as LBS.Char8 import qualified Data.List.NonEmpty as NE -import Control.Exception (ErrorCall, Handler (..), SomeAsyncException, assert, catches) +import Control.Exception (ErrorCall, Handler (..), SomeAsyncException, assert, catches, onException) import System.Directory (canonicalizePath, createDirectoryIfMissing, doesDirectoryExist, doesFileExist, removeFile) import System.FilePath (dropDrive, normalise, takeDirectory, (<.>), ()) import System.IO (Handle, IOMode (AppendMode), withFile) @@ -133,7 +138,7 @@ data PackageBuildingPhase | PBInstallPhase { runCopy :: FilePath -> IO () , runRegister - :: PackageDBStack + :: PackageDBStackCWD -> Cabal.RegisterOptions -> IO InstalledPackageInfo } @@ -168,7 +173,7 @@ buildAndRegisterUnpackedPackage verbosity distDirLayout@DistDirLayout{distTempDirectory} maybe_semaphore - buildTimeSettings@BuildTimeSettings{buildSettingNumJobs} + buildTimeSettings@BuildTimeSettings{buildSettingNumJobs, buildSettingKeepTempFiles} registerLock cacheLock pkgshared@ElaboratedSharedConfig @@ -191,21 +196,21 @@ buildAndRegisterUnpackedPackage delegate $ PBBuildPhase $ annotateFailure mlogFile BuildFailed $ do - setup buildCommand Cabal.buildCommonFlags buildFlags buildArgs + setup buildCommand Cabal.buildCommonFlags (return . buildFlags) buildArgs -- Haddock phase whenHaddock $ delegate $ PBHaddockPhase $ annotateFailure mlogFile HaddocksFailed $ do - setup haddockCommand Cabal.haddockCommonFlags haddockFlags haddockArgs + setup haddockCommand Cabal.haddockCommonFlags (return . haddockFlags) haddockArgs -- Install phase delegate $ PBInstallPhase { runCopy = \destdir -> annotateFailure mlogFile InstallFailed $ - setup Cabal.copyCommand Cabal.copyCommonFlags (copyFlags destdir) copyArgs + setup Cabal.copyCommand Cabal.copyCommonFlags (return . copyFlags destdir) copyArgs , runRegister = \pkgDBStack registerOpts -> annotateFailure mlogFile InstallFailed $ do -- We register ourselves rather than via Setup.hs. We need to @@ -219,7 +224,7 @@ buildAndRegisterUnpackedPackage compiler progdb Nothing - pkgDBStack + (coercePackageDBStack pkgDBStack) ipkg registerOpts return ipkg @@ -230,14 +235,14 @@ buildAndRegisterUnpackedPackage delegate $ PBTestPhase $ annotateFailure mlogFile TestsFailed $ - setup testCommand Cabal.testCommonFlags testFlags testArgs + setup testCommand Cabal.testCommonFlags (return . testFlags) testArgs -- Bench phase whenBench $ delegate $ PBBenchPhase $ annotateFailure mlogFile BenchFailed $ - setup benchCommand Cabal.benchmarkCommonFlags benchFlags benchArgs + setup benchCommand Cabal.benchmarkCommonFlags (return . benchFlags) benchArgs -- Repl phase whenRepl $ @@ -271,30 +276,36 @@ buildAndRegisterUnpackedPackage | otherwise = return () mbWorkDir = useWorkingDir scriptOptions - commonFlags v = - flip filterCommonFlags v $ - setupHsCommonFlags verbosity mbWorkDir builddir + commonFlags = setupHsCommonFlags verbosity mbWorkDir builddir buildSettingKeepTempFiles configureCommand = Cabal.configureCommand defaultProgramDb configureFlags v = - flip filterConfigureFlags v $ - setupHsConfigureFlags + flip filterConfigureFlags v + <$> setupHsConfigureFlags + (\p -> makeSymbolicPath <$> canonicalizePath p) plan rpkg pkgshared - (commonFlags v) + commonFlags configureArgs _ = setupHsConfigureArgs pkg buildCommand = Cabal.buildCommand defaultProgramDb - buildFlags v = setupHsBuildFlags comp_par_strat pkg pkgshared $ commonFlags v + buildFlags v = + flip filterBuildFlags v $ + setupHsBuildFlags + comp_par_strat + pkg + pkgshared + commonFlags buildArgs _ = setupHsBuildArgs pkg copyFlags destdir v = - setupHsCopyFlags - pkg - pkgshared - (commonFlags v) - destdir + flip filterCopyFlags v $ + setupHsCopyFlags + pkg + pkgshared + commonFlags + destdir -- In theory, we could want to copy less things than those that were -- built, but instead, we simply copy the targets that were built. copyArgs = buildArgs @@ -304,23 +315,25 @@ buildAndRegisterUnpackedPackage flip filterTestFlags v $ setupHsTestFlags pkg - (commonFlags v) + commonFlags testArgs _ = setupHsTestArgs pkg benchCommand = Cabal.benchmarkCommand benchFlags v = - setupHsBenchFlags - pkg - pkgshared - (commonFlags v) + flip filterBenchmarkFlags v $ + setupHsBenchFlags + pkg + pkgshared + commonFlags benchArgs _ = setupHsBenchArgs pkg replCommand = Cabal.replCommand defaultProgramDb replFlags v = - setupHsReplFlags - pkg - pkgshared - (commonFlags v) + flip filterReplFlags v $ + setupHsReplFlags + pkg + pkgshared + commonFlags replArgs _ = setupHsReplArgs pkg haddockCommand = Cabal.haddockCommand @@ -330,7 +343,7 @@ buildAndRegisterUnpackedPackage pkg pkgshared buildTimeSettings - (commonFlags v) + commonFlags haddockArgs v = flip filterHaddockArgs v $ setupHsHaddockArgs pkg @@ -349,11 +362,11 @@ buildAndRegisterUnpackedPackage setup :: CommandUI flags -> (flags -> CommonSetupFlags) - -> (Version -> flags) + -> (Version -> IO flags) -> (Version -> [String]) -> IO () setup cmd getCommonFlags flags args = - withLogging $ \mLogFileHandle -> + withLogging $ \mLogFileHandle -> do setupWrapper verbosity scriptOptions @@ -382,7 +395,7 @@ buildAndRegisterUnpackedPackage (Just (elabPkgDescription pkg)) cmd getCommonFlags - flags + (\v -> return (flags v)) args generateInstalledPackageInfo :: IO InstalledPackageInfo @@ -392,12 +405,13 @@ buildAndRegisterUnpackedPackage distTempDirectory $ \pkgConfDest -> do let registerFlags v = - setupHsRegisterFlags - pkg - pkgshared - (commonFlags v) - pkgConfDest - setup (Cabal.registerCommand) Cabal.registerCommonFlags registerFlags (const []) + flip filterRegisterFlags v $ + setupHsRegisterFlags + pkg + pkgshared + commonFlags + pkgConfDest + setup (Cabal.registerCommand) Cabal.registerCommonFlags (\v -> return (registerFlags v)) (const []) withLogging :: (Maybe Handle -> IO r) -> IO r withLogging action = @@ -480,6 +494,10 @@ buildInplaceUnpackedPackage whenRebuild $ do timestamp <- beginUpdateFileMonitor runBuild + -- Be sure to invalidate the cache if building throws an exception! + -- If not, we'll abort execution with a stale recompilation cache. + -- See ghc#24926 for an example of how this can go wrong. + `onException` invalidatePackageRegFileMonitor packageFileMonitor let listSimple = execRebuild (getSymbolicPath srcdir) (needElaboratedConfiguredPackage pkg) diff --git a/cabal-install/src/Distribution/Client/ProjectConfig.hs b/cabal-install/src/Distribution/Client/ProjectConfig.hs index 5d04f101c7d..5387f8e37db 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig.hs @@ -1,8 +1,8 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE TypeApplications #-} -- | Handling project configuration. module Distribution.Client.ProjectConfig @@ -18,8 +18,10 @@ module Distribution.Client.ProjectConfig -- * Project root , findProjectRoot + , getProjectRootUsability , ProjectRoot (..) - , BadProjectRoot + , BadProjectRoot (..) + , ProjectRootUsability (..) -- * Project config files , readProjectConfig @@ -34,6 +36,10 @@ module Distribution.Client.ProjectConfig , writeProjectLocalFreezeConfig , writeProjectConfigFile , commandLineFlagsToProjectConfig + , onlyTopLevelProvenance + , readSourcePackageCabalFile + , readSourcePackageCabalFile' + , CabalFileParseError (..) -- * Packages within projects , ProjectPackageLocation (..) @@ -51,19 +57,24 @@ module Distribution.Client.ProjectConfig , resolveSolverSettings , BuildTimeSettings (..) , resolveBuildTimeSettings + , resolveNumJobsSetting -- * Checking configuration , checkBadPerPackageCompilerPaths , BadPerPackageCompilerPaths (..) + + -- * Globals + , maxNumFetchJobs ) where import Distribution.Client.Compat.Prelude -import Text.PrettyPrint (render) +import Text.PrettyPrint (nest, render, text, vcat) import Prelude () import Distribution.Client.Glob ( isTrivialRootedGlob ) +import Distribution.Client.JobControl import Distribution.Client.ProjectConfig.Legacy import Distribution.Client.ProjectConfig.Types import Distribution.Client.RebuildMonad @@ -93,6 +104,7 @@ import Distribution.Client.GlobalFlags ( RepoContext (..) , withRepoContext' ) +import Distribution.Client.HashValue import Distribution.Client.HttpUtils ( HttpTransport , configureTransport @@ -102,9 +114,8 @@ import Distribution.Client.HttpUtils import Distribution.Client.Types import Distribution.Client.Utils.Parsec (renderParseError) +import Distribution.Solver.Types.ConstraintSource import Distribution.Solver.Types.PackageConstraint - ( PackageProperty (..) - ) import Distribution.Solver.Types.Settings import Distribution.Solver.Types.SourcePackage @@ -116,6 +127,7 @@ import Distribution.Client.Setup import Distribution.Client.SrcDist ( packageDirToSdist ) +import Distribution.Client.Targets import Distribution.Client.Types.SourceRepo ( SourceRepoList , SourceRepositoryPackage (..) @@ -136,11 +148,6 @@ import Distribution.Fields , showPWarning ) import Distribution.Package - ( PackageId - , PackageName - , UnitId - , packageId - ) import Distribution.PackageDescription.Parsec ( parseGenericPackageDescription ) @@ -169,7 +176,6 @@ import Distribution.Simple.Setup import Distribution.Simple.Utils ( createDirectoryIfMissingVerbose , dieWithException - , info , maybeExit , notice , rawSystemIOWithEnv @@ -187,6 +193,10 @@ import Distribution.Types.PackageVersionConstraint import Distribution.Types.SourceRepo ( RepoType (..) ) +import Distribution.Utils.Generic + ( toUTF8BS + , toUTF8LBS + ) import Distribution.Utils.NubList ( fromNubList ) @@ -195,22 +205,19 @@ import Distribution.Verbosity , verbose ) import Distribution.Version - ( Version - ) import qualified Codec.Archive.Tar as Tar import qualified Codec.Archive.Tar.Entry as Tar import qualified Distribution.Client.GZipUtils as GZipUtils import qualified Distribution.Client.Tar as Tar +import Control.Exception (handle) import Control.Monad.Trans (liftIO) import qualified Data.ByteString as BS import qualified Data.ByteString.Lazy as LBS -import qualified Data.Hashable as Hashable import qualified Data.List.NonEmpty as NE import qualified Data.Map as Map import qualified Data.Set as Set -import Numeric (showHex) import Network.URI ( URI (..) @@ -222,9 +229,11 @@ import System.Directory ( canonicalizePath , doesDirectoryExist , doesFileExist + , doesPathExist , getCurrentDirectory , getDirectoryContents , getHomeDirectory + , pathIsSymbolicLink ) import System.FilePath hiding (combine) import System.IO @@ -317,9 +326,34 @@ resolveSolverSettings where -- TODO: [required eventually] some of these settings need validation, e.g. -- the flag assignments need checking. + cabalPkgname = mkPackageName "Cabal" + + profilingDynamicConstraint = + ( UserConstraint + (UserAnySetupQualifier cabalPkgname) + (PackagePropertyVersion $ orLaterVersion (mkVersion [3, 13, 0])) + , ConstraintSourceProfiledDynamic + ) + + profDynEnabledGlobally = fromFlagOrDefault False (packageConfigProfShared projectConfigLocalPackages) + + profDynEnabledAnyLocally = + or + [ fromFlagOrDefault False (packageConfigProfShared ppc) + | (_, ppc) <- Map.toList (getMapMappend projectConfigSpecificPackage) + ] + + -- Add a setup.Cabal >= 3.13 constraint if prof+dyn is enabled globally + -- or any package in the project enables it. + -- Ideally we'd apply this constraint only on the closure of packages requiring prof+dyn, + -- but that would require another solver run for marginal advantages that + -- will further shrink as 3.13 is adopted. + solverCabalLibConstraints = + [profilingDynamicConstraint | profDynEnabledGlobally || profDynEnabledAnyLocally] + solverSettingRemoteRepos = fromNubList projectConfigRemoteRepos solverSettingLocalNoIndexRepos = fromNubList projectConfigLocalNoIndexRepos - solverSettingConstraints = projectConfigConstraints + solverSettingConstraints = solverCabalLibConstraints ++ projectConfigConstraints solverSettingPreferences = projectConfigPreferences solverSettingFlagAssignment = packageConfigFlagAssignment projectConfigLocalPackages solverSettingFlagAssignments = @@ -406,12 +440,7 @@ resolveBuildTimeSettings -- buildSettingLogVerbosity -- defined below, more complicated buildSettingBuildReports = fromFlag projectConfigBuildReports buildSettingSymlinkBinDir = flagToList projectConfigSymlinkBinDir - buildSettingNumJobs = - if fromFlag projectConfigUseSemaphore - then UseSem (determineNumJobs projectConfigNumJobs) - else case (determineNumJobs projectConfigNumJobs) of - 1 -> Serial - n -> NumJobs (Just n) + buildSettingNumJobs = resolveNumJobsSetting projectConfigUseSemaphore projectConfigNumJobs buildSettingKeepGoing = fromFlag projectConfigKeepGoing buildSettingOfflineMode = fromFlag projectConfigOfflineMode buildSettingKeepTempFiles = fromFlag projectConfigKeepTempFiles @@ -507,10 +536,42 @@ resolveBuildTimeSettings | isParallelBuild buildSettingNumJobs = False | otherwise = False +-- | Determine the number of jobs (ParStrat) from the project config +resolveNumJobsSetting + :: Flag Bool + -- ^ Whether to use a semaphore (-jsem) + -> Flag (Maybe Int) + -- ^ The number of jobs to run concurrently + -> ParStratX Int +resolveNumJobsSetting projectConfigUseSemaphore projectConfigNumJobs = + if fromFlag projectConfigUseSemaphore + then UseSem (determineNumJobs projectConfigNumJobs) + else case (determineNumJobs projectConfigNumJobs) of + 1 -> Serial + n -> NumJobs (Just n) + --------------------------------------------- -- Reading and writing project config files -- +-- | Get @ProjectRootUsability@ of a given file +getProjectRootUsability :: FilePath -> IO ProjectRootUsability +getProjectRootUsability filePath = do + exists <- doesFileExist filePath + if exists + then return ProjectRootUsabilityPresentAndUsable + else do + let isUsableAction = + handle @IOException + -- NOTE: if any IOException is raised, we assume the file does not exist. + -- That is what happen when we call @pathIsSymbolicLink@ on a @FilePath@ that does not exist. + (const $ pure False) + ((||) <$> pathIsSymbolicLink filePath <*> doesPathExist filePath) + isUnusable <- isUsableAction + if isUnusable + then return ProjectRootUsabilityPresentAndUnusable + else return ProjectRootUsabilityNotPresent + -- | Find the root of this project. -- -- The project directory will be one of the following: @@ -534,13 +595,18 @@ findProjectRoot verbosity mprojectDir mprojectFile = do "Specifying an absolute path to the project file is deprecated." <> " Use --project-dir to set the project's directory." - doesFileExist file >>= \case - False -> left (BadProjectRootExplicitFile file) - True -> uncurry projectRoot =<< first dropTrailingPathSeparator . splitFileName <$> canonicalizePath file + getProjectRootUsability file >>= \case + ProjectRootUsabilityPresentAndUsable -> + uncurry projectRoot + =<< first dropTrailingPathSeparator . splitFileName <$> canonicalizePath file + ProjectRootUsabilityNotPresent -> + left (BadProjectRootExplicitFileNotFound file) + ProjectRootUsabilityPresentAndUnusable -> + left (BadProjectRootFileBroken file) | otherwise -> probeProjectRoot mprojectFile Just dir -> doesDirectoryExist dir >>= \case - False -> left (BadProjectRootDir dir) + False -> left (BadProjectRootDirNotFound dir) True -> do projectDir <- canonicalizePath dir @@ -548,13 +614,21 @@ findProjectRoot verbosity mprojectDir mprojectFile = do Nothing -> pure $ Right (ProjectRootExplicit projectDir defaultProjectFile) Just projectFile | isAbsolute projectFile -> - doesFileExist projectFile >>= \case - False -> left (BadProjectRootAbsoluteFile projectFile) - True -> Right . ProjectRootExplicitAbsolute dir <$> canonicalizePath projectFile + getProjectRootUsability projectFile >>= \case + ProjectRootUsabilityNotPresent -> + left (BadProjectRootAbsoluteFileNotFound projectFile) + ProjectRootUsabilityPresentAndUsable -> + Right . ProjectRootExplicitAbsolute dir <$> canonicalizePath projectFile + ProjectRootUsabilityPresentAndUnusable -> + left (BadProjectRootFileBroken projectFile) | otherwise -> - doesFileExist (projectDir projectFile) >>= \case - False -> left (BadProjectRootDirFile dir projectFile) - True -> projectRoot projectDir projectFile + getProjectRootUsability (projectDir projectFile) >>= \case + ProjectRootUsabilityNotPresent -> + left (BadProjectRootDirFileNotFound dir projectFile) + ProjectRootUsabilityPresentAndUsable -> + projectRoot projectDir projectFile + ProjectRootUsabilityPresentAndUnusable -> + left (BadProjectRootFileBroken projectFile) where left = pure . Left @@ -579,45 +653,50 @@ probeProjectRoot mprojectFile = do go dir | isDrive dir || dir == homedir = case mprojectFile of Nothing -> return (Right (ProjectRootImplicit startdir)) - Just file -> return (Left (BadProjectRootExplicitFile file)) + Just file -> return (Left (BadProjectRootExplicitFileNotFound file)) go dir = do - exists <- doesFileExist (dir projectFileName) - if exists - then return (Right (ProjectRootExplicit dir projectFileName)) - else go (takeDirectory dir) + getProjectRootUsability (dir projectFileName) >>= \case + ProjectRootUsabilityNotPresent -> + go (takeDirectory dir) + ProjectRootUsabilityPresentAndUsable -> + return (Right $ ProjectRootExplicit dir projectFileName) + ProjectRootUsabilityPresentAndUnusable -> + return (Left $ BadProjectRootFileBroken projectFileName) -- | Errors returned by 'findProjectRoot'. data BadProjectRoot - = BadProjectRootExplicitFile FilePath - | BadProjectRootDir FilePath - | BadProjectRootAbsoluteFile FilePath - | BadProjectRootDirFile FilePath FilePath -#if MIN_VERSION_base(4,8,0) - deriving (Show, Typeable) -#else - deriving (Typeable) - -instance Show BadProjectRoot where - show = renderBadProjectRoot -#endif - -#if MIN_VERSION_base(4,8,0) + = BadProjectRootExplicitFileNotFound FilePath + | BadProjectRootDirNotFound FilePath + | BadProjectRootAbsoluteFileNotFound FilePath + | BadProjectRootDirFileNotFound FilePath FilePath + | BadProjectRootFileBroken FilePath + deriving (Show, Eq) + instance Exception BadProjectRoot where displayException = renderBadProjectRoot -#else -instance Exception BadProjectRoot -#endif renderBadProjectRoot :: BadProjectRoot -> String renderBadProjectRoot = \case - BadProjectRootExplicitFile projectFile -> + BadProjectRootExplicitFileNotFound projectFile -> "The given project file '" ++ projectFile ++ "' does not exist." - BadProjectRootDir dir -> + BadProjectRootDirNotFound dir -> "The given project directory '" <> dir <> "' does not exist." - BadProjectRootAbsoluteFile file -> + BadProjectRootAbsoluteFileNotFound file -> "The given project file '" <> file <> "' does not exist." - BadProjectRootDirFile dir file -> + BadProjectRootDirFileNotFound dir file -> "The given project directory/file combination '" <> dir file <> "' does not exist." + BadProjectRootFileBroken file -> + "The given project file '" <> file <> "' is broken. Is it a broken symbolic link?" + +-- | State of the project file, encodes if the file can be used +data ProjectRootUsability + = -- | The file is present and can be used + ProjectRootUsabilityPresentAndUsable + | -- | The file is present but can't be used (e.g. broken symlink) + ProjectRootUsabilityPresentAndUnusable + | -- | The file is not present + ProjectRootUsabilityNotPresent + deriving (Eq, Show) withGlobalConfig :: Verbosity @@ -826,21 +905,11 @@ data ProjectPackageLocation -- | Exception thrown by 'findProjectPackages'. data BadPackageLocations = BadPackageLocations (Set ProjectConfigProvenance) [BadPackageLocation] -#if MIN_VERSION_base(4,8,0) - deriving (Show, Typeable) -#else - deriving (Typeable) - -instance Show BadPackageLocations where - show = renderBadPackageLocations -#endif + deriving (Show) -#if MIN_VERSION_base(4,8,0) instance Exception BadPackageLocations where displayException = renderBadPackageLocations -#else -instance Exception BadPackageLocations -#endif + -- TODO: [nice to have] custom exception subclass for Doc rendering, colour etc data BadPackageLocation @@ -882,10 +951,10 @@ renderBadPackageLocations (BadPackageLocations provenance bpls) renderErrors f = unlines (map f bpls) renderExplicit = - "When using configuration(s) from " - ++ intercalate ", " (render . docProjectConfigPath <$> mapMaybe getExplicit (Set.toList provenance)) - ++ ", the following errors occurred:\n" - ++ renderErrors renderBadPackageLocation + "When using configuration from:\n" + ++ render (nest 2 . docProjectConfigFiles $ mapMaybe getExplicit (Set.toList provenance)) + ++ "\nThe following errors occurred:\n" + ++ render (nest 2 $ vcat ((text "-" <+>) . text <$> map renderBadPackageLocation bpls)) getExplicit (Explicit path) = Just path getExplicit Implicit = Nothing @@ -1159,6 +1228,7 @@ mplusMaybeT ma mb = do fetchAndReadSourcePackages :: Verbosity -> DistDirLayout + -> Compiler -> ProjectConfigShared -> ProjectConfigBuildOnly -> [ProjectPackageLocation] @@ -1166,6 +1236,7 @@ fetchAndReadSourcePackages fetchAndReadSourcePackages verbosity distDirLayout + compiler projectConfigShared projectConfigBuildOnly pkgLocations = do @@ -1202,7 +1273,9 @@ fetchAndReadSourcePackages syncAndReadSourcePackagesRemoteRepos verbosity distDirLayout + compiler projectConfigShared + projectConfigBuildOnly (fromFlag (projectConfigOfflineMode projectConfigBuildOnly)) [repo | ProjectPackageRemoteRepo repo <- pkgLocations] @@ -1319,16 +1392,23 @@ fetchAndReadSourcePackageRemoteTarball syncAndReadSourcePackagesRemoteRepos :: Verbosity -> DistDirLayout + -> Compiler -> ProjectConfigShared + -> ProjectConfigBuildOnly -> Bool -> [SourceRepoList] -> Rebuild [PackageSpecifier (SourcePackage UnresolvedPkgLoc)] syncAndReadSourcePackagesRemoteRepos verbosity DistDirLayout{distDownloadSrcDirectory} + compiler ProjectConfigShared { projectConfigProgPathExtra } + ProjectConfigBuildOnly + { projectConfigUseSemaphore + , projectConfigNumJobs + } offlineMode repos = do repos' <- @@ -1354,10 +1434,15 @@ syncAndReadSourcePackagesRemoteRepos in configureVCS verbosity progPathExtra vcs concat - <$> sequenceA - [ rerunIfChanged verbosity monitor repoGroup' $ do - vcs' <- getConfiguredVCS repoType - syncRepoGroupAndReadSourcePackages vcs' pathStem repoGroup' + <$> rerunConcurrentlyIfChanged + verbosity + (newJobControlFromParStrat verbosity compiler parStrat (Just maxNumFetchJobs)) + [ ( monitor + , repoGroup' + , do + vcs' <- getConfiguredVCS repoType + syncRepoGroupAndReadSourcePackages vcs' pathStem repoGroup' + ) | repoGroup@((primaryRepo, repoType) : _) <- Map.elems reposByLocation , let repoGroup' = map fst repoGroup pathStem = @@ -1370,6 +1455,7 @@ syncAndReadSourcePackagesRemoteRepos monitor = newFileMonitor (pathStem <.> "cache") ] where + parStrat = resolveNumJobsSetting projectConfigUseSemaphore projectConfigNumJobs syncRepoGroupAndReadSourcePackages :: VCS ConfiguredProgram -> FilePath @@ -1494,7 +1580,6 @@ data CabalFileParseError -- ^ We might discover the spec version the package needs [PWarning] -- ^ warnings - deriving (Typeable) -- | Manual instance which skips file contents instance Show CabalFileParseError where @@ -1512,11 +1597,8 @@ instance Show CabalFileParseError where . showChar ' ' . showsPrec 11 ws -instance Exception CabalFileParseError -#if MIN_VERSION_base(4,8,0) - where +instance Exception CabalFileParseError where displayException = renderCabalFileParseError -#endif renderCabalFileParseError :: CabalFileParseError -> String renderCabalFileParseError (CabalFileParseError filePath contents errors _ warnings) = @@ -1530,10 +1612,22 @@ readSourcePackageCabalFile -> BS.ByteString -> IO GenericPackageDescription readSourcePackageCabalFile verbosity pkgfilename content = + readSourcePackageCabalFile' (warn verbosity) pkgfilename content + +-- | Like `readSourcePackageCabalFile`, but the `warn` function is an argument. +-- +-- This is used when reading @.cabal@ files in indexes, where warnings should +-- generally be ignored. +readSourcePackageCabalFile' + :: (String -> IO ()) + -> FilePath + -> BS.ByteString + -> IO GenericPackageDescription +readSourcePackageCabalFile' logWarnings pkgfilename content = case runParseResult (parseGenericPackageDescription content) of (warnings, Right pkg) -> do unless (null warnings) $ - info verbosity (formatWarnings warnings) + logWarnings (formatWarnings warnings) return pkg (warnings, Left (mspecVersion, errors)) -> throwIO $ CabalFileParseError pkgfilename content errors mspecVersion warnings @@ -1549,7 +1643,7 @@ readSourcePackageCabalFile verbosity pkgfilename content = data CabalFileSearchFailure = NoCabalFileFound FilePath | MultipleCabalFilesFound FilePath - deriving (Show, Typeable) + deriving (Show) instance Exception CabalFileSearchFailure @@ -1608,7 +1702,7 @@ localFileNameForRemoteTarball :: URI -> FilePath localFileNameForRemoteTarball uri = mangleName uri ++ "-" - ++ showHex locationHash "" + ++ showHashValue locationHash where mangleName = truncateString 10 @@ -1618,15 +1712,15 @@ localFileNameForRemoteTarball uri = . dropTrailingPathSeparator . uriPath - locationHash :: Word - locationHash = fromIntegral (Hashable.hash (uriToString id uri "")) + locationHash :: HashValue + locationHash = hashValue (toUTF8LBS (uriToString id uri "")) -- | The name to use for a local file or dir for a remote 'SourceRepo'. -- This is deterministic based on the source repo identity details, and -- intended to produce non-clashing file names for different repos. localFileNameForRemoteRepo :: SourceRepoList -> FilePath localFileNameForRemoteRepo SourceRepositoryPackage{srpType, srpLocation} = - mangleName srpLocation ++ "-" ++ showHex locationHash "" + mangleName srpLocation ++ "-" ++ showHashValue locationHash where mangleName = truncateString 10 @@ -1635,9 +1729,10 @@ localFileNameForRemoteRepo SourceRepositoryPackage{srpType, srpLocation} = . dropTrailingPathSeparator -- just the parts that make up the "identity" of the repo - locationHash :: Word + locationHash :: HashValue locationHash = - fromIntegral (Hashable.hash (show srpType, srpLocation)) + hashValue $ + LBS.fromChunks [toUTF8BS srpLocation, toUTF8BS (show srpType)] -- | Truncate a string, with a visual indication that it is truncated. truncateString :: Int -> String -> String @@ -1658,21 +1753,11 @@ truncateString n s data BadPerPackageCompilerPaths = BadPerPackageCompilerPaths [(PackageName, String)] -#if MIN_VERSION_base(4,8,0) - deriving (Show, Typeable) -#else - deriving (Typeable) - -instance Show BadPerPackageCompilerPaths where - show = renderBadPerPackageCompilerPaths -#endif + deriving (Show) -#if MIN_VERSION_base(4,8,0) instance Exception BadPerPackageCompilerPaths where displayException = renderBadPerPackageCompilerPaths -#else -instance Exception BadPerPackageCompilerPaths -#endif + -- TODO: [nice to have] custom exception subclass for Doc rendering, colour etc renderBadPerPackageCompilerPaths :: BadPerPackageCompilerPaths -> String @@ -1712,3 +1797,16 @@ checkBadPerPackageCompilerPaths compilerPrograms packagesConfig = ] of [] -> return () ps -> throwIO (BadPerPackageCompilerPaths ps) + +-- | Filter out non-top-level project configs. +onlyTopLevelProvenance :: Set ProjectConfigProvenance -> Set ProjectConfigProvenance +onlyTopLevelProvenance = Set.filter $ \case + Implicit -> False + Explicit ps -> isTopLevelConfigPath ps + +-- | The maximum amount of fetch jobs that can run concurrently. +-- For instance, this is used to limit the amount of concurrent downloads from +-- hackage, or the amount of concurrent git clones for +-- source-repository-package stanzas. +maxNumFetchJobs :: Int +maxNumFetchJobs = 2 diff --git a/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs b/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs index fe2e86d8ccc..1b6357c335b 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig/Legacy.hs @@ -85,6 +85,7 @@ import Distribution.Simple.Compiler ( CompilerInfo (..) , DebugInfoLevel (..) , OptimisationLevel (..) + , interpretPackageDB ) import Distribution.Simple.InstallDirs (CopyDest (NoCopyDest)) import Distribution.Simple.LocalBuildInfo @@ -125,6 +126,7 @@ import Distribution.Simple.Setup import Distribution.Simple.Utils ( debug , lowercase + , noticeDoc ) import Distribution.Types.CondTree ( CondBranch (..) @@ -140,6 +142,7 @@ import Distribution.Utils.NubList , overNubList , toNubList ) +import Distribution.Utils.String (trim) import Distribution.Client.HttpUtils import Distribution.Client.ParseUtils @@ -205,12 +208,10 @@ type ProjectConfigSkeleton = CondTree ConfVar [ProjectConfigPath] ProjectConfig singletonProjectConfigSkeleton :: ProjectConfig -> ProjectConfigSkeleton singletonProjectConfigSkeleton x = CondNode x mempty mempty -instantiateProjectConfigSkeletonFetchingCompiler :: Monad m => m (OS, Arch, CompilerInfo) -> FlagAssignment -> ProjectConfigSkeleton -> m ProjectConfig -instantiateProjectConfigSkeletonFetchingCompiler fetch flags skel - | null (toListOf traverseCondTreeV skel) = pure $ fst (ignoreConditions skel) - | otherwise = do - (os, arch, impl) <- fetch - pure $ instantiateProjectConfigSkeletonWithCompiler os arch impl flags skel +instantiateProjectConfigSkeletonFetchingCompiler :: (OS, Arch, CompilerInfo) -> FlagAssignment -> ProjectConfigSkeleton -> ProjectConfig +instantiateProjectConfigSkeletonFetchingCompiler (os, arch, impl) flags skel + | null (toListOf traverseCondTreeV skel) = fst (ignoreConditions skel) + | otherwise = instantiateProjectConfigSkeletonWithCompiler os arch impl flags skel instantiateProjectConfigSkeletonWithCompiler :: OS -> Arch -> CompilerInfo -> FlagAssignment -> ProjectConfigSkeleton -> ProjectConfig instantiateProjectConfigSkeletonWithCompiler os arch impl _flags skel = go $ mapTreeConds (fst . simplifyWithSysParams os arch impl) skel @@ -275,6 +276,9 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project if isCyclicConfigPath normLocPath then pure . parseFail $ ParseUtils.FromString (render $ cyclicalImportMsg normLocPath) Nothing else do + when + (isUntrimmedUriConfigPath importLocPath) + (noticeDoc verbosity $ untrimmedUriImportMsg (Disp.text "Warning:") importLocPath) normSource <- canonicalizeConfigPath projectDir source let fs = (\z -> CondNode z [normLocPath] mempty) <$> fieldsToConfig normSource (reverse acc) res <- parseProjectSkeleton cacheDir httpTransport verbosity projectDir importLocPath . ProjectConfigToParse =<< fetchImportConfig normLocPath @@ -343,7 +347,7 @@ parseProjectSkeleton cacheDir httpTransport verbosity projectDir source (Project fetch pci fetch :: FilePath -> IO BS.ByteString - fetch pci = case parseURI pci of + fetch pci = case parseURI $ trim pci of Just uri -> do let fp = cacheDir map (\x -> if isPathSeparator x then '_' else x) (makeValid $ show uri) createDirectoryIfMissing True cacheDir @@ -508,6 +512,7 @@ commandLineFlagsToProjectConfig globalFlags NixStyleFlags{..} clientInstallFlags , packageConfigHaddockInternal = packageConfigHaddockInternal pc , packageConfigHaddockQuickJump = packageConfigHaddockQuickJump pc , packageConfigHaddockLinkedSource = packageConfigHaddockLinkedSource pc + , packageConfigHaddockUseUnicode = packageConfigHaddockUseUnicode pc } ) @@ -684,6 +689,8 @@ convertLegacyAllPackageFlags globalFlags configFlags configExFlags installFlags , globalStoreDir = projectConfigStoreDir } = globalFlags + projectConfigPackageDBs = (fmap . fmap) (interpretPackageDB Nothing) projectConfigPackageDBs_ + ConfigFlags { configCommonFlags = commonFlags , configHcFlavor = projectConfigHcFlavor @@ -692,7 +699,7 @@ convertLegacyAllPackageFlags globalFlags configFlags configExFlags installFlags , -- configProgramPathExtra = projectConfigProgPathExtra DELETE ME configInstallDirs = projectConfigInstallDirs , -- configUserInstall = projectConfigUserInstall, - configPackageDBs = projectConfigPackageDBs + configPackageDBs = projectConfigPackageDBs_ } = configFlags CommonSetupFlags @@ -768,6 +775,7 @@ convertLegacyPerPackageFlags , configFullyStaticExe = packageConfigFullyStaticExe , configProfExe = packageConfigProfExe , configProf = packageConfigProf + , configProfShared = packageConfigProfShared , configProfDetail = packageConfigProfDetail , configProfLibDetail = packageConfigProfLibDetail , configConfigureArgs = packageConfigConfigureArgs @@ -821,8 +829,9 @@ convertLegacyPerPackageFlags , haddockContents = packageConfigHaddockContents , haddockIndex = packageConfigHaddockIndex , haddockBaseUrl = packageConfigHaddockBaseUrl - , haddockLib = packageConfigHaddockLib + , haddockResourcesDir = packageConfigHaddockResourcesDir , haddockOutputDir = packageConfigHaddockOutputDir + , haddockUseUnicode = packageConfigHaddockUseUnicode } = haddockFlags TestFlags @@ -855,9 +864,9 @@ convertLegacyBuildOnlyFlags configFlags installFlags clientInstallFlags - haddockFlags - _ - _ = + _haddockFlags + _testFlags + _benchmarkFlags = ProjectConfigBuildOnly{..} where projectConfigClientInstallFlags = clientInstallFlags @@ -874,6 +883,7 @@ convertLegacyBuildOnlyFlags CommonSetupFlags { setupVerbosity = projectConfigVerbosity + , setupKeepTempFiles = projectConfigKeepTempFiles } = commonFlags InstallFlags @@ -893,10 +903,6 @@ convertLegacyBuildOnlyFlags , installOfflineMode = projectConfigOfflineMode } = installFlags - HaddockFlags - { haddockKeepTempFiles = projectConfigKeepTempFiles -- TODO: this ought to live elsewhere - } = haddockFlags - convertToLegacyProjectConfig :: ProjectConfig -> LegacyProjectConfig convertToLegacyProjectConfig projectConfig@ProjectConfig @@ -969,12 +975,13 @@ convertToLegacySharedConfig mempty { setupVerbosity = projectConfigVerbosity , setupDistPref = fmap makeSymbolicPath $ projectConfigDistDir + , setupKeepTempFiles = projectConfigKeepTempFiles } configFlags = mempty { configCommonFlags = commonFlags - , configPackageDBs = projectConfigPackageDBs + , configPackageDBs = fmap (fmap (fmap unsafeMakeSymbolicPath)) projectConfigPackageDBs , configInstallDirs = projectConfigInstallDirs } @@ -1041,8 +1048,7 @@ convertToLegacySharedConfig convertToLegacyAllPackageConfig :: ProjectConfig -> LegacyPackageConfig convertToLegacyAllPackageConfig ProjectConfig - { projectConfigBuildOnly = ProjectConfigBuildOnly{..} - , projectConfigShared = ProjectConfigShared{..} + { projectConfigShared = ProjectConfigShared{..} } = LegacyPackageConfig { legacyConfigureFlags = configFlags @@ -1074,6 +1080,7 @@ convertToLegacyAllPackageConfig , configFullyStaticExe = mempty , configProfExe = mempty , configProf = mempty + , configProfShared = mempty , configProfDetail = mempty , configProfLibDetail = mempty , configConfigureArgs = mempty @@ -1112,12 +1119,11 @@ convertToLegacyAllPackageConfig , configDumpBuildInfo = mempty , configAllowDependingOnPrivateLibs = mempty , configCoverageFor = mempty + , configIgnoreBuildTools = mempty } haddockFlags = mempty - { haddockKeepTempFiles = projectConfigKeepTempFiles - } convertToLegacyPerPackageConfig :: PackageConfig -> LegacyPackageConfig convertToLegacyPerPackageConfig PackageConfig{..} = @@ -1150,6 +1156,7 @@ convertToLegacyPerPackageConfig PackageConfig{..} = , configFullyStaticExe = packageConfigFullyStaticExe , configProfExe = packageConfigProfExe , configProf = packageConfigProf + , configProfShared = packageConfigProfShared , configProfDetail = packageConfigProfDetail , configProfLibDetail = packageConfigProfLibDetail , configConfigureArgs = packageConfigConfigureArgs @@ -1188,6 +1195,7 @@ convertToLegacyPerPackageConfig PackageConfig{..} = , configDumpBuildInfo = packageConfigDumpBuildInfo , configAllowDependingOnPrivateLibs = mempty , configCoverageFor = mempty + , configIgnoreBuildTools = mempty } installFlags = @@ -1215,11 +1223,11 @@ convertToLegacyPerPackageConfig PackageConfig{..} = , haddockQuickJump = packageConfigHaddockQuickJump , haddockHscolourCss = packageConfigHaddockHscolourCss , haddockContents = packageConfigHaddockContents - , haddockKeepTempFiles = mempty , haddockIndex = packageConfigHaddockIndex , haddockBaseUrl = packageConfigHaddockBaseUrl - , haddockLib = packageConfigHaddockLib + , haddockResourcesDir = packageConfigHaddockResourcesDir , haddockOutputDir = packageConfigHaddockOutputDir + , haddockUseUnicode = packageConfigHaddockUseUnicode } testFlags = @@ -1397,7 +1405,8 @@ legacySharedConfigFieldDescrs constraintSrc = configPackageDBs (\v conf -> conf{configPackageDBs = v}) ] - . filterFields (["verbose", "builddir"] ++ map optionName installDirsOptions) + . aliasField "keep-temp-files" "haddock-keep-temp-files" + . filterFields (["verbose", "builddir", "keep-temp-files"] ++ map optionName installDirsOptions) . commandOptionsToFields $ configureOptions ParseArgs , liftFields @@ -1545,11 +1554,13 @@ legacyPackageConfigFieldDescrs = , "program-suffix" , "library-vanilla" , "library-profiling" + , "library-vanilla" , "shared" , "static" , "executable-dynamic" , "executable-static" , "profiling" + , "profiling-shared" , "executable-profiling" , "profiling-detail" , "library-profiling-detail" @@ -1617,10 +1628,10 @@ legacyPackageConfigFieldDescrs = , "hscolour-css" , "contents-location" , "index-location" - , "keep-temp-files" , "base-url" - , "lib" + , "resources-dir" , "output-dir" + , "use-unicode" ] . commandOptionsToFields ) @@ -2059,9 +2070,3 @@ showTokenQ "" = Disp.empty showTokenQ x@('-' : '-' : _) = Disp.text (show x) showTokenQ x@('.' : []) = Disp.text (show x) showTokenQ x = showToken x - --- Handy util -addFields - :: [FieldDescr a] - -> ([FieldDescr a] -> [FieldDescr a]) -addFields = (++) diff --git a/cabal-install/src/Distribution/Client/ProjectConfig/Types.hs b/cabal-install/src/Distribution/Client/ProjectConfig/Types.hs index 3e8e3ba1b07..1a2b6ae2fa6 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig/Types.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig/Types.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} @@ -69,7 +68,7 @@ import Distribution.Simple.Compiler , CompilerFlavor , DebugInfoLevel (..) , OptimisationLevel (..) - , PackageDB + , PackageDBCWD , ProfDetailLevel ) import Distribution.Simple.InstallDirs @@ -152,7 +151,7 @@ data ProjectConfig = ProjectConfig -- any packages which are explicitly named in `cabal.project`. , projectConfigSpecificPackage :: MapMappend PackageName PackageConfig } - deriving (Eq, Show, Generic, Typeable) + deriving (Eq, Show, Generic) -- | That part of the project configuration that only affects /how/ we build -- and not the /value/ of the things we build. This means this information @@ -198,7 +197,7 @@ data ProjectConfigShared = ProjectConfigShared -- projectConfigUserInstall :: Flag Bool, projectConfigInstallDirs :: InstallDirs (Flag PathTemplate) - , projectConfigPackageDBs :: [Maybe PackageDB] + , projectConfigPackageDBs :: [Maybe PackageDBCWD] , -- configuration used both by the solver and other phases projectConfigRemoteRepos :: NubList RemoteRepo -- ^ Available Hackage servers. @@ -265,6 +264,7 @@ data PackageConfig = PackageConfig , packageConfigFullyStaticExe :: Flag Bool , packageConfigProf :: Flag Bool -- TODO: [code cleanup] sort out , packageConfigProfLib :: Flag Bool -- this duplication + , packageConfigProfShared :: Flag Bool , packageConfigProfExe :: Flag Bool -- and consistency , packageConfigProfDetail :: Flag ProfDetailLevel , packageConfigProfLibDetail :: Flag ProfDetailLevel @@ -305,8 +305,9 @@ data PackageConfig = PackageConfig , packageConfigHaddockContents :: Flag PathTemplate -- TODO: [required eventually] use this , packageConfigHaddockIndex :: Flag PathTemplate -- TODO: [required eventually] use this , packageConfigHaddockBaseUrl :: Flag String -- TODO: [required eventually] use this - , packageConfigHaddockLib :: Flag String -- TODO: [required eventually] use this + , packageConfigHaddockResourcesDir :: Flag String -- TODO: [required eventually] use this , packageConfigHaddockOutputDir :: Flag FilePath -- TODO: [required eventually] use this + , packageConfigHaddockUseUnicode :: Flag Bool -- TODO: [required eventually] use this , packageConfigHaddockForHackage :: Flag HaddockTarget , -- Test options packageConfigTestHumanLog :: Flag PathTemplate @@ -336,7 +337,7 @@ instance Structured PackageConfig -- | Newtype wrapper for 'Map' that provides a 'Monoid' instance that takes -- the last value rather than the first value for overlapping keys. newtype MapLast k v = MapLast {getMapLast :: Map k v} - deriving (Eq, Show, Functor, Generic, Binary, Typeable) + deriving (Eq, Show, Functor, Generic, Binary) instance (Structured k, Structured v) => Structured (MapLast k v) @@ -352,7 +353,7 @@ instance Ord k => Semigroup (MapLast k v) where -- | Newtype wrapper for 'Map' that provides a 'Monoid' instance that -- 'mappend's values of overlapping keys rather than taking the first. newtype MapMappend k v = MapMappend {getMapMappend :: Map k v} - deriving (Eq, Show, Functor, Generic, Binary, Typeable) + deriving (Eq, Show, Functor, Generic, Binary) instance (Structured k, Structured v) => Structured (MapMappend k v) @@ -437,7 +438,7 @@ data SolverSettings = SolverSettings -- solverSettingOverrideReinstall :: Bool, -- solverSettingUpgradeDeps :: Bool } - deriving (Eq, Show, Generic, Typeable) + deriving (Eq, Show, Generic) instance Binary SolverSettings instance Structured SolverSettings diff --git a/cabal-install/src/Distribution/Client/ProjectOrchestration.hs b/cabal-install/src/Distribution/Client/ProjectOrchestration.hs index 2d963b0e07f..fef9f6efde4 100644 --- a/cabal-install/src/Distribution/Client/ProjectOrchestration.hs +++ b/cabal-install/src/Distribution/Client/ProjectOrchestration.hs @@ -946,7 +946,7 @@ printPlan printPlan verbosity ProjectBaseContext - { buildSettings = BuildTimeSettings{buildSettingDryRun} + { buildSettings = BuildTimeSettings{buildSettingDryRun, buildSettingKeepTempFiles} , projectConfig = ProjectConfig { projectConfigAllPackages = @@ -1048,12 +1048,16 @@ printPlan verbosity Nothing -- omit working directory (makeSymbolicPath "$builddir") + buildSettingKeepTempFiles fullConfigureFlags = - setupHsConfigureFlags - elaboratedPlan - (ReadyPackage elab) - elaboratedShared - commonFlags + runIdentity $ + ( setupHsConfigureFlags + (\_ -> return (error "unused")) + elaboratedPlan + (ReadyPackage elab) + elaboratedShared + commonFlags + ) -- \| Given a default value @x@ for a flag, nub @Flag x@ -- into @NoFlag@. This gives us a tidier command line -- rendering. @@ -1061,7 +1065,7 @@ printPlan nubFlag x (Setup.Flag x') | x == x' = Setup.NoFlag nubFlag _ f = f - (tryLibProfiling, tryExeProfiling) = + (tryLibProfiling, tryLibProfilingShared, tryExeProfiling) = computeEffectiveProfiling fullConfigureFlags partialConfigureFlags = @@ -1072,7 +1076,8 @@ printPlan nubFlag tryExeProfiling (configProfExe fullConfigureFlags) , configProfLib = nubFlag tryLibProfiling (configProfLib fullConfigureFlags) - -- Maybe there are more we can add + , configProfShared = + nubFlag tryLibProfilingShared (configProfShared fullConfigureFlags) } in -- Not necessary to "escape" it, it's just for user output unwords . ("" :) $ @@ -1411,11 +1416,7 @@ dieOnBuildFailures verbosity currentCommand plan buildOutcomes " The build process terminated with exit code " ++ show n _ -> " The exception was:\n " -#if MIN_VERSION_base(4,8,0) ++ displayException e -#else - ++ show e -#endif buildFailureException :: BuildFailureReason -> Maybe SomeException buildFailureException reason = diff --git a/cabal-install/src/Distribution/Client/ProjectPlanOutput.hs b/cabal-install/src/Distribution/Client/ProjectPlanOutput.hs index d38f07037a6..b6b5dc8dd79 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanOutput.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanOutput.hs @@ -1,8 +1,4 @@ -{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -40,7 +36,6 @@ import qualified Distribution.Solver.Types.ComponentDeps as ComponentDeps import qualified Distribution.Compat.Binary as Binary import Distribution.Compat.Graph (Graph, Node) import qualified Distribution.Compat.Graph as Graph -import Distribution.Compiler (CompilerFlavor (GHC, GHCJS)) import Distribution.InstalledPackageInfo (InstalledPackageInfo) import Distribution.Package import qualified Distribution.PackageDescription as PD @@ -50,15 +45,6 @@ import Distribution.Simple.BuildPaths , exeExtension ) import Distribution.Simple.Compiler - ( Compiler - , CompilerId (..) - , PackageDB (..) - , PackageDBStack - , compilerFlavor - , compilerId - , compilerVersion - , showCompilerId - ) import Distribution.Simple.GHC ( GhcEnvironmentFileEntry (..) , GhcImplInfo (supportsPkgEnvFiles) @@ -871,7 +857,7 @@ renderGhcEnvironmentFile :: FilePath -> ElaboratedInstallPlan -> PostBuildProjectStatus - -> [GhcEnvironmentFileEntry] + -> [GhcEnvironmentFileEntry FilePath] renderGhcEnvironmentFile projectRootDir elaboratedInstallPlan @@ -977,7 +963,7 @@ selectGhcEnvironmentFileLibraries PostBuildProjectStatus{..} = elabRequiresRegistration pkg && installedUnitId pkg `Set.member` packagesProbablyUpToDate -selectGhcEnvironmentFilePackageDbs :: ElaboratedInstallPlan -> PackageDBStack +selectGhcEnvironmentFilePackageDbs :: ElaboratedInstallPlan -> PackageDBStackCWD selectGhcEnvironmentFilePackageDbs elaboratedInstallPlan = -- If we have any inplace packages then their package db stack is the -- one we should use since it'll include the store + the local db but @@ -987,7 +973,7 @@ selectGhcEnvironmentFilePackageDbs elaboratedInstallPlan = ([], pkgs) -> checkSamePackageDBs pkgs (pkgs, _) -> checkSamePackageDBs pkgs where - checkSamePackageDBs :: [ElaboratedConfiguredPackage] -> PackageDBStack + checkSamePackageDBs :: [ElaboratedConfiguredPackage] -> PackageDBStackCWD checkSamePackageDBs pkgs = case ordNub (map elabBuildPackageDBStack pkgs) of [packageDbs] -> packageDbs @@ -1019,10 +1005,10 @@ selectGhcEnvironmentFilePackageDbs elaboratedInstallPlan = InstallPlan.PreExisting _ -> Nothing ] -relativePackageDBPaths :: FilePath -> PackageDBStack -> PackageDBStack +relativePackageDBPaths :: FilePath -> PackageDBStackCWD -> PackageDBStackCWD relativePackageDBPaths relroot = map (relativePackageDBPath relroot) -relativePackageDBPath :: FilePath -> PackageDB -> PackageDB +relativePackageDBPath :: FilePath -> PackageDBCWD -> PackageDBCWD relativePackageDBPath relroot pkgdb = case pkgdb of GlobalPackageDB -> GlobalPackageDB diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning.hs b/cabal-install/src/Distribution/Client/ProjectPlanning.hs index ea4fae8ab8c..582e526af53 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} @@ -127,7 +126,7 @@ import Distribution.Client.SetupWrapper import Distribution.Client.Store import Distribution.Client.Targets (userToPackageConstraint) import Distribution.Client.Types -import Distribution.Client.Utils (incVersion) +import Distribution.Client.Utils (concatMapM, incVersion) import qualified Distribution.Client.BuildReports.Storage as BuildReports import qualified Distribution.Client.IndexUtils as IndexUtils @@ -165,6 +164,8 @@ import Distribution.Simple.LocalBuildInfo , componentName , pkgComponents ) + +import Distribution.Simple.BuildWay import Distribution.Simple.PackageIndex (InstalledPackageIndex) import Distribution.Simple.Program import Distribution.Simple.Program.Db @@ -174,6 +175,9 @@ import Distribution.System import Distribution.Types.AnnotatedId import Distribution.Types.ComponentInclude import Distribution.Types.ComponentName +import Distribution.Types.DependencySatisfaction + ( DependencySatisfaction (..) + ) import Distribution.Types.DumpBuildInfo import Distribution.Types.GivenComponent import Distribution.Types.LibraryName @@ -190,6 +194,7 @@ import Distribution.Backpack.LinkedComponent import Distribution.Backpack.ModuleShape import Distribution.Simple.Utils +import Distribution.Verbosity import Distribution.Version import qualified Distribution.InstalledPackageInfo as IPI @@ -206,7 +211,7 @@ import qualified Distribution.Solver.Types.ComponentDeps as CD import qualified Distribution.Compat.Graph as Graph import Control.Exception (assert) -import Control.Monad (forM, sequence) +import Control.Monad (sequence) import Control.Monad.IO.Class (liftIO) import Control.Monad.State as State (State, execState, runState, state) import Data.Foldable (fold) @@ -379,26 +384,25 @@ rebuildProjectConfig $ do liftIO $ info verbosity "Project settings changed, reconfiguring..." projectConfigSkeleton <- phaseReadProjectConfig - let fetchCompiler = do - -- have to create the cache directory before configuring the compiler - liftIO $ createDirectoryIfMissingVerbose verbosity True distProjectCacheDirectory - (compiler, Platform arch os, _) <- configureCompiler verbosity distDirLayout (fst (PD.ignoreConditions projectConfigSkeleton) <> cliConfig) - pure (os, arch, compilerInfo compiler) - projectConfig <- instantiateProjectConfigSkeletonFetchingCompiler fetchCompiler mempty projectConfigSkeleton + -- have to create the cache directory before configuring the compiler + liftIO $ createDirectoryIfMissingVerbose verbosity True distProjectCacheDirectory + (compiler, Platform arch os, _) <- configureCompiler verbosity distDirLayout (fst (PD.ignoreConditions projectConfigSkeleton) <> cliConfig) + + let projectConfig = instantiateProjectConfigSkeletonFetchingCompiler (os, arch, compilerInfo compiler) mempty projectConfigSkeleton when (projectConfigDistDir (projectConfigShared $ projectConfig) /= NoFlag) $ liftIO $ warn verbosity "The builddir option is not supported in project and config files. It will be ignored." - localPackages <- phaseReadLocalPackages (projectConfig <> cliConfig) + localPackages <- phaseReadLocalPackages compiler (projectConfig <> cliConfig) return (projectConfig, localPackages) - sequence_ - [ do - info verbosity . render . vcat $ - text "this build was affected by the following (project) config files:" - : [text "-" <+> docProjectConfigPath path] - | Explicit path <- Set.toList $ projectConfigProvenance projectConfig - ] + let configfiles = + [ text "-" <+> docProjectConfigPath path + | Explicit path <- Set.toList . (if verbosity >= verbose then id else onlyTopLevelProvenance) $ projectConfigProvenance projectConfig + ] + unless (null configfiles) $ + notice (verboseStderr verbosity) . render . vcat $ + text "Configuration is affected by the following files:" : configfiles return (projectConfig <> cliConfig, localPackages) where @@ -421,9 +425,11 @@ rebuildProjectConfig -- NOTE: These are all packages mentioned in the project configuration. -- Whether or not they will be considered local to the project will be decided by `shouldBeLocal`. phaseReadLocalPackages - :: ProjectConfig + :: Compiler + -> ProjectConfig -> Rebuild [PackageSpecifier UnresolvedSourcePackage] phaseReadLocalPackages + compiler projectConfig@ProjectConfig { projectConfigShared , projectConfigBuildOnly @@ -438,6 +444,7 @@ rebuildProjectConfig fetchAndReadSourcePackages verbosity distDirLayout + compiler projectConfigShared projectConfigBuildOnly pkgLocations @@ -483,7 +490,7 @@ configureCompiler let extraPath = fromNubList packageConfigProgramPathExtra progdb <- liftIO $ prependProgramSearchPath verbosity extraPath [] defaultProgramDb let progdb' = userSpecifyPaths (Map.toList (getMapLast packageConfigProgramPaths)) progdb - result@(_, _, progdb'') <- + (comp, plat, progdb'') <- liftIO $ Cabal.configCompilerEx hcFlavor @@ -500,7 +507,12 @@ configureCompiler -- programs it cares about, and those are the ones we monitor here. monitorFiles (programsMonitorFiles progdb'') - return result + -- Configure the unconfigured programs in the program database, + -- as we can't serialise unconfigured programs. + -- See also #2241 and #9840. + finalProgDb <- liftIO $ configureAllKnownPrograms verbosity progdb'' + + return (comp, plat, finalProgDb) where hcFlavor = flagToMaybe projectConfigHcFlavor hcPath = flagToMaybe projectConfigHcPath @@ -619,7 +631,7 @@ rebuildInstallPlan -- Configuring other programs. -- - -- Having configred the compiler, now we configure all the remaining + -- Having configured the compiler, now we configure all the remaining -- programs. This is to check we can find them, and to monitor them for -- changes. -- @@ -657,7 +669,7 @@ rebuildInstallPlan -> (Compiler, Platform, ProgramDb) -> [PackageSpecifier UnresolvedSourcePackage] -> InstalledPackageIndex - -> Rebuild (SolverInstallPlan, PkgConfigDb, IndexUtils.TotalIndexState, IndexUtils.ActiveRepos) + -> Rebuild (SolverInstallPlan, Maybe PkgConfigDb, IndexUtils.TotalIndexState, IndexUtils.ActiveRepos) phaseRunSolver projectConfig@ProjectConfig { projectConfigShared @@ -717,7 +729,7 @@ rebuildInstallPlan dieWithException verbosity $ PhaseRunSolverErr msg Right plan -> return (plan, pkgConfigDB, tis, ar) where - corePackageDbs :: [PackageDB] + corePackageDbs :: PackageDBStackCWD corePackageDbs = Cabal.interpretPackageDbFlags False (projectConfigPackageDBs projectConfigShared) @@ -769,7 +781,7 @@ rebuildInstallPlan phaseElaboratePlan :: ProjectConfig -> (Compiler, Platform, ProgramDb) - -> PkgConfigDb + -> Maybe PkgConfigDb -> SolverInstallPlan -> [PackageSpecifier (SourcePackage (PackageLocation loc))] -> Rebuild @@ -889,7 +901,7 @@ reportPlanningFailure projectConfig comp platform pkgSpecifiers = buildReports platform where - -- TODO may want to handle the projectConfigLogFile paramenter here, or just remove it entirely? + -- TODO may want to handle the projectConfigLogFile parameter here, or just remove it entirely? reportFailure = Cabal.fromFlag . projectConfigReportPlanningFailure . projectConfigBuildOnly $ projectConfig pkgids = mapMaybe theSpecifiedPackage pkgSpecifiers @@ -948,7 +960,7 @@ getInstalledPackages -> Compiler -> ProgramDb -> Platform - -> PackageDBStack + -> PackageDBStackCWD -> Rebuild InstalledPackageIndex getInstalledPackages verbosity compiler progdb platform packagedbs = do monitorFiles . map monitorFileOrDirectory @@ -957,7 +969,7 @@ getInstalledPackages verbosity compiler progdb platform packagedbs = do verbosity compiler Nothing -- use ambient working directory - packagedbs + (coercePackageDBStack packagedbs) progdb platform ) @@ -1003,7 +1015,7 @@ getSourcePackages verbosity withRepoCtx idxState activeRepos = do $ repos return sourcePkgDbWithTIS -getPkgConfigDb :: Verbosity -> ProgramDb -> Rebuild PkgConfigDb +getPkgConfigDb :: Verbosity -> ProgramDb -> Rebuild (Maybe PkgConfigDb) getPkgConfigDb verbosity progdb = do dirs <- liftIO $ getPkgConfigDbDirs verbosity progdb -- Just monitor the dirs so we'll notice new .pc files. @@ -1064,25 +1076,29 @@ getPackageSourceHashes verbosity withRepoCtx solverPlan = do -- Tarballs from repositories, either where the repository provides -- hashes as part of the repo metadata, or where we will have to -- download and hash the tarball. - repoTarballPkgsWithMetadataUnvalidated :: [(PackageId, Repo)] - repoTarballPkgsWithoutMetadata :: [(PackageId, Repo)] + repoTarballPkgsWithMetadataUnvalidated :: [(Repo, [PackageId])] + repoTarballPkgsWithoutMetadata :: [(Repo, PackageId)] ( repoTarballPkgsWithMetadataUnvalidated , repoTarballPkgsWithoutMetadata ) = partitionEithers [ case repo of - RepoSecure{} -> Left (pkgid, repo) - _ -> Right (pkgid, repo) + RepoSecure{} -> Left (repo, [pkgid]) + _ -> Right (repo, pkgid) | (pkgid, RepoTarballPackage repo _ _) <- allPkgLocations ] + -- Group up the unvalidated packages by repo so we only read the remote + -- index once per repo (see #10110). The packages are ungrouped here and then regrouped + -- below, it would be better in future to refactor this whole code path so that we don't + -- repeatedly group and ungroup. + repoTarballPkgsWithMetadataUnvalidatedMap = Map.fromListWith (++) repoTarballPkgsWithMetadataUnvalidated + (repoTarballPkgsWithMetadata, repoTarballPkgsToDownloadWithMeta) <- fmap partitionEithers $ liftIO $ - withRepoCtx $ \repoctx -> forM repoTarballPkgsWithMetadataUnvalidated $ - \x@(pkg, repo) -> - verifyFetchedTarball verbosity repoctx repo pkg >>= \b -> case b of - True -> return $ Left x - False -> return $ Right x + withRepoCtx $ \repoctx -> flip concatMapM (Map.toList repoTarballPkgsWithMetadataUnvalidatedMap) $ + \(repo, pkgids) -> + verifyFetchedTarballs verbosity repoctx repo pkgids -- For tarballs from repos that do not have hashes available we now have -- to check if the packages were downloaded already. @@ -1096,9 +1112,9 @@ getPackageSourceHashes verbosity withRepoCtx solverPlan = do [ do mtarball <- checkRepoTarballFetched repo pkgid case mtarball of - Nothing -> return (Left (pkgid, repo)) + Nothing -> return (Left (repo, pkgid)) Just tarball -> return (Right (pkgid, tarball)) - | (pkgid, repo) <- repoTarballPkgsWithoutMetadata + | (repo, pkgid) <- repoTarballPkgsWithoutMetadata ] let repoTarballPkgsToDownload = repoTarballPkgsToDownloadWithMeta ++ repoTarballPkgsToDownloadWithNoMeta @@ -1134,9 +1150,9 @@ getPackageSourceHashes verbosity withRepoCtx solverPlan = do | pkgid <- pkgids ] | (repo, pkgids) <- - map (\grp@((_, repo) :| _) -> (repo, map fst (NE.toList grp))) - . NE.groupBy ((==) `on` (remoteRepoName . repoRemote . snd)) - . sortBy (compare `on` (remoteRepoName . repoRemote . snd)) + map (\grp@((repo, _) :| _) -> (repo, map snd (NE.toList grp))) + . NE.groupBy ((==) `on` (remoteRepoName . repoRemote . fst)) + . sortBy (compare `on` (remoteRepoName . repoRemote . fst)) $ repoTarballPkgsWithMetadata ] @@ -1148,7 +1164,7 @@ getPackageSourceHashes verbosity withRepoCtx solverPlan = do [ do tarball <- fetchRepoTarball verbosity repoctx repo pkgid return (pkgid, tarball) - | (pkgid, repo) <- repoTarballPkgsToDownload + | (repo, pkgid) <- repoTarballPkgsToDownload ] return @@ -1199,7 +1215,7 @@ planPackages -> SolverSettings -> InstalledPackageIndex -> SourcePackageDb - -> PkgConfigDb + -> Maybe PkgConfigDb -> [PackageSpecifier UnresolvedSourcePackage] -> Map PackageName (Map OptionalStanza Bool) -> Progress String String SolverInstallPlan @@ -1522,7 +1538,7 @@ elaborateInstallPlan -> Platform -> Compiler -> ProgramDb - -> PkgConfigDb + -> Maybe PkgConfigDb -> DistDirLayout -> StoreDirLayout -> SolverInstallPlan @@ -1618,13 +1634,18 @@ elaborateInstallPlan (map fst src_comps) let whyNotPerComp = why_not_per_component src_comps case NE.nonEmpty whyNotPerComp of - Nothing -> return comps + Nothing -> do + elaborationWarnings + return comps Just notPerCompReasons -> do checkPerPackageOk comps notPerCompReasons - return - [ elaborateSolverToPackage notPerCompReasons spkg g $ - comps ++ maybeToList setupComponent - ] + pkgComp <- + elaborateSolverToPackage + notPerCompReasons + spkg + g + (comps ++ maybeToList setupComponent) + return [pkgComp] Left cns -> dieProgress $ hang @@ -1687,7 +1708,7 @@ elaborateInstallPlan <+> fsep (punctuate comma $ map (text . whyNotPerComponent) $ toList reasons) -- TODO: Maybe exclude Backpack too - elab0 = elaborateSolverToCommon spkg + (elab0, elaborationWarnings) = elaborateSolverToCommon spkg pkgid = elabPkgSourceId elab0 pd = elabPkgDescription elab0 @@ -1921,7 +1942,7 @@ elaborateInstallPlan ++ " from " ++ prettyShow (elabPkgSourceId elab0) ) - (pkgConfigDbPkgVersion pkgConfigDB pn) + (pkgConfigDB >>= \db -> pkgConfigDbPkgVersion db pn) ) | PkgconfigDependency pn _ <- PD.pkgconfigDepends @@ -1983,7 +2004,7 @@ elaborateInstallPlan -> SolverPackage UnresolvedPkgLoc -> ComponentsGraph -> [ElaboratedConfiguredPackage] - -> ElaboratedConfiguredPackage + -> LogProgress ElaboratedConfiguredPackage elaborateSolverToPackage pkgWhyNotPerComponent pkg@( SolverPackage @@ -1994,13 +2015,14 @@ elaborateInstallPlan _exe_deps0 ) compGraph - comps = + comps = do -- Knot tying: the final elab includes the -- pkgInstalledId, which is calculated by hashing many -- of the other fields of the elaboratedPackage. - elab + elaborationWarnings + return elab where - elab0@ElaboratedConfiguredPackage{..} = + (elab0@ElaboratedConfiguredPackage{..}, elaborationWarnings) = elaborateSolverToCommon pkg elab1 = @@ -2086,7 +2108,7 @@ elaborateInstallPlan elaborateSolverToCommon :: SolverPackage UnresolvedPkgLoc - -> ElaboratedConfiguredPackage + -> (ElaboratedConfiguredPackage, LogProgress ()) elaborateSolverToCommon pkg@( SolverPackage (SourcePackage pkgid gdesc srcloc descOverride) @@ -2095,7 +2117,7 @@ elaborateInstallPlan deps0 _exe_deps0 ) = - elaboratedPackage + (elaboratedPackage, wayWarnings pkgid) where elaboratedPackage = ElaboratedConfiguredPackage{..} @@ -2113,7 +2135,7 @@ elaborateInstallPlan elabPkgDescription = case PD.finalizePD flags elabEnabledSpec - (const True) + (const Satisfied) platform (compilerInfo compiler) [] @@ -2163,6 +2185,13 @@ elaborateInstallPlan elabBuildHaddocks = perPkgOptionFlag pkgid False packageConfigDocumentation + -- `documentation: true` should imply `-haddock` for GHC + addHaddockIfDocumentationEnabled :: ConfiguredProgram -> ConfiguredProgram + addHaddockIfDocumentationEnabled cp@ConfiguredProgram{..} = + if programId == "ghc" && elabBuildHaddocks + then cp{programOverrideArgs = "-haddock" : programOverrideArgs} + else cp + elabPkgSourceLocation = srcloc elabPkgSourceHash = Map.lookup pkgid sourcePackageHashes elabLocalToProject = isLocalToProject pkg @@ -2196,13 +2225,14 @@ elaborateInstallPlan elabBuildOptions = LBC.BuildOptions { withVanillaLib = perPkgOptionFlag pkgid True packageConfigVanillaLib -- TODO: [required feature]: also needs to be handled recursively - , withSharedLib = pkgid `Set.member` pkgsUseSharedLibrary + , withSharedLib = canBuildSharedLibs && pkgid `Set.member` pkgsUseSharedLibrary , withStaticLib = perPkgOptionFlag pkgid False packageConfigStaticLib , withDynExe = perPkgOptionFlag pkgid False packageConfigDynExe , withFullyStaticExe = perPkgOptionFlag pkgid False packageConfigFullyStaticExe , withGHCiLib = perPkgOptionFlag pkgid False packageConfigGHCiLib -- TODO: [required feature] needs to default to enabled on windows still , withProfExe = perPkgOptionFlag pkgid False packageConfigProf - , withProfLib = pkgid `Set.member` pkgsUseProfilingLibrary + , withProfLib = canBuildProfilingLibs && pkgid `Set.member` pkgsUseProfilingLibrary + , withProfLibShared = canBuildProfilingSharedLibs && pkgid `Set.member` pkgsUseProfilingLibraryShared , exeCoverage = perPkgOptionFlag pkgid False packageConfigCoverage , libCoverage = perPkgOptionFlag pkgid False packageConfigCoverage , withOptimization = perPkgOptionFlag pkgid NormalOptimisation packageConfigOptimization @@ -2242,7 +2272,7 @@ elaborateInstallPlan Map.fromList [ (programId prog, args) | prog <- configuredPrograms compilerprogdb - , let args = programOverrideArgs prog + , let args = programOverrideArgs $ addHaddockIfDocumentationEnabled prog , not (null args) ] <> perPkgOptionMapMappend pkgid packageConfigProgramArgs @@ -2271,8 +2301,9 @@ elaborateInstallPlan elabHaddockContents = perPkgOptionMaybe pkgid packageConfigHaddockContents elabHaddockIndex = perPkgOptionMaybe pkgid packageConfigHaddockIndex elabHaddockBaseUrl = perPkgOptionMaybe pkgid packageConfigHaddockBaseUrl - elabHaddockLib = perPkgOptionMaybe pkgid packageConfigHaddockLib + elabHaddockResourcesDir = perPkgOptionMaybe pkgid packageConfigHaddockResourcesDir elabHaddockOutputDir = perPkgOptionMaybe pkgid packageConfigHaddockOutputDir + elabHaddockUseUnicode = perPkgOptionFlag pkgid False packageConfigHaddockUseUnicode elabTestMachineLog = perPkgOptionMaybe pkgid packageConfigTestMachineLog elabTestHumanLog = perPkgOptionMaybe pkgid packageConfigTestHumanLog @@ -2361,35 +2392,112 @@ elaborateInstallPlan pkgsUseSharedLibrary :: Set PackageId pkgsUseSharedLibrary = packagesWithLibDepsDownwardClosedProperty needsSharedLib + + needsSharedLib pkgid = + fromMaybe + compilerShouldUseSharedLibByDefault + -- Case 1: --enable-shared or --disable-shared is passed explicitly, honour that. + ( case pkgSharedLib of + Just v -> Just v + Nothing -> case pkgDynExe of + -- case 2: If --enable-executable-dynamic is passed then turn on + -- shared library generation. + Just True -> + -- Case 3: If --enable-profiling is passed, then we are going to + -- build profiled dynamic, so no need for shared libraries. + case pkgProf of + Just True -> if canBuildProfilingSharedLibs then Nothing else Just True + _ -> Just True + -- But don't necessarily turn off shared library generation if + -- --disable-executable-dynamic is passed. The shared objects might + -- be needed for something different. + _ -> Nothing + ) where - needsSharedLib pkg = - fromMaybe - compilerShouldUseSharedLibByDefault - (liftM2 (||) pkgSharedLib pkgDynExe) - where - pkgid = packageId pkg - pkgSharedLib = perPkgOptionMaybe pkgid packageConfigSharedLib - pkgDynExe = perPkgOptionMaybe pkgid packageConfigDynExe + pkgSharedLib = perPkgOptionMaybe pkgid packageConfigSharedLib + pkgDynExe = perPkgOptionMaybe pkgid packageConfigDynExe + pkgProf = perPkgOptionMaybe pkgid packageConfigProf -- TODO: [code cleanup] move this into the Cabal lib. It's currently open -- coded in Distribution.Simple.Configure, but should be made a proper -- function of the Compiler or CompilerInfo. compilerShouldUseSharedLibByDefault = case compilerFlavor compiler of - GHC -> GHC.isDynamic compiler + GHC -> GHC.compilerBuildWay compiler == DynWay && canBuildSharedLibs GHCJS -> GHCJS.isDynamic compiler _ -> False + compilerShouldUseProfilingLibByDefault = + case compilerFlavor compiler of + GHC -> GHC.compilerBuildWay compiler == ProfWay && canBuildProfilingLibs + _ -> False + + compilerShouldUseProfilingSharedLibByDefault = + case compilerFlavor compiler of + GHC -> GHC.compilerBuildWay compiler == ProfDynWay && canBuildProfilingSharedLibs + _ -> False + + -- Returns False if we definitely can't build shared libs + canBuildWayLibs predicate = case predicate compiler of + Just can_build -> can_build + -- If we don't know for certain, just assume we can + -- which matches behaviour in previous cabal releases + Nothing -> True + + canBuildSharedLibs = canBuildWayLibs dynamicSupported + canBuildProfilingLibs = canBuildWayLibs profilingVanillaSupported + canBuildProfilingSharedLibs = canBuildWayLibs profilingDynamicSupported + + wayWarnings pkg = do + when + (needsProfilingLib pkg && not canBuildProfilingLibs) + (warnProgress (text "Compiler does not support building p libraries, profiling is disabled")) + when + (needsSharedLib pkg && not canBuildSharedLibs) + (warnProgress (text "Compiler does not support building dyn libraries, dynamic libraries are disabled")) + when + (needsProfilingLibShared pkg && not canBuildProfilingSharedLibs) + (warnProgress (text "Compiler does not support building p_dyn libraries, profiling dynamic libraries are disabled.")) + pkgsUseProfilingLibrary :: Set PackageId pkgsUseProfilingLibrary = packagesWithLibDepsDownwardClosedProperty needsProfilingLib + + needsProfilingLib pkg = + fromFlagOrDefault compilerShouldUseProfilingLibByDefault (profBothFlag <> profLibFlag) where - needsProfilingLib pkg = - fromFlagOrDefault False (profBothFlag <> profLibFlag) - where - pkgid = packageId pkg - profBothFlag = lookupPerPkgOption pkgid packageConfigProf - profLibFlag = lookupPerPkgOption pkgid packageConfigProfLib + pkgid = packageId pkg + profBothFlag = lookupPerPkgOption pkgid packageConfigProf + profLibFlag = lookupPerPkgOption pkgid packageConfigProfLib + + pkgsUseProfilingLibraryShared :: Set PackageId + pkgsUseProfilingLibraryShared = + packagesWithLibDepsDownwardClosedProperty needsProfilingLibShared + + needsProfilingLibShared pkg = + fromMaybe + compilerShouldUseProfilingSharedLibByDefault + -- case 1: If --enable-profiling-shared is passed explicitly, honour that + ( case profLibSharedFlag of + Just v -> Just v + Nothing -> case pkgDynExe of + Just True -> + case pkgProf of + -- case 2: --enable-executable-dynamic + --enable-profiling + -- turn on shared profiling libraries + Just True -> if canBuildProfilingSharedLibs then Just True else Nothing + _ -> Nothing + -- But don't necessarily turn off shared library generation is + -- --disable-executable-dynamic is passed. The shared objects might + -- be needed for something different. + _ -> Nothing + ) + where + pkgid = packageId pkg + profLibSharedFlag = perPkgOptionMaybe pkgid packageConfigProfShared + pkgDynExe = perPkgOptionMaybe pkgid packageConfigDynExe + pkgProf = perPkgOptionMaybe pkgid packageConfigProf + -- TODO: [code cleanup] unused: the old deprecated packageConfigProfExe libDepGraph = @@ -2406,7 +2514,7 @@ elaborateInstallPlan libDepGraph [ Graph.nodeKey pkg | pkg <- SolverInstallPlan.toList solverPlan - , property pkg -- just the packages that satisfy the property + , property (packageId pkg) -- just the packages that satisfy the property -- TODO: [nice to have] this does not check the config consistency, -- e.g. a package explicitly turning off profiling, but something -- depending on it that needs profiling. This really needs a separate @@ -3806,22 +3914,31 @@ computeInstallDirs storeDirLayout defaultInstallDirs elaboratedShared elab -- TODO: [code cleanup] perhaps reorder this code -- based on the ElaboratedInstallPlan + ElaboratedSharedConfig, -- make the various Setup.hs {configure,build,copy} flags - setupHsConfigureFlags - :: ElaboratedInstallPlan + :: Monad m + => (FilePath -> m (SymbolicPath Pkg (Dir PkgDB))) + -- ^ How to transform a path which is relative to cabal-install cwd to one which + -- is relative to the route of the package about to be compiled. The simplest way + -- to do this is to convert the potentially relative path into an absolute path. + -> ElaboratedInstallPlan -> ElaboratedReadyPackage -> ElaboratedSharedConfig -> Cabal.CommonSetupFlags - -> Cabal.ConfigFlags + -> m Cabal.ConfigFlags setupHsConfigureFlags + mkSymbolicPath plan (ReadyPackage elab@ElaboratedConfiguredPackage{..}) sharedConfig@ElaboratedSharedConfig{..} - configCommonFlags = - sanityCheckElaboratedConfiguredPackage - sharedConfig - elab - (Cabal.ConfigFlags{..}) + configCommonFlags = do + -- explicitly clear, then our package db stack + -- TODO: [required eventually] have to do this differently for older Cabal versions + configPackageDBs <- (traverse . traverse . traverse) mkSymbolicPath (Nothing : map Just elabBuildPackageDBStack) + return $ + sanityCheckElaboratedConfiguredPackage + sharedConfig + elab + Cabal.ConfigFlags{..} where Cabal.ConfigFlags { configVanillaLib @@ -3832,6 +3949,7 @@ setupHsConfigureFlags , configGHCiLib , -- , configProfExe -- overridden configProfLib + , configProfShared , -- , configProf -- overridden configProfDetail , configProfLibDetail @@ -3913,7 +4031,7 @@ setupHsConfigureFlags ] configPromisedDependencies = - [ cidToGivenComponent cid + [ cidToPromisedComponent cid | (cid, is_internal) <- elabLibDependencies elab , is_internal ] @@ -3926,10 +4044,6 @@ setupHsConfigureFlags ] ElabComponent _ -> [] - -- explicitly clear, then our package db stack - -- TODO: [required eventually] have to do this differently for older Cabal versions - configPackageDBs = Nothing : map Just elabBuildPackageDBStack - configTests = case elabPkgOrComp of ElabPackage pkg -> toFlag (TestStanzas `optStanzaSetMember` pkgStanzasEnabled pkg) ElabComponent _ -> mempty @@ -3944,6 +4058,7 @@ setupHsConfigureFlags configPrograms_ = mempty -- never use, shouldn't exist configUseResponseFiles = mempty configAllowDependingOnPrivateLibs = Flag $ not $ libraryVisibilitySupported pkgConfigCompiler + configIgnoreBuildTools = mempty cidToGivenComponent :: ConfiguredId -> GivenComponent cidToGivenComponent (ConfiguredId srcid mb_cn cid) = GivenComponent (packageName srcid) ln cid @@ -3953,7 +4068,16 @@ setupHsConfigureFlags Just _ -> error "non-library dependency" Nothing -> LMainLibName - configCoverageFor = determineCoverageFor elabPkgSourceId plan + configCoverageFor = determineCoverageFor elab plan + + cidToPromisedComponent :: ConfiguredId -> PromisedComponent + cidToPromisedComponent (ConfiguredId srcid mb_cn cid) = + PromisedComponent srcid ln cid + where + ln = case mb_cn of + Just (CLibName lname) -> lname + Just _ -> error "non-library dependency" + Nothing -> LMainLibName setupHsConfigureArgs :: ElaboratedConfiguredPackage @@ -3971,14 +4095,16 @@ setupHsCommonFlags :: Verbosity -> Maybe (SymbolicPath CWD (Dir Pkg)) -> SymbolicPath Pkg (Dir Dist) + -> Bool -> Cabal.CommonSetupFlags -setupHsCommonFlags verbosity mbWorkDir builddir = +setupHsCommonFlags verbosity mbWorkDir builddir keepTempFiles = Cabal.CommonSetupFlags { setupDistPref = toFlag builddir , setupVerbosity = toFlag verbosity , setupCabalFilePath = mempty , setupWorkingDir = maybeToFlag mbWorkDir , setupTargets = [] + , setupKeepTempFiles = toFlag keepTempFiles } setupHsBuildFlags @@ -4091,7 +4217,7 @@ setupHsRegisterFlags { registerCommonFlags = common , regPackageDB = mempty -- misfeature , regGenScript = mempty -- never use - , regGenPkgConf = toFlag (Just pkgConfFile) + , regGenPkgConf = toFlag (Just (makeSymbolicPath pkgConfFile)) , regInPlace = case elabBuildStyle of BuildInplaceOnly{} -> toFlag True BuildAndInstall -> toFlag False @@ -4107,7 +4233,7 @@ setupHsHaddockFlags setupHsHaddockFlags (ElaboratedConfiguredPackage{..}) (ElaboratedSharedConfig{..}) - (BuildTimeSettings{buildSettingKeepTempFiles = keepTmpFiles}) + _buildTimeSettings common = Cabal.HaddockFlags { haddockCommonFlags = common @@ -4135,11 +4261,11 @@ setupHsHaddockFlags , haddockQuickJump = toFlag elabHaddockQuickJump , haddockHscolourCss = maybe mempty toFlag elabHaddockHscolourCss , haddockContents = maybe mempty toFlag elabHaddockContents - , haddockKeepTempFiles = toFlag keepTmpFiles , haddockIndex = maybe mempty toFlag elabHaddockIndex , haddockBaseUrl = maybe mempty toFlag elabHaddockBaseUrl - , haddockLib = maybe mempty toFlag elabHaddockLib + , haddockResourcesDir = maybe mempty toFlag elabHaddockResourcesDir , haddockOutputDir = maybe mempty toFlag elabHaddockOutputDir + , haddockUseUnicode = toFlag elabHaddockUseUnicode } setupHsHaddockArgs :: ElaboratedConfiguredPackage -> [String] @@ -4296,8 +4422,9 @@ packageHashConfigInputs shared@ElaboratedSharedConfig{..} pkg = , pkgHashHaddockContents = elabHaddockContents , pkgHashHaddockIndex = elabHaddockIndex , pkgHashHaddockBaseUrl = elabHaddockBaseUrl - , pkgHashHaddockLib = elabHaddockLib + , pkgHashHaddockResourcesDir = elabHaddockResourcesDir , pkgHashHaddockOutputDir = elabHaddockOutputDir + , pkgHashHaddockUseUnicode = elabHaddockUseUnicode } where ElaboratedConfiguredPackage{..} = normaliseConfiguredPackage shared pkg @@ -4362,13 +4489,14 @@ inplaceBinRoot layout config package = -- The list of non-pre-existing libraries without module holes, i.e. the -- main library and sub-libraries components of all the local packages in --- the project that do not require instantiations or are instantiations. +-- the project that are dependencies of the components being built and that do +-- not require instantiations or are instantiations. determineCoverageFor - :: PackageId - -- ^ The 'PackageId' of the package or component being configured + :: ElaboratedConfiguredPackage + -- ^ The package or component being configured -> ElaboratedInstallPlan -> Flag [UnitId] -determineCoverageFor configuredPkgSourceId plan = +determineCoverageFor configuredPkg plan = Flag $ mapMaybe ( \case @@ -4381,15 +4509,18 @@ determineCoverageFor configuredPkgSourceId plan = $ Graph.toList $ InstallPlan.toGraph plan where - shouldCoverPkg elab@ElaboratedConfiguredPackage{elabModuleShape, elabPkgSourceId, elabLocalToProject} = + libDeps = elabLibDependencies configuredPkg + shouldCoverPkg elab@ElaboratedConfiguredPackage{elabModuleShape, elabPkgSourceId = pkgSID, elabLocalToProject} = elabLocalToProject && not (isIndefiniteOrInstantiation elabModuleShape) -- TODO(#9493): We can only cover libraries in the same package -- as the testsuite - && configuredPkgSourceId == elabPkgSourceId + && elabPkgSourceId configuredPkg == pkgSID -- Libraries only! We don't cover testsuite modules, so we never need -- the paths to their mix dirs. Furthermore, we do not install testsuites... && maybe False (\case CLibName{} -> True; CNotLibName{} -> False) (elabComponentName elab) + -- We only want coverage for libraries which are dependencies of the given one + && pkgSID `elem` map (confSrcId . fst) libDeps isIndefiniteOrInstantiation :: ModuleShape -> Bool isIndefiniteOrInstantiation = not . Set.null . modShapeRequires diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs b/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs index 212a5d93f81..a510ea2bff6 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning/SetupPolicy.hs @@ -133,11 +133,10 @@ mkDefaultSetupDeps compiler platform pkg = -- For other build types (like Simple) if we still need to compile an -- external Setup.hs, it'll be one of the simple ones that only depends - -- on Cabal and base. + -- on Cabal. SetupNonCustomExternalLib -> Just [ Dependency cabalPkgname cabalConstraint mainLibSet - , Dependency basePkgname anyVersion mainLibSet ] where cabalConstraint = orLaterVersion (csvToVersion (specVersion pkg)) @@ -217,9 +216,8 @@ packageSetupScriptSpecVersion _ pkg libDepGraph deps = fromMaybe [] $ Graph.closure libDepGraph (CD.setupDeps deps) -cabalPkgname, basePkgname :: PackageName +cabalPkgname :: PackageName cabalPkgname = mkPackageName "Cabal" -basePkgname = mkPackageName "base" legacyCustomSetupPkgs :: Compiler -> Platform -> [PackageName] legacyCustomSetupPkgs compiler (Platform _ os) = diff --git a/cabal-install/src/Distribution/Client/ProjectPlanning/Types.hs b/cabal-install/src/Distribution/Client/ProjectPlanning/Types.hs index 5b4896b0568..7ee5cb52f41 100644 --- a/cabal-install/src/Distribution/Client/ProjectPlanning/Types.hs +++ b/cabal-install/src/Distribution/Client/ProjectPlanning/Types.hs @@ -1,10 +1,8 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} -- | Types used while planning how to build everything in a project. @@ -193,7 +191,7 @@ data ElaboratedSharedConfig = ElaboratedSharedConfig -- used. , pkgConfigReplOptions :: ReplOptions } - deriving (Show, Generic, Typeable) + deriving (Show, Generic) -- TODO: [code cleanup] no Eq instance @@ -262,13 +260,13 @@ data ElaboratedConfiguredPackage = ElaboratedConfiguredPackage -- that a user enabled tests globally, and some local packages -- just happen not to have any tests. (But perhaps we should -- warn if ALL local packages don't have any tests.) - , elabPackageDbs :: [Maybe PackageDB] - , elabSetupPackageDBStack :: PackageDBStack - , elabBuildPackageDBStack :: PackageDBStack - , elabRegisterPackageDBStack :: PackageDBStack - , elabInplaceSetupPackageDBStack :: PackageDBStack - , elabInplaceBuildPackageDBStack :: PackageDBStack - , elabInplaceRegisterPackageDBStack :: PackageDBStack + , elabPackageDbs :: [Maybe PackageDBCWD] + , elabSetupPackageDBStack :: PackageDBStackCWD + , elabBuildPackageDBStack :: PackageDBStackCWD + , elabRegisterPackageDBStack :: PackageDBStackCWD + , elabInplaceSetupPackageDBStack :: PackageDBStackCWD + , elabInplaceBuildPackageDBStack :: PackageDBStackCWD + , elabInplaceRegisterPackageDBStack :: PackageDBStackCWD , elabPkgDescriptionOverride :: Maybe CabalFileText , -- TODO: make per-component variants of these flags elabBuildOptions :: LBC.BuildOptions @@ -300,8 +298,9 @@ data ElaboratedConfiguredPackage = ElaboratedConfiguredPackage , elabHaddockContents :: Maybe PathTemplate , elabHaddockIndex :: Maybe PathTemplate , elabHaddockBaseUrl :: Maybe String - , elabHaddockLib :: Maybe String + , elabHaddockResourcesDir :: Maybe String , elabHaddockOutputDir :: Maybe FilePath + , elabHaddockUseUnicode :: Bool , elabTestMachineLog :: Maybe PathTemplate , elabTestHumanLog :: Maybe PathTemplate , elabTestShowDetails :: Maybe TestShowDetails @@ -337,7 +336,7 @@ data ElaboratedConfiguredPackage = ElaboratedConfiguredPackage elabPkgOrComp :: ElaboratedPackageOrComponent -- ^ Component/package specific information } - deriving (Eq, Show, Generic, Typeable) + deriving (Eq, Show, Generic) normaliseConfiguredPackage :: ElaboratedSharedConfig @@ -933,7 +932,7 @@ data SetupScriptStyle | SetupCustomImplicitDeps | SetupNonCustomExternalLib | SetupNonCustomInternalLib - deriving (Eq, Show, Generic, Typeable) + deriving (Eq, Show, Generic) instance Binary SetupScriptStyle instance Structured SetupScriptStyle diff --git a/cabal-install/src/Distribution/Client/RebuildMonad.hs b/cabal-install/src/Distribution/Client/RebuildMonad.hs index 2950d9f7a30..e6450addabc 100644 --- a/cabal-install/src/Distribution/Client/RebuildMonad.hs +++ b/cabal-install/src/Distribution/Client/RebuildMonad.hs @@ -1,6 +1,7 @@ {-# LANGUAGE BangPatterns #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} +{-# LANGUAGE LambdaCase #-} {-# LANGUAGE ScopedTypeVariables #-} -- | An abstraction for re-running actions if values or files have changed. @@ -42,6 +43,7 @@ module Distribution.Client.RebuildMonad , FileMonitor (..) , newFileMonitor , rerunIfChanged + , rerunConcurrentlyIfChanged -- * Utils , delayInitSharedResource @@ -64,11 +66,13 @@ import Prelude () import Distribution.Client.FileMonitor import Distribution.Client.Glob hiding (matchFileGlob) import qualified Distribution.Client.Glob as Glob (matchFileGlob) +import Distribution.Client.JobControl import Distribution.Simple.PreProcess.Types (Suffix (..)) import Distribution.Simple.Utils (debug) import Control.Concurrent.MVar (MVar, modifyMVar, newMVar) +import Control.Monad import Control.Monad.Reader as Reader import Control.Monad.State as State import qualified Data.Map.Strict as Map @@ -123,39 +127,61 @@ rerunIfChanged -> Rebuild b -> Rebuild b rerunIfChanged verbosity monitor key action = do + -- rerunIfChanged is implemented in terms of rerunConcurrentlyIfChanged, but + -- nothing concurrent will happen since the list of concurrent actions has a + -- single value that will be waited for alone. + rerunConcurrentlyIfChanged verbosity newSerialJobControl [(monitor, key, action)] >>= \case + [x] -> return x + _ -> error "rerunIfChanged: impossible!" + +-- | Like 'rerunIfChanged' meets 'mapConcurrently': For when we want multiple actions +-- that need to do be re-run-if-changed asynchronously. The function returns +-- when all values have finished computing. +rerunConcurrentlyIfChanged + :: (Binary a, Structured a, Binary b, Structured b) + => Verbosity + -> IO (JobControl IO (b, [MonitorFilePath])) + -> [(FileMonitor a b, a, Rebuild b)] + -> Rebuild [b] +rerunConcurrentlyIfChanged verbosity mkJobControl triples = do rootDir <- askRoot - changed <- liftIO $ checkFileMonitorChanged monitor rootDir key - case changed of - MonitorUnchanged result files -> do - liftIO $ - debug verbosity $ - "File monitor '" - ++ monitorName - ++ "' unchanged." - monitorFiles files - return result - MonitorChanged reason -> do - liftIO $ - debug verbosity $ - "File monitor '" - ++ monitorName - ++ "' changed: " - ++ showReason reason - startTime <- liftIO $ beginUpdateFileMonitor - (result, files) <- liftIO $ unRebuild rootDir action - liftIO $ - updateFileMonitor - monitor - rootDir - (Just startTime) - files - key - result - monitorFiles files - return result - where - monitorName = takeFileName (fileMonitorCacheFile monitor) + dacts <- forM triples $ \(monitor, key, action) -> do + let monitorName = takeFileName (fileMonitorCacheFile monitor) + changed <- liftIO $ checkFileMonitorChanged monitor rootDir key + case changed of + MonitorUnchanged result files -> do + liftIO $ + debug verbosity $ + "File monitor '" + ++ monitorName + ++ "' unchanged." + monitorFiles files + return (return (result, [])) + MonitorChanged reason -> do + liftIO $ + debug verbosity $ + "File monitor '" + ++ monitorName + ++ "' changed: " + ++ showReason reason + return $ do + startTime <- beginUpdateFileMonitor + (result, files) <- unRebuild rootDir action + updateFileMonitor + monitor + rootDir + (Just startTime) + files + key + result + return (result, files) + (results, files) <- liftIO $ + withJobControl mkJobControl $ \jobControl -> do + unzip <$> mapConcurrentWithJobs jobControl id dacts + monitorFiles (concat files) + return results + where showReason (MonitoredFileChanged file) = "file " ++ file showReason (MonitoredValueChanged _) = "monitor value changed" showReason MonitorFirstRun = "first run" diff --git a/cabal-install/src/Distribution/Client/ReplFlags.hs b/cabal-install/src/Distribution/Client/ReplFlags.hs index a7136aa572d..0d587b1d501 100644 --- a/cabal-install/src/Distribution/Client/ReplFlags.hs +++ b/cabal-install/src/Distribution/Client/ReplFlags.hs @@ -27,7 +27,6 @@ import Distribution.Simple.Setup , falseArg , replOptions , toFlag - , trueArg ) import Distribution.Types.Dependency ( Dependency (..) @@ -55,11 +54,10 @@ data ReplFlags = ReplFlags { configureReplOptions :: ReplOptions , replEnvFlags :: EnvFlags , replUseMulti :: Flag Bool - , replKeepTempFiles :: Flag Bool } instance Semigroup ReplFlags where - (ReplFlags a1 a2 a3 a4) <> (ReplFlags b1 b2 b3 b4) = ReplFlags (a1 <> b1) (a2 <> b2) (a3 <> b3) (a4 <> b4) + (ReplFlags a1 a2 a3) <> (ReplFlags b1 b2 b3) = ReplFlags (a1 <> b1) (a2 <> b2) (a3 <> b3) instance Monoid ReplFlags where mempty = defaultReplFlags @@ -70,7 +68,6 @@ defaultReplFlags = { configureReplOptions = mempty , replEnvFlags = defaultEnvFlags , replUseMulti = NoFlag - , replKeepTempFiles = NoFlag } topReplOptions :: ShowOrParseArgs -> [OptionField ReplFlags] @@ -78,18 +75,6 @@ topReplOptions showOrParseArgs = liftOptions configureReplOptions set1 (replOptions showOrParseArgs) ++ liftOptions replEnvFlags set2 (envOptions showOrParseArgs) ++ [ liftOption replUseMulti set3 multiReplOption - , -- keeping temporary files is important functionality for HLS, - -- which runs @cabal repl@ with fake GHC to get cli arguments. - -- It will need the temporary files (incl. multi unit repl response files) - -- to stay, even after the @cabal repl@ command exits. - -- - option - [] - ["keep-temp-files"] - "Keep temporary files" - replKeepTempFiles - (\b flags -> flags{replKeepTempFiles = b}) - trueArg ] where set1 a x = x{configureReplOptions = a} diff --git a/cabal-install/src/Distribution/Client/Run.hs b/cabal-install/src/Distribution/Client/Run.hs index 0c3e5c89e8a..7ff4c8bb5e8 100644 --- a/cabal-install/src/Distribution/Client/Run.hs +++ b/cabal-install/src/Distribution/Client/Run.hs @@ -27,7 +27,7 @@ import Distribution.PackageDescription , PackageDescription (..) , TestSuite (..) ) -import Distribution.Simple (PackageDB (..)) +import Distribution.Simple (PackageDBX (..)) import Distribution.Simple.Build (addInternalBuildTools) import Distribution.Simple.BuildPaths (exeExtension) import Distribution.Simple.Compiler (CompilerFlavor (..), compilerFlavor) @@ -148,7 +148,7 @@ run verbosity lbi exe exeArgs = do pkg_descr = localPkgDescr lbi i = interpretSymbolicPathLBI lbi -- See Note [Symbolic paths] in Distribution.Utils.Path mbWorkDir = mbWorkDirLBI lbi - internalPkgDb = i $ internalPackageDBPath lbi distPref + internalPkgDb = internalPackageDBPath lbi distPref lbiForExe = lbi { withPackageDB = withPackageDB lbi ++ [SpecificPackageDB internalPkgDb] diff --git a/cabal-install/src/Distribution/Client/SavedFlags.hs b/cabal-install/src/Distribution/Client/SavedFlags.hs index 1a598a58fd7..1f752e11bd4 100644 --- a/cabal-install/src/Distribution/Client/SavedFlags.hs +++ b/cabal-install/src/Distribution/Client/SavedFlags.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} - module Distribution.Client.SavedFlags ( readCommandFlags , writeCommandFlags @@ -67,7 +65,6 @@ data SavedArgsError = SavedArgsErrorHelp Args | SavedArgsErrorList Args | SavedArgsErrorOther Args [String] - deriving (Typeable) instance Show SavedArgsError where show (SavedArgsErrorHelp args) = diff --git a/cabal-install/src/Distribution/Client/ScriptUtils.hs b/cabal-install/src/Distribution/Client/ScriptUtils.hs index aeae4eaf459..f397f4342c5 100644 --- a/cabal-install/src/Distribution/Client/ScriptUtils.hs +++ b/cabal-install/src/Distribution/Client/ScriptUtils.hs @@ -305,9 +305,9 @@ withContextAndSelectors noTargets kind flags@NixStyleFlags{..} targetStrings glo (withGlobalConfig verbosity globalConfigFlag $ withoutProject mkTmpDir) (tc', ctx', sels) <- case targetStrings of - -- Only script targets may contain spaces and or end with ':'. + -- Only script targets may end with ':'. -- Trying to readTargetSelectors such a target leads to a parse error. - [target] | any (\c -> isSpace c) target || ":" `isSuffixOf` target -> do + [target] | ":" `isSuffixOf` target -> do scriptOrError target [TargetSelectorNoScript $ TargetString1 target] _ -> do -- In the case where a selector is both a valid target and script, assume it is a target, @@ -381,7 +381,7 @@ withContextAndSelectors noTargets kind flags@NixStyleFlags{..} targetStrings glo createDirectoryIfMissingVerbose verbosity True (distProjectCacheDirectory $ distDirLayout ctx) (compiler, platform@(Platform arch os), _) <- runRebuild projectRoot $ configureCompiler verbosity (distDirLayout ctx) (fst (ignoreConditions projectCfgSkeleton) <> projectConfig ctx) - projectCfg <- instantiateProjectConfigSkeletonFetchingCompiler (pure (os, arch, compilerInfo compiler)) mempty projectCfgSkeleton + let projectCfg = instantiateProjectConfigSkeletonFetchingCompiler (os, arch, compilerInfo compiler) mempty projectCfgSkeleton let ctx' = ctx & lProjectConfig %~ (<> projectCfg) @@ -414,8 +414,8 @@ withTemporaryTempDirectory act = newEmptyMVar >>= \m -> bracket (getMkTmp m) (rm return tmpDir rmTmp m _ = tryTakeMVar m >>= maybe (return ()) (handleDoesNotExist () . removeDirectoryRecursive) -scriptComponenetName :: IsString s => FilePath -> s -scriptComponenetName scriptPath = fromString cname +scriptComponentName :: IsString s => FilePath -> s +scriptComponentName scriptPath = fromString cname where cname = "script-" ++ map censor (takeFileName scriptPath) censor c @@ -437,7 +437,7 @@ scriptDistDirParams scriptPath ctx compiler platform = , distParamOptimization = fromFlagOrDefault NormalOptimisation optimization } where - cn = scriptComponenetName scriptPath + cn = scriptComponentName scriptPath cid = mkComponentId $ prettyShow fakePackageId <> "-inplace-" <> prettyShow cn optimization = (packageConfigOptimization . projectConfigLocalPackages . projectConfig) ctx @@ -475,7 +475,7 @@ updateContextAndWriteProjectFile ctx scriptPath scriptExecutable = do sourcePackage = fakeProjectSourcePackage projectRoot & lSrcpkgDescription . L.condExecutables - .~ [(scriptComponenetName scriptPath, CondNode executable (targetBuildDepends $ buildInfo executable) [])] + .~ [(scriptComponentName scriptPath, CondNode executable (targetBuildDepends $ buildInfo executable) [])] executable = scriptExecutable & L.modulePath .~ absScript diff --git a/cabal-install/src/Distribution/Client/Security/HTTP.hs b/cabal-install/src/Distribution/Client/Security/HTTP.hs index f433c61ab21..9e2da46f631 100644 --- a/cabal-install/src/Distribution/Client/Security/HTTP.hs +++ b/cabal-install/src/Distribution/Client/Security/HTTP.hs @@ -1,8 +1,6 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE StandaloneDeriving #-} @@ -180,7 +178,6 @@ mkReqHeaders reqHeaders mRange' = -------------------------------------------------------------------------------} data UnexpectedResponse = UnexpectedResponse URI Int - deriving (Typeable) instance HC.Pretty UnexpectedResponse where pretty (UnexpectedResponse uri code) = @@ -189,13 +186,8 @@ instance HC.Pretty UnexpectedResponse where ++ " for " ++ show uri -#if MIN_VERSION_base(4,8,0) deriving instance Show UnexpectedResponse instance Exception UnexpectedResponse where displayException = HC.pretty -#else -instance Show UnexpectedResponse where show = HC.pretty -instance Exception UnexpectedResponse -#endif wrapCustomEx :: ( ( HC.Throws UnexpectedResponse diff --git a/cabal-install/src/Distribution/Client/Setup.hs b/cabal-install/src/Distribution/Client/Setup.hs index ae21e7f3799..c68f0dec44a 100644 --- a/cabal-install/src/Distribution/Client/Setup.hs +++ b/cabal-install/src/Distribution/Client/Setup.hs @@ -1,7 +1,6 @@ {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} ----------------------------------------------------------------------------- @@ -35,12 +34,15 @@ module Distribution.Client.Setup , defaultConfigExFlags , buildCommand , BuildFlags (..) + , filterBuildFlags , filterTestFlags , replCommand + , filterReplFlags , testCommand , benchmarkCommand , testOptions , benchmarkOptions + , filterBenchmarkFlags , configureExOptions , reconfigureCommand , installCommand @@ -87,7 +89,9 @@ module Distribution.Client.Setup , haddockCommand , cleanCommand , copyCommand + , filterCopyFlags , registerCommand + , filterRegisterFlags , liftOptions , yesNoOpt ) where @@ -183,7 +187,7 @@ import Distribution.Simple.InstallDirs ) import Distribution.Simple.Program (ProgramDb, defaultProgramDb) import Distribution.Simple.Setup - ( BenchmarkFlags + ( BenchmarkFlags (benchmarkCommonFlags) , BooleanFlag (..) , BuildFlags (..) , CleanFlags (..) @@ -192,7 +196,7 @@ import Distribution.Simple.Setup , CopyFlags (..) , HaddockFlags (..) , RegisterFlags (..) - , ReplFlags + , ReplFlags (..) , TestFlags , boolOpt , boolOpt' @@ -210,7 +214,9 @@ import Distribution.Simple.Utils import Distribution.System (Platform) import Distribution.Types.GivenComponent ( GivenComponent (..) + , PromisedComponent (..) ) +import Distribution.Types.PackageId import Distribution.Types.PackageVersionConstraint ( PackageVersionConstraint (..) ) @@ -226,6 +232,7 @@ import Distribution.Verbosity import Distribution.Version ( Version , mkVersion + , nullVersion ) import Control.Exception @@ -644,9 +651,11 @@ filterCommonFlags flags cabalLibVersion flags_latest = flags flags_3_13_0 = flags_latest - { setupWorkingDir = NoFlag + { -- Cabal < 3.13 does not support the --working-dir flag. + setupWorkingDir = NoFlag + , -- Or the --keep-temp-files flag. + setupKeepTempFiles = NoFlag } - -- Cabal < 3.13 does not support the --working-dir flag. flags_2_1_0 = flags_3_13_0 { -- Cabal < 2.1 doesn't know about -v +timestamp modifier @@ -679,7 +688,7 @@ filterConfigureFlags' :: ConfigFlags -> Version -> ConfigFlags filterConfigureFlags' flags cabalLibVersion -- NB: we expect the latest version to be the most common case, -- so test it first. - | cabalLibVersion >= mkVersion [3, 11, 0] = flags_latest + | cabalLibVersion >= mkVersion [3, 13, 0] = flags_latest -- The naming convention is that flags_version gives flags with -- all flags *introduced* in version eliminated. -- It is NOT the latest version of Cabal library that @@ -701,6 +710,7 @@ filterConfigureFlags' flags cabalLibVersion | cabalLibVersion < mkVersion [2, 5, 0] = flags_2_5_0 | cabalLibVersion < mkVersion [3, 7, 0] = flags_3_7_0 | cabalLibVersion < mkVersion [3, 11, 0] = flags_3_11_0 + | cabalLibVersion < mkVersion [3, 13, 0] = flags_3_13_0 | otherwise = error "the impossible just happened" -- see first guard where flags_latest = @@ -712,8 +722,26 @@ filterConfigureFlags' flags cabalLibVersion configConstraints = [] } + flags_3_13_0 = + let scrubVersion pc = + pc + { promisedComponentPackage = + (promisedComponentPackage pc){pkgVersion = nullVersion} + } + in -- Earlier Cabal versions don't understand about .. + flags_latest + { -- Building profiled shared libraries + configProfShared = NoFlag + , configIgnoreBuildTools = NoFlag + , -- Older versions of Cabal don't include the package version in the + -- --promised-dependency flag, by setting the version to nullVersion, + -- it won't be printed. + configPromisedDependencies = + map scrubVersion (configPromisedDependencies flags) + } + flags_3_11_0 = - flags_latest + flags_3_13_0 { -- It's too late to convert configPromisedDependencies to anything -- meaningful, so we just assert that it's empty. -- We add a Cabal>=3.11 constraint before solving when multi-repl is @@ -783,7 +811,7 @@ filterConfigureFlags' flags cabalLibVersion -- Cabal < 1.23 doesn't know about '--profiling-detail'. -- Cabal < 1.23 has a hacked up version of 'enable-profiling' -- which we shouldn't use. - (tryLibProfiling, tryExeProfiling) = computeEffectiveProfiling flags + (tryLibProfiling, _tryLibProfilingShared, tryExeProfiling) = computeEffectiveProfiling flags flags_1_23_0 = flags_1_25_0 { configProfDetail = NoFlag @@ -1122,6 +1150,21 @@ buildCommand = where parent = Cabal.buildCommand defaultProgramDb +-- | Given some 'BuildFlags' for the version of @Cabal@ that +-- @cabal-install@ was built with, and a target older 'Version' of +-- @Cabal@ that we want to pass these flags to, convert the +-- flags into a form that will be accepted by the older +-- @Setup@ script. Generally speaking, this just means filtering +-- out flags that the old @Cabal@ library doesn't understand, but +-- in some cases it may also mean "emulating" a feature using +-- some more legacy flags. +filterBuildFlags :: BuildFlags -> Version -> BuildFlags +filterBuildFlags flags cabalLibVersion = + flags + { buildCommonFlags = + filterCommonFlags (buildCommonFlags flags) cabalLibVersion + } + -- ------------------------------------------------------------ -- * Test flags @@ -1214,6 +1257,24 @@ replCommand = where parent = Cabal.replCommand defaultProgramDb +-- | Given some 'ReplFlags' for the version of @Cabal@ that +-- @cabal-install@ was built with, and a target older 'Version' of +-- @Cabal@ that we want to pass these flags to, convert the +-- flags into a form that will be accepted by the older +-- @Setup@ script. Generally speaking, this just means filtering +-- out flags that the old @Cabal@ library doesn't understand, but +-- in some cases it may also mean "emulating" a feature using +-- some more legacy flags. +filterReplFlags :: ReplFlags -> Version -> ReplFlags +filterReplFlags flags cabalLibVersion = + flags + { replCommonFlags = + (filterCommonFlags (replCommonFlags flags) cabalLibVersion) + { -- `cabal repl` knew about `--keep-temp-files` before other commands did. + setupKeepTempFiles = setupKeepTempFiles (replCommonFlags flags) + } + } + -- ------------------------------------------------------------ -- * Test command @@ -1309,6 +1370,21 @@ benchmarkCommand = parent = Cabal.benchmarkCommand progDb = defaultProgramDb +-- | Given some 'BenchmarkFlags' for the version of @Cabal@ that +-- @cabal-install@ was built with, and a target older 'Version' of +-- @Cabal@ that we want to pass these flags to, convert the +-- flags into a form that will be accepted by the older +-- @Setup@ script. Generally speaking, this just means filtering +-- out flags that the old @Cabal@ library doesn't understand, but +-- in some cases it may also mean "emulating" a feature using +-- some more legacy flags. +filterBenchmarkFlags :: BenchmarkFlags -> Version -> BenchmarkFlags +filterBenchmarkFlags flags cabalLibVersion = + flags + { benchmarkCommonFlags = + filterCommonFlags (benchmarkCommonFlags flags) cabalLibVersion + } + -- ------------------------------------------------------------ -- * Fetch command @@ -1599,7 +1675,7 @@ data CheckFlags = CheckFlags { checkVerbosity :: Flag Verbosity , checkIgnore :: [CheckExplanationIDString] } - deriving (Show, Typeable) + deriving (Show) defaultCheckFlags :: CheckFlags defaultCheckFlags = @@ -2382,21 +2458,28 @@ filterHaddockArgs args cabalLibVersion -- Cabal < 2.3 doesn't know about per-component haddock args_2_3_0 = [] +-- | Given some 'HaddockFlags' for the version of @Cabal@ that +-- @cabal-install@ was built with, and a target older 'Version' of +-- @Cabal@ that we want to pass these flags to, convert the +-- flags into a form that will be accepted by the older +-- @Setup@ script. Generally speaking, this just means filtering +-- out flags that the old @Cabal@ library doesn't understand, but +-- in some cases it may also mean "emulating" a feature using +-- some more legacy flags. filterHaddockFlags :: HaddockFlags -> Version -> HaddockFlags -filterHaddockFlags flags cabalLibVersion = - let flags' = filterHaddockFlags' flags cabalLibVersion - in flags' - { haddockCommonFlags = - filterCommonFlags (haddockCommonFlags flags') cabalLibVersion - } - -filterHaddockFlags' :: HaddockFlags -> Version -> HaddockFlags -filterHaddockFlags' flags cabalLibVersion +filterHaddockFlags flags cabalLibVersion | cabalLibVersion >= mkVersion [2, 3, 0] = flags_latest | cabalLibVersion < mkVersion [2, 3, 0] = flags_2_3_0 | otherwise = flags_latest where - flags_latest = flags + flags_latest = + flags + { haddockCommonFlags = + (filterCommonFlags (haddockCommonFlags flags) cabalLibVersion) + { -- `cabal haddock` knew about `--keep-temp-files` before other commands did. + setupKeepTempFiles = setupKeepTempFiles (haddockCommonFlags flags) + } + } flags_2_3_0 = flags_latest @@ -2435,8 +2518,9 @@ haddockOptions showOrParseArgs = , "use-index" , "for-hackage" , "base-url" - , "lib" + , "resources-dir" , "output-dir" + , "use-unicode" ] ] @@ -2467,6 +2551,9 @@ testOptions showOrParseArgs = | "test-" `isPrefixOf` name = name | otherwise = "test-" ++ name +-- | Options for the @bench@ command. +-- +-- Not to be confused with the @benchmarkOptions@ field of the `BenchmarkFlags` record! benchmarkOptions :: ShowOrParseArgs -> [OptionField BenchmarkFlags] benchmarkOptions showOrParseArgs = [ opt @@ -3294,6 +3381,35 @@ registerCommand = { commandUsage = \pname -> "Usage: " ++ pname ++ " v1-register [FLAGS]\n" } +-- | Given some 'RegisterFlags' for the version of @Cabal@ that +-- @cabal-install@ was built with, and a target older 'Version' of +-- @Cabal@ that we want to pass these flags to, convert the +-- flags into a form that will be accepted by the older +-- @Setup@ script. Generally speaking, this just means filtering +-- out flags that the old @Cabal@ library doesn't understand, but +-- in some cases it may also mean "emulating" a feature using +-- some more legacy flags. +filterRegisterFlags :: RegisterFlags -> Version -> RegisterFlags +filterRegisterFlags flags cabalLibVersion = + flags + { registerCommonFlags = + filterCommonFlags (registerCommonFlags flags) cabalLibVersion + } + +-- | Given some 'CopyFlags' for the version of @Cabal@ that +-- @cabal-install@ was built with, and a target older 'Version' of +-- @Cabal@ that we want to pass these flags to, convert the +-- flags into a form that will be accepted by the older +-- @Setup@ script. Generally speaking, this just means filtering +-- out flags that the old @Cabal@ library doesn't understand, but +-- in some cases it may also mean "emulating" a feature using +-- some more legacy flags. +filterCopyFlags :: CopyFlags -> Version -> CopyFlags +filterCopyFlags flags cabalLibVersion = + flags + { copyCommonFlags = filterCommonFlags (copyCommonFlags flags) cabalLibVersion + } + -- ------------------------------------------------------------ -- * ActAsSetup flags diff --git a/cabal-install/src/Distribution/Client/SetupWrapper.hs b/cabal-install/src/Distribution/Client/SetupWrapper.hs index 32b492541d1..1b401ff6f7c 100644 --- a/cabal-install/src/Distribution/Client/SetupWrapper.hs +++ b/cabal-install/src/Distribution/Client/SetupWrapper.hs @@ -34,10 +34,6 @@ import Prelude () import qualified Distribution.Backpack as Backpack import Distribution.CabalSpecVersion (cabalSpecMinimumLibraryVersion) -import Distribution.Compiler - ( CompilerFlavor (GHC, GHCJS) - , buildCompilerId - ) import qualified Distribution.Make as Make import Distribution.Package ( ComponentId @@ -65,11 +61,6 @@ import Distribution.Simple.BuildPaths , exeExtension ) import Distribution.Simple.Compiler - ( Compiler (compilerId) - , PackageDB (..) - , PackageDBStack - , compilerFlavor - ) import Distribution.Simple.Configure ( configCompilerEx ) @@ -90,7 +81,8 @@ import Distribution.Simple.Program , runDbProgramCwd ) import Distribution.Simple.Program.Db - ( prependProgramSearchPath + ( configureAllKnownPrograms + , prependProgramSearchPath , progOverrideEnv ) import Distribution.Simple.Program.Find @@ -125,6 +117,7 @@ import Distribution.Client.JobControl import Distribution.Client.Types import Distribution.Client.Utils ( existsAndIsMoreRecentThan + , makeRelativeToDirS #ifdef mingw32_HOST_OS , canonicalizePathNoThrow #endif @@ -181,6 +174,7 @@ import Distribution.Utils.NubList import Distribution.Verbosity import Data.List (foldl1') +import qualified Data.Map.Lazy as Map import Distribution.Simple.Setup (globalCommand) import Distribution.Client.Compat.ExecutablePath (getExecutablePath) import Distribution.Compat.Process (proc) @@ -256,7 +250,7 @@ data SetupScriptOptions = SetupScriptOptions -- if needed. , useCompiler :: Maybe Compiler , usePlatform :: Maybe Platform - , usePackageDB :: PackageDBStack + , usePackageDB :: PackageDBStackCWD , usePackageIndex :: Maybe InstalledPackageIndex , useProgramDb :: ProgramDb , useDistPref :: SymbolicPath Pkg (Dir Dist) @@ -509,15 +503,15 @@ setupWrapper -> Maybe PackageDescription -> CommandUI flags -> (flags -> CommonSetupFlags) - -> (Version -> flags) + -> (Version -> IO flags) -- ^ produce command flags given the Cabal library version -> (Version -> [String]) -> IO () setupWrapper verbosity options mpkg cmd getCommonFlags getFlags getExtraArgs = do setup <- getSetup verbosity options mpkg let version = setupVersion setup - flags = getFlags version extraArgs = getExtraArgs version + flags <- getFlags version runSetupCommand verbosity setup @@ -556,8 +550,8 @@ internalSetupMethod verbosity options bt args = do buildTypeAction :: BuildType -> ([String] -> IO ()) buildTypeAction Simple = Simple.defaultMainArgs buildTypeAction Configure = - Simple.defaultMainWithHooksArgs - Simple.autoconfUserHooks + Simple.defaultMainWithSetupHooksArgs + Simple.autoconfSetupHooks buildTypeAction Make = Make.defaultMainArgs buildTypeAction Hooks = error "buildTypeAction Hooks" buildTypeAction Custom = error "buildTypeAction Custom" @@ -858,13 +852,21 @@ getExternalSetupMethod verbosity options pkg bt = do rewriteFileLBS verbosity (i setupHs) (buildTypeScript cabalLibVersion) buildTypeScript :: Version -> BS.ByteString - buildTypeScript cabalLibVersion = case bt of + buildTypeScript cabalLibVersion = "{-# LANGUAGE NoImplicitPrelude #-}\n" <> case bt of Simple -> "import Distribution.Simple; main = defaultMain\n" Configure - | cabalLibVersion >= mkVersion [1, 3, 10] -> "import Distribution.Simple; main = defaultMainWithHooks autoconfUserHooks\n" - | otherwise -> "import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks\n" + | cabalLibVersion >= mkVersion [3, 13, 0] + -> "import Distribution.Simple; main = defaultMainWithSetupHooks autoconfSetupHooks\n" + | cabalLibVersion >= mkVersion [1, 3, 10] + -> "import Distribution.Simple; main = defaultMainWithHooks autoconfUserHooks\n" + | otherwise + -> "import Distribution.Simple; main = defaultMainWithHooks defaultUserHooks\n" Make -> "import Distribution.Make; main = defaultMain\n" - Hooks -> "import Distribution.Simple; import SetupHooks; main = defaultMainWithSetupHooks setupHooks\n" + Hooks + | cabalLibVersion >= mkVersion [3, 13, 0] + -> "import Distribution.Simple; import SetupHooks; main = defaultMainWithSetupHooks setupHooks\n" + | otherwise + -> error "buildTypeScript Hooks with Cabal < 3.13" Custom -> error "buildTypeScript Custom" installedCabalVersion @@ -1026,11 +1028,19 @@ getExternalSetupMethod verbosity options pkg bt = do createDirectoryIfMissingVerbose verbosity True setupCacheDir installExecutableFile verbosity src cachedSetupProgFile -- Do not strip if we're using GHCJS, since the result may be a script - when (maybe True ((/= GHCJS) . compilerFlavor) $ useCompiler options') $ + when (maybe True ((/= GHCJS) . compilerFlavor) $ useCompiler options') $ do + -- Add the relevant PATH overrides for the package to the + -- program database. + setupProgDb + <- prependProgramSearchPath verbosity + (useExtraPathEnv options) + (useExtraEnvOverrides options) + (useProgramDb options') + >>= configureAllKnownPrograms verbosity Strip.stripExe verbosity platform - (useProgramDb options') + setupProgDb cachedSetupProgFile return cachedSetupProgFile where @@ -1055,6 +1065,7 @@ getExternalSetupMethod verbosity options pkg bt = do when (outOfDate || forceCompile) $ do debug verbosity "Setup executable needs to be updated, compiling..." (compiler, progdb, options'') <- configureCompiler options' + pkgDbs <- traverse (traverse (makeRelativeToDirS mbWorkDir)) (coercePackageDBStack (usePackageDB options'')) let cabalPkgid = PackageIdentifier (mkPackageName "Cabal") cabalLibVersion (program, extraOpts) = case compilerFlavor compiler of @@ -1100,7 +1111,7 @@ getExternalSetupMethod verbosity options pkg bt = do Custom -> toNubListR [sameDirectory] Hooks -> toNubListR [sameDirectory] _ -> mempty - , ghcOptPackageDBs = usePackageDB options'' + , ghcOptPackageDBs = pkgDbs , ghcOptHideAllPackages = Flag (useDependenciesExclusive options') , ghcOptCabal = Flag (useDependenciesExclusive options') , ghcOptPackages = toNubListR $ map addRenaming selectedDeps @@ -1111,6 +1122,13 @@ getExternalSetupMethod verbosity options pkg bt = do | useVersionMacros options' ] , ghcOptExtra = extraOpts + , ghcOptExtensions = toNubListR $ + if bt == Custom || any (isBasePkgId . snd) selectedDeps + then [] + else [ Simple.DisableExtension Simple.ImplicitPrelude ] + -- Pass -WNoImplicitPrelude to avoid depending on base + -- when compiling a Simple Setup.hs file. + , ghcOptExtensionMap = Map.fromList . Simple.compilerExtensions $ compiler } let ghcCmdLine = renderGhcOptions compiler platform ghcOptions when (useVersionMacros options') $ @@ -1131,5 +1149,6 @@ getExternalSetupMethod verbosity options pkg bt = do hPutStr logHandle output return $ i setupProgFile -isCabalPkgId :: PackageIdentifier -> Bool +isCabalPkgId, isBasePkgId :: PackageIdentifier -> Bool isCabalPkgId (PackageIdentifier pname _) = pname == mkPackageName "Cabal" +isBasePkgId (PackageIdentifier pname _) = pname == mkPackageName "base" diff --git a/cabal-install/src/Distribution/Client/SolverInstallPlan.hs b/cabal-install/src/Distribution/Client/SolverInstallPlan.hs index f4422080a4b..17dcf6d9398 100644 --- a/cabal-install/src/Distribution/Client/SolverInstallPlan.hs +++ b/cabal-install/src/Distribution/Client/SolverInstallPlan.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE TypeFamilies #-} @@ -93,7 +92,7 @@ data SolverInstallPlan = SolverInstallPlan { planIndex :: !SolverPlanIndex , planIndepGoals :: !IndependentGoals } - deriving (Typeable, Generic) + deriving (Generic) {- -- | Much like 'planPkgIdOf', but mapping back to full packages. diff --git a/cabal-install/src/Distribution/Client/Store.hs b/cabal-install/src/Distribution/Client/Store.hs index a8358ec2f18..9ffe6099c7f 100644 --- a/cabal-install/src/Distribution/Client/Store.hs +++ b/cabal-install/src/Distribution/Client/Store.hs @@ -48,10 +48,8 @@ import Lukko #else import System.IO (openFile, IOMode(ReadWriteMode), hClose) import GHC.IO.Handle.Lock (hLock, hTryLock, LockMode(ExclusiveLock)) -#if MIN_VERSION_base(4,11,0) import GHC.IO.Handle.Lock (hUnlock) #endif -#endif -- $concurrency -- diff --git a/cabal-install/src/Distribution/Client/Tar.hs b/cabal-install/src/Distribution/Client/Tar.hs index 4c5957d89d3..8d0f5449c67 100644 --- a/cabal-install/src/Distribution/Client/Tar.hs +++ b/cabal-install/src/Distribution/Client/Tar.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE DeriveFunctor #-} {-# OPTIONS_GHC -fno-warn-orphans #-} ----------------------------------------------------------------------------- diff --git a/cabal-install/src/Distribution/Client/TargetSelector.hs b/cabal-install/src/Distribution/Client/TargetSelector.hs index 856168103d1..6e0ad2488f3 100644 --- a/cabal-install/src/Distribution/Client/TargetSelector.hs +++ b/cabal-install/src/Distribution/Client/TargetSelector.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE RecordWildCards #-} @@ -101,6 +100,11 @@ import Control.Arrow ((&&&)) import Control.Monad hiding ( mfilter ) +#if MIN_VERSION_base(4,20,0) +import Data.Functor as UZ (unzip) +#else +import qualified Data.List.NonEmpty as UZ (unzip) +#endif import Data.List ( stripPrefix ) @@ -324,13 +328,13 @@ parseTargetString = parseTargetApprox :: Parse.ReadP r TargetString parseTargetApprox = ( do - a <- tokenQ + a <- tokenQEnd return (TargetString1 a) ) +++ ( do a <- tokenQ0 _ <- Parse.char ':' - b <- tokenQ + b <- tokenQEnd return (TargetString2 a b) ) +++ ( do @@ -338,7 +342,7 @@ parseTargetString = _ <- Parse.char ':' b <- tokenQ _ <- Parse.char ':' - c <- tokenQ + c <- tokenQEnd return (TargetString3 a b c) ) +++ ( do @@ -348,7 +352,7 @@ parseTargetString = _ <- Parse.char ':' c <- tokenQ _ <- Parse.char ':' - d <- tokenQ + d <- tokenQEnd return (TargetString4 a b c d) ) +++ ( do @@ -360,7 +364,7 @@ parseTargetString = _ <- Parse.char ':' d <- tokenQ _ <- Parse.char ':' - e <- tokenQ + e <- tokenQEnd return (TargetString5 a b c d e) ) +++ ( do @@ -376,7 +380,7 @@ parseTargetString = _ <- Parse.char ':' f <- tokenQ _ <- Parse.char ':' - g <- tokenQ + g <- tokenQEnd return (TargetString7 a b c d e f g) ) @@ -384,6 +388,8 @@ parseTargetString = tokenQ = parseHaskellString <++ token token0 = Parse.munch (\x -> not (isSpace x) && x /= ':') tokenQ0 = parseHaskellString <++ token0 + tokenEnd = Parse.munch1 (/= ':') + tokenQEnd = parseHaskellString <++ tokenEnd parseHaskellString :: Parse.ReadP r String parseHaskellString = Parse.readS_to_P reads @@ -583,7 +589,7 @@ resolveTargetSelector knowntargets@KnownTargets{..} mfilter targetStrStatus = classifyMatchErrors errs | Just expectedNE <- NE.nonEmpty expected = - let (things, got :| _) = NE.unzip expectedNE + let (things, got :| _) = UZ.unzip expectedNE in TargetSelectorExpected targetStr (NE.toList things) got | not (null nosuch) = TargetSelectorNoSuch targetStr nosuch diff --git a/cabal-install/src/Distribution/Client/Targets.hs b/cabal-install/src/Distribution/Client/Targets.hs index 1a37c9c73b9..a973433ccb8 100644 --- a/cabal-install/src/Distribution/Client/Targets.hs +++ b/cabal-install/src/Distribution/Client/Targets.hs @@ -1,6 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveFoldable #-} -{-# LANGUAGE DeriveFunctor #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DeriveTraversable #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -676,7 +674,7 @@ readUserConstraint str = instance Pretty UserConstraint where pretty (UserConstraint scope prop) = - dispPackageConstraint $ PackageConstraint (fromUserConstraintScope scope) prop + pretty $ PackageConstraint (fromUserConstraintScope scope) prop instance Parsec UserConstraint where parsec = do diff --git a/cabal-install/src/Distribution/Client/Types.hs b/cabal-install/src/Distribution/Client/Types.hs index 710960ee939..841a4dbc9d2 100644 --- a/cabal-install/src/Distribution/Client/Types.hs +++ b/cabal-install/src/Distribution/Client/Types.hs @@ -1,8 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} -{-# LANGUAGE DeriveFunctor #-} -{-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE GeneralizedNewtypeDeriving #-} -{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TypeFamilies #-} ----------------------------------------------------------------------------- diff --git a/cabal-install/src/Distribution/Client/Types/BuildResults.hs b/cabal-install/src/Distribution/Client/Types/BuildResults.hs index 55c01534620..61ad6e41c96 100644 --- a/cabal-install/src/Distribution/Client/Types/BuildResults.hs +++ b/cabal-install/src/Distribution/Client/Types/BuildResults.hs @@ -32,7 +32,7 @@ data BuildFailure | BuildFailed SomeException | TestsFailed SomeException | InstallFailed SomeException - deriving (Show, Typeable, Generic) + deriving (Show, Generic) instance Exception BuildFailure @@ -48,9 +48,9 @@ data BuildResult deriving (Show, Generic) data DocsResult = DocsNotTried | DocsFailed | DocsOk - deriving (Show, Generic, Typeable) + deriving (Show, Generic) data TestsResult = TestsNotTried | TestsOk - deriving (Show, Generic, Typeable) + deriving (Show, Generic) instance Binary BuildFailure instance Binary BuildResult diff --git a/cabal-install/src/Distribution/Client/Types/PackageLocation.hs b/cabal-install/src/Distribution/Client/Types/PackageLocation.hs index 2f4993e22bd..9a0537aae7a 100644 --- a/cabal-install/src/Distribution/Client/Types/PackageLocation.hs +++ b/cabal-install/src/Distribution/Client/Types/PackageLocation.hs @@ -37,7 +37,7 @@ data PackageLocation local RepoTarballPackage Repo PackageId local | -- | A package available from a version control system source repository RemoteSourceRepoPackage SourceRepoMaybe local - deriving (Show, Functor, Eq, Ord, Generic, Typeable) + deriving (Show, Functor, Eq, Ord, Generic) instance Binary local => Binary (PackageLocation local) instance Structured local => Structured (PackageLocation local) diff --git a/cabal-install/src/Distribution/Client/Utils.hs b/cabal-install/src/Distribution/Client/Utils.hs index 87378da7f10..b1ad7bd9a37 100644 --- a/cabal-install/src/Distribution/Client/Utils.hs +++ b/cabal-install/src/Distribution/Client/Utils.hs @@ -19,6 +19,7 @@ module Distribution.Client.Utils , makeAbsoluteToCwd , makeRelativeToCwd , makeRelativeToDir + , makeRelativeToDirS , makeRelativeCanonical , filePathToByteString , byteStringToFilePath @@ -38,6 +39,7 @@ module Distribution.Client.Utils , listFilesInside , safeRead , hasElem + , concatMapM , occursOnlyOrBefore , giveRTSWarning ) where @@ -75,8 +77,11 @@ import Distribution.Utils.Path , Pkg , RelativePath , SymbolicPath + , getSymbolicPath , makeSymbolicPath , relativeSymbolicPath + , sameDirectory + , symbolicPathRelative_maybe ) import Distribution.Version @@ -263,6 +268,16 @@ makeRelativeToDir :: FilePath -> FilePath -> IO FilePath makeRelativeToDir path dir = makeRelativeCanonical <$> canonicalizePath path <*> canonicalizePath dir +-- | makeRelativeToDir for SymbolicPath +makeRelativeToDirS :: Maybe (SymbolicPath CWD (Dir dir)) -> SymbolicPath CWD to -> IO (SymbolicPath dir to) +makeRelativeToDirS Nothing s = makeRelativeToDirS (Just sameDirectory) s +makeRelativeToDirS (Just root) p = + case symbolicPathRelative_maybe p of + -- TODO: Use AbsolutePath + Nothing -> return $ makeSymbolicPath (getSymbolicPath p) + Just rel_path -> + makeSymbolicPath <$> makeRelativeToDir (getSymbolicPath root) (getSymbolicPath rel_path) + -- | Given a canonical absolute path and canonical absolute dir, make the path -- relative to the directory, including using @../..@ if necessary. Returns -- the original absolute path if it is not on the same drive as the given dir. diff --git a/cabal-install/src/Distribution/Client/VCS.hs b/cabal-install/src/Distribution/Client/VCS.hs index 2f2686c6ae2..98b8251d9c1 100644 --- a/cabal-install/src/Distribution/Client/VCS.hs +++ b/cabal-install/src/Distribution/Client/VCS.hs @@ -64,6 +64,10 @@ import Distribution.Simple.Program import Distribution.Simple.Program.Db ( prependProgramSearchPath ) +import Distribution.System + ( OS (Windows) + , buildOS + ) import Distribution.Types.SourceRepo ( KnownRepoType (..) , RepoType (..) @@ -92,7 +96,9 @@ import qualified Data.List as List import qualified Data.Map as Map import System.Directory ( doesDirectoryExist + , doesFileExist , removeDirectoryRecursive + , removePathForcibly ) import System.FilePath ( takeDirectory @@ -100,7 +106,9 @@ import System.FilePath ) import System.IO.Error ( isDoesNotExistError + , isPermissionError ) +import qualified System.Process as Process -- | A driver for a version control system, e.g. git, darcs etc. data VCS program = VCS @@ -461,11 +469,18 @@ vcsGit = [programInvocation prog cloneArgs] -- And if there's a tag, we have to do that in a second step: ++ [git (resetArgs tag) | tag <- maybeToList (srpTag repo)] - ++ [ git (["submodule", "sync", "--recursive"] ++ verboseArg) - , git (["submodule", "update", "--init", "--force", "--recursive"] ++ verboseArg) + ++ [ whenGitModulesExists $ git $ ["submodule", "sync", "--recursive"] ++ verboseArg + , whenGitModulesExists $ git $ ["submodule", "update", "--init", "--force", "--recursive"] ++ verboseArg ] where git args = (programInvocation prog args){progInvokeCwd = Just destdir} + + gitModulesPath = destdir ".gitmodules" + whenGitModulesExists invocation = + invocation + { progInvokeWhen = doesFileExist gitModulesPath + } + cloneArgs = ["clone", srcuri, destdir] ++ branchArgs @@ -476,6 +491,9 @@ vcsGit = resetArgs tag = "reset" : verboseArg ++ ["--hard", tag, "--"] verboseArg = ["--quiet" | verbosity < Verbosity.normal] + -- Note: No --depth=1 for vcsCloneRepo since that is used for `cabal get -s`, + -- whereas `vcsSyncRepo` is used for source-repository-package where we do want shallow clones. + vcsSyncRepos :: Verbosity -> ConfiguredProgram @@ -496,6 +514,8 @@ vcsGit = | dir <- (primaryLocalDir : map snd secondaryRepos) ] + -- NOTE: Repositories are cloned once, but can be synchronized multiple times. + -- Therefore, this code has to work with both `git clone` and `git fetch`. vcsSyncRepo verbosity gitProg SourceRepositoryPackage{..} localDir peer = do exists <- doesDirectoryExist localDir if exists @@ -506,14 +526,79 @@ vcsGit = -- is needed because sometimes `git submodule sync` does not actually -- update the submodule source URL. Detailed description here: -- https://git.coop/-/snippets/85 - git localDir ["submodule", "deinit", "--force", "--all"] - let gitModulesDir = localDir ".git" "modules" - gitModulesExists <- doesDirectoryExist gitModulesDir - when gitModulesExists $ removeDirectoryRecursive gitModulesDir - git localDir resetArgs - git localDir $ ["submodule", "sync", "--recursive"] ++ verboseArg - git localDir $ ["submodule", "update", "--force", "--init", "--recursive"] ++ verboseArg - git localDir $ ["submodule", "foreach", "--recursive"] ++ verboseArg ++ ["git clean -ffxdq"] + let dotGitModulesPath = localDir ".git" "modules" + gitModulesPath = localDir ".gitmodules" + + -- Remove any `.git/modules` if they exist. + dotGitModulesExists <- doesDirectoryExist dotGitModulesPath + when dotGitModulesExists $ do + git localDir $ ["submodule", "deinit", "--force", "--all"] ++ verboseArg + if buildOS == Windows + then do + -- Windows can't delete some git files #10182 + void $ + Process.createProcess_ "attrib" $ + Process.shell $ + "attrib -s -h -r " <> dotGitModulesPath <> "\\*.* /s /d" + + catch + (removePathForcibly dotGitModulesPath) + (\e -> if isPermissionError e then removePathForcibly dotGitModulesPath else throw e) + else removeDirectoryRecursive dotGitModulesPath + + -- If we want a particular branch or tag, fetch it. + ref <- case srpBranch `mplus` srpTag of + Nothing -> pure "HEAD" + Just ref -> do + -- /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ + -- /!\ MULTIPLE HOURS HAVE BEEN LOST HERE!! /!\ + -- /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ /!\ + -- + -- If you run `git fetch origin MY_TAG`, then the tag _will_ be + -- fetched, but no local ref (e.g. `refs/tags/MY_TAG`) will be + -- created. + -- + -- This means that doing `git fetch origin MY_TAG && git reset --hard + -- MY_TAG` will fail with a message like `unknown revision MY_TAG`. + -- + -- There are two ways around this: + -- + -- 1. Provide a refmap explicitly: + -- + -- git fetch --refmap="+refs/tags/*:refs/tags/*" origin MYTAG + -- + -- This tells Git to create local tags matching remote tags. It's + -- not in the default refmap so you need to set it explicitly. + -- (You can also set it with `git config set --local + -- remote.origin.fetch ...`.) + -- + -- 2. Use `FETCH_HEAD` directly: Git writes a `FETCH_HEAD` ref + -- containing the commit that was just fetched. This feels a bit + -- nasty but seems to work reliably, even if nothing was fetched. + -- (That is, deleting `FETCH_HEAD` and re-running a `git fetch` + -- command will succesfully recreate the `FETCH_HEAD` ref.) + -- + -- Option 2 is what Cabal has done historically, and we're keeping it + -- for now. Option 1 is possible but seems to have little benefit. + git localDir ("fetch" : verboseArg ++ ["origin", ref]) + pure "FETCH_HEAD" + + -- Then, reset to the appropriate ref. + git localDir $ + "reset" + : verboseArg + ++ [ "--hard" + , ref + , "--" + ] + + -- We need to check if `.gitmodules` exists _after_ the `git reset` call. + gitModulesExists <- doesFileExist gitModulesPath + when gitModulesExists $ do + git localDir $ ["submodule", "sync", "--recursive"] ++ verboseArg + git localDir $ ["submodule", "update", "--force", "--init", "--recursive"] ++ verboseArg + git localDir $ ["submodule", "foreach", "--recursive"] ++ verboseArg ++ ["git clean -ffxdq"] + git localDir $ ["clean", "-ffxdq"] where git :: FilePath -> [String] -> IO () @@ -524,15 +609,14 @@ vcsGit = } cloneArgs = - ["clone", "--no-checkout", loc, localDir] + ["clone", "--depth=1", "--no-checkout", loc, localDir] ++ case peer of Nothing -> [] Just peerLocalDir -> ["--reference", peerLocalDir] ++ verboseArg where loc = srpLocation - resetArgs = "reset" : verboseArg ++ ["--hard", resetTarget, "--"] - resetTarget = fromMaybe "HEAD" (srpBranch `mplus` srpTag) + verboseArg = ["--quiet" | verbosity < Verbosity.normal] gitProgram :: Program diff --git a/cabal-install/src/Distribution/Client/Version.hs b/cabal-install/src/Distribution/Client/Version.hs index f5c6bec510d..e50f4231090 100644 --- a/cabal-install/src/Distribution/Client/Version.hs +++ b/cabal-install/src/Distribution/Client/Version.hs @@ -1,13 +1,51 @@ +{-# LANGUAGE CPP #-} +#ifdef GIT_REV +{-# LANGUAGE TemplateHaskell #-} +#endif + -- | Provides the version number of @cabal-install@. module Distribution.Client.Version ( cabalInstallVersion + , cabalInstallGitInfo ) where import Distribution.Version import qualified Paths_cabal_install as PackageInfo +#ifdef GIT_REV +import Data.Either (isLeft) +import GitHash + ( giHash + , giBranch + , giCommitDate + , tGitInfoCwdTry + ) +#endif + -- | -- This value determines the output of `cabal-install --version`. cabalInstallVersion :: Version cabalInstallVersion = mkVersion' PackageInfo.version + +-- | +-- `cabal-install` Git information. Only filled in if built in a Git tree in +-- developmnent mode and Template Haskell is available. +cabalInstallGitInfo :: String +#ifdef GIT_REV +cabalInstallGitInfo = concat [ "(commit " + , giHash' + , branchInfo + , ", " + , either (const "") giCommitDate gi' + , ")" + ] + where + gi' = $$tGitInfoCwdTry + giHash' = take 7 . either (const "") giHash $ gi' + branchInfo | isLeft gi' = "" + | either id giBranch gi' == "master" = "" + | otherwise = " on " <> either id giBranch gi' +#else +cabalInstallGitInfo = "" +#endif diff --git a/cabal-install/src/Distribution/Client/Win32SelfUpgrade.hs b/cabal-install/src/Distribution/Client/Win32SelfUpgrade.hs index 3e7ceefac63..89b75610261 100644 --- a/cabal-install/src/Distribution/Client/Win32SelfUpgrade.hs +++ b/cabal-install/src/Distribution/Client/Win32SelfUpgrade.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE ForeignFunctionInterface #-} ----------------------------------------------------------------------------- diff --git a/cabal-install/src/Distribution/Deprecated/ParseUtils.hs b/cabal-install/src/Distribution/Deprecated/ParseUtils.hs index b3b5f8bab9d..4743213fde9 100644 --- a/cabal-install/src/Distribution/Deprecated/ParseUtils.hs +++ b/cabal-install/src/Distribution/Deprecated/ParseUtils.hs @@ -91,6 +91,7 @@ data PError = AmbiguousParse String LineNo | NoParse String LineNo | TabsError LineNo + | FieldShouldBeStanza String LineNo | FromString String (Maybe LineNo) deriving (Eq, Show) @@ -121,19 +122,12 @@ instance Applicative ParseResult where pure = ParseOk [] (<*>) = ap -{- FOURMOLU_DISABLE -} instance Monad ParseResult where return = pure ParseFailed err >>= _ = ParseFailed err ParseOk ws x >>= f = case f x of ParseFailed err -> ParseFailed err ParseOk ws' x' -> ParseOk (ws' ++ ws) x' -#if !(MIN_VERSION_base(4,9,0)) - fail = parseResultFail -#elif !(MIN_VERSION_base(4,13,0)) - fail = Fail.fail -#endif -{- FOURMOLU_ENABLE -} instance Foldable ParseResult where foldMap _ (ParseFailed _) = mempty @@ -193,6 +187,10 @@ locatedErrorMsg (NoParse f n) = , "Parse of field '" ++ f ++ "' failed." ) locatedErrorMsg (TabsError n) = (Just n, "Tab used as indentation.") +locatedErrorMsg (FieldShouldBeStanza name lineNumber) = + ( Just lineNumber + , "'" ++ name ++ "' is a stanza, not a field. Remove the trailing ':' to parse a stanza." + ) locatedErrorMsg (FromString s n) = (n, s) syntaxError :: LineNo -> String -> ParseResult a diff --git a/cabal-install/src/Distribution/Deprecated/ReadP.hs b/cabal-install/src/Distribution/Deprecated/ReadP.hs index f0626d5cfe7..2e6f9c189b8 100644 --- a/cabal-install/src/Distribution/Deprecated/ReadP.hs +++ b/cabal-install/src/Distribution/Deprecated/ReadP.hs @@ -119,12 +119,6 @@ instance Monad (P s) where (Result x p) >>= k = k x `mplus` (p >>= k) (Final r) >>= k = final [ys' | (x, s) <- r, ys' <- run (k x) s] -#if !(MIN_VERSION_base(4,9,0)) - fail _ = Fail -#elif !(MIN_VERSION_base(4,13,0)) - fail = Fail.fail -#endif - instance Fail.MonadFail (P s) where fail _ = Fail @@ -180,12 +174,6 @@ instance Monad (Parser r s) where return = pure R m >>= f = R (\k -> m (\a -> let R m' = f a in m' k)) -#if !(MIN_VERSION_base(4,9,0)) - fail _ = R (const Fail) -#elif !(MIN_VERSION_base(4,13,0)) - fail = Fail.fail -#endif - instance Fail.MonadFail (Parser r s) where fail _ = R (const Fail) diff --git a/cabal-install/tests/IntegrationTests2.hs b/cabal-install/tests/IntegrationTests2.hs index 6579b2ddcc2..daf6959fbc2 100644 --- a/cabal-install/tests/IntegrationTests2.hs +++ b/cabal-install/tests/IntegrationTests2.hs @@ -1,11 +1,7 @@ -{- FOURMOLU_DISABLE -} -{-# LANGUAGE CPP #-} {-# LANGUAGE BangPatterns #-} -{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE OverloadedStrings #-} - -- For the handy instance IsString PackageIdentifier {-# OPTIONS_GHC -fno-warn-orphans #-} @@ -15,552 +11,732 @@ import Distribution.Client.Compat.Prelude import Prelude () import Distribution.Client.DistDirLayout -import Distribution.Client.ProjectConfig import Distribution.Client.HttpUtils -import Distribution.Client.TargetSelector hiding (DirActions(..)) -import qualified Distribution.Client.TargetSelector as TS (DirActions(..)) -import Distribution.Client.ProjectPlanning -import Distribution.Client.ProjectPlanning.Types +import qualified Distribution.Client.InstallPlan as InstallPlan import Distribution.Client.ProjectBuilding +import Distribution.Client.ProjectConfig import Distribution.Client.ProjectOrchestration - ( resolveTargets, distinctTargetComponents ) + ( distinctTargetComponents + , resolveTargets + ) +import Distribution.Client.ProjectPlanning +import Distribution.Client.ProjectPlanning.Types import Distribution.Client.TargetProblem - ( TargetProblem', TargetProblem (..) ) -import Distribution.Client.Types - ( PackageLocation(..), UnresolvedSourcePackage - , PackageSpecifier(..) ) + ( TargetProblem (..) + , TargetProblem' + ) +import Distribution.Client.TargetSelector hiding (DirActions (..)) +import qualified Distribution.Client.TargetSelector as TS (DirActions (..)) import Distribution.Client.Targets - ( UserConstraint(..), UserConstraintScope(UserAnyQualifier) ) -import qualified Distribution.Client.InstallPlan as InstallPlan -import Distribution.Solver.Types.SourcePackage as SP + ( UserConstraint (..) + , UserConstraintScope (UserAnyQualifier) + ) +import Distribution.Client.Types + ( PackageLocation (..) + , PackageSpecifier (..) + , UnresolvedSourcePackage + ) import Distribution.Solver.Types.ConstraintSource - ( ConstraintSource(ConstraintSourceUnknown) ) + ( ConstraintSource (ConstraintSourceUnknown) + ) import Distribution.Solver.Types.PackageConstraint - ( PackageProperty(PackagePropertySource) ) + ( PackageProperty (PackagePropertySource) + ) +import Distribution.Solver.Types.SourcePackage as SP -import qualified Distribution.Client.CmdBuild as CmdBuild -import qualified Distribution.Client.CmdRepl as CmdRepl -import qualified Distribution.Client.CmdRun as CmdRun -import qualified Distribution.Client.CmdTest as CmdTest -import qualified Distribution.Client.CmdBench as CmdBench -import qualified Distribution.Client.CmdHaddock as CmdHaddock -import qualified Distribution.Client.CmdListBin as CmdListBin +import qualified Distribution.Client.CmdBench as CmdBench +import qualified Distribution.Client.CmdBuild as CmdBuild +import qualified Distribution.Client.CmdHaddock as CmdHaddock +import qualified Distribution.Client.CmdListBin as CmdListBin +import qualified Distribution.Client.CmdRepl as CmdRepl +import qualified Distribution.Client.CmdRun as CmdRun +import qualified Distribution.Client.CmdTest as CmdTest +import qualified Distribution.Client.CmdHaddockProject as CmdHaddockProject +import Distribution.Client.Config (SavedConfig (savedGlobalFlags), createDefaultConfigFile, loadConfig) +import Distribution.Client.GlobalFlags (defaultGlobalFlags) +import Distribution.Client.Setup (globalCommand, globalStoreDir) +import Distribution.InstalledPackageInfo (InstalledPackageInfo) +import Distribution.ModuleName (ModuleName) import Distribution.Package import Distribution.PackageDescription -import Distribution.InstalledPackageInfo (InstalledPackageInfo) -import Distribution.Simple.Setup (toFlag, HaddockFlags(..), defaultHaddockFlags) -import Distribution.Client.Setup (globalCommand) -import Distribution.Client.Config (loadConfig, SavedConfig(savedGlobalFlags), createDefaultConfigFile) -import Distribution.Simple.Compiler import Distribution.Simple.Command +import Distribution.Simple.Compiler import qualified Distribution.Simple.Flag as Flag +import Distribution.Simple.Setup (CommonSetupFlags (..), HaddockFlags (..), HaddockProjectFlags (..), defaultCommonSetupFlags, defaultHaddockFlags, defaultHaddockProjectFlags, toFlag) import Distribution.System -import Distribution.Version -import Distribution.ModuleName (ModuleName) import Distribution.Text import Distribution.Utils.Path (unsafeMakeSymbolicPath) -import qualified Distribution.Client.CmdHaddockProject as CmdHaddockProject -import Distribution.Client.Setup (globalStoreDir) -import Distribution.Client.GlobalFlags (defaultGlobalFlags) -import Distribution.Simple.Setup (HaddockProjectFlags(..), defaultHaddockProjectFlags) +import Distribution.Version +import IntegrationTests2.CPP +import Data.List (isInfixOf) import qualified Data.Map as Map import qualified Data.Set as Set -import Data.List (isInfixOf) -import Control.Monad import Control.Concurrent (threadDelay) import Control.Exception hiding (assert) -import System.FilePath +import Control.Monad import System.Directory +import System.Environment (setEnv) +import System.FilePath import System.IO (hPutStrLn, stderr) +import System.Process (callProcess) +import Data.Tagged (Tagged (..)) import Test.Tasty import Test.Tasty.HUnit import Test.Tasty.Options -import Data.Tagged (Tagged(..)) import qualified Data.ByteString as BS +import Data.Maybe (fromJust) import Distribution.Client.GlobalFlags (GlobalFlags, globalNix) import Distribution.Simple.Flag (Flag (Flag, NoFlag)) import Distribution.Types.ParStrat -import Data.Maybe (fromJust) - -#if !MIN_VERSION_directory(1,2,7) -removePathForcibly :: FilePath -> IO () -removePathForcibly = removeDirectoryRecursive -#endif main :: IO () -main = +main = do + -- this is needed to ensure tests aren't affected by the user's cabal config + cwd <- getCurrentDirectory + let configDir = cwd basedir "config" "cabal-config" + setEnv "CABAL_DIR" configDir + removeDirectoryRecursive configDir <|> return () + createDirectoryIfMissing True configDir + -- sigh + -- NOTE: This is running the `cabal` from the user environment, which is + -- generally not the `cabal` being tested! + callProcess "cabal" ["-v0", "user-config", "init", "-f"] + callProcess "cabal" ["update"] defaultMainWithIngredients (defaultIngredients ++ [includingOptions projectConfigOptionDescriptions]) - (withProjectConfig $ \config -> - testGroup "Integration tests (internal)" - (tests config)) - + ( withProjectConfig $ \config -> + testGroup + "Integration tests (internal)" + (tests config) + ) tests :: ProjectConfig -> [TestTree] tests config = - --TODO: tests for: - -- * normal success - -- * dry-run tests with changes + -- TODO: tests for: + -- \* normal success + -- \* dry-run tests with changes [ testGroup "Discovery and planning" $ - [ testCase "no package" (testExceptionInFindingPackage config) - , testCase "no package2" (testExceptionInFindingPackage2 config) - , testCase "proj conf1" (testExceptionInProjectConfig config) - ] + [ testCase "no package" (testExceptionInFindingPackage config) + , testCase "no package2" (testExceptionInFindingPackage2 config) + , testCase "proj conf1" (testExceptionInProjectConfig config) + ] , testGroup "Target selectors" $ - [ testCaseSteps "valid" testTargetSelectors - , testCase "bad syntax" testTargetSelectorBadSyntax - , testCaseSteps "ambiguous syntax" testTargetSelectorAmbiguous - , testCase "no current pkg" testTargetSelectorNoCurrentPackage - , testCase "no targets" testTargetSelectorNoTargets - , testCase "project empty" testTargetSelectorProjectEmpty - , testCase "canonicalized path" testTargetSelectorCanonicalizedPath - , testCase "problems (common)" (testTargetProblemsCommon config) - , testCaseSteps "problems (build)" (testTargetProblemsBuild config) - , testCaseSteps "problems (repl)" (testTargetProblemsRepl config) - , testCaseSteps "problems (run)" (testTargetProblemsRun config) - , testCaseSteps "problems (list-bin)" (testTargetProblemsListBin config) - , testCaseSteps "problems (test)" (testTargetProblemsTest config) - , testCaseSteps "problems (bench)" (testTargetProblemsBench config) - , testCaseSteps "problems (haddock)" (testTargetProblemsHaddock config) - ] + [ testCaseSteps "valid" testTargetSelectors + , testCase "bad syntax" testTargetSelectorBadSyntax + , testCaseSteps "ambiguous syntax" testTargetSelectorAmbiguous + , testCase "no current pkg" testTargetSelectorNoCurrentPackage + , testCase "no targets" testTargetSelectorNoTargets + , testCase "project empty" testTargetSelectorProjectEmpty + , testCase "canonicalized path" testTargetSelectorCanonicalizedPath + , testCase "problems (common)" (testTargetProblemsCommon config) + , testCaseSteps "problems (build)" (testTargetProblemsBuild config) + , testCaseSteps "problems (repl)" (testTargetProblemsRepl config) + , testCaseSteps "problems (run)" (testTargetProblemsRun config) + , testCaseSteps "problems (list-bin)" (testTargetProblemsListBin config) + , testCaseSteps "problems (test)" (testTargetProblemsTest config) + , testCaseSteps "problems (bench)" (testTargetProblemsBench config) + , testCaseSteps "problems (haddock)" (testTargetProblemsHaddock config) + ] , testGroup "Exceptions during building (local inplace)" $ - [ testCase "configure" (testExceptionInConfigureStep config) - , testCase "build" (testExceptionInBuildStep config) --- , testCase "register" testExceptionInRegisterStep - ] - --TODO: need to repeat for packages for the store - --TODO: need to check we can build sub-libs, foreign libs and exes + [ testCase "configure" (testExceptionInConfigureStep config) + , testCase "build" (testExceptionInBuildStep config) + -- , testCase "register" testExceptionInRegisterStep + ] + , -- TODO: need to repeat for packages for the store + -- TODO: need to check we can build sub-libs, foreign libs and exes -- components for non-local packages / packages in the store. - , testGroup "Successful builds" $ - [ testCaseSteps "Setup script styles" (testSetupScriptStyles config) - , testCase "keep-going" (testBuildKeepGoing config) -#ifndef mingw32_HOST_OS - -- disabled because https://github.com/haskell/cabal/issues/6272 - , testCase "local tarball" (testBuildLocalTarball config) -#endif - ] - + testGroup "Successful builds" $ + [ testCaseSteps "Setup script styles" (testSetupScriptStyles config) + , testCase "keep-going" (testBuildKeepGoing config) + ] + ++ if isMingw32 + then -- disabled because https://github.com/haskell/cabal/issues/6272 + [] + else + [ testCase "local tarball" (testBuildLocalTarball config) + ] , testGroup "Regression tests" $ - [ testCase "issue #3324" (testRegressionIssue3324 config) - , testCase "program options scope all" (testProgramOptionsAll config) - , testCase "program options scope local" (testProgramOptionsLocal config) - , testCase "program options scope specific" (testProgramOptionsSpecific config) - ] + [ testCase "issue #3324" (testRegressionIssue3324 config) + , testCase "program options scope all" (testProgramOptionsAll config) + , testCase "program options scope local" (testProgramOptionsLocal config) + , testCase "program options scope specific" (testProgramOptionsSpecific config) + ] , testGroup "Flag tests" $ - [ - testCase "Test Nix Flag" testNixFlags, - testCase "Test Config options for commented options" testConfigOptionComments, - testCase "Test Ignore Project Flag" testIgnoreProjectFlag - ] - , testGroup "haddock-project" - [ testCase "dependencies" (testHaddockProjectDependencies config) - ] + [ testCase "Test Nix Flag" testNixFlags + , testCase "Test Config options for commented options" testConfigOptionComments + , testCase "Test Ignore Project Flag" testIgnoreProjectFlag + ] + , testGroup + "haddock-project" + [ testCase "dependencies" (testHaddockProjectDependencies config) + ] ] testTargetSelectors :: (String -> IO ()) -> Assertion testTargetSelectors reportSubCase = do - (_, _, _, localPackages, _) <- configureProject testdir config - let readTargetSelectors' = readTargetSelectorsWith (dirActions testdir) - localPackages - Nothing - - reportSubCase "cwd" - do Right ts <- readTargetSelectors' [] - ts @?= [TargetPackage TargetImplicitCwd ["p-0.1"] Nothing] - - reportSubCase "all" - do Right ts <- readTargetSelectors' - ["all", ":all"] - ts @?= replicate 2 (TargetAllPackages Nothing) - - reportSubCase "filter" - do Right ts <- readTargetSelectors' - [ "libs", ":cwd:libs" - , "flibs", ":cwd:flibs" - , "exes", ":cwd:exes" - , "tests", ":cwd:tests" - , "benchmarks", ":cwd:benchmarks"] - zipWithM_ (@?=) ts - [ TargetPackage TargetImplicitCwd ["p-0.1"] (Just kind) - | kind <- concatMap (replicate 2) [LibKind .. ] - ] + (_, _, _, localPackages, _) <- configureProject testdir config + let readTargetSelectors' = + readTargetSelectorsWith + (dirActions testdir) + localPackages + Nothing + + reportSubCase "cwd" + do + Right ts <- readTargetSelectors' [] + ts @?= [TargetPackage TargetImplicitCwd ["p-0.1"] Nothing] + + reportSubCase "all" + do + Right ts <- + readTargetSelectors' + ["all", ":all"] + ts @?= replicate 2 (TargetAllPackages Nothing) + + reportSubCase "filter" + do + Right ts <- + readTargetSelectors' + [ "libs" + , ":cwd:libs" + , "flibs" + , ":cwd:flibs" + , "exes" + , ":cwd:exes" + , "tests" + , ":cwd:tests" + , "benchmarks" + , ":cwd:benchmarks" + ] + zipWithM_ + (@?=) + ts + [ TargetPackage TargetImplicitCwd ["p-0.1"] (Just kind) + | kind <- concatMap (replicate 2) [LibKind ..] + ] - reportSubCase "all:filter" - do Right ts <- readTargetSelectors' - [ "all:libs", ":all:libs" - , "all:flibs", ":all:flibs" - , "all:exes", ":all:exes" - , "all:tests", ":all:tests" - , "all:benchmarks", ":all:benchmarks"] - zipWithM_ (@?=) ts - [ TargetAllPackages (Just kind) - | kind <- concatMap (replicate 2) [LibKind .. ] - ] + reportSubCase "all:filter" + do + Right ts <- + readTargetSelectors' + [ "all:libs" + , ":all:libs" + , "all:flibs" + , ":all:flibs" + , "all:exes" + , ":all:exes" + , "all:tests" + , ":all:tests" + , "all:benchmarks" + , ":all:benchmarks" + ] + zipWithM_ + (@?=) + ts + [ TargetAllPackages (Just kind) + | kind <- concatMap (replicate 2) [LibKind ..] + ] - reportSubCase "pkg" - do Right ts <- readTargetSelectors' - [ ":pkg:p", ".", "./", "p.cabal" - , "q", ":pkg:q", "q/", "./q/", "q/q.cabal"] - ts @?= replicate 4 (mkTargetPackage "p-0.1") - ++ replicate 5 (mkTargetPackage "q-0.1") - - reportSubCase "pkg:filter" - do Right ts <- readTargetSelectors' - [ "p:libs", ".:libs", ":pkg:p:libs" - , "p:flibs", ".:flibs", ":pkg:p:flibs" - , "p:exes", ".:exes", ":pkg:p:exes" - , "p:tests", ".:tests", ":pkg:p:tests" - , "p:benchmarks", ".:benchmarks", ":pkg:p:benchmarks" - , "q:libs", "q/:libs", ":pkg:q:libs" - , "q:flibs", "q/:flibs", ":pkg:q:flibs" - , "q:exes", "q/:exes", ":pkg:q:exes" - , "q:tests", "q/:tests", ":pkg:q:tests" - , "q:benchmarks", "q/:benchmarks", ":pkg:q:benchmarks"] - zipWithM_ (@?=) ts $ - [ TargetPackage TargetExplicitNamed ["p-0.1"] (Just kind) - | kind <- concatMap (replicate 3) [LibKind .. ] - ] ++ - [ TargetPackage TargetExplicitNamed ["q-0.1"] (Just kind) - | kind <- concatMap (replicate 3) [LibKind .. ] - ] + reportSubCase "pkg" + do + Right ts <- + readTargetSelectors' + [ ":pkg:p" + , "." + , "./" + , "p.cabal" + , "q" + , ":pkg:q" + , "q/" + , "./q/" + , "q/q.cabal" + ] + ts + @?= replicate 4 (mkTargetPackage "p-0.1") + ++ replicate 5 (mkTargetPackage "q-0.1") + + reportSubCase "pkg:filter" + do + Right ts <- + readTargetSelectors' + [ "p:libs" + , ".:libs" + , ":pkg:p:libs" + , "p:flibs" + , ".:flibs" + , ":pkg:p:flibs" + , "p:exes" + , ".:exes" + , ":pkg:p:exes" + , "p:tests" + , ".:tests" + , ":pkg:p:tests" + , "p:benchmarks" + , ".:benchmarks" + , ":pkg:p:benchmarks" + , "q:libs" + , "q/:libs" + , ":pkg:q:libs" + , "q:flibs" + , "q/:flibs" + , ":pkg:q:flibs" + , "q:exes" + , "q/:exes" + , ":pkg:q:exes" + , "q:tests" + , "q/:tests" + , ":pkg:q:tests" + , "q:benchmarks" + , "q/:benchmarks" + , ":pkg:q:benchmarks" + ] + zipWithM_ (@?=) ts $ + [ TargetPackage TargetExplicitNamed ["p-0.1"] (Just kind) + | kind <- concatMap (replicate 3) [LibKind ..] + ] + ++ [ TargetPackage TargetExplicitNamed ["q-0.1"] (Just kind) + | kind <- concatMap (replicate 3) [LibKind ..] + ] + + reportSubCase "component" + do + Right ts <- + readTargetSelectors' + [ "p" + , "lib:p" + , "p:lib:p" + , ":pkg:p:lib:p" + , "lib:q" + , "q:lib:q" + , ":pkg:q:lib:q" + ] + ts + @?= replicate 4 (TargetComponent "p-0.1" (CLibName LMainLibName) WholeComponent) + ++ replicate 3 (TargetComponent "q-0.1" (CLibName LMainLibName) WholeComponent) + + reportSubCase "module" + do + Right ts <- + readTargetSelectors' + [ "P" + , "lib:p:P" + , "p:p:P" + , ":pkg:p:lib:p:module:P" + , "QQ" + , "lib:q:QQ" + , "q:q:QQ" + , ":pkg:q:lib:q:module:QQ" + , "pexe:PMain" -- p:P or q:QQ would be ambiguous here + , "qexe:QMain" -- package p vs component p + ] + ts + @?= replicate 4 (TargetComponent "p-0.1" (CLibName LMainLibName) (ModuleTarget "P")) + ++ replicate 4 (TargetComponent "q-0.1" (CLibName LMainLibName) (ModuleTarget "QQ")) + ++ [ TargetComponent "p-0.1" (CExeName "pexe") (ModuleTarget "PMain") + , TargetComponent "q-0.1" (CExeName "qexe") (ModuleTarget "QMain") + ] + + reportSubCase "file" + do + Right ts <- + readTargetSelectors' + [ "./P.hs" + , "p:P.lhs" + , "lib:p:P.hsc" + , "p:p:P.hsc" + , ":pkg:p:lib:p:file:P.y" + , "q/QQ.hs" + , "q:QQ.lhs" + , "lib:q:QQ.hsc" + , "q:q:QQ.hsc" + , ":pkg:q:lib:q:file:QQ.y" + , "q/Q.hs" + , "q:Q.lhs" + , "lib:q:Q.hsc" + , "q:q:Q.hsc" + , ":pkg:q:lib:q:file:Q.y" + , "app/Main.hs" + , "p:app/Main.hs" + , "exe:ppexe:app/Main.hs" + , "p:ppexe:app/Main.hs" + , ":pkg:p:exe:ppexe:file:app/Main.hs" + , "a p p/Main.hs" + , "p:a p p/Main.hs" + , "exe:pppexe:a p p/Main.hs" + , "p:pppexe:a p p/Main.hs" + , ":pkg:p:exe:pppexe:file:a p p/Main.hs" + ] + ts + @?= replicate 5 (TargetComponent "p-0.1" (CLibName LMainLibName) (FileTarget "P")) + ++ replicate 5 (TargetComponent "q-0.1" (CLibName LMainLibName) (FileTarget "QQ")) + ++ replicate 5 (TargetComponent "q-0.1" (CLibName LMainLibName) (FileTarget "Q")) + ++ replicate 5 (TargetComponent "p-0.1" (CExeName "ppexe") (FileTarget ("app" "Main.hs"))) + ++ replicate 5 (TargetComponent "p-0.1" (CExeName "pppexe") (FileTarget ("a p p" "Main.hs"))) + -- Note there's a bit of an inconsistency here: for the single-part + -- syntax the target has to point to a file that exists, whereas for + -- all the other forms we don't require that. - reportSubCase "component" - do Right ts <- readTargetSelectors' - [ "p", "lib:p", "p:lib:p", ":pkg:p:lib:p" - , "lib:q", "q:lib:q", ":pkg:q:lib:q" ] - ts @?= replicate 4 (TargetComponent "p-0.1" (CLibName LMainLibName) WholeComponent) - ++ replicate 3 (TargetComponent "q-0.1" (CLibName LMainLibName) WholeComponent) - - reportSubCase "module" - do Right ts <- readTargetSelectors' - [ "P", "lib:p:P", "p:p:P", ":pkg:p:lib:p:module:P" - , "QQ", "lib:q:QQ", "q:q:QQ", ":pkg:q:lib:q:module:QQ" - , "pexe:PMain" -- p:P or q:QQ would be ambiguous here - , "qexe:QMain" -- package p vs component p - ] - ts @?= replicate 4 (TargetComponent "p-0.1" (CLibName LMainLibName) (ModuleTarget "P")) - ++ replicate 4 (TargetComponent "q-0.1" (CLibName LMainLibName) (ModuleTarget "QQ")) - ++ [ TargetComponent "p-0.1" (CExeName "pexe") (ModuleTarget "PMain") - , TargetComponent "q-0.1" (CExeName "qexe") (ModuleTarget "QMain") - ] - - reportSubCase "file" - do Right ts <- readTargetSelectors' - [ "./P.hs", "p:P.lhs", "lib:p:P.hsc", "p:p:P.hsc", - ":pkg:p:lib:p:file:P.y" - , "q/QQ.hs", "q:QQ.lhs", "lib:q:QQ.hsc", "q:q:QQ.hsc", - ":pkg:q:lib:q:file:QQ.y" - , "q/Q.hs", "q:Q.lhs", "lib:q:Q.hsc", "q:q:Q.hsc", - ":pkg:q:lib:q:file:Q.y" - , "app/Main.hs", "p:app/Main.hs", "exe:ppexe:app/Main.hs", "p:ppexe:app/Main.hs", - ":pkg:p:exe:ppexe:file:app/Main.hs" - ] - ts @?= replicate 5 (TargetComponent "p-0.1" (CLibName LMainLibName) (FileTarget "P")) - ++ replicate 5 (TargetComponent "q-0.1" (CLibName LMainLibName) (FileTarget "QQ")) - ++ replicate 5 (TargetComponent "q-0.1" (CLibName LMainLibName) (FileTarget "Q")) - ++ replicate 5 (TargetComponent "p-0.1" (CExeName "ppexe") (FileTarget ("app" "Main.hs"))) - -- Note there's a bit of an inconsistency here: for the single-part - -- syntax the target has to point to a file that exists, whereas for - -- all the other forms we don't require that. - - cleanProject testdir + cleanProject testdir where testdir = "targets/simple" - config = mempty - + config = mempty testTargetSelectorBadSyntax :: Assertion testTargetSelectorBadSyntax = do - (_, _, _, localPackages, _) <- configureProject testdir config - let targets = [ "foo bar", " foo" - , "foo:", "foo::bar" - , "foo: ", "foo: :bar" - , "a:b:c:d:e:f", "a:b:c:d:e:f:g:h" ] - Left errs <- readTargetSelectors localPackages Nothing targets - zipWithM_ (@?=) errs (map TargetSelectorUnrecognised targets) - cleanProject testdir + (_, _, _, localPackages, _) <- configureProject testdir config + let targets = + [ "foo:" + , "foo::bar" + , " :foo" + , "foo: :bar" + , "a:b:c:d:e:f" + , "a:b:c:d:e:f:g:h" + ] + Left errs <- readTargetSelectors localPackages Nothing targets + zipWithM_ (@?=) errs (map TargetSelectorUnrecognised targets) + cleanProject testdir where testdir = "targets/empty" - config = mempty - + config = mempty testTargetSelectorAmbiguous :: (String -> IO ()) -> Assertion testTargetSelectorAmbiguous reportSubCase = do + -- 'all' is ambiguous with packages and cwd components + reportSubCase "ambiguous: all vs pkg" + assertAmbiguous + "all" + [mkTargetPackage "all", mkTargetAllPackages] + [mkpkg "all" []] + + reportSubCase "ambiguous: all vs cwd component" + assertAmbiguous + "all" + [mkTargetComponent "other" (CExeName "all"), mkTargetAllPackages] + [mkpkg "other" [mkexe "all"]] + + -- but 'all' is not ambiguous with non-cwd components, modules or files + reportSubCase "unambiguous: all vs non-cwd comp, mod, file" + assertUnambiguous + "All" + mkTargetAllPackages + [ mkpkgAt "foo" [mkexe "All"] "foo" + , mkpkg + "bar" + [ mkexe "bar" `withModules` ["All"] + , mkexe "baz" `withCFiles` ["All"] + ] + ] - -- 'all' is ambiguous with packages and cwd components - reportSubCase "ambiguous: all vs pkg" - assertAmbiguous "all" - [mkTargetPackage "all", mkTargetAllPackages] - [mkpkg "all" []] - - reportSubCase "ambiguous: all vs cwd component" - assertAmbiguous "all" - [mkTargetComponent "other" (CExeName "all"), mkTargetAllPackages] - [mkpkg "other" [mkexe "all"]] - - -- but 'all' is not ambiguous with non-cwd components, modules or files - reportSubCase "unambiguous: all vs non-cwd comp, mod, file" - assertUnambiguous "All" - mkTargetAllPackages - [ mkpkgAt "foo" [mkexe "All"] "foo" - , mkpkg "bar" [ mkexe "bar" `withModules` ["All"] - , mkexe "baz" `withCFiles` ["All"] ] - ] + -- filters 'libs', 'exes' etc are ambiguous with packages and + -- local components + reportSubCase "ambiguous: cwd-pkg filter vs pkg" + assertAmbiguous + "libs" + [ mkTargetPackage "libs" + , TargetPackage TargetImplicitCwd ["libs"] (Just LibKind) + ] + [mkpkg "libs" []] - -- filters 'libs', 'exes' etc are ambiguous with packages and - -- local components - reportSubCase "ambiguous: cwd-pkg filter vs pkg" - assertAmbiguous "libs" - [ mkTargetPackage "libs" - , TargetPackage TargetImplicitCwd ["libs"] (Just LibKind) ] - [mkpkg "libs" []] - - reportSubCase "ambiguous: filter vs cwd component" - assertAmbiguous "exes" - [ mkTargetComponent "other" (CExeName "exes") - , TargetPackage TargetImplicitCwd ["other"] (Just ExeKind) ] - [mkpkg "other" [mkexe "exes"]] - - -- but filters are not ambiguous with non-cwd components, modules or files - reportSubCase "unambiguous: filter vs non-cwd comp, mod, file" - assertUnambiguous "Libs" - (TargetPackage TargetImplicitCwd ["bar"] (Just LibKind)) - [ mkpkgAt "foo" [mkexe "Libs"] "foo" - , mkpkg "bar" [ mkexe "bar" `withModules` ["Libs"] - , mkexe "baz" `withCFiles` ["Libs"] ] - ] + reportSubCase "ambiguous: filter vs cwd component" + assertAmbiguous + "exes" + [ mkTargetComponent "other" (CExeName "exes") + , TargetPackage TargetImplicitCwd ["other"] (Just ExeKind) + ] + [mkpkg "other" [mkexe "exes"]] + + -- but filters are not ambiguous with non-cwd components, modules or files + reportSubCase "unambiguous: filter vs non-cwd comp, mod, file" + assertUnambiguous + "Libs" + (TargetPackage TargetImplicitCwd ["bar"] (Just LibKind)) + [ mkpkgAt "foo" [mkexe "Libs"] "foo" + , mkpkg + "bar" + [ mkexe "bar" `withModules` ["Libs"] + , mkexe "baz" `withCFiles` ["Libs"] + ] + ] - -- local components shadow packages and other components - reportSubCase "unambiguous: cwd comp vs pkg, non-cwd comp" - assertUnambiguous "foo" - (mkTargetComponent "other" (CExeName "foo")) - [ mkpkg "other" [mkexe "foo"] - , mkpkgAt "other2" [mkexe "foo"] "other2" -- shadows non-local foo - , mkpkg "foo" [] ] -- shadows package foo - - -- local components shadow modules and files - reportSubCase "unambiguous: cwd comp vs module, file" - assertUnambiguous "Foo" - (mkTargetComponent "bar" (CExeName "Foo")) - [ mkpkg "bar" [mkexe "Foo"] - , mkpkg "other" [ mkexe "other" `withModules` ["Foo"] - , mkexe "other2" `withCFiles` ["Foo"] ] - ] + -- local components shadow packages and other components + reportSubCase "unambiguous: cwd comp vs pkg, non-cwd comp" + assertUnambiguous + "foo" + (mkTargetComponent "other" (CExeName "foo")) + [ mkpkg "other" [mkexe "foo"] + , mkpkgAt "other2" [mkexe "foo"] "other2" -- shadows non-local foo + , mkpkg "foo" [] -- shadows package foo + ] - -- packages shadow non-local components - reportSubCase "unambiguous: pkg vs non-cwd comp" - assertUnambiguous "foo" - (mkTargetPackage "foo") - [ mkpkg "foo" [] - , mkpkgAt "other" [mkexe "foo"] "other" -- shadows non-local foo - ] + -- local components shadow modules and files + reportSubCase "unambiguous: cwd comp vs module, file" + assertUnambiguous + "Foo" + (mkTargetComponent "bar" (CExeName "Foo")) + [ mkpkg "bar" [mkexe "Foo"] + , mkpkg + "other" + [ mkexe "other" `withModules` ["Foo"] + , mkexe "other2" `withCFiles` ["Foo"] + ] + ] - -- packages shadow modules and files - reportSubCase "unambiguous: pkg vs module, file" - assertUnambiguous "Foo" - (mkTargetPackage "Foo") - [ mkpkgAt "Foo" [] "foo" - , mkpkg "other" [ mkexe "other" `withModules` ["Foo"] - , mkexe "other2" `withCFiles` ["Foo"] ] - ] + -- packages shadow non-local components + reportSubCase "unambiguous: pkg vs non-cwd comp" + assertUnambiguous + "foo" + (mkTargetPackage "foo") + [ mkpkg "foo" [] + , mkpkgAt "other" [mkexe "foo"] "other" -- shadows non-local foo + ] - -- File target is ambiguous, part of multiple components - reportSubCase "ambiguous: file in multiple comps" - assertAmbiguous "Bar.hs" - [ mkTargetFile "foo" (CExeName "bar") "Bar" - , mkTargetFile "foo" (CExeName "bar2") "Bar" - ] - [ mkpkg "foo" [ mkexe "bar" `withModules` ["Bar"] - , mkexe "bar2" `withModules` ["Bar"] ] - ] - reportSubCase "ambiguous: file in multiple comps with path" - assertAmbiguous ("src" "Bar.hs") - [ mkTargetFile "foo" (CExeName "bar") ("src" "Bar") - , mkTargetFile "foo" (CExeName "bar2") ("src" "Bar") - ] - [ mkpkg "foo" [ mkexe "bar" `withModules` ["Bar"] `withHsSrcDirs` ["src"] - , mkexe "bar2" `withModules` ["Bar"] `withHsSrcDirs` ["src"] ] - ] + -- packages shadow modules and files + reportSubCase "unambiguous: pkg vs module, file" + assertUnambiguous + "Foo" + (mkTargetPackage "Foo") + [ mkpkgAt "Foo" [] "foo" + , mkpkg + "other" + [ mkexe "other" `withModules` ["Foo"] + , mkexe "other2" `withCFiles` ["Foo"] + ] + ] - -- non-exact case packages and components are ambiguous - reportSubCase "ambiguous: non-exact-case pkg names" - assertAmbiguous "Foo" - [ mkTargetPackage "foo", mkTargetPackage "FOO" ] - [ mkpkg "foo" [], mkpkg "FOO" [] ] - reportSubCase "ambiguous: non-exact-case comp names" - assertAmbiguous "Foo" - [ mkTargetComponent "bar" (CExeName "foo") - , mkTargetComponent "bar" (CExeName "FOO") ] - [ mkpkg "bar" [mkexe "foo", mkexe "FOO"] ] - - -- exact-case Module or File over non-exact case package or component - reportSubCase "unambiguous: module vs non-exact-case pkg, comp" - assertUnambiguous "Baz" - (mkTargetModule "other" (CExeName "other") "Baz") - [ mkpkg "baz" [mkexe "BAZ"] - , mkpkg "other" [ mkexe "other" `withModules` ["Baz"] ] - ] - reportSubCase "unambiguous: file vs non-exact-case pkg, comp" - assertUnambiguous "Baz" - (mkTargetFile "other" (CExeName "other") "Baz") - [ mkpkg "baz" [mkexe "BAZ"] - , mkpkg "other" [ mkexe "other" `withCFiles` ["Baz"] ] - ] + -- File target is ambiguous, part of multiple components + reportSubCase "ambiguous: file in multiple comps" + assertAmbiguous + "Bar.hs" + [ mkTargetFile "foo" (CExeName "bar") "Bar" + , mkTargetFile "foo" (CExeName "bar2") "Bar" + ] + [ mkpkg + "foo" + [ mkexe "bar" `withModules` ["Bar"] + , mkexe "bar2" `withModules` ["Bar"] + ] + ] + reportSubCase "ambiguous: file in multiple comps with path" + assertAmbiguous + ("src" "Bar.hs") + [ mkTargetFile "foo" (CExeName "bar") ("src" "Bar") + , mkTargetFile "foo" (CExeName "bar2") ("src" "Bar") + ] + [ mkpkg + "foo" + [ mkexe "bar" `withModules` ["Bar"] `withHsSrcDirs` ["src"] + , mkexe "bar2" `withModules` ["Bar"] `withHsSrcDirs` ["src"] + ] + ] + + -- non-exact case packages and components are ambiguous + reportSubCase "ambiguous: non-exact-case pkg names" + assertAmbiguous + "Foo" + [mkTargetPackage "foo", mkTargetPackage "FOO"] + [mkpkg "foo" [], mkpkg "FOO" []] + reportSubCase "ambiguous: non-exact-case comp names" + assertAmbiguous + "Foo" + [ mkTargetComponent "bar" (CExeName "foo") + , mkTargetComponent "bar" (CExeName "FOO") + ] + [mkpkg "bar" [mkexe "foo", mkexe "FOO"]] + + -- exact-case Module or File over non-exact case package or component + reportSubCase "unambiguous: module vs non-exact-case pkg, comp" + assertUnambiguous + "Baz" + (mkTargetModule "other" (CExeName "other") "Baz") + [ mkpkg "baz" [mkexe "BAZ"] + , mkpkg "other" [mkexe "other" `withModules` ["Baz"]] + ] + reportSubCase "unambiguous: file vs non-exact-case pkg, comp" + assertUnambiguous + "Baz" + (mkTargetFile "other" (CExeName "other") "Baz") + [ mkpkg "baz" [mkexe "BAZ"] + , mkpkg "other" [mkexe "other" `withCFiles` ["Baz"]] + ] where - assertAmbiguous :: String - -> [TargetSelector] - -> [SourcePackage (PackageLocation a)] - -> Assertion + assertAmbiguous + :: String + -> [TargetSelector] + -> [SourcePackage (PackageLocation a)] + -> Assertion assertAmbiguous str tss pkgs = do - res <- readTargetSelectorsWith - fakeDirActions - (map SpecificSourcePackage pkgs) - Nothing - [str] + res <- + readTargetSelectorsWith + fakeDirActions + (map SpecificSourcePackage pkgs) + Nothing + [str] case res of Left [TargetSelectorAmbiguous _ tss'] -> sort (map snd tss') @?= sort tss - _ -> assertFailure $ "expected Left [TargetSelectorAmbiguous _ _], " - ++ "got " ++ show res - - assertUnambiguous :: String - -> TargetSelector - -> [SourcePackage (PackageLocation a)] - -> Assertion + _ -> + assertFailure $ + "expected Left [TargetSelectorAmbiguous _ _], " + ++ "got " + ++ show res + + assertUnambiguous + :: String + -> TargetSelector + -> [SourcePackage (PackageLocation a)] + -> Assertion assertUnambiguous str ts pkgs = do - res <- readTargetSelectorsWith - fakeDirActions - (map SpecificSourcePackage pkgs) - Nothing - [str] + res <- + readTargetSelectorsWith + fakeDirActions + (map SpecificSourcePackage pkgs) + Nothing + [str] case res of Right [ts'] -> ts' @?= ts - _ -> assertFailure $ "expected Right [Target...], " - ++ "got " ++ show res - - fakeDirActions = TS.DirActions { - TS.doesFileExist = \_p -> return True, - TS.doesDirectoryExist = \_p -> return True, - TS.canonicalizePath = \p -> return ("/" p), -- FilePath.Unix. ? - TS.getCurrentDirectory = return "/" - } + _ -> + assertFailure $ + "expected Right [Target...], " + ++ "got " + ++ show res + + fakeDirActions = + TS.DirActions + { TS.doesFileExist = \_p -> return True + , TS.doesDirectoryExist = \_p -> return True + , TS.canonicalizePath = \p -> return ("/" p) -- FilePath.Unix. ? + , TS.getCurrentDirectory = return "/" + } mkpkg :: String -> [Executable] -> SourcePackage (PackageLocation a) mkpkg pkgidstr exes = mkpkgAt pkgidstr exes "" - mkpkgAt :: String -> [Executable] -> FilePath - -> SourcePackage (PackageLocation a) + mkpkgAt + :: String + -> [Executable] + -> FilePath + -> SourcePackage (PackageLocation a) mkpkgAt pkgidstr exes loc = - SourcePackage { - srcpkgPackageId = pkgid, - srcpkgSource = LocalUnpackedPackage loc, - srcpkgDescrOverride = Nothing, - srcpkgDescription = GenericPackageDescription { - packageDescription = emptyPackageDescription { package = pkgid }, - gpdScannedVersion = Nothing, - genPackageFlags = [], - condLibrary = Nothing, - condSubLibraries = [], - condForeignLibs = [], - condExecutables = [ ( exeName exe, CondNode exe [] [] ) - | exe <- exes ], - condTestSuites = [], - condBenchmarks = [] + SourcePackage + { srcpkgPackageId = pkgid + , srcpkgSource = LocalUnpackedPackage loc + , srcpkgDescrOverride = Nothing + , srcpkgDescription = + GenericPackageDescription + { packageDescription = emptyPackageDescription{package = pkgid} + , gpdScannedVersion = Nothing + , genPackageFlags = [] + , condLibrary = Nothing + , condSubLibraries = [] + , condForeignLibs = [] + , condExecutables = + [ (exeName exe, CondNode exe [] []) + | exe <- exes + ] + , condTestSuites = [] + , condBenchmarks = [] + } } - } where pkgid = fromMaybe (error $ "failed to parse " ++ pkgidstr) $ simpleParse pkgidstr mkexe :: String -> Executable - mkexe name = mempty { exeName = fromString name } + mkexe name = mempty{exeName = fromString name} withModules :: Executable -> [String] -> Executable withModules exe mods = - exe { buildInfo = (buildInfo exe) { otherModules = map fromString mods } } + exe{buildInfo = (buildInfo exe){otherModules = map fromString mods}} withCFiles :: Executable -> [FilePath] -> Executable withCFiles exe files = - exe { buildInfo = (buildInfo exe) { cSources = map unsafeMakeSymbolicPath files } } + exe{buildInfo = (buildInfo exe){cSources = map unsafeMakeSymbolicPath files}} withHsSrcDirs :: Executable -> [FilePath] -> Executable withHsSrcDirs exe srcDirs = - exe { buildInfo = (buildInfo exe) { hsSourceDirs = map unsafeMakeSymbolicPath srcDirs }} - + exe{buildInfo = (buildInfo exe){hsSourceDirs = map unsafeMakeSymbolicPath srcDirs}} mkTargetPackage :: PackageId -> TargetSelector mkTargetPackage pkgid = - TargetPackage TargetExplicitNamed [pkgid] Nothing + TargetPackage TargetExplicitNamed [pkgid] Nothing mkTargetComponent :: PackageId -> ComponentName -> TargetSelector mkTargetComponent pkgid cname = - TargetComponent pkgid cname WholeComponent + TargetComponent pkgid cname WholeComponent mkTargetModule :: PackageId -> ComponentName -> ModuleName -> TargetSelector mkTargetModule pkgid cname mname = - TargetComponent pkgid cname (ModuleTarget mname) + TargetComponent pkgid cname (ModuleTarget mname) mkTargetFile :: PackageId -> ComponentName -> String -> TargetSelector mkTargetFile pkgid cname fname = - TargetComponent pkgid cname (FileTarget fname) + TargetComponent pkgid cname (FileTarget fname) mkTargetAllPackages :: TargetSelector mkTargetAllPackages = TargetAllPackages Nothing instance IsString PackageIdentifier where - fromString pkgidstr = pkgid - where pkgid = fromMaybe (error $ "fromString @PackageIdentifier " ++ show pkgidstr) $ simpleParse pkgidstr - + fromString pkgidstr = pkgid + where + pkgid = fromMaybe (error $ "fromString @PackageIdentifier " ++ show pkgidstr) $ simpleParse pkgidstr testTargetSelectorNoCurrentPackage :: Assertion testTargetSelectorNoCurrentPackage = do - (_, _, _, localPackages, _) <- configureProject testdir config - let readTargetSelectors' = readTargetSelectorsWith (dirActions testdir) - localPackages - Nothing - targets = [ "libs", ":cwd:libs" - , "flibs", ":cwd:flibs" - , "exes", ":cwd:exes" - , "tests", ":cwd:tests" - , "benchmarks", ":cwd:benchmarks"] - Left errs <- readTargetSelectors' targets - zipWithM_ (@?=) errs - [ TargetSelectorNoCurrentPackage ts - | target <- targets - , let ts = fromMaybe (error $ "failed to parse target string " ++ target) $ parseTargetString target - ] - cleanProject testdir + (_, _, _, localPackages, _) <- configureProject testdir config + let readTargetSelectors' = + readTargetSelectorsWith + (dirActions testdir) + localPackages + Nothing + targets = + [ "libs" + , ":cwd:libs" + , "flibs" + , ":cwd:flibs" + , "exes" + , ":cwd:exes" + , "tests" + , ":cwd:tests" + , "benchmarks" + , ":cwd:benchmarks" + ] + Left errs <- readTargetSelectors' targets + zipWithM_ + (@?=) + errs + [ TargetSelectorNoCurrentPackage ts + | target <- targets + , let ts = fromMaybe (error $ "failed to parse target string " ++ target) $ parseTargetString target + ] + cleanProject testdir where testdir = "targets/complex" - config = mempty - + config = mempty testTargetSelectorNoTargets :: Assertion testTargetSelectorNoTargets = do - (_, _, _, localPackages, _) <- configureProject testdir config - Left errs <- readTargetSelectors localPackages Nothing [] - errs @?= [TargetSelectorNoTargetsInCwd True] - cleanProject testdir + (_, _, _, localPackages, _) <- configureProject testdir config + Left errs <- readTargetSelectors localPackages Nothing [] + errs @?= [TargetSelectorNoTargetsInCwd True] + cleanProject testdir where testdir = "targets/complex" - config = mempty - + config = mempty testTargetSelectorProjectEmpty :: Assertion testTargetSelectorProjectEmpty = do - (_, _, _, localPackages, _) <- configureProject testdir config - Left errs <- readTargetSelectors localPackages Nothing [] - errs @?= [TargetSelectorNoTargetsInProject] - cleanProject testdir + (_, _, _, localPackages, _) <- configureProject testdir config + Left errs <- readTargetSelectors localPackages Nothing [] + errs @?= [TargetSelectorNoTargetsInProject] + cleanProject testdir where testdir = "targets/empty" - config = mempty - + config = mempty -- | Ensure we don't miss primary package and produce -- TargetSelectorNoTargetsInCwd error due to symlink or @@ -573,952 +749,1231 @@ testTargetSelectorCanonicalizedPath = do -- Check that the symlink is there before running test as on Windows -- some versions/configurations of git won't pull down/create the symlink canRunTest <- doesDirectoryExist virtcwd - when canRunTest (do - let dirActions' = (dirActions symlink) { TS.getCurrentDirectory = return virtcwd } - Right ts <- readTargetSelectorsWith dirActions' localPackages Nothing [] - ts @?= [TargetPackage TargetImplicitCwd ["p-0.1"] Nothing]) + when + canRunTest + ( do + let dirActions' = (dirActions symlink){TS.getCurrentDirectory = return virtcwd} + Right ts <- readTargetSelectorsWith dirActions' localPackages Nothing [] + ts @?= [TargetPackage TargetImplicitCwd ["p-0.1"] Nothing] + ) cleanProject testdir where testdir = "targets/simple" symlink = "targets/symbolic-link-to-simple" config = mempty - testTargetProblemsCommon :: ProjectConfig -> Assertion testTargetProblemsCommon config0 = do - (_,elaboratedPlan,_) <- planProject testdir config - - let pkgIdMap :: Map.Map PackageName PackageId - pkgIdMap = Map.fromList - [ (packageName p, packageId p) - | p <- InstallPlan.toList elaboratedPlan ] - - cases :: [( TargetSelector -> TargetProblem' - , TargetSelector - )] - cases = - [ -- Cannot resolve packages outside of the project - ( \_ -> TargetProblemNoSuchPackage "foobar" - , mkTargetPackage "foobar" ) - - -- We cannot currently build components like testsuites or - -- benchmarks from packages that are not local to the project - , ( \_ -> TargetComponentNotProjectLocal - (pkgIdMap Map.! "filepath") (CTestName "filepath-tests") - WholeComponent - , mkTargetComponent (pkgIdMap Map.! "filepath") - (CTestName "filepath-tests") ) - - -- Components can be explicitly @buildable: False@ - , ( \_ -> TargetComponentNotBuildable "q-0.1" (CExeName "buildable-false") WholeComponent - , mkTargetComponent "q-0.1" (CExeName "buildable-false") ) - - -- Testsuites and benchmarks can be disabled by the solver if it - -- cannot satisfy deps - , ( \_ -> TargetOptionalStanzaDisabledBySolver "q-0.1" (CTestName "solver-disabled") WholeComponent - , mkTargetComponent "q-0.1" (CTestName "solver-disabled") ) - - -- Testsuites and benchmarks can be disabled explicitly by the - -- user via config - , ( \_ -> TargetOptionalStanzaDisabledByUser - "q-0.1" (CBenchName "user-disabled") WholeComponent - , mkTargetComponent "q-0.1" (CBenchName "user-disabled") ) - - -- An unknown package. The target selector resolution should only - -- produce known packages, so this should not happen with the - -- output from 'readTargetSelectors'. - , ( \_ -> TargetProblemNoSuchPackage "foobar" - , mkTargetPackage "foobar" ) - - -- An unknown component of a known package. The target selector - -- resolution should only produce known packages, so this should - -- not happen with the output from 'readTargetSelectors'. - , ( \_ -> TargetProblemNoSuchComponent "q-0.1" (CExeName "no-such") - , mkTargetComponent "q-0.1" (CExeName "no-such") ) + (_, elaboratedPlan, _) <- planProject testdir config + + let pkgIdMap :: Map.Map PackageName PackageId + pkgIdMap = + Map.fromList + [ (packageName p, packageId p) + | p <- InstallPlan.toList elaboratedPlan ] - assertTargetProblems - elaboratedPlan - CmdBuild.selectPackageTargets - CmdBuild.selectComponentTarget + cases + :: [ ( TargetSelector -> TargetProblem' + , TargetSelector + ) + ] + cases = + [ -- Cannot resolve packages outside of the project + + ( \_ -> TargetProblemNoSuchPackage "foobar" + , mkTargetPackage "foobar" + ) + , -- We cannot currently build components like testsuites or + -- benchmarks from packages that are not local to the project + + ( \_ -> + TargetComponentNotProjectLocal + (pkgIdMap Map.! "filepath") + (CTestName "filepath-tests") + WholeComponent + , mkTargetComponent + (pkgIdMap Map.! "filepath") + (CTestName "filepath-tests") + ) + , -- Components can be explicitly @buildable: False@ + + ( \_ -> TargetComponentNotBuildable "q-0.1" (CExeName "buildable-false") WholeComponent + , mkTargetComponent "q-0.1" (CExeName "buildable-false") + ) + , -- Testsuites and benchmarks can be disabled by the solver if it + -- cannot satisfy deps + + ( \_ -> TargetOptionalStanzaDisabledBySolver "q-0.1" (CTestName "solver-disabled") WholeComponent + , mkTargetComponent "q-0.1" (CTestName "solver-disabled") + ) + , -- Testsuites and benchmarks can be disabled explicitly by the + -- user via config + + ( \_ -> + TargetOptionalStanzaDisabledByUser + "q-0.1" + (CBenchName "user-disabled") + WholeComponent + , mkTargetComponent "q-0.1" (CBenchName "user-disabled") + ) + , -- An unknown package. The target selector resolution should only + -- produce known packages, so this should not happen with the + -- output from 'readTargetSelectors'. + + ( \_ -> TargetProblemNoSuchPackage "foobar" + , mkTargetPackage "foobar" + ) + , -- An unknown component of a known package. The target selector + -- resolution should only produce known packages, so this should + -- not happen with the output from 'readTargetSelectors'. + + ( \_ -> TargetProblemNoSuchComponent "q-0.1" (CExeName "no-such") + , mkTargetComponent "q-0.1" (CExeName "no-such") + ) + ] + assertTargetProblems + elaboratedPlan + CmdBuild.selectPackageTargets + CmdBuild.selectComponentTarget + cases where testdir = "targets/complex" - config = config0 { - projectConfigLocalPackages = (projectConfigLocalPackages config0) { - packageConfigBenchmarks = toFlag False - } - , projectConfigShared = (projectConfigShared config0) { - projectConfigConstraints = - [( UserConstraint (UserAnyQualifier "filepath") PackagePropertySource - , ConstraintSourceUnknown )] - } - } - + config = + config0 + { projectConfigLocalPackages = + (projectConfigLocalPackages config0) + { packageConfigBenchmarks = toFlag False + } + , projectConfigShared = + (projectConfigShared config0) + { projectConfigConstraints = + [ + ( UserConstraint (UserAnyQualifier "filepath") PackagePropertySource + , ConstraintSourceUnknown + ) + ] + } + } testTargetProblemsBuild :: ProjectConfig -> (String -> IO ()) -> Assertion testTargetProblemsBuild config reportSubCase = do + reportSubCase "empty-pkg" + assertProjectTargetProblems + "targets/empty-pkg" + config + CmdBuild.selectPackageTargets + CmdBuild.selectComponentTarget + [ (TargetProblemNoTargets, mkTargetPackage "p-0.1") + ] + + reportSubCase "all-disabled" + assertProjectTargetProblems + "targets/all-disabled" + config + { projectConfigLocalPackages = + (projectConfigLocalPackages config) + { packageConfigBenchmarks = toFlag False + } + } + CmdBuild.selectPackageTargets + CmdBuild.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget + "p-0.1" + (CBenchName "user-disabled") + TargetDisabledByUser + True + , AvailableTarget + "p-0.1" + (CTestName "solver-disabled") + TargetDisabledBySolver + True + , AvailableTarget + "p-0.1" + (CExeName "buildable-false") + TargetNotBuildable + True + , AvailableTarget + "p-0.1" + (CLibName LMainLibName) + TargetNotBuildable + True + ] + , mkTargetPackage "p-0.1" + ) + ] - reportSubCase "empty-pkg" - assertProjectTargetProblems - "targets/empty-pkg" config + reportSubCase "enabled component kinds" + -- When we explicitly enable all the component kinds then selecting the + -- whole package selects those component kinds too + do + (_, elaboratedPlan, _) <- + planProject + "targets/variety" + config + { projectConfigLocalPackages = + (projectConfigLocalPackages config) + { packageConfigTests = toFlag True + , packageConfigBenchmarks = toFlag True + } + } + assertProjectDistinctTargets + elaboratedPlan CmdBuild.selectPackageTargets CmdBuild.selectComponentTarget - [ ( TargetProblemNoTargets, mkTargetPackage "p-0.1" ) + [mkTargetPackage "p-0.1"] + [ ("p-0.1-inplace", (CLibName LMainLibName)) + , ("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark") + , ("p-0.1-inplace-a-testsuite", CTestName "a-testsuite") + , ("p-0.1-inplace-an-exe", CExeName "an-exe") + , ("p-0.1-inplace-libp", CFLibName "libp") ] - reportSubCase "all-disabled" - assertProjectTargetProblems - "targets/all-disabled" - config { - projectConfigLocalPackages = (projectConfigLocalPackages config) { - packageConfigBenchmarks = toFlag False - } - } + reportSubCase "disabled component kinds" + -- When we explicitly disable all the component kinds then selecting the + -- whole package only selects the library, foreign lib and exes + do + (_, elaboratedPlan, _) <- + planProject + "targets/variety" + config + { projectConfigLocalPackages = + (projectConfigLocalPackages config) + { packageConfigTests = toFlag False + , packageConfigBenchmarks = toFlag False + } + } + assertProjectDistinctTargets + elaboratedPlan CmdBuild.selectPackageTargets CmdBuild.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CBenchName "user-disabled") - TargetDisabledByUser True - , AvailableTarget "p-0.1" (CTestName "solver-disabled") - TargetDisabledBySolver True - , AvailableTarget "p-0.1" (CExeName "buildable-false") - TargetNotBuildable True - , AvailableTarget "p-0.1" (CLibName LMainLibName) - TargetNotBuildable True - ] - , mkTargetPackage "p-0.1" ) + [mkTargetPackage "p-0.1"] + [ ("p-0.1-inplace", (CLibName LMainLibName)) + , ("p-0.1-inplace-an-exe", CExeName "an-exe") + , ("p-0.1-inplace-libp", CFLibName "libp") ] - reportSubCase "enabled component kinds" - -- When we explicitly enable all the component kinds then selecting the - -- whole package selects those component kinds too - do (_,elaboratedPlan,_) <- planProject "targets/variety" config { - projectConfigLocalPackages = (projectConfigLocalPackages config) { - packageConfigTests = toFlag True, - packageConfigBenchmarks = toFlag True - } - } - assertProjectDistinctTargets - elaboratedPlan - CmdBuild.selectPackageTargets - CmdBuild.selectComponentTarget - [ mkTargetPackage "p-0.1" ] - [ ("p-0.1-inplace", (CLibName LMainLibName)) - , ("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark") - , ("p-0.1-inplace-a-testsuite", CTestName "a-testsuite") - , ("p-0.1-inplace-an-exe", CExeName "an-exe") - , ("p-0.1-inplace-libp", CFLibName "libp") - ] - - reportSubCase "disabled component kinds" - -- When we explicitly disable all the component kinds then selecting the - -- whole package only selects the library, foreign lib and exes - do (_,elaboratedPlan,_) <- planProject "targets/variety" config { - projectConfigLocalPackages = (projectConfigLocalPackages config) { - packageConfigTests = toFlag False, - packageConfigBenchmarks = toFlag False - } - } - assertProjectDistinctTargets - elaboratedPlan - CmdBuild.selectPackageTargets - CmdBuild.selectComponentTarget - [ mkTargetPackage "p-0.1" ] - [ ("p-0.1-inplace", (CLibName LMainLibName)) - , ("p-0.1-inplace-an-exe", CExeName "an-exe") - , ("p-0.1-inplace-libp", CFLibName "libp") - ] - - reportSubCase "requested component kinds" - -- When we selecting the package with an explicit filter then we get those - -- components even though we did not explicitly enable tests/benchmarks - do (_,elaboratedPlan,_) <- planProject "targets/variety" config - assertProjectDistinctTargets - elaboratedPlan - CmdBuild.selectPackageTargets - CmdBuild.selectComponentTarget - [ TargetPackage TargetExplicitNamed ["p-0.1"] (Just TestKind) - , TargetPackage TargetExplicitNamed ["p-0.1"] (Just BenchKind) - ] - [ ("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark") - , ("p-0.1-inplace-a-testsuite", CTestName "a-testsuite") - ] - + reportSubCase "requested component kinds" + -- When we selecting the package with an explicit filter then we get those + -- components even though we did not explicitly enable tests/benchmarks + do + (_, elaboratedPlan, _) <- planProject "targets/variety" config + assertProjectDistinctTargets + elaboratedPlan + CmdBuild.selectPackageTargets + CmdBuild.selectComponentTarget + [ TargetPackage TargetExplicitNamed ["p-0.1"] (Just TestKind) + , TargetPackage TargetExplicitNamed ["p-0.1"] (Just BenchKind) + ] + [ ("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark") + , ("p-0.1-inplace-a-testsuite", CTestName "a-testsuite") + ] testTargetProblemsRepl :: ProjectConfig -> (String -> IO ()) -> Assertion testTargetProblemsRepl config reportSubCase = do + reportSubCase "multiple-libs" + assertProjectTargetProblems + "targets/multiple-libs" + config + (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) + CmdRepl.selectComponentTarget + [ + ( flip + (CmdRepl.matchesMultipleProblem (CmdRepl.MultiReplDecision Nothing False)) + [ AvailableTarget + "p-0.1" + (CLibName LMainLibName) + (TargetBuildable () TargetRequestedByDefault) + True + , AvailableTarget + "q-0.1" + (CLibName LMainLibName) + (TargetBuildable () TargetRequestedByDefault) + True + ] + , mkTargetAllPackages + ) + ] - reportSubCase "multiple-libs" - assertProjectTargetProblems - "targets/multiple-libs" config - (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) - CmdRepl.selectComponentTarget - [ ( flip (CmdRepl.matchesMultipleProblem (CmdRepl.MultiReplDecision Nothing False)) - [ AvailableTarget "p-0.1" (CLibName LMainLibName) - (TargetBuildable () TargetRequestedByDefault) True - , AvailableTarget "q-0.1" (CLibName LMainLibName) - (TargetBuildable () TargetRequestedByDefault) True - ] - , mkTargetAllPackages ) - ] + reportSubCase "multiple-exes" + assertProjectTargetProblems + "targets/multiple-exes" + config + (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) + CmdRepl.selectComponentTarget + [ + ( flip + (CmdRepl.matchesMultipleProblem (CmdRepl.MultiReplDecision Nothing False)) + [ AvailableTarget + "p-0.1" + (CExeName "p2") + (TargetBuildable () TargetRequestedByDefault) + True + , AvailableTarget + "p-0.1" + (CExeName "p1") + (TargetBuildable () TargetRequestedByDefault) + True + ] + , mkTargetPackage "p-0.1" + ) + ] - reportSubCase "multiple-exes" - assertProjectTargetProblems - "targets/multiple-exes" config - (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) - CmdRepl.selectComponentTarget - [ ( flip (CmdRepl.matchesMultipleProblem (CmdRepl.MultiReplDecision Nothing False)) - [ AvailableTarget "p-0.1" (CExeName "p2") - (TargetBuildable () TargetRequestedByDefault) True - , AvailableTarget "p-0.1" (CExeName "p1") - (TargetBuildable () TargetRequestedByDefault) True - ] - , mkTargetPackage "p-0.1" ) - ] + reportSubCase "multiple-tests" + assertProjectTargetProblems + "targets/multiple-tests" + config + (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) + CmdRepl.selectComponentTarget + [ + ( flip + (CmdRepl.matchesMultipleProblem (CmdRepl.MultiReplDecision Nothing False)) + [ AvailableTarget + "p-0.1" + (CTestName "p2") + (TargetBuildable () TargetNotRequestedByDefault) + True + , AvailableTarget + "p-0.1" + (CTestName "p1") + (TargetBuildable () TargetNotRequestedByDefault) + True + ] + , TargetPackage TargetExplicitNamed ["p-0.1"] (Just TestKind) + ) + ] - reportSubCase "multiple-tests" - assertProjectTargetProblems - "targets/multiple-tests" config + reportSubCase "multiple targets" + do + (_, elaboratedPlan, _) <- planProject "targets/multiple-exes" config + assertProjectDistinctTargets + elaboratedPlan (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) CmdRepl.selectComponentTarget - [ ( flip (CmdRepl.matchesMultipleProblem (CmdRepl.MultiReplDecision Nothing False)) - [ AvailableTarget "p-0.1" (CTestName "p2") - (TargetBuildable () TargetNotRequestedByDefault) True - , AvailableTarget "p-0.1" (CTestName "p1") - (TargetBuildable () TargetNotRequestedByDefault) True - ] - , TargetPackage TargetExplicitNamed ["p-0.1"] (Just TestKind) ) + [ mkTargetComponent "p-0.1" (CExeName "p1") + , mkTargetComponent "p-0.1" (CExeName "p2") + ] + [ ("p-0.1-inplace-p1", CExeName "p1") + , ("p-0.1-inplace-p2", CExeName "p2") ] - reportSubCase "multiple targets" - do (_,elaboratedPlan,_) <- planProject "targets/multiple-exes" config - assertProjectDistinctTargets - elaboratedPlan - (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) - CmdRepl.selectComponentTarget - [ mkTargetComponent "p-0.1" (CExeName "p1") - , mkTargetComponent "p-0.1" (CExeName "p2") - ] - [ ("p-0.1-inplace-p1", CExeName "p1") - , ("p-0.1-inplace-p2", CExeName "p2") - ] + reportSubCase "libs-disabled" + assertProjectTargetProblems + "targets/libs-disabled" + config + (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) + CmdRepl.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [AvailableTarget "p-0.1" (CLibName LMainLibName) TargetNotBuildable True] + , mkTargetPackage "p-0.1" + ) + ] - reportSubCase "libs-disabled" - assertProjectTargetProblems - "targets/libs-disabled" config - (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) - CmdRepl.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CLibName LMainLibName) TargetNotBuildable True ] - , mkTargetPackage "p-0.1" ) - ] + reportSubCase "exes-disabled" + assertProjectTargetProblems + "targets/exes-disabled" + config + (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) + CmdRepl.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget "p-0.1" (CExeName "p") TargetNotBuildable True + ] + , mkTargetPackage "p-0.1" + ) + ] - reportSubCase "exes-disabled" - assertProjectTargetProblems - "targets/exes-disabled" config + reportSubCase "test-only" + assertProjectTargetProblems + "targets/test-only" + config + (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) + CmdRepl.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget + "p-0.1" + (CTestName "pexe") + (TargetBuildable () TargetNotRequestedByDefault) + True + ] + , mkTargetPackage "p-0.1" + ) + ] + + reportSubCase "empty-pkg" + assertProjectTargetProblems + "targets/empty-pkg" + config + (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) + CmdRepl.selectComponentTarget + [ (TargetProblemNoTargets, mkTargetPackage "p-0.1") + ] + + reportSubCase "requested component kinds" + do + (_, elaboratedPlan, _) <- planProject "targets/variety" config + -- by default we only get the lib + assertProjectDistinctTargets + elaboratedPlan (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) CmdRepl.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CExeName "p") TargetNotBuildable True - ] - , mkTargetPackage "p-0.1" ) - ] - - reportSubCase "test-only" - assertProjectTargetProblems - "targets/test-only" config + [TargetPackage TargetExplicitNamed ["p-0.1"] Nothing] + [("p-0.1-inplace", (CLibName LMainLibName))] + -- When we select the package with an explicit filter then we get those + -- components even though we did not explicitly enable tests/benchmarks + assertProjectDistinctTargets + elaboratedPlan (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) CmdRepl.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CTestName "pexe") - (TargetBuildable () TargetNotRequestedByDefault) True - ] - , mkTargetPackage "p-0.1" ) - ] - - reportSubCase "empty-pkg" - assertProjectTargetProblems - "targets/empty-pkg" config + [TargetPackage TargetExplicitNamed ["p-0.1"] (Just TestKind)] + [("p-0.1-inplace-a-testsuite", CTestName "a-testsuite")] + assertProjectDistinctTargets + elaboratedPlan (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) CmdRepl.selectComponentTarget - [ ( TargetProblemNoTargets, mkTargetPackage "p-0.1" ) - ] - - reportSubCase "requested component kinds" - do (_,elaboratedPlan,_) <- planProject "targets/variety" config - -- by default we only get the lib - assertProjectDistinctTargets - elaboratedPlan - (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) - CmdRepl.selectComponentTarget - [ TargetPackage TargetExplicitNamed ["p-0.1"] Nothing ] - [ ("p-0.1-inplace", (CLibName LMainLibName)) ] - -- When we select the package with an explicit filter then we get those - -- components even though we did not explicitly enable tests/benchmarks - assertProjectDistinctTargets - elaboratedPlan - (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) - CmdRepl.selectComponentTarget - [ TargetPackage TargetExplicitNamed ["p-0.1"] (Just TestKind) ] - [ ("p-0.1-inplace-a-testsuite", CTestName "a-testsuite") ] - assertProjectDistinctTargets - elaboratedPlan - (CmdRepl.selectPackageTargets (CmdRepl.MultiReplDecision Nothing False)) - CmdRepl.selectComponentTarget - [ TargetPackage TargetExplicitNamed ["p-0.1"] (Just BenchKind) ] - [ ("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark") ] + [TargetPackage TargetExplicitNamed ["p-0.1"] (Just BenchKind)] + [("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark")] testTargetProblemsListBin :: ProjectConfig -> (String -> IO ()) -> Assertion testTargetProblemsListBin config reportSubCase = do - reportSubCase "one-of-each" - do (_,elaboratedPlan,_) <- planProject "targets/one-of-each" config - assertProjectDistinctTargets - elaboratedPlan - CmdListBin.selectPackageTargets - CmdListBin.selectComponentTarget - [ TargetPackage TargetExplicitNamed ["p-0.1"] Nothing - ] - [ ("p-0.1-inplace-p1", CExeName "p1") - ] - - reportSubCase "multiple-exes" - assertProjectTargetProblems - "targets/multiple-exes" config + reportSubCase "one-of-each" + do + (_, elaboratedPlan, _) <- planProject "targets/one-of-each" config + assertProjectDistinctTargets + elaboratedPlan CmdListBin.selectPackageTargets CmdListBin.selectComponentTarget - [ ( flip CmdListBin.matchesMultipleProblem - [ AvailableTarget "p-0.1" (CExeName "p2") - (TargetBuildable () TargetRequestedByDefault) True - , AvailableTarget "p-0.1" (CExeName "p1") - (TargetBuildable () TargetRequestedByDefault) True - ] - , mkTargetPackage "p-0.1" ) + [ TargetPackage TargetExplicitNamed ["p-0.1"] Nothing + ] + [ ("p-0.1-inplace-p1", CExeName "p1") ] - reportSubCase "multiple targets" - do (_,elaboratedPlan,_) <- planProject "targets/multiple-exes" config - assertProjectDistinctTargets - elaboratedPlan - CmdListBin.selectPackageTargets - CmdListBin.selectComponentTarget - [ mkTargetComponent "p-0.1" (CExeName "p1") - , mkTargetComponent "p-0.1" (CExeName "p2") - ] - [ ("p-0.1-inplace-p1", CExeName "p1") - , ("p-0.1-inplace-p2", CExeName "p2") - ] + reportSubCase "multiple-exes" + assertProjectTargetProblems + "targets/multiple-exes" + config + CmdListBin.selectPackageTargets + CmdListBin.selectComponentTarget + [ + ( flip + CmdListBin.matchesMultipleProblem + [ AvailableTarget + "p-0.1" + (CExeName "p2") + (TargetBuildable () TargetRequestedByDefault) + True + , AvailableTarget + "p-0.1" + (CExeName "p1") + (TargetBuildable () TargetRequestedByDefault) + True + ] + , mkTargetPackage "p-0.1" + ) + ] - reportSubCase "exes-disabled" - assertProjectTargetProblems - "targets/exes-disabled" config + reportSubCase "multiple targets" + do + (_, elaboratedPlan, _) <- planProject "targets/multiple-exes" config + assertProjectDistinctTargets + elaboratedPlan CmdListBin.selectPackageTargets CmdListBin.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CExeName "p") TargetNotBuildable True - ] - , mkTargetPackage "p-0.1" ) + [ mkTargetComponent "p-0.1" (CExeName "p1") + , mkTargetComponent "p-0.1" (CExeName "p2") ] - - reportSubCase "empty-pkg" - assertProjectTargetProblems - "targets/empty-pkg" config - CmdListBin.selectPackageTargets - CmdListBin.selectComponentTarget - [ ( TargetProblemNoTargets, mkTargetPackage "p-0.1" ) + [ ("p-0.1-inplace-p1", CExeName "p1") + , ("p-0.1-inplace-p2", CExeName "p2") ] - reportSubCase "lib-only" - assertProjectTargetProblems - "targets/lib-only" config - CmdListBin.selectPackageTargets - CmdListBin.selectComponentTarget - [ (CmdListBin.noComponentsProblem, mkTargetPackage "p-0.1" ) - ] + reportSubCase "exes-disabled" + assertProjectTargetProblems + "targets/exes-disabled" + config + CmdListBin.selectPackageTargets + CmdListBin.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget "p-0.1" (CExeName "p") TargetNotBuildable True + ] + , mkTargetPackage "p-0.1" + ) + ] + + reportSubCase "empty-pkg" + assertProjectTargetProblems + "targets/empty-pkg" + config + CmdListBin.selectPackageTargets + CmdListBin.selectComponentTarget + [ (TargetProblemNoTargets, mkTargetPackage "p-0.1") + ] + + reportSubCase "lib-only" + assertProjectTargetProblems + "targets/lib-only" + config + CmdListBin.selectPackageTargets + CmdListBin.selectComponentTarget + [ (CmdListBin.noComponentsProblem, mkTargetPackage "p-0.1") + ] testTargetProblemsRun :: ProjectConfig -> (String -> IO ()) -> Assertion testTargetProblemsRun config reportSubCase = do - reportSubCase "one-of-each" - do (_,elaboratedPlan,_) <- planProject "targets/one-of-each" config - assertProjectDistinctTargets - elaboratedPlan - CmdRun.selectPackageTargets - CmdRun.selectComponentTarget - [ TargetPackage TargetExplicitNamed ["p-0.1"] Nothing - ] - [ ("p-0.1-inplace-p1", CExeName "p1") - ] - - reportSubCase "multiple-exes" - assertProjectTargetProblems - "targets/multiple-exes" config + reportSubCase "one-of-each" + do + (_, elaboratedPlan, _) <- planProject "targets/one-of-each" config + assertProjectDistinctTargets + elaboratedPlan CmdRun.selectPackageTargets CmdRun.selectComponentTarget - [ ( flip CmdRun.matchesMultipleProblem - [ AvailableTarget "p-0.1" (CExeName "p2") - (TargetBuildable () TargetRequestedByDefault) True - , AvailableTarget "p-0.1" (CExeName "p1") - (TargetBuildable () TargetRequestedByDefault) True - ] - , mkTargetPackage "p-0.1" ) + [ TargetPackage TargetExplicitNamed ["p-0.1"] Nothing + ] + [ ("p-0.1-inplace-p1", CExeName "p1") ] - reportSubCase "multiple targets" - do (_,elaboratedPlan,_) <- planProject "targets/multiple-exes" config - assertProjectDistinctTargets - elaboratedPlan - CmdRun.selectPackageTargets - CmdRun.selectComponentTarget - [ mkTargetComponent "p-0.1" (CExeName "p1") - , mkTargetComponent "p-0.1" (CExeName "p2") - ] - [ ("p-0.1-inplace-p1", CExeName "p1") - , ("p-0.1-inplace-p2", CExeName "p2") - ] + reportSubCase "multiple-exes" + assertProjectTargetProblems + "targets/multiple-exes" + config + CmdRun.selectPackageTargets + CmdRun.selectComponentTarget + [ + ( flip + CmdRun.matchesMultipleProblem + [ AvailableTarget + "p-0.1" + (CExeName "p2") + (TargetBuildable () TargetRequestedByDefault) + True + , AvailableTarget + "p-0.1" + (CExeName "p1") + (TargetBuildable () TargetRequestedByDefault) + True + ] + , mkTargetPackage "p-0.1" + ) + ] - reportSubCase "exes-disabled" - assertProjectTargetProblems - "targets/exes-disabled" config + reportSubCase "multiple targets" + do + (_, elaboratedPlan, _) <- planProject "targets/multiple-exes" config + assertProjectDistinctTargets + elaboratedPlan CmdRun.selectPackageTargets CmdRun.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CExeName "p") TargetNotBuildable True - ] - , mkTargetPackage "p-0.1" ) + [ mkTargetComponent "p-0.1" (CExeName "p1") + , mkTargetComponent "p-0.1" (CExeName "p2") ] - - reportSubCase "empty-pkg" - assertProjectTargetProblems - "targets/empty-pkg" config - CmdRun.selectPackageTargets - CmdRun.selectComponentTarget - [ ( TargetProblemNoTargets, mkTargetPackage "p-0.1" ) + [ ("p-0.1-inplace-p1", CExeName "p1") + , ("p-0.1-inplace-p2", CExeName "p2") ] - reportSubCase "lib-only" - assertProjectTargetProblems - "targets/lib-only" config - CmdRun.selectPackageTargets - CmdRun.selectComponentTarget - [ (CmdRun.noExesProblem, mkTargetPackage "p-0.1" ) - ] + reportSubCase "exes-disabled" + assertProjectTargetProblems + "targets/exes-disabled" + config + CmdRun.selectPackageTargets + CmdRun.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget "p-0.1" (CExeName "p") TargetNotBuildable True + ] + , mkTargetPackage "p-0.1" + ) + ] + + reportSubCase "empty-pkg" + assertProjectTargetProblems + "targets/empty-pkg" + config + CmdRun.selectPackageTargets + CmdRun.selectComponentTarget + [ (TargetProblemNoTargets, mkTargetPackage "p-0.1") + ] + reportSubCase "lib-only" + assertProjectTargetProblems + "targets/lib-only" + config + CmdRun.selectPackageTargets + CmdRun.selectComponentTarget + [ (CmdRun.noExesProblem, mkTargetPackage "p-0.1") + ] testTargetProblemsTest :: ProjectConfig -> (String -> IO ()) -> Assertion testTargetProblemsTest config reportSubCase = do - - reportSubCase "disabled by config" - assertProjectTargetProblems - "targets/tests-disabled" - config { - projectConfigLocalPackages = (projectConfigLocalPackages config) { - packageConfigTests = toFlag False - } + reportSubCase "disabled by config" + assertProjectTargetProblems + "targets/tests-disabled" + config + { projectConfigLocalPackages = + (projectConfigLocalPackages config) + { packageConfigTests = toFlag False + } } - CmdTest.selectPackageTargets - CmdTest.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CTestName "user-disabled") - TargetDisabledByUser True - , AvailableTarget "p-0.1" (CTestName "solver-disabled") - TargetDisabledByUser True - ] - , mkTargetPackage "p-0.1" ) - ] + CmdTest.selectPackageTargets + CmdTest.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget + "p-0.1" + (CTestName "user-disabled") + TargetDisabledByUser + True + , AvailableTarget + "p-0.1" + (CTestName "solver-disabled") + TargetDisabledByUser + True + ] + , mkTargetPackage "p-0.1" + ) + ] - reportSubCase "disabled by solver & buildable false" - assertProjectTargetProblems - "targets/tests-disabled" - config - CmdTest.selectPackageTargets - CmdTest.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CTestName "user-disabled") - TargetDisabledBySolver True - , AvailableTarget "p-0.1" (CTestName "solver-disabled") - TargetDisabledBySolver True - ] - , mkTargetPackage "p-0.1" ) - - , ( flip TargetProblemNoneEnabled - [ AvailableTarget "q-0.1" (CTestName "buildable-false") - TargetNotBuildable True - ] - , mkTargetPackage "q-0.1" ) - ] + reportSubCase "disabled by solver & buildable false" + assertProjectTargetProblems + "targets/tests-disabled" + config + CmdTest.selectPackageTargets + CmdTest.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget + "p-0.1" + (CTestName "user-disabled") + TargetDisabledBySolver + True + , AvailableTarget + "p-0.1" + (CTestName "solver-disabled") + TargetDisabledBySolver + True + ] + , mkTargetPackage "p-0.1" + ) + , + ( flip + TargetProblemNoneEnabled + [ AvailableTarget + "q-0.1" + (CTestName "buildable-false") + TargetNotBuildable + True + ] + , mkTargetPackage "q-0.1" + ) + ] - reportSubCase "empty-pkg" - assertProjectTargetProblems - "targets/empty-pkg" config - CmdTest.selectPackageTargets - CmdTest.selectComponentTarget - [ ( TargetProblemNoTargets, mkTargetPackage "p-0.1" ) - ] + reportSubCase "empty-pkg" + assertProjectTargetProblems + "targets/empty-pkg" + config + CmdTest.selectPackageTargets + CmdTest.selectComponentTarget + [ (TargetProblemNoTargets, mkTargetPackage "p-0.1") + ] - reportSubCase "no tests" - assertProjectTargetProblems - "targets/simple" - config - CmdTest.selectPackageTargets - CmdTest.selectComponentTarget - [ ( CmdTest.noTestsProblem, mkTargetPackage "p-0.1" ) - , ( CmdTest.noTestsProblem, mkTargetPackage "q-0.1" ) - ] + reportSubCase "no tests" + assertProjectTargetProblems + "targets/simple" + config + CmdTest.selectPackageTargets + CmdTest.selectComponentTarget + [ (CmdTest.noTestsProblem, mkTargetPackage "p-0.1") + , (CmdTest.noTestsProblem, mkTargetPackage "q-0.1") + ] - reportSubCase "not a test" - assertProjectTargetProblems - "targets/variety" - config - CmdTest.selectPackageTargets - CmdTest.selectComponentTarget $ - [ ( const (CmdTest.notTestProblem - "p-0.1" (CLibName LMainLibName)) - , mkTargetComponent "p-0.1" (CLibName LMainLibName) ) - - , ( const (CmdTest.notTestProblem - "p-0.1" (CExeName "an-exe")) - , mkTargetComponent "p-0.1" (CExeName "an-exe") ) - - , ( const (CmdTest.notTestProblem - "p-0.1" (CFLibName "libp")) - , mkTargetComponent "p-0.1" (CFLibName "libp") ) - - , ( const (CmdTest.notTestProblem - "p-0.1" (CBenchName "a-benchmark")) - , mkTargetComponent "p-0.1" (CBenchName "a-benchmark") ) - ] ++ - [ ( const (CmdTest.isSubComponentProblem - "p-0.1" cname (ModuleTarget modname)) - , mkTargetModule "p-0.1" cname modname ) - | (cname, modname) <- [ (CTestName "a-testsuite", "TestModule") - , (CBenchName "a-benchmark", "BenchModule") - , (CExeName "an-exe", "ExeModule") - , ((CLibName LMainLibName), "P") - ] - ] ++ - [ ( const (CmdTest.isSubComponentProblem - "p-0.1" cname (FileTarget fname)) - , mkTargetFile "p-0.1" cname fname) - | (cname, fname) <- [ (CTestName "a-testsuite", "Test.hs") - , (CBenchName "a-benchmark", "Bench.hs") - , (CExeName "an-exe", "Main.hs") - ] + reportSubCase "not a test" + assertProjectTargetProblems + "targets/variety" + config + CmdTest.selectPackageTargets + CmdTest.selectComponentTarget + $ [ + ( const + ( CmdTest.notTestProblem + "p-0.1" + (CLibName LMainLibName) + ) + , mkTargetComponent "p-0.1" (CLibName LMainLibName) + ) + , + ( const + ( CmdTest.notTestProblem + "p-0.1" + (CExeName "an-exe") + ) + , mkTargetComponent "p-0.1" (CExeName "an-exe") + ) + , + ( const + ( CmdTest.notTestProblem + "p-0.1" + (CFLibName "libp") + ) + , mkTargetComponent "p-0.1" (CFLibName "libp") + ) + , + ( const + ( CmdTest.notTestProblem + "p-0.1" + (CBenchName "a-benchmark") + ) + , mkTargetComponent "p-0.1" (CBenchName "a-benchmark") + ) ] - + ++ [ ( const + ( CmdTest.isSubComponentProblem + "p-0.1" + cname + (ModuleTarget modname) + ) + , mkTargetModule "p-0.1" cname modname + ) + | (cname, modname) <- + [ (CTestName "a-testsuite", "TestModule") + , (CBenchName "a-benchmark", "BenchModule") + , (CExeName "an-exe", "ExeModule") + , ((CLibName LMainLibName), "P") + ] + ] + ++ [ ( const + ( CmdTest.isSubComponentProblem + "p-0.1" + cname + (FileTarget fname) + ) + , mkTargetFile "p-0.1" cname fname + ) + | (cname, fname) <- + [ (CTestName "a-testsuite", "Test.hs") + , (CBenchName "a-benchmark", "Bench.hs") + , (CExeName "an-exe", "Main.hs") + ] + ] testTargetProblemsBench :: ProjectConfig -> (String -> IO ()) -> Assertion testTargetProblemsBench config reportSubCase = do - - reportSubCase "disabled by config" - assertProjectTargetProblems - "targets/benchmarks-disabled" - config { - projectConfigLocalPackages = (projectConfigLocalPackages config) { - packageConfigBenchmarks = toFlag False - } + reportSubCase "disabled by config" + assertProjectTargetProblems + "targets/benchmarks-disabled" + config + { projectConfigLocalPackages = + (projectConfigLocalPackages config) + { packageConfigBenchmarks = toFlag False + } } - CmdBench.selectPackageTargets - CmdBench.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CBenchName "user-disabled") - TargetDisabledByUser True - , AvailableTarget "p-0.1" (CBenchName "solver-disabled") - TargetDisabledByUser True - ] - , mkTargetPackage "p-0.1" ) - ] + CmdBench.selectPackageTargets + CmdBench.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget + "p-0.1" + (CBenchName "user-disabled") + TargetDisabledByUser + True + , AvailableTarget + "p-0.1" + (CBenchName "solver-disabled") + TargetDisabledByUser + True + ] + , mkTargetPackage "p-0.1" + ) + ] - reportSubCase "disabled by solver & buildable false" - assertProjectTargetProblems - "targets/benchmarks-disabled" - config - CmdBench.selectPackageTargets - CmdBench.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CBenchName "user-disabled") - TargetDisabledBySolver True - , AvailableTarget "p-0.1" (CBenchName "solver-disabled") - TargetDisabledBySolver True - ] - , mkTargetPackage "p-0.1" ) - - , ( flip TargetProblemNoneEnabled - [ AvailableTarget "q-0.1" (CBenchName "buildable-false") - TargetNotBuildable True - ] - , mkTargetPackage "q-0.1" ) - ] + reportSubCase "disabled by solver & buildable false" + assertProjectTargetProblems + "targets/benchmarks-disabled" + config + CmdBench.selectPackageTargets + CmdBench.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget + "p-0.1" + (CBenchName "user-disabled") + TargetDisabledBySolver + True + , AvailableTarget + "p-0.1" + (CBenchName "solver-disabled") + TargetDisabledBySolver + True + ] + , mkTargetPackage "p-0.1" + ) + , + ( flip + TargetProblemNoneEnabled + [ AvailableTarget + "q-0.1" + (CBenchName "buildable-false") + TargetNotBuildable + True + ] + , mkTargetPackage "q-0.1" + ) + ] - reportSubCase "empty-pkg" - assertProjectTargetProblems - "targets/empty-pkg" config - CmdBench.selectPackageTargets - CmdBench.selectComponentTarget - [ ( TargetProblemNoTargets, mkTargetPackage "p-0.1" ) - ] + reportSubCase "empty-pkg" + assertProjectTargetProblems + "targets/empty-pkg" + config + CmdBench.selectPackageTargets + CmdBench.selectComponentTarget + [ (TargetProblemNoTargets, mkTargetPackage "p-0.1") + ] - reportSubCase "no benchmarks" - assertProjectTargetProblems - "targets/simple" - config - CmdBench.selectPackageTargets - CmdBench.selectComponentTarget - [ ( CmdBench.noBenchmarksProblem, mkTargetPackage "p-0.1" ) - , ( CmdBench.noBenchmarksProblem, mkTargetPackage "q-0.1" ) - ] + reportSubCase "no benchmarks" + assertProjectTargetProblems + "targets/simple" + config + CmdBench.selectPackageTargets + CmdBench.selectComponentTarget + [ (CmdBench.noBenchmarksProblem, mkTargetPackage "p-0.1") + , (CmdBench.noBenchmarksProblem, mkTargetPackage "q-0.1") + ] - reportSubCase "not a benchmark" - assertProjectTargetProblems - "targets/variety" - config - CmdBench.selectPackageTargets - CmdBench.selectComponentTarget $ - [ ( const (CmdBench.componentNotBenchmarkProblem - "p-0.1" (CLibName LMainLibName)) - , mkTargetComponent "p-0.1" (CLibName LMainLibName) ) - - , ( const (CmdBench.componentNotBenchmarkProblem - "p-0.1" (CExeName "an-exe")) - , mkTargetComponent "p-0.1" (CExeName "an-exe") ) - - , ( const (CmdBench.componentNotBenchmarkProblem - "p-0.1" (CFLibName "libp")) - , mkTargetComponent "p-0.1" (CFLibName "libp") ) - - , ( const (CmdBench.componentNotBenchmarkProblem - "p-0.1" (CTestName "a-testsuite")) - , mkTargetComponent "p-0.1" (CTestName "a-testsuite") ) - ] ++ - [ ( const (CmdBench.isSubComponentProblem - "p-0.1" cname (ModuleTarget modname)) - , mkTargetModule "p-0.1" cname modname ) - | (cname, modname) <- [ (CTestName "a-testsuite", "TestModule") - , (CBenchName "a-benchmark", "BenchModule") - , (CExeName "an-exe", "ExeModule") - , ((CLibName LMainLibName), "P") - ] - ] ++ - [ ( const (CmdBench.isSubComponentProblem - "p-0.1" cname (FileTarget fname)) - , mkTargetFile "p-0.1" cname fname) - | (cname, fname) <- [ (CTestName "a-testsuite", "Test.hs") - , (CBenchName "a-benchmark", "Bench.hs") - , (CExeName "an-exe", "Main.hs") - ] + reportSubCase "not a benchmark" + assertProjectTargetProblems + "targets/variety" + config + CmdBench.selectPackageTargets + CmdBench.selectComponentTarget + $ [ + ( const + ( CmdBench.componentNotBenchmarkProblem + "p-0.1" + (CLibName LMainLibName) + ) + , mkTargetComponent "p-0.1" (CLibName LMainLibName) + ) + , + ( const + ( CmdBench.componentNotBenchmarkProblem + "p-0.1" + (CExeName "an-exe") + ) + , mkTargetComponent "p-0.1" (CExeName "an-exe") + ) + , + ( const + ( CmdBench.componentNotBenchmarkProblem + "p-0.1" + (CFLibName "libp") + ) + , mkTargetComponent "p-0.1" (CFLibName "libp") + ) + , + ( const + ( CmdBench.componentNotBenchmarkProblem + "p-0.1" + (CTestName "a-testsuite") + ) + , mkTargetComponent "p-0.1" (CTestName "a-testsuite") + ) ] - + ++ [ ( const + ( CmdBench.isSubComponentProblem + "p-0.1" + cname + (ModuleTarget modname) + ) + , mkTargetModule "p-0.1" cname modname + ) + | (cname, modname) <- + [ (CTestName "a-testsuite", "TestModule") + , (CBenchName "a-benchmark", "BenchModule") + , (CExeName "an-exe", "ExeModule") + , ((CLibName LMainLibName), "P") + ] + ] + ++ [ ( const + ( CmdBench.isSubComponentProblem + "p-0.1" + cname + (FileTarget fname) + ) + , mkTargetFile "p-0.1" cname fname + ) + | (cname, fname) <- + [ (CTestName "a-testsuite", "Test.hs") + , (CBenchName "a-benchmark", "Bench.hs") + , (CExeName "an-exe", "Main.hs") + ] + ] testTargetProblemsHaddock :: ProjectConfig -> (String -> IO ()) -> Assertion testTargetProblemsHaddock config reportSubCase = do - - reportSubCase "all-disabled" - assertProjectTargetProblems - "targets/all-disabled" - config - (let haddockFlags = mkHaddockFlags False True True False - in CmdHaddock.selectPackageTargets haddockFlags) - CmdHaddock.selectComponentTarget - [ ( flip TargetProblemNoneEnabled - [ AvailableTarget "p-0.1" (CBenchName "user-disabled") - TargetDisabledByUser True - , AvailableTarget "p-0.1" (CTestName "solver-disabled") - TargetDisabledBySolver True - , AvailableTarget "p-0.1" (CExeName "buildable-false") - TargetNotBuildable True - , AvailableTarget "p-0.1" (CLibName LMainLibName) - TargetNotBuildable True - ] - , mkTargetPackage "p-0.1" ) - ] - - reportSubCase "empty-pkg" - assertProjectTargetProblems - "targets/empty-pkg" config - (let haddockFlags = mkHaddockFlags False False False False - in CmdHaddock.selectPackageTargets haddockFlags) - CmdHaddock.selectComponentTarget - [ ( TargetProblemNoTargets, mkTargetPackage "p-0.1" ) - ] - - reportSubCase "enabled component kinds" - -- When we explicitly enable all the component kinds then selecting the - -- whole package selects those component kinds too - (_,elaboratedPlan,_) <- planProject "targets/variety" config - let haddockFlags = mkHaddockFlags True True True True - in assertProjectDistinctTargets - elaboratedPlan - (CmdHaddock.selectPackageTargets haddockFlags) - CmdHaddock.selectComponentTarget - [ mkTargetPackage "p-0.1" ] - [ ("p-0.1-inplace", (CLibName LMainLibName)) - , ("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark") - , ("p-0.1-inplace-a-testsuite", CTestName "a-testsuite") - , ("p-0.1-inplace-an-exe", CExeName "an-exe") - , ("p-0.1-inplace-libp", CFLibName "libp") + reportSubCase "all-disabled" + assertProjectTargetProblems + "targets/all-disabled" + config + ( let haddockFlags = mkHaddockFlags False True True False + in CmdHaddock.selectPackageTargets haddockFlags + ) + CmdHaddock.selectComponentTarget + [ + ( flip + TargetProblemNoneEnabled + [ AvailableTarget + "p-0.1" + (CBenchName "user-disabled") + TargetDisabledByUser + True + , AvailableTarget + "p-0.1" + (CTestName "solver-disabled") + TargetDisabledBySolver + True + , AvailableTarget + "p-0.1" + (CExeName "buildable-false") + TargetNotBuildable + True + , AvailableTarget + "p-0.1" + (CLibName LMainLibName) + TargetNotBuildable + True ] + , mkTargetPackage "p-0.1" + ) + ] - reportSubCase "disabled component kinds" - -- When we explicitly disable all the component kinds then selecting the - -- whole package only selects the library - let haddockFlags = mkHaddockFlags False False False False - in assertProjectDistinctTargets - elaboratedPlan - (CmdHaddock.selectPackageTargets haddockFlags) - CmdHaddock.selectComponentTarget - [ mkTargetPackage "p-0.1" ] - [ ("p-0.1-inplace", (CLibName LMainLibName)) ] - - reportSubCase "requested component kinds" - -- When we selecting the package with an explicit filter then it does not - -- matter if the config was to disable all the component kinds - let haddockFlags = mkHaddockFlags False False False False - in assertProjectDistinctTargets - elaboratedPlan - (CmdHaddock.selectPackageTargets haddockFlags) - CmdHaddock.selectComponentTarget - [ TargetPackage TargetExplicitNamed ["p-0.1"] (Just FLibKind) - , TargetPackage TargetExplicitNamed ["p-0.1"] (Just ExeKind) - , TargetPackage TargetExplicitNamed ["p-0.1"] (Just TestKind) - , TargetPackage TargetExplicitNamed ["p-0.1"] (Just BenchKind) - ] - [ ("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark") - , ("p-0.1-inplace-a-testsuite", CTestName "a-testsuite") - , ("p-0.1-inplace-an-exe", CExeName "an-exe") - , ("p-0.1-inplace-libp", CFLibName "libp") - ] + reportSubCase "empty-pkg" + assertProjectTargetProblems + "targets/empty-pkg" + config + ( let haddockFlags = mkHaddockFlags False False False False + in CmdHaddock.selectPackageTargets haddockFlags + ) + CmdHaddock.selectComponentTarget + [ (TargetProblemNoTargets, mkTargetPackage "p-0.1") + ] + + reportSubCase "enabled component kinds" + -- When we explicitly enable all the component kinds then selecting the + -- whole package selects those component kinds too + (_, elaboratedPlan, _) <- planProject "targets/variety" config + let haddockFlags = mkHaddockFlags True True True True + in assertProjectDistinctTargets + elaboratedPlan + (CmdHaddock.selectPackageTargets haddockFlags) + CmdHaddock.selectComponentTarget + [mkTargetPackage "p-0.1"] + [ ("p-0.1-inplace", (CLibName LMainLibName)) + , ("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark") + , ("p-0.1-inplace-a-testsuite", CTestName "a-testsuite") + , ("p-0.1-inplace-an-exe", CExeName "an-exe") + , ("p-0.1-inplace-libp", CFLibName "libp") + ] + + reportSubCase "disabled component kinds" + -- When we explicitly disable all the component kinds then selecting the + -- whole package only selects the library + let haddockFlags = mkHaddockFlags False False False False + in assertProjectDistinctTargets + elaboratedPlan + (CmdHaddock.selectPackageTargets haddockFlags) + CmdHaddock.selectComponentTarget + [mkTargetPackage "p-0.1"] + [("p-0.1-inplace", (CLibName LMainLibName))] + + reportSubCase "requested component kinds" + -- When we selecting the package with an explicit filter then it does not + -- matter if the config was to disable all the component kinds + let haddockFlags = mkHaddockFlags False False False False + in assertProjectDistinctTargets + elaboratedPlan + (CmdHaddock.selectPackageTargets haddockFlags) + CmdHaddock.selectComponentTarget + [ TargetPackage TargetExplicitNamed ["p-0.1"] (Just FLibKind) + , TargetPackage TargetExplicitNamed ["p-0.1"] (Just ExeKind) + , TargetPackage TargetExplicitNamed ["p-0.1"] (Just TestKind) + , TargetPackage TargetExplicitNamed ["p-0.1"] (Just BenchKind) + ] + [ ("p-0.1-inplace-a-benchmark", CBenchName "a-benchmark") + , ("p-0.1-inplace-a-testsuite", CTestName "a-testsuite") + , ("p-0.1-inplace-an-exe", CExeName "an-exe") + , ("p-0.1-inplace-libp", CFLibName "libp") + ] where mkHaddockFlags flib exe test bench = - defaultHaddockFlags { - haddockForeignLibs = toFlag flib, - haddockExecutables = toFlag exe, - haddockTestSuites = toFlag test, - haddockBenchmarks = toFlag bench - } + defaultHaddockFlags + { haddockForeignLibs = toFlag flib + , haddockExecutables = toFlag exe + , haddockTestSuites = toFlag test + , haddockBenchmarks = toFlag bench + } assertProjectDistinctTargets - :: forall err. (Eq err, Show err) => - ElaboratedInstallPlan + :: forall err + . (Eq err, Show err) + => ElaboratedInstallPlan -> (forall k. TargetSelector -> [AvailableTarget k] -> Either (TargetProblem err) [k]) - -> (forall k. SubComponentTarget -> AvailableTarget k -> Either (TargetProblem err) k ) + -> (forall k. SubComponentTarget -> AvailableTarget k -> Either (TargetProblem err) k) -> [TargetSelector] -> [(UnitId, ComponentName)] -> Assertion -assertProjectDistinctTargets elaboratedPlan - selectPackageTargets - selectComponentTarget - targetSelectors - expectedTargets - | Right targets <- results - = distinctTargetComponents targets @?= Set.fromList expectedTargets - - | otherwise - = assertFailure $ "assertProjectDistinctTargets: expected " - ++ "(Right targets) but got " ++ show results - where - results = resolveTargets - selectPackageTargets - selectComponentTarget - elaboratedPlan - Nothing - targetSelectors - +assertProjectDistinctTargets + elaboratedPlan + selectPackageTargets + selectComponentTarget + targetSelectors + expectedTargets + | Right targets <- results = + distinctTargetComponents targets @?= Set.fromList expectedTargets + | otherwise = + assertFailure $ + "assertProjectDistinctTargets: expected " + ++ "(Right targets) but got " + ++ show results + where + results = + resolveTargets + selectPackageTargets + selectComponentTarget + elaboratedPlan + Nothing + targetSelectors assertProjectTargetProblems - :: forall err. (Eq err, Show err) => - FilePath -> ProjectConfig - -> (forall k. TargetSelector - -> [AvailableTarget k] - -> Either (TargetProblem err) [k]) - -> (forall k. SubComponentTarget - -> AvailableTarget k - -> Either (TargetProblem err) k ) + :: forall err + . (Eq err, Show err) + => FilePath + -> ProjectConfig + -> ( forall k + . TargetSelector + -> [AvailableTarget k] + -> Either (TargetProblem err) [k] + ) + -> ( forall k + . SubComponentTarget + -> AvailableTarget k + -> Either (TargetProblem err) k + ) -> [(TargetSelector -> TargetProblem err, TargetSelector)] -> Assertion -assertProjectTargetProblems testdir config - selectPackageTargets - selectComponentTarget - cases = do - (_,elaboratedPlan,_) <- planProject testdir config +assertProjectTargetProblems + testdir + config + selectPackageTargets + selectComponentTarget + cases = do + (_, elaboratedPlan, _) <- planProject testdir config assertTargetProblems elaboratedPlan selectPackageTargets selectComponentTarget cases - assertTargetProblems - :: forall err. (Eq err, Show err) => - ElaboratedInstallPlan + :: forall err + . (Eq err, Show err) + => ElaboratedInstallPlan -> (forall k. TargetSelector -> [AvailableTarget k] -> Either (TargetProblem err) [k]) - -> (forall k. SubComponentTarget -> AvailableTarget k -> Either (TargetProblem err) k ) + -> (forall k. SubComponentTarget -> AvailableTarget k -> Either (TargetProblem err) k) -> [(TargetSelector -> TargetProblem err, TargetSelector)] -> Assertion assertTargetProblems elaboratedPlan selectPackageTargets selectComponentTarget = - mapM_ (uncurry assertTargetProblem) + mapM_ (uncurry assertTargetProblem) where assertTargetProblem expected targetSelector = - let res = resolveTargets selectPackageTargets selectComponentTarget - elaboratedPlan Nothing - [targetSelector] in - case res of - Left [problem] -> - problem @?= expected targetSelector - - unexpected -> - assertFailure $ "expected resolveTargets result: (Left [problem]) " - ++ "but got: " ++ show unexpected - + let res = + resolveTargets + selectPackageTargets + selectComponentTarget + elaboratedPlan + Nothing + [targetSelector] + in case res of + Left [problem] -> + problem @?= expected targetSelector + unexpected -> + assertFailure $ + "expected resolveTargets result: (Left [problem]) " + ++ "but got: " + ++ show unexpected testExceptionInFindingPackage :: ProjectConfig -> Assertion testExceptionInFindingPackage config = do - BadPackageLocations _ locs <- expectException "BadPackageLocations" $ - void $ planProject testdir config - case locs of - [BadLocGlobEmptyMatch "./*.cabal"] -> return () - _ -> assertFailure "expected BadLocGlobEmptyMatch" - cleanProject testdir + BadPackageLocations _ locs <- + expectException "BadPackageLocations" $ + void $ + planProject testdir config + case locs of + [BadLocGlobEmptyMatch "./*.cabal"] -> return () + _ -> assertFailure "expected BadLocGlobEmptyMatch" + cleanProject testdir where testdir = "exception/no-pkg" - testExceptionInFindingPackage2 :: ProjectConfig -> Assertion testExceptionInFindingPackage2 config = do - BadPackageLocations _ locs <- expectException "BadPackageLocations" $ - void $ planProject testdir config - case locs of - [BadPackageLocationFile (BadLocDirNoCabalFile ".")] -> return () - _ -> assertFailure $ "expected BadLocDirNoCabalFile, got " ++ show locs - cleanProject testdir + BadPackageLocations _ locs <- + expectException "BadPackageLocations" $ + void $ + planProject testdir config + case locs of + [BadPackageLocationFile (BadLocDirNoCabalFile ".")] -> return () + _ -> assertFailure $ "expected BadLocDirNoCabalFile, got " ++ show locs + cleanProject testdir where testdir = "exception/no-pkg2" - testExceptionInProjectConfig :: ProjectConfig -> Assertion testExceptionInProjectConfig config = do - BadPerPackageCompilerPaths ps <- expectException "BadPerPackageCompilerPaths" $ - void $ planProject testdir config - case ps of - [(pn,"ghc")] | "foo" == pn -> return () - _ -> assertFailure $ "expected (PackageName \"foo\",\"ghc\"), got " - ++ show ps - cleanProject testdir + BadPerPackageCompilerPaths ps <- + expectException "BadPerPackageCompilerPaths" $ + void $ + planProject testdir config + case ps of + [(pn, "ghc")] | "foo" == pn -> return () + _ -> + assertFailure $ + "expected (PackageName \"foo\",\"ghc\"), got " + ++ show ps + cleanProject testdir where testdir = "exception/bad-config" - testExceptionInConfigureStep :: ProjectConfig -> Assertion testExceptionInConfigureStep config = do - (plan, res) <- executePlan =<< planProject testdir config - (_pkga1, failure) <- expectPackageFailed plan res pkgidA1 - case buildFailureReason failure of - ConfigureFailed _ -> return () - _ -> assertFailure $ "expected ConfigureFailed, got " ++ show failure - cleanProject testdir + (plan, res) <- executePlan =<< planProject testdir config + (_pkga1, failure) <- expectPackageFailed plan res pkgidA1 + case buildFailureReason failure of + ConfigureFailed _ -> return () + _ -> assertFailure $ "expected ConfigureFailed, got " ++ show failure + cleanProject testdir where testdir = "exception/configure" pkgidA1 = PackageIdentifier "a" (mkVersion [1]) - testExceptionInBuildStep :: ProjectConfig -> Assertion testExceptionInBuildStep config = do - (plan, res) <- executePlan =<< planProject testdir config - (_pkga1, failure) <- expectPackageFailed plan res pkgidA1 - expectBuildFailed failure + (plan, res) <- executePlan =<< planProject testdir config + (_pkga1, failure) <- expectPackageFailed plan res pkgidA1 + expectBuildFailed failure where testdir = "exception/build" pkgidA1 = PackageIdentifier "a" (mkVersion [1]) testSetupScriptStyles :: ProjectConfig -> (String -> IO ()) -> Assertion testSetupScriptStyles config reportSubCase = do - reportSubCase (show SetupCustomExplicitDeps) - plan0@(_,_,sharedConfig) <- planProject testdir1 config + plan0@(_, _, sharedConfig) <- planProject testdir1 config let isOSX (Platform _ OSX) = True isOSX _ = False + compilerVer = compilerVersion (pkgConfigCompiler sharedConfig) -- Skip the Custom tests when the shipped Cabal library is buggy - unless (isOSX (pkgConfigPlatform sharedConfig) - && compilerVersion (pkgConfigCompiler sharedConfig) < mkVersion [7,10]) $ do - - (plan1, res1) <- executePlan plan0 - pkg1 <- expectPackageInstalled plan1 res1 pkgidA - elabSetupScriptStyle pkg1 @?= SetupCustomExplicitDeps - hasDefaultSetupDeps pkg1 @?= Just False - marker1 <- readFile (basedir testdir1 "marker") - marker1 @?= "ok" - removeFile (basedir testdir1 "marker") - - -- implicit deps implies 'Cabal < 2' which conflicts w/ GHC 8.2 or later - when (compilerVersion (pkgConfigCompiler sharedConfig) < mkVersion [8,2]) $ do - reportSubCase (show SetupCustomImplicitDeps) - (plan2, res2) <- executePlan =<< planProject testdir2 config - pkg2 <- expectPackageInstalled plan2 res2 pkgidA - elabSetupScriptStyle pkg2 @?= SetupCustomImplicitDeps - hasDefaultSetupDeps pkg2 @?= Just True - marker2 <- readFile (basedir testdir2 "marker") - marker2 @?= "ok" - removeFile (basedir testdir2 "marker") - - reportSubCase (show SetupNonCustomInternalLib) - (plan3, res3) <- executePlan =<< planProject testdir3 config - pkg3 <- expectPackageInstalled plan3 res3 pkgidA - elabSetupScriptStyle pkg3 @?= SetupNonCustomInternalLib -{- - --TODO: the SetupNonCustomExternalLib case is hard to test since it - -- requires a version of Cabal that's later than the one we're testing - -- e.g. needs a .cabal file that specifies cabal-version: >= 2.0 - -- and a corresponding Cabal package that we can use to try and build a - -- default Setup.hs. - reportSubCase (show SetupNonCustomExternalLib) - (plan4, res4) <- executePlan =<< planProject testdir4 config - pkg4 <- expectPackageInstalled plan4 res4 pkgidA - pkgSetupScriptStyle pkg4 @?= SetupNonCustomExternalLib --} + unless + ( (isOSX (pkgConfigPlatform sharedConfig) && (compilerVer < mkVersion [7, 10])) + -- 9.10 ships Cabal 3.12.0.0 affected by #9940 + || (mkVersion [9, 10] <= compilerVer && compilerVer < mkVersion [9, 11]) + ) + $ do + (plan1, res1) <- executePlan plan0 + pkg1 <- expectPackageInstalled plan1 res1 pkgidA + elabSetupScriptStyle pkg1 @?= SetupCustomExplicitDeps + hasDefaultSetupDeps pkg1 @?= Just False + marker1 <- readFile (basedir testdir1 "marker") + marker1 @?= "ok" + removeFile (basedir testdir1 "marker") + + -- implicit deps implies 'Cabal < 2' which conflicts w/ GHC 8.2 or later + when (compilerVersion (pkgConfigCompiler sharedConfig) < mkVersion [8, 2]) $ do + reportSubCase (show SetupCustomImplicitDeps) + (plan2, res2) <- executePlan =<< planProject testdir2 config + pkg2 <- expectPackageInstalled plan2 res2 pkgidA + elabSetupScriptStyle pkg2 @?= SetupCustomImplicitDeps + hasDefaultSetupDeps pkg2 @?= Just True + marker2 <- readFile (basedir testdir2 "marker") + marker2 @?= "ok" + removeFile (basedir testdir2 "marker") + + reportSubCase (show SetupNonCustomInternalLib) + (plan3, res3) <- executePlan =<< planProject testdir3 config + pkg3 <- expectPackageInstalled plan3 res3 pkgidA + elabSetupScriptStyle pkg3 @?= SetupNonCustomInternalLib where + {- + --TODO: the SetupNonCustomExternalLib case is hard to test since it + -- requires a version of Cabal that's later than the one we're testing + -- e.g. needs a .cabal file that specifies cabal-version: >= 2.0 + -- and a corresponding Cabal package that we can use to try and build a + -- default Setup.hs. + reportSubCase (show SetupNonCustomExternalLib) + (plan4, res4) <- executePlan =<< planProject testdir4 config + pkg4 <- expectPackageInstalled plan4 res4 pkgidA + pkgSetupScriptStyle pkg4 @?= SetupNonCustomExternalLib + -} + testdir1 = "build/setup-custom1" testdir2 = "build/setup-custom2" testdir3 = "build/setup-simple" - pkgidA = PackageIdentifier "a" (mkVersion [0,1]) + pkgidA = PackageIdentifier "a" (mkVersion [0, 1]) -- The solver fills in default setup deps explicitly, but marks them as such - hasDefaultSetupDeps = fmap defaultSetupDepends - . setupBuildInfo . elabPkgDescription + hasDefaultSetupDeps = + fmap defaultSetupDepends + . setupBuildInfo + . elabPkgDescription -- | Test the behaviour with and without @--keep-going@ --- testBuildKeepGoing :: ProjectConfig -> Assertion testBuildKeepGoing config = do - -- P is expected to fail, Q does not depend on P but without - -- parallel build and without keep-going then we don't build Q yet. - (plan1, res1) <- executePlan =<< planProject testdir (config `mappend` keepGoing False) - (_, failure1) <- expectPackageFailed plan1 res1 "p-0.1" - expectBuildFailed failure1 - _ <- expectPackageConfigured plan1 res1 "q-0.1" - - -- With keep-going then we should go on to successfully build Q - (plan2, res2) <- executePlan - =<< planProject testdir (config `mappend` keepGoing True) - (_, failure2) <- expectPackageFailed plan2 res2 "p-0.1" - expectBuildFailed failure2 - _ <- expectPackageInstalled plan2 res2 "q-0.1" - return () + -- P is expected to fail, Q does not depend on P but without + -- parallel build and without keep-going then we don't build Q yet. + (plan1, res1) <- executePlan =<< planProject testdir (config `mappend` keepGoing False) + (_, failure1) <- expectPackageFailed plan1 res1 "p-0.1" + expectBuildFailed failure1 + _ <- expectPackageConfigured plan1 res1 "q-0.1" + + -- With keep-going then we should go on to successfully build Q + (plan2, res2) <- + executePlan + =<< planProject testdir (config `mappend` keepGoing True) + (_, failure2) <- expectPackageFailed plan2 res2 "p-0.1" + expectBuildFailed failure2 + _ <- expectPackageInstalled plan2 res2 "q-0.1" + return () where testdir = "build/keep-going" keepGoing kg = - mempty { - projectConfigBuildOnly = mempty { - projectConfigKeepGoing = toFlag kg + mempty + { projectConfigBuildOnly = + mempty + { projectConfigKeepGoing = toFlag kg + } } - } -- | Test we can successfully build packages from local tarball files. --- testBuildLocalTarball :: ProjectConfig -> Assertion testBuildLocalTarball config = do - -- P is a tarball package, Q is a local dir package that depends on it. - (plan, res) <- executePlan =<< planProject testdir config - _ <- expectPackageInstalled plan res "p-0.1" - _ <- expectPackageInstalled plan res "q-0.1" - return () + -- P is a tarball package, Q is a local dir package that depends on it. + (plan, res) <- executePlan =<< planProject testdir config + _ <- expectPackageInstalled plan res "p-0.1" + _ <- expectPackageInstalled plan res "q-0.1" + return () where testdir = "build/local-tarball" @@ -1526,22 +1981,21 @@ testBuildLocalTarball config = do -- -- This test just doesn't seem to work on Windows, -- due filesystem woes. --- testRegressionIssue3324 :: ProjectConfig -> Assertion testRegressionIssue3324 config = when (buildOS /= Windows) $ do - -- expected failure first time due to missing dep - (plan1, res1) <- executePlan =<< planProject testdir config - (_pkgq, failure) <- expectPackageFailed plan1 res1 "q-0.1" - expectBuildFailed failure - - -- add the missing dep, now it should work - let qcabal = basedir testdir "q" "q.cabal" - withFileFinallyRestore qcabal $ do - tryFewTimes $ BS.appendFile qcabal (" build-depends: p\n") - (plan2, res2) <- executePlan =<< planProject testdir config - _ <- expectPackageInstalled plan2 res2 "p-0.1" - _ <- expectPackageInstalled plan2 res2 "q-0.1" - return () + -- expected failure first time due to missing dep + (plan1, res1) <- executePlan =<< planProject testdir config + (_pkgq, failure) <- expectPackageFailed plan1 res1 "q-0.1" + expectBuildFailed failure + + -- add the missing dep, now it should work + let qcabal = basedir testdir "q" "q.cabal" + withFileFinallyRestore qcabal $ do + tryFewTimes $ BS.appendFile qcabal (" build-depends: p\n") + (plan2, res2) <- executePlan =<< planProject testdir config + _ <- expectPackageInstalled plan2 res2 "p-0.1" + _ <- expectPackageInstalled plan2 res2 "q-0.1" + return () where testdir = "regression/3324" @@ -1549,92 +2003,104 @@ testRegressionIssue3324 config = when (buildOS /= Windows) $ do -- from ProjectConfig to ElaboratedInstallPlan testProgramOptionsAll :: ProjectConfig -> Assertion testProgramOptionsAll config0 = do - -- P is a tarball package, Q is a local dir package that depends on it. - (_, elaboratedPlan, _) <- planProject testdir config - let packages = filterConfiguredPackages $ InstallPlan.toList elaboratedPlan - - assertEqual "q" - (Just [ghcFlag]) - (getProgArgs packages "q") - assertEqual "p" - (Just [ghcFlag]) - (getProgArgs packages "p") + -- P is a tarball package, Q is a local dir package that depends on it. + (_, elaboratedPlan, _) <- planProject testdir config + let packages = filterConfiguredPackages $ InstallPlan.toList elaboratedPlan + + assertEqual + "q" + (Just [ghcFlag]) + (getProgArgs packages "q") + assertEqual + "p" + (Just [ghcFlag]) + (getProgArgs packages "p") where testdir = "regression/program-options" programArgs = MapMappend (Map.fromList [("ghc", [ghcFlag])]) ghcFlag = "-fno-full-laziness" -- Insert flag into global config - config = config0 { - projectConfigAllPackages = (projectConfigAllPackages config0) { - packageConfigProgramArgs = programArgs - } - } + config = + config0 + { projectConfigAllPackages = + (projectConfigAllPackages config0) + { packageConfigProgramArgs = programArgs + } + } -- | Test local program options are propagated correctly -- from ProjectConfig to ElaboratedInstallPlan testProgramOptionsLocal :: ProjectConfig -> Assertion testProgramOptionsLocal config0 = do - (_, elaboratedPlan, _) <- planProject testdir config - let localPackages = filterConfiguredPackages $ InstallPlan.toList elaboratedPlan - - assertEqual "q" - (Just [ghcFlag]) - (getProgArgs localPackages "q") - assertEqual "p" - Nothing - (getProgArgs localPackages "p") + (_, elaboratedPlan, _) <- planProject testdir config + let localPackages = filterConfiguredPackages $ InstallPlan.toList elaboratedPlan + + assertEqual + "q" + (Just [ghcFlag]) + (getProgArgs localPackages "q") + assertEqual + "p" + Nothing + (getProgArgs localPackages "p") where testdir = "regression/program-options" programArgs = MapMappend (Map.fromList [("ghc", [ghcFlag])]) ghcFlag = "-fno-full-laziness" -- Insert flag into local config - config = config0 { - projectConfigLocalPackages = (projectConfigLocalPackages config0) { - packageConfigProgramArgs = programArgs - } - } + config = + config0 + { projectConfigLocalPackages = + (projectConfigLocalPackages config0) + { packageConfigProgramArgs = programArgs + } + } -- | Test package specific program options are propagated correctly -- from ProjectConfig to ElaboratedInstallPlan testProgramOptionsSpecific :: ProjectConfig -> Assertion testProgramOptionsSpecific config0 = do - (_, elaboratedPlan, _) <- planProject testdir config - let packages = filterConfiguredPackages $ InstallPlan.toList elaboratedPlan - - assertEqual "q" - (Nothing) - (getProgArgs packages "q") - assertEqual "p" - (Just [ghcFlag]) - (getProgArgs packages "p") + (_, elaboratedPlan, _) <- planProject testdir config + let packages = filterConfiguredPackages $ InstallPlan.toList elaboratedPlan + + assertEqual + "q" + (Nothing) + (getProgArgs packages "q") + assertEqual + "p" + (Just [ghcFlag]) + (getProgArgs packages "p") where testdir = "regression/program-options" programArgs = MapMappend (Map.fromList [("ghc", [ghcFlag])]) ghcFlag = "-fno-full-laziness" -- Insert flag into package "p" config - config = config0 { - projectConfigSpecificPackage = MapMappend (Map.fromList [(mkPackageName "p", configArgs)]) - } - configArgs = mempty { - packageConfigProgramArgs = programArgs - } + config = + config0 + { projectConfigSpecificPackage = MapMappend (Map.fromList [(mkPackageName "p", configArgs)]) + } + configArgs = + mempty + { packageConfigProgramArgs = programArgs + } filterConfiguredPackages :: [ElaboratedPlanPackage] -> [ElaboratedConfiguredPackage] filterConfiguredPackages [] = [] -filterConfiguredPackages (InstallPlan.PreExisting _ : pkgs) = filterConfiguredPackages pkgs -filterConfiguredPackages (InstallPlan.Installed elab : pkgs) = elab : filterConfiguredPackages pkgs -filterConfiguredPackages (InstallPlan.Configured elab : pkgs) = elab : filterConfiguredPackages pkgs +filterConfiguredPackages (InstallPlan.PreExisting _ : pkgs) = filterConfiguredPackages pkgs +filterConfiguredPackages (InstallPlan.Installed elab : pkgs) = elab : filterConfiguredPackages pkgs +filterConfiguredPackages (InstallPlan.Configured elab : pkgs) = elab : filterConfiguredPackages pkgs getProgArgs :: [ElaboratedConfiguredPackage] -> String -> Maybe [String] getProgArgs [] _ = Nothing getProgArgs (elab : pkgs) name - | pkgName (elabPkgSourceId elab) == mkPackageName name - = Map.lookup "ghc" (elabProgramArgs elab) - | otherwise - = getProgArgs pkgs name + | pkgName (elabPkgSourceId elab) == mkPackageName name = + Map.lookup "ghc" (elabProgramArgs elab) + | otherwise = + getProgArgs pkgs name --------------------------------- -- Test utils to plan and build @@ -1645,139 +2111,155 @@ basedir = "tests" "IntegrationTests2" dirActions :: FilePath -> TS.DirActions IO dirActions testdir = - defaultDirActions { - TS.doesFileExist = \p -> - TS.doesFileExist defaultDirActions (virtcwd p), - - TS.doesDirectoryExist = \p -> - TS.doesDirectoryExist defaultDirActions (virtcwd p), - - TS.canonicalizePath = \p -> - TS.canonicalizePath defaultDirActions (virtcwd p), - - TS.getCurrentDirectory = + defaultDirActions + { TS.doesFileExist = \p -> + TS.doesFileExist defaultDirActions (virtcwd p) + , TS.doesDirectoryExist = \p -> + TS.doesDirectoryExist defaultDirActions (virtcwd p) + , TS.canonicalizePath = \p -> + TS.canonicalizePath defaultDirActions (virtcwd p) + , TS.getCurrentDirectory = TS.canonicalizePath defaultDirActions virtcwd } where virtcwd = basedir testdir -type ProjDetails = (DistDirLayout, - CabalDirLayout, - ProjectConfig, - [PackageSpecifier UnresolvedSourcePackage], - BuildTimeSettings) +type ProjDetails = + ( DistDirLayout + , CabalDirLayout + , ProjectConfig + , [PackageSpecifier UnresolvedSourcePackage] + , BuildTimeSettings + ) configureProject :: FilePath -> ProjectConfig -> IO ProjDetails configureProject testdir cliConfig = do - cabalDirLayout <- defaultCabalDirLayout - - projectRootDir <- canonicalizePath (basedir testdir) - isexplict <- doesFileExist (projectRootDir defaultProjectFile) - - let projectRoot - | isexplict = ProjectRootExplicit projectRootDir defaultProjectFile - | otherwise = ProjectRootImplicit projectRootDir - distDirLayout = defaultDistDirLayout projectRoot Nothing Nothing - - -- Clear state between test runs. The state remains if the previous run - -- ended in an exception (as we leave the files to help with debugging). - cleanProject testdir - - httpTransport <- configureTransport verbosity [] Nothing + cabalDirLayout <- defaultCabalDirLayout - (projectConfig, localPackages) <- - rebuildProjectConfig verbosity - httpTransport - distDirLayout - cliConfig + projectRootDir <- canonicalizePath (basedir testdir) + isexplict <- doesFileExist (projectRootDir defaultProjectFile) - let buildSettings = resolveBuildTimeSettings - verbosity cabalDirLayout - projectConfig + let projectRoot + | isexplict = ProjectRootExplicit projectRootDir defaultProjectFile + | otherwise = ProjectRootImplicit projectRootDir + distDirLayout = defaultDistDirLayout projectRoot Nothing Nothing - return (distDirLayout, - cabalDirLayout, - projectConfig, - localPackages, - buildSettings) + -- Clear state between test runs. The state remains if the previous run + -- ended in an exception (as we leave the files to help with debugging). + cleanProject testdir -type PlanDetails = (ProjDetails, - ElaboratedInstallPlan, - ElaboratedSharedConfig) + httpTransport <- configureTransport verbosity [] Nothing + + (projectConfig, localPackages) <- + rebuildProjectConfig + verbosity + httpTransport + distDirLayout + cliConfig + + let buildSettings = + resolveBuildTimeSettings + verbosity + cabalDirLayout + projectConfig + + return + ( distDirLayout + , cabalDirLayout + , projectConfig + , localPackages + , buildSettings + ) + +type PlanDetails = + ( ProjDetails + , ElaboratedInstallPlan + , ElaboratedSharedConfig + ) planProject :: FilePath -> ProjectConfig -> IO PlanDetails planProject testdir cliConfig = do - - projDetails@( - distDirLayout, - cabalDirLayout, - projectConfig, - localPackages, - _buildSettings) <- configureProject testdir cliConfig - - (elaboratedPlan, _, elaboratedShared, _, _) <- - rebuildInstallPlan verbosity - distDirLayout cabalDirLayout - projectConfig - localPackages - Nothing - - return (projDetails, - elaboratedPlan, - elaboratedShared) + projDetails@( distDirLayout + , cabalDirLayout + , projectConfig + , localPackages + , _buildSettings + ) <- + configureProject testdir cliConfig + + (elaboratedPlan, _, elaboratedShared, _, _) <- + rebuildInstallPlan + verbosity + distDirLayout + cabalDirLayout + projectConfig + localPackages + Nothing + + return + ( projDetails + , elaboratedPlan + , elaboratedShared + ) executePlan :: PlanDetails -> IO (ElaboratedInstallPlan, BuildOutcomes) -executePlan ((distDirLayout, cabalDirLayout, config, _, buildSettings), - elaboratedPlan, - elaboratedShared) = do - +executePlan + ( (distDirLayout, cabalDirLayout, config, _, buildSettings) + , elaboratedPlan + , elaboratedShared + ) = do let targets :: Map.Map UnitId [ComponentTarget] targets = Map.fromList [ (unitid, [ComponentTarget cname WholeComponent]) | ts <- Map.elems (availableTargets elaboratedPlan) - , AvailableTarget { - availableTargetStatus = TargetBuildable (unitid, cname) _ - } <- ts + , AvailableTarget + { availableTargetStatus = TargetBuildable (unitid, cname) _ + } <- + ts ] - elaboratedPlan' = pruneInstallPlanToTargets - TargetActionBuild targets - elaboratedPlan + elaboratedPlan' = + pruneInstallPlanToTargets + TargetActionBuild + targets + elaboratedPlan pkgsBuildStatus <- - rebuildTargetsDryRun distDirLayout elaboratedShared - elaboratedPlan' + rebuildTargetsDryRun + distDirLayout + elaboratedShared + elaboratedPlan' - let elaboratedPlan'' = improveInstallPlanWithUpToDatePackages - pkgsBuildStatus elaboratedPlan' + let elaboratedPlan'' = + improveInstallPlanWithUpToDatePackages + pkgsBuildStatus + elaboratedPlan' buildOutcomes <- - rebuildTargets verbosity - config - distDirLayout - (cabalStoreDirLayout cabalDirLayout) - elaboratedPlan'' - elaboratedShared - pkgsBuildStatus - -- Avoid trying to use act-as-setup mode: - buildSettings { buildSettingNumJobs = Serial } + rebuildTargets + verbosity + config + distDirLayout + (cabalStoreDirLayout cabalDirLayout) + elaboratedPlan'' + elaboratedShared + pkgsBuildStatus + -- Avoid trying to use act-as-setup mode: + buildSettings{buildSettingNumJobs = Serial} return (elaboratedPlan'', buildOutcomes) cleanProject :: FilePath -> IO () cleanProject testdir = do - alreadyExists <- doesDirectoryExist distDir - when alreadyExists $ removePathForcibly distDir + alreadyExists <- doesDirectoryExist distDir + when alreadyExists $ removePathForcibly distDir where - projectRoot = ProjectRootImplicit (basedir testdir) - distDirLayout = defaultDistDirLayout projectRoot Nothing Nothing - distDir = distDirectory distDirLayout - + projectRoot = ProjectRootImplicit (basedir testdir) + distDirLayout = defaultDistDirLayout projectRoot Nothing Nothing + distDir = distDirectory distDirLayout verbosity :: Verbosity -verbosity = minBound --normal --verbose --maxBound --minBound - - +verbosity = minBound -- normal --verbose --maxBound --minBound ------------------------------------------- -- Tasty integration to adjust the config @@ -1785,120 +2267,150 @@ verbosity = minBound --normal --verbose --maxBound --minBound withProjectConfig :: (ProjectConfig -> TestTree) -> TestTree withProjectConfig testtree = - askOption $ \ghcPath -> - testtree (mkProjectConfig ghcPath) + askOption $ \ghcPath -> + testtree (mkProjectConfig ghcPath) mkProjectConfig :: GhcPath -> ProjectConfig mkProjectConfig (GhcPath ghcPath) = - mempty { - projectConfigShared = mempty { - projectConfigHcPath = maybeToFlag ghcPath - }, - projectConfigBuildOnly = mempty { - projectConfigNumJobs = toFlag (Just 1) - } + mempty + { projectConfigShared = + mempty + { projectConfigHcPath = maybeToFlag ghcPath + } + , projectConfigBuildOnly = + mempty + { projectConfigNumJobs = toFlag (Just 1) + } } where maybeToFlag = maybe mempty toFlag - data GhcPath = GhcPath (Maybe FilePath) - deriving Typeable instance IsOption GhcPath where defaultValue = GhcPath Nothing - optionName = Tagged "with-ghc" - optionHelp = Tagged "The ghc compiler to use" - parseValue = Just . GhcPath . Just + optionName = Tagged "with-ghc" + optionHelp = Tagged "The ghc compiler to use" + parseValue = Just . GhcPath . Just projectConfigOptionDescriptions :: [OptionDescription] projectConfigOptionDescriptions = [Option (Proxy :: Proxy GhcPath)] - --------------------------------------- -- HUint style utils for this context -- expectException :: Exception e => String -> IO a -> IO e expectException expected action = do - res <- try action - case res of - Left e -> return e - Right _ -> throwIO $ HUnitFailure Nothing $ "expected an exception " ++ expected - -expectPackagePreExisting :: ElaboratedInstallPlan -> BuildOutcomes -> PackageId - -> IO InstalledPackageInfo + res <- try action + case res of + Left e -> return e + Right _ -> throwIO $ HUnitFailure Nothing $ "expected an exception " ++ expected + +expectPackagePreExisting + :: ElaboratedInstallPlan + -> BuildOutcomes + -> PackageId + -> IO InstalledPackageInfo expectPackagePreExisting plan buildOutcomes pkgid = do - planpkg <- expectPlanPackage plan pkgid - case (planpkg, InstallPlan.lookupBuildOutcome planpkg buildOutcomes) of - (InstallPlan.PreExisting pkg, Nothing) - -> return pkg - (_, buildResult) -> unexpectedBuildResult "PreExisting" planpkg buildResult - -expectPackageConfigured :: ElaboratedInstallPlan -> BuildOutcomes -> PackageId - -> IO ElaboratedConfiguredPackage + planpkg <- expectPlanPackage plan pkgid + case (planpkg, InstallPlan.lookupBuildOutcome planpkg buildOutcomes) of + (InstallPlan.PreExisting pkg, Nothing) -> + return pkg + (_, buildResult) -> unexpectedBuildResult "PreExisting" planpkg buildResult + +expectPackageConfigured + :: ElaboratedInstallPlan + -> BuildOutcomes + -> PackageId + -> IO ElaboratedConfiguredPackage expectPackageConfigured plan buildOutcomes pkgid = do - planpkg <- expectPlanPackage plan pkgid - case (planpkg, InstallPlan.lookupBuildOutcome planpkg buildOutcomes) of - (InstallPlan.Configured pkg, Nothing) - -> return pkg - (_, buildResult) -> unexpectedBuildResult "Configured" planpkg buildResult - -expectPackageInstalled :: ElaboratedInstallPlan -> BuildOutcomes -> PackageId - -> IO ElaboratedConfiguredPackage + planpkg <- expectPlanPackage plan pkgid + case (planpkg, InstallPlan.lookupBuildOutcome planpkg buildOutcomes) of + (InstallPlan.Configured pkg, Nothing) -> + return pkg + (_, buildResult) -> unexpectedBuildResult "Configured" planpkg buildResult + +expectPackageInstalled + :: ElaboratedInstallPlan + -> BuildOutcomes + -> PackageId + -> IO ElaboratedConfiguredPackage expectPackageInstalled plan buildOutcomes pkgid = do - planpkg <- expectPlanPackage plan pkgid - case (planpkg, InstallPlan.lookupBuildOutcome planpkg buildOutcomes) of - (InstallPlan.Configured pkg, Just (Right _result)) -- result isn't used by any test - -> return pkg - -- package can be installed in the global .store! - -- (when installing from tarball!) - (InstallPlan.Installed pkg, Nothing) - -> return pkg - (_, buildResult) -> unexpectedBuildResult "Installed" planpkg buildResult - -expectPackageFailed :: ElaboratedInstallPlan -> BuildOutcomes -> PackageId - -> IO (ElaboratedConfiguredPackage, BuildFailure) + planpkg <- expectPlanPackage plan pkgid + case (planpkg, InstallPlan.lookupBuildOutcome planpkg buildOutcomes) of + (InstallPlan.Configured pkg, Just (Right _result)) -> + -- result isn't used by any test + return pkg + -- package can be installed in the global .store! + -- (when installing from tarball!) + (InstallPlan.Installed pkg, Nothing) -> + return pkg + (_, buildResult) -> unexpectedBuildResult "Installed" planpkg buildResult + +expectPackageFailed + :: ElaboratedInstallPlan + -> BuildOutcomes + -> PackageId + -> IO (ElaboratedConfiguredPackage, BuildFailure) expectPackageFailed plan buildOutcomes pkgid = do - planpkg <- expectPlanPackage plan pkgid - case (planpkg, InstallPlan.lookupBuildOutcome planpkg buildOutcomes) of - (InstallPlan.Configured pkg, Just (Left failure)) - -> return (pkg, failure) - (_, buildResult) -> unexpectedBuildResult "Failed" planpkg buildResult - -unexpectedBuildResult :: String -> ElaboratedPlanPackage - -> Maybe (Either BuildFailure BuildResult) -> IO a + planpkg <- expectPlanPackage plan pkgid + case (planpkg, InstallPlan.lookupBuildOutcome planpkg buildOutcomes) of + (InstallPlan.Configured pkg, Just (Left failure)) -> + return (pkg, failure) + (_, buildResult) -> unexpectedBuildResult "Failed" planpkg buildResult + +unexpectedBuildResult + :: String + -> ElaboratedPlanPackage + -> Maybe (Either BuildFailure BuildResult) + -> IO a unexpectedBuildResult expected planpkg buildResult = - throwIO $ HUnitFailure Nothing $ - "expected to find " ++ display (packageId planpkg) ++ " in the " - ++ expected ++ " state, but it is actually in the " ++ actual ++ " state." + throwIO $ + HUnitFailure Nothing $ + "expected to find " + ++ display (packageId planpkg) + ++ " in the " + ++ expected + ++ " state, but it is actually in the " + ++ actual + ++ " state." where actual = case (buildResult, planpkg) of - (Nothing, InstallPlan.PreExisting{}) -> "PreExisting" - (Nothing, InstallPlan.Configured{}) -> "Configured" + (Nothing, InstallPlan.PreExisting{}) -> "PreExisting" + (Nothing, InstallPlan.Configured{}) -> "Configured" (Just (Right _), InstallPlan.Configured{}) -> "Installed" - (Just (Left _), InstallPlan.Configured{}) -> "Failed" - (Nothing, InstallPlan.Installed{}) -> "Installed globally" - _ -> "Impossible! " ++ show buildResult ++ show planpkg - -expectPlanPackage :: ElaboratedInstallPlan -> PackageId - -> IO ElaboratedPlanPackage + (Just (Left _), InstallPlan.Configured{}) -> "Failed" + (Nothing, InstallPlan.Installed{}) -> "Installed globally" + _ -> "Impossible! " ++ show buildResult ++ show planpkg + +expectPlanPackage + :: ElaboratedInstallPlan + -> PackageId + -> IO ElaboratedPlanPackage expectPlanPackage plan pkgid = - case [ pkg - | pkg <- InstallPlan.toList plan - , packageId pkg == pkgid ] of - [pkg] -> return pkg - [] -> throwIO $ HUnitFailure Nothing $ - "expected to find " ++ display pkgid - ++ " in the install plan but it's not there" - _ -> throwIO $ HUnitFailure Nothing $ - "expected to find only one instance of " ++ display pkgid - ++ " in the install plan but there's several" + case [ pkg + | pkg <- InstallPlan.toList plan + , packageId pkg == pkgid + ] of + [pkg] -> return pkg + [] -> + throwIO $ + HUnitFailure Nothing $ + "expected to find " + ++ display pkgid + ++ " in the install plan but it's not there" + _ -> + throwIO $ + HUnitFailure Nothing $ + "expected to find only one instance of " + ++ display pkgid + ++ " in the install plan but there's several" expectBuildFailed :: BuildFailure -> IO () expectBuildFailed (BuildFailure _ (BuildFailed _)) = return () expectBuildFailed (BuildFailure _ reason) = - assertFailure $ "expected BuildFailed, got " ++ show reason + assertFailure $ "expected BuildFailed, got " ++ show reason --------------------------------------- -- Other utils @@ -1907,11 +2419,10 @@ expectBuildFailed (BuildFailure _ reason) = -- | Allow altering a file during a test, but then restore it afterwards -- -- We read into the memory, as filesystems are tricky. (especially Windows) --- withFileFinallyRestore :: FilePath -> IO a -> IO a withFileFinallyRestore file action = do - originalContents <- BS.readFile file - action `finally` handle onIOError (tryFewTimes $ BS.writeFile file originalContents) + originalContents <- BS.readFile file + action `finally` handle onIOError (tryFewTimes $ BS.writeFile file originalContents) where onIOError :: IOException -> IO () onIOError e = putStrLn $ "WARNING: Cannot restore " ++ file ++ "; " ++ show e @@ -1923,16 +2434,18 @@ withFileFinallyRestore file action = do -- retrying if it fails for 'IOException' reason. -- tryFewTimes :: forall a. IO a -> IO a -tryFewTimes action = go (3 :: Int) where +tryFewTimes action = go (3 :: Int) + where go :: Int -> IO a - go !n | n <= 0 = action - | otherwise = action `catch` onIOError n + go !n + | n <= 0 = action + | otherwise = action `catch` onIOError n onIOError :: Int -> IOException -> IO a onIOError n e = do - hPutStrLn stderr $ "Trying " ++ show n ++ " after " ++ show e - threadDelay 10000 - go (n - 1) + hPutStrLn stderr $ "Trying " ++ show n ++ " after " ++ show e + threadDelay 10000 + go (n - 1) testNixFlags :: Assertion testNixFlags = do @@ -1955,7 +2468,6 @@ testNixFlags = do Just True @=? (fromFlag . globalNix . savedGlobalFlags $ trueConfig) Just False @=? (fromFlag . globalNix . savedGlobalFlags $ falseConfig) - where fromFlag :: Flag Bool -> Maybe Bool fromFlag (Flag x) = Just x @@ -1967,228 +2479,271 @@ testNixFlags = do -- Tests whether config options are commented or not testConfigOptionComments :: Assertion testConfigOptionComments = do - _ <- createDefaultConfigFile verbosity [] (basedir "config/default-config") - defaultConfigFile <- readFile (basedir "config/default-config") - - " url" @=? findLineWith False "url" defaultConfigFile - " -- secure" @=? findLineWith True "secure" defaultConfigFile - " -- root-keys" @=? findLineWith True "root-keys" defaultConfigFile - " -- key-threshold" @=? findLineWith True "key-threshold" defaultConfigFile - - "-- ignore-expiry" @=? findLineWith True "ignore-expiry" defaultConfigFile - "-- http-transport" @=? findLineWith True "http-transport" defaultConfigFile - "-- nix" @=? findLineWith True "nix" defaultConfigFile - "-- store-dir" @=? findLineWith True "store-dir" defaultConfigFile - "-- active-repositories" @=? findLineWith True "active-repositories" defaultConfigFile - "-- local-no-index-repo" @=? findLineWith True "local-no-index-repo" defaultConfigFile - "remote-repo-cache" @=? findLineWith False "remote-repo-cache" defaultConfigFile - "-- logs-dir" @=? findLineWith True "logs-dir" defaultConfigFile - "-- default-user-config" @=? findLineWith True "default-user-config" defaultConfigFile - "-- verbose" @=? findLineWith True "verbose" defaultConfigFile - "-- compiler" @=? findLineWith True "compiler" defaultConfigFile - "-- cabal-file" @=? findLineWith True "cabal-file" defaultConfigFile - "-- with-compiler" @=? findLineWith True "with-compiler" defaultConfigFile - "-- with-hc-pkg" @=? findLineWith True "with-hc-pkg" defaultConfigFile - "-- program-prefix" @=? findLineWith True "program-prefix" defaultConfigFile - "-- program-suffix" @=? findLineWith True "program-suffix" defaultConfigFile - "-- library-vanilla" @=? findLineWith True "library-vanilla" defaultConfigFile - "-- library-profiling" @=? findLineWith True "library-profiling" defaultConfigFile - "-- shared" @=? findLineWith True "shared" defaultConfigFile - "-- static" @=? findLineWith True "static" defaultConfigFile - "-- executable-dynamic" @=? findLineWith True "executable-dynamic" defaultConfigFile - "-- executable-static" @=? findLineWith True "executable-static" defaultConfigFile - "-- profiling" @=? findLineWith True "profiling" defaultConfigFile - "-- executable-profiling" @=? findLineWith True "executable-profiling" defaultConfigFile - "-- profiling-detail" @=? findLineWith True "profiling-detail" defaultConfigFile - "-- library-profiling-detail" @=? findLineWith True "library-profiling-detail" defaultConfigFile - "-- optimization" @=? findLineWith True "optimization" defaultConfigFile - "-- debug-info" @=? findLineWith True "debug-info" defaultConfigFile - "-- build-info" @=? findLineWith True "build-info" defaultConfigFile - "-- library-for-ghci" @=? findLineWith True "library-for-ghci" defaultConfigFile - "-- split-sections" @=? findLineWith True "split-sections" defaultConfigFile - "-- split-objs" @=? findLineWith True "split-objs" defaultConfigFile - "-- executable-stripping" @=? findLineWith True "executable-stripping" defaultConfigFile - "-- library-stripping" @=? findLineWith True "library-stripping" defaultConfigFile - "-- configure-option" @=? findLineWith True "configure-option" defaultConfigFile - "-- user-install" @=? findLineWith True "user-install" defaultConfigFile - "-- package-db" @=? findLineWith True "package-db" defaultConfigFile - "-- flags" @=? findLineWith True "flags" defaultConfigFile - "-- extra-include-dirs" @=? findLineWith True "extra-include-dirs" defaultConfigFile - "-- deterministic" @=? findLineWith True "deterministic" defaultConfigFile - "-- cid" @=? findLineWith True "cid" defaultConfigFile - "-- extra-lib-dirs" @=? findLineWith True "extra-lib-dirs" defaultConfigFile - "-- extra-lib-dirs-static" @=? findLineWith True "extra-lib-dirs-static" defaultConfigFile - "-- extra-framework-dirs" @=? findLineWith True "extra-framework-dirs" defaultConfigFile - "-- extra-prog-path" @=? findLineWith False "extra-prog-path" defaultConfigFile - "-- instantiate-with" @=? findLineWith True "instantiate-with" defaultConfigFile - "-- tests" @=? findLineWith True "tests" defaultConfigFile - "-- coverage" @=? findLineWith True "coverage" defaultConfigFile - "-- library-coverage" @=? findLineWith True "library-coverage" defaultConfigFile - "-- exact-configuration" @=? findLineWith True "exact-configuration" defaultConfigFile - "-- benchmarks" @=? findLineWith True "benchmarks" defaultConfigFile - "-- relocatable" @=? findLineWith True "relocatable" defaultConfigFile - "-- response-files" @=? findLineWith True "response-files" defaultConfigFile - "-- allow-depending-on-private-libs" @=? findLineWith True "allow-depending-on-private-libs" defaultConfigFile - "-- cabal-lib-version" @=? findLineWith True "cabal-lib-version" defaultConfigFile - "-- append" @=? findLineWith True "append" defaultConfigFile - "-- backup" @=? findLineWith True "backup" defaultConfigFile - "-- constraint" @=? findLineWith True "constraint" defaultConfigFile - "-- preference" @=? findLineWith True "preference" defaultConfigFile - "-- solver" @=? findLineWith True "solver" defaultConfigFile - "-- allow-older" @=? findLineWith True "allow-older" defaultConfigFile - "-- allow-newer" @=? findLineWith True "allow-newer" defaultConfigFile - "-- write-ghc-environment-files" @=? findLineWith True "write-ghc-environment-files" defaultConfigFile - "-- documentation" @=? findLineWith True "documentation" defaultConfigFile - "-- doc-index-file" @=? findLineWith True "doc-index-file" defaultConfigFile - "-- only-download" @=? findLineWith True "only-download" defaultConfigFile - "-- target-package-db" @=? findLineWith True "target-package-db" defaultConfigFile - "-- max-backjumps" @=? findLineWith True "max-backjumps" defaultConfigFile - "-- reorder-goals" @=? findLineWith True "reorder-goals" defaultConfigFile - "-- count-conflicts" @=? findLineWith True "count-conflicts" defaultConfigFile - "-- fine-grained-conflicts" @=? findLineWith True "fine-grained-conflicts" defaultConfigFile - "-- minimize-conflict-set" @=? findLineWith True "minimize-conflict-set" defaultConfigFile - "-- independent-goals" @=? findLineWith True "independent-goals" defaultConfigFile - "-- prefer-oldest" @=? findLineWith True "prefer-oldest" defaultConfigFile - "-- shadow-installed-packages" @=? findLineWith True "shadow-installed-packages" defaultConfigFile - "-- strong-flags" @=? findLineWith True "strong-flags" defaultConfigFile - "-- allow-boot-library-installs" @=? findLineWith True "allow-boot-library-installs" defaultConfigFile - "-- reject-unconstrained-dependencies" @=? findLineWith True "reject-unconstrained-dependencies" defaultConfigFile - "-- reinstall" @=? findLineWith True "reinstall" defaultConfigFile - "-- avoid-reinstalls" @=? findLineWith True "avoid-reinstalls" defaultConfigFile - "-- force-reinstalls" @=? findLineWith True "force-reinstalls" defaultConfigFile - "-- upgrade-dependencies" @=? findLineWith True "upgrade-dependencies" defaultConfigFile - "-- index-state" @=? findLineWith True "index-state" defaultConfigFile - "-- root-cmd" @=? findLineWith True "root-cmd" defaultConfigFile - "-- symlink-bindir" @=? findLineWith True "symlink-bindir" defaultConfigFile - "build-summary" @=? findLineWith False "build-summary" defaultConfigFile - "-- build-log" @=? findLineWith True "build-log" defaultConfigFile - "remote-build-reporting" @=? findLineWith False "remote-build-reporting" defaultConfigFile - "-- report-planning-failure" @=? findLineWith True "report-planning-failure" defaultConfigFile - "-- per-component" @=? findLineWith True "per-component" defaultConfigFile - "-- run-tests" @=? findLineWith True "run-tests" defaultConfigFile - "jobs" @=? findLineWith False "jobs" defaultConfigFile - "-- keep-going" @=? findLineWith True "keep-going" defaultConfigFile - "-- offline" @=? findLineWith True "offline" defaultConfigFile - "-- lib" @=? findLineWith True "lib" defaultConfigFile - "-- package-env" @=? findLineWith True "package-env" defaultConfigFile - "-- overwrite-policy" @=? findLineWith True "overwrite-policy" defaultConfigFile - "-- install-method" @=? findLineWith True "install-method" defaultConfigFile - "installdir" @=? findLineWith False "installdir" defaultConfigFile - "-- token" @=? findLineWith True "token" defaultConfigFile - "-- username" @=? findLineWith True "username" defaultConfigFile - "-- password" @=? findLineWith True "password" defaultConfigFile - "-- password-command" @=? findLineWith True "password-command" defaultConfigFile - "-- builddir" @=? findLineWith True "builddir" defaultConfigFile - - " -- keep-temp-files" @=? findLineWith True "keep-temp-files" defaultConfigFile - " -- hoogle" @=? findLineWith True "hoogle" defaultConfigFile - " -- html" @=? findLineWith True "html" defaultConfigFile - " -- html-location" @=? findLineWith True "html-location" defaultConfigFile - " -- executables" @=? findLineWith True "executables" defaultConfigFile - " -- foreign-libraries" @=? findLineWith True "foreign-libraries" defaultConfigFile - " -- all" @=? findLineWith True "all" defaultConfigFile - " -- internal" @=? findLineWith True "internal" defaultConfigFile - " -- css" @=? findLineWith True "css" defaultConfigFile - " -- hyperlink-source" @=? findLineWith True "hyperlink-source" defaultConfigFile - " -- quickjump" @=? findLineWith True "quickjump" defaultConfigFile - " -- hscolour-css" @=? findLineWith True "hscolour-css" defaultConfigFile - " -- contents-location" @=? findLineWith True "contents-location" defaultConfigFile - " -- index-location" @=? findLineWith True "index-location" defaultConfigFile - " -- base-url" @=? findLineWith True "base-url" defaultConfigFile - " -- output-dir" @=? findLineWith True "output-dir" defaultConfigFile - - " -- interactive" @=? findLineWith True "interactive" defaultConfigFile - " -- quiet" @=? findLineWith True "quiet" defaultConfigFile - " -- no-comments" @=? findLineWith True "no-comments" defaultConfigFile - " -- minimal" @=? findLineWith True "minimal" defaultConfigFile - " -- cabal-version" @=? findLineWith True "cabal-version" defaultConfigFile - " -- license" @=? findLineWith True "license" defaultConfigFile - " -- extra-doc-file" @=? findLineWith True "extra-doc-file" defaultConfigFile - " -- test-dir" @=? findLineWith True "test-dir" defaultConfigFile - " -- simple" @=? findLineWith True "simple" defaultConfigFile - " -- language" @=? findLineWith True "language" defaultConfigFile - " -- application-dir" @=? findLineWith True "application-dir" defaultConfigFile - " -- source-dir" @=? findLineWith True "source-dir" defaultConfigFile - - " -- prefix" @=? findLineWith True "prefix" defaultConfigFile - " -- bindir"@=? findLineWith True "bindir" defaultConfigFile - " -- libdir" @=? findLineWith True "libdir" defaultConfigFile - " -- libsubdir" @=? findLineWith True "libsubdir" defaultConfigFile - " -- dynlibdir" @=? findLineWith True "dynlibdir" defaultConfigFile - " -- libexecdir" @=? findLineWith True "libexecdir" defaultConfigFile - " -- libexecsubdir" @=? findLineWith True "libexecsubdir" defaultConfigFile - " -- datadir" @=? findLineWith True "datadir" defaultConfigFile - " -- datasubdir" @=? findLineWith True "datasubdir" defaultConfigFile - " -- docdir" @=? findLineWith True "docdir" defaultConfigFile - " -- htmldir" @=? findLineWith True "htmldir" defaultConfigFile - " -- haddockdir" @=? findLineWith True "haddockdir" defaultConfigFile - " -- sysconfdir" @=? findLineWith True "sysconfdir" defaultConfigFile - - " -- alex-location" @=? findLineWith True "alex-location" defaultConfigFile - " -- ar-location" @=? findLineWith True "ar-location" defaultConfigFile - " -- c2hs-location" @=? findLineWith True "c2hs-location" defaultConfigFile - " -- cpphs-location" @=? findLineWith True "cpphs-location" defaultConfigFile - " -- doctest-location" @=? findLineWith True "doctest-location" defaultConfigFile - " -- gcc-location" @=? findLineWith True "gcc-location" defaultConfigFile - " -- ghc-location" @=? findLineWith True "ghc-location" defaultConfigFile - " -- ghc-pkg-location" @=? findLineWith True "ghc-pkg-location" defaultConfigFile - " -- ghcjs-location" @=? findLineWith True "ghcjs-location" defaultConfigFile - " -- ghcjs-pkg-location" @=? findLineWith True "ghcjs-pkg-location" defaultConfigFile - " -- greencard-location" @=? findLineWith True "greencard-location" defaultConfigFile - " -- haddock-location" @=? findLineWith True "haddock-location" defaultConfigFile - " -- happy-location" @=? findLineWith True "happy-location" defaultConfigFile - " -- haskell-suite-location" @=? findLineWith True "haskell-suite-location" defaultConfigFile - " -- haskell-suite-pkg-location" @=? findLineWith True "haskell-suite-pkg-location" defaultConfigFile - " -- hmake-location" @=? findLineWith True "hmake-location" defaultConfigFile - " -- hpc-location" @=? findLineWith True "hpc-location" defaultConfigFile - " -- hscolour-location" @=? findLineWith True "hscolour-location" defaultConfigFile - " -- jhc-location" @=? findLineWith True "jhc-location" defaultConfigFile - " -- ld-location" @=? findLineWith True "ld-location" defaultConfigFile - " -- pkg-config-location" @=? findLineWith True "pkg-config-location" defaultConfigFile - " -- runghc-location" @=? findLineWith True "runghc-location" defaultConfigFile - " -- strip-location" @=? findLineWith True "strip-location" defaultConfigFile - " -- tar-location" @=? findLineWith True "tar-location" defaultConfigFile - " -- uhc-location" @=? findLineWith True "uhc-location" defaultConfigFile - - " -- alex-options" @=? findLineWith True "alex-options" defaultConfigFile - " -- ar-options" @=? findLineWith True "ar-options" defaultConfigFile - " -- c2hs-options" @=? findLineWith True "c2hs-options" defaultConfigFile - " -- cpphs-options" @=? findLineWith True "cpphs-options" defaultConfigFile - " -- doctest-options" @=? findLineWith True "doctest-options" defaultConfigFile - " -- gcc-options" @=? findLineWith True "gcc-options" defaultConfigFile - " -- ghc-options" @=? findLineWith True "ghc-options" defaultConfigFile - " -- ghc-pkg-options" @=? findLineWith True "ghc-pkg-options" defaultConfigFile - " -- ghcjs-options" @=? findLineWith True "ghcjs-options" defaultConfigFile - " -- ghcjs-pkg-options" @=? findLineWith True "ghcjs-pkg-options" defaultConfigFile - " -- greencard-options" @=? findLineWith True "greencard-options" defaultConfigFile - " -- haddock-options" @=? findLineWith True "haddock-options" defaultConfigFile - " -- happy-options" @=? findLineWith True "happy-options" defaultConfigFile - " -- haskell-suite-options" @=? findLineWith True "haskell-suite-options" defaultConfigFile - " -- haskell-suite-pkg-options" @=? findLineWith True "haskell-suite-pkg-options" defaultConfigFile - " -- hmake-options" @=? findLineWith True "hmake-options" defaultConfigFile - " -- hpc-options" @=? findLineWith True "hpc-options" defaultConfigFile - " -- hsc2hs-options" @=? findLineWith True "hsc2hs-options" defaultConfigFile - " -- hscolour-options" @=? findLineWith True "hscolour-options" defaultConfigFile - " -- jhc-options" @=? findLineWith True "jhc-options" defaultConfigFile - " -- ld-options" @=? findLineWith True "ld-options" defaultConfigFile - " -- pkg-config-options" @=? findLineWith True "pkg-config-options" defaultConfigFile - " -- runghc-options" @=? findLineWith True "runghc-options" defaultConfigFile - " -- strip-options" @=? findLineWith True "strip-options" defaultConfigFile - " -- tar-options" @=? findLineWith True "tar-options" defaultConfigFile - " -- uhc-options" @=? findLineWith True "uhc-options" defaultConfigFile - where - -- | Find lines containing a target string. + let + -- \| Find the first line containing a target setting name. + -- + -- If `isComment` is set, only comment lines will be found. findLineWith :: Bool -> String -> String -> String findLineWith isComment target text = case findLinesWith isComment target text of [] -> text - (l : _) -> removeCommentValue l + (l : _) -> removeColonAndAfter l + + -- \| Find lines containing a target setting name. findLinesWith :: Bool -> String -> String -> [String] findLinesWith isComment target - | isComment = filter (isInfixOf (" " ++ target ++ ":")) . lines + | isComment = filter (isInfixOf ("-- " ++ target ++ ":")) . lines | otherwise = filter (isInfixOf (target ++ ":")) . lines - removeCommentValue :: String -> String - removeCommentValue = takeWhile (/= ':') + + -- \| Transform @-- puppy: doggy@ into @-- puppy@. + removeColonAndAfter :: String -> String + removeColonAndAfter = takeWhile (/= ':') + + cwd <- getCurrentDirectory + let configFile = cwd basedir "config" "default-config" + _ <- createDefaultConfigFile verbosity [] configFile + defaultConfigFile <- readFile configFile + + let + -- TODO: These assertions are fairly weak. Potential improvements: + -- + -- - Include the section name in the assertion, so that (e.g.) a + -- `keep-temp-files` setting in the `haddock` section won't be confused + -- with a `keep-temp-files` setting in the `init` section. + -- + -- - Check all matching lines to confirm that settings are not listed + -- multiple times. For example, `cabal-file` is listed twice right now, + -- once under the `haddock` settings! + -- + -- - Consume the file as we go, ensuring that the settings are in a given + -- order. + -- + -- - Check the generated config file into Git (replacing e.g. `$HOME` with + -- a sentinel value) so changes show up in PR diffs. + assertHasLine' :: Bool -> String -> String -> Assertion + assertHasLine' isComment expected settingName = + let actual = findLineWith isComment settingName defaultConfigFile + messagePrefix = + "Did not find expected line for setting " + <> show settingName + <> " in configuration file " + <> configFile + in assertEqual messagePrefix expected actual + + assertHasLine :: String -> String -> Assertion + assertHasLine = assertHasLine' False + + assertHasCommentLine :: String -> String -> Assertion + assertHasCommentLine = assertHasLine' True + + " url" `assertHasLine` "url" + " -- secure" `assertHasCommentLine` "secure" + " -- root-keys" `assertHasCommentLine` "root-keys" + " -- key-threshold" `assertHasCommentLine` "key-threshold" + + "-- ignore-expiry" `assertHasCommentLine` "ignore-expiry" + "-- http-transport" `assertHasCommentLine` "http-transport" + "-- nix" `assertHasCommentLine` "nix" + "-- store-dir" `assertHasCommentLine` "store-dir" + "-- active-repositories" `assertHasCommentLine` "active-repositories" + "-- local-no-index-repo" `assertHasCommentLine` "local-no-index-repo" + "remote-repo-cache" `assertHasLine` "remote-repo-cache" + "-- logs-dir" `assertHasCommentLine` "logs-dir" + "-- default-user-config" `assertHasCommentLine` "default-user-config" + "-- verbose" `assertHasCommentLine` "verbose" + "-- compiler" `assertHasCommentLine` "compiler" + "-- cabal-file" `assertHasCommentLine` "cabal-file" + "-- keep-temp-files" `assertHasCommentLine` "keep-temp-files" + "-- with-compiler" `assertHasCommentLine` "with-compiler" + "-- with-hc-pkg" `assertHasCommentLine` "with-hc-pkg" + "-- program-prefix" `assertHasCommentLine` "program-prefix" + "-- program-suffix" `assertHasCommentLine` "program-suffix" + "-- library-vanilla" `assertHasCommentLine` "library-vanilla" + "-- library-profiling" `assertHasCommentLine` "library-profiling" + "-- shared" `assertHasCommentLine` "shared" + "-- static" `assertHasCommentLine` "static" + "-- executable-dynamic" `assertHasCommentLine` "executable-dynamic" + "-- executable-static" `assertHasCommentLine` "executable-static" + "-- profiling" `assertHasCommentLine` "profiling" + "-- executable-profiling" `assertHasCommentLine` "executable-profiling" + "-- profiling-detail" `assertHasCommentLine` "profiling-detail" + "-- library-profiling-detail" `assertHasCommentLine` "library-profiling-detail" + "-- optimization" `assertHasCommentLine` "optimization" + "-- debug-info" `assertHasCommentLine` "debug-info" + "-- build-info" `assertHasCommentLine` "build-info" + "-- library-for-ghci" `assertHasCommentLine` "library-for-ghci" + "-- split-sections" `assertHasCommentLine` "split-sections" + "-- split-objs" `assertHasCommentLine` "split-objs" + "-- executable-stripping" `assertHasCommentLine` "executable-stripping" + "-- library-stripping" `assertHasCommentLine` "library-stripping" + "-- configure-option" `assertHasCommentLine` "configure-option" + "-- user-install" `assertHasCommentLine` "user-install" + "-- package-db" `assertHasCommentLine` "package-db" + "-- flags" `assertHasCommentLine` "flags" + "-- extra-include-dirs" `assertHasCommentLine` "extra-include-dirs" + "-- deterministic" `assertHasCommentLine` "deterministic" + "-- cid" `assertHasCommentLine` "cid" + "-- extra-lib-dirs" `assertHasCommentLine` "extra-lib-dirs" + "-- extra-lib-dirs-static" `assertHasCommentLine` "extra-lib-dirs-static" + "-- extra-framework-dirs" `assertHasCommentLine` "extra-framework-dirs" + "-- extra-prog-path" `assertHasLine` "extra-prog-path" + "-- instantiate-with" `assertHasCommentLine` "instantiate-with" + "-- tests" `assertHasCommentLine` "tests" + "-- coverage" `assertHasCommentLine` "coverage" + "-- library-coverage" `assertHasCommentLine` "library-coverage" + "-- exact-configuration" `assertHasCommentLine` "exact-configuration" + "-- benchmarks" `assertHasCommentLine` "benchmarks" + "-- relocatable" `assertHasCommentLine` "relocatable" + "-- response-files" `assertHasCommentLine` "response-files" + "-- allow-depending-on-private-libs" `assertHasCommentLine` "allow-depending-on-private-libs" + "-- cabal-lib-version" `assertHasCommentLine` "cabal-lib-version" + "-- append" `assertHasCommentLine` "append" + "-- backup" `assertHasCommentLine` "backup" + "-- constraint" `assertHasCommentLine` "constraint" + "-- preference" `assertHasCommentLine` "preference" + "-- solver" `assertHasCommentLine` "solver" + "-- allow-older" `assertHasCommentLine` "allow-older" + "-- allow-newer" `assertHasCommentLine` "allow-newer" + "-- write-ghc-environment-files" `assertHasCommentLine` "write-ghc-environment-files" + "-- documentation" `assertHasCommentLine` "documentation" + "-- doc-index-file" `assertHasCommentLine` "doc-index-file" + "-- only-download" `assertHasCommentLine` "only-download" + "-- target-package-db" `assertHasCommentLine` "target-package-db" + "-- max-backjumps" `assertHasCommentLine` "max-backjumps" + "-- reorder-goals" `assertHasCommentLine` "reorder-goals" + "-- count-conflicts" `assertHasCommentLine` "count-conflicts" + "-- fine-grained-conflicts" `assertHasCommentLine` "fine-grained-conflicts" + "-- minimize-conflict-set" `assertHasCommentLine` "minimize-conflict-set" + "-- independent-goals" `assertHasCommentLine` "independent-goals" + "-- prefer-oldest" `assertHasCommentLine` "prefer-oldest" + "-- shadow-installed-packages" `assertHasCommentLine` "shadow-installed-packages" + "-- strong-flags" `assertHasCommentLine` "strong-flags" + "-- allow-boot-library-installs" `assertHasCommentLine` "allow-boot-library-installs" + "-- reject-unconstrained-dependencies" `assertHasCommentLine` "reject-unconstrained-dependencies" + "-- reinstall" `assertHasCommentLine` "reinstall" + "-- avoid-reinstalls" `assertHasCommentLine` "avoid-reinstalls" + "-- force-reinstalls" `assertHasCommentLine` "force-reinstalls" + "-- upgrade-dependencies" `assertHasCommentLine` "upgrade-dependencies" + "-- index-state" `assertHasCommentLine` "index-state" + "-- root-cmd" `assertHasCommentLine` "root-cmd" + "-- symlink-bindir" `assertHasCommentLine` "symlink-bindir" + "build-summary" `assertHasLine` "build-summary" + "-- build-log" `assertHasCommentLine` "build-log" + "remote-build-reporting" `assertHasLine` "remote-build-reporting" + "-- report-planning-failure" `assertHasCommentLine` "report-planning-failure" + "-- per-component" `assertHasCommentLine` "per-component" + "-- run-tests" `assertHasCommentLine` "run-tests" + "jobs" `assertHasLine` "jobs" + "-- keep-going" `assertHasCommentLine` "keep-going" + "-- offline" `assertHasCommentLine` "offline" + "-- lib" `assertHasCommentLine` "lib" + "-- package-env" `assertHasCommentLine` "package-env" + "-- overwrite-policy" `assertHasCommentLine` "overwrite-policy" + "-- install-method" `assertHasCommentLine` "install-method" + "installdir" `assertHasLine` "installdir" + "-- token" `assertHasCommentLine` "token" + "-- username" `assertHasCommentLine` "username" + "-- password" `assertHasCommentLine` "password" + "-- password-command" `assertHasCommentLine` "password-command" + "-- builddir" `assertHasCommentLine` "builddir" + + " -- hoogle" `assertHasCommentLine` "hoogle" + " -- html" `assertHasCommentLine` "html" + " -- html-location" `assertHasCommentLine` "html-location" + " -- executables" `assertHasCommentLine` "executables" + " -- foreign-libraries" `assertHasCommentLine` "foreign-libraries" + " -- all" `assertHasCommentLine` "all" + " -- internal" `assertHasCommentLine` "internal" + " -- css" `assertHasCommentLine` "css" + " -- hyperlink-source" `assertHasCommentLine` "hyperlink-source" + " -- quickjump" `assertHasCommentLine` "quickjump" + " -- hscolour-css" `assertHasCommentLine` "hscolour-css" + " -- contents-location" `assertHasCommentLine` "contents-location" + " -- index-location" `assertHasCommentLine` "index-location" + " -- base-url" `assertHasCommentLine` "base-url" + " -- resources-dir" `assertHasCommentLine` "resources-dir" + " -- output-dir" `assertHasCommentLine` "output-dir" + " -- use-unicode" `assertHasCommentLine` "use-unicode" + + " -- interactive" `assertHasCommentLine` "interactive" + " -- quiet" `assertHasCommentLine` "quiet" + " -- no-comments" `assertHasCommentLine` "no-comments" + " -- minimal" `assertHasCommentLine` "minimal" + " -- cabal-version" `assertHasCommentLine` "cabal-version" + " -- license" `assertHasCommentLine` "license" + " -- extra-doc-file" `assertHasCommentLine` "extra-doc-file" + " -- test-dir" `assertHasCommentLine` "test-dir" + " -- simple" `assertHasCommentLine` "simple" + " -- language" `assertHasCommentLine` "language" + " -- application-dir" `assertHasCommentLine` "application-dir" + " -- source-dir" `assertHasCommentLine` "source-dir" + + " -- prefix" `assertHasCommentLine` "prefix" + " -- bindir" `assertHasCommentLine` "bindir" + " -- libdir" `assertHasCommentLine` "libdir" + " -- libsubdir" `assertHasCommentLine` "libsubdir" + " -- dynlibdir" `assertHasCommentLine` "dynlibdir" + " -- libexecdir" `assertHasCommentLine` "libexecdir" + " -- libexecsubdir" `assertHasCommentLine` "libexecsubdir" + " -- datadir" `assertHasCommentLine` "datadir" + " -- datasubdir" `assertHasCommentLine` "datasubdir" + " -- docdir" `assertHasCommentLine` "docdir" + " -- htmldir" `assertHasCommentLine` "htmldir" + " -- haddockdir" `assertHasCommentLine` "haddockdir" + " -- sysconfdir" `assertHasCommentLine` "sysconfdir" + + " -- alex-location" `assertHasCommentLine` "alex-location" + " -- ar-location" `assertHasCommentLine` "ar-location" + " -- c2hs-location" `assertHasCommentLine` "c2hs-location" + " -- cpphs-location" `assertHasCommentLine` "cpphs-location" + " -- doctest-location" `assertHasCommentLine` "doctest-location" + " -- gcc-location" `assertHasCommentLine` "gcc-location" + " -- ghc-location" `assertHasCommentLine` "ghc-location" + " -- ghc-pkg-location" `assertHasCommentLine` "ghc-pkg-location" + " -- ghcjs-location" `assertHasCommentLine` "ghcjs-location" + " -- ghcjs-pkg-location" `assertHasCommentLine` "ghcjs-pkg-location" + " -- greencard-location" `assertHasCommentLine` "greencard-location" + " -- haddock-location" `assertHasCommentLine` "haddock-location" + " -- happy-location" `assertHasCommentLine` "happy-location" + " -- haskell-suite-location" `assertHasCommentLine` "haskell-suite-location" + " -- haskell-suite-pkg-location" `assertHasCommentLine` "haskell-suite-pkg-location" + " -- hmake-location" `assertHasCommentLine` "hmake-location" + " -- hpc-location" `assertHasCommentLine` "hpc-location" + " -- hscolour-location" `assertHasCommentLine` "hscolour-location" + " -- jhc-location" `assertHasCommentLine` "jhc-location" + " -- ld-location" `assertHasCommentLine` "ld-location" + " -- pkg-config-location" `assertHasCommentLine` "pkg-config-location" + " -- runghc-location" `assertHasCommentLine` "runghc-location" + " -- strip-location" `assertHasCommentLine` "strip-location" + " -- tar-location" `assertHasCommentLine` "tar-location" + " -- uhc-location" `assertHasCommentLine` "uhc-location" + + " -- alex-options" `assertHasCommentLine` "alex-options" + " -- ar-options" `assertHasCommentLine` "ar-options" + " -- c2hs-options" `assertHasCommentLine` "c2hs-options" + " -- cpphs-options" `assertHasCommentLine` "cpphs-options" + " -- doctest-options" `assertHasCommentLine` "doctest-options" + " -- gcc-options" `assertHasCommentLine` "gcc-options" + " -- ghc-options" `assertHasCommentLine` "ghc-options" + " -- ghc-pkg-options" `assertHasCommentLine` "ghc-pkg-options" + " -- ghcjs-options" `assertHasCommentLine` "ghcjs-options" + " -- ghcjs-pkg-options" `assertHasCommentLine` "ghcjs-pkg-options" + " -- greencard-options" `assertHasCommentLine` "greencard-options" + " -- haddock-options" `assertHasCommentLine` "haddock-options" + " -- happy-options" `assertHasCommentLine` "happy-options" + " -- haskell-suite-options" `assertHasCommentLine` "haskell-suite-options" + " -- haskell-suite-pkg-options" `assertHasCommentLine` "haskell-suite-pkg-options" + " -- hmake-options" `assertHasCommentLine` "hmake-options" + " -- hpc-options" `assertHasCommentLine` "hpc-options" + " -- hsc2hs-options" `assertHasCommentLine` "hsc2hs-options" + " -- hscolour-options" `assertHasCommentLine` "hscolour-options" + " -- jhc-options" `assertHasCommentLine` "jhc-options" + " -- ld-options" `assertHasCommentLine` "ld-options" + " -- pkg-config-options" `assertHasCommentLine` "pkg-config-options" + " -- runghc-options" `assertHasCommentLine` "runghc-options" + " -- strip-options" `assertHasCommentLine` "strip-options" + " -- tar-options" `assertHasCommentLine` "tar-options" + " -- uhc-options" `assertHasCommentLine` "uhc-options" testIgnoreProjectFlag :: Assertion testIgnoreProjectFlag = do @@ -2204,37 +2759,40 @@ testIgnoreProjectFlag = do testdir = "build/ignore-project" emptyConfig = mempty ignoreSetConfig :: ProjectConfig - ignoreSetConfig = mempty { projectConfigShared = mempty { projectConfigIgnoreProject = Flag True } } - + ignoreSetConfig = mempty{projectConfigShared = mempty{projectConfigIgnoreProject = Flag True}} cleanHaddockProject :: FilePath -> IO () cleanHaddockProject testdir = do - cleanProject testdir - let haddocksdir = basedir testdir "haddocks" - alreadyExists <- doesDirectoryExist haddocksdir - when alreadyExists $ removePathForcibly haddocksdir - let storedir = basedir testdir "store" - alreadyExists' <- doesDirectoryExist storedir - when alreadyExists' $ removePathForcibly storedir - + cleanProject testdir + let haddocksdir = basedir testdir "haddocks" + alreadyExists <- doesDirectoryExist haddocksdir + when alreadyExists $ removePathForcibly haddocksdir + let storedir = basedir testdir "store" + alreadyExists' <- doesDirectoryExist storedir + when alreadyExists' $ removePathForcibly storedir testHaddockProjectDependencies :: ProjectConfig -> Assertion testHaddockProjectDependencies config = do - (_,_,sharedConfig) <- planProject testdir config - -- `haddock-project` is only supported by `haddock-2.26.1` and above which is - -- shipped with `ghc-9.4` - when (compilerVersion (pkgConfigCompiler sharedConfig) > mkVersion [9,4]) $ do - let dir = basedir testdir - cleanHaddockProject testdir - withCurrentDirectory dir $ do - CmdHaddockProject.haddockProjectAction - defaultHaddockProjectFlags { haddockProjectVerbosity = Flag verbosity } - ["all"] - defaultGlobalFlags { globalStoreDir = Flag "store" } - - let haddock = "haddocks" "async" "async.haddock" - hasHaddock <- doesFileExist haddock - unless hasHaddock $ assertFailure ("File `" ++ haddock ++ "` does not exist.") - cleanHaddockProject testdir + (_, _, sharedConfig) <- planProject testdir config + -- `haddock-project` is only supported by `haddock-2.26.1` and above which is + -- shipped with `ghc-9.4` + when (compilerVersion (pkgConfigCompiler sharedConfig) > mkVersion [9, 4]) $ do + let dir = basedir testdir + cleanHaddockProject testdir + withCurrentDirectory dir $ do + CmdHaddockProject.haddockProjectAction + defaultHaddockProjectFlags + { haddockProjectCommonFlags = + defaultCommonSetupFlags + { setupVerbosity = Flag verbosity + } + } + ["all"] + defaultGlobalFlags{globalStoreDir = Flag "store"} + + let haddock = "haddocks" "async" "async.haddock" + hasHaddock <- doesFileExist haddock + unless hasHaddock $ assertFailure ("File `" ++ haddock ++ "` does not exist.") + cleanHaddockProject testdir where testdir = "haddock-project/dependencies" diff --git a/cabal-install/tests/IntegrationTests2/CPP.hs b/cabal-install/tests/IntegrationTests2/CPP.hs new file mode 100644 index 00000000000..bc591ab4c6b --- /dev/null +++ b/cabal-install/tests/IntegrationTests2/CPP.hs @@ -0,0 +1,26 @@ +{- FOURMOLU_DISABLE -} +{-# LANGUAGE CPP #-} + +module IntegrationTests2.CPP + ( removePathForcibly + , isMingw32 + ) where + +import Distribution.Client.Compat.Prelude +import Prelude () + +#if MIN_VERSION_directory(1,2,7) +import System.Directory (removePathForcibly) +#endif + +#if !MIN_VERSION_directory(1,2,7) +removePathForcibly :: FilePath -> IO () +removePathForcibly = removeDirectoryRecursive +#endif + +isMingw32 :: Bool +#ifndef mingw32_HOST_OS +isMingw32 = True +#else +isMingw32 = False +#endif diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/Setup.hs b/cabal-install/tests/IntegrationTests2/targets/simple/a p p/Main.hs similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/Setup.hs rename to cabal-install/tests/IntegrationTests2/targets/simple/a p p/Main.hs diff --git a/cabal-install/tests/IntegrationTests2/targets/simple/p.cabal b/cabal-install/tests/IntegrationTests2/targets/simple/p.cabal index 75b24e0eadc..33ffc0d3a5f 100644 --- a/cabal-install/tests/IntegrationTests2/targets/simple/p.cabal +++ b/cabal-install/tests/IntegrationTests2/targets/simple/p.cabal @@ -15,3 +15,8 @@ executable ppexe main-is: Main.hs hs-source-dirs: app other-modules: PMain + +executable pppexe + main-is: Main.hs + hs-source-dirs: "a p p" + other-modules: PMain diff --git a/cabal-install/tests/UnitTests/Distribution/Client/ArbitraryInstances.hs b/cabal-install/tests/UnitTests/Distribution/Client/ArbitraryInstances.hs index 6acc63072d1..4246617a6e0 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/ArbitraryInstances.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/ArbitraryInstances.hs @@ -1,6 +1,5 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE GADTs #-} -{-# LANGUAGE TypeOperators #-} {-# OPTIONS_GHC -fno-warn-orphans #-} module UnitTests.Distribution.Client.ArbitraryInstances diff --git a/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs b/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs index f3c8145bc49..77f84108563 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/FileMonitor.hs @@ -32,7 +32,7 @@ tests :: Int -> [TestTree] tests mtimeChange = [ testGroup "Structured hashes" - [ testCase "MonitorStateFile" $ structureHash (Proxy :: Proxy MonitorStateFile) @?= Fingerprint 0xe4108804c34962f6 0x06e94f8fc9e48e13 + [ testCase "MonitorStateFile" $ structureHash (Proxy :: Proxy MonitorStateFile) @?= Fingerprint 0xe1339b9dcfdfe19d 0x9135a5f30da7ca82 , testCase "MonitorStateGlob" $ structureHash (Proxy :: Proxy MonitorStateGlob) @?= Fingerprint fingerprintStateGlob1 fingerprintStateGlob2 , testCase "MonitorStateFileSet" $ structureHash (Proxy :: Proxy MonitorStateFileSet) @?= Fingerprint fingerprintStateFileSet1 fingerprintStateFileSet2 ] @@ -88,17 +88,10 @@ tests mtimeChange = Windows -> expectFailBecause msg _ -> id fingerprintStateGlob1, fingerprintStateGlob2, fingerprintStateFileSet1, fingerprintStateFileSet2 :: Word64 -#if MIN_VERSION_base(4,19,0) - fingerprintStateGlob1 = 0x4ebc6a7d12bb2132 - fingerprintStateGlob2 = 0x2c2292eeda0a9319 - fingerprintStateFileSet1 = 0x01df5796f9030851 - fingerprintStateFileSet2 = 0x2f5c472be17bee98 -#else - fingerprintStateGlob1 = 0xf32c0d1644dd9ee5 - fingerprintStateGlob2 = 0x0f2494f7b6031fb6 - fingerprintStateFileSet1 = 0x06d4a13275c24282 - fingerprintStateFileSet2 = 0x791b2a88684b5f37 -#endif + fingerprintStateGlob1 = 0x1f9edda22b7e8de6 + fingerprintStateGlob2 = 0xda1d085c9fc6f5db + fingerprintStateFileSet1 = 0x00ac4a0df546905d + fingerprintStateFileSet2 = 0x5b2b2df018b1fa83 -- Check the file system behaves the way we expect it to diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Init.hs b/cabal-install/tests/UnitTests/Distribution/Client/Init.hs index b06faef5312..ce33e9ab302 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Init.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Init.hs @@ -17,6 +17,7 @@ import Distribution.Client.IndexUtils import Distribution.Client.Init.Types import Distribution.Client.Sandbox import Distribution.Client.Setup +import Distribution.Simple.Compiler import Distribution.Verbosity tests :: IO [TestTree] @@ -32,7 +33,7 @@ tests = do withRepoContext v globalFlags' $ \repoCtx -> do let pkgDb = configPackageDB' confFlags' - pkgIx <- getInstalledPackages v comp pkgDb progdb + pkgIx <- getInstalledPackages v comp (interpretPackageDBStack Nothing pkgDb) progdb srcDb <- getSourcePackages v repoCtx return diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Init/FileCreators.hs b/cabal-install/tests/UnitTests/Distribution/Client/Init/FileCreators.hs index 38c488dd3a7..63a5774acb1 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Init/FileCreators.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Init/FileCreators.hs @@ -81,7 +81,7 @@ tests _v _initFlags comp pkgIx srcDb = "False" ] - case flip _runPrompt inputs $ do + case flip runPrompt inputs $ do projSettings <- createProject comp silent pkgIx srcDb dummyFlags' writeProject projSettings of Left (BreakException ex) -> assertFailure $ show ex diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Init/Golden.hs b/cabal-install/tests/UnitTests/Distribution/Client/Init/Golden.hs index 19efe2eea1a..2bc0fb5e3e8 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Init/Golden.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Init/Golden.hs @@ -1,5 +1,4 @@ {-# LANGUAGE CPP #-} -{-# LANGUAGE LambdaCase #-} module UnitTests.Distribution.Client.Init.Golden ( tests @@ -105,7 +104,7 @@ goldenPkgDescTests v srcDb pkgDir pkgName = ] where runPkgDesc opts flags args = do - case _runPrompt (genPkgDescription flags srcDb) args of + case runPrompt (genPkgDescription flags srcDb) args of Left e -> assertFailure $ show e Right (pkg, _) -> mkStanza $ mkPkgDescription opts pkg @@ -146,7 +145,7 @@ goldenExeTests v pkgIx pkgDir pkgName = ] where runGoldenExe opts args flags = - case _runPrompt (genExeTarget flags pkgIx) args of + case runPrompt (genExeTarget flags pkgIx) args of Right (t, _) -> mkStanza [mkExeStanza opts $ t{_exeDependencies = mangleBaseDep t _exeDependencies}] Left e -> assertFailure $ show e @@ -192,7 +191,7 @@ goldenLibTests v pkgIx pkgDir pkgName = ] where runGoldenLib opts args flags = - case _runPrompt (genLibTarget flags pkgIx) args of + case runPrompt (genLibTarget flags pkgIx) args of Right (t, _) -> mkStanza [mkLibStanza opts $ t{_libDependencies = mangleBaseDep t _libDependencies}] Left e -> assertFailure $ show e @@ -243,7 +242,7 @@ goldenTestTests v pkgIx pkgDir pkgName = ] where runGoldenTest opts args flags = - case _runPrompt (genTestTarget flags pkgIx) args of + case runPrompt (genTestTarget flags pkgIx) args of Left e -> assertFailure $ show e Right (Nothing, _) -> assertFailure @@ -286,7 +285,7 @@ goldenCabalTests v pkgIx srcDb = ] where runGoldenTest args flags = - case _runPrompt (createProject v pkgIx srcDb flags) args of + case runPrompt (createProject v pkgIx srcDb flags) args of Left e -> assertFailure $ show e (Right (ProjectSettings opts pkgDesc (Just libTarget) (Just exeTarget) (Just testTarget), _)) -> do let pkgFields = mkPkgDescription opts pkgDesc diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Init/Interactive.hs b/cabal-install/tests/UnitTests/Distribution/Client/Init/Interactive.hs index 15714bba952..9ba237cbadc 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Init/Interactive.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Init/Interactive.hs @@ -76,7 +76,7 @@ createProjectTest pkgIx srcDb = , dependencies = Flag [] } - case (_runPrompt $ createProject silent pkgIx srcDb dummyFlags') (fromList ["[]", "3", "quxTest/Main.hs"]) of + case (runPrompt $ createProject silent pkgIx srcDb dummyFlags') (fromList ["[]", "3", "quxTest/Main.hs"]) of Right (ProjectSettings opts desc (Just lib) (Just exe) (Just test), _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -186,7 +186,7 @@ createProjectTest pkgIx srcDb = "y" ] - case (_runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of + case (runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of Right (ProjectSettings opts desc (Just lib) (Just exe) (Just test), _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -286,7 +286,7 @@ createProjectTest pkgIx srcDb = "y" ] - case (_runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of + case (runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of Right (ProjectSettings opts desc (Just lib) Nothing (Just test), _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -372,7 +372,7 @@ createProjectTest pkgIx srcDb = "y" ] - case (_runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of + case (runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of Right (ProjectSettings opts desc Nothing Nothing (Just test), _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -460,7 +460,7 @@ createProjectTest pkgIx srcDb = "y" ] - case (_runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of + case (runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of Right (ProjectSettings opts desc (Just lib) (Just exe) Nothing, _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -546,7 +546,7 @@ createProjectTest pkgIx srcDb = "y" ] - case (_runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of + case (runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of Right (ProjectSettings opts desc (Just lib) Nothing Nothing, _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -631,7 +631,7 @@ createProjectTest pkgIx srcDb = , extraSrc = Flag ["README.md"] } - case (_runPrompt $ createProject silent pkgIx srcDb flags) inputs of + case (runPrompt $ createProject silent pkgIx srcDb flags) inputs of Right (ProjectSettings opts desc (Just lib) Nothing Nothing, _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -709,7 +709,7 @@ createProjectTest pkgIx srcDb = "y" ] - case (_runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of + case (runPrompt $ createProject silent pkgIx srcDb emptyFlags) inputs of Right (ProjectSettings opts desc Nothing (Just exe) Nothing, _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -809,7 +809,7 @@ fileCreatorTests pkgIx srcDb _pkgName = ] ] where - runGenTest inputs go = case _runPrompt go inputs of + runGenTest inputs go = case runPrompt go inputs of Left e -> assertFailure $ show e Right{} -> return () @@ -1030,6 +1030,20 @@ interactiveTests srcDb = , "Lang_TS!" ] ] + , testGroup + "Check languagePrompt session state" + [ testSimplePrompt + "Use last language" + ( \flags -> do + a <- languagePrompt flags "first language" + b <- languagePrompt flags "second language" + pure (a, b) + ) + (GHC2024, GHC2024) + [ "4" + , "" -- default + ] + ] , testGroup "Check srcDirsPrompt output" [ testNumberedPrompt @@ -1113,7 +1127,7 @@ testPrompt -> [String] -> TestTree testPrompt label f g h input = testCase label $ - case (_runPrompt $ f emptyFlags) (fromList input) of + case (runPrompt $ f emptyFlags) (fromList input) of Left x -> g x -- :: BreakException Right x -> h x -- :: (a, other inputs) diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Init/NonInteractive.hs b/cabal-install/tests/UnitTests/Distribution/Client/Init/NonInteractive.hs index d35ab35a659..711d50c8e3b 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Init/NonInteractive.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Init/NonInteractive.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE LambdaCase #-} module UnitTests.Distribution.Client.Init.NonInteractive @@ -12,7 +13,9 @@ import UnitTests.Distribution.Client.Init.Utils import qualified Data.List.NonEmpty as NEL import qualified Distribution.SPDX as SPDX +#if !MIN_VERSION_base(4,20,0) import Data.List (foldl') +#endif import qualified Data.Set as Set import Distribution.CabalSpecVersion import Distribution.Client.Init.Defaults @@ -90,7 +93,7 @@ driverFunctionTest pkgIx srcDb comp = , "[\"quxTest/Main.hs\"]" ] - case (_runPrompt $ createProject comp silent pkgIx srcDb dummyFlags') inputs of + case (runPrompt $ createProject comp silent pkgIx srcDb dummyFlags') inputs of Right (ProjectSettings opts desc (Just lib) (Just exe) (Just test), _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -177,7 +180,7 @@ driverFunctionTest pkgIx srcDb comp = "False" ] - case (_runPrompt $ createProject comp silent pkgIx srcDb dummyFlags') inputs of + case (runPrompt $ createProject comp silent pkgIx srcDb dummyFlags') inputs of Right (ProjectSettings opts desc (Just lib) (Just exe) (Just test), _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -353,7 +356,7 @@ driverFunctionTest pkgIx srcDb comp = , "[\"test/Main.hs\", \"test/Foo.hs\", \"test/bar.y\"]" ] - case ( _runPrompt $ + case ( runPrompt $ createProject comp silent @@ -505,7 +508,7 @@ driverFunctionTest pkgIx srcDb comp = , "[\"test/Main.hs\", \"test/Foo.hs\", \"test/bar.y\"]" ] - case ( _runPrompt $ + case ( runPrompt $ createProject comp silent @@ -661,7 +664,7 @@ driverFunctionTest pkgIx srcDb comp = , "[\"app/Main.hs\", \"src/Foo.hs\", \"src/bar.y\"]" ] - case (_runPrompt $ createProject comp silent pkgIx srcDb emptyFlags) inputs of + case (runPrompt $ createProject comp silent pkgIx srcDb emptyFlags) inputs of Right (ProjectSettings opts desc (Just lib) (Just exe) Nothing, _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -771,7 +774,7 @@ driverFunctionTest pkgIx srcDb comp = , "[\"app/Main.hs\", \"src/Foo.hs\", \"src/bar.y\"]" ] - case (_runPrompt $ createProject comp silent pkgIx srcDb emptyFlags) inputs of + case (runPrompt $ createProject comp silent pkgIx srcDb emptyFlags) inputs of Right (ProjectSettings opts desc (Just lib) Nothing Nothing, _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -862,7 +865,7 @@ driverFunctionTest pkgIx srcDb comp = , "[\"app/Main.hs\", \"src/Foo.hs\", \"src/bar.y\"]" ] - case (_runPrompt $ createProject comp silent pkgIx srcDb emptyFlags) inputs of + case (runPrompt $ createProject comp silent pkgIx srcDb emptyFlags) inputs of Right (ProjectSettings opts desc Nothing (Just exe) Nothing, _) -> do _optOverwrite opts @?= False _optMinimal opts @?= False @@ -928,7 +931,7 @@ fileCreatorTests pkgIx srcDb comp = , "[]" ] - case (_runPrompt $ genPkgDescription emptyFlags srcDb) inputs of + case (runPrompt $ genPkgDescription emptyFlags srcDb) inputs of Left e -> assertFailure $ show e Right{} -> return () ] @@ -977,7 +980,7 @@ fileCreatorTests pkgIx srcDb comp = , "[\"app/Main.hs\", \"src/Foo.hs\", \"src/bar.y\"]" ] - case (_runPrompt $ genLibTarget emptyFlags comp pkgIx defaultCabalVersion) inputs of + case (runPrompt $ genLibTarget emptyFlags comp pkgIx defaultCabalVersion) inputs of Left e -> assertFailure $ show e Right{} -> return () ] @@ -1018,7 +1021,7 @@ fileCreatorTests pkgIx srcDb comp = , "[\"app/Main.hs\", \"src/Foo.hs\", \"src/bar.y\"]" ] - case (_runPrompt $ genExeTarget emptyFlags comp pkgIx defaultCabalVersion) inputs of + case (runPrompt $ genExeTarget emptyFlags comp pkgIx defaultCabalVersion) inputs of Left e -> assertFailure $ show e Right{} -> return () ] @@ -1055,7 +1058,7 @@ fileCreatorTests pkgIx srcDb comp = ] flags = emptyFlags{initializeTestSuite = Flag True} - case (_runPrompt $ genTestTarget flags comp pkgIx defaultCabalVersion) inputs of + case (runPrompt $ genTestTarget flags comp pkgIx defaultCabalVersion) inputs of Left e -> assertFailure $ show e Right{} -> return () ] @@ -1400,7 +1403,7 @@ testGo -> [String] -> TestTree testGo label f g h inputs = testCase label $ - case (_runPrompt $ f emptyFlags) (NEL.fromList inputs) of + case (runPrompt $ f emptyFlags) (NEL.fromList inputs) of Left x -> g x Right x -> h x diff --git a/cabal-install/tests/UnitTests/Distribution/Client/Init/Simple.hs b/cabal-install/tests/UnitTests/Distribution/Client/Init/Simple.hs index 13a12ba0827..bbe3c0401bb 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/Init/Simple.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/Init/Simple.hs @@ -69,7 +69,7 @@ simpleCreateProjectTests v pkgIx srcDb pkgName = Nothing Nothing - case _runPrompt (createProject v pkgIx srcDb flags) inputs of + case runPrompt (createProject v pkgIx srcDb flags) inputs of Left e -> assertFailure $ "Failed to create simple lib project: " ++ show e Right (settings', _) -> settings @=? settings' , testCase "Simple lib createProject - with tests" $ do @@ -83,7 +83,7 @@ simpleCreateProjectTests v pkgIx srcDb pkgName = Nothing (Just $ simpleTestTarget (Just pkgName) baseDep) - case _runPrompt (createProject v pkgIx srcDb flags) inputs of + case runPrompt (createProject v pkgIx srcDb flags) inputs of Left e -> assertFailure $ "Failed to create simple lib (with tests)project: " ++ show e Right (settings', _) -> settings @=? settings' , testCase "Simple exe createProject" $ do @@ -97,7 +97,7 @@ simpleCreateProjectTests v pkgIx srcDb pkgName = (Just $ simpleExeTarget Nothing baseDep) Nothing - case _runPrompt (createProject v pkgIx srcDb flags) inputs of + case runPrompt (createProject v pkgIx srcDb flags) inputs of Left e -> assertFailure $ "Failed to create simple exe project: " ++ show e Right (settings', _) -> settings @=? settings' , testCase "Simple lib+exe createProject - no tests" $ do @@ -111,7 +111,7 @@ simpleCreateProjectTests v pkgIx srcDb pkgName = (Just $ simpleExeTarget (Just pkgName) baseDep) Nothing - case _runPrompt (createProject v pkgIx srcDb flags) inputs of + case runPrompt (createProject v pkgIx srcDb flags) inputs of Left e -> assertFailure $ "Failed to create simple lib+exe project: " ++ show e Right (settings', _) -> settings @=? settings' , testCase "Simple lib+exe createProject - with tests" $ do @@ -125,7 +125,7 @@ simpleCreateProjectTests v pkgIx srcDb pkgName = (Just $ simpleExeTarget (Just pkgName) baseDep) (Just $ simpleTestTarget (Just pkgName) baseDep) - case _runPrompt (createProject v pkgIx srcDb flags) inputs of + case runPrompt (createProject v pkgIx srcDb flags) inputs of Left e -> assertFailure $ "Failed to create simple lib+exe (with tests) project: " ++ show e Right (settings', _) -> settings @=? settings' , testCase "Simple standalone tests" $ do @@ -139,12 +139,12 @@ simpleCreateProjectTests v pkgIx srcDb pkgName = Nothing (Just $ simpleTestTarget Nothing baseDep) - case _runPrompt (createProject v pkgIx srcDb flags) inputs of + case runPrompt (createProject v pkgIx srcDb flags) inputs of Left e -> assertFailure $ "Failed to create simple standalone test project: " ++ show e Right (settings', _) -> settings @=? settings' ] where - baseDep = case _runPrompt (getBaseDep pkgIx emptyFlags) $ fromList [] of + baseDep = case runPrompt (getBaseDep pkgIx emptyFlags) $ fromList [] of Left e -> error $ show e Right a -> fst a diff --git a/cabal-install/tests/UnitTests/Distribution/Client/InstallPlan.hs b/cabal-install/tests/UnitTests/Distribution/Client/InstallPlan.hs index 39c719f2e1f..9db7109fbc6 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/InstallPlan.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/InstallPlan.hs @@ -316,9 +316,9 @@ renderDotGraph :: Graph -> String renderDotGraph graph = unlines ( [header - ,graphDefaultAtribs - ,nodeDefaultAtribs - ,edgeDefaultAtribs] + ,graphDefaultAttribs + ,nodeDefaultAttribs + ,edgeDefaultAttribs] ++ map renderNode (vertices graph) ++ map renderEdge (edges graph) ++ [footer] @@ -328,12 +328,12 @@ renderDotGraph graph = renderEdge (n, n') = "\t" ++ show n ++ " -> " ++ show n' ++ "[];" -header, footer, graphDefaultAtribs, nodeDefaultAtribs, edgeDefaultAtribs :: String +header, footer, graphDefaultAttribs, nodeDefaultAttribs, edgeDefaultAttribs :: String header = "digraph packages {" footer = "}" -graphDefaultAtribs = "\tgraph [fontsize=14, fontcolor=black, color=black];" -nodeDefaultAtribs = "\tnode [label=\"\\N\", width=\"0.75\", shape=ellipse];" -edgeDefaultAtribs = "\tedge [fontsize=10];" +graphDefaultAttribs = "\tgraph [fontsize=14, fontcolor=black, color=black];" +nodeDefaultAttribs = "\tnode [label=\"\\N\", width=\"0.75\", shape=ellipse];" +edgeDefaultAttribs = "\tedge [fontsize=10];" -} diff --git a/cabal-install/tests/UnitTests/Distribution/Client/JobControl.hs b/cabal-install/tests/UnitTests/Distribution/Client/JobControl.hs index 73769f91b18..068037a1706 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/JobControl.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/JobControl.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} - module UnitTests.Distribution.Client.JobControl (tests) where import Distribution.Client.JobControl @@ -178,7 +176,7 @@ prop_cancel_parallel (Positive (Small maxJobLimit)) xs ys = do return $ Set.fromList (xs' ++ ys') `Set.isSubsetOf` Set.fromList (xs ++ ys) data TestException = TestException Int - deriving (Typeable, Show) + deriving (Show) instance Exception TestException diff --git a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs index abdc1e79390..1996dab1a1d 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/ProjectConfig.hs @@ -10,10 +10,6 @@ module UnitTests.Distribution.Client.ProjectConfig (tests) where -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -import Control.Applicative -#endif import Control.Monad import Data.Either (isRight) import Data.Foldable (for_) @@ -102,6 +98,7 @@ tests = , testProperty "specific" prop_roundtrip_printparse_specific , testProperty "all" prop_roundtrip_printparse_all ] + , testGetProjectRootUsability , testFindProjectRoot ] where @@ -110,6 +107,31 @@ tests = CompilerId GHC v -> v < mkVersion [7, 7] _ -> False +testGetProjectRootUsability :: TestTree +testGetProjectRootUsability = + testGroup + "getProjectRootUsability" + [ test "relative path" file ProjectRootUsabilityPresentAndUsable + , test "absolute path" absFile ProjectRootUsabilityPresentAndUsable + , test "symbolic link" fileSymlink ProjectRootUsabilityPresentAndUsable + , test "file not present" fileNotPresent ProjectRootUsabilityNotPresent + , test "directory" brokenDirCabalProject ProjectRootUsabilityPresentAndUnusable + , test "broken symbolic link" fileSymlinkBroken ProjectRootUsabilityPresentAndUnusable + ] + where + dir = fixturesDir "project-root" + file = defaultProjectFile + absFile = dir file + fileNotPresent = file <.> "not-present" + fileSymlink = file <.> "symlink" + fileSymlinkBroken = fileSymlink <.> "broken" + brokenDirCabalProject = "cabal" <.> "project" <.> "dir" <.> "broken" + test name fileName expectedState = + testCase name $ + withCurrentDirectory dir $ + getProjectRootUsability fileName + >>= (@?= expectedState) + testFindProjectRoot :: TestTree testFindProjectRoot = testGroup @@ -120,6 +142,10 @@ testFindProjectRoot = , test "explicit file in lib" (cd libDir) Nothing (Just file) (succeeds dir file) , test "other file" (cd dir) Nothing (Just fileOther) (succeeds dir fileOther) , test "other file in lib" (cd libDir) Nothing (Just fileOther) (succeeds dir fileOther) + , test "symbolic link" (cd dir) Nothing (Just fileSymlink) (succeeds dir fileSymlink) + , test "symbolic link in lib" (cd libDir) Nothing (Just fileSymlink) (succeeds dir fileSymlink) + , test "broken symbolic link" (cd dir) Nothing (Just fileSymlinkBroken) (failsWith $ BadProjectRootFileBroken fileSymlinkBroken) + , test "broken symbolic link in lib" (cd libDir) Nothing (Just fileSymlinkBroken) (failsWith $ BadProjectRootFileBroken fileSymlinkBroken) , -- Deprecated use-case test "absolute file" Nothing Nothing (Just absFile) (succeeds dir file) , test "nested file" (cd dir) Nothing (Just nixFile) (succeeds dir nixFile) @@ -141,6 +167,9 @@ testFindProjectRoot = nixFile = "nix" file nixOther = nixFile <.> "other" + fileSymlink = file <.> "symlink" + fileSymlinkBroken = fileSymlink <.> "broken" + missing path = Just (path <.> "does_not_exist") test name wrap projectDir projectFile validate = @@ -169,6 +198,18 @@ testFindProjectRoot = Left _ -> pure () Right x -> assertFailure $ "Expected an error, but found " <> show x + failsWith expectedError result = case result of + Left actualError -> + if actualError == expectedError + then pure () + else + assertFailure $ + "Expected an error " + <> show expectedError + <> ", but found " + <> show actualError + Right x -> assertFailure $ "Expected an error, but found " <> show x + fixturesDir :: FilePath fixturesDir = unsafePerformIO $ @@ -683,6 +724,7 @@ instance Arbitrary PackageConfig where <*> arbitrary <*> arbitrary <*> arbitrary + <*> arbitrary <*> shortListOf 5 arbitraryShortToken <*> arbitrary <*> arbitrary @@ -726,6 +768,7 @@ instance Arbitrary PackageConfig where <*> arbitrary <*> arbitrary <*> arbitrary + <*> arbitrary <*> arbitraryFlag arbitraryShortToken <*> arbitrary <*> shortListOf 5 arbitrary @@ -751,6 +794,7 @@ instance Arbitrary PackageConfig where , packageConfigFullyStaticExe = x50 , packageConfigProf = x07 , packageConfigProfLib = x08 + , packageConfigProfShared = x08_1 , packageConfigProfExe = x09 , packageConfigProfDetail = x10 , packageConfigProfLibDetail = x11 @@ -791,8 +835,9 @@ instance Arbitrary PackageConfig where , packageConfigHaddockForHackage = x41 , packageConfigHaddockIndex = x54 , packageConfigHaddockBaseUrl = x55 - , packageConfigHaddockLib = x56 + , packageConfigHaddockResourcesDir = x56 , packageConfigHaddockOutputDir = x57 + , packageConfigHaddockUseUnicode = x58 , packageConfigTestHumanLog = x44 , packageConfigTestMachineLog = x45 , packageConfigTestShowDetails = x46 @@ -814,6 +859,7 @@ instance Arbitrary PackageConfig where , packageConfigFullyStaticExe = x50' , packageConfigProf = x07' , packageConfigProfLib = x08' + , packageConfigProfShared = x08_1' , packageConfigProfExe = x09' , packageConfigProfDetail = x10' , packageConfigProfLibDetail = x11' @@ -854,8 +900,9 @@ instance Arbitrary PackageConfig where , packageConfigHaddockForHackage = x41' , packageConfigHaddockIndex = x54' , packageConfigHaddockBaseUrl = x55' - , packageConfigHaddockLib = x56' + , packageConfigHaddockResourcesDir = x56' , packageConfigHaddockOutputDir = x57' + , packageConfigHaddockUseUnicode = x58' , packageConfigTestHumanLog = x44' , packageConfigTestMachineLog = x45' , packageConfigTestShowDetails = x46' @@ -866,7 +913,7 @@ instance Arbitrary PackageConfig where , packageConfigBenchmarkOptions = x52' } | ( ( (x00', x01', x02', x03', x04') - , (x05', x42', x06', x50', x07', x08', x09') + , (x05', x42', x06', x50', x07', x08', x08_1', x09') , (x10', x11', x12', x13', x14') , (x15', x16', x53', x17', x18', x19') ) @@ -878,12 +925,13 @@ instance Arbitrary PackageConfig where , (x44', x45', x46', x47', x48', x49', x51', x52', x54', x55') , x56' , x57' + , x58' ) ) <- shrink ( ( (preShrink_Paths x00, preShrink_Args x01, x02, x03, x04) - , (x05, x42, x06, x50, x07, x08, x09) + , (x05, x42, x06, x50, x07, x08, x08_1, x09) , (x10, x11, map NonEmpty x12, x13, x14) , ( x15 @@ -903,6 +951,7 @@ instance Arbitrary PackageConfig where , (x44, x45, x46, x47, x48, x49, x51, x52, x54, x55) , x56 , x57 + , x58 ) ) ] diff --git a/cabal-install/tests/UnitTests/Distribution/Client/TreeDiffInstances.hs b/cabal-install/tests/UnitTests/Distribution/Client/TreeDiffInstances.hs index 0dede72858a..da9bd8ad90d 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/TreeDiffInstances.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/TreeDiffInstances.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE UndecidableInstances #-} {-# OPTIONS_GHC -fno-warn-orphans #-} @@ -21,7 +22,7 @@ import Distribution.Client.Types import Distribution.Client.Types.OverwritePolicy (OverwritePolicy) import Distribution.Client.Types.SourceRepo (SourceRepositoryPackage) -import Distribution.Simple.Compiler (PackageDB) +import Distribution.Simple.Compiler (PackageDBX) import Data.TreeDiff.Class import Data.TreeDiff.Instances.Cabal () @@ -54,7 +55,7 @@ instance ToExpr OptionalStanza instance ToExpr Outcome instance ToExpr OverwritePolicy instance ToExpr PackageConfig -instance ToExpr PackageDB +instance ToExpr (PackageDBX FilePath) instance ToExpr PackageProperty instance ToExpr PreferOldest instance ToExpr PreSolver diff --git a/cabal-install/tests/UnitTests/Distribution/Client/UserConfig.hs b/cabal-install/tests/UnitTests/Distribution/Client/UserConfig.hs index 17adc1b75b4..91ed61c86cd 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/UserConfig.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/UserConfig.hs @@ -7,9 +7,6 @@ module UnitTests.Distribution.Client.UserConfig import Control.Exception (bracket) import Control.Monad (replicateM_) import Data.List (nub, sort) -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -#endif import System.Directory ( doesFileExist , getCurrentDirectory diff --git a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs index 0bd49355913..4f7ff569a5d 100644 --- a/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs +++ b/cabal-install/tests/UnitTests/Distribution/Client/VCS.hs @@ -56,6 +56,12 @@ import UnitTests.Distribution.Client.ArbitraryInstances tests :: MTimeChange -> [TestTree] tests mtimeChange = map + -- Are you tuning performance for these tests? The size of the arbitrary + -- instances involved is very significant, because each element generated + -- corresponds to one or more Git subcommands being run. + -- + -- See [Tuning Arbitrary Instances] below for more information and + -- parameters. (localOption $ QuickCheckTests 10) [ ignoreInWindows "See issue #8048 and #9519" $ testGroup @@ -216,22 +222,27 @@ prop_syncRepos_hg destRepoDirs syncTargetSetIterations seed = testSetup :: VCS Program - -> ( Verbosity - -> VCS ConfiguredProgram - -> FilePath - -> FilePath - -> VCSTestDriver - ) + -> (MkVCSTestDriver -> VCSTestDriver) -> RepoRecipe submodules -> (VCSTestDriver -> FilePath -> RepoState -> IO a) -> IO a testSetup vcs mkVCSTestDriver repoRecipe theTest = do - -- test setup - vcs' <- configureVCS verbosity [] vcs withTestDir verbosity "vcstest" $ \tmpdir -> do + -- test setup + vcs' <- configureVCS verbosity [] vcs + let srcRepoPath = tmpdir "src" submodulesPath = tmpdir "submodules" - vcsDriver = mkVCSTestDriver verbosity vcs' submodulesPath srcRepoPath + vcsDriver = + mkVCSTestDriver + MkVCSTestDriver + { mkVcsVerbosity = verbosity + , mkVcsVcs = vcs' + , mkVcsSubmoduleDir = submodulesPath + , mkVcsRepoRoot = srcRepoPath + , mkVcsTmpDir = tmpdir + } + repoState <- createRepo vcsDriver repoRecipe -- actual test @@ -252,12 +263,7 @@ testSetup vcs mkVCSTestDriver repoRecipe theTest = do -- the working state is the same as the pure representation. prop_framework :: VCS Program - -> ( Verbosity - -> VCS ConfiguredProgram - -> FilePath - -> FilePath - -> VCSTestDriver - ) + -> (MkVCSTestDriver -> VCSTestDriver) -> RepoRecipe submodules -> IO () prop_framework vcs mkVCSTestDriver repoRecipe = @@ -288,12 +294,7 @@ prop_framework vcs mkVCSTestDriver repoRecipe = prop_cloneRepo :: VCS Program - -> ( Verbosity - -> VCS ConfiguredProgram - -> FilePath - -> FilePath - -> VCSTestDriver - ) + -> (MkVCSTestDriver -> VCSTestDriver) -> RepoRecipe submodules -> IO () prop_cloneRepo vcs mkVCSTestDriver repoRecipe = @@ -329,12 +330,7 @@ newtype PrngSeed = PrngSeed Int deriving (Show) prop_syncRepos :: VCS Program - -> ( Verbosity - -> VCS ConfiguredProgram - -> FilePath - -> FilePath - -> VCSTestDriver - ) + -> (MkVCSTestDriver -> VCSTestDriver) -> RepoDirSet -> SyncTargetIterations -> PrngSeed @@ -482,6 +478,7 @@ instance Arbitrary PrngSeed where -- VCS commands to make a repository on-disk. data SubmodulesSupport = SubmodulesSupported | SubmodulesNotSupported + deriving (Show, Eq) class KnownSubmodulesSupport (a :: SubmodulesSupport) where submoduleSupport :: SubmodulesSupport @@ -494,7 +491,11 @@ instance KnownSubmodulesSupport 'SubmodulesNotSupported where data FileUpdate = FileUpdate FilePath String deriving (Show) -data SubmoduleAdd = SubmoduleAdd FilePath FilePath (Commit 'SubmodulesSupported) +data SubmoduleAdd = SubmoduleAdd + { submodulePath :: FilePath + , submoduleSource :: FilePath + , submoduleCommit :: Commit 'SubmodulesSupported + } deriving (Show) newtype Commit (submodules :: SubmodulesSupport) @@ -535,40 +536,71 @@ data RepoRecipe submodules genFileName :: Gen FilePath genFileName = (\c -> "file" [c]) <$> choose ('A', 'E') +-- [Tuning Arbitrary Instances] +-- +-- Arbitrary repo recipes can get quite large due to nesting: +-- +-- - `RepoRecipes` contain a number of groups (`TaggedCommits` or `BranchCommits`). +-- - Groups contain a number of `Commit`s. +-- - Commits contain a number of operations (`FileUpdate` or `SubmoduleAdd`). +-- +-- There's also another wrinkle in that `SubmoduleAdd`s contain a `Commit` +-- themselves, so square the `operationsPerCommit` number! +-- +-- Then, a rough upper bound of the number of `git` calls required for an +-- arbitrary `RepoRecipe` is +-- `groupsPerRecipe * commitsPerGroup * operationsPerCommit^2`. +-- +-- The original implementation of these instances, which chose +-- reasonable-sounding size parameters of 5-15, led to a maximum of 1875 +-- operations per test case! No wonder they took so long! +-- +-- In most cases, we only care about one or many operations, so "two" is a fine +-- stand-in for "many" :) +groupsPerRecipe :: Int +groupsPerRecipe = 3 + +commitsPerGroup :: Int +commitsPerGroup = 3 + +operationsPerCommit :: Int +operationsPerCommit = 3 + instance Arbitrary FileUpdate where - arbitrary = genOnlyFileUpdate + arbitrary = FileUpdate <$> genFileName <*> genFileContent where - genOnlyFileUpdate = FileUpdate <$> genFileName <*> genFileContent genFileContent = vectorOf 10 (choose ('#', '~')) instance Arbitrary SubmoduleAdd where - arbitrary = genOnlySubmoduleAdd + arbitrary = SubmoduleAdd <$> genFileName <*> genSubmoduleSrc <*> arbitrary where - genOnlySubmoduleAdd = SubmoduleAdd <$> genFileName <*> genSubmoduleSrc <*> arbitrary genSubmoduleSrc = vectorOf 20 (choose ('a', 'z')) instance forall submodules. KnownSubmodulesSupport submodules => Arbitrary (Commit submodules) where - arbitrary = Commit <$> shortListOf1 5 fileUpdateOrSubmoduleAdd + arbitrary = Commit <$> shortListOf1 operationsPerCommit (sized fileUpdateOrSubmoduleAdd) where - fileUpdateOrSubmoduleAdd = + fileUpdateOrSubmoduleAdd 0 = Left <$> arbitrary + fileUpdateOrSubmoduleAdd size = case submoduleSupport @submodules of SubmodulesSupported -> frequency [ (10, Left <$> arbitrary) - , (1, Right <$> arbitrary) + , -- A `SubmoduleAdd` contains a `Commit`, so we make sure to scale + -- down the size in the recursive call to avoid unbounded nesting. + (1, Right <$> resize (size `div` 2) arbitrary) ] SubmodulesNotSupported -> Left <$> arbitrary shrink (Commit writes) = Commit <$> filter (not . null) (shrink writes) instance KnownSubmodulesSupport submodules => Arbitrary (TaggedCommits submodules) where - arbitrary = TaggedCommits <$> genTagName <*> shortListOf1 5 arbitrary + arbitrary = TaggedCommits <$> genTagName <*> shortListOf1 commitsPerGroup arbitrary where genTagName = ("tag_" ++) <$> shortListOf1 5 (choose ('A', 'Z')) shrink (TaggedCommits tag commits) = TaggedCommits tag <$> filter (not . null) (shrink commits) instance KnownSubmodulesSupport submodules => Arbitrary (BranchCommits submodules) where - arbitrary = BranchCommits <$> genBranchName <*> shortListOf1 5 arbitrary + arbitrary = BranchCommits <$> genBranchName <*> shortListOf1 commitsPerGroup arbitrary where genBranchName = sized $ \n -> @@ -578,12 +610,12 @@ instance KnownSubmodulesSupport submodules => Arbitrary (BranchCommits submodule BranchCommits branch <$> filter (not . null) (shrink commits) instance KnownSubmodulesSupport submodules => Arbitrary (NonBranchingRepoRecipe submodules) where - arbitrary = NonBranchingRepoRecipe <$> shortListOf1 15 arbitrary + arbitrary = NonBranchingRepoRecipe <$> shortListOf1 groupsPerRecipe arbitrary shrink (NonBranchingRepoRecipe xs) = NonBranchingRepoRecipe <$> filter (not . null) (shrink xs) instance KnownSubmodulesSupport submodules => Arbitrary (BranchingRepoRecipe submodules) where - arbitrary = BranchingRepoRecipe <$> shortListOf1 15 taggedOrBranch + arbitrary = BranchingRepoRecipe <$> shortListOf1 groupsPerRecipe taggedOrBranch where taggedOrBranch = frequency @@ -839,219 +871,282 @@ data VCSTestDriver = VCSTestDriver (TagName -> FilePath -> IO ()) } +data MkVCSTestDriver = MkVCSTestDriver + { mkVcsVerbosity :: Verbosity + , mkVcsVcs :: VCS ConfiguredProgram + , mkVcsSubmoduleDir :: FilePath + , mkVcsRepoRoot :: FilePath + , mkVcsTmpDir :: FilePath + } + +vcsTestDriverGit :: MkVCSTestDriver -> VCSTestDriver vcsTestDriverGit - :: Verbosity - -> VCS ConfiguredProgram - -> FilePath - -> FilePath - -> VCSTestDriver -vcsTestDriverGit verbosity vcs submoduleDir repoRoot = - VCSTestDriver - { vcsVCS = vcs - , vcsRepoRoot = repoRoot - , vcsIgnoreFiles = Set.empty - , vcsInit = - git $ ["init"] ++ verboseArg - , vcsAddFile = \_ filename -> - git ["add", filename] - , vcsCommitChanges = \_state -> do - git $ - [ "-c" - , "user.name=A" - , "-c" - , "user.email=a@example.com" - , "commit" - , "--all" - , "--message=a patch" - , "--author=A " + MkVCSTestDriver + { mkVcsVerbosity = verbosity + , mkVcsVcs = vcs + , mkVcsSubmoduleDir = submoduleDir + , mkVcsRepoRoot = repoRoot + , mkVcsTmpDir = tmpDir + } = + VCSTestDriver + { vcsVCS = vcs' + , vcsRepoRoot = repoRoot + , vcsIgnoreFiles = Set.empty + , vcsInit = do + createDirectoryIfMissing True home + gitconfigExists <- doesFileExist gitconfigPath + unless gitconfigExists $ do + writeFile gitconfigPath gitconfig + gitQuiet ["init"] + , vcsAddFile = \_ filename -> + git ["add", filename] + , vcsCommitChanges = \_state -> do + gitQuiet + [ "commit" + , "--all" + , "--message=a patch" + ] + commit <- git' ["rev-parse", "HEAD"] + let commit' = takeWhile (not . isSpace) commit + return (Just commit') + , vcsTagState = \_ tagname -> + git ["tag", "--force", "--no-sign", tagname] + , vcsSubmoduleDriver = + \newPath -> + pure $ + vcsTestDriverGit + MkVCSTestDriver + { mkVcsVerbosity = verbosity + , mkVcsVcs = vcs' + , mkVcsSubmoduleDir = submoduleDir + , mkVcsRepoRoot = submoduleDir newPath + , mkVcsTmpDir = tmpDir + } + , vcsAddSubmodule = \_ source dest -> do + destExists <- doesPathExist $ repoRoot dest + when destExists $ gitQuiet ["rm", "--force", dest] + -- If there is an old submodule git dir with the same name, remove it. + -- It most likely has a different URL and `git submodule add` will fai. + submoduleGitDirExists <- doesDirectoryExist $ submoduleGitDir dest + when submoduleGitDirExists $ removeDirectoryRecursive (submoduleGitDir dest) + gitQuiet ["submodule", "add", source, dest] + gitQuiet ["submodule", "update", "--init", "--recursive", "--force"] + , vcsSwitchBranch = \RepoState{allBranches} branchname -> do + deinitAndRemoveCachedSubmodules + unless (branchname `Map.member` allBranches) $ + gitQuiet ["branch", branchname] + gitQuiet ["checkout", branchname] + updateSubmodulesAndCleanup + , vcsCheckoutTag = Left $ \tagname -> do + deinitAndRemoveCachedSubmodules + gitQuiet ["checkout", "--detach", "--force", tagname] + updateSubmodulesAndCleanup + } + where + home = tmpDir "home" + gitconfigPath = home ".gitconfig" + -- Git 2.38.1 and newer fails to clone from local paths with `fatal: transport 'file' + -- not allowed` unless `protocol.file.allow=always` is set. + -- + -- This is not safe in general, but it's fine in the test suite. + -- + -- See: https://github.blog/open-source/git/git-security-vulnerabilities-announced/#fn-67904-1 + -- See: https://git-scm.com/docs/git-config#Documentation/git-config.txt-protocolallow + gitconfig = + unlines + [ "[protocol.file]" + , " allow = always" + , "[user]" + , " name = Puppy Doggy" + , " email = puppy.doggy@example.com" ] - ++ verboseArg - commit <- git' ["log", "--format=%H", "-1"] - let commit' = takeWhile (not . isSpace) commit - return (Just commit') - , vcsTagState = \_ tagname -> - git ["tag", "--force", "--no-sign", tagname] - , vcsSubmoduleDriver = - pure . vcsTestDriverGit verbosity vcs submoduleDir . (submoduleDir ) - , vcsAddSubmodule = \_ source dest -> do - destExists <- - (||) - <$> doesFileExist (repoRoot dest) - <*> doesDirectoryExist (repoRoot dest) - when destExists $ git ["rm", "-f", dest] - -- If there is an old submodule git dir with the same name, remove it. - -- It most likely has a different URL and `git submodule add` will fai. - submoduleGitDirExists <- doesDirectoryExist $ submoduleGitDir dest - when submoduleGitDirExists $ removeDirectoryRecursive (submoduleGitDir dest) - git ["submodule", "add", source, dest] - git ["submodule", "update", "--init", "--recursive", "--force"] - , vcsSwitchBranch = \RepoState{allBranches} branchname -> do - deinitAndRemoveCachedSubmodules - unless (branchname `Map.member` allBranches) $ - git ["branch", branchname] - git $ ["checkout", branchname] ++ verboseArg - updateSubmodulesAndCleanup - , vcsCheckoutTag = Left $ \tagname -> do - deinitAndRemoveCachedSubmodules - git $ ["checkout", "--detach", "--force", tagname] ++ verboseArg - updateSubmodulesAndCleanup - } - where - gitInvocation args = - (programInvocation (vcsProgram vcs) args) - { progInvokeCwd = Just repoRoot - } - git = runProgramInvocation verbosity . gitInvocation - git' = getProgramInvocationOutput verbosity . gitInvocation - verboseArg = ["--quiet" | verbosity < Verbosity.normal] - submoduleGitDir path = repoRoot ".git" "modules" path - deinitAndRemoveCachedSubmodules = do - git $ ["submodule", "deinit", "--force", "--all"] ++ verboseArg - let gitModulesDir = repoRoot ".git" "modules" - gitModulesExists <- doesDirectoryExist gitModulesDir - when gitModulesExists $ removeDirectoryRecursive gitModulesDir - updateSubmodulesAndCleanup = do - git $ ["submodule", "sync", "--recursive"] ++ verboseArg - git $ ["submodule", "update", "--init", "--recursive", "--force"] ++ verboseArg - git $ ["submodule", "foreach", "--recursive"] ++ verboseArg ++ ["git clean -ffxdq"] - git $ ["clean", "-ffxdq"] ++ verboseArg + + vcs' = + vcs + { vcsProgram = + (vcsProgram vcs) + { programOverrideEnv = + programOverrideEnv (vcsProgram vcs) + ++ [ -- > Whether to skip reading settings from the system-wide $(prefix)/etc/gitconfig file. + ("GIT_CONFIG_NOSYSTEM", Just "1") + , ("GIT_CONFIG_GLOBAL", Just gitconfigPath) + , -- Setting the author and committer dates makes commit hashes deterministic between test runs. + ("GIT_AUTHOR_DATE", Just "1998-04-30T18:25:03-0400") + , ("GIT_COMMITTER_DATE", Just "1998-04-30T18:25:00-0400") + , ("HOME", Just home) + ] + } + } + + gitInvocation args = + (programInvocation (vcsProgram vcs') args) + { progInvokeCwd = Just repoRoot + } + + git = runProgramInvocation verbosity . gitInvocation + git' = getProgramInvocationOutput verbosity . gitInvocation + + gitQuiet [] = git [] + gitQuiet (cmd : args) = git (cmd : verboseArg ++ args) + + verboseArg = ["--quiet" | verbosity < Verbosity.normal] + + submoduleGitDir path = repoRoot ".git" "modules" path + + dotGitModulesPath = repoRoot ".git" "modules" + gitModulesPath = repoRoot ".gitmodules" + + deinitAndRemoveCachedSubmodules = do + dotGitModulesExists <- doesDirectoryExist dotGitModulesPath + when dotGitModulesExists $ do + git $ ["submodule", "deinit", "--force", "--all"] ++ verboseArg + removeDirectoryRecursive dotGitModulesPath + + updateSubmodulesAndCleanup = do + gitModulesExists <- doesFileExist gitModulesPath + when gitModulesExists $ do + gitQuiet ["submodule", "sync", "--recursive"] + gitQuiet ["submodule", "update", "--init", "--recursive", "--force"] + -- Note: We need to manually add `verboseArg` here so that the embedded `git clean` command includes it as well. + gitQuiet $ ["submodule", "foreach", "--recursive", "git clean -ffxdq"] ++ verboseArg + gitQuiet ["clean", "-ffxdq"] type MTimeChange = Int +vcsTestDriverDarcs :: MTimeChange -> MkVCSTestDriver -> VCSTestDriver vcsTestDriverDarcs - :: MTimeChange - -> Verbosity - -> VCS ConfiguredProgram - -> FilePath - -> FilePath - -> VCSTestDriver -vcsTestDriverDarcs mtimeChange verbosity vcs _ repoRoot = - VCSTestDriver - { vcsVCS = vcs - , vcsRepoRoot = repoRoot - , vcsIgnoreFiles = Set.singleton "_darcs" - , vcsInit = - darcs ["initialize"] - , vcsAddFile = \state filename -> do - threadDelay mtimeChange - unless (filename `Map.member` currentWorking state) $ - darcs ["add", filename] - , -- Darcs's file change tracking relies on mtime changes, - -- so we have to be careful with doing stuff too quickly: - - vcsSubmoduleDriver = \_ -> - fail "vcsSubmoduleDriver: darcs does not support submodules" - , vcsAddSubmodule = \_ _ _ -> - fail "vcsAddSubmodule: darcs does not support submodules" - , vcsCommitChanges = \_state -> do - threadDelay mtimeChange - darcs ["record", "--all", "--author=author", "--name=a patch"] - return Nothing - , vcsTagState = \_ tagname -> - darcs ["tag", "--author=author", tagname] - , vcsSwitchBranch = \_ _ -> - fail "vcsSwitchBranch: darcs does not support branches within a repo" - , vcsCheckoutTag = Right $ \tagname dest -> - darcs ["clone", "--lazy", "--tag=^" ++ tagname ++ "$", ".", dest] - } - where - darcsInvocation args = - (programInvocation (vcsProgram vcs) args) - { progInvokeCwd = Just repoRoot - } - darcs = runProgramInvocation verbosity . darcsInvocation + mtimeChange + MkVCSTestDriver + { mkVcsVerbosity = verbosity + , mkVcsVcs = vcs + , mkVcsRepoRoot = repoRoot + } = + VCSTestDriver + { vcsVCS = vcs + , vcsRepoRoot = repoRoot + , vcsIgnoreFiles = Set.singleton "_darcs" + , vcsInit = + darcs ["initialize"] + , vcsAddFile = \state filename -> do + threadDelay mtimeChange + unless (filename `Map.member` currentWorking state) $ + darcs ["add", filename] + , -- Darcs's file change tracking relies on mtime changes, + -- so we have to be careful with doing stuff too quickly: + + vcsSubmoduleDriver = \_ -> + fail "vcsSubmoduleDriver: darcs does not support submodules" + , vcsAddSubmodule = \_ _ _ -> + fail "vcsAddSubmodule: darcs does not support submodules" + , vcsCommitChanges = \_state -> do + threadDelay mtimeChange + darcs ["record", "--all", "--author=author", "--name=a patch"] + return Nothing + , vcsTagState = \_ tagname -> + darcs ["tag", "--author=author", tagname] + , vcsSwitchBranch = \_ _ -> + fail "vcsSwitchBranch: darcs does not support branches within a repo" + , vcsCheckoutTag = Right $ \tagname dest -> + darcs ["clone", "--lazy", "--tag=^" ++ tagname ++ "$", ".", dest] + } + where + darcsInvocation args = + (programInvocation (vcsProgram vcs) args) + { progInvokeCwd = Just repoRoot + } + darcs = runProgramInvocation verbosity . darcsInvocation +vcsTestDriverPijul :: MkVCSTestDriver -> VCSTestDriver vcsTestDriverPijul - :: Verbosity - -> VCS ConfiguredProgram - -> FilePath - -> FilePath - -> VCSTestDriver -vcsTestDriverPijul verbosity vcs _ repoRoot = - VCSTestDriver - { vcsVCS = vcs - , vcsRepoRoot = repoRoot - , vcsIgnoreFiles = Set.empty - , vcsInit = - pijul $ ["init"] - , vcsAddFile = \_ filename -> - pijul ["add", filename] - , vcsSubmoduleDriver = \_ -> - fail "vcsSubmoduleDriver: pijul does not support submodules" - , vcsAddSubmodule = \_ _ _ -> - fail "vcsAddSubmodule: pijul does not support submodules" - , vcsCommitChanges = \_state -> do - pijul $ - [ "record" - , "-a" - , "-m 'a patch'" - , "-A 'A '" - ] - commit <- pijul' ["log"] - let commit' = takeWhile (not . isSpace) commit - return (Just commit') - , -- tags work differently in pijul... - -- so this is wrong - vcsTagState = \_ tagname -> - pijul ["tag", tagname] - , vcsSwitchBranch = \_ branchname -> do - -- unless (branchname `Map.member` allBranches) $ - -- pijul ["from-branch", branchname] - pijul $ ["checkout", branchname] - , vcsCheckoutTag = Left $ \tagname -> - pijul $ ["checkout", tagname] - } - where - gitInvocation args = - (programInvocation (vcsProgram vcs) args) - { progInvokeCwd = Just repoRoot - } - pijul = runProgramInvocation verbosity . gitInvocation - pijul' = getProgramInvocationOutput verbosity . gitInvocation - + MkVCSTestDriver + { mkVcsVerbosity = verbosity + , mkVcsVcs = vcs + , mkVcsRepoRoot = repoRoot + } = + VCSTestDriver + { vcsVCS = vcs + , vcsRepoRoot = repoRoot + , vcsIgnoreFiles = Set.empty + , vcsInit = + pijul $ ["init"] + , vcsAddFile = \_ filename -> + pijul ["add", filename] + , vcsSubmoduleDriver = \_ -> + fail "vcsSubmoduleDriver: pijul does not support submodules" + , vcsAddSubmodule = \_ _ _ -> + fail "vcsAddSubmodule: pijul does not support submodules" + , vcsCommitChanges = \_state -> do + pijul $ + [ "record" + , "-a" + , "-m 'a patch'" + , "-A 'A '" + ] + commit <- pijul' ["log"] + let commit' = takeWhile (not . isSpace) commit + return (Just commit') + , -- tags work differently in pijul... + -- so this is wrong + vcsTagState = \_ tagname -> + pijul ["tag", tagname] + , vcsSwitchBranch = \_ branchname -> do + -- unless (branchname `Map.member` allBranches) $ + -- pijul ["from-branch", branchname] + pijul $ ["checkout", branchname] + , vcsCheckoutTag = Left $ \tagname -> + pijul $ ["checkout", tagname] + } + where + gitInvocation args = + (programInvocation (vcsProgram vcs) args) + { progInvokeCwd = Just repoRoot + } + pijul = runProgramInvocation verbosity . gitInvocation + pijul' = getProgramInvocationOutput verbosity . gitInvocation + +vcsTestDriverHg :: MkVCSTestDriver -> VCSTestDriver vcsTestDriverHg - :: Verbosity - -> VCS ConfiguredProgram - -> FilePath - -> FilePath - -> VCSTestDriver -vcsTestDriverHg verbosity vcs _ repoRoot = - VCSTestDriver - { vcsVCS = vcs - , vcsRepoRoot = repoRoot - , vcsIgnoreFiles = Set.empty - , vcsInit = - hg $ ["init"] ++ verboseArg - , vcsAddFile = \_ filename -> - hg ["add", filename] - , vcsSubmoduleDriver = \_ -> - fail "vcsSubmoduleDriver: hg submodules not supported" - , vcsAddSubmodule = \_ _ _ -> - fail "vcsAddSubmodule: hg submodules not supported" - , vcsCommitChanges = \_state -> do - hg $ - [ "--user='A '" - , "commit" - , "--message=a patch" - ] - ++ verboseArg - commit <- hg' ["log", "--template='{node}\\n' -l1"] - let commit' = takeWhile (not . isSpace) commit - return (Just commit') - , vcsTagState = \_ tagname -> - hg ["tag", "--force", tagname] - , vcsSwitchBranch = \RepoState{allBranches} branchname -> do - unless (branchname `Map.member` allBranches) $ - hg ["branch", branchname] - hg $ ["checkout", branchname] ++ verboseArg - , vcsCheckoutTag = Left $ \tagname -> - hg $ ["checkout", "--rev", tagname] ++ verboseArg - } - where - hgInvocation args = - (programInvocation (vcsProgram vcs) args) - { progInvokeCwd = Just repoRoot - } - hg = runProgramInvocation verbosity . hgInvocation - hg' = getProgramInvocationOutput verbosity . hgInvocation - verboseArg = ["--quiet" | verbosity < Verbosity.normal] + MkVCSTestDriver + { mkVcsVerbosity = verbosity + , mkVcsVcs = vcs + , mkVcsRepoRoot = repoRoot + } = + VCSTestDriver + { vcsVCS = vcs + , vcsRepoRoot = repoRoot + , vcsIgnoreFiles = Set.empty + , vcsInit = + hg $ ["init"] ++ verboseArg + , vcsAddFile = \_ filename -> + hg ["add", filename] + , vcsSubmoduleDriver = \_ -> + fail "vcsSubmoduleDriver: hg submodules not supported" + , vcsAddSubmodule = \_ _ _ -> + fail "vcsAddSubmodule: hg submodules not supported" + , vcsCommitChanges = \_state -> do + hg $ + [ "--user='A '" + , "commit" + , "--message=a patch" + ] + ++ verboseArg + commit <- hg' ["log", "--template='{node}\\n' -l1"] + let commit' = takeWhile (not . isSpace) commit + return (Just commit') + , vcsTagState = \_ tagname -> + hg ["tag", "--force", tagname] + , vcsSwitchBranch = \RepoState{allBranches} branchname -> do + unless (branchname `Map.member` allBranches) $ + hg ["branch", branchname] + hg $ ["checkout", branchname] ++ verboseArg + , vcsCheckoutTag = Left $ \tagname -> + hg $ ["checkout", "--rev", tagname] ++ verboseArg + } + where + hgInvocation args = + (programInvocation (vcsProgram vcs) args) + { progInvokeCwd = Just repoRoot + } + hg = runProgramInvocation verbosity . hgInvocation + hg' = getProgramInvocationOutput verbosity . hgInvocation + verboseArg = ["--quiet" | verbosity < Verbosity.normal] diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs index 991c5cafa0e..d1d70f59348 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL.hs @@ -1,6 +1,6 @@ +{-# LANGUAGE DisambiguateRecordFields #-} {-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE OverloadedStrings #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} -- | DSL for testing the modular solver @@ -783,7 +783,7 @@ exResolve -> Maybe [Extension] -- List of languages supported by the compiler, or Nothing if unknown. -> Maybe [Language] - -> PC.PkgConfigDb + -> Maybe PC.PkgConfigDb -> [ExamplePkgName] -> Maybe Int -> CountConflicts diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs index 91ec541f976..afd1419d30c 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/DSL/TestCaseUtils.hs @@ -130,7 +130,7 @@ data SolverTest = SolverTest , testDb :: ExampleDb , testSupportedExts :: Maybe [Extension] , testSupportedLangs :: Maybe [Language] - , testPkgConfigDb :: PkgConfigDb + , testPkgConfigDb :: Maybe PkgConfigDb , testEnableAllTests :: EnableAllTests } @@ -233,7 +233,7 @@ mkTestExtLangPC exts langs mPkgConfigDb db label targets result = , testDb = db , testSupportedExts = exts , testSupportedLangs = langs - , testPkgConfigDb = maybe NoPkgConfigDb pkgConfigDbFromList mPkgConfigDb + , testPkgConfigDb = pkgConfigDbFromList <$> mPkgConfigDb , testEnableAllTests = EnableAllTests False } diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs index 114db775f21..2b308d770ae 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck.hs @@ -10,7 +10,6 @@ import Prelude () import Control.Arrow ((&&&)) import Data.Either (lefts) -import Data.Hashable (Hashable (..)) import Data.List (groupBy, isInfixOf) import Text.Show.Pretty (parseValue, valToStr) @@ -20,7 +19,7 @@ import Test.QuickCheck.Instances.Cabal () import Test.Tasty (TestTree) import Distribution.Types.Flag (FlagName) -import Distribution.Utils.ShortText (ShortText) +import Distribution.Utils.ShortText (ShortText, fromShortText) import Distribution.Client.Setup (defaultMaxBackjumps) @@ -47,12 +46,26 @@ import Distribution.Version import UnitTests.Distribution.Solver.Modular.DSL import UnitTests.Distribution.Solver.Modular.QuickCheck.Utils - ( testPropertyWithSeed + ( ArbitraryOrd (..) + , testPropertyWithSeed ) tests :: [TestTree] tests = - [ -- This test checks that certain solver parameters do not affect the + [ testPropertyWithSeed "solver does not throw exceptions" $ + \test goalOrder reorderGoals indepGoals prefOldest -> + let r = + solve + (EnableBackjumping True) + (FineGrainedConflicts True) + reorderGoals + (CountConflicts True) + indepGoals + prefOldest + (getBlind <$> goalOrder) + test + in resultPlan r `seq` () + , -- This test checks that certain solver parameters do not affect the -- existence of a solution. It runs the solver twice, and only sets those -- parameters on the second run. The test also applies parameters that -- can affect the existence of a solution to both runs. @@ -210,6 +223,9 @@ newtype VarOrdering = VarOrdering { unVarOrdering :: Variable P.QPN -> Variable P.QPN -> Ordering } +instance Arbitrary VarOrdering where + arbitrary = VarOrdering <$> arbitraryCompare + solve :: EnableBackjumping -> FineGrainedConflicts @@ -227,7 +243,7 @@ solve enableBj fineGrainedConflicts reorder countConflicts indep prefOldest goal (unTestDb (testDb test)) Nothing Nothing - (pkgConfigDbFromList []) + (Just $ pkgConfigDbFromList []) (map unPN (testTargets test)) -- The backjump limit prevents individual tests from using -- too much time and memory. @@ -516,6 +532,11 @@ instance Arbitrary IndependentGoals where shrink (IndependentGoals indep) = [IndependentGoals False | indep] +instance Arbitrary PreferOldest where + arbitrary = PreferOldest <$> arbitrary + + shrink (PreferOldest prefOldest) = [PreferOldest False | prefOldest] + instance Arbitrary Component where arbitrary = oneof @@ -600,22 +621,18 @@ instance Arbitrary OptionalStanza where shrink BenchStanzas = [TestStanzas] shrink TestStanzas = [] --- Randomly sorts solver variables using 'hash'. --- TODO: Sorting goals with this function is very slow. -instance Arbitrary VarOrdering where - arbitrary = do - f <- arbitrary :: Gen (Int -> Int) - return $ VarOrdering (comparing (f . hash)) - -instance Hashable pn => Hashable (Variable pn) -instance Hashable a => Hashable (P.Qualified a) -instance Hashable P.PackagePath -instance Hashable P.Qualifier -instance Hashable P.Namespace -instance Hashable OptionalStanza -instance Hashable FlagName -instance Hashable PackageName -instance Hashable ShortText +instance ArbitraryOrd pn => ArbitraryOrd (Variable pn) +instance ArbitraryOrd a => ArbitraryOrd (P.Qualified a) +instance ArbitraryOrd P.PackagePath +instance ArbitraryOrd P.Qualifier +instance ArbitraryOrd P.Namespace +instance ArbitraryOrd OptionalStanza +instance ArbitraryOrd FlagName +instance ArbitraryOrd PackageName +instance ArbitraryOrd ShortText where + arbitraryCompare = do + strc <- arbitraryCompare + pure $ \l r -> strc (fromShortText l) (fromShortText r) deriving instance Generic (Variable pn) deriving instance Generic (P.Qualified a) diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck/Utils.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck/Utils.hs index 72283639cd9..24d61e1e72d 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck/Utils.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Modular/QuickCheck/Utils.hs @@ -1,10 +1,17 @@ +{-# LANGUAGE DefaultSignatures #-} +{-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE TypeOperators #-} + module UnitTests.Distribution.Solver.Modular.QuickCheck.Utils ( testPropertyWithSeed + , ArbitraryOrd (..) ) where import Data.Tagged (Tagged, retag) +import GHC.Generics import System.Random (getStdRandom, random) +import qualified Test.QuickCheck as QC import Test.Tasty (TestTree) import Test.Tasty.Options (OptionDescription, lookupOption, setOption) import Test.Tasty.Providers (IsTest (..), singleTest) @@ -31,7 +38,83 @@ instance IsTest QCWithSeed where run options (QCWithSeed test) progress = do replay <- case lookupOption options of - QuickCheckReplay (Just override) -> return override - QuickCheckReplay Nothing -> getStdRandom random + QuickCheckReplayLegacy override -> return override + _ -> getStdRandom random notice normal $ "Using --quickcheck-replay=" ++ show replay - run (setOption (QuickCheckReplay (Just replay)) options) test progress + run (setOption (QuickCheckReplayLegacy replay) options) test progress + +-- | Typeclass for doing arbitrary (but law-abiding) comparisons. See also +-- 'ArbitraryOrd', this is the version that works with 'GHC.Generics'. +class GArbitraryOrd f where + garbitraryCompare :: QC.Gen (f p -> f p -> Ordering) + +instance GArbitraryOrd V1 where + garbitraryCompare = pure $ \_ _ -> EQ + +instance GArbitraryOrd U1 where + garbitraryCompare = pure $ \_ _ -> EQ + +instance (GArbitraryOrd f, GArbitraryOrd g) => GArbitraryOrd (f :+: g) where + garbitraryCompare = do + bias <- QC.arbitrary + lcompare <- garbitraryCompare + rcompare <- garbitraryCompare + pure $ \l r -> + let args = if bias then (l, r) else (r, l) + in case args of + (L1 x, L1 y) -> lcompare x y + (L1 _, R1 _) -> LT + (R1 x, R1 y) -> rcompare x y + (R1 _, L1 _) -> GT + +instance (GArbitraryOrd f, GArbitraryOrd g) => GArbitraryOrd (f :*: g) where + garbitraryCompare = do + bias <- QC.arbitrary + xcompare <- garbitraryCompare + ycompare <- garbitraryCompare + pure $ \l r -> + let (x1 :*: y1, x2 :*: y2) = if bias then (l, r) else (r, l) + in case xcompare x1 x2 of + LT -> LT + EQ -> ycompare y1 y2 + GT -> GT + +instance GArbitraryOrd f => GArbitraryOrd (M1 i t f) where + garbitraryCompare = (\c (M1 l) (M1 r) -> c l r) <$> garbitraryCompare + +instance ArbitraryOrd c => GArbitraryOrd (K1 i c) where + garbitraryCompare = (\c (K1 l) (K1 r) -> c l r) <$> arbitraryCompare + +-- | Typeclass for doing arbitrary (but law-abiding) comparisons. +class ArbitraryOrd a where + arbitraryCompare :: QC.Gen (a -> a -> Ordering) + default arbitraryCompare + :: (Generic a, GArbitraryOrd (Rep a)) => QC.Gen (a -> a -> Ordering) + arbitraryCompare = (\c l r -> c (from l) (from r)) <$> garbitraryCompare + +instance ArbitraryOrd Char where + arbitraryCompare = arbitraryCompareReverseSection + +-- | Construct an arbitrary comparison by (conceptually) laying out all values +-- in a list, picking two values (since we are using arbitrary these should +-- be "good" values), and then reversing the section between these two values. +arbitraryCompareReverseSection + :: (QC.Arbitrary a, Ord a) => QC.Gen (a -> a -> Ordering) +arbitraryCompareReverseSection = do + x <- QC.arbitrary + y <- QC.arbitrary + let inside n = n >= min x y && n <= max x y + pure $ \l r -> if inside l && inside r then compare r l else compare l r + +instance ArbitraryOrd a => ArbitraryOrd [a] where + arbitraryCompare = do + shorterIsLess <- QC.arbitrary + cmp <- arbitraryCompare + let go [] [] = EQ + go [] (_ : _) = if shorterIsLess then LT else GT + go (_ : _) [] = if shorterIsLess then GT else LT + go (x : xs) (y : ys) = case cmp x y of + LT -> LT + EQ -> go xs ys + GT -> GT + pure go diff --git a/cabal-install/tests/UnitTests/Distribution/Solver/Types/OptionalStanza.hs b/cabal-install/tests/UnitTests/Distribution/Solver/Types/OptionalStanza.hs index 8f068d2ae53..3e2959b01f2 100644 --- a/cabal-install/tests/UnitTests/Distribution/Solver/Types/OptionalStanza.hs +++ b/cabal-install/tests/UnitTests/Distribution/Solver/Types/OptionalStanza.hs @@ -10,10 +10,6 @@ import UnitTests.Distribution.Client.ArbitraryInstances () import Test.Tasty import Test.Tasty.QuickCheck -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid -#endif - tests :: [TestTree] tests = [ testProperty "fromList . toList = id" $ \xs -> diff --git a/cabal-install/tests/UnitTests/Options.hs b/cabal-install/tests/UnitTests/Options.hs index 232f80a2711..6971d271a17 100644 --- a/cabal-install/tests/UnitTests/Options.hs +++ b/cabal-install/tests/UnitTests/Options.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE DeriveDataTypeable #-} - module UnitTests.Options ( OptionShowSolverLog (..) , OptionMtimeChangeDelay (..) @@ -9,7 +7,6 @@ module UnitTests.Options where import Data.Proxy -import Data.Typeable import Test.Tasty.Options @@ -25,7 +22,6 @@ extraOptions = ] newtype OptionShowSolverLog = OptionShowSolverLog Bool - deriving (Typeable) instance IsOption OptionShowSolverLog where defaultValue = OptionShowSolverLog False @@ -35,7 +31,6 @@ instance IsOption OptionShowSolverLog where optionCLParser = flagCLParser Nothing (OptionShowSolverLog True) newtype OptionMtimeChangeDelay = OptionMtimeChangeDelay Int - deriving (Typeable) instance IsOption OptionMtimeChangeDelay where defaultValue = OptionMtimeChangeDelay 0 @@ -47,7 +42,6 @@ instance IsOption OptionMtimeChangeDelay where ++ "file modification, in microseconds" newtype RunNetworkTests = RunNetworkTests Bool - deriving (Typeable) instance IsOption RunNetworkTests where defaultValue = RunNetworkTests True diff --git a/cabal-install/tests/fixtures/project-root/cabal.project.dir.broken/.gitkeep b/cabal-install/tests/fixtures/project-root/cabal.project.dir.broken/.gitkeep new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-install/tests/fixtures/project-root/cabal.project.symlink b/cabal-install/tests/fixtures/project-root/cabal.project.symlink new file mode 120000 index 00000000000..b4c9ceac597 --- /dev/null +++ b/cabal-install/tests/fixtures/project-root/cabal.project.symlink @@ -0,0 +1 @@ +cabal.project \ No newline at end of file diff --git a/cabal-install/tests/fixtures/project-root/cabal.project.symlink.broken b/cabal-install/tests/fixtures/project-root/cabal.project.symlink.broken new file mode 120000 index 00000000000..cfa0a46515b --- /dev/null +++ b/cabal-install/tests/fixtures/project-root/cabal.project.symlink.broken @@ -0,0 +1 @@ +does-not-exist \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs b/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs index 93ce9825a36..544764affcd 100644 --- a/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs +++ b/cabal-testsuite/PackageTests/AutoconfBadPaths/cabal.test.hs @@ -2,36 +2,38 @@ import Test.Cabal.Prelude import Data.Foldable (traverse_) import Distribution.Simple.Utils import System.Directory -main = cabalTest $ do - -- Test the forbidden characters except NUL. Reference: - -- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions +main = do -- Most of these are magic on Windows, so don't bother testing there. - -- - -- Note: we bundle the configure script so no need to autoreconf - -- while building - skipIfWindows - traverse_ check - [ "foo bar" - , "foo\tbar" - , "foo\nbar" - , "foo\"bar" - , "foo#bar" - , "foo$bar" - , "foo&bar" - , "foo'bar" - , "foo(bar" - , "foo)bar" - , "foo*bar" - , "foo;bar" - , "foobar" - , "foo?bar" - , "foo[bar" - , "foo\\bar" - , "foo`bar" - , "foo|bar" - ] + skipIfWindows "uninteresting" + cabalTest $ + -- Test the forbidden characters except NUL. Reference: + -- https://www.gnu.org/software/autoconf/manual/autoconf.html#File-System-Conventions + -- + -- Note: we bundle the configure script so no need to autoreconf + -- while building + + traverse_ check + [ "foo bar" + , "foo\tbar" + , "foo\nbar" + , "foo\"bar" + , "foo#bar" + , "foo$bar" + , "foo&bar" + , "foo'bar" + , "foo(bar" + , "foo)bar" + , "foo*bar" + , "foo;bar" + , "foobar" + , "foo?bar" + , "foo[bar" + , "foo\\bar" + , "foo`bar" + , "foo|bar" + ] where setup dir = do env <- getTestEnv diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal similarity index 92% rename from cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal rename to cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal index e6aa6169e68..efaa83b4837 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal @@ -1,4 +1,4 @@ -name: Includes2 +name: I version: 0.1.0.0 license: BSD3 author: Edward Z. Yang @@ -35,14 +35,14 @@ library default-language: Haskell2010 executable exe - build-depends: base, Includes2 + build-depends: base, I main-is: Main.hs hs-source-dirs: exe default-language: Haskell2010 test-suite includes2-test type: exitcode-stdio-1.0 - build-depends: base, Includes2 + build-depends: base, I main-is: test.hs hs-source-dirs: test default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2-fail/Includes2.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal.fail similarity index 100% rename from cabal-testsuite/PackageTests/Backpack/Includes2/Includes2-fail/Includes2.cabal rename to cabal-testsuite/PackageTests/Backpack/Includes2/I.cabal.fail diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal.fail b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2-fail/I.cabal similarity index 100% rename from cabal-testsuite/PackageTests/Backpack/Includes2/Includes2.cabal.fail rename to cabal-testsuite/PackageTests/Backpack/Includes2/Includes2-fail/I.cabal diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/Includes2.cabal b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/I.cabal similarity index 93% rename from cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/Includes2.cabal rename to cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/I.cabal index 7a02fcd961c..793f6a31979 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/Includes2.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/Includes2/I.cabal @@ -1,4 +1,4 @@ -name: Includes2 +name: I version: 0.1.0.0 license: BSD3 author: Edward Z. Yang @@ -35,7 +35,7 @@ library default-language: Haskell2010 executable exe - build-depends: base, Includes2 + build-depends: base, I main-is: Main.hs hs-source-dirs: exe default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external-target.out b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external-target.out index ff8d8b3f518..abca8b3cc98 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external-target.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external-target.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.external.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.out b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.out index 1c42b18b90a..d5aca3080fd 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.external.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.test.hs index 7197786ff2a..432911b1714 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-external.test.hs @@ -1,8 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ do +main = do + cabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 withProjectFile "cabal.external.project" $ do cabal "v2-build" ["exe"] withPlan $ do diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal-target.out b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal-target.out index 8b63d59d82c..f9dfec2b574 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal-target.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal-target.out @@ -1,9 +1,11 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.internal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - Includes2-0.1.0.0 (lib:mylib) (first run) -Configuring library 'mylib' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + - I-0.1.0.0 (lib:mylib) (first run) +Configuring library 'mylib' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out index f8dfb64d9e6..1bf07c32034 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.out @@ -1,43 +1,45 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.internal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - Includes2-0.1.0.0 (lib:mylib) (first run) - - Includes2-0.1.0.0 (lib:mysql) (first run) - - Includes2-0.1.0.0 (lib:postgresql) (first run) - - Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-mysql:Database.MySQL) (first run) - - Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run) - - Includes2-0.1.0.0 (lib) (first run) - - Includes2-0.1.0.0 (exe:exe) (first run) -Configuring library 'mylib' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + - I-0.1.0.0 (lib:mylib) (first run) + - I-0.1.0.0 (lib:mysql) (first run) + - I-0.1.0.0 (lib:postgresql) (first run) + - I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-mysql:Database.MySQL) (first run) + - I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run) + - I-0.1.0.0 (lib) (first run) + - I-0.1.0.0 (exe:exe) (first run) +Configuring library 'mylib' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Configuring library 'mysql' for Includes2-0.1.0.0... -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... -Configuring library 'postgresql' for Includes2-0.1.0.0... -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... +for I-0.1.0.0... +Configuring library 'mysql' for I-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... +Configuring library 'postgresql' for I-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... Configuring library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-mysql:Database.MySQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL -for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-mysql:Database.MySQL +for I-0.1.0.0... Configuring library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Configuring library for Includes2-0.1.0.0... -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... -Configuring executable 'exe' for Includes2-0.1.0.0... -Preprocessing executable 'exe' for Includes2-0.1.0.0... -Building executable 'exe' for Includes2-0.1.0.0... -# Includes2 exe + Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Configuring library for I-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... +Configuring executable 'exe' for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... +# I exe "minemysql minepostgresql" diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.test.hs index a04fdd4987a..1413f66dcdc 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cabal-internal.test.hs @@ -2,9 +2,8 @@ import Test.Cabal.Prelude main = cabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 withProjectFile "cabal.internal.project" $ do cabal "v2-build" ["exe"] withPlan $ do - r <- runPlanExe' "Includes2" "exe" [] + r <- runPlanExe' "I" "exe" [] assertOutputContains "minemysql minepostgresql" r diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cov.out b/cabal-testsuite/PackageTests/Backpack/Includes2/cov.out index 784baff09e7..dde9cb4b37a 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cov.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cov.out @@ -1,48 +1,50 @@ # cabal test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - Includes2-0.1.0.0 (lib:mylib) (first run) - - Includes2-0.1.0.0 (lib:mysql) (first run) - - Includes2-0.1.0.0 (lib:postgresql) (first run) - - Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-mysql:Database.MySQL) (first run) - - Includes2-0.1.0.0 (lib:mylib with Database=Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run) - - Includes2-0.1.0.0 (lib) (first run) - - Includes2-0.1.0.0 (test:includes2-test) (first run) -Configuring library 'mylib' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + - I-0.1.0.0 (lib:mylib) (first run) + - I-0.1.0.0 (lib:mysql) (first run) + - I-0.1.0.0 (lib:postgresql) (first run) + - I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-mysql:Database.MySQL) (first run) + - I-0.1.0.0 (lib:mylib with Database=I-0.1.0.0-inplace-postgresql:Database.PostgreSQL) (first run) + - I-0.1.0.0 (lib) (first run) + - I-0.1.0.0 (test:includes2-test) (first run) +Configuring library 'mylib' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Configuring library 'mysql' for Includes2-0.1.0.0... -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... -Configuring library 'postgresql' for Includes2-0.1.0.0... -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... +for I-0.1.0.0... +Configuring library 'mysql' for I-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... +Configuring library 'postgresql' for I-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... Configuring library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-mysql:Database.MySQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-mysql:Database.MySQL -for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-mysql:Database.MySQL +for I-0.1.0.0... Configuring library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-inplace-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Configuring library for Includes2-0.1.0.0... -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... -Configuring test suite 'includes2-test' for Includes2-0.1.0.0... -Preprocessing test suite 'includes2-test' for Includes2-0.1.0.0... -Building test suite 'includes2-test' for Includes2-0.1.0.0... + Database = I-0.1.0.0-inplace-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Configuring library for I-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... +Configuring test suite 'includes2-test' for I-0.1.0.0... +Preprocessing test suite 'includes2-test' for I-0.1.0.0... +Building test suite 'includes2-test' for I-0.1.0.0... Running 1 test suites... Test suite includes2-test: RUNNING... Test suite includes2-test: PASS -Test suite logged to: /cov.dist/work/./dist/build//ghc-/Includes2-0.1.0.0/t/includes2-test/test/Includes2-0.1.0.0-includes2-test.log -Package coverage report written to /cov.dist/work/./dist/build//ghc-/Includes2-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html +Test suite logged to: /cov.dist/work/./dist/build//ghc-/I-0.1.0.0/t/includes2-test/test/I-0.1.0.0-includes2-test.log +Package coverage report written to /cov.dist/work/./dist/build//ghc-/I-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html 1 of 1 test suites (1 of 1 test cases) passed. -Package coverage report written to /cov.dist/work/./dist/build//ghc-/Includes2-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html +Package coverage report written to /cov.dist/work/./dist/build//ghc-/I-0.1.0.0/t/includes2-test/hpc/vanilla/html/hpc_index.html diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/cov.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/cov.test.hs index 24c1662c375..40079c0e787 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/cov.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/cov.test.hs @@ -1,6 +1,5 @@ import Test.Cabal.Prelude main = cabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 -- #6397 cabal "test" ["--enable-coverage", "includes2-test"] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.cabal.out b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.cabal.out index cb4f8288291..127f860bd87 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.cabal.out @@ -8,7 +8,7 @@ for mylib-0.1.0.0... Preprocessing library for mylib-0.1.0.0... Running Haddock on library instantiated with Database = for mylib-0.1.0.0... -Documentation created: ../setup-external.cabal.dist/work/mylib/dist/doc/html/mylib/ +Documentation created: ./mylib/../setup-external.cabal.dist/work/mylib/dist/doc/html/mylib # Setup copy Installing library in # Setup register @@ -22,7 +22,7 @@ Building library for mysql-0.1.0.0... # Setup haddock Preprocessing library for mysql-0.1.0.0... Running Haddock on library for mysql-0.1.0.0... -Documentation created: ../setup-external.cabal.dist/work/mysql/dist/doc/html/mysql/ +Documentation created: ./mysql/../setup-external.cabal.dist/work/mysql/dist/doc/html/mysql # Setup copy Installing library in # Setup register @@ -35,7 +35,7 @@ Building library for postgresql-0.1.0.0... # Setup haddock Preprocessing library for postgresql-0.1.0.0... Running Haddock on library for postgresql-0.1.0.0... -Documentation created: ../setup-external.cabal.dist/work/postgresql/dist/doc/html/postgresql/ +Documentation created: ./postgresql/../setup-external.cabal.dist/work/postgresql/dist/doc/html/postgresql # Setup copy Installing library in # Setup register @@ -51,7 +51,7 @@ Preprocessing library for mylib-0.1.0.0... Running Haddock on library instantiated with Database = mysql-0.1.0.0:Database.MySQL for mylib-0.1.0.0... -Documentation created: ../setup-external.cabal.dist/work/mylib/dist/doc/html/mylib/ +Documentation created: ./mylib/../setup-external.cabal.dist/work/mylib/dist/doc/html/mylib # Setup copy Installing library in # Setup register @@ -69,7 +69,7 @@ Preprocessing library for mylib-0.1.0.0... Running Haddock on library instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL for mylib-0.1.0.0... -Documentation created: ../setup-external.cabal.dist/work/mylib/dist/doc/html/mylib/ +Documentation created: ./mylib/../setup-external.cabal.dist/work/mylib/dist/doc/html/mylib # Setup copy Installing library in # Setup register @@ -84,7 +84,7 @@ Building library for src-0.1.0.0... # Setup haddock Preprocessing library for src-0.1.0.0... Running Haddock on library for src-0.1.0.0... -Documentation created: ../setup-external.cabal.dist/work/src/dist/doc/html/src/ +Documentation created: ./src/../setup-external.cabal.dist/work/src/dist/doc/html/src # Setup copy Installing library in # Setup register diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.out b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.out index 299d6a831b3..f363c456afd 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.out @@ -8,7 +8,7 @@ for mylib-0.1.0.0... Preprocessing library for mylib-0.1.0.0... Running Haddock on library instantiated with Database = for mylib-0.1.0.0... -Documentation created: ../setup-external.dist/work/mylib/dist/doc/html/mylib/ +Documentation created: ./mylib/../setup-external.dist/work/mylib/dist/doc/html/mylib # Setup copy Installing library in # Setup register @@ -22,7 +22,7 @@ Building library for mysql-0.1.0.0... # Setup haddock Preprocessing library for mysql-0.1.0.0... Running Haddock on library for mysql-0.1.0.0... -Documentation created: ../setup-external.dist/work/mysql/dist/doc/html/mysql/ +Documentation created: ./mysql/../setup-external.dist/work/mysql/dist/doc/html/mysql # Setup copy Installing library in # Setup register @@ -35,7 +35,7 @@ Building library for postgresql-0.1.0.0... # Setup haddock Preprocessing library for postgresql-0.1.0.0... Running Haddock on library for postgresql-0.1.0.0... -Documentation created: ../setup-external.dist/work/postgresql/dist/doc/html/postgresql/ +Documentation created: ./postgresql/../setup-external.dist/work/postgresql/dist/doc/html/postgresql # Setup copy Installing library in # Setup register @@ -51,7 +51,7 @@ Preprocessing library for mylib-0.1.0.0... Running Haddock on library instantiated with Database = mysql-0.1.0.0:Database.MySQL for mylib-0.1.0.0... -Documentation created: ../setup-external.dist/work/mylib/dist/doc/html/mylib/ +Documentation created: ./mylib/../setup-external.dist/work/mylib/dist/doc/html/mylib # Setup copy Installing library in # Setup register @@ -69,7 +69,7 @@ Preprocessing library for mylib-0.1.0.0... Running Haddock on library instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL for mylib-0.1.0.0... -Documentation created: ../setup-external.dist/work/mylib/dist/doc/html/mylib/ +Documentation created: ./mylib/../setup-external.dist/work/mylib/dist/doc/html/mylib # Setup copy Installing library in # Setup register @@ -84,7 +84,7 @@ Building library for src-0.1.0.0... # Setup haddock Preprocessing library for src-0.1.0.0... Running Haddock on library for src-0.1.0.0... -Documentation created: ../setup-external.dist/work/src/dist/doc/html/src/ +Documentation created: ./src/../setup-external.dist/work/src/dist/doc/html/src # Setup copy Installing library in # Setup register diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.test.hs index 3e4577aecfa..87ab998b3b0 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-external.test.hs @@ -1,8 +1,7 @@ import Test.Cabal.Prelude main = setupAndCabalTest $ do skipUnlessGhcVersion ">= 8.1" - ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*" - expectBrokenIf ghc 7987 $ do + expectBrokenIfGhc "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*" 7987 $ do withPackageDb $ do withDirectory "mylib" $ setup_install_with_docs ["--ipid", "mylib-0.1.0.0"] withDirectory "mysql" $ setup_install_with_docs ["--ipid", "mysql-0.1.0.0"] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.cabal.out b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.cabal.out index 12dc4aecc6c..e8f2fa18d85 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.cabal.out @@ -1,25 +1,25 @@ # Setup configure -Configuring Includes2-0.1.0.0... +Configuring I-0.1.0.0... # Setup build -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-mysql:Database.MySQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... -Preprocessing executable 'exe' for Includes2-0.1.0.0... -Building executable 'exe' for Includes2-0.1.0.0... + Database = I-0.1.0.0-mysql:Database.MySQL +for I-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup copy Installing internal library postgresql in Installing internal library mysql in @@ -30,16 +30,16 @@ Installing library in Installing executable exe in Warning: The directory /setup-internal.cabal.dist/usr/bin is not in the system search path. # Setup register -Registering library 'postgresql' for Includes2-0.1.0.0... -Registering library 'mysql' for Includes2-0.1.0.0... +Registering library 'postgresql' for I-0.1.0.0... +Registering library 'mysql' for I-0.1.0.0... Registering library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... Registering library 'mylib' instantiated with - Database = Includes2-0.1.0.0-mysql:Database.MySQL -for Includes2-0.1.0.0... + Database = I-0.1.0.0-postgresql:Database.PostgreSQL +for I-0.1.0.0... Registering library 'mylib' instantiated with - Database = Includes2-0.1.0.0-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Registering library for Includes2-0.1.0.0... + Database = I-0.1.0.0-mysql:Database.MySQL +for I-0.1.0.0... +Registering library for I-0.1.0.0... # exe "minemysql minepostgresql" diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.out b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.out index 700f1b2fbfc..0cb3b8768c3 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-internal.out @@ -1,25 +1,25 @@ # Setup configure -Configuring Includes2-0.1.0.0... +Configuring I-0.1.0.0... # Setup build -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-mysql:Database.MySQL -for Includes2-0.1.0.0... -Preprocessing library 'mylib' for Includes2-0.1.0.0... + Database = I-0.1.0.0-postgresql:Database.PostgreSQL +for I-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with - Database = Includes2-0.1.0.0-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... -Preprocessing executable 'exe' for Includes2-0.1.0.0... -Building executable 'exe' for Includes2-0.1.0.0... + Database = I-0.1.0.0-mysql:Database.MySQL +for I-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup copy Installing internal library postgresql in Installing internal library mysql in @@ -30,16 +30,16 @@ Installing library in Installing executable exe in Warning: The directory /setup-internal.dist/usr/bin is not in the system search path. # Setup register -Registering library 'postgresql' for Includes2-0.1.0.0... -Registering library 'mysql' for Includes2-0.1.0.0... +Registering library 'postgresql' for I-0.1.0.0... +Registering library 'mysql' for I-0.1.0.0... Registering library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... Registering library 'mylib' instantiated with - Database = Includes2-0.1.0.0-mysql:Database.MySQL -for Includes2-0.1.0.0... + Database = I-0.1.0.0-postgresql:Database.PostgreSQL +for I-0.1.0.0... Registering library 'mylib' instantiated with - Database = Includes2-0.1.0.0-postgresql:Database.PostgreSQL -for Includes2-0.1.0.0... -Registering library for Includes2-0.1.0.0... + Database = I-0.1.0.0-mysql:Database.MySQL +for I-0.1.0.0... +Registering library for I-0.1.0.0... # exe "minemysql minepostgresql" diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.out b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.out index 01888faed97..3eaa739df55 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.out @@ -1,107 +1,107 @@ # Setup configure -Configuring library 'mylib' for Includes2-0.1.0.0... +Configuring library 'mylib' for I-0.1.0.0... # Setup build -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup haddock -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Running Haddock on library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/ +for I-0.1.0.0... +Documentation created: ./Includes2/../setup-per-component.dist/work/Includes2/dist/doc/html/I/mylib # Setup copy Installing internal library mylib in # Setup register Registering library 'mylib' instantiated with Database = -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup configure -Configuring library 'mysql' for Includes2-0.1.0.0... +Configuring library 'mysql' for I-0.1.0.0... # Setup build -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Building library 'mysql' for Includes2-0.1.0.0... +Preprocessing library 'mysql' for I-0.1.0.0... +Building library 'mysql' for I-0.1.0.0... # Setup haddock -Preprocessing library 'mysql' for Includes2-0.1.0.0... -Running Haddock on library 'mysql' for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/ +Preprocessing library 'mysql' for I-0.1.0.0... +Running Haddock on library 'mysql' for I-0.1.0.0... +Documentation created: ./Includes2/../setup-per-component.dist/work/Includes2/dist/doc/html/I/mysql # Setup copy Installing internal library mysql in # Setup register -Registering library 'mysql' for Includes2-0.1.0.0... +Registering library 'mysql' for I-0.1.0.0... # Setup configure -Configuring library 'postgresql' for Includes2-0.1.0.0... +Configuring library 'postgresql' for I-0.1.0.0... # Setup build -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Building library 'postgresql' for Includes2-0.1.0.0... +Preprocessing library 'postgresql' for I-0.1.0.0... +Building library 'postgresql' for I-0.1.0.0... # Setup haddock -Preprocessing library 'postgresql' for Includes2-0.1.0.0... -Running Haddock on library 'postgresql' for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/ +Preprocessing library 'postgresql' for I-0.1.0.0... +Running Haddock on library 'postgresql' for I-0.1.0.0... +Documentation created: ./Includes2/../setup-per-component.dist/work/Includes2/dist/doc/html/I/postgresql # Setup copy Installing internal library postgresql in # Setup register -Registering library 'postgresql' for Includes2-0.1.0.0... +Registering library 'postgresql' for I-0.1.0.0... # Setup configure Configuring library 'mylib' instantiated with Database = mysql-0.1.0.0:Database.MySQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup build -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = mysql-0.1.0.0:Database.MySQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup haddock -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Running Haddock on library 'mylib' instantiated with Database = mysql-0.1.0.0:Database.MySQL -for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/ +for I-0.1.0.0... +Documentation created: ./Includes2/../setup-per-component.dist/work/Includes2/dist/doc/html/I/mylib # Setup copy Installing internal library mylib in # Setup register Registering library 'mylib' instantiated with Database = mysql-0.1.0.0:Database.MySQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup configure Configuring library 'mylib' instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup build -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Building library 'mylib' instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup haddock -Preprocessing library 'mylib' for Includes2-0.1.0.0... +Preprocessing library 'mylib' for I-0.1.0.0... Running Haddock on library 'mylib' instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL -for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/ +for I-0.1.0.0... +Documentation created: ./Includes2/../setup-per-component.dist/work/Includes2/dist/doc/html/I/mylib # Setup copy Installing internal library mylib in # Setup register Registering library 'mylib' instantiated with Database = postgresql-0.1.0.0:Database.PostgreSQL -for Includes2-0.1.0.0... +for I-0.1.0.0... # Setup configure -Configuring library for Includes2-0.1.0.0... +Configuring library for I-0.1.0.0... # Setup build -Preprocessing library for Includes2-0.1.0.0... -Building library for Includes2-0.1.0.0... +Preprocessing library for I-0.1.0.0... +Building library for I-0.1.0.0... # Setup haddock -Preprocessing library for Includes2-0.1.0.0... -Running Haddock on library for Includes2-0.1.0.0... -Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/ +Preprocessing library for I-0.1.0.0... +Running Haddock on library for I-0.1.0.0... +Documentation created: ./Includes2/../setup-per-component.dist/work/Includes2/dist/doc/html/I # Setup copy Installing library in # Setup register -Registering library for Includes2-0.1.0.0... +Registering library for I-0.1.0.0... # Setup configure -Configuring executable 'exe' for Includes2-0.1.0.0... +Configuring executable 'exe' for I-0.1.0.0... # Setup build -Preprocessing executable 'exe' for Includes2-0.1.0.0... -Building executable 'exe' for Includes2-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup haddock -Preprocessing executable 'exe' for Includes2-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... # Setup copy Installing executable exe in Warning: The directory /setup-per-component.dist/usr/bin is not in the system search path. diff --git a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.test.hs index 5bbb1b02af2..80990b1136c 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes2/setup-per-component.test.hs @@ -2,8 +2,7 @@ import Test.Cabal.Prelude main = setupTest $ do -- No cabal test because per-component is broken with it skipUnlessGhcVersion ">= 8.1" - ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*" - expectBrokenIf ghc 7987 $ + expectBrokenIfGhc "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*" 7987 $ withPackageDb $ withDirectory "Includes2" $ do let setup_install' args = setup_install_with_docs args @@ -14,6 +13,6 @@ main = setupTest $ do "--instantiate-with", "Database=mysql-0.1.0.0:Database.MySQL"] setup_install' ["mylib", "--cid", "mylib-0.1.0.0", "--instantiate-with", "Database=postgresql-0.1.0.0:Database.PostgreSQL"] - setup_install' ["Includes2"] + setup_install' ["I"] setup_install' ["exe"] runExe' "exe" [] >>= assertOutputContains "minemysql minepostgresql" diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal b/cabal-testsuite/PackageTests/Backpack/Includes3/I.cabal similarity index 95% rename from cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal rename to cabal-testsuite/PackageTests/Backpack/Includes3/I.cabal index 7016e221218..ca17845e21d 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/Includes3.cabal +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/I.cabal @@ -1,4 +1,4 @@ -name: Includes3 +name: I version: 0.1.0.0 license: BSD3 author: Edward Z. Yang diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.out b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.out index 6e2abbf4a0c..5c8ce031497 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.external.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.test.hs index 80a4c47d068..a974254fc98 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-external.test.hs @@ -2,7 +2,6 @@ import Test.Cabal.Prelude main = cabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 withProjectFile "cabal.external.project" $ do cabal "v2-build" ["exe"] withPlan $ do diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.out b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.out index 88b36e02c50..9597b8ca719 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.out @@ -1,28 +1,29 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.internal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - Includes3-0.1.0.0 (lib:sigs) (first run) - - Includes3-0.1.0.0 (lib:indef) (first run) - - Includes3-0.1.0.0 (lib:indef with Data.Map=containers-:Data.Map) (first run) - - Includes3-0.1.0.0 (exe:exe) (first run) -Configuring library 'sigs' for Includes3-0.1.0.0... -Preprocessing library 'sigs' for Includes3-0.1.0.0... + - I-0.1.0.0 (lib:sigs) (first run) + - I-0.1.0.0 (lib:indef) (first run) + - I-0.1.0.0 (lib:indef with Data.Map=containers-:Data.Map) (first run) + - I-0.1.0.0 (exe:exe) (first run) +Configuring library 'sigs' for I-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Configuring library 'indef' for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Configuring library 'indef' for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Configuring library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... -Building library 'indef' instantiated with - Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Configuring executable 'exe' for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... -# Includes3 exe +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... +Building library 'indef' instantiated with Data.Map = containers-:Data.Map +for I-0.1.0.0... +Configuring executable 'exe' for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... +# I exe fromList [(0,2),(2,4)] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.test.hs index b247e56259a..81f3fcb0027 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-internal.test.hs @@ -2,9 +2,8 @@ import Test.Cabal.Prelude main = cabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 withProjectFile "cabal.internal.project" $ do cabal "v2-build" ["exe"] withPlan $ do - r <- runPlanExe' "Includes3" "exe" [] + r <- runPlanExe' "I" "exe" [] assertOutputContains "fromList [(0,2),(2,4)]" r diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.out b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.out index d6fb3844873..d6033fc608c 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.out @@ -1,6 +1,10 @@ # cabal v2-update +Configuration is affected by the following files: +- cabal.repo.project Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.repo.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.test.hs index 00e2aff3c84..03b74a01b9a 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/cabal-repo.test.hs @@ -1,7 +1,6 @@ import Test.Cabal.Prelude main = cabalTest $ withShorterPathForNewBuildStore $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 withProjectFile "cabal.repo.project" $ do withRepo "repo" $ do cabal "v2-build" ["exe"] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-explicit.out b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-explicit.out index b27b2d8eb1a..3697155460a 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-explicit.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-explicit.out @@ -8,7 +8,7 @@ for sigs-0.1.0.0... Preprocessing library for sigs-0.1.0.0... Running Haddock on library instantiated with Data.Map = for sigs-0.1.0.0... -Documentation created: ../../setup-external-explicit.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs/ +Documentation created: ./repo/sigs-0.1.0.0/../../setup-external-explicit.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs # Setup copy Installing library in # Setup register @@ -24,7 +24,7 @@ for indef-0.1.0.0... Preprocessing library for indef-0.1.0.0... Running Haddock on library instantiated with Data.Map = for indef-0.1.0.0... -Documentation created: ../../setup-external-explicit.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef/ +Documentation created: ./repo/indef-0.1.0.0/../../setup-external-explicit.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef # Setup copy Installing library in # Setup register diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.cabal.out b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.cabal.out index 6d0abf817af..e57a01ca56e 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.cabal.out @@ -8,7 +8,7 @@ for sigs-0.1.0.0... Preprocessing library for sigs-0.1.0.0... Running Haddock on library instantiated with Data.Map = for sigs-0.1.0.0... -Documentation created: ../../setup-external-ok.cabal.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs/ +Documentation created: ./repo/sigs-0.1.0.0/../../setup-external-ok.cabal.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs # Setup copy Installing library in # Setup register @@ -24,7 +24,7 @@ for indef-0.1.0.0... Preprocessing library for indef-0.1.0.0... Running Haddock on library instantiated with Data.Map = for indef-0.1.0.0... -Documentation created: ../../setup-external-ok.cabal.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef/ +Documentation created: ./repo/indef-0.1.0.0/../../setup-external-ok.cabal.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef # Setup copy Installing library in # Setup register @@ -41,11 +41,12 @@ Preprocessing library for sigs-0.1.0.0... Running Haddock on library instantiated with Data.Map = containers-:Data.Map for sigs-0.1.0.0... -Documentation created: ../../setup-external-ok.cabal.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs/ +Documentation created: ./repo/sigs-0.1.0.0/../../setup-external-ok.cabal.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs # Setup copy Installing library in # Setup register -Registering library instantiated with Data.Map = containers-:Data.Map +Registering library instantiated with + Data.Map = containers-:Data.Map for sigs-0.1.0.0... # Setup configure Configuring indef-0.1.0.0... @@ -58,11 +59,12 @@ Preprocessing library for indef-0.1.0.0... Running Haddock on library instantiated with Data.Map = containers-:Data.Map for indef-0.1.0.0... -Documentation created: ../../setup-external-ok.cabal.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef/ +Documentation created: ./repo/indef-0.1.0.0/../../setup-external-ok.cabal.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef # Setup copy Installing library in # Setup register -Registering library instantiated with Data.Map = containers-:Data.Map +Registering library instantiated with + Data.Map = containers-:Data.Map for indef-0.1.0.0... # Setup configure Configuring exe-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.out b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.out index 8fc173d40f0..2d4e65cb2cd 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.out @@ -8,7 +8,7 @@ for sigs-0.1.0.0... Preprocessing library for sigs-0.1.0.0... Running Haddock on library instantiated with Data.Map = for sigs-0.1.0.0... -Documentation created: ../../setup-external-ok.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs/ +Documentation created: ./repo/sigs-0.1.0.0/../../setup-external-ok.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs # Setup copy Installing library in # Setup register @@ -24,7 +24,7 @@ for indef-0.1.0.0... Preprocessing library for indef-0.1.0.0... Running Haddock on library instantiated with Data.Map = for indef-0.1.0.0... -Documentation created: ../../setup-external-ok.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef/ +Documentation created: ./repo/indef-0.1.0.0/../../setup-external-ok.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef # Setup copy Installing library in # Setup register @@ -41,11 +41,12 @@ Preprocessing library for sigs-0.1.0.0... Running Haddock on library instantiated with Data.Map = containers-:Data.Map for sigs-0.1.0.0... -Documentation created: ../../setup-external-ok.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs/ +Documentation created: ./repo/sigs-0.1.0.0/../../setup-external-ok.dist/work/repo/sigs-0.1.0.0/dist/doc/html/sigs # Setup copy Installing library in # Setup register -Registering library instantiated with Data.Map = containers-:Data.Map +Registering library instantiated with + Data.Map = containers-:Data.Map for sigs-0.1.0.0... # Setup configure Configuring indef-0.1.0.0... @@ -58,11 +59,12 @@ Preprocessing library for indef-0.1.0.0... Running Haddock on library instantiated with Data.Map = containers-:Data.Map for indef-0.1.0.0... -Documentation created: ../../setup-external-ok.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef/ +Documentation created: ./repo/indef-0.1.0.0/../../setup-external-ok.dist/work/repo/indef-0.1.0.0/dist/doc/html/indef # Setup copy Installing library in # Setup register -Registering library instantiated with Data.Map = containers-:Data.Map +Registering library instantiated with + Data.Map = containers-:Data.Map for indef-0.1.0.0... # Setup configure Configuring exe-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.test.hs b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.test.hs index d7ae9a1921d..a905e873cac 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-external-ok.test.hs @@ -3,8 +3,7 @@ import Data.List import qualified Data.Char as Char main = setupAndCabalTest $ do skipUnlessGhcVersion ">= 8.1" - ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*" - expectBrokenIf ghc 7987 $ + expectBrokenIfGhc "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*" 7987 $ withPackageDb $ do containers_id <- getIPID "containers" withDirectory "repo/sigs-0.1.0.0" $ setup_install_with_docs ["--ipid", "sigs-0.1.0.0"] @@ -21,4 +20,3 @@ main = setupAndCabalTest $ do withDirectory "repo/exe-0.1.0.0" $ do setup_install [] runExe' "exe" [] >>= assertOutputContains "fromList [(0,2),(2,4)]" - diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.cabal.out b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.cabal.out index ea300c9286d..9ac4463aa6e 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.cabal.out @@ -1,18 +1,18 @@ # Setup configure -Configuring Includes3-0.1.0.0... +Configuring I-0.1.0.0... # Setup build -Preprocessing library 'sigs' for Includes3-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup copy Installing internal library sigs in Installing internal library indef in @@ -21,24 +21,24 @@ Installing executable exe in Warning: The directory /setup-internal.cabal.dist/usr/bin is not in the system search path. # Setup register Registering library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Registering library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Registering library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... +for I-0.1.0.0... # Setup build -Preprocessing library 'sigs' for Includes3-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # exe fromList [(0,2),(2,4)] diff --git a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.out b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.out index cb9caef57a7..6912ab117cd 100644 --- a/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.out +++ b/cabal-testsuite/PackageTests/Backpack/Includes3/setup-internal.out @@ -1,18 +1,18 @@ # Setup configure -Configuring Includes3-0.1.0.0... +Configuring I-0.1.0.0... # Setup build -Preprocessing library 'sigs' for Includes3-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # Setup copy Installing internal library sigs in Installing internal library indef in @@ -21,24 +21,24 @@ Installing executable exe in Warning: The directory /setup-internal.dist/usr/bin is not in the system search path. # Setup register Registering library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Registering library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... +for I-0.1.0.0... Registering library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... +for I-0.1.0.0... # Setup build -Preprocessing library 'sigs' for Includes3-0.1.0.0... +Preprocessing library 'sigs' for I-0.1.0.0... Building library 'sigs' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = -for Includes3-0.1.0.0... -Preprocessing library 'indef' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing library 'indef' for I-0.1.0.0... Building library 'indef' instantiated with Data.Map = containers-:Data.Map -for Includes3-0.1.0.0... -Preprocessing executable 'exe' for Includes3-0.1.0.0... -Building executable 'exe' for Includes3-0.1.0.0... +for I-0.1.0.0... +Preprocessing executable 'exe' for I-0.1.0.0... +Building executable 'exe' for I-0.1.0.0... # exe fromList [(0,2),(2,4)] diff --git a/cabal-testsuite/PackageTests/Backpack/Reexport1/setup.cabal.out b/cabal-testsuite/PackageTests/Backpack/Reexport1/setup.cabal.out index 1c8de306e5d..d36358ef31e 100644 --- a/cabal-testsuite/PackageTests/Backpack/Reexport1/setup.cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/Reexport1/setup.cabal.out @@ -6,7 +6,7 @@ Building library for p-0.1.0.0... # Setup haddock Preprocessing library for p-0.1.0.0... Running Haddock on library for p-0.1.0.0... -Documentation created: ../setup.cabal.dist/work/p/dist/doc/html/p/ +Documentation created: ./p/../setup.cabal.dist/work/p/dist/doc/html/p # Setup copy Installing library in # Setup register @@ -19,4 +19,4 @@ Building library for q-0.1.0.0... # Setup haddock Preprocessing library for q-0.1.0.0... Running Haddock on library for q-0.1.0.0... -Documentation created: ../setup.cabal.dist/work/q/dist/doc/html/q/ +Documentation created: ./q/../setup.cabal.dist/work/q/dist/doc/html/q diff --git a/cabal-testsuite/PackageTests/Backpack/Reexport1/setup.out b/cabal-testsuite/PackageTests/Backpack/Reexport1/setup.out index ee41d01148b..78312c7bcbb 100644 --- a/cabal-testsuite/PackageTests/Backpack/Reexport1/setup.out +++ b/cabal-testsuite/PackageTests/Backpack/Reexport1/setup.out @@ -6,7 +6,7 @@ Building library for p-0.1.0.0... # Setup haddock Preprocessing library for p-0.1.0.0... Running Haddock on library for p-0.1.0.0... -Documentation created: ../setup.dist/work/p/dist/doc/html/p/ +Documentation created: ./p/../setup.dist/work/p/dist/doc/html/p # Setup copy Installing library in # Setup register @@ -19,4 +19,4 @@ Building library for q-0.1.0.0... # Setup haddock Preprocessing library for q-0.1.0.0... Running Haddock on library for q-0.1.0.0... -Documentation created: ../setup.dist/work/q/dist/doc/html/q/ +Documentation created: ./q/../setup.dist/work/q/dist/doc/html/q diff --git a/cabal-testsuite/PackageTests/Backpack/Reexport2/cabal.out b/cabal-testsuite/PackageTests/Backpack/Reexport2/cabal.out index 31c9428dcaf..2709b24a4d8 100644 --- a/cabal-testsuite/PackageTests/Backpack/Reexport2/cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/Reexport2/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: Problem with module re-exports: diff --git a/cabal-testsuite/PackageTests/Backpack/T4754/setup.test.hs b/cabal-testsuite/PackageTests/Backpack/T4754/setup.test.hs index 97dae2b597c..4931cd33c99 100644 --- a/cabal-testsuite/PackageTests/Backpack/T4754/setup.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/T4754/setup.test.hs @@ -1,6 +1,6 @@ import Test.Cabal.Prelude main = setupAndCabalTest $ do skipUnlessGhcVersion ">= 8.1" - skipUnless "no profiling libs" =<< hasProfiledLibraries + skipIfNoProfiledLibraries setup "configure" ["--enable-profiling"] setup "build" [] diff --git a/cabal-testsuite/PackageTests/Backpack/T6385/cabal.out b/cabal-testsuite/PackageTests/Backpack/T6385/cabal.out index ad3387bf28b..7147f2ead8b 100644 --- a/cabal-testsuite/PackageTests/Backpack/T6385/cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/T6385/cabal.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Backpack/T6385/cabal.test.hs b/cabal-testsuite/PackageTests/Backpack/T6385/cabal.test.hs index 0a31702615c..5048e09d56b 100644 --- a/cabal-testsuite/PackageTests/Backpack/T6385/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/T6385/cabal.test.hs @@ -2,6 +2,5 @@ import Test.Cabal.Prelude main = cabalTest $ withShorterPathForNewBuildStore $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 withRepo "repo" $ do cabal "v2-build" ["T6385"] diff --git a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/bkpcabal01.cabal b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/b.cabal similarity index 96% rename from cabal-testsuite/PackageTests/Backpack/bkpcabal01/bkpcabal01.cabal rename to cabal-testsuite/PackageTests/Backpack/bkpcabal01/b.cabal index f10d1aad151..f1e92112a1f 100644 --- a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/bkpcabal01.cabal +++ b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/b.cabal @@ -1,5 +1,5 @@ cabal-version: 2.0 -name: bkpcabal01 +name: b version: 0.1.0.0 description: This test also exists in GHC's test-suite under the same name and was ported over to cabal's testsuite as it exposed a diff --git a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out index 4630087ccc2..6308ceaefd3 100644 --- a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out +++ b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.out @@ -1,34 +1,36 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: - - bkpcabal01-0.1.0.0 (lib:impl) (first run) - - bkpcabal01-0.1.0.0 (lib:p) (first run) - - bkpcabal01-0.1.0.0 (lib:p with H=bkpcabal01-0.1.0.0-inplace-impl:H) (first run) - - bkpcabal01-0.1.0.0 (lib:q) (first run) - - bkpcabal01-0.1.0.0 (lib:q with I=bkpcabal01-0.1.0.0-inplace-impl:I) (first run) - - bkpcabal01-0.1.0.0 (exe:exe) (first run) -Configuring library 'impl' for bkpcabal01-0.1.0.0... -Preprocessing library 'impl' for bkpcabal01-0.1.0.0... -Building library 'impl' for bkpcabal01-0.1.0.0... -Configuring library 'p' for bkpcabal01-0.1.0.0... -Preprocessing library 'p' for bkpcabal01-0.1.0.0... + - b-0.1.0.0 (lib:impl) (first run) + - b-0.1.0.0 (lib:p) (first run) + - b-0.1.0.0 (lib:p with H=b-0.1.0.0-inplace-impl:H) (first run) + - b-0.1.0.0 (lib:q) (first run) + - b-0.1.0.0 (lib:q with I=b-0.1.0.0-inplace-impl:I) (first run) + - b-0.1.0.0 (exe:exe) (first run) +Configuring library 'impl' for b-0.1.0.0... +Preprocessing library 'impl' for b-0.1.0.0... +Building library 'impl' for b-0.1.0.0... +Configuring library 'p' for b-0.1.0.0... +Preprocessing library 'p' for b-0.1.0.0... Building library 'p' instantiated with H = -for bkpcabal01-0.1.0.0... -Configuring library 'p' instantiated with H = bkpcabal01-0.1.0.0-inplace-impl:H -for bkpcabal01-0.1.0.0... -Preprocessing library 'p' for bkpcabal01-0.1.0.0... -Building library 'p' instantiated with H = bkpcabal01-0.1.0.0-inplace-impl:H -for bkpcabal01-0.1.0.0... -Configuring library 'q' for bkpcabal01-0.1.0.0... -Preprocessing library 'q' for bkpcabal01-0.1.0.0... +for b-0.1.0.0... +Configuring library 'p' instantiated with H = b-0.1.0.0-inplace-impl:H +for b-0.1.0.0... +Preprocessing library 'p' for b-0.1.0.0... +Building library 'p' instantiated with H = b-0.1.0.0-inplace-impl:H +for b-0.1.0.0... +Configuring library 'q' for b-0.1.0.0... +Preprocessing library 'q' for b-0.1.0.0... Building library 'q' instantiated with I = -for bkpcabal01-0.1.0.0... -Configuring library 'q' instantiated with I = bkpcabal01-0.1.0.0-inplace-impl:I -for bkpcabal01-0.1.0.0... -Preprocessing library 'q' for bkpcabal01-0.1.0.0... -Building library 'q' instantiated with I = bkpcabal01-0.1.0.0-inplace-impl:I -for bkpcabal01-0.1.0.0... -Configuring executable 'exe' for bkpcabal01-0.1.0.0... -Preprocessing executable 'exe' for bkpcabal01-0.1.0.0... -Building executable 'exe' for bkpcabal01-0.1.0.0... +for b-0.1.0.0... +Configuring library 'q' instantiated with I = b-0.1.0.0-inplace-impl:I +for b-0.1.0.0... +Preprocessing library 'q' for b-0.1.0.0... +Building library 'q' instantiated with I = b-0.1.0.0-inplace-impl:I +for b-0.1.0.0... +Configuring executable 'exe' for b-0.1.0.0... +Preprocessing executable 'exe' for b-0.1.0.0... +Building executable 'exe' for b-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.test.hs b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.test.hs index 5a30f6a867a..0f1b7544e07 100644 --- a/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Backpack/bkpcabal01/cabal.test.hs @@ -1,6 +1,6 @@ import Test.Cabal.Prelude -main = cabalTest $ do +main = do + cabalTest $ do -- GHC 8.2.2 had a regression ("unknown package: hole"), see also #4908 skipUnlessGhcVersion ">= 8.2 && <8.2.2 || >8.2.2" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 cabal "v2-build" ["all"] diff --git a/cabal-testsuite/PackageTests/BuildAutogenPackageGuard/cabal.out b/cabal-testsuite/PackageTests/BuildAutogenPackageGuard/cabal.out index 512a50e37ee..8224b23be46 100644 --- a/cabal-testsuite/PackageTests/BuildAutogenPackageGuard/cabal.out +++ b/cabal-testsuite/PackageTests/BuildAutogenPackageGuard/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/BuildDeps/DepCycle/cabal.out b/cabal-testsuite/PackageTests/BuildDeps/DepCycle/cabal.out index 966c934480b..053a770072e 100644 --- a/cabal-testsuite/PackageTests/BuildDeps/DepCycle/cabal.out +++ b/cabal-testsuite/PackageTests/BuildDeps/DepCycle/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: Dependency cycle between the following components: diff --git a/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary1/cabal.out b/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary1/cabal.out index f00101f9ba2..eced886a5e8 100644 --- a/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary1/cabal.out +++ b/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary1/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary2/setup.test.hs b/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary2/setup.test.hs index e36e33823d2..6b6da17f116 100644 --- a/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary2/setup.test.hs +++ b/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary2/setup.test.hs @@ -6,4 +6,4 @@ main = setupAndCabalTest . withPackageDb $ do assertEqual ("executable should have linked with the internal library") ("foo foo myLibFunc internal") - (concatOutput (resultOutput r)) + (lineBreaksToSpaces $ resultOutput r) diff --git a/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary3/setup.test.hs b/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary3/setup.test.hs index 549e8bf8bb4..ac05c394383 100644 --- a/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary3/setup.test.hs +++ b/cabal-testsuite/PackageTests/BuildDeps/InternalLibrary3/setup.test.hs @@ -8,4 +8,4 @@ main = setupAndCabalTest . withPackageDb $ do assertEqual ("executable should have linked with the internal library") ("foo foo myLibFunc internal") - (concatOutput (resultOutput r)) + (lineBreaksToSpaces $ resultOutput r) diff --git a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackage/use-local-version-of-package.out b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackage/use-local-version-of-package.out index a1636d8cbff..92f3698edc6 100644 --- a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackage/use-local-version-of-package.out +++ b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackage/use-local-version-of-package.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -11,6 +13,8 @@ Building executable 'my-exe' for pkg-1.0... # pkg my-exe local pkg-1.0 # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/pkg/pkg.cabal b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/pkg/pkg.cabal index f6ca5619b77..7e0d2a55f8a 100644 --- a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/pkg/pkg.cabal +++ b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/pkg/pkg.cabal @@ -1,7 +1,7 @@ name: pkg version: 1.0 build-type: Custom -cabal-version: >= 1.20 +cabal-version: 1.20 custom-setup setup-depends: base, Cabal, setup-dep == 2.* diff --git a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/repo/setup-dep-1.0/setup-dep.cabal b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/repo/setup-dep-1.0/setup-dep.cabal index 7e3e890b092..0a8ee4af5b0 100644 --- a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/repo/setup-dep-1.0/setup-dep.cabal +++ b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/repo/setup-dep-1.0/setup-dep.cabal @@ -1,7 +1,7 @@ name: setup-dep version: 1.0 build-type: Simple -cabal-version: >= 1.20 +cabal-version: 1.20 library build-depends: base diff --git a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/setup-dep/setup-dep.cabal b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/setup-dep/setup-dep.cabal index 47910b2eed7..6cfa8c075fd 100644 --- a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/setup-dep/setup-dep.cabal +++ b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/setup-dep/setup-dep.cabal @@ -1,7 +1,7 @@ name: setup-dep version: 2.0 build-type: Simple -cabal-version: >= 1.20 +cabal-version: 1.20 library build-depends: base diff --git a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/use-local-package-as-setup-dep.out b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/use-local-package-as-setup-dep.out index 482ff118031..de46b91c396 100644 --- a/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/use-local-package-as-setup-dep.out +++ b/cabal-testsuite/PackageTests/BuildTargets/UseLocalPackageForSetup/use-local-package-as-setup-dep.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/BuildToolDepends/setup.out b/cabal-testsuite/PackageTests/BuildToolDepends/setup.out index 9a873303de8..1c2bd108bca 100644 --- a/cabal-testsuite/PackageTests/BuildToolDepends/setup.out +++ b/cabal-testsuite/PackageTests/BuildToolDepends/setup.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/BuildToolPaths/cabal.test.hs b/cabal-testsuite/PackageTests/BuildToolPaths/cabal.test.hs index 60df6ca1ac2..dc2559eb12f 100644 --- a/cabal-testsuite/PackageTests/BuildToolPaths/cabal.test.hs +++ b/cabal-testsuite/PackageTests/BuildToolPaths/cabal.test.hs @@ -10,16 +10,19 @@ main = cabalTest $ do -- shipped with a version of Cabal with SetupHooks). -- Ever since 716b109c4ae908458b16af5d75c233c7d9fdfc06, we use --intree-cabal-lib in -- CI, so we should always take the "Just" case which actually runs the test. + -- + -- NB: be sure to use v2 commands, as otherwise the testsuite driver will not + -- pass --package-db flags. Nothing -> skip "Cabal-hooks library unavailable." - Just pkgdb -> recordMode DoNotRecord $ do + Just _pkgdb -> recordMode DoNotRecord $ do -- At build-time: -- -- - in a pre-build hook -- - in a Template Haskell splice - cabal "build" [ "all", "--enable-tests", "--enable-benchmarks", "--package-db=" ++ pkgdb ] + cabal "v2-build" [ "all", "--enable-tests", "--enable-benchmarks"] -- At runtime of a test-suite - cabal "test" [ "pbts", "--package-db=" ++ pkgdb ] + cabal "v2-test" [ "pbts" ] -- At runtime of a benchmark - cabal "bench" [ "pbts", "--package-db=" ++ pkgdb ] + cabal "v2-bench" [ "pbts" ] -- At runtime of an executable - cabal "run" [ "pbts-exe", "--package-db=" ++ pkgdb ] + cabal "v2-run" [ "pbts-exe" ] diff --git a/cabal-testsuite/PackageTests/BuildToolPaths/pbts/SetupHooks.hs b/cabal-testsuite/PackageTests/BuildToolPaths/pbts/SetupHooks.hs index 1386a6ad3c2..478d7af2f5d 100644 --- a/cabal-testsuite/PackageTests/BuildToolPaths/pbts/SetupHooks.hs +++ b/cabal-testsuite/PackageTests/BuildToolPaths/pbts/SetupHooks.hs @@ -38,15 +38,12 @@ import Distribution.Types.Component import Distribution.Types.LocalBuildInfo ( withPrograms ) import Distribution.Utils.Path - ( SymbolicPath, FileOrDir(Dir), CWD, Pkg - , getSymbolicPath, moduleNameSymbolicPath - ) import Distribution.Utils.ShortText ( toShortText ) -- filepath import System.FilePath - ( (), replaceExtension, takeDirectory, takeExtension ) + ( takeExtension ) -------------------------------------------------------------------------------- @@ -120,7 +117,7 @@ preBuildRules Just ( base, rel ) -> return $ Just - ( md, ( getSymbolicPath base, getSymbolicPath rel ) ) + ( md, Location base rel ) Nothing -> return Nothing let ppMods = catMaybes ppMbMods @@ -131,23 +128,27 @@ preBuildRules -- above search (it would be nice to be able to use findFileWithExtensionMonitored). -- 5. Declare a rule for each custom-pp module that runs the pre-processor. - for_ ppMods $ \ ( md, inputLoc@( _inputBaseDir, inputRelPath ) ) -> do - let ext = takeExtension inputRelPath + for_ ppMods $ \ ( md, inputLoc@(Location _inputBaseDir inputRelPath ) ) -> do + let ext = takeExtension $ getSymbolicPath inputRelPath customPp = case ext of ".hs-pp1" -> customPp1 ".hs-pp2" -> customPp2 _ -> error $ "internal error: unhandled extension " ++ ext - outputBaseLoc = getSymbolicPath $ autogenComponentModulesDir lbi clbi - outputLoc = ( outputBaseLoc, replaceExtension inputRelPath "hs" ) + outputBaseLoc = autogenComponentModulesDir lbi clbi + outputLoc = + Location + outputBaseLoc + ( unsafeCoerceSymbolicPath $ replaceExtensionSymbolicPath inputRelPath "hs" ) registerRule_ ( toShortText $ show md ) $ staticRule ( ppCmd customPp inputLoc outputLoc ) [] ( outputLoc NE.:| [] ) ppModule :: ( Verbosity, Maybe (SymbolicPath CWD (Dir Pkg)), ConfiguredProgram, Location, Location ) -> IO () -ppModule ( verbosity, mbWorkDir, customPp, ( inputBaseDir, inputRelPath ), ( outputBaseDir, outputRelPath ) ) = do - let inputPath = inputBaseDir inputRelPath - outputPath = outputBaseDir outputRelPath - createDirectoryIfMissingVerbose verbosity True $ takeDirectory outputPath - runProgramCwd verbosity mbWorkDir customPp [ inputPath, outputPath ] +ppModule ( verbosity, mbWorkDir, customPp, inputLoc, outputLoc ) = do + let inputPath = location inputLoc + outputPath = location outputLoc + createDirectoryIfMissingVerbose verbosity True $ + interpretSymbolicPath mbWorkDir (takeDirectorySymbolicPath outputPath) + runProgramCwd verbosity mbWorkDir customPp [ getSymbolicPath inputPath, getSymbolicPath outputPath ] componentModules :: Component -> [ ModuleName ] componentModules comp = libMods ++ otherModules ( componentBuildInfo comp ) diff --git a/cabal-testsuite/PackageTests/BuildTools/External/cabal.out b/cabal-testsuite/PackageTests/BuildTools/External/cabal.out index b61bf0f1886..8fee1586cdc 100644 --- a/cabal-testsuite/PackageTests/BuildTools/External/cabal.out +++ b/cabal-testsuite/PackageTests/BuildTools/External/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/BuildTools/Foreign/A.hs b/cabal-testsuite/PackageTests/BuildTools/Foreign/A.hs index eae7f4476f3..45fc0ecfe9e 100644 --- a/cabal-testsuite/PackageTests/BuildTools/Foreign/A.hs +++ b/cabal-testsuite/PackageTests/BuildTools/Foreign/A.hs @@ -1,4 +1,9 @@ +{-# LANGUAGE CPP #-} +#if mingw32_HOST_OS +{-# OPTIONS_GHC -F -pgmF my-foreign-preprocessor.bat #-} +#else {-# OPTIONS_GHC -F -pgmF my-foreign-preprocessor #-} +#endif module A where a :: String diff --git a/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.bat b/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.bat new file mode 100644 index 00000000000..51e58f1b40c --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.bat @@ -0,0 +1,2 @@ +echo @off +pwsh my-foreign-preprocessor.ps1 %1 %2 %3 diff --git a/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.ps1 b/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.ps1 new file mode 100644 index 00000000000..1bb89bcc1b8 --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildTools/Foreign/my-foreign-preprocessor.ps1 @@ -0,0 +1 @@ +get-content $args[1] | %{$_ -replace "0","1"} > $args[2] diff --git a/cabal-testsuite/PackageTests/BuildTools/Foreign/setup.test.hs b/cabal-testsuite/PackageTests/BuildTools/Foreign/setup.test.hs index 9860683f7b0..b698f579f93 100644 --- a/cabal-testsuite/PackageTests/BuildTools/Foreign/setup.test.hs +++ b/cabal-testsuite/PackageTests/BuildTools/Foreign/setup.test.hs @@ -5,9 +5,7 @@ import Control.Monad.IO.Class import System.Environment -- Test PATH-munging --- TODO: Enable this test on Windows main = setupAndCabalTest $ do - skipIfWindows path <- liftIO $ getEnv "PATH" cwd <- testCurrentDir <$> getTestEnv r <- withEnv [("PATH", Just $ cwd ++ ":" ++ path)] $ setup_build [] diff --git a/cabal-testsuite/PackageTests/BuildTools/Internal/cabal.out b/cabal-testsuite/PackageTests/BuildTools/Internal/cabal.out index 37cab90e663..73d2639a82f 100644 --- a/cabal-testsuite/PackageTests/BuildTools/Internal/cabal.out +++ b/cabal-testsuite/PackageTests/BuildTools/Internal/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/BuildWays/p/CHANGELOG.md b/cabal-testsuite/PackageTests/BuildWays/p/CHANGELOG.md new file mode 100644 index 00000000000..9ede8b27d4f --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildWays/p/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for p + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/BuildWays/p/p.cabal b/cabal-testsuite/PackageTests/BuildWays/p/p.cabal new file mode 100644 index 00000000000..687cf16bc0c --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildWays/p/p.cabal @@ -0,0 +1,18 @@ +cabal-version: 3.12 +name: p +version: 0.1.0.0 +license: NONE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +build-type: Simple +extra-doc-files: CHANGELOG.md + +common warnings + ghc-options: -Wall + +library + import: warnings + exposed-modules: MyLib + build-depends: base + hs-source-dirs: src + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/BuildWays/p/src/MyLib.hs b/cabal-testsuite/PackageTests/BuildWays/p/src/MyLib.hs new file mode 100644 index 00000000000..e657c4403f6 --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildWays/p/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib (someFunc) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" diff --git a/cabal-testsuite/PackageTests/BuildWays/q/CHANGELOG.md b/cabal-testsuite/PackageTests/BuildWays/q/CHANGELOG.md new file mode 100644 index 00000000000..62632c53766 --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildWays/q/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for q + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/BuildWays/q/app/Main.hs b/cabal-testsuite/PackageTests/BuildWays/q/app/Main.hs new file mode 100644 index 00000000000..642b418a547 --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildWays/q/app/Main.hs @@ -0,0 +1,7 @@ +{-# LANGUAGE TemplateHaskell #-} +module Main where + +import MyLib + +main :: IO () +main = someFunc diff --git a/cabal-testsuite/PackageTests/BuildWays/q/q.cabal b/cabal-testsuite/PackageTests/BuildWays/q/q.cabal new file mode 100644 index 00000000000..a4f2a1d65d7 --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildWays/q/q.cabal @@ -0,0 +1,19 @@ +cabal-version: 3.12 +name: q +version: 0.1.0.0 +license: NONE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +build-type: Simple +extra-doc-files: CHANGELOG.md + +common warnings + ghc-options: -Wall + +executable q + import: warnings + main-is: Main.hs + build-depends: p, base + hs-source-dirs: app + ghc-options: -dynamic-too + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/BuildWays/setup.test.hs b/cabal-testsuite/PackageTests/BuildWays/setup.test.hs new file mode 100644 index 00000000000..dd4531599e4 --- /dev/null +++ b/cabal-testsuite/PackageTests/BuildWays/setup.test.hs @@ -0,0 +1,10 @@ +import Test.Cabal.Prelude + +opts = ["--enable-shared", "--enable-library-vanilla", "--enable-library-profiling"] + +-- See #10418 +main = setupTest $ recordMode DoNotRecord $ withPackageDb $ do + skipIfNoSharedLibraries + skipIfNoProfiledLibraries + withDirectory "p" $ setup_install opts + withDirectory "q" $ setup_install opts diff --git a/cabal-testsuite/PackageTests/CCompilerOverride/custom-cc-clang.bat b/cabal-testsuite/PackageTests/CCompilerOverride/custom-cc-clang.bat index a2e60a9c592..63221f54528 100644 --- a/cabal-testsuite/PackageTests/CCompilerOverride/custom-cc-clang.bat +++ b/cabal-testsuite/PackageTests/CCompilerOverride/custom-cc-clang.bat @@ -1,11 +1,7 @@ @echo OFF -where /q clang.exe - -IF %ERRORLEVEL% EQU 0 ( - call clang.exe -DNOERROR6 %* - EXIT /B %ERRORLEVEL% -) - -ECHO "Cannot find C compiler" -EXIT /B 1 +REM replace the libdir with the path to the compiler +FOR /f "delims=" %%A in ('call ghc.exe --print-libdir') do set "var=%%A" +setlocal EnableDelayedExpansion +CALL !var:lib=mingw\bin\clang.exe! -DNOERROR6 %* +EXIT /B %ERRORLEVEL% diff --git a/cabal-testsuite/PackageTests/CCompilerOverride/custom-cc.bat b/cabal-testsuite/PackageTests/CCompilerOverride/custom-cc.bat index 504f6b800cd..560845174d8 100644 --- a/cabal-testsuite/PackageTests/CCompilerOverride/custom-cc.bat +++ b/cabal-testsuite/PackageTests/CCompilerOverride/custom-cc.bat @@ -1,11 +1,7 @@ @echo OFF -where /q gcc.exe - -IF %ERRORLEVEL% EQU 0 ( - call gcc.exe -DNOERROR6 %* - EXIT /B %ERRORLEVEL% -) - -ECHO "Cannot find C compiler" -EXIT /B 1 +REM replace the libdir with the path to the compiler +FOR /f "delims=" %%A in ('call ghc.exe --print-libdir') do set "var=%%A" +setlocal EnableDelayedExpansion +CALL !var:lib=mingw\bin\gcc.exe! -DNOERROR6 %* +EXIT /B %ERRORLEVEL% diff --git a/cabal-testsuite/PackageTests/CCompilerOverride/foo.c b/cabal-testsuite/PackageTests/CCompilerOverride/foo.c index 30892bef07e..03ddd01e14b 100644 --- a/cabal-testsuite/PackageTests/CCompilerOverride/foo.c +++ b/cabal-testsuite/PackageTests/CCompilerOverride/foo.c @@ -1,16 +1,8 @@ -#ifndef NOERROR1 -#error "NOERROR1 was not passed" -#endif - #ifndef NOERROR2 #error "NOERROR2 was not passed" #endif -#ifndef NOERROR3 -#error "NOERROR3 was not passed" -#endif - #ifndef NOERROR4 #error "NOERROR4 was not passed" #endif diff --git a/cabal-testsuite/PackageTests/CCompilerOverride/my.cabal b/cabal-testsuite/PackageTests/CCompilerOverride/my.cabal index 31a79f93a60..14772f3894f 100644 --- a/cabal-testsuite/PackageTests/CCompilerOverride/my.cabal +++ b/cabal-testsuite/PackageTests/CCompilerOverride/my.cabal @@ -9,5 +9,5 @@ executable foo main-is: Main.hs c-sources: foo.c build-depends: base - ghc-options: -DNOERROR4 + ghc-options: -optc=-DNOERROR4 cc-options: -DNOERROR5 -march=native diff --git a/cabal-testsuite/PackageTests/CCompilerOverride/setup.cabal.out b/cabal-testsuite/PackageTests/CCompilerOverride/setup.cabal.out index 21981fd9b76..6d0c3265de9 100644 --- a/cabal-testsuite/PackageTests/CCompilerOverride/setup.cabal.out +++ b/cabal-testsuite/PackageTests/CCompilerOverride/setup.cabal.out @@ -1,4 +1,3 @@ # Setup configure Configuring my-0.1... -Warning: [misplaced-c-opt] Instead of 'ghc-options: -DNOERROR4' use 'cpp-options: -DNOERROR4' # Setup build diff --git a/cabal-testsuite/PackageTests/CCompilerOverride/setup.out b/cabal-testsuite/PackageTests/CCompilerOverride/setup.out index 21981fd9b76..6d0c3265de9 100644 --- a/cabal-testsuite/PackageTests/CCompilerOverride/setup.out +++ b/cabal-testsuite/PackageTests/CCompilerOverride/setup.out @@ -1,4 +1,3 @@ # Setup configure Configuring my-0.1... -Warning: [misplaced-c-opt] Instead of 'ghc-options: -DNOERROR4' use 'cpp-options: -DNOERROR4' # Setup build diff --git a/cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs b/cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs index 5843cb2b7df..7cdb7c75287 100644 --- a/cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs +++ b/cabal-testsuite/PackageTests/CCompilerOverride/setup.test.hs @@ -3,20 +3,21 @@ import Test.Cabal.Prelude -- Test that all the respective defines -DNOERROR... specified in various ways -- all end up routed to the C compiler. Otherwise the C file we depend on will -- not compile. +-- +-- This has been largely gutted, as ghc 9.10 no longer passes through most +-- of the defines we were testing; see +-- https://gitlab.haskell.org/ghc/ghc/-/commit/8ff3134ed4aa323b0199ad683f72165e51a59ab6 main = setupAndCabalTest $ do skipUnlessGhcVersion ">= 8.8" - isWin <- isWindows ghc94 <- isGhcVersion ">= 9.4.1" env <- getTestEnv let pwd = testCurrentDir env win_suffix = if ghc94 then "-clang.bat" else ".bat" customCC = - pwd ++ "/custom-cc" ++ if isWin then win_suffix else "" + pwd ++ "/custom-cc" ++ if isWindows then win_suffix else "" setup "configure" - [ "--ghc-option=-DNOERROR1" - , "--ghc-option=-optc=-DNOERROR2" - , "--ghc-option=-optP=-DNOERROR3" + [ "--ghc-option=-optc=-DNOERROR2" , "--with-gcc=" ++ customCC ] setup "build" ["-v2"] diff --git a/cabal-testsuite/PackageTests/CustomDep/client/Setup.hs b/cabal-testsuite/PackageTests/CMain/10168/Setup.hs similarity index 100% rename from cabal-testsuite/PackageTests/CustomDep/client/Setup.hs rename to cabal-testsuite/PackageTests/CMain/10168/Setup.hs diff --git a/cabal-testsuite/PackageTests/CMain/10168/app/Main.hs b/cabal-testsuite/PackageTests/CMain/10168/app/Main.hs new file mode 100644 index 00000000000..718f1d5a74c --- /dev/null +++ b/cabal-testsuite/PackageTests/CMain/10168/app/Main.hs @@ -0,0 +1,6 @@ +module Main ( main ) where + +import Lib ( myMax ) + +main :: IO () +main = print $ myMax 10 100 diff --git a/cabal-testsuite/PackageTests/CMain/10168/c-app/main.c b/cabal-testsuite/PackageTests/CMain/10168/c-app/main.c new file mode 100644 index 00000000000..2cf1d456e33 --- /dev/null +++ b/cabal-testsuite/PackageTests/CMain/10168/c-app/main.c @@ -0,0 +1,12 @@ +#include +#include +#ifdef __GLASGOW_HASKELL__ +#include "Lib_stub.h" +#endif + +int main(int argc, char *argv[]) { + hs_init(&argc, &argv); + printf("%lld\n", myMax(10,100)); + hs_exit(); + return 0; +} diff --git a/cabal-testsuite/PackageTests/CMain/10168/haskell-c-tests.cabal b/cabal-testsuite/PackageTests/CMain/10168/haskell-c-tests.cabal new file mode 100644 index 00000000000..9f5f9e1dff2 --- /dev/null +++ b/cabal-testsuite/PackageTests/CMain/10168/haskell-c-tests.cabal @@ -0,0 +1,27 @@ +cabal-version: 2.0 + +name: haskell-c-tests +version: 0.1.0.0 +build-type: Simple + +library + exposed-modules: Lib + hs-source-dirs: src + ghc-options: -stubdir autogen-stubs + build-depends: base + default-language: Haskell2010 + +executable c-exe + main-is: main.c + hs-source-dirs: c-app + ghc-options: -no-hs-main + include-dirs: autogen-stubs + build-depends: base, haskell-c-tests + default-language: Haskell2010 + +executable haskell-exe + main-is: Main.hs + hs-source-dirs: app + ghc-options: -threaded -rtsopts -with-rtsopts=-N + build-depends: base, haskell-c-tests + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/CMain/10168/setup.out b/cabal-testsuite/PackageTests/CMain/10168/setup.out new file mode 100644 index 00000000000..bb075774c77 --- /dev/null +++ b/cabal-testsuite/PackageTests/CMain/10168/setup.out @@ -0,0 +1,10 @@ +# Setup configure +Configuring haskell-c-tests-0.1.0.0... +Warning: [unknown-directory] 'include-dirs: autogen-stubs' specifies a directory which does not exist. +# Setup build +Preprocessing library for haskell-c-tests-0.1.0.0... +Building library for haskell-c-tests-0.1.0.0... +Preprocessing executable 'c-exe' for haskell-c-tests-0.1.0.0... +Building executable 'c-exe' for haskell-c-tests-0.1.0.0... +Preprocessing executable 'haskell-exe' for haskell-c-tests-0.1.0.0... +Building executable 'haskell-exe' for haskell-c-tests-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/CMain/10168/setup.test.hs b/cabal-testsuite/PackageTests/CMain/10168/setup.test.hs new file mode 100644 index 00000000000..bcefa0b29be --- /dev/null +++ b/cabal-testsuite/PackageTests/CMain/10168/setup.test.hs @@ -0,0 +1,7 @@ +import Test.Cabal.Prelude +-- Test building an executable whose main-is is a C source found in the hs-source-dirs. +-- It is a bit counter intuitive that we look for non-haskell sources in +-- `hs-source-dirs`, but that is a behaviour that users rely on (see #10168) +-- and there's no good reason to break it. +main = setupTest $ do + setup_build [] diff --git a/cabal-testsuite/PackageTests/CMain/10168/src/Lib.hs b/cabal-testsuite/PackageTests/CMain/10168/src/Lib.hs new file mode 100644 index 00000000000..ba1bcce7ab9 --- /dev/null +++ b/cabal-testsuite/PackageTests/CMain/10168/src/Lib.hs @@ -0,0 +1,6 @@ +module Lib ( myMax ) where + +myMax :: Int -> Int -> Int +myMax x1 x2 = if x1 > x2 then x1 else x2 + +foreign export ccall myMax :: Int -> Int -> Int diff --git a/cabal-testsuite/PackageTests/CMain/Bar.hs b/cabal-testsuite/PackageTests/CMain/Simple/Bar.hs similarity index 100% rename from cabal-testsuite/PackageTests/CMain/Bar.hs rename to cabal-testsuite/PackageTests/CMain/Simple/Bar.hs diff --git a/cabal-testsuite/PackageTests/CMain/foo.c b/cabal-testsuite/PackageTests/CMain/Simple/foo.c similarity index 100% rename from cabal-testsuite/PackageTests/CMain/foo.c rename to cabal-testsuite/PackageTests/CMain/Simple/foo.c diff --git a/cabal-testsuite/PackageTests/CMain/my.cabal b/cabal-testsuite/PackageTests/CMain/Simple/my.cabal similarity index 100% rename from cabal-testsuite/PackageTests/CMain/my.cabal rename to cabal-testsuite/PackageTests/CMain/Simple/my.cabal diff --git a/cabal-testsuite/PackageTests/CMain/setup.cabal.out b/cabal-testsuite/PackageTests/CMain/Simple/setup.cabal.out similarity index 100% rename from cabal-testsuite/PackageTests/CMain/setup.cabal.out rename to cabal-testsuite/PackageTests/CMain/Simple/setup.cabal.out diff --git a/cabal-testsuite/PackageTests/CMain/setup.out b/cabal-testsuite/PackageTests/CMain/Simple/setup.out similarity index 100% rename from cabal-testsuite/PackageTests/CMain/setup.out rename to cabal-testsuite/PackageTests/CMain/Simple/setup.out diff --git a/cabal-testsuite/PackageTests/CMain/setup.test.hs b/cabal-testsuite/PackageTests/CMain/Simple/setup.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/CMain/setup.test.hs rename to cabal-testsuite/PackageTests/CMain/Simple/setup.test.hs diff --git a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ImpossibleVersionRangeLib/cabal.out b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ImpossibleVersionRangeLib/cabal.out index c037b09c0f5..37bb62112ca 100644 --- a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ImpossibleVersionRangeLib/cabal.out +++ b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ImpossibleVersionRangeLib/cabal.out @@ -1,4 +1,4 @@ # cabal check The package will not build sanely due to these errors: -Error: [impossible-dep] The package has an impossible version range for a dependency on an internal library: pkg:internal >1.0 && <2.0. This version range does not include the current package, and must be removed as the current package's library will always be used. +Error: [impossible-dep] The package has an impossible version range for a dependency on an internal library: pkg:internal >=1.0 && <2. This version range does not include the current package, and must be removed as the current package's library will always be used. Error: Hackage would reject this package. diff --git a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ImpossibleVersionRangeLib/pkg.cabal b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ImpossibleVersionRangeLib/pkg.cabal index ffebdd5ee04..64165ade3cb 100644 --- a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ImpossibleVersionRangeLib/pkg.cabal +++ b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Fields/ImpossibleVersionRangeLib/pkg.cabal @@ -10,7 +10,7 @@ license: GPL-3.0-or-later library exposed-modules: Module build-depends: base == 4.*, - internal > 1.0 && < 2.0 + internal >= 1.0 && < 2 default-language: Haskell2010 library internal diff --git a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/AbsolutePath/cabal.out b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/AbsolutePath/cabal.out index 562f6f4d4f7..8fa0a5d985b 100644 --- a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/AbsolutePath/cabal.out +++ b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/AbsolutePath/cabal.out @@ -1,6 +1,6 @@ # cabal check These warnings may cause trouble when distributing the package: -Warning: [glob-missing-dir] In 'extra-source-files': the pattern '/home/user/file' attempts to match files in the directory '/home/user', but there is no directory by that name. +Warning: [no-glob-match] In 'extra-source-files': the pattern '/home/user/file' does not match any files. The following errors will cause portability problems on other environments: Error: [absolute-path] 'extra-source-files: /home/user/file' specifies an absolute path, but the 'extra-source-files' field must use relative paths. Error: [malformed-relative-path] 'extra-source-files: /home/user/file' is not a good relative path: "posix absolute path" diff --git a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/InvalidWin/cabal.test.hs b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/InvalidWin/cabal.test.hs index 2201d7c73dc..12398950ed9 100644 --- a/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/InvalidWin/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Check/ConfiguredPackage/Paths/InvalidWin/cabal.test.hs @@ -3,11 +3,12 @@ import Test.Cabal.Prelude import System.Directory (createDirectoryIfMissing) -- Invalid Windows filepath. -main = cabalTest $ do - skipIfWindows - cwd <- testCurrentDir <$> getTestEnv - liftIO $ createDirectoryIfMissing False $ cwd "n?ul" - liftIO $ writeFile (cwd "n?ul" "test.a") "" - -- A directory named like `n?ul` on Windows will make external - -- tools like git — and hence the whole testsuite — error. - fails $ cabal "check" [] +main = do + -- A directory named like `n?ul` on Windows will make external + -- tools like git — and hence the whole testsuite — error. + skipIfWindows "uninteresting" + cabalTest $ do + cwd <- testCurrentDir <$> getTestEnv + liftIO $ createDirectoryIfMissing False $ cwd "n?ul" + liftIO $ writeFile (cwd "n?ul" "test.a") "" + fails $ cabal "check" [] diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersions/cabal.out b/cabal-testsuite/PackageTests/Check/DepVersionRange/BaseDep/cabal.out similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersions/cabal.out rename to cabal-testsuite/PackageTests/Check/DepVersionRange/BaseDep/cabal.out diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersions/cabal.test.hs b/cabal-testsuite/PackageTests/Check/DepVersionRange/BaseDep/cabal.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersions/cabal.test.hs rename to cabal-testsuite/PackageTests/Check/DepVersionRange/BaseDep/cabal.test.hs diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersions/pkg.cabal b/cabal-testsuite/PackageTests/Check/DepVersionRange/BaseDep/pkg.cabal similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersions/pkg.cabal rename to cabal-testsuite/PackageTests/Check/DepVersionRange/BaseDep/pkg.cabal diff --git a/cabal-testsuite/PackageTests/Check/DepVersionRange/CustomSetupBaseDep/Setup.hs b/cabal-testsuite/PackageTests/Check/DepVersionRange/CustomSetupBaseDep/Setup.hs new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/cabal.out b/cabal-testsuite/PackageTests/Check/DepVersionRange/CustomSetupBaseDep/cabal.out similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/cabal.out rename to cabal-testsuite/PackageTests/Check/DepVersionRange/CustomSetupBaseDep/cabal.out diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/cabal.test.hs b/cabal-testsuite/PackageTests/Check/DepVersionRange/CustomSetupBaseDep/cabal.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/cabal.test.hs rename to cabal-testsuite/PackageTests/Check/DepVersionRange/CustomSetupBaseDep/cabal.test.hs diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/pkg.cabal b/cabal-testsuite/PackageTests/Check/DepVersionRange/CustomSetupBaseDep/pkg.cabal similarity index 90% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/pkg.cabal rename to cabal-testsuite/PackageTests/Check/DepVersionRange/CustomSetupBaseDep/pkg.cabal index 1c184cb17d4..3aa5c161924 100644 --- a/cabal-testsuite/PackageTests/Check/NonConfCheck/SetupBounds/pkg.cabal +++ b/cabal-testsuite/PackageTests/Check/DepVersionRange/CustomSetupBaseDep/pkg.cabal @@ -9,7 +9,7 @@ maintainer: none@example.com license: GPL-3.0-or-later custom-setup - setup-depends: base > 1 + setup-depends: base >= 1 library exposed-modules: Foo diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsLibInt/cabal.out b/cabal-testsuite/PackageTests/Check/DepVersionRange/InternalLibDep/cabal.out similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsLibInt/cabal.out rename to cabal-testsuite/PackageTests/Check/DepVersionRange/InternalLibDep/cabal.out diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsLibInt/cabal.test.hs b/cabal-testsuite/PackageTests/Check/DepVersionRange/InternalLibDep/cabal.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsLibInt/cabal.test.hs rename to cabal-testsuite/PackageTests/Check/DepVersionRange/InternalLibDep/cabal.test.hs diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsLibInt/pkg.cabal b/cabal-testsuite/PackageTests/Check/DepVersionRange/InternalLibDep/pkg.cabal similarity index 84% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsLibInt/pkg.cabal rename to cabal-testsuite/PackageTests/Check/DepVersionRange/InternalLibDep/pkg.cabal index 3d5b861f059..a4e0eecab0d 100644 --- a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsLibInt/pkg.cabal +++ b/cabal-testsuite/PackageTests/Check/DepVersionRange/InternalLibDep/pkg.cabal @@ -9,12 +9,12 @@ license: GPL-3.0-or-later library exposed-modules: Foo - build-depends: base <= 3.10, + build-depends: base < 3.10, int-lib default-language: Haskell2010 library int-lib exposed-modules: Bar - build-depends: text > 1 + build-depends: text >= 1 default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternalSimple/cabal.out b/cabal-testsuite/PackageTests/Check/DepVersionRange/UnboundedInternalDep/cabal.out similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternalSimple/cabal.out rename to cabal-testsuite/PackageTests/Check/DepVersionRange/UnboundedInternalDep/cabal.out diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternalSimple/cabal.test.hs b/cabal-testsuite/PackageTests/Check/DepVersionRange/UnboundedInternalDep/cabal.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternalSimple/cabal.test.hs rename to cabal-testsuite/PackageTests/Check/DepVersionRange/UnboundedInternalDep/cabal.test.hs diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternalSimple/pkg.cabal b/cabal-testsuite/PackageTests/Check/DepVersionRange/UnboundedInternalDep/pkg.cabal similarity index 92% rename from cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternalSimple/pkg.cabal rename to cabal-testsuite/PackageTests/Check/DepVersionRange/UnboundedInternalDep/pkg.cabal index 06c47e49740..eb60e1c4472 100644 --- a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternalSimple/pkg.cabal +++ b/cabal-testsuite/PackageTests/Check/DepVersionRange/UnboundedInternalDep/pkg.cabal @@ -9,7 +9,7 @@ license: GPL-3.0-or-later library exposed-modules: Foo - build-depends: text < 5.0 + build-depends: text < 5 default-language: Haskell2010 executable prova diff --git a/cabal-testsuite/PackageTests/Check/DepVersionRange/VersionConstraintOperators/cabal.out b/cabal-testsuite/PackageTests/Check/DepVersionRange/VersionConstraintOperators/cabal.out new file mode 100644 index 00000000000..e566ffae18a --- /dev/null +++ b/cabal-testsuite/PackageTests/Check/DepVersionRange/VersionConstraintOperators/cabal.out @@ -0,0 +1,18 @@ +# cabal check +These warnings may cause trouble when distributing the package: +Warning: [missing-upper-bounds] On library, these packages miss upper bounds: + - missing-upper + - exclusive-minimums-missing-upper + - or-exclusive-minimums-missing-upper + - or-inclusive-maximums-missing-upper +Please add them. There is more information at https://pvp.haskell.org/ +Warning: [le-upper-bounds] On library, these packages have less than or equals (<=) upper bounds: + - inclusive-maximums + - and-inclusive-maximums + - or-inclusive-maximums-missing-upper +Please use less than (<) for upper bounds. +Warning: [gt-lower-bounds] On library, these packages have greater than (>) lower bounds: + - exclusive-minimums-missing-upper + - and-exclusive-minimums + - or-exclusive-minimums-missing-upper +Please use greater than or equals (>=) for lower bounds. diff --git a/cabal-testsuite/PackageTests/Check/DepVersionRange/VersionConstraintOperators/cabal.test.hs b/cabal-testsuite/PackageTests/Check/DepVersionRange/VersionConstraintOperators/cabal.test.hs new file mode 100644 index 00000000000..60a32cb7374 --- /dev/null +++ b/cabal-testsuite/PackageTests/Check/DepVersionRange/VersionConstraintOperators/cabal.test.hs @@ -0,0 +1,4 @@ +import Test.Cabal.Prelude + +main = cabalTest $ + cabal "check" [] diff --git a/cabal-testsuite/PackageTests/Check/DepVersionRange/VersionConstraintOperators/pkg.cabal b/cabal-testsuite/PackageTests/Check/DepVersionRange/VersionConstraintOperators/pkg.cabal new file mode 100644 index 00000000000..f8fc673e14c --- /dev/null +++ b/cabal-testsuite/PackageTests/Check/DepVersionRange/VersionConstraintOperators/pkg.cabal @@ -0,0 +1,25 @@ +cabal-version: 3.0 +name: pkg +synopsis: synopsis +description: description +version: 0 +category: example +maintainer: none@example.com +license: GPL-3.0-or-later + +library + exposed-modules: Foo + default-language: Haskell2010 + build-depends: + , base ^>= 4.20.0.0 + + , missing-upper >= 0 + , missing-lower < 1 + + , exclusive-minimums-missing-upper > 0 + , and-exclusive-minimums > 0 && < 1 + , or-exclusive-minimums-missing-upper > 0 || < 1 + + , inclusive-maximums <= 1 + , and-inclusive-maximums >= 0 && <= 1 + , or-inclusive-maximums-missing-upper >= 0 || <= 1 diff --git a/cabal-testsuite/PackageTests/Check/GitProtocol/cabal.out b/cabal-testsuite/PackageTests/Check/GitProtocol/cabal.out new file mode 100644 index 00000000000..eb61b32ab3e --- /dev/null +++ b/cabal-testsuite/PackageTests/Check/GitProtocol/cabal.out @@ -0,0 +1,6 @@ +# cabal check +The following errors are likely to affect your build negatively: +Error: [git-protocol] Cloning over git:// might lead to an arbitrary code +execution vulnerability. Furthermore, popular forges like GitHub do not +support it. Use https:// or ssh:// instead. +Error: Hackage would reject this package. diff --git a/cabal-testsuite/PackageTests/Check/GitProtocol/cabal.test.hs b/cabal-testsuite/PackageTests/Check/GitProtocol/cabal.test.hs new file mode 100644 index 00000000000..d57f8e16590 --- /dev/null +++ b/cabal-testsuite/PackageTests/Check/GitProtocol/cabal.test.hs @@ -0,0 +1,3 @@ +import Test.Cabal.Prelude + +main = cabalTest $ fails $ cabal "check" [] diff --git a/cabal-testsuite/PackageTests/Check/GitProtocol/pkg.cabal b/cabal-testsuite/PackageTests/Check/GitProtocol/pkg.cabal new file mode 100644 index 00000000000..5622d522ac3 --- /dev/null +++ b/cabal-testsuite/PackageTests/Check/GitProtocol/pkg.cabal @@ -0,0 +1,16 @@ +cabal-version: 3.0 +name: pkg +version: 0 +category: example +maintainer: me@example.com +synopsis: small synopsis +description: longer description +license: GPL-3.0-only + +library + exposed-modules: Foo + default-language: Haskell2010 + +source-repository head + type: git + location: git://www.example.org/my-repo/ diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternal/pkg.cabal b/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternal/pkg.cabal index 91943d4987a..cbd71c314f5 100644 --- a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternal/pkg.cabal +++ b/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsInternal/pkg.cabal @@ -10,7 +10,7 @@ license: GPL-3.0-or-later library exposed-modules: Foo default-language: Haskell2010 - build-depends: base <= 3.10 + build-depends: base < 3.10 executable test-exe main-is: Main.hs diff --git a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsStraddle/pkg.cabal b/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsStraddle/pkg.cabal index b21ffe61f12..37d3948e696 100644 --- a/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsStraddle/pkg.cabal +++ b/cabal-testsuite/PackageTests/Check/NonConfCheck/PackageVersionsStraddle/pkg.cabal @@ -10,6 +10,6 @@ license: GPL-3.0-or-later library exposed-modules: Foo default-language: Haskell2010 - build-depends: base > 2, - base <= 3.10 + build-depends: base >= 2, + base < 3.10 diff --git a/cabal-testsuite/PackageTests/CheckSetup/setup.test.hs b/cabal-testsuite/PackageTests/CheckSetup/setup.test.hs index 96ed4395785..67997e7e21b 100644 --- a/cabal-testsuite/PackageTests/CheckSetup/setup.test.hs +++ b/cabal-testsuite/PackageTests/CheckSetup/setup.test.hs @@ -13,8 +13,12 @@ main = cabalTest $ do "The dependency 'setup-depends: 'base' does not specify " ++ "an upper bound on the version number" + -- Replace line breaks with spaces in the haystack so that we can search + -- for a string that wraps lines. + let lineBreakBlind = needleHaystack{txHaystack = txContainsId{txFwd = lineBreaksToSpaces}} + -- Asserts for the desired check messages after configure. - assertOutputContains libError1 checkResult - assertOutputContains libError2 checkResult + assertOn lineBreakBlind libError1 checkResult + assertOn lineBreakBlind libError2 checkResult return () diff --git a/cabal-testsuite/PackageTests/CmmSources/cabal.out b/cabal-testsuite/PackageTests/CmmSources/cabal.out index 1664b64c7fc..f05bf7aa5a4 100644 --- a/cabal-testsuite/PackageTests/CmmSources/cabal.out +++ b/cabal-testsuite/PackageTests/CmmSources/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.out b/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.out index 1664b64c7fc..f05bf7aa5a4 100644 --- a/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.out +++ b/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs b/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs index ee8aa155ac2..0e39257c843 100644 --- a/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs +++ b/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs @@ -1,7 +1,7 @@ import Test.Cabal.Prelude main = cabalTest $ do - skipIfWindows + skipIfNoSharedLibraries res <- cabal' "v2-run" ["demo"] assertOutputContains "= Post common block elimination =" res assertOutputContains "In Box we have 0x" res diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/setup.test.hs b/cabal-testsuite/PackageTests/CmmSourcesDyn/setup.test.hs index 800a540696a..d0d9a11057c 100644 --- a/cabal-testsuite/PackageTests/CmmSourcesDyn/setup.test.hs +++ b/cabal-testsuite/PackageTests/CmmSourcesDyn/setup.test.hs @@ -1,7 +1,7 @@ import Test.Cabal.Prelude main = setupTest $ do - skipIf "ghc < 7.8" =<< isGhcVersion "< 7.8" + skipIfGhcVersion "< 7.8" setup "configure" [] res <- setup' "build" [] assertOutputContains "= Post common block elimination =" res diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/cabal.out b/cabal-testsuite/PackageTests/CmmSourcesExe/cabal.out index 77b94906515..8ad5a59bac4 100644 --- a/cabal-testsuite/PackageTests/CmmSourcesExe/cabal.out +++ b/cabal-testsuite/PackageTests/CmmSourcesExe/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-missing-package.expect.txt b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-missing-package.expect.txt new file mode 100644 index 00000000000..f81a82a6c73 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-missing-package.expect.txt @@ -0,0 +1,6 @@ +When using configuration from: + - cabal-missing-package.project + - missing/pkgs.config + - missing/pkgs/default.config +The following errors occurred: + - The package location 'pkg-doesnt-exist' does not exist. diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-missing-package.project b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-missing-package.project new file mode 100644 index 00000000000..136ebb028a2 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal-missing-package.project @@ -0,0 +1 @@ +import: missing/pkgs.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out index e14881e8581..fd408a95505 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.out @@ -1,6 +1,10 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-run +Configuration is affected by the following files: +- cabal.project +- extra.project + imported by: cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -62,6 +66,13 @@ cyclical import of cyclical-2-out-out-self-b.config; imported by: cyclical-2-out-out-self.project # checking that cyclical check doesn't false-positive on same file names in different folders; hoping within a folder and then into a subfolder # cabal v2-build +Configuration is affected by the following files: +- noncyclical-same-filename-a.project +- noncyclical-same-filename-a.config + imported by: noncyclical-same-filename-a.project +- same-filename/noncyclical-same-filename-a.config + imported by: noncyclical-same-filename-a.config + imported by: noncyclical-same-filename-a.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -71,6 +82,13 @@ Preprocessing library for my-0.1... Building library for my-0.1... # checking that cyclical check doesn't false-positive on same file names in different folders; hoping into a subfolder and then back out again # cabal v2-build +Configuration is affected by the following files: +- noncyclical-same-filename-b.project +- noncyclical-same-filename-b.config + imported by: same-filename/noncyclical-same-filename-b.config + imported by: noncyclical-same-filename-b.project +- same-filename/noncyclical-same-filename-b.config + imported by: noncyclical-same-filename-b.project Up to date # checking that cyclical check catches a same file name that imports itself # cabal v2-build @@ -101,9 +119,121 @@ cyclical import of cyclical-same-filename-out-out-back.config; imported by: cyclical-same-filename-out-out-back.project # checking that imports work skipping into a subfolder and then back out again and again # cabal v2-build +Configuration is affected by the following files: +- hops-0.project +- hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops-8.config + imported by: hops/hops-7.config + imported by: hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-1.config + imported by: hops-0.project +- hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-7.config + imported by: hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-9.config + imported by: hops-8.config + imported by: hops/hops-7.config + imported by: hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project Up to date # checking conflicting constraints skipping into a subfolder and then back out again and again # cabal v2-build +Configuration is affected by the following files: +- oops-0.project +- oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project +- oops-4.config + imported by: oops/oops-3.config + imported by: oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project +- oops-6.config + imported by: oops/oops-5.config + imported by: oops-4.config + imported by: oops/oops-3.config + imported by: oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project +- oops-8.config + imported by: oops/oops-7.config + imported by: oops-6.config + imported by: oops/oops-5.config + imported by: oops-4.config + imported by: oops/oops-3.config + imported by: oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project +- oops/oops-1.config + imported by: oops-0.project +- oops/oops-3.config + imported by: oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project +- oops/oops-5.config + imported by: oops-4.config + imported by: oops/oops-3.config + imported by: oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project +- oops/oops-7.config + imported by: oops-6.config + imported by: oops/oops-5.config + imported by: oops-4.config + imported by: oops/oops-3.config + imported by: oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project +- oops/oops-9.config + imported by: oops-8.config + imported by: oops/oops-7.config + imported by: oops-6.config + imported by: oops/oops-5.config + imported by: oops-4.config + imported by: oops/oops-3.config + imported by: oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: @@ -124,8 +254,135 @@ Could not resolve dependencies: (constraint from oops-0.project requires ==1.4.3.0) [__1] fail (backjumping, conflict set: hashable, oops) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), oops (2) +# checking if we detect when the same config is imported via many different paths (we don't) +# cabal v2-build +Configuration is affected by the following files: +- yops-0.project +- yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +- yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +- yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +- yops-6.config + imported by: yops/yops-5.config + imported by: yops-0.project +- yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +- yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +- yops-8.config + imported by: yops/yops-7.config + imported by: yops-0.project +- yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-0.project +- yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +- yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +- yops/yops-1.config + imported by: yops-0.project +- yops/yops-3.config + imported by: yops-0.project +- yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +- yops/yops-5.config + imported by: yops-0.project +- yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +- yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +- yops/yops-7.config + imported by: yops-0.project +- yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-0.project +- yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +- yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +- yops/yops-9.config + imported by: yops-0.project +- yops/yops-9.config + imported by: yops-8.config + imported by: yops/yops-7.config + imported by: yops-0.project +- yops/yops-9.config + imported by: yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-0.project +- yops/yops-9.config + imported by: yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-0.project +- yops/yops-9.config + imported by: yops-8.config + imported by: yops/yops-7.config + imported by: yops-6.config + imported by: yops/yops-5.config + imported by: yops-4.config + imported by: yops/yops-3.config + imported by: yops-2.config + imported by: yops/yops-1.config + imported by: yops-0.project +Up to date # checking bad conditional # cabal v2-build Error: [Cabal-7090] Error parsing project file /bad-conditional.project: Cannot set compiler in a conditional clause of a cabal project file +# checking that missing package message lists configuration provenance +# cabal v2-build diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs index 651658c441a..681865df2e5 100644 --- a/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/cabal.test.hs @@ -1,4 +1,7 @@ import Test.Cabal.Prelude +import Test.Cabal.OutputNormalizer +import Data.Function ((&)) +import Data.Functor ((<&>)) main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do let log = recordHeader . pure @@ -76,7 +79,7 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do -- +-- etc log "checking that cyclical check catches a same file name that imports itself" cyclical4a <- fails $ cabal' "v2-build" [ "--project-file=cyclical-same-filename-out-out-self.project" ] - assertOutputContains "cyclical import of same-filename/cyclical-same-filename-out-out-self.config" cyclical4a + assertOutputContains (normalizePathSeparators "cyclical import of same-filename/cyclical-same-filename-out-out-self.config") cyclical4a -- +-- cyclical-same-filename-out-out-backback.project -- +-- cyclical-same-filename-out-out-backback.config @@ -108,89 +111,9 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do -- +-- hops/hops-9.config (no further imports so not cyclical) log "checking that imports work skipping into a subfolder and then back out again and again" hopping <- cabal' "v2-build" [ "--project-file=hops-0.project" ] - assertOutputContains "this build was affected by the following (project) config files:" hopping - assertOutputContains "- hops-0.project" hopping - - assertOutputContains - "- hops-2.config \ - \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" - hopping - - assertOutputContains - "- hops-4.config \ - \ imported by: hops/hops-3.config \ - \ imported by: hops-2.config \ - \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" - hopping - - assertOutputContains - "- hops-6.config \ - \ imported by: hops/hops-5.config \ - \ imported by: hops-4.config \ - \ imported by: hops/hops-3.config \ - \ imported by: hops-2.config \ - \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" - hopping - - assertOutputContains - "- hops-8.config \ - \ imported by: hops/hops-7.config \ - \ imported by: hops-6.config \ - \ imported by: hops/hops-5.config \ - \ imported by: hops-4.config \ - \ imported by: hops/hops-3.config \ - \ imported by: hops-2.config \ - \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" - hopping - - assertOutputContains - "- hops/hops-1.config \ - \ imported by: hops-0.project" - hopping - - assertOutputContains - "- hops/hops-3.config \ - \ imported by: hops-2.config \ - \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" - hopping - - assertOutputContains - "- hops/hops-5.config \ - \ imported by: hops-4.config \ - \ imported by: hops/hops-3.config \ - \ imported by: hops-2.config \ - \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" - hopping - - assertOutputContains - "- hops/hops-7.config \ - \ imported by: hops-6.config \ - \ imported by: hops/hops-5.config \ - \ imported by: hops-4.config \ - \ imported by: hops/hops-3.config \ - \ imported by: hops-2.config \ - \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" - hopping - - assertOutputContains - "- hops/hops-9.config \ - \ imported by: hops-8.config \ - \ imported by: hops/hops-7.config \ - \ imported by: hops-6.config \ - \ imported by: hops/hops-5.config \ - \ imported by: hops-4.config \ - \ imported by: hops/hops-3.config \ - \ imported by: hops-2.config \ - \ imported by: hops/hops-1.config \ - \ imported by: hops-0.project" - hopping + + readFileVerbatim "hops.expect.txt" >>= + flip (assertOn multilineNeedleHaystack) hopping . normalizePathSeparators -- The project is named oops as it is like hops but has conflicting constraints. -- +-- oops-0.project @@ -205,25 +128,51 @@ main = cabalTest . withRepo "repo" . recordMode RecordMarked $ do -- +-- oops/oops-9.config (has conflicting constraints) log "checking conflicting constraints skipping into a subfolder and then back out again and again" oopsing <- fails $ cabal' "v2-build" [ "all", "--project-file=oops-0.project" ] - assertOutputContains "rejecting: hashable-1.4.2.0" oopsing - assertOutputContains "rejecting: hashable-1.4.3.0" oopsing - assertOutputContains "(constraint from oops-0.project requires ==1.4.3.0)" oopsing - - assertOutputContains - " (constraint from oops/oops-9.config requires ==1.4.2.0) \ - \ imported by: oops-8.config \ - \ imported by: oops/oops-7.config \ - \ imported by: oops-6.config \ - \ imported by: oops/oops-5.config \ - \ imported by: oops-4.config \ - \ imported by: oops/oops-3.config \ - \ imported by: oops-2.config \ - \ imported by: oops/oops-1.config \ - \ imported by: oops-0.project" - oopsing + + readFileVerbatim "oops.expect.txt" + >>= flip (assertOn multilineNeedleHaystack) oopsing . normalizePathSeparators + + -- The project is named yops as it is like hops but with y's for forks. + -- +-- yops-0.project + -- +-- yops/yops-1.config + -- +-- yops-2.config + -- +-- yops/yops-3.config + -- +-- yops-4.config + -- +-- yops/yops-5.config + -- +-- yops-6.config + -- +-- yops/yops-7.config + -- +-- yops-8.config + -- +-- yops/yops-9.config (no further imports) + -- +-- yops/yops-3.config + -- +-- yops-4.config + -- +-- yops/yops-5.config + -- +-- yops-6.config + -- +-- yops/yops-7.config + -- +-- yops-8.config + -- +-- yops/yops-9.config (no further imports) + -- +-- yops/yops-5.config + -- +-- yops-6.config + -- +-- yops/yops-7.config + -- +-- yops-8.config + -- +-- yops/yops-9.config (no further imports) + -- +-- yops/yops-7.config + -- +-- yops-8.config + -- +-- yops/yops-9.config (no further imports) + -- +-- yops/yops-9.config (no further imports) + -- + -- We don't check and don't error or warn on the same config being imported + -- via many different paths. + log "checking if we detect when the same config is imported via many different paths (we don't)" + yopping <- cabal' "v2-build" [ "--project-file=yops-0.project" ] log "checking bad conditional" badIf <- fails $ cabal' "v2-build" [ "--project-file=bad-conditional.project" ] assertOutputContains "Cannot set compiler in a conditional clause of a cabal project file" badIf + log "checking that missing package message lists configuration provenance" + missing <- fails $ cabal' "v2-build" [ "--project-file=cabal-missing-package.project" ] + + readFileVerbatim "cabal-missing-package.expect.txt" + >>= flip (assertOn multilineNeedleHaystack) missing . normalizePathSeparators + return () diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/hops.expect.txt b/cabal-testsuite/PackageTests/ConditionalAndImport/hops.expect.txt new file mode 100644 index 00000000000..bf3ea9bc001 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/hops.expect.txt @@ -0,0 +1,56 @@ +Configuration is affected by the following files: +- hops-0.project +- hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops-8.config + imported by: hops/hops-7.config + imported by: hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-1.config + imported by: hops-0.project +- hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-7.config + imported by: hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project +- hops/hops-9.config + imported by: hops-8.config + imported by: hops/hops-7.config + imported by: hops-6.config + imported by: hops/hops-5.config + imported by: hops-4.config + imported by: hops/hops-3.config + imported by: hops-2.config + imported by: hops/hops-1.config + imported by: hops-0.project diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/missing/pkgs.config b/cabal-testsuite/PackageTests/ConditionalAndImport/missing/pkgs.config new file mode 100644 index 00000000000..afca189fce6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/missing/pkgs.config @@ -0,0 +1 @@ +import: pkgs/default.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/missing/pkgs/default.config b/cabal-testsuite/PackageTests/ConditionalAndImport/missing/pkgs/default.config new file mode 100644 index 00000000000..fbdd530d3ed --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/missing/pkgs/default.config @@ -0,0 +1 @@ +packages: pkg-doesnt-exist diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/oops.expect.txt b/cabal-testsuite/PackageTests/ConditionalAndImport/oops.expect.txt new file mode 100644 index 00000000000..88c23627575 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/oops.expect.txt @@ -0,0 +1,16 @@ +Could not resolve dependencies: +[__0] trying: oops-0.1 (user goal) +[__1] next goal: hashable (dependency of oops) +[__1] rejecting: hashable-1.4.3.0 + (constraint from oops/oops-9.config requires ==1.4.2.0) + imported by: oops-8.config + imported by: oops/oops-7.config + imported by: oops-6.config + imported by: oops/oops-5.config + imported by: oops-4.config + imported by: oops/oops-3.config + imported by: oops-2.config + imported by: oops/oops-1.config + imported by: oops-0.project +[__1] rejecting: hashable-1.4.2.0 + (constraint from oops-0.project requires ==1.4.3.0) diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/with-ghc.config b/cabal-testsuite/PackageTests/ConditionalAndImport/with-ghc.config new file mode 100644 index 00000000000..140a00be1b9 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/with-ghc.config @@ -0,0 +1,7 @@ +-- WARNING: Override the `with-compiler: ghc-x.y.z` of the stackage import, of +-- https://www.stackage.org/nightly-yyyy-mm-dd/cabal.config. Otherwise tests +-- will fail with: +-- -Error: [Cabal-5490] +-- -Cannot find the program 'ghc'. User-specified path 'ghc-x.y.z' does not +-- refer to an executable and the program is not on the system path. +with-compiler: ghc diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-0.project b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-0.project new file mode 100644 index 00000000000..28f582bab91 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-0.project @@ -0,0 +1,7 @@ +packages: . + +import: yops/yops-1.config +import: yops/yops-3.config +import: yops/yops-5.config +import: yops/yops-7.config +import: yops/yops-9.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-2.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-2.config new file mode 100644 index 00000000000..c8535704f13 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-2.config @@ -0,0 +1 @@ +import: yops/yops-3.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-4.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-4.config new file mode 100644 index 00000000000..024d1c94d1e --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-4.config @@ -0,0 +1 @@ +import: yops/yops-5.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-6.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-6.config new file mode 100644 index 00000000000..4df25a90a59 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-6.config @@ -0,0 +1 @@ +import: yops/yops-7.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops-8.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-8.config new file mode 100644 index 00000000000..a2d27ab2b16 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops-8.config @@ -0,0 +1 @@ +import: yops/yops-9.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-1.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-1.config new file mode 100644 index 00000000000..5ad1fe73bd3 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-1.config @@ -0,0 +1 @@ +import: ../yops-2.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-3.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-3.config new file mode 100644 index 00000000000..6cbaeb3fa87 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-3.config @@ -0,0 +1 @@ +import: ../yops-4.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-5.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-5.config new file mode 100644 index 00000000000..ae0901cedd6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-5.config @@ -0,0 +1 @@ +import: ../yops-6.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-7.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-7.config new file mode 100644 index 00000000000..18edcb74c20 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-7.config @@ -0,0 +1 @@ +import: ../yops-8.config diff --git a/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-9.config b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-9.config new file mode 100644 index 00000000000..61813df4e2c --- /dev/null +++ b/cabal-testsuite/PackageTests/ConditionalAndImport/yops/yops-9.config @@ -0,0 +1 @@ +-- No imports here diff --git a/cabal-testsuite/PackageTests/ConfigFile/T8487/cabal.out b/cabal-testsuite/PackageTests/ConfigFile/T8487/cabal.out index bf17f93ac6c..507f9fc2ccb 100644 --- a/cabal-testsuite/PackageTests/ConfigFile/T8487/cabal.out +++ b/cabal-testsuite/PackageTests/ConfigFile/T8487/cabal.out @@ -1,4 +1,6 @@ # cabal build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O2 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Configure/cabal.out b/cabal-testsuite/PackageTests/Configure/cabal.out index 79a33e68892..019ac30955f 100644 --- a/cabal-testsuite/PackageTests/Configure/cabal.out +++ b/cabal-testsuite/PackageTests/Configure/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Configure/cabal.test.hs b/cabal-testsuite/PackageTests/Configure/cabal.test.hs index afcc00cbf7a..cd419e8cee2 100644 --- a/cabal-testsuite/PackageTests/Configure/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Configure/cabal.test.hs @@ -2,9 +2,26 @@ import Test.Cabal.Prelude import Control.Monad.IO.Class import Data.Maybe import System.Directory +import System.Environment +import Data.List (isSuffixOf) + -- Test for 'build-type: Configure' example from the setup manual. main = cabalTest $ do - hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf" - skipUnless "no autoreconf" hasAutoreconf - _ <- shell "autoreconf" ["-i"] - cabal "v2-build" [] + if isWindows + then do + (mCI, mSh) <- liftIO $ (,) <$> lookupEnv "CI" <*> lookupEnv "SHELL" + case (mCI, mSh) of + (Nothing, Nothing) -> skip "Missing $SHELL" + (Nothing, Just sh) -> do + env <- getTestEnv + void $ shell sh [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"] + cabal "v2-build" [] + (Just{}, _) -> do + env <- getTestEnv + void $ shell "C:\\msys64\\usr\\bin\\bash.exe" [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"] + cabal "v2-build" [] + else do + hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf" + skipUnless "no autoreconf" hasAutoreconf + _ <- shell "autoreconf" ["-i"] + cabal "v2-build" [] diff --git a/cabal-testsuite/PackageTests/Configure/setup.test.hs b/cabal-testsuite/PackageTests/Configure/setup.test.hs index 559b88c6ff2..5eaea387fe6 100644 --- a/cabal-testsuite/PackageTests/Configure/setup.test.hs +++ b/cabal-testsuite/PackageTests/Configure/setup.test.hs @@ -2,9 +2,25 @@ import Test.Cabal.Prelude import Control.Monad.IO.Class import Data.Maybe import System.Directory +import System.Environment + -- Test for 'build-type: Configure' example from the setup manual. -main = setupTest $ do - hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf" - skipUnless "no autoreconf" hasAutoreconf - _ <- shell "autoreconf" ["-i"] - setup_build [] +main = setupTest $ + if isWindows + then do + (mCI, mSh) <- liftIO $ (,) <$> lookupEnv "CI" <*> lookupEnv "SHELL" + case (mCI, mSh) of + (Nothing, Nothing) -> skip "Missing $SHELL" + (Nothing, Just sh) -> do + env <- getTestEnv + void $ shell sh [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"] + setup_build [] + (Just{}, _) -> do + env <- getTestEnv + void $ shell "C:\\msys64\\usr\\bin\\bash.exe" [ "-l", "-c", "cd $(cygpath -m '" <> testTmpDir env <> "') && autoreconf -i"] + setup_build [] + else do + hasAutoreconf <- liftIO $ fmap isJust $ findExecutable "autoreconf" + skipUnless "no autoreconf" hasAutoreconf + _ <- shell "autoreconf" ["-i"] + setup_build [] diff --git a/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/Lib.cabal b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/Lib.cabal new file mode 100644 index 00000000000..284513bd8b1 --- /dev/null +++ b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/Lib.cabal @@ -0,0 +1,20 @@ +cabal-version: 3.0 +name: Lib +version: 0.1.0.0 +license: BSD-3-Clause +author: Edward Z. Yang +maintainer: ezyang@cs.stanford.edu +build-type: Simple + +library foo-internal + build-depends: base + exposed-modules: Lib + default-language: Haskell2010 + +executable exe + main-is: Exe.hs + build-depends: base <=1.0, + package-that-does-not-exist, + Lib:{foo-internal, bar-internal}, + hs-source-dirs: exe + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/Lib.hs b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/Lib.hs new file mode 100644 index 00000000000..1d7d07d5cba --- /dev/null +++ b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/Lib.hs @@ -0,0 +1,2 @@ +module Lib where +lib = "OK" diff --git a/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/exe/Exe.hs b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/exe/Exe.hs new file mode 100644 index 00000000000..6ee3fb933aa --- /dev/null +++ b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/exe/Exe.hs @@ -0,0 +1,2 @@ +import Lib +main = putStrLn lib diff --git a/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/setup-fail.out b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/setup-fail.out new file mode 100644 index 00000000000..2ea38e253cd --- /dev/null +++ b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/setup-fail.out @@ -0,0 +1,16 @@ +# Setup configure +Configuring library 'foo-internal' for Lib-0.1.0.0... +# Setup build +Preprocessing library 'foo-internal' for Lib-0.1.0.0... +Building library 'foo-internal' for Lib-0.1.0.0... +# Setup copy +Installing internal library foo-internal in +# Setup register +Registering library 'foo-internal' for Lib-0.1.0.0... +# Setup configure +Configuring executable 'exe' for Lib-0.1.0.0... +Error: [Cabal-8010] +Encountered missing or private dependencies: + Lib:{bar-internal,foo-internal} (missing :bar-internal), + base <=1.0 (installed: ), + package-that-does-not-exist (missing) diff --git a/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/setup-fail.test.hs b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/setup-fail.test.hs new file mode 100644 index 00000000000..5d8123ee88c --- /dev/null +++ b/cabal-testsuite/PackageTests/ConfigureComponent/MissingOrPrivate/setup-fail.test.hs @@ -0,0 +1,8 @@ + +import Test.Cabal.Prelude +main = setupTest $ do + withPackageDb $ do + base_id <- getIPID "base" + setup_install ["foo-internal", "--cid", "foo-internal-0.1-abc"] + r <- fails $ setup' "configure" [ "exe" ] + assertOutputContains "Lib" r diff --git a/cabal-testsuite/PackageTests/ConfigureComponent/SubLib/setup-explicit-fail.out b/cabal-testsuite/PackageTests/ConfigureComponent/SubLib/setup-explicit-fail.out index fec347864e5..ee7258799b1 100644 --- a/cabal-testsuite/PackageTests/ConfigureComponent/SubLib/setup-explicit-fail.out +++ b/cabal-testsuite/PackageTests/ConfigureComponent/SubLib/setup-explicit-fail.out @@ -11,4 +11,4 @@ Registering library 'sublib' for Lib-0.1.0.0... Configuring executable 'exe' for Lib-0.1.0.0... Error: [Cabal-8010] Encountered missing or private dependencies: - Lib:sublib + Lib:sublib (missing :sublib) diff --git a/cabal-testsuite/PackageTests/CopyHie/cabal.out b/cabal-testsuite/PackageTests/CopyHie/cabal.out index a45daf37831..d6e8a9f3f42 100644 --- a/cabal-testsuite/PackageTests/CopyHie/cabal.out +++ b/cabal-testsuite/PackageTests/CopyHie/cabal.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/CustomDep/cabal.project b/cabal-testsuite/PackageTests/CustomDep/cabal.project deleted file mode 100644 index d4198c181d9..00000000000 --- a/cabal-testsuite/PackageTests/CustomDep/cabal.project +++ /dev/null @@ -1 +0,0 @@ -packages: client custom diff --git a/cabal-testsuite/PackageTests/CustomDep/cabal.test.hs b/cabal-testsuite/PackageTests/CustomDep/cabal.test.hs deleted file mode 100644 index 9058afe19c0..00000000000 --- a/cabal-testsuite/PackageTests/CustomDep/cabal.test.hs +++ /dev/null @@ -1,10 +0,0 @@ -import Test.Cabal.Prelude -main = cabalTest $ do - -- implicit setup-depends conflict with GHC >= 8.2; c.f. #415 - skipUnlessGhcVersion "< 8.2" - -- This test depends heavily on what packages are in the global - -- database, don't record the output - recordMode DoNotRecord $ do - -- TODO: Hack, delete me - withEnvFilter (`notElem` ["HOME", "CABAL_DIR"]) $ do - cabal "v2-build" ["all"] diff --git a/cabal-testsuite/PackageTests/CustomDep/client/B.hs b/cabal-testsuite/PackageTests/CustomDep/client/B.hs deleted file mode 100644 index af119169669..00000000000 --- a/cabal-testsuite/PackageTests/CustomDep/client/B.hs +++ /dev/null @@ -1,2 +0,0 @@ -module B where -import A diff --git a/cabal-testsuite/PackageTests/CustomDep/client/client.cabal b/cabal-testsuite/PackageTests/CustomDep/client/client.cabal deleted file mode 100644 index 2bb74b34594..00000000000 --- a/cabal-testsuite/PackageTests/CustomDep/client/client.cabal +++ /dev/null @@ -1,12 +0,0 @@ -name: client -version: 0.1.0.0 -license: BSD3 -author: Edward Z. Yang -maintainer: ezyang@cs.stanford.edu -build-type: Simple -cabal-version: >=1.10 - -library - exposed-modules: B - build-depends: base, custom - default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/CustomDep/custom/A.hs b/cabal-testsuite/PackageTests/CustomDep/custom/A.hs deleted file mode 100644 index d843c00b782..00000000000 --- a/cabal-testsuite/PackageTests/CustomDep/custom/A.hs +++ /dev/null @@ -1 +0,0 @@ -module A where diff --git a/cabal-testsuite/PackageTests/CustomDep/custom/custom.cabal b/cabal-testsuite/PackageTests/CustomDep/custom/custom.cabal deleted file mode 100644 index 4f327080098..00000000000 --- a/cabal-testsuite/PackageTests/CustomDep/custom/custom.cabal +++ /dev/null @@ -1,15 +0,0 @@ -name: custom -version: 0.1.0.0 -license: BSD3 -author: Edward Z. Yang -maintainer: ezyang@cs.stanford.edu -build-type: Custom -cabal-version: >=1.10 - -library - exposed-modules: A - build-depends: base - default-language: Haskell2010 - -custom-setup - setup-depends: base, Cabal diff --git a/cabal-testsuite/PackageTests/CustomPlain/A.hs b/cabal-testsuite/PackageTests/CustomPlain/A.hs deleted file mode 100644 index d843c00b782..00000000000 --- a/cabal-testsuite/PackageTests/CustomPlain/A.hs +++ /dev/null @@ -1 +0,0 @@ -module A where diff --git a/cabal-testsuite/PackageTests/CustomPlain/Setup.hs b/cabal-testsuite/PackageTests/CustomPlain/Setup.hs deleted file mode 100644 index 20b960ede90..00000000000 --- a/cabal-testsuite/PackageTests/CustomPlain/Setup.hs +++ /dev/null @@ -1,3 +0,0 @@ -import Distribution.Simple -import System.IO -main = hPutStrLn stderr "ThisIsCustomYeah" >> defaultMain diff --git a/cabal-testsuite/PackageTests/CustomPlain/cabal.test.hs b/cabal-testsuite/PackageTests/CustomPlain/cabal.test.hs deleted file mode 100644 index 42c64595594..00000000000 --- a/cabal-testsuite/PackageTests/CustomPlain/cabal.test.hs +++ /dev/null @@ -1,11 +0,0 @@ -import Test.Cabal.Prelude -main = cabalTest $ do - -- implicit setup-depends conflict with GHC >= 8.2; c.f. #415 - skipUnlessGhcVersion "< 8.2" - -- Regression test for #4393 - recordMode DoNotRecord $ do - -- TODO: Hack; see also CustomDep/cabal.test.hs - withEnvFilter (`notElem` ["HOME", "CABAL_DIR"]) $ do - -- On -v2, we don't have vQuiet set, which suppressed - -- the error - cabal "v2-build" ["-v1"] diff --git a/cabal-testsuite/PackageTests/CustomPlain/plain.cabal b/cabal-testsuite/PackageTests/CustomPlain/plain.cabal deleted file mode 100644 index d0666a10fd8..00000000000 --- a/cabal-testsuite/PackageTests/CustomPlain/plain.cabal +++ /dev/null @@ -1,11 +0,0 @@ -name: plain -version: 0.1.0.0 -license: BSD3 -author: Edward Z. Yang -maintainer: ezyang@cs.stanford.edu -cabal-version: >=1.10 - -library - exposed-modules: A - build-depends: base - default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/CustomPlain/setup.cabal.out b/cabal-testsuite/PackageTests/CustomPlain/setup.cabal.out deleted file mode 100644 index 2d3ff0f9451..00000000000 --- a/cabal-testsuite/PackageTests/CustomPlain/setup.cabal.out +++ /dev/null @@ -1,7 +0,0 @@ -# Setup configure -Resolving dependencies... -Configuring plain-0.1.0.0... -Warning: No 'build-type' specified. If you do not need a custom Setup.hs or ./configure script then use 'build-type: Simple'. -# Setup build -Preprocessing library for plain-0.1.0.0... -Building library for plain-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/CustomPlain/setup.out b/cabal-testsuite/PackageTests/CustomPlain/setup.out deleted file mode 100644 index 3fdfe2b7f77..00000000000 --- a/cabal-testsuite/PackageTests/CustomPlain/setup.out +++ /dev/null @@ -1,6 +0,0 @@ -# Setup configure -Configuring plain-0.1.0.0... -Warning: [no-build-type] No 'build-type' specified. If you do not need a custom Setup.hs or ./configure script then use 'build-type: Simple'. -# Setup build -Preprocessing library for plain-0.1.0.0... -Building library for plain-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/CustomPlain/setup.test.hs b/cabal-testsuite/PackageTests/CustomPlain/setup.test.hs deleted file mode 100644 index abf668397b8..00000000000 --- a/cabal-testsuite/PackageTests/CustomPlain/setup.test.hs +++ /dev/null @@ -1,4 +0,0 @@ -import Test.Cabal.Prelude -main = setupTest $ do - setup' "configure" [] >>= assertOutputContains "ThisIsCustomYeah" - setup' "build" [] >>= assertOutputContains "ThisIsCustomYeah" diff --git a/cabal-testsuite/PackageTests/CustomPreProcess/Setup.hs b/cabal-testsuite/PackageTests/CustomPreProcess/Setup.hs index b315119728b..769f1309339 100644 --- a/cabal-testsuite/PackageTests/CustomPreProcess/Setup.hs +++ b/cabal-testsuite/PackageTests/CustomPreProcess/Setup.hs @@ -15,7 +15,7 @@ import Distribution.Simple import Distribution.Simple.LocalBuildInfo import Distribution.Simple.PreProcess import Distribution.Simple.Utils -#if MIN_VERSION_Cabal(3,11,0) +#if MIN_VERSION_Cabal(3,13,0) import Distribution.Utils.Path (getSymbolicPath) #endif @@ -47,7 +47,7 @@ main = defaultMainWithHooks } where builddir = -#if MIN_VERSION_Cabal(3,11,0) +#if MIN_VERSION_Cabal(3,13,0) getSymbolicPath $ #endif buildDir lbi diff --git a/cabal-testsuite/PackageTests/CustomSegfault/cabal.out b/cabal-testsuite/PackageTests/CustomSegfault/cabal.out index 80f27e69b58..2c7f2ea0ddc 100644 --- a/cabal-testsuite/PackageTests/CustomSegfault/cabal.out +++ b/cabal-testsuite/PackageTests/CustomSegfault/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/CustomSegfault/cabal.test.hs b/cabal-testsuite/PackageTests/CustomSegfault/cabal.test.hs index a6c74dab745..b543cc5de45 100644 --- a/cabal-testsuite/PackageTests/CustomSegfault/cabal.test.hs +++ b/cabal-testsuite/PackageTests/CustomSegfault/cabal.test.hs @@ -1,6 +1,5 @@ import Test.Cabal.Prelude main = cabalTest $ do - -- TODO: this test ought to work on Windows too - skipUnless "not Linux" =<< isLinux + skipUnless "depends on `unix` and needs Linux" isLinux skipUnlessGhcVersion ">= 7.8" fails $ cabal' "v2-build" [] >>= assertOutputContains "SIGSEGV" diff --git a/cabal-testsuite/PackageTests/CustomTestCoverage/cabal.out b/cabal-testsuite/PackageTests/CustomTestCoverage/cabal.out index 8597dcc94df..f46d372f357 100644 --- a/cabal-testsuite/PackageTests/CustomTestCoverage/cabal.out +++ b/cabal-testsuite/PackageTests/CustomTestCoverage/cabal.out @@ -1,4 +1,6 @@ # cabal test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/CustomWithoutCabal/cabal.out b/cabal-testsuite/PackageTests/CustomWithoutCabal/cabal.out index 74d7f6adf31..b2e823ff426 100644 --- a/cabal-testsuite/PackageTests/CustomWithoutCabal/cabal.out +++ b/cabal-testsuite/PackageTests/CustomWithoutCabal/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/CustomWithoutCabalDefaultMain/cabal.out b/cabal-testsuite/PackageTests/CustomWithoutCabalDefaultMain/cabal.out index 0e26184375c..49829f86e53 100644 --- a/cabal-testsuite/PackageTests/CustomWithoutCabalDefaultMain/cabal.out +++ b/cabal-testsuite/PackageTests/CustomWithoutCabalDefaultMain/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Exec/cabal.out b/cabal-testsuite/PackageTests/Exec/cabal.out index 7ce2cfb90f0..28952d14e4e 100644 --- a/cabal-testsuite/PackageTests/Exec/cabal.out +++ b/cabal-testsuite/PackageTests/Exec/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ExecModern/cabal.out b/cabal-testsuite/PackageTests/ExecModern/cabal.out index fc4e1b601b3..0e1b514edcb 100644 --- a/cabal-testsuite/PackageTests/ExecModern/cabal.out +++ b/cabal-testsuite/PackageTests/ExecModern/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ExternalCommand/cabal.out b/cabal-testsuite/PackageTests/ExternalCommand/cabal.out index 1c4c24db55c..a5139bb22a6 100644 --- a/cabal-testsuite/PackageTests/ExternalCommand/cabal.out +++ b/cabal-testsuite/PackageTests/ExternalCommand/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ExternalCommandEnv/cabal.out b/cabal-testsuite/PackageTests/ExternalCommandEnv/cabal.out index 1c4c24db55c..a5139bb22a6 100644 --- a/cabal-testsuite/PackageTests/ExternalCommandEnv/cabal.out +++ b/cabal-testsuite/PackageTests/ExternalCommandEnv/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ExternalCommandExitCode/cabal.out b/cabal-testsuite/PackageTests/ExternalCommandExitCode/cabal.out new file mode 100644 index 00000000000..a5139bb22a6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ExternalCommandExitCode/cabal.out @@ -0,0 +1,10 @@ +# cabal v2-build +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - setup-test-0.1.0.0 (exe:cabal-aaaa) (first run) +Configuring executable 'cabal-aaaa' for setup-test-0.1.0.0... +Preprocessing executable 'cabal-aaaa' for setup-test-0.1.0.0... +Building executable 'cabal-aaaa' for setup-test-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/ExternalCommandExitCode/cabal.project b/cabal-testsuite/PackageTests/ExternalCommandExitCode/cabal.project new file mode 100644 index 00000000000..1a33bb5a25e --- /dev/null +++ b/cabal-testsuite/PackageTests/ExternalCommandExitCode/cabal.project @@ -0,0 +1 @@ +packages: setup-test/ diff --git a/cabal-testsuite/PackageTests/ExternalCommandExitCode/cabal.test.hs b/cabal-testsuite/PackageTests/ExternalCommandExitCode/cabal.test.hs new file mode 100644 index 00000000000..7fc79d75815 --- /dev/null +++ b/cabal-testsuite/PackageTests/ExternalCommandExitCode/cabal.test.hs @@ -0,0 +1,38 @@ +import Test.Cabal.Prelude +import qualified System.Process as Process +import Control.Concurrent (threadDelay) +import System.Directory (removeFile) +import Control.Exception (catch, throwIO) +import System.IO.Error (isDoesNotExistError) +import qualified Data.Time.Clock as Time +import qualified Data.Time.Format as Time +import Data.Maybe +import System.Environment +import System.FilePath +import System.Exit + +main = do + cabalTest $ do + res <- cabalWithStdin "v2-build" ["all"] "" + exe_path <- withPlan $ planExePath "setup-test" "cabal-aaaa" + addToPath (takeDirectory exe_path) $ do + -- Test that the thing works at all + res <- fails $ cabal_raw_action ["aaaa"] (\h -> () <$ Process.waitForProcess h) + assertOutputContains "aaaa" res + -- Check the exit code is the one returned by subcommand + unless (resultExitCode res == ExitFailure 99) (assertFailure $ "Incorrect exit code: " ++ show (resultExitCode res)) + + +cabal_raw_action :: [String] -> (Process.ProcessHandle -> IO ()) -> TestM Result +cabal_raw_action args action = do + configured_prog <- requireProgramM cabalProgram + env <- getTestEnv + r <- liftIO $ runAction (testVerbosity env) + (Just $ testCurrentDir env) + (testEnvironment env) + (programPath configured_prog) + args + Nothing + action + recordLog r + requireSuccess r diff --git a/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/AAAA.hs b/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/AAAA.hs new file mode 100644 index 00000000000..b9d4e99c553 --- /dev/null +++ b/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/AAAA.hs @@ -0,0 +1,8 @@ +module Main where + +import System.Environment +import System.Exit + +main = do + getArgs >>= print + exitWith (ExitFailure 99) diff --git a/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/CHANGELOG.md b/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/CHANGELOG.md new file mode 100644 index 00000000000..7ae8ff6113d --- /dev/null +++ b/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for setup-test + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/LICENSE b/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/LICENSE new file mode 100644 index 00000000000..cd8ad2ac8ae --- /dev/null +++ b/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/LICENSE @@ -0,0 +1,30 @@ +Copyright (c) 2023, Matthew Pickering + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Matthew Pickering nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/setup-test.cabal b/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/setup-test.cabal new file mode 100644 index 00000000000..8deb0577a16 --- /dev/null +++ b/cabal-testsuite/PackageTests/ExternalCommandExitCode/setup-test/setup-test.cabal @@ -0,0 +1,25 @@ +cabal-version: 3.0 +name: setup-test +version: 0.1.0.0 +-- synopsis: +-- description: +license: BSD-3-Clause +license-file: LICENSE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +-- copyright: +build-type: Simple +extra-doc-files: CHANGELOG.md +-- extra-source-files: + +common warnings + ghc-options: -Wall + +executable cabal-aaaa + import: warnings + main-is: AAAA.hs + -- other-modules: + -- other-extensions: + build-depends: base + hs-source-dirs: . + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/ExternalCommandHelp/cabal.out b/cabal-testsuite/PackageTests/ExternalCommandHelp/cabal.out index 1c4c24db55c..a5139bb22a6 100644 --- a/cabal-testsuite/PackageTests/ExternalCommandHelp/cabal.out +++ b/cabal-testsuite/PackageTests/ExternalCommandHelp/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ExtraPackages/cabal.out b/cabal-testsuite/PackageTests/ExtraPackages/cabal.out index 95c356b73f6..0ae87fbc8ef 100644 --- a/cabal-testsuite/PackageTests/ExtraPackages/cabal.out +++ b/cabal-testsuite/PackageTests/ExtraPackages/cabal.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ExtraProgPath/setup.out b/cabal-testsuite/PackageTests/ExtraProgPath/setup.out index 1011c8899ed..ed22f251035 100644 --- a/cabal-testsuite/PackageTests/ExtraProgPath/setup.out +++ b/cabal-testsuite/PackageTests/ExtraProgPath/setup.out @@ -1,12 +1,12 @@ # cabal v2-build Warning: cannot determine version of /pkg-config : "" -Warning: cannot determine version of /pkg-config : -"" +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: [__0] next goal: CheckExtraProgPath (user goal) -[__0] rejecting: CheckExtraProgPath-0.1 (conflict: pkg-config package zlib-any, not found in the pkg-config database) +[__0] rejecting: CheckExtraProgPath-0.1 (pkg-config package zlib-any is needed but no pkg-config executable was found or querying it failed) [__0] fail (backjumping, conflict set: CheckExtraProgPath) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: CheckExtraProgPath (2) diff --git a/cabal-testsuite/PackageTests/ExtraProgPath/setup.test.hs b/cabal-testsuite/PackageTests/ExtraProgPath/setup.test.hs index 80ee56f6287..ecc6696c1f2 100644 --- a/cabal-testsuite/PackageTests/ExtraProgPath/setup.test.hs +++ b/cabal-testsuite/PackageTests/ExtraProgPath/setup.test.hs @@ -1,8 +1,8 @@ import Test.Cabal.Prelude -- Test that extra-prog-path overrides the path for pkg-config -main = cabalTest $ do - -- skipped on windows because using a script to dummy up an executable doesn't work the same. - skipIfWindows - cdir <- testCurrentDir `fmap` getTestEnv - fails $ cabal "v2-build" ["--extra-prog-path="++cdir] +main = do + skipIfWindows "useless test (CI has no pkg-config already)" + cabalTest $ do + cdir <- testCurrentDir `fmap` getTestEnv + fails $ cabal "v2-build" ["--extra-prog-path="++cdir] diff --git a/cabal-testsuite/PackageTests/FFI/CSourceDependsStub/cabal.out b/cabal-testsuite/PackageTests/FFI/CSourceDependsStub/cabal.out index cdfe4ab10de..d7d7f802298 100644 --- a/cabal-testsuite/PackageTests/FFI/CSourceDependsStub/cabal.out +++ b/cabal-testsuite/PackageTests/FFI/CSourceDependsStub/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.out b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.out index 97e0b60ec7c..2db68152992 100644 --- a/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.out +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsC/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.out b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.out index 522304298c4..a95271222aa 100644 --- a/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.out +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCxx/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ForeignLibs/MyForeignLib.def b/cabal-testsuite/PackageTests/ForeignLibs/MyForeignLib.def new file mode 100644 index 00000000000..b9438c8d6a0 --- /dev/null +++ b/cabal-testsuite/PackageTests/ForeignLibs/MyForeignLib.def @@ -0,0 +1,4 @@ +EXPORTS + sayHi + myForeignLibExit + myForeignLibInit diff --git a/cabal-testsuite/PackageTests/ForeignLibs/my-foreign-lib.cabal b/cabal-testsuite/PackageTests/ForeignLibs/my-foreign-lib.cabal index 8b63dc24e9e..43a5a655567 100644 --- a/cabal-testsuite/PackageTests/ForeignLibs/my-foreign-lib.cabal +++ b/cabal-testsuite/PackageTests/ForeignLibs/my-foreign-lib.cabal @@ -16,7 +16,8 @@ foreign-library myforeignlib type: native-shared if os(windows) - options: standalone + options: standalone + mod-def-file: MyForeignLib.def other-modules: MyForeignLib.Hello MyForeignLib.SomeBindings diff --git a/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs b/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs index 1dcf918eaed..69df1e8d313 100644 --- a/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs +++ b/cabal-testsuite/PackageTests/ForeignLibs/setup.test.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE CPP #-} import Control.Exception @@ -27,10 +26,8 @@ import Test.Cabal.Prelude main = setupAndCabalTest . recordMode DoNotRecord $ do -- Foreign libraries don't work with GHC 7.6 and earlier skipUnlessGhcVersion ">= 7.8" - win <- isWindows ghc94 <- isGhcVersion ">= 9.4.1" - expectBrokenIf (win && ghc94) 8451 $ - withPackageDb $ do + withPackageDb $ do setup_install [] setup "copy" [] -- regression test #4156 dist_dir <- fmap testDistDir getTestEnv diff --git a/cabal-testsuite/PackageTests/GHCJS/BuildRunner/cabal.test.hs b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/cabal.test.hs index fd7328da0c2..da8afae103e 100644 --- a/cabal-testsuite/PackageTests/GHCJS/BuildRunner/cabal.test.hs +++ b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/cabal.test.hs @@ -1,7 +1,7 @@ import Test.Cabal.Prelude -main = cabalTest . recordMode DoNotRecord $ do - skipIfWindows -- disabled because (I presume) Windows doesn't have BASH +main = do + cabalTest . recordMode DoNotRecord $ do cwd <- fmap testCurrentDir getTestEnv testInvokedWithBuildRunner cwd "test" [] testInvokedWithBuildRunner cwd "run" ["ghcjs-exe"] @@ -14,6 +14,8 @@ testInvokedWithBuildRunner cwd cabalCmd extraArgs = do [ "--ghcjs" , "--with-compiler", cwd fakeGhcjsPath ] + -- On windows point cabal to the right cc + ++ if isWindows then ["--with-gcc", "scripts/cc.bat"] else [] assertOutputContains magicString output where - fakeGhcjsPath = "scripts/fake-ghcjs.sh" + fakeGhcjsPath = if isWindows then "scripts/fake-ghcjs.exe" else "scripts/fake-ghcjs.sh" diff --git a/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/cc.bat b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/cc.bat new file mode 100644 index 00000000000..b2300d2fd6b --- /dev/null +++ b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/cc.bat @@ -0,0 +1,45 @@ +@ECHO off + +FOR /f "delims=" %%A in ('call ghc.exe --print-libdir') do set "libdir=%%A" +FOR /f "delims=" %%A in ('call ghc.exe --numeric-version') do set "numVersion=%%A" +setlocal EnableDelayedExpansion + +call :compareVersions 9.4.1 %numVersion% +if %errorlevel% == 1 (set "cc=gcc.exe") else (set "cc=clang.exe") +CALL !libdir:lib=mingw\bin\!%cc% %* +EXIT /B %ERRORLEVEL% + +REM taken from https://stackoverflow.com/questions/15807762/compare-version-numbers-in-batch-file + +:compareVersions version1 version2 +:: +:: Compares two version numbers and returns the result in the ERRORLEVEL +:: +:: Returns 1 if version1 > version2 +:: 0 if version1 = version2 +:: -1 if version1 < version2 +:: +:: The nodes must be delimited by . or , or - +:: +:: Nodes are normally strictly numeric, without a 0 prefix. A letter suffix +:: is treated as a separate node +:: +setlocal enableDelayedExpansion +set "v1=%~1" +set "v2=%~2" +:loop +call :parseNode "%v1%" n1 v1 +call :parseNode "%v2%" n2 v2 +if %n1% gtr %n2% exit /b 1 +if %n1% lss %n2% exit /b -1 +if not defined v1 if not defined v2 exit /b 0 +if not defined v1 exit /b -1 +if not defined v2 exit /b 1 +goto :loop + + +:parseNode version nodeVar remainderVar +for /f "tokens=1* delims=." %%A in ("%~1") do ( + set "%~2=%%A" + set "%~3=%%B" +) diff --git a/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/fake-ghcjs.exe b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/fake-ghcjs.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/fake-ghcjs.exe differ diff --git a/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/fake-ghcjs.shim b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/fake-ghcjs.shim new file mode 100644 index 00000000000..725429e82d7 --- /dev/null +++ b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/fake-ghcjs.shim @@ -0,0 +1,2 @@ +path = "sh.exe" +args = "scripts/fake-ghcjs.sh" diff --git a/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/ghcjs-pkg.exe b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/ghcjs-pkg.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/ghcjs-pkg.exe differ diff --git a/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/ghcjs-pkg.shim b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/ghcjs-pkg.shim new file mode 100644 index 00000000000..d330fc23e3e --- /dev/null +++ b/cabal-testsuite/PackageTests/GHCJS/BuildRunner/scripts/ghcjs-pkg.shim @@ -0,0 +1,2 @@ +path = "sh.exe" +args = "scripts/ghcjs-pkg" diff --git a/cabal-testsuite/PackageTests/Get/T7248/cabal.out b/cabal-testsuite/PackageTests/Get/T7248/cabal.out index a172b425d4d..0c6e3ce035c 100644 --- a/cabal-testsuite/PackageTests/Get/T7248/cabal.out +++ b/cabal-testsuite/PackageTests/Get/T7248/cabal.out @@ -1,4 +1,6 @@ # cabal get Warning: /cabal.config: Unrecognized stanza on line 3 -Error: [Cabal-7160] -The package list for 'repo.invalid' does not exist. Run 'cabal update' to download it. +Warning: The package list for 'repo.invalid' does not exist. Run 'cabal update' to download it. +Error: [Cabal-7100] +There is no package named 'a-b-s-e-n-t'. +You may need to run 'cabal update' to get the latest list of available packages. diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc-pkg.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc-pkg.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc-pkg.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc-pkg.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc-pkg.shim new file mode 100644 index 00000000000..0ec39dd3f09 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc-pkg.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "ghc-pkg" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc.shim new file mode 100644 index 00000000000..97596f1c171 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/ghc.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "ghc" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/setup.test.hs index 85b30b87523..805f56abc9c 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectory/setup.test.hs @@ -1,10 +1,19 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows +import System.Directory + main = setupAndCabalTest $ do - skipIfWindows - env <- getTestEnv - let cwd = testCurrentDir env - ghc_path <- programPathM ghcProgram - r <- withEnv [("WITH_GHC", Just ghc_path)] - . fails $ setup' "configure" ["-w", cwd "ghc"] - assertOutputContains "is version 9999999" r + when isWindows $ do + sh <- fmap takeDirectory <$> liftIO (findExecutable "sh") + case sh of + Nothing -> skip "no sh" + Just sh' -> do + let sh'' = concatMap (\c -> case c of + '\\' -> "\\\\\\\\" + x -> [x]) sh' + void $ shell "sed" [ "-i", "-e", "s/FINDSH/" <> sh'' <> "/g", "ghc.shim", "ghc-pkg.shim"] + env <- getTestEnv + let cwd = testCurrentDir env + ghc_path <- programPathM ghcProgram + r <- withEnv [("WITH_GHC", Just ghc_path)] + . fails $ setup' "configure" ["-w", cwd if isWindows then "ghc.exe" else "ghc" ] + assertOutputContains "is version 9999999" r diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-7.10.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-7.10.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-7.10.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-7.10.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-7.10.shim new file mode 100644 index 00000000000..16ae1ddead3 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-7.10.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "ghc-7.10" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-pkg-ghc-7.10.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-pkg-ghc-7.10.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-pkg-ghc-7.10.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-pkg-ghc-7.10.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-pkg-ghc-7.10.shim new file mode 100644 index 00000000000..9e85ac7f0fb --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/ghc-pkg-ghc-7.10.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "ghc-pkg-ghc-7.10" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/setup.test.hs index 746c8015fca..e60d3685863 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryGhcVersion/setup.test.hs @@ -1,10 +1,19 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows +import System.Directory + main = setupAndCabalTest $ do - skipIfWindows - env <- getTestEnv - let cwd = testCurrentDir env - ghc_path <- programPathM ghcProgram - r <- withEnv [("WITH_GHC", Just ghc_path)] - . fails $ setup' "configure" ["-w", cwd "ghc-7.10"] - assertOutputContains "is version 9999999" r + when isWindows $ do + sh <- fmap takeDirectory <$> liftIO (findExecutable "sh") + case sh of + Nothing -> skip "no sh" + Just sh' -> do + let sh'' = concatMap (\c -> case c of + '\\' -> "\\\\\\\\" + x -> [x]) sh' + void $ shell "sed" [ "-i", "-e", "s/FINDSH/" <> sh'' <> "/g", "ghc-7.10.shim", "ghc-pkg-ghc-7.10.shim"] + env <- getTestEnv + let cwd = testCurrentDir env + ghc_path <- programPathM ghcProgram + r <- withEnv [("WITH_GHC", Just ghc_path)] + . fails $ setup' "configure" ["-w", cwd if isWindows then "ghc-7.10.exe" else "ghc-7.10"] + assertOutputContains "is version 9999999" r diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-7.10.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-7.10.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-7.10.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-7.10.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-7.10.shim new file mode 100644 index 00000000000..16ae1ddead3 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-7.10.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "ghc-7.10" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-pkg-7.10.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-pkg-7.10.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-pkg-7.10.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-pkg-7.10.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-pkg-7.10.shim new file mode 100644 index 00000000000..8558f8a0513 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/ghc-pkg-7.10.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "ghc-pkg-7.10" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/setup.test.hs index 746c8015fca..b5f6b4c88d6 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SameDirectoryVersion/setup.test.hs @@ -1,10 +1,19 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows +import System.Directory + main = setupAndCabalTest $ do - skipIfWindows - env <- getTestEnv - let cwd = testCurrentDir env - ghc_path <- programPathM ghcProgram - r <- withEnv [("WITH_GHC", Just ghc_path)] - . fails $ setup' "configure" ["-w", cwd "ghc-7.10"] - assertOutputContains "is version 9999999" r + when isWindows $ do + sh <- fmap takeDirectory <$> liftIO (findExecutable "sh") + case sh of + Nothing -> skip "no sh" + Just sh' -> do + let sh'' = concatMap (\c -> case c of + '\\' -> "\\\\\\\\" + x -> [x]) sh' + void $ shell "sed" [ "-i", "-e", "s/FINDSH/" <> sh'' <> "/g", "ghc-7.10.shim", "ghc-pkg-7.10.shim"] + env <- getTestEnv + let cwd = testCurrentDir env + ghc_path <- programPathM ghcProgram + r <- withEnv [("WITH_GHC", Just ghc_path)] + . fails $ setup' "configure" ["-w", cwd if isWindows then "ghc-7.10.exe" else "ghc-7.10"] + assertOutputContains "is version 9999999" r diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc-pkg.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc-pkg.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc-pkg.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc-pkg.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc-pkg.shim new file mode 100644 index 00000000000..1c68332a0a6 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc-pkg.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "bin\ghc-pkg" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc.shim new file mode 100644 index 00000000000..97596f1c171 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/bin/ghc.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "ghc" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/setup.test.hs index eab35100802..b188acc36d6 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/Symlink/setup.test.hs @@ -1,11 +1,22 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows +import System.Directory + main = setupAndCabalTest $ do - skipIfWindows - withSymlink "bin/ghc" "ghc" $ do + when isWindows $ do + sh <- fmap takeDirectory <$> liftIO (findExecutable "sh") + case sh of + Nothing -> skip "no sh" + Just sh' -> do + let sh'' = concatMap (\c -> case c of + '\\' -> "\\\\\\\\" + x -> [x]) sh' + void $ shell "sed" [ "-i", "-e", "s/FINDSH/" <> sh'' <> "/g", "bin/ghc.shim", "bin/ghc-pkg.shim"] + (if isWindows + then withSymlink "bin/ghc.exe" "ghc.exe" . withSymlink "bin/ghc.shim" "ghc.shim" . withSymlink "bin/ghc" "ghc" + else withSymlink "bin/ghc" "ghc") $ do env <- getTestEnv let cwd = testCurrentDir env ghc_path <- programPathM ghcProgram r <- withEnv [("WITH_GHC", Just ghc_path)] - . fails $ setup' "configure" ["-w", cwd "ghc"] + . fails $ setup' "configure" ["-w", cwd if isWindows then "ghc.exe" else "ghc"] assertOutputContains "is version 9999999" r diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-7.10.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-7.10.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-7.10.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-7.10.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-7.10.shim new file mode 100644 index 00000000000..97596f1c171 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-7.10.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "ghc" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-pkg-7.10.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-pkg-7.10.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-pkg-7.10.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-pkg-7.10.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-pkg-7.10.shim new file mode 100644 index 00000000000..5c1d58caf88 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/bin/ghc-pkg-7.10.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "bin\ghc-pkg-7.10" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/setup.test.hs index eb95044b941..bf9b16fa195 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkGhcVersion/setup.test.hs @@ -1,11 +1,22 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows +import System.Directory + main = setupAndCabalTest $ do - skipIfWindows - withSymlink "bin/ghc-7.10" "ghc" $ do + when isWindows $ do + sh <- fmap takeDirectory <$> liftIO (findExecutable "sh") + case sh of + Nothing -> skip "no sh" + Just sh' -> do + let sh'' = concatMap (\c -> case c of + '\\' -> "\\\\\\\\" + x -> [x]) sh' + void $ shell "sed" [ "-i", "-e", "s/FINDSH/" <> sh'' <> "/g", "bin/ghc-7.10.shim", "bin/ghc-pkg-7.10.shim"] + (if isWindows + then withSymlink "bin/ghc-7.10.exe" "ghc.exe" . withSymlink "bin/ghc-7.10.shim" "ghc.shim" . withSymlink "bin/ghc-7.10" "ghc" + else withSymlink "bin/ghc-7.10" "ghc") $ do env <- getTestEnv let cwd = testCurrentDir env ghc_path <- programPathM ghcProgram r <- withEnv [("WITH_GHC", Just ghc_path)] - . fails $ setup' "configure" ["-w", cwd "ghc"] + . fails $ setup' "configure" ["-w", cwd if isWindows then "ghc.exe" else "ghc"] assertOutputContains "is version 9999999" r diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-7.10.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-7.10.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-7.10.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-7.10.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-7.10.shim new file mode 100644 index 00000000000..97596f1c171 --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-7.10.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "ghc" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-pkg-ghc-7.10.exe b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-pkg-ghc-7.10.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-pkg-ghc-7.10.exe differ diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-pkg-ghc-7.10.shim b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-pkg-ghc-7.10.shim new file mode 100644 index 00000000000..7e9ba24d98b --- /dev/null +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/bin/ghc-pkg-ghc-7.10.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "bin\ghc-pkg-ghc-7.10" diff --git a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/setup.test.hs b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/setup.test.hs index eb95044b941..2f406ce6226 100644 --- a/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/setup.test.hs +++ b/cabal-testsuite/PackageTests/GhcPkgGuess/SymlinkVersion/setup.test.hs @@ -1,11 +1,22 @@ import Test.Cabal.Prelude --- TODO: Enable this test on Windows +import System.Directory + main = setupAndCabalTest $ do - skipIfWindows - withSymlink "bin/ghc-7.10" "ghc" $ do + when isWindows $ do + sh <- fmap takeDirectory <$> liftIO (findExecutable "sh") + case sh of + Nothing -> skip "no sh" + Just sh' -> do + let sh'' = concatMap (\c -> case c of + '\\' -> "\\\\\\\\" + x -> [x]) sh' + void $ shell "sed" [ "-i", "-e", "s/FINDSH/" <> sh'' <> "/g", "bin/ghc-7.10.shim", "bin/ghc-pkg-ghc-7.10.shim"] + (if isWindows + then withSymlink "bin/ghc-7.10.exe" "ghc.exe" . withSymlink "bin/ghc-7.10.shim" "ghc.shim" . withSymlink "bin/ghc-7.10" "ghc" + else withSymlink "bin/ghc-7.10" "ghc") $ do env <- getTestEnv let cwd = testCurrentDir env ghc_path <- programPathM ghcProgram r <- withEnv [("WITH_GHC", Just ghc_path)] - . fails $ setup' "configure" ["-w", cwd "ghc"] + . fails $ setup' "configure" ["-w", cwd if isWindows then "ghc.exe" else "ghc"] assertOutputContains "is version 9999999" r diff --git a/cabal-testsuite/PackageTests/Haddock/setup.cabal.out b/cabal-testsuite/PackageTests/Haddock/setup.cabal.out index a13ae638ac4..a55ef1a732a 100644 --- a/cabal-testsuite/PackageTests/Haddock/setup.cabal.out +++ b/cabal-testsuite/PackageTests/Haddock/setup.cabal.out @@ -3,4 +3,4 @@ Configuring Haddock-0.1... # Setup haddock Preprocessing library for Haddock-0.1... Running Haddock on library for Haddock-0.1... -Documentation created: setup.cabal.dist/work/dist/doc/html/Haddock/ +Documentation created: setup.cabal.dist/work/dist/doc/html/Haddock diff --git a/cabal-testsuite/PackageTests/Haddock/setup.out b/cabal-testsuite/PackageTests/Haddock/setup.out index a16722bc65c..550d84c45ae 100644 --- a/cabal-testsuite/PackageTests/Haddock/setup.out +++ b/cabal-testsuite/PackageTests/Haddock/setup.out @@ -3,4 +3,4 @@ Configuring Haddock-0.1... # Setup haddock Preprocessing library for Haddock-0.1... Running Haddock on library for Haddock-0.1... -Documentation created: setup.dist/work/dist/doc/html/Haddock/ +Documentation created: setup.dist/work/dist/doc/html/Haddock diff --git a/cabal-testsuite/PackageTests/HaddockArgs/hoogle.out b/cabal-testsuite/PackageTests/HaddockArgs/hoogle.out index 3aeb5d42e04..4f2b2103045 100644 --- a/cabal-testsuite/PackageTests/HaddockArgs/hoogle.out +++ b/cabal-testsuite/PackageTests/HaddockArgs/hoogle.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/HaddockArgs/quickjump.out b/cabal-testsuite/PackageTests/HaddockArgs/quickjump.out index f81b0b94852..4e304d38ece 100644 --- a/cabal-testsuite/PackageTests/HaddockArgs/quickjump.out +++ b/cabal-testsuite/PackageTests/HaddockArgs/quickjump.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -14,7 +16,7 @@ for sigs-0.1.0.0... Preprocessing library for sigs-0.1.0.0... Running Haddock on library instantiated with Data.Map = for sigs-0.1.0.0... -Documentation created: /quickjump.dist/work/./dist//sigs-0.1.0.0/dist/doc/html/sigs/ +Documentation created: /quickjump.dist/work/./dist//sigs-0.1.0.0/dist/doc/html/sigs Installing library in Configuring library for indef-0.1.0.0... Preprocessing library for indef-0.1.0.0... @@ -23,7 +25,7 @@ for indef-0.1.0.0... Preprocessing library for indef-0.1.0.0... Running Haddock on library instantiated with Data.Map = for indef-0.1.0.0... -Documentation created: /quickjump.dist/work/./dist//indef-0.1.0.0/dist/doc/html/indef/ +Documentation created: /quickjump.dist/work/./dist//indef-0.1.0.0/dist/doc/html/indef Installing library in Configuring library for example-1.0... Preprocessing library for example-1.0... @@ -32,4 +34,4 @@ for example-1.0... Preprocessing library for example-1.0... Running Haddock on library instantiated with Data.Map = for example-1.0... -Documentation created: /quickjump.dist/work/dist/build//ghc-/example-1.0/doc/html/example/ +Documentation created: /quickjump.dist/work/dist/build//ghc-/example-1.0/doc/html/example diff --git a/cabal-testsuite/PackageTests/HaddockBuildDepends/cabal.out b/cabal-testsuite/PackageTests/HaddockBuildDepends/cabal.out index 64f999e4368..8b0daaa45ad 100644 --- a/cabal-testsuite/PackageTests/HaddockBuildDepends/cabal.out +++ b/cabal-testsuite/PackageTests/HaddockBuildDepends/cabal.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -17,11 +19,11 @@ Preprocessing library for lib-1... Building library for lib-1... Preprocessing library for lib-1... Running Haddock on library for lib-1... -Documentation created: /cabal.dist/work/./dist//lib-1/dist/doc/html/lib/ +Documentation created: /cabal.dist/work/./dist//lib-1/dist/doc/html/lib Installing library in Configuring library for a-0.1.0.0... Preprocessing library for a-0.1.0.0... Building library for a-0.1.0.0... Preprocessing library for a-0.1.0.0... Running Haddock on library for a-0.1.0.0... -Documentation created: /cabal.dist/work/dist/build//ghc-/a-0.1.0.0/doc/html/a/ +Documentation created: /cabal.dist/work/dist/build//ghc-/a-0.1.0.0/doc/html/a diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/Setup.hs b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/Setup.hs similarity index 97% rename from cabal-testsuite/PackageTests/NewBuild/T4375/Setup.hs rename to cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/Setup.hs index 9a994af677b..e8ef27dbba9 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T4375/Setup.hs +++ b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/Setup.hs @@ -1,2 +1,3 @@ import Distribution.Simple + main = defaultMain diff --git a/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/Simple.hs b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/Simple.hs new file mode 100644 index 00000000000..df38c448c5e --- /dev/null +++ b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/Simple.hs @@ -0,0 +1,4 @@ +module Simple where + +-- | For hiding needles. +data Haystack = Haystack diff --git a/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/cabal.project b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/cabal.project new file mode 100644 index 00000000000..f45d5a19d3c --- /dev/null +++ b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/cabal.project @@ -0,0 +1,3 @@ +packages: . + +haddock-keep-temp-files: true diff --git a/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/cabal.test.hs b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/cabal.test.hs new file mode 100644 index 00000000000..e2d819e44d6 --- /dev/null +++ b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/cabal.test.hs @@ -0,0 +1,22 @@ +import Test.Cabal.Prelude + +-- Test that "cabal haddock" preserves temporary files +-- We use haddock-keep-temp-file: True in the cabal.project. +main = cabalTest $ recordMode DoNotRecord $ withProjectFile "cabal.project" $ do + cabal "haddock" [] + + -- From the docs for `System.IO.openTempFile`: + -- + -- On Windows, the template prefix may be truncated to 3 chars, e.g. + -- "foobar.ext" will be "fooXXX.ext". + let glob = + if isWindows + then "had*.txt" + else "haddock-response*.txt" + + -- Check that there is a response file. + responseFiles <- assertGlobMatchesTestDir testTmpDir glob + + -- Check that the matched response file is not empty, and is indeed a Haddock + -- response file. + assertAnyFileContains responseFiles "--package-name" diff --git a/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/my.cabal b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/my.cabal new file mode 100644 index 00000000000..a4a24980c12 --- /dev/null +++ b/cabal-testsuite/PackageTests/HaddockKeepTmpsCustom/my.cabal @@ -0,0 +1,16 @@ +cabal-version: 3.0 +name: HaddockKeepsTmpsCustom +version: 0.1 +license: BSD-3-Clause +author: Rodrigo Mesquita +stability: stable +category: PackageTests +build-type: Custom + +custom-setup + setup-depends: Cabal, base + +library + default-language: Haskell2010 + exposed-modules: Simple + build-depends: base diff --git a/cabal-testsuite/PackageTests/HaddockKeepsTmps/cabal.test.hs b/cabal-testsuite/PackageTests/HaddockKeepsTmps/cabal.test.hs index 9a3dfe1777b..3a76caadf6c 100644 --- a/cabal-testsuite/PackageTests/HaddockKeepsTmps/cabal.test.hs +++ b/cabal-testsuite/PackageTests/HaddockKeepsTmps/cabal.test.hs @@ -1,20 +1,29 @@ -{-# LANGUAGE LambdaCase #-} -import Test.Cabal.Prelude -import Distribution.Verbosity +import Data.List (isPrefixOf, sort) import Distribution.Simple.Glob import Distribution.Simple.Glob.Internal +import Distribution.Simple.Utils +import Distribution.Verbosity +import System.Directory +import Test.Cabal.Prelude -- Test that "cabal haddock" preserves temporary files -- We use haddock-keep-temp-file: True in the cabal.project. -main = cabalTest $ recordMode DoNotRecord $ do - skipIfWindows +main = + cabalTest $ recordMode DoNotRecord $ withProjectFile "cabal.project" $ do + cabal "haddock" [] - cabal "haddock" [] + -- From the docs for `System.IO.openTempFile`: + -- + -- On Windows, the template prefix may be truncated to 3 chars, e.g. + -- "foobar.ext" will be "fooXXX.ext". + let glob = + if isWindows + then "had*.txt" + else "haddock-response*.txt" - cwd <- fmap testCurrentDir getTestEnv + -- Check that there is a response file. + responseFiles <- assertGlobMatchesTestDir testTmpDir glob - (globMatches <$> liftIO (runDirFileGlob silent Nothing cwd (GlobDirRecursive [WildCard, Literal "response", WildCard, Literal "txt"]))) >>= \case - [] -> error "Expecting a response file to exist" - (m:_) -> - -- Assert the matched response file is not empty. - assertFileDoesContain (cwd m) "Simple.hs" + -- Check that the matched response file is not empty, and is indeed a Haddock + -- response file. + assertAnyFileContains responseFiles "--package-name" diff --git a/cabal-testsuite/PackageTests/HaddockNewline/setup.cabal.out b/cabal-testsuite/PackageTests/HaddockNewline/setup.cabal.out index 7db9a69eefe..57539271f24 100644 --- a/cabal-testsuite/PackageTests/HaddockNewline/setup.cabal.out +++ b/cabal-testsuite/PackageTests/HaddockNewline/setup.cabal.out @@ -3,4 +3,4 @@ Configuring HaddockNewline-0.1.0.0... # Setup haddock Preprocessing library for HaddockNewline-0.1.0.0... Running Haddock on library for HaddockNewline-0.1.0.0... -Documentation created: setup.cabal.dist/work/dist/doc/html/HaddockNewline/ +Documentation created: setup.cabal.dist/work/dist/doc/html/HaddockNewline diff --git a/cabal-testsuite/PackageTests/HaddockNewline/setup.out b/cabal-testsuite/PackageTests/HaddockNewline/setup.out index 57908512556..f18bb263e04 100644 --- a/cabal-testsuite/PackageTests/HaddockNewline/setup.out +++ b/cabal-testsuite/PackageTests/HaddockNewline/setup.out @@ -3,4 +3,4 @@ Configuring HaddockNewline-0.1.0.0... # Setup haddock Preprocessing library for HaddockNewline-0.1.0.0... Running Haddock on library for HaddockNewline-0.1.0.0... -Documentation created: setup.dist/work/dist/doc/html/HaddockNewline/ +Documentation created: setup.dist/work/dist/doc/html/HaddockNewline diff --git a/cabal-testsuite/PackageTests/HaddockProject/haddock-project.out b/cabal-testsuite/PackageTests/HaddockProject/haddock-project.out index 50ede874c75..4f21f859ad9 100644 --- a/cabal-testsuite/PackageTests/HaddockProject/haddock-project.out +++ b/cabal-testsuite/PackageTests/HaddockProject/haddock-project.out @@ -3,10 +3,8 @@ Downloading the latest package list from test-local-repo # cabal haddock-project Warning: haddock-project command is experimental, it might break in the future Resolving dependencies... -Build profile: -w ghc- -O1 -In order, the following will be built: - - async-2.2.4 (lib) (requires build) - - a-0.1.0.0 (lib) (first run) +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - async-2.2.4 (lib) (requires build) @@ -16,10 +14,10 @@ Preprocessing library for async-2.2.4... Building library for async-2.2.4... Preprocessing library for async-2.2.4... Running Haddock on library for async-2.2.4... -Documentation created: /dist-newstyle//async-2.2.4/dist/doc/html/async/ +Documentation created: /dist-newstyle//async-2.2.4/dist/doc/html/async Installing library in Configuring library for a-0.1.0.0... Preprocessing library for a-0.1.0.0... Running Haddock on library for a-0.1.0.0... -Documentation created: /dist-newstyle/build//ghc-/a-0.1.0.0/doc/html/a/ +Documentation created: /dist-newstyle/build//ghc-/a-0.1.0.0/doc/html/a Documentation created: haddocks/index.html diff --git a/cabal-testsuite/PackageTests/HaddockWarn/cabal.out b/cabal-testsuite/PackageTests/HaddockWarn/cabal.out index fae3d5423de..bdf609a5940 100644 --- a/cabal-testsuite/PackageTests/HaddockWarn/cabal.out +++ b/cabal-testsuite/PackageTests/HaddockWarn/cabal.out @@ -1,3 +1,5 @@ # cabal v2-haddock +Configuration is affected by the following files: +- cabal.project Resolving dependencies... -No documentation was generated as this package does not contain a library. Perhaps you want to use the --haddock-all flag, or one or more of the --haddock-executables, --haddock-tests, --haddock-benchmarks or --haddock-internal flags. \ No newline at end of file +No documentation was generated as this package does not contain a library. Perhaps you want to use the --haddock-all flag, or one or more of the --haddock-executables, --haddock-tests, --haddock-benchmarks or --haddock-internal flags. diff --git a/cabal-testsuite/PackageTests/IgnoreBuildTools/Hello.hs b/cabal-testsuite/PackageTests/IgnoreBuildTools/Hello.hs new file mode 100644 index 00000000000..4c2772407db --- /dev/null +++ b/cabal-testsuite/PackageTests/IgnoreBuildTools/Hello.hs @@ -0,0 +1,7 @@ +module Main where + +a :: String +a = "0000" + +main :: IO () +main = putStrLn a diff --git a/cabal-testsuite/PackageTests/IgnoreBuildTools/client.cabal b/cabal-testsuite/PackageTests/IgnoreBuildTools/client.cabal new file mode 100644 index 00000000000..fc69b378236 --- /dev/null +++ b/cabal-testsuite/PackageTests/IgnoreBuildTools/client.cabal @@ -0,0 +1,13 @@ +cabal-version: 3.0 +name: client +version: 0.1.0.0 +license: MIT +category: Testing +build-type: Simple + +executable hello-world + main-is: Hello.hs + build-depends: base + build-tool-depends: pre-proc:zero-to-one, another:non-existent + -- build-tools: somethingnonexists + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/IgnoreBuildTools/setup.out b/cabal-testsuite/PackageTests/IgnoreBuildTools/setup.out new file mode 100644 index 00000000000..de3c1b9d6bc --- /dev/null +++ b/cabal-testsuite/PackageTests/IgnoreBuildTools/setup.out @@ -0,0 +1,5 @@ +# Setup configure +Configuring client-0.1.0.0... +# Setup build +Preprocessing executable 'hello-world' for client-0.1.0.0... +Building executable 'hello-world' for client-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/IgnoreBuildTools/setup.test.hs b/cabal-testsuite/PackageTests/IgnoreBuildTools/setup.test.hs new file mode 100644 index 00000000000..0a0297ad454 --- /dev/null +++ b/cabal-testsuite/PackageTests/IgnoreBuildTools/setup.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude +-- Test --ignore-build-tools ignores build-tools and build-tool-depends +main = setupTest $ do + setup "configure" ["--ignore-build-tools"] + setup "build" [] diff --git a/cabal-testsuite/PackageTests/IndexCabalFileParseError/cabal.out b/cabal-testsuite/PackageTests/IndexCabalFileParseError/cabal.out new file mode 100644 index 00000000000..8d891bd421e --- /dev/null +++ b/cabal-testsuite/PackageTests/IndexCabalFileParseError/cabal.out @@ -0,0 +1,19 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +Warning: In /cabal.dist/repo/my-lib-1.0.tar.gz: Errors encountered when parsing cabal file my-lib-1.0/my-lib.cabal: + +my-lib-1.0/my-lib.cabal:4:22: error: +unexpected Unknown SPDX license identifier: 'puppy' + + 3 | version: 1.0 + 4 | license: puppy license :) + | ^ + +my-lib-1.0/my-lib.cabal:5:1: warning: +Unknown field: "puppy" + + 4 | license: puppy license :) + 5 | puppy: teehee! + | ^ +Error: [Cabal-7046] +Failed to read my-lib-1.0/my-lib.cabal from archive /cabal.dist/repo/my-lib-1.0.tar.gz diff --git a/cabal-testsuite/PackageTests/IndexCabalFileParseError/cabal.test.hs b/cabal-testsuite/PackageTests/IndexCabalFileParseError/cabal.test.hs new file mode 100644 index 00000000000..05a6bfc4934 --- /dev/null +++ b/cabal-testsuite/PackageTests/IndexCabalFileParseError/cabal.test.hs @@ -0,0 +1,4 @@ +import Test.Cabal.Prelude + +main = cabalTest $ withRepoNoUpdate "repo" $ do + fails $ cabal "v2-update" [] diff --git a/cabal-testsuite/PackageTests/IndexCabalFileParseError/repo/my-lib-1.0/my-lib.cabal b/cabal-testsuite/PackageTests/IndexCabalFileParseError/repo/my-lib-1.0/my-lib.cabal new file mode 100644 index 00000000000..f37d57df406 --- /dev/null +++ b/cabal-testsuite/PackageTests/IndexCabalFileParseError/repo/my-lib-1.0/my-lib.cabal @@ -0,0 +1,5 @@ +cabal-version: 3.0 +name: my-lib +version: 1.0 +license: puppy license :) +puppy: teehee! diff --git a/cabal-testsuite/PackageTests/Init/init-without-git.out b/cabal-testsuite/PackageTests/Init/init-without-git.out new file mode 100644 index 00000000000..9a143a9375c --- /dev/null +++ b/cabal-testsuite/PackageTests/Init/init-without-git.out @@ -0,0 +1 @@ +# cabal init diff --git a/cabal-testsuite/PackageTests/Init/init-without-git.test.hs b/cabal-testsuite/PackageTests/Init/init-without-git.test.hs new file mode 100644 index 00000000000..4c98f751c57 --- /dev/null +++ b/cabal-testsuite/PackageTests/Init/init-without-git.test.hs @@ -0,0 +1,22 @@ +import Test.Cabal.Prelude +import System.Directory +import System.FilePath +import Distribution.Simple.Utils +import Distribution.Verbosity + +-- Test cabal init when git is not installed +main = do + skipIfWindows "Might fail on windows." + tmp <- getTemporaryDirectory + withTempDirectory normal tmp "bin" $ + \bin -> cabalTest $ + do + ghc_path <- programPathM ghcProgram + cabal_path <- programPathM cabalProgram + withSymlink ghc_path (bin "ghc") . withSymlink cabal_path (bin "cabal") . + withEnv [("PATH", Just bin)] $ do + cwd <- fmap testSourceCopyDir getTestEnv + + void . withDirectory cwd $ do + cabalWithStdin "init" ["-i"] + "2\n\n5\n\n\n2\n\n\n\n\n\n\n\n\n\n" diff --git a/cabal-testsuite/PackageTests/Install/DistPrefInstall/CHANGELOG.md b/cabal-testsuite/PackageTests/Install/DistPrefInstall/CHANGELOG.md new file mode 100644 index 00000000000..3d5552b0ba5 --- /dev/null +++ b/cabal-testsuite/PackageTests/Install/DistPrefInstall/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for DistPrefInstall + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/Install/DistPrefInstall/DistPrefInstall.cabal b/cabal-testsuite/PackageTests/Install/DistPrefInstall/DistPrefInstall.cabal new file mode 100644 index 00000000000..536d26b3648 --- /dev/null +++ b/cabal-testsuite/PackageTests/Install/DistPrefInstall/DistPrefInstall.cabal @@ -0,0 +1,18 @@ +cabal-version: 3.12 +name: DistPrefInstall +version: 0.1.0.0 +license: NONE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +build-type: Simple +extra-doc-files: CHANGELOG.md + +common warnings + ghc-options: -Wall + +library + import: warnings + exposed-modules: MyLib + build-depends: base + hs-source-dirs: src + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/CustomDep/custom/Setup.hs b/cabal-testsuite/PackageTests/Install/DistPrefInstall/Setup.hs similarity index 100% rename from cabal-testsuite/PackageTests/CustomDep/custom/Setup.hs rename to cabal-testsuite/PackageTests/Install/DistPrefInstall/Setup.hs diff --git a/cabal-testsuite/PackageTests/Install/DistPrefInstall/setup.test.hs b/cabal-testsuite/PackageTests/Install/DistPrefInstall/setup.test.hs new file mode 100644 index 00000000000..27b709e7070 --- /dev/null +++ b/cabal-testsuite/PackageTests/Install/DistPrefInstall/setup.test.hs @@ -0,0 +1,8 @@ +import Test.Cabal.Prelude + +main = setupTest $ recordMode DoNotRecord $ withPackageDb $ do + setup "configure" [] + setup "build" [] + setup "copy" [] + setup "install" [] + setup "sdist" [] diff --git a/cabal-testsuite/PackageTests/Install/DistPrefInstall/src/MyLib.hs b/cabal-testsuite/PackageTests/Install/DistPrefInstall/src/MyLib.hs new file mode 100644 index 00000000000..e657c4403f6 --- /dev/null +++ b/cabal-testsuite/PackageTests/Install/DistPrefInstall/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib (someFunc) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" diff --git a/cabal-testsuite/PackageTests/Install/ProgramAffixes/Main.hs b/cabal-testsuite/PackageTests/Install/ProgramAffixes/Main.hs new file mode 100644 index 00000000000..76a9bdb5d48 --- /dev/null +++ b/cabal-testsuite/PackageTests/Install/ProgramAffixes/Main.hs @@ -0,0 +1 @@ +main = pure () diff --git a/cabal-testsuite/PackageTests/CustomPlain/cabal.project b/cabal-testsuite/PackageTests/Install/ProgramAffixes/cabal.project similarity index 100% rename from cabal-testsuite/PackageTests/CustomPlain/cabal.project rename to cabal-testsuite/PackageTests/Install/ProgramAffixes/cabal.project diff --git a/cabal-testsuite/PackageTests/Install/ProgramAffixes/cabal.test.hs b/cabal-testsuite/PackageTests/Install/ProgramAffixes/cabal.test.hs new file mode 100644 index 00000000000..c02eda531f6 --- /dev/null +++ b/cabal-testsuite/PackageTests/Install/ProgramAffixes/cabal.test.hs @@ -0,0 +1,27 @@ +import Test.Cabal.Prelude +import Data.Foldable (traverse_) + +-- Test that program affixes options result in successful installation: +-- • Valid symlinks (--install-method=symlink) +-- • Valid copy of executables (--install-method=copy) +main = cabalTest $ do + env <- getTestEnv + recordMode DoNotRecord $ do + let installdir = testPrefixDir env "bin" + commonOpts = ["p", "--installdir", installdir, "--overwrite-policy=always"] + testAllAffixes installMethod = do + let testAffixes' = testAffixes + (commonOpts ++ ["--install-method", installMethod]) + testAffixes' Nothing Nothing + testAffixes' (Just "a-") Nothing + testAffixes' Nothing (Just "-z") + testAffixes' (Just "a-") (Just "-z") + traverse_ testAllAffixes ["symlink", "copy"] + where + mkAffixOption option = maybe [] (\a -> ["--program-" ++ option, a]) + mkProgramName p s = maybe [] id p ++ "p" ++ maybe [] id s + testAffixes commonOpts prefix suffix = do + cabal "install" ( commonOpts + ++ mkAffixOption "prefix" prefix + ++ mkAffixOption "suffix" suffix) + runInstalledExe (mkProgramName prefix suffix) [] diff --git a/cabal-testsuite/PackageTests/Install/ProgramAffixes/overwrite-policy.out b/cabal-testsuite/PackageTests/Install/ProgramAffixes/overwrite-policy.out new file mode 100644 index 00000000000..cf1c952c9d3 --- /dev/null +++ b/cabal-testsuite/PackageTests/Install/ProgramAffixes/overwrite-policy.out @@ -0,0 +1,160 @@ +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - p-1.0 (exe:p) (requires build) +Configuring p-1.0... +Preprocessing executable 'p' for p-1.0... +Building executable 'p' for p-1.0... +Installing executable p in +Warning: The directory /overwrite-policy.dist/home/.cabal/store/ghc-/incoming/new-/overwrite-policy.dist/home/.cabal/store/ghc-/-/bin is not in the system search path. +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Error: [Cabal-7149] +Path '/overwrite-policy.dist/usr/bin/p' already exists. Use --overwrite-policy=always to overwrite. +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p-my-suffix' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Error: [Cabal-7149] +Path '/overwrite-policy.dist/usr/bin/p-my-suffix' already exists. Use --overwrite-policy=always to overwrite. +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p-my-suffix' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/my-prefix-p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Error: [Cabal-7149] +Path '/overwrite-policy.dist/usr/bin/my-prefix-p' already exists. Use --overwrite-policy=always to overwrite. +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/my-prefix-p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/my-prefix-p-my-suffix' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Error: [Cabal-7149] +Path '/overwrite-policy.dist/usr/bin/my-prefix-p-my-suffix' already exists. Use --overwrite-policy=always to overwrite. +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/my-prefix-p-my-suffix' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Symlinking 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Error: [Cabal-7149] +Path '/overwrite-policy.dist/usr/bin/p' already exists. Use --overwrite-policy=always to overwrite. +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p-my-suffix' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Error: [Cabal-7149] +Path '/overwrite-policy.dist/usr/bin/p-my-suffix' already exists. Use --overwrite-policy=always to overwrite. +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p-my-suffix' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/my-prefix-p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Error: [Cabal-7149] +Path '/overwrite-policy.dist/usr/bin/my-prefix-p' already exists. Use --overwrite-policy=always to overwrite. +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/my-prefix-p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/my-prefix-p-my-suffix' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Error: [Cabal-7149] +Path '/overwrite-policy.dist/usr/bin/my-prefix-p-my-suffix' already exists. Use --overwrite-policy=always to overwrite. +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/my-prefix-p-my-suffix' +# cabal install +Wrote tarball sdist to /overwrite-policy.dist/work/./dist/sdist/p-1.0.tar.gz +Resolving dependencies... +Copying 'p' to '/overwrite-policy.dist/usr/bin/p' diff --git a/cabal-testsuite/PackageTests/Install/ProgramAffixes/overwrite-policy.test.hs b/cabal-testsuite/PackageTests/Install/ProgramAffixes/overwrite-policy.test.hs new file mode 100644 index 00000000000..f94fa436387 --- /dev/null +++ b/cabal-testsuite/PackageTests/Install/ProgramAffixes/overwrite-policy.test.hs @@ -0,0 +1,66 @@ +import Test.Cabal.Prelude +import System.FilePath (()) +import System.Directory (removeFile) + +main = cabalTest $ do + runTestForInstallMethod "symlink" + runTestForInstallMethod "copy" + +runTestForInstallMethod :: String -> TestM () +runTestForInstallMethod method = do + env <- getTestEnv + let installdir = testPrefixDir env "bin" + + -- install the binary, don't overwrite anything + cabal "install" + ["p", "--installdir", installdir, "--install-method", method, "--overwrite-policy", "never"] + -- install the binary, don't overwrite anything + fails $ cabal "install" + ["p", "--installdir", installdir, "--install-method", method, "--overwrite-policy", "never"] + -- install the binary again, forcing an overwrite, should succeed. + cabal "install" + ["p", "--installdir", installdir, "--install-method", method, "--overwrite-policy", "always"] + -- remove the installed binary. + liftIO $ removeFile (installdir "p" <.> exeExt) + + testPolicyForAffix installdir method ["--program-suffix", "-my-suffix"] + testPolicyForAffix installdir method ["--program-prefix", "my-prefix-"] + testPolicyForAffix installdir method ["--program-prefix", "my-prefix-", "--program-suffix", "-my-suffix"] + -- remove the installed binaries. + liftIO $ removeFile (installdir "p" <.> exeExt) + liftIO $ removeFile (installdir "p-my-suffix" <.> exeExt) + liftIO $ removeFile (installdir "my-prefix-p" <.> exeExt) + liftIO $ removeFile (installdir "my-prefix-p-my-suffix" <.> exeExt) + +-- | Run a policy test for a given 'install-method' and program-affix +-- (i.e., '--program-suffix' or '--program-prefix'). +-- +-- When a program affix is given, the installation should not be affected +-- by installing the binary with no affix and vice-versa. +-- So, installing the program without any affix is not affected by installations with +-- some program affix. +testPolicyForAffix :: FilePath -> String -> [String] -> TestM () +testPolicyForAffix installdir method affixArgs = do + -- install the binary again, forcing an overwrite, must succeed. + -- The rest of this test assumes the binary has been installed before. + cabal "install" + ["p", "--installdir", installdir, "--install-method", method, "--overwrite-policy", "always"] + + -- Install the binary with some program affix, don't need overwrite anything + cabal "install" + (["p", "--installdir", installdir, "--install-method", method, "--overwrite-policy", "never"] ++ affixArgs) + -- Once the binary is installed, we can't overwrite it unless we are told so. + fails $ cabal "install" + (["p", "--installdir", installdir, "--install-method", method, "--overwrite-policy", "never"] ++ affixArgs) + -- Successfully overwrite the binary if told so. + cabal "install" + (["p", "--installdir", installdir, "--install-method", method, "--overwrite-policy", "always"] ++ affixArgs) + + -- remove the installed binary. + liftIO $ removeFile (installdir "p" <.> exeExt) + -- Make sure we can still install the original program with no program affix without overwriting, + -- even though, the program is already installed with some affix. + cabal "install" + ["p", "--installdir", installdir, "--install-method", method, "--overwrite-policy", "never"] + +exeExt = if isWindows then "exe" else "" diff --git a/cabal-testsuite/PackageTests/Install/ProgramAffixes/p.cabal b/cabal-testsuite/PackageTests/Install/ProgramAffixes/p.cabal new file mode 100644 index 00000000000..30428ef4ac3 --- /dev/null +++ b/cabal-testsuite/PackageTests/Install/ProgramAffixes/p.cabal @@ -0,0 +1,8 @@ +name: p +version: 1.0 +build-type: Simple +cabal-version: >= 1.2 + +executable p + main-is: Main.hs + build-depends: base diff --git a/cabal-testsuite/PackageTests/InternalLibraries/Executable/setup-static.test.hs b/cabal-testsuite/PackageTests/InternalLibraries/Executable/setup-static.test.hs index e84be709823..1c12fd03a7a 100644 --- a/cabal-testsuite/PackageTests/InternalLibraries/Executable/setup-static.test.hs +++ b/cabal-testsuite/PackageTests/InternalLibraries/Executable/setup-static.test.hs @@ -24,7 +24,7 @@ import System.Directory -- this does build shared libraries just to make sure they -- don't get installed, so this test doesn't work on Windows.) main = setupAndCabalTest $ do - skipUnless "no shared libs" =<< hasSharedLibraries + skipIfNoSharedLibraries withPackageDb $ do -- MULTI forM_ [False, True] $ \is_dynamic -> do diff --git a/cabal-testsuite/PackageTests/InternalLibraries/Haddock/haddock.cabal.out b/cabal-testsuite/PackageTests/InternalLibraries/Haddock/haddock.cabal.out index bdc57a81bfd..dbd8c26e948 100644 --- a/cabal-testsuite/PackageTests/InternalLibraries/Haddock/haddock.cabal.out +++ b/cabal-testsuite/PackageTests/InternalLibraries/Haddock/haddock.cabal.out @@ -18,10 +18,10 @@ Registering library 'foo-internal-after' for foo-0.1.0.0... # Setup haddock Preprocessing library 'foo-internal-before' for foo-0.1.0.0... Running Haddock on library 'foo-internal-before' for foo-0.1.0.0... -Documentation created: haddock.cabal.dist/work/dist/doc/html/foo/ +Documentation created: haddock.cabal.dist/work/dist/doc/html/foo/foo-internal-before Preprocessing library for foo-0.1.0.0... Running Haddock on library for foo-0.1.0.0... -Documentation created: haddock.cabal.dist/work/dist/doc/html/foo/ +Documentation created: haddock.cabal.dist/work/dist/doc/html/foo Preprocessing library 'foo-internal-after' for foo-0.1.0.0... Running Haddock on library 'foo-internal-after' for foo-0.1.0.0... -Documentation created: haddock.cabal.dist/work/dist/doc/html/foo/ +Documentation created: haddock.cabal.dist/work/dist/doc/html/foo/foo-internal-after diff --git a/cabal-testsuite/PackageTests/InternalLibraries/Haddock/haddock.out b/cabal-testsuite/PackageTests/InternalLibraries/Haddock/haddock.out index 44ee7824244..6259fcfeb0c 100644 --- a/cabal-testsuite/PackageTests/InternalLibraries/Haddock/haddock.out +++ b/cabal-testsuite/PackageTests/InternalLibraries/Haddock/haddock.out @@ -18,10 +18,10 @@ Registering library 'foo-internal-after' for foo-0.1.0.0... # Setup haddock Preprocessing library 'foo-internal-before' for foo-0.1.0.0... Running Haddock on library 'foo-internal-before' for foo-0.1.0.0... -Documentation created: haddock.dist/work/dist/doc/html/foo/ +Documentation created: haddock.dist/work/dist/doc/html/foo/foo-internal-before Preprocessing library for foo-0.1.0.0... Running Haddock on library for foo-0.1.0.0... -Documentation created: haddock.dist/work/dist/doc/html/foo/ +Documentation created: haddock.dist/work/dist/doc/html/foo Preprocessing library 'foo-internal-after' for foo-0.1.0.0... Running Haddock on library 'foo-internal-after' for foo-0.1.0.0... -Documentation created: haddock.dist/work/dist/doc/html/foo/ +Documentation created: haddock.dist/work/dist/doc/html/foo/foo-internal-after diff --git a/cabal-testsuite/PackageTests/InternalLibraries/cabal-per-package.out b/cabal-testsuite/PackageTests/InternalLibraries/cabal-per-package.out index 72a24d04059..fabb3eb96bf 100644 --- a/cabal-testsuite/PackageTests/InternalLibraries/cabal-per-package.out +++ b/cabal-testsuite/PackageTests/InternalLibraries/cabal-per-package.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: Internal libraries only supported with per-component builds. diff --git a/cabal-testsuite/PackageTests/InternalLibraries/cabal.out b/cabal-testsuite/PackageTests/InternalLibraries/cabal.out index fba3d64f472..dce636019a9 100644 --- a/cabal-testsuite/PackageTests/InternalLibraries/cabal.out +++ b/cabal-testsuite/PackageTests/InternalLibraries/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/InternalLibraries/setup-gen-script.test.hs b/cabal-testsuite/PackageTests/InternalLibraries/setup-gen-script.test.hs index 644d437b8ab..ada96fc159a 100644 --- a/cabal-testsuite/PackageTests/InternalLibraries/setup-gen-script.test.hs +++ b/cabal-testsuite/PackageTests/InternalLibraries/setup-gen-script.test.hs @@ -1,13 +1,12 @@ import Test.Cabal.Prelude -- Test to see if --gen-script main = setupAndCabalTest $ do - is_windows <- isWindows withPackageDb $ do withDirectory "p" $ do setup_build [] setup "copy" [] setup "register" ["--gen-script"] - _ <- if is_windows + _ <- if isWindows then shell "cmd" ["/C", "register.bat"] else shell "sh" ["register.sh"] return () diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/Foo.hs b/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/Foo.hs deleted file mode 100644 index efbf93bbde8..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/Foo.hs +++ /dev/null @@ -1 +0,0 @@ -module Foo where diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/build-depends-extra-version.cabal b/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/build-depends-extra-version.cabal deleted file mode 100644 index 01c7b3b5972..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/build-depends-extra-version.cabal +++ /dev/null @@ -1,17 +0,0 @@ -name: build-depends-extra-version -version: 0.1.0.0 -synopsis: Checks build-depends warns for extraneous version -license: BSD3 -category: Testing -build-type: Simple -cabal-version: >=1.10 - -library - exposed-modules: Foo - default-language: Haskell2010 - -executable bar - main-is: Main.hs - build-depends: build-depends-extra-version >=0.0.0.1 - -- ^ internal dependency, extraneous version - default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/setup.cabal.out b/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/setup.cabal.out deleted file mode 100644 index 61f9d97a4ba..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/setup.cabal.out +++ /dev/null @@ -1,13 +0,0 @@ -# Setup configure -Configuring build-depends-extra-version-0.1.0.0... -Warning: The package has an extraneous version range for a dependency on an internal library: build-depends-extra-version >=0.0.0.1. This version range includes the current package but isn't needed as the current package's library will always be used. -# Setup sdist -Distribution quality errors: -The package has an extraneous version range for a dependency on an internal library: build-depends-extra-version >=0.0.0.1. This version range includes the current package but isn't needed as the current package's library will always be used. -Distribution quality warnings: -No 'maintainer' field. -No 'description' field. -A 'license-file' is not specified. -Note: the public hackage server would reject this package. -Building source dist for build-depends-extra-version-0.1.0.0... -Source tarball created: setup.cabal.dist/work/dist/build-depends-extra-version-0.1.0.0.tar.gz diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/setup.out b/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/setup.out deleted file mode 100644 index 2b9987c8544..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/setup.out +++ /dev/null @@ -1,13 +0,0 @@ -# Setup configure -Configuring build-depends-extra-version-0.1.0.0... -Warning: The package has an extraneous version range for a dependency on an internal library: build-depends-extra-version >=0.0.0.1. This version range includes the current package but isn't needed as the current package's library will always be used. -# Setup sdist -Distribution quality errors: -The package has an extraneous version range for a dependency on an internal library: build-depends-extra-version >=0.0.0.1. This version range includes the current package but isn't needed as the current package's library will always be used. -Distribution quality warnings: -No 'maintainer' field. -No 'description' field. -A 'license-file' is not specified. -Note: the public hackage server would reject this package. -Building source dist for build-depends-extra-version-0.1.0.0... -Source tarball created: setup.dist/work/dist/build-depends-extra-version-0.1.0.0.tar.gz diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/setup.test.hs b/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/setup.test.hs deleted file mode 100644 index c006efe6f72..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/setup.test.hs +++ /dev/null @@ -1,6 +0,0 @@ -import Test.Cabal.Prelude --- Test unneed version bound on internal build-tools deps -main = setupAndCabalTest . expectBroken 7470 $ do - setup' "configure" [] - assertOutputContains "extraneous version range" - =<< setup' "sdist" [] diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/Foo.hs b/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/Foo.hs deleted file mode 100644 index efbf93bbde8..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/Foo.hs +++ /dev/null @@ -1 +0,0 @@ -module Foo where diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/build-tool-depends-extra-version.cabal b/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/build-tool-depends-extra-version.cabal deleted file mode 100644 index af43e0cdd02..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/build-tool-depends-extra-version.cabal +++ /dev/null @@ -1,18 +0,0 @@ -name: build-tool-depends-extra-version -version: 0.1.0.0 -synopsis: Checks build-tool-depends warns for extraneous version -license: BSD3 -category: Testing -build-type: Simple -cabal-version: >=1.10 - -library - exposed-modules: Foo - build-tool-depends: build-tool-depends-extra-version:hello-world >=0.0.0.1 - -- ^ internal dependency, extraneous version - default-language: Haskell2010 - -executable hello-world - main-is: Main.hs - build-depends: base - default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/setup.cabal.out b/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/setup.cabal.out deleted file mode 100644 index c247d90f995..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/setup.cabal.out +++ /dev/null @@ -1,13 +0,0 @@ -# Setup configure -Configuring build-tool-depends-extra-version-0.1.0.0... -Warning: The package has an extraneous version range for a dependency on an internal executable: build-tool-depends-extra-version:hello-world >=0.0.0.1. This version range includes the current package but isn't needed as the current package's executable will always be used. -# Setup sdist -Distribution quality errors: -The package has an extraneous version range for a dependency on an internal executable: build-tool-depends-extra-version:hello-world >=0.0.0.1. This version range includes the current package but isn't needed as the current package's executable will always be used. -Distribution quality warnings: -No 'maintainer' field. -No 'description' field. -A 'license-file' is not specified. -Note: the public hackage server would reject this package. -Building source dist for build-tool-depends-extra-version-0.1.0.0... -Source tarball created: setup.cabal.dist/work/dist/build-tool-depends-extra-version-0.1.0.0.tar.gz diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/setup.out b/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/setup.out deleted file mode 100644 index cd0ba1f5e0a..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/setup.out +++ /dev/null @@ -1,13 +0,0 @@ -# Setup configure -Configuring build-tool-depends-extra-version-0.1.0.0... -Warning: The package has an extraneous version range for a dependency on an internal executable: build-tool-depends-extra-version:hello-world >=0.0.0.1. This version range includes the current package but isn't needed as the current package's executable will always be used. -# Setup sdist -Distribution quality errors: -The package has an extraneous version range for a dependency on an internal executable: build-tool-depends-extra-version:hello-world >=0.0.0.1. This version range includes the current package but isn't needed as the current package's executable will always be used. -Distribution quality warnings: -No 'maintainer' field. -No 'description' field. -A 'license-file' is not specified. -Note: the public hackage server would reject this package. -Building source dist for build-tool-depends-extra-version-0.1.0.0... -Source tarball created: setup.dist/work/dist/build-tool-depends-extra-version-0.1.0.0.tar.gz diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/setup.test.hs b/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/setup.test.hs deleted file mode 100644 index c006efe6f72..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/setup.test.hs +++ /dev/null @@ -1,6 +0,0 @@ -import Test.Cabal.Prelude --- Test unneed version bound on internal build-tools deps -main = setupAndCabalTest . expectBroken 7470 $ do - setup' "configure" [] - assertOutputContains "extraneous version range" - =<< setup' "sdist" [] diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/Foo.hs b/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/Foo.hs deleted file mode 100644 index efbf93bbde8..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/Foo.hs +++ /dev/null @@ -1 +0,0 @@ -module Foo where diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/Main.hs b/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/Main.hs deleted file mode 100644 index d82a4bd93b7..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/Main.hs +++ /dev/null @@ -1,4 +0,0 @@ -module Main where - -main :: IO () -main = return () diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/build-tools-extra-version.cabal b/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/build-tools-extra-version.cabal deleted file mode 100644 index c5371bf45ee..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/build-tools-extra-version.cabal +++ /dev/null @@ -1,18 +0,0 @@ -name: build-tools-extra-version -version: 0.1.0.0 -synopsis: Checks build-tools warns for extraneous version -license: BSD3 -category: Testing -build-type: Simple -cabal-version: >=1.10 - -library - exposed-modules: Foo - build-tools: hello-world >=0.0.0.1 - -- ^ internal dependency, extraneous version - default-language: Haskell2010 - -executable hello-world - main-is: Main.hs - build-depends: base - default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/setup.cabal.out b/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/setup.cabal.out deleted file mode 100644 index 58d3172cb43..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/setup.cabal.out +++ /dev/null @@ -1,13 +0,0 @@ -# Setup configure -Configuring build-tools-extra-version-0.1.0.0... -Warning: The package has an extraneous version range for a dependency on an internal executable: build-tools-extra-version:hello-world >=0.0.0.1. This version range includes the current package but isn't needed as the current package's executable will always be used. -# Setup sdist -Distribution quality errors: -The package has an extraneous version range for a dependency on an internal executable: build-tools-extra-version:hello-world >=0.0.0.1. This version range includes the current package but isn't needed as the current package's executable will always be used. -Distribution quality warnings: -No 'maintainer' field. -No 'description' field. -A 'license-file' is not specified. -Note: the public hackage server would reject this package. -Building source dist for build-tools-extra-version-0.1.0.0... -Source tarball created: setup.cabal.dist/work/dist/build-tools-extra-version-0.1.0.0.tar.gz diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/setup.out b/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/setup.out deleted file mode 100644 index 28059d26ccd..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/setup.out +++ /dev/null @@ -1,13 +0,0 @@ -# Setup configure -Configuring build-tools-extra-version-0.1.0.0... -Warning: The package has an extraneous version range for a dependency on an internal executable: build-tools-extra-version:hello-world >=0.0.0.1. This version range includes the current package but isn't needed as the current package's executable will always be used. -# Setup sdist -Distribution quality errors: -The package has an extraneous version range for a dependency on an internal executable: build-tools-extra-version:hello-world >=0.0.0.1. This version range includes the current package but isn't needed as the current package's executable will always be used. -Distribution quality warnings: -No 'maintainer' field. -No 'description' field. -A 'license-file' is not specified. -Note: the public hackage server would reject this package. -Building source dist for build-tools-extra-version-0.1.0.0... -Source tarball created: setup.dist/work/dist/build-tools-extra-version-0.1.0.0.tar.gz diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/setup.test.hs b/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/setup.test.hs deleted file mode 100644 index c006efe6f72..00000000000 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolsExtra/setup.test.hs +++ /dev/null @@ -1,6 +0,0 @@ -import Test.Cabal.Prelude --- Test unneed version bound on internal build-tools deps -main = setupAndCabalTest . expectBroken 7470 $ do - setup' "configure" [] - assertOutputContains "extraneous version range" - =<< setup' "sdist" [] diff --git a/cabal-testsuite/PackageTests/JS/JsSources/js-arch.test.hs b/cabal-testsuite/PackageTests/JS/JsSources/js-arch.test.hs index 1fed749bdb8..2b318af6670 100644 --- a/cabal-testsuite/PackageTests/JS/JsSources/js-arch.test.hs +++ b/cabal-testsuite/PackageTests/JS/JsSources/js-arch.test.hs @@ -1,9 +1,9 @@ import Test.Cabal.Prelude -main = setupAndCabalTest $ do - skipUnlessGhcVersion ">= 9.6" +main = do skipUnlessJavaScript - skipIfWindows - - res <- cabal' "v2-run" ["demo"] - assertOutputContains "Hello JS!" res + skipIfWindows "" + setupAndCabalTest $ do + skipUnlessGhcVersion ">= 9.6" + res <- cabal' "v2-run" ["demo"] + assertOutputContains "Hello JS!" res diff --git a/cabal-testsuite/PackageTests/JS/JsSources/other-arch.out b/cabal-testsuite/PackageTests/JS/JsSources/other-arch.out index a07cc17dd35..5a9e791cfce 100644 --- a/cabal-testsuite/PackageTests/JS/JsSources/other-arch.out +++ b/cabal-testsuite/PackageTests/JS/JsSources/other-arch.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/JS/JsSources/other-arch.test.hs b/cabal-testsuite/PackageTests/JS/JsSources/other-arch.test.hs index 187a9cf73bd..2e92eb1fcc5 100644 --- a/cabal-testsuite/PackageTests/JS/JsSources/other-arch.test.hs +++ b/cabal-testsuite/PackageTests/JS/JsSources/other-arch.test.hs @@ -1,7 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ do +main = do skipIfJavaScript - -- Ensure the field `js-sources` does not raise issues - res <- cabal' "v2-run" ["demo"] - assertOutputContains "Hello Not JS!" res + cabalTest $ do + -- Ensure the field `js-sources` does not raise issues + res <- cabal' "v2-run" ["demo"] + assertOutputContains "Hello Not JS!" res diff --git a/cabal-testsuite/PackageTests/JS/JsSourcesExe/js-arch.test.hs b/cabal-testsuite/PackageTests/JS/JsSourcesExe/js-arch.test.hs index 1fed749bdb8..2b318af6670 100644 --- a/cabal-testsuite/PackageTests/JS/JsSourcesExe/js-arch.test.hs +++ b/cabal-testsuite/PackageTests/JS/JsSourcesExe/js-arch.test.hs @@ -1,9 +1,9 @@ import Test.Cabal.Prelude -main = setupAndCabalTest $ do - skipUnlessGhcVersion ">= 9.6" +main = do skipUnlessJavaScript - skipIfWindows - - res <- cabal' "v2-run" ["demo"] - assertOutputContains "Hello JS!" res + skipIfWindows "" + setupAndCabalTest $ do + skipUnlessGhcVersion ">= 9.6" + res <- cabal' "v2-run" ["demo"] + assertOutputContains "Hello JS!" res diff --git a/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.out b/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.out index 96e1bbadcf9..441e8b14ba4 100644 --- a/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.out +++ b/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.test.hs b/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.test.hs index 187a9cf73bd..2e92eb1fcc5 100644 --- a/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.test.hs +++ b/cabal-testsuite/PackageTests/JS/JsSourcesExe/other-arch.test.hs @@ -1,7 +1,8 @@ import Test.Cabal.Prelude -main = cabalTest $ do +main = do skipIfJavaScript - -- Ensure the field `js-sources` does not raise issues - res <- cabal' "v2-run" ["demo"] - assertOutputContains "Hello Not JS!" res + cabalTest $ do + -- Ensure the field `js-sources` does not raise issues + res <- cabal' "v2-run" ["demo"] + assertOutputContains "Hello Not JS!" res diff --git a/cabal-testsuite/PackageTests/LinkerOptions/NonignoredConfigs/cabal.test.hs b/cabal-testsuite/PackageTests/LinkerOptions/NonignoredConfigs/cabal.test.hs index 8e7c8a6391d..55ec5ee6144 100644 --- a/cabal-testsuite/PackageTests/LinkerOptions/NonignoredConfigs/cabal.test.hs +++ b/cabal-testsuite/PackageTests/LinkerOptions/NonignoredConfigs/cabal.test.hs @@ -52,14 +52,7 @@ lrun :: [Linking] lrun = [Static, Dynamic, Static, Dynamic] main = cabalTest $ do - -- Skip if on Windows, since my default Chocolatey Windows setup (and the CI - -- server setup at the time, presumably) lacks support for dynamic builds - -- since the base package appears to be static only, lacking e.g. ‘.dyn_o’ - -- files. Normal Windows installations would need support for dynamic - -- builds, or else this test would fail when it tries to build with the - -- dynamic flags. - skipIfWindows - + skipIfNoSharedLibraries env <- getTestEnv withPackageDb $ do -- Phase 1: get 4 hashes according to config flags. diff --git a/cabal-testsuite/PackageTests/LinkerOptions/T7339/setup.test.hs b/cabal-testsuite/PackageTests/LinkerOptions/T7339/setup.test.hs index a46921de895..233d3b20736 100644 --- a/cabal-testsuite/PackageTests/LinkerOptions/T7339/setup.test.hs +++ b/cabal-testsuite/PackageTests/LinkerOptions/T7339/setup.test.hs @@ -18,8 +18,7 @@ import Test.Cabal.Prelude main = setupTest $ do - - skipIfWindows + skipIfNoSharedLibraries skipUnlessGhcVersion ">= 8.4" withPackageDb $ do @@ -59,9 +58,9 @@ main = setupTest $ do pkgDb <- testPackageDbDir <$> getTestEnv ghciScript <- liftIO $ readFile (cwd "T19350.script") _ <- runProgramM ghcProgram - [ "--interactive" - , "-package", "T7339" - , "-package-db", pkgDb - ] (Just ghciScript) + [ "--interactive" + , "-package", "T7339" + , "-package-db", pkgDb + ] (Just ghciScript) return () diff --git a/cabal-testsuite/PackageTests/ListBin/SelectedComponent/cabal.out b/cabal-testsuite/PackageTests/ListBin/SelectedComponent/cabal.out index 3728cc3e70e..a3613ceff25 100644 --- a/cabal-testsuite/PackageTests/ListBin/SelectedComponent/cabal.out +++ b/cabal-testsuite/PackageTests/ListBin/SelectedComponent/cabal.out @@ -1,4 +1,6 @@ # cabal list-bin +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/cabal.out b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/cabal.out new file mode 100644 index 00000000000..ec51444c0e4 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/cabal.out @@ -0,0 +1,12 @@ +# cabal v2-repl +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - pkg-a-1 (interactive) (lib) (first run) + - pkg-b-0 (interactive) (lib) (first run) +Configuring library for pkg-a-1... +Preprocessing library for pkg-a-1... +Configuring library for pkg-b-0... +Preprocessing library for pkg-b-0... diff --git a/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/cabal.project b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/cabal.project new file mode 100644 index 00000000000..bf8292adeb5 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/cabal.project @@ -0,0 +1,2 @@ +packages: pkg-a/*.cabal +packages: pkg-b/*.cabal diff --git a/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/cabal.test.hs b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/cabal.test.hs new file mode 100644 index 00000000000..5a8434c5467 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/cabal.test.hs @@ -0,0 +1,7 @@ +import Test.Cabal.Prelude + +main = do + cabalTest $ do + skipUnlessGhcVersion ">= 9.4" + res <- cabalWithStdin "v2-repl" ["--enable-multi-repl","pkg-b", "pkg-a"] "Bar.bar" + assertOutputContains "3735929054" res diff --git a/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-a/Foo.hs b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-a/Foo.hs new file mode 100644 index 00000000000..997ca89eecd --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-a/Foo.hs @@ -0,0 +1,5 @@ +module Foo where + +foo :: Int +foo = 42 + diff --git a/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-a/pkg-a.cabal b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-a/pkg-a.cabal new file mode 100644 index 00000000000..7e4a3e9ef70 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-a/pkg-a.cabal @@ -0,0 +1,8 @@ +cabal-version: 2.2 +name: pkg-a +version: 1 + +library + default-language: Haskell2010 + build-depends: base + exposed-modules: Foo diff --git a/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-b/Bar.hs b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-b/Bar.hs new file mode 100644 index 00000000000..c3179aa8db6 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-b/Bar.hs @@ -0,0 +1,12 @@ +{-# LANGUAGE CPP #-} +module Bar (foo, bar) where + +import Foo (foo) + +#if MIN_VERSION_pkg_a(0,1,0) +bar :: Int +bar = 0xdeadc0de +#else +bar :: Int +bar = 0xdeadc0d1 +#endif diff --git a/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-b/pkg-b.cabal b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-b/pkg-b.cabal new file mode 100644 index 00000000000..8e1a273f0c4 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CabalMacros/pkg-b/pkg-b.cabal @@ -0,0 +1,8 @@ +cabal-version: 2.2 +name: pkg-b +version: 0 + +library + default-language: Haskell2010 + build-depends: base, pkg-a + exposed-modules: Bar diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.no.out b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.no.out new file mode 100644 index 00000000000..bcdd05715d3 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.no.out @@ -0,0 +1,13 @@ +# cabal clean +# cabal v2-repl +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - pkg-a-1 (interactive) (first run) + - pkg-b-0 (interactive) (first run) +Configuring pkg-a-1... +Preprocessing library for pkg-a-1... +Configuring pkg-b-0... +Preprocessing library for pkg-b-0... diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.out b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.out new file mode 100644 index 00000000000..9c141d7ac42 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.out @@ -0,0 +1,10 @@ +# cabal v2-repl +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - pkg-a-1 (interactive) (lib) (first run) + - pkg-b-0 (interactive) (lib) (first run) +Configuring library for pkg-a-1... +Preprocessing library for pkg-a-1... +Configuring library for pkg-b-0... +Preprocessing library for pkg-b-0... diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.project b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.project new file mode 100644 index 00000000000..bf8292adeb5 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.project @@ -0,0 +1,2 @@ +packages: pkg-a/*.cabal +packages: pkg-b/*.cabal diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.test.hs b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.test.hs new file mode 100644 index 00000000000..ea0851f1f2c --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.test.hs @@ -0,0 +1,33 @@ +import Test.Cabal.Prelude + +main = do + cabalTest' "yes" $ do + skipUnlessAnyCabalVersion ">= 3.11" + skipUnlessGhcVersion ">= 9.4" + cabal' "clean" [] + res <- + cabalWithStdin + "v2-repl" + [ "--keep-temp-files" + , "--enable-multi-repl" + , "pkg-b" + , "pkg-a" + ] + "Bar.bar" + assertOutputContains "foo is 42" res + void $ assertGlobMatchesTestDir testDistDir "multi-out*/" + + cabalTest' "no" $ do + skipUnlessAnyCabalVersion ">= 3.11" + skipUnlessGhcVersion ">= 9.4" + cabal' "clean" [] + res <- + cabalWithStdin + "v2-repl" + [ "--enable-multi-repl" + , "pkg-b" + , "pkg-a" + ] + "Bar.bar" + assertOutputContains "foo is 42" res + void $ assertGlobDoesNotMatchTestDir testDistDir "multi-out*/" diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.yes.out b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.yes.out new file mode 100644 index 00000000000..bcdd05715d3 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/cabal.yes.out @@ -0,0 +1,13 @@ +# cabal clean +# cabal v2-repl +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - pkg-a-1 (interactive) (first run) + - pkg-b-0 (interactive) (first run) +Configuring pkg-a-1... +Preprocessing library for pkg-a-1... +Configuring pkg-b-0... +Preprocessing library for pkg-b-0... diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-a/Foo.hs b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-a/Foo.hs new file mode 100644 index 00000000000..208f04764de --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-a/Foo.hs @@ -0,0 +1,4 @@ +module Foo where + +foo :: Int +foo = 42 diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-a/Setup.hs b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-a/Setup.hs new file mode 100644 index 00000000000..00bfe1fe441 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-a/Setup.hs @@ -0,0 +1,4 @@ +import Distribution.Simple + +main :: IO () +main = defaultMain diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-a/pkg-a.cabal b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-a/pkg-a.cabal new file mode 100644 index 00000000000..3c3bbde21a2 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-a/pkg-a.cabal @@ -0,0 +1,12 @@ +cabal-version: 2.2 +name: pkg-a +version: 1 +build-type: Custom + +custom-setup + setup-depends: Cabal, base + +library + default-language: Haskell2010 + build-depends: base + exposed-modules: Foo diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-b/Bar.hs b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-b/Bar.hs new file mode 100644 index 00000000000..114eedd9306 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-b/Bar.hs @@ -0,0 +1,6 @@ +module Bar (foo, bar) where + +import Foo (foo) + +bar :: String +bar = "foo is " <> show foo diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-b/Setup.hs b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-b/Setup.hs new file mode 100644 index 00000000000..00bfe1fe441 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-b/Setup.hs @@ -0,0 +1,4 @@ +import Distribution.Simple + +main :: IO () +main = defaultMain diff --git a/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-b/pkg-b.cabal b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-b/pkg-b.cabal new file mode 100644 index 00000000000..a354090771d --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/CustomSetupKeepTempFiles/pkg-b/pkg-b.cabal @@ -0,0 +1,12 @@ +cabal-version: 2.2 +name: pkg-b +version: 0 +build-type: Custom + +custom-setup + setup-depends: Cabal, base + +library + default-language: Haskell2010 + build-depends: base, pkg-a + exposed-modules: Bar diff --git a/cabal-testsuite/PackageTests/MultiRepl/EnabledClosure/cabal.out b/cabal-testsuite/PackageTests/MultiRepl/EnabledClosure/cabal.out index 8944a7dba34..90c934d9535 100644 --- a/cabal-testsuite/PackageTests/MultiRepl/EnabledClosure/cabal.out +++ b/cabal-testsuite/PackageTests/MultiRepl/EnabledClosure/cabal.out @@ -1,4 +1,6 @@ # cabal v2-repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.out b/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.out index 6571793245e..e077254e102 100644 --- a/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.out +++ b/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.out @@ -1,4 +1,6 @@ # cabal v2-repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.test.hs b/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.test.hs index 7ea2f71ea49..5a8434c5467 100644 --- a/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.test.hs +++ b/cabal-testsuite/PackageTests/MultiRepl/EnabledSucc/cabal.test.hs @@ -3,6 +3,5 @@ import Test.Cabal.Prelude main = do cabalTest $ do skipUnlessGhcVersion ">= 9.4" - skipIfWindows -- heisenbug, see #9103 res <- cabalWithStdin "v2-repl" ["--enable-multi-repl","pkg-b", "pkg-a"] "Bar.bar" assertOutputContains "3735929054" res diff --git a/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/CHANGELOG.md b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/CHANGELOG.md new file mode 100644 index 00000000000..fd67fc8144e --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for extra-options + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/LICENSE b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/LICENSE new file mode 100644 index 00000000000..5c92e310c86 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/LICENSE @@ -0,0 +1,30 @@ +Copyright (c) 2024, Matthew Pickering + +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Matthew Pickering nor the names of other + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/app/Main.hs b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/app/Main.hs new file mode 100644 index 00000000000..576a1174fe8 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/app/Main.hs @@ -0,0 +1,10 @@ +module Main where + +import qualified MyLib (someFunc) + +#ifdef FOO +main :: IO () +main = do + putStrLn "Hello, Haskell!" + MyLib.someFunc +#endif diff --git a/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/cabal.out b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/cabal.out new file mode 100644 index 00000000000..ce8177d9bd9 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/cabal.out @@ -0,0 +1,15 @@ +# cabal v2-repl +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - extra-options-0.1.0.0 (interactive) (lib) (first run) + - extra-options-0.1.0.0 (interactive) (test:extra-options-test) (first run) + - extra-options-0.1.0.0 (interactive) (exe:extra-options) (first run) +Configuring library for extra-options-0.1.0.0... +Preprocessing library for extra-options-0.1.0.0... +Configuring test suite 'extra-options-test' for extra-options-0.1.0.0... +Preprocessing test suite 'extra-options-test' for extra-options-0.1.0.0... +Configuring executable 'extra-options' for extra-options-0.1.0.0... +Preprocessing executable 'extra-options' for extra-options-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/cabal.project b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/cabal.project new file mode 100644 index 00000000000..f991c04133a --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/cabal.project @@ -0,0 +1,6 @@ +packages: . + +tests: True + +program-options + ghc-options: -XCPP -DFOO diff --git a/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/cabal.test.hs b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/cabal.test.hs new file mode 100644 index 00000000000..313609f30ad --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/cabal.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +main = do + cabalTest $ do + skipUnlessGhcVersion ">= 9.4" + void $ cabalWithStdin "v2-repl" ["--enable-multi-repl","all"] "" diff --git a/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/extra-options.cabal b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/extra-options.cabal new file mode 100644 index 00000000000..e1b9c13aadc --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/extra-options.cabal @@ -0,0 +1,39 @@ +cabal-version: 3.0 +name: extra-options +version: 0.1.0.0 +license: BSD-3-Clause +license-file: LICENSE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +build-type: Simple +extra-doc-files: CHANGELOG.md + +common warnings + ghc-options: -Wall + +library + import: warnings + exposed-modules: MyLib + build-depends: base + hs-source-dirs: src + default-language: Haskell2010 + +executable extra-options + import: warnings + main-is: Main.hs + build-depends: + base, + extra-options + + hs-source-dirs: app + default-language: Haskell2010 + +test-suite extra-options-test + import: warnings + default-language: Haskell2010 + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Main.hs + build-depends: + base, + extra-options diff --git a/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/src/MyLib.hs b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/src/MyLib.hs new file mode 100644 index 00000000000..acdf14c0c9e --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/src/MyLib.hs @@ -0,0 +1,6 @@ +module MyLib (someFunc) where + +#ifdef FOO +someFunc :: IO () +someFunc = putStrLn "someFunc" +#endif diff --git a/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/test/Main.hs b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/test/Main.hs new file mode 100644 index 00000000000..f60b8ae5379 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/ExtraOptions/test/Main.hs @@ -0,0 +1,6 @@ +module Main (main) where + +#ifdef FOO +main :: IO () +main = putStrLn "Test suite not yet implemented." +#endif diff --git a/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.no.out b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.no.out new file mode 100644 index 00000000000..d114d56dca9 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.no.out @@ -0,0 +1,13 @@ +# cabal clean +# cabal v2-repl +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - pkg-a-1 (interactive) (lib) (first run) + - pkg-b-0 (interactive) (lib) (first run) +Configuring library for pkg-a-1... +Preprocessing library for pkg-a-1... +Configuring library for pkg-b-0... +Preprocessing library for pkg-b-0... diff --git a/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.project b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.project new file mode 100644 index 00000000000..bf8292adeb5 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.project @@ -0,0 +1,2 @@ +packages: pkg-a/*.cabal +packages: pkg-b/*.cabal diff --git a/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.test.hs b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.test.hs new file mode 100644 index 00000000000..26c90db7ab1 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.test.hs @@ -0,0 +1,31 @@ +import Test.Cabal.Prelude + +main = do + cabalTest' "yes" $ do + skipUnlessGhcVersion ">= 9.4" + cabal' "clean" [] + res <- + cabalWithStdin + "v2-repl" + [ "--keep-temp-files" + , "--enable-multi-repl" + , "pkg-b" + , "pkg-a" + ] + "Bar.bar" + assertOutputContains "foo is 42" res + void $ assertGlobMatchesTestDir testDistDir "multi-out*/" + + cabalTest' "no" $ do + skipUnlessGhcVersion ">= 9.4" + cabal' "clean" [] + res <- + cabalWithStdin + "v2-repl" + [ "--enable-multi-repl" + , "pkg-b" + , "pkg-a" + ] + "Bar.bar" + assertOutputContains "foo is 42" res + void $ assertGlobDoesNotMatchTestDir testDistDir "multi-out*/" diff --git a/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.yes.out b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.yes.out new file mode 100644 index 00000000000..d114d56dca9 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/cabal.yes.out @@ -0,0 +1,13 @@ +# cabal clean +# cabal v2-repl +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - pkg-a-1 (interactive) (lib) (first run) + - pkg-b-0 (interactive) (lib) (first run) +Configuring library for pkg-a-1... +Preprocessing library for pkg-a-1... +Configuring library for pkg-b-0... +Preprocessing library for pkg-b-0... diff --git a/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-a/Foo.hs b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-a/Foo.hs new file mode 100644 index 00000000000..208f04764de --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-a/Foo.hs @@ -0,0 +1,4 @@ +module Foo where + +foo :: Int +foo = 42 diff --git a/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-a/pkg-a.cabal b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-a/pkg-a.cabal new file mode 100644 index 00000000000..7e4a3e9ef70 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-a/pkg-a.cabal @@ -0,0 +1,8 @@ +cabal-version: 2.2 +name: pkg-a +version: 1 + +library + default-language: Haskell2010 + build-depends: base + exposed-modules: Foo diff --git a/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-b/Bar.hs b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-b/Bar.hs new file mode 100644 index 00000000000..114eedd9306 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-b/Bar.hs @@ -0,0 +1,6 @@ +module Bar (foo, bar) where + +import Foo (foo) + +bar :: String +bar = "foo is " <> show foo diff --git a/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-b/pkg-b.cabal b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-b/pkg-b.cabal new file mode 100644 index 00000000000..8e1a273f0c4 --- /dev/null +++ b/cabal-testsuite/PackageTests/MultiRepl/KeepTempFiles/pkg-b/pkg-b.cabal @@ -0,0 +1,8 @@ +cabal-version: 2.2 +name: pkg-b +version: 0 + +library + default-language: Haskell2010 + build-depends: base, pkg-a + exposed-modules: Bar diff --git a/cabal-testsuite/PackageTests/MultiRepl/NotEnabledFail/cabal.multirepl-a.out b/cabal-testsuite/PackageTests/MultiRepl/NotEnabledFail/cabal.multirepl-a.out index 3b38560a7d4..108004e859e 100644 --- a/cabal-testsuite/PackageTests/MultiRepl/NotEnabledFail/cabal.multirepl-a.out +++ b/cabal-testsuite/PackageTests/MultiRepl/NotEnabledFail/cabal.multirepl-a.out @@ -1,4 +1,6 @@ # cabal v2-repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7076] Cannot open a repl for multiple components at once. The targets 'pkg-a' and 'pkg-b' refer to different components.. diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/Failing/cabal.out b/cabal-testsuite/PackageTests/MultipleLibraries/Failing/cabal.out index 5dee45c63bd..a1a6e519a55 100644 --- a/cabal-testsuite/PackageTests/MultipleLibraries/Failing/cabal.out +++ b/cabal-testsuite/PackageTests/MultipleLibraries/Failing/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/Successful/cabal.out b/cabal-testsuite/PackageTests/MultipleLibraries/Successful/cabal.out index 272b9fc6b4c..48ccbdc36cb 100644 --- a/cabal-testsuite/PackageTests/MultipleLibraries/Successful/cabal.out +++ b/cabal-testsuite/PackageTests/MultipleLibraries/Successful/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/T6083Post/cabal.out b/cabal-testsuite/PackageTests/MultipleLibraries/T6083Post/cabal.out index fb7bb90085f..b0122dc2950 100644 --- a/cabal-testsuite/PackageTests/MultipleLibraries/T6083Post/cabal.out +++ b/cabal-testsuite/PackageTests/MultipleLibraries/T6083Post/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/T6083PostMixin/cabal.out b/cabal-testsuite/PackageTests/MultipleLibraries/T6083PostMixin/cabal.out index fb7bb90085f..b0122dc2950 100644 --- a/cabal-testsuite/PackageTests/MultipleLibraries/T6083PostMixin/cabal.out +++ b/cabal-testsuite/PackageTests/MultipleLibraries/T6083PostMixin/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/T6083Pre/cabal.out b/cabal-testsuite/PackageTests/MultipleLibraries/T6083Pre/cabal.out index fbeef6a0af7..0eae2556c8c 100644 --- a/cabal-testsuite/PackageTests/MultipleLibraries/T6083Pre/cabal.out +++ b/cabal-testsuite/PackageTests/MultipleLibraries/T6083Pre/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/T6083PreMixin/cabal.out b/cabal-testsuite/PackageTests/MultipleLibraries/T6083PreMixin/cabal.out index fbeef6a0af7..0eae2556c8c 100644 --- a/cabal-testsuite/PackageTests/MultipleLibraries/T6083PreMixin/cabal.out +++ b/cabal-testsuite/PackageTests/MultipleLibraries/T6083PreMixin/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/MultipleLibraries/T6894/cabal.out b/cabal-testsuite/PackageTests/MultipleLibraries/T6894/cabal.out index 8f3f3286d40..8622b4f95be 100644 --- a/cabal-testsuite/PackageTests/MultipleLibraries/T6894/cabal.out +++ b/cabal-testsuite/PackageTests/MultipleLibraries/T6894/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdBench/MultipleBenchmarks/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdBench/MultipleBenchmarks/cabal.out index cff1673e167..8d3e71f53dd 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdBench/MultipleBenchmarks/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdBench/MultipleBenchmarks/cabal.out @@ -1,4 +1,6 @@ # cabal v2-bench +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -10,6 +12,8 @@ Running 1 benchmarks... Benchmark foo: RUNNING... Benchmark foo: FINISH # cabal v2-bench +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - MultipleBenchmarks-1.0 (bench:bar) (first run) diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdBench/OptionsFlag/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdBench/OptionsFlag/cabal.out index 84b8bdd781b..a962f5da6a4 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdBench/OptionsFlag/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdBench/OptionsFlag/cabal.out @@ -1,4 +1,6 @@ # cabal v2-bench +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdBench/WarningRTS/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdBench/WarningRTS/cabal.out index 84eec3eeae3..2f194d22dc1 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdBench/WarningRTS/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdBench/WarningRTS/cabal.out @@ -1,4 +1,6 @@ # cabal bench +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Warning: Some RTS options were found standalone, which affect cabal and not the binary. Please note that +RTS inside the --benchmark-options argument suffices if your goal is to affect the benchmarked binary. For example, use "cabal test --benchmark-options='+RTS -N'" to pass the '-N' RTS option to your binary. Build profile: -w ghc- -O1 @@ -11,6 +13,8 @@ Running 1 benchmarks... Benchmark foo: RUNNING... Benchmark foo: FINISH # cabal bench +Configuration is affected by the following files: +- cabal.project Warning: Some RTS options were found standalone, which affect cabal and not the binary. Please note that +RTS inside the --benchmark-options argument suffices if your goal is to affect the benchmarked binary. For example, use "cabal test --benchmark-options='+RTS -N'" to pass the '-N' RTS option to your binary. Build profile: -w ghc- -O1 In order, the following will be built: @@ -21,6 +25,8 @@ Running 1 benchmarks... Benchmark foo: RUNNING... Benchmark foo: FINISH # cabal bench +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - WarningRTS-1.0 (bench:foo) (first run) diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdBuild/OnlyConfigure/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdBuild/OnlyConfigure/cabal.out index 594f392e735..7de34d52b59 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdBuild/OnlyConfigure/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdBuild/OnlyConfigure/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -7,6 +9,8 @@ In order, the following will be built: Configuring library for OnlyConfigure-1.0... Configuring executable 'foo' for OnlyConfigure-1.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -17,6 +21,8 @@ Configuring library for OnlyConfigure-1.0... Configuring test suite 'bar' for OnlyConfigure-1.0... Configuring executable 'foo' for OnlyConfigure-1.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/a.cabal b/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/a.cabal new file mode 100644 index 00000000000..77f47fbbcf5 --- /dev/null +++ b/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/a.cabal @@ -0,0 +1,6 @@ +cabal-version: 3.0 +name: aa +version: 0.1.0.0 +build-type: Simple + +library diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/cabal.out new file mode 100644 index 00000000000..f3429841e3c --- /dev/null +++ b/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/cabal.out @@ -0,0 +1,8 @@ +# cabal build +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following would be built: + - aa-0.1.0.0 (lib) (first run) +# cabal clean diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/cabal.project b/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/cabal.project new file mode 100644 index 00000000000..60739ea84dd --- /dev/null +++ b/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/cabal.project @@ -0,0 +1,5 @@ +packages: . + +source-repository-package + type: git + location: https://github.com/haskell-hvr/Only diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/cabal.test.hs new file mode 100644 index 00000000000..9e93c607ce4 --- /dev/null +++ b/cabal-testsuite/PackageTests/NewBuild/CmdClean/CleanSourceRepositoryPackage/cabal.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +main = cabalTest $ withProjectFile "cabal.project" $ do + void $ cabal' "build" ["--dry-run"] + void $ cabal' "clean" [] diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdExec/GhcInvocation/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdExec/GhcInvocation/cabal.out index 437714d34bd..7e96d11422f 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdExec/GhcInvocation/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdExec/GhcInvocation/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -7,3 +9,5 @@ Configuring library for inplace-dep-1.0... Preprocessing library for inplace-dep-1.0... Building library for inplace-dep-1.0... # cabal v2-exec +Configuration is affected by the following files: +- cabal.project diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdExec/RunExe/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdExec/RunExe/cabal.out index 2ae9f2a0fd4..691cbb03f6f 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdExec/RunExe/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdExec/RunExe/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -7,3 +9,5 @@ Configuring executable 'foo' for RunExe-1.0... Preprocessing executable 'foo' for RunExe-1.0... Building executable 'foo' for RunExe-1.0... # cabal v2-exec +Configuration is affected by the following files: +- cabal.project diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRepl/CustomSetup/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRepl/CustomSetup/cabal.out index d581aac783e..cc77b3c7b41 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRepl/CustomSetup/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRepl/CustomSetup/cabal.out @@ -1,4 +1,6 @@ # cabal v2-repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Datafiles/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Datafiles/cabal.out index 8893a5acdc9..ba2ac3912ac 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Datafiles/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Datafiles/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -7,6 +9,8 @@ Configuring executable 'foo' for foo-1.0... Preprocessing executable 'foo' for foo-1.0... Building executable 'foo' for foo-1.0... # cabal v2-run +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - foo-1.0 (lib) (first run) diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ExeAndLib/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ExeAndLib/cabal.out index 02391a63734..4417a2fb4c8 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ExeAndLib/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ExeAndLib/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -7,5 +9,7 @@ Configuring executable 'foo' for ExeAndLib-1.0... Preprocessing executable 'foo' for ExeAndLib-1.0... Building executable 'foo' for ExeAndLib-1.0... # cabal v2-run +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7070] The run command is for running executables, but the target 'ExeAndLib' refers to the library ExeAndLib from the package ExeAndLib-1.0. diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ExitCodePropagation/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ExitCodePropagation/cabal.out index 0cf6a51332f..d2cbf7245af 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ExitCodePropagation/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ExitCodePropagation/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultipleExes/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultipleExes/cabal.out index 2223a88a94c..b5e1175e983 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultipleExes/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultipleExes/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -7,6 +9,8 @@ Configuring executable 'foo' for MultipleExes-1.0... Preprocessing executable 'foo' for MultipleExes-1.0... Building executable 'foo' for MultipleExes-1.0... # cabal v2-run +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - MultipleExes-1.0 (exe:bar) (first run) @@ -14,12 +18,18 @@ Configuring executable 'bar' for MultipleExes-1.0... Preprocessing executable 'bar' for MultipleExes-1.0... Building executable 'bar' for MultipleExes-1.0... # cabal v2-run +Configuration is affected by the following files: +- cabal.project # cabal v2-run +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7070] The run command is for running a single executable at once. The target '' refers to the package MultipleExes-1.0 which includes - executables: bar and foo # cabal v2-run +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7070] The run command is for running a single executable at once. The target 'MultipleExes' refers to the package MultipleExes-1.0 which includes - executables: bar and foo diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultiplePackages/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultiplePackages/cabal.out index 7f851dca6a8..54b0387e0e1 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultiplePackages/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultiplePackages/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -7,7 +9,11 @@ Configuring executable 'bar-exe' for bar-1.0... Preprocessing executable 'bar-exe' for bar-1.0... Building executable 'bar-exe' for bar-1.0... # cabal v2-run +Configuration is affected by the following files: +- cabal.project # cabal v2-run +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - foo-1.0 (exe:foo-exe) (first run) @@ -15,6 +21,8 @@ Configuring executable 'foo-exe' for foo-1.0... Preprocessing executable 'foo-exe' for foo-1.0... Building executable 'foo-exe' for foo-1.0... # cabal v2-run +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - bar-1.0 (exe:foo-exe) (first run) @@ -22,20 +30,28 @@ Configuring executable 'foo-exe' for bar-1.0... Preprocessing executable 'foo-exe' for bar-1.0... Building executable 'foo-exe' for bar-1.0... # cabal v2-run +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7135] No targets given and there is no package in the current directory. Specify packages or components by name or location. See 'cabal build --help' for more details on target options. # cabal v2-run +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7070] The run command is for running a single executable at once. The target 'bar' refers to the package bar-1.0 which includes - executables: bar-exe and foo-exe # cabal v2-run +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7132] Ambiguous target 'foo-exe'. It could be: bar:foo-exe (component) foo:foo-exe (component) # cabal v2-run +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7131] Unknown target 'foo:bar-exe'. The package foo has no component 'bar-exe'. diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/RunMainBad/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/RunMainBad/cabal.out index 25b71f37cce..d836bcbed00 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/RunMainBad/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/RunMainBad/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7070] The run command can only run an executable as a whole, not files or modules within them, but the target 'Main.hs' refers to the file Main.hs in the executable foo. diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Script/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Script/cabal.out index 936db57d6be..54fa7f05e1c 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Script/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Script/cabal.out @@ -1,4 +1,7 @@ # cabal v2-run +Warning: The package description file ./script.cabal has warnings: script.cabal:0:0: A package using 'cabal-version: >=1.10' must use section syntax. See the Cabal user guide for details. +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptBad/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptBad/cabal.out index be36f8398e0..076b432b019 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptBad/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptBad/cabal.out @@ -1,3 +1,6 @@ # cabal v2-run +Warning: The package description file ./script.cabal has warnings: script.cabal:0:0: A package using 'cabal-version: >=1.10' must use section syntax. See the Cabal user guide for details. +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7121] Failed extracting script block: `{- cabal:` start marker not found diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptLiterate/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptLiterate/cabal.out index 0615cc31a41..5ebd9d91f5c 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptLiterate/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptLiterate/cabal.out @@ -1,4 +1,7 @@ # cabal v2-run +Warning: The package description file ./script.cabal has warnings: script.cabal:0:0: A package using 'cabal-version: >=1.10' must use section syntax. See the Cabal user guide for details. +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Single/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Single/cabal.out index 2d03fa7af39..1599052effd 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Single/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Single/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -7,9 +9,19 @@ Configuring executable 'foo' for Single-1.0... Preprocessing executable 'foo' for Single-1.0... Building executable 'foo' for Single-1.0... # cabal v2-run +Configuration is affected by the following files: +- cabal.project # cabal v2-run +Configuration is affected by the following files: +- cabal.project # cabal v2-run +Configuration is affected by the following files: +- cabal.project # cabal v2-run +Configuration is affected by the following files: +- cabal.project # cabal v2-run +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7070] Cannot run the package bar, it is not in this project (either directly or indirectly). If you want to add it to the project then edit the cabal.project file. diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Terminate/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Terminate/cabal.test.hs index 44f88c26656..8c3277174b8 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Terminate/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Terminate/cabal.test.hs @@ -17,36 +17,36 @@ without forking in the future.) -} main :: IO () -main = cabalTest $ do - skipIfWindows -- test project relies on Posix +main = do + skipIfWindows "depends on `unix`" + cabalTest $ do + -- timestamped logging to aid with #8416 + let logIO msg = do + ts <- Time.getCurrentTime + let tsfmt = Time.formatTime Time.defaultTimeLocale "%H:%M:%S.%q" ts + putStrLn $ tsfmt <> " [cabal.test] " <> msg + log = liftIO . logIO - -- timestamped logging to aid with #8416 - let logIO msg = do - ts <- Time.getCurrentTime - let tsfmt = Time.formatTime Time.defaultTimeLocale "%H:%M:%S.%q" ts - putStrLn $ tsfmt <> " [cabal.test] " <> msg - log = liftIO . logIO + dir <- fmap testCurrentDir getTestEnv + let runFile = dir "exe.run" + liftIO $ removeFile runFile `catchNoExist` return () - dir <- fmap testCurrentDir getTestEnv - let runFile = dir "exe.run" - liftIO $ removeFile runFile `catchNoExist` return () + log "about to v2-build" + cabal_raw_action ["v2-build", "exe"] (\_ -> return ()) + log "about to v2-run" + r <- fails $ cabal_raw_action ["v2-run", "exe"] $ \cabalHandle -> do + -- wait for "cabal run" to have started "exe" + logIO "about to wait for file" + waitFile total runFile + -- then kill "cabal run" + logIO "about to terminate cabal" + Process.terminateProcess cabalHandle + log "v2-run done" - log "about to v2-build" - cabal_raw_action ["v2-build", "exe"] (\_ -> return ()) - log "about to v2-run" - r <- fails $ cabal_raw_action ["v2-run", "exe"] $ \cabalHandle -> do - -- wait for "cabal run" to have started "exe" - logIO "about to wait for file" - waitFile total runFile - -- then kill "cabal run" - logIO "about to terminate cabal" - Process.terminateProcess cabalHandle - log "v2-run done" - - -- "exe" should exit, and should have been interrupted before - -- finishing its sleep - assertOutputContains "exiting" r - assertOutputDoesNotContain "done sleeping" r + -- "exe" should exit, and should have been interrupted before + -- finishing its sleep + assertOutputContains "exiting" r + assertOutputDoesNotContain "done sleeping" r where catchNoExist action handle = diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/WarningRTS/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/WarningRTS/cabal.out index a7f6033bb1d..ac29846553e 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/WarningRTS/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/WarningRTS/cabal.out @@ -1,4 +1,6 @@ # cabal run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Warning: Your RTS options are applied to cabal, not the executable. Use '--' to separate cabal options from your executable options. For example, use 'cabal run -- +RTS -N to pass the '-N' RTS option to your executable. Build profile: -w ghc- -O1 @@ -8,5 +10,9 @@ Configuring executable 'foo' for WarningRTS-1.0... Preprocessing executable 'foo' for WarningRTS-1.0... Building executable 'foo' for WarningRTS-1.0... # cabal run +Configuration is affected by the following files: +- cabal.project Warning: Your RTS options are applied to cabal, not the executable. Use '--' to separate cabal options from your executable options. For example, use 'cabal run -- +RTS -N to pass the '-N' RTS option to your executable. # cabal run +Configuration is affected by the following files: +- cabal.project diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdTest/OptionsFlag/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdTest/OptionsFlag/cabal.out index 55aac7326b6..959dedbdb61 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdTest/OptionsFlag/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdTest/OptionsFlag/cabal.out @@ -1,4 +1,6 @@ # cabal v2-test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdTest/WarningRTS/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdTest/WarningRTS/cabal.out index aef2481eac8..c16c641e235 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdTest/WarningRTS/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdTest/WarningRTS/cabal.out @@ -1,4 +1,6 @@ # cabal test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Warning: Some RTS options were found standalone, which affect cabal and not the binary. Please note that +RTS inside the --test-options argument suffices if your goal is to affect the tested binary. For example, use "cabal test --test-options='+RTS -N'" to pass the '-N' RTS option to your binary. Build profile: -w ghc- -O1 @@ -13,6 +15,8 @@ Test suite foo: PASS Test suite logged to: /cabal.dist/work/./dist/build//ghc-/WarningRTS-1.0/t/foo/test/WarningRTS-1.0-foo.log 1 of 1 test suites (1 of 1 test cases) passed. # cabal test +Configuration is affected by the following files: +- cabal.project Warning: Some RTS options were found standalone, which affect cabal and not the binary. Please note that +RTS inside the --test-options argument suffices if your goal is to affect the tested binary. For example, use "cabal test --test-options='+RTS -N'" to pass the '-N' RTS option to your binary. Build profile: -w ghc- -O1 In order, the following will be built: @@ -25,6 +29,8 @@ Test suite foo: PASS Test suite logged to: /cabal.dist/work/./dist/build//ghc-/WarningRTS-1.0/t/foo/test/WarningRTS-1.0-foo.log 1 of 1 test suites (1 of 1 test cases) passed. # cabal test +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - WarningRTS-1.0 (test:foo) (first run) diff --git a/cabal-testsuite/PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs b/cabal-testsuite/PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs index f3774f78cd7..114d3487e8e 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs +++ b/cabal-testsuite/PackageTests/NewBuild/CustomSetup/RemotePackageWithCustomSetup/build-package-from-repo-with-custom-setup.test.hs @@ -2,11 +2,7 @@ import Test.Cabal.Prelude -- The one local package, pkg, has a dependency on remote-pkg-2.0, which has a -- setup dependency on remote-setup-dep-3.0. -main = - cabalTest $ withShorterPathForNewBuildStore $ do - - -- TODO: Debug this failure on Windows. - skipIfWindows +main = cabalTest $ withShorterPathForNewBuildStore $ do skipUnless "no v2-build compatible boot-Cabal" =<< hasNewBuildCompatBootCabal withRepo "repo" $ do diff --git a/cabal-testsuite/PackageTests/NewBuild/MonitorCabalFiles/cabal.out b/cabal-testsuite/PackageTests/NewBuild/MonitorCabalFiles/cabal.out index 93f0fd7f938..20490c7cbd5 100644 --- a/cabal-testsuite/PackageTests/NewBuild/MonitorCabalFiles/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/MonitorCabalFiles/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -9,6 +11,8 @@ Building executable 'q' for q-0.1.0.0... Error: [Cabal-7125] Failed to build q-0.1.0.0-inplace-q. # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.out b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.out index 3c7beab60c7..6b549c4eb26 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs index f418538b074..93d28460c83 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewBuild/T3827/cabal.test.hs @@ -1,6 +1,4 @@ import Test.Cabal.Prelude main = cabalTest $ do - linux <- isLinux - osx <- isOSX - skipIf "8032 heisenbug profiling" (linux || osx) + skipIf "8032 heisenbug profiling" (isLinux || isOSX) cabal "v2-build" ["exe:q"] diff --git a/cabal-testsuite/PackageTests/NewBuild/T3978/cabal.out b/cabal-testsuite/PackageTests/NewBuild/T3978/cabal.out index bb8adff32b7..3769d3ba3f7 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T3978/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/T3978/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/NewBuild/T4017/cabal.out b/cabal-testsuite/PackageTests/NewBuild/T4017/cabal.out index 2175160b583..0d86c44624e 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T4017/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/T4017/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/T4288/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/T4288/cabal.test.hs index 3e3b8de853e..3313f596546 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T4288/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewBuild/T4288/cabal.test.hs @@ -1,4 +1,5 @@ import Test.Cabal.Prelude +import Data.Function ((&)) -- This test is similar to the simplified example in issue #4288. The package's -- setup script only depends on base and setup-helper. setup-helper exposes a @@ -10,8 +11,7 @@ main = cabalTest $ do skipUnless "no v2-build compatible boot-Cabal" =<< hasNewBuildCompatBootCabal r <- recordMode DoNotRecord $ cabal' "v2-build" ["T4288"] assertOutputContains "This is setup-helper-1.0." r - assertOutputContains - ("In order, the following will be built: " - ++ " - setup-helper-1.0 (lib:setup-helper) (first run) " - ++ " - T4288-1.0 (lib:T4288) (first run)") - r + "In order, the following will be built:\n\ + \ - setup-helper-1.0 (lib:setup-helper) (first run)\n\ + \ - T4288-1.0 (lib:T4288) (first run)" + & flip (assertOn multilineNeedleHaystack) r diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/A.hs b/cabal-testsuite/PackageTests/NewBuild/T4375/A.hs deleted file mode 100644 index d843c00b782..00000000000 --- a/cabal-testsuite/PackageTests/NewBuild/T4375/A.hs +++ /dev/null @@ -1 +0,0 @@ -module A where diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/a.cabal b/cabal-testsuite/PackageTests/NewBuild/T4375/a.cabal deleted file mode 100644 index e3c9ed6bca1..00000000000 --- a/cabal-testsuite/PackageTests/NewBuild/T4375/a.cabal +++ /dev/null @@ -1,11 +0,0 @@ -name: a -version: 0.1 -build-type: Custom -cabal-version: >= 1.10 - --- no explicit setup deps - -library - exposed-modules: A - build-depends: base - default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.out b/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.out deleted file mode 100644 index ebbf63746ef..00000000000 --- a/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.out +++ /dev/null @@ -1,7 +0,0 @@ -# cabal v2-update -Downloading the latest package list from test-local-repo -# cabal v2-build -Resolving dependencies... -Build profile: -w ghc- -O1 -In order, the following will be built: - - a-0.1 (lib:a) (first run) diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.test.hs deleted file mode 100644 index b42f3f28c7a..00000000000 --- a/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.test.hs +++ /dev/null @@ -1,13 +0,0 @@ -import Test.Cabal.Prelude -main = - -- TODO: is this test ever run? - cabalTest $ withShorterPathForNewBuildStore $ do - -- Don't run this test unless the GHC is sufficiently recent - -- to not ship boot old-time/old-locale - skipUnlessGhcVersion ">= 7.11" - -- Don't run this test on GHC 8.2, which ships with Cabal 2.0, - -- which is not eligible for old-style Custom setup (if - -- we had the full Hackage index, we'd try it.) - skipUnlessGhcVersion "< 8.1" - withRepo "repo" $ do - cabal "v2-build" ["a"] diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-locale-1.0.0.7/System/Locale.hs b/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-locale-1.0.0.7/System/Locale.hs deleted file mode 100644 index 83af47b0ef4..00000000000 --- a/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-locale-1.0.0.7/System/Locale.hs +++ /dev/null @@ -1 +0,0 @@ -module System.Locale where diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-locale-1.0.0.7/old-locale.cabal b/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-locale-1.0.0.7/old-locale.cabal deleted file mode 100644 index f6e3dadf6d5..00000000000 --- a/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-locale-1.0.0.7/old-locale.cabal +++ /dev/null @@ -1,9 +0,0 @@ -name: old-locale -version: 1.0.0.7 -build-type: Simple -cabal-version: >= 1.10 - -library - exposed-modules: System.Locale - build-depends: base - default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-time-1.1.0.3/System/Time.hs b/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-time-1.1.0.3/System/Time.hs deleted file mode 100644 index f4185b6527a..00000000000 --- a/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-time-1.1.0.3/System/Time.hs +++ /dev/null @@ -1,2 +0,0 @@ -module System.Time where -import System.Locale diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-time-1.1.0.3/old-time.cabal b/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-time-1.1.0.3/old-time.cabal deleted file mode 100644 index 11ac6cccc91..00000000000 --- a/cabal-testsuite/PackageTests/NewBuild/T4375/repo/old-time-1.1.0.3/old-time.cabal +++ /dev/null @@ -1,9 +0,0 @@ -name: old-time -version: 1.1.0.3 -build-type: Simple -cabal-version: >= 1.10 - -library - exposed-modules: System.Time - build-depends: base, old-locale == 1.0.* - default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/NewBuild/T4405/cabal.out b/cabal-testsuite/PackageTests/NewBuild/T4405/cabal.out index 2b684028ae0..e91a6fe2c15 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T4405/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/T4405/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -11,4 +13,6 @@ Configuring library for q-1.0... Preprocessing library for q-1.0... Building library for q-1.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Up to date diff --git a/cabal-testsuite/PackageTests/NewBuild/T4477/cabal.out b/cabal-testsuite/PackageTests/NewBuild/T4477/cabal.out index e8c59896590..5904b7d5372 100644 --- a/cabal-testsuite/PackageTests/NewBuild/T4477/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/T4477/cabal.out @@ -1,4 +1,6 @@ # cabal v2-run +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/T8875/T8875.cabal b/cabal-testsuite/PackageTests/NewBuild/T8875/T8875.cabal new file mode 100644 index 00000000000..9372c1977f9 --- /dev/null +++ b/cabal-testsuite/PackageTests/NewBuild/T8875/T8875.cabal @@ -0,0 +1,9 @@ +cabal-version: 3.0 +name: T8875 +version: 0.1.0.0 + +executable foo + main-is: Main.hs + build-depends: base + hs-source-dirs: "a app" + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/NewBuild/T8875/a app/Main.hs b/cabal-testsuite/PackageTests/NewBuild/T8875/a app/Main.hs new file mode 100644 index 00000000000..b3549c2fe3d --- /dev/null +++ b/cabal-testsuite/PackageTests/NewBuild/T8875/a app/Main.hs @@ -0,0 +1 @@ +main = return () diff --git a/cabal-testsuite/PackageTests/NewBuild/T8875/cabal.out b/cabal-testsuite/PackageTests/NewBuild/T8875/cabal.out new file mode 100644 index 00000000000..9a1118c9b2f --- /dev/null +++ b/cabal-testsuite/PackageTests/NewBuild/T8875/cabal.out @@ -0,0 +1,10 @@ +# cabal v2-build +Configuration is affected by the following files: +- cabal.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - T8875-0.1.0.0 (exe:foo) (first run) +Configuring executable 'foo' for T8875-0.1.0.0... +Preprocessing executable 'foo' for T8875-0.1.0.0... +Building executable 'foo' for T8875-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/NewBuild/T4375/cabal.project b/cabal-testsuite/PackageTests/NewBuild/T8875/cabal.project similarity index 100% rename from cabal-testsuite/PackageTests/NewBuild/T4375/cabal.project rename to cabal-testsuite/PackageTests/NewBuild/T8875/cabal.project diff --git a/cabal-testsuite/PackageTests/NewBuild/T8875/cabal.test.hs b/cabal-testsuite/PackageTests/NewBuild/T8875/cabal.test.hs new file mode 100644 index 00000000000..a9120447cb9 --- /dev/null +++ b/cabal-testsuite/PackageTests/NewBuild/T8875/cabal.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +main = cabalTest . void $ do + -- Building a target that contains whitespace + cabal' "v2-build" ["a app/Main.hs"] diff --git a/cabal-testsuite/PackageTests/NewConfigure/ConfigFile/cabal.out b/cabal-testsuite/PackageTests/NewConfigure/ConfigFile/cabal.out index f26ed6aac4d..90a93d8bd2f 100644 --- a/cabal-testsuite/PackageTests/NewConfigure/ConfigFile/cabal.out +++ b/cabal-testsuite/PackageTests/NewConfigure/ConfigFile/cabal.out @@ -1,5 +1,12 @@ # cabal v2-configure +Warning: The package description file ./ConfigFile.cabal has warnings: ConfigFile.cabal:0:0: A package using 'cabal-version: >=1.10' must use section syntax. See the Cabal user guide for details. +Configuration is affected by the following files: +- cabal.project Config file not written due to flag(s). # cabal v2-configure +Configuration is affected by the following files: +- cabal.project Config file not written due to flag(s). # cabal v2-configure +Configuration is affected by the following files: +- cabal.project diff --git a/cabal-testsuite/PackageTests/NewConfigure/LocalConfigOverwrite/cabal.out b/cabal-testsuite/PackageTests/NewConfigure/LocalConfigOverwrite/cabal.out index 316c05855bb..14c74f590ec 100644 --- a/cabal-testsuite/PackageTests/NewConfigure/LocalConfigOverwrite/cabal.out +++ b/cabal-testsuite/PackageTests/NewConfigure/LocalConfigOverwrite/cabal.out @@ -1,4 +1,10 @@ # cabal v2-configure +Configuration is affected by the following files: +- cabal.project +- cabal.project.local 'cabal.project.local' already exists, backing it up to 'cabal.project.local~'. # cabal v2-configure -'foo.project.local' already exists, backing it up to 'foo.project.local~'. \ No newline at end of file +Configuration is affected by the following files: +- foo.project +- foo.project.local +'foo.project.local' already exists, backing it up to 'foo.project.local~'. diff --git a/cabal-testsuite/PackageTests/NewFreeze/BuildTools/new_freeze.out b/cabal-testsuite/PackageTests/NewFreeze/BuildTools/new_freeze.out index ff47b1dd0cc..2cc44b9016b 100644 --- a/cabal-testsuite/PackageTests/NewFreeze/BuildTools/new_freeze.out +++ b/cabal-testsuite/PackageTests/NewFreeze/BuildTools/new_freeze.out @@ -1,6 +1,9 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Warning: The package description file ./my-local-package.cabal has warnings: my-local-package.cabal:3:23: Packages with 'cabal-version: 1.12' or later should specify a specific version of the Cabal spec of the form 'cabal-version: x.y'. Use 'cabal-version: 1.20'. +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: @@ -9,9 +12,15 @@ In order, the following would be built: - my-library-dep-1.0 (lib) (requires build) - my-local-package-1.0 (lib) (first run) # cabal v2-freeze +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Wrote freeze file: /cabal.project.freeze # cabal v2-build +Warning: The package description file ./my-local-package.cabal has warnings: my-local-package.cabal:3:23: Packages with 'cabal-version: 1.12' or later should specify a specific version of the Cabal spec of the form 'cabal-version: x.y'. Use 'cabal-version: 1.20'. +Configuration is affected by the following files: +- cabal.project +- cabal.project.freeze Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: diff --git a/cabal-testsuite/PackageTests/NewFreeze/Flags/new_freeze.out b/cabal-testsuite/PackageTests/NewFreeze/Flags/new_freeze.out index d0cc7e4ee0c..8adf0bf2702 100644 --- a/cabal-testsuite/PackageTests/NewFreeze/Flags/new_freeze.out +++ b/cabal-testsuite/PackageTests/NewFreeze/Flags/new_freeze.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: @@ -8,9 +10,14 @@ In order, the following would be built: - my-library-dep-1.0 (lib) (requires build) - my-local-package-1.0 (lib) (first run) # cabal v2-freeze +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Wrote freeze file: /cabal.project.freeze # cabal v2-build +Configuration is affected by the following files: +- cabal.project +- cabal.project.freeze Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: diff --git a/cabal-testsuite/PackageTests/NewFreeze/FreezeFile/new_freeze.out b/cabal-testsuite/PackageTests/NewFreeze/FreezeFile/new_freeze.out index 36278f47542..f07819538f4 100644 --- a/cabal-testsuite/PackageTests/NewFreeze/FreezeFile/new_freeze.out +++ b/cabal-testsuite/PackageTests/NewFreeze/FreezeFile/new_freeze.out @@ -1,19 +1,30 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: - my-library-dep-2.0 (lib) (requires build) - my-local-package-1.0 (exe:my-exe) (first run) # cabal v2-freeze +Configuration is affected by the following files: +- cabal.project Freeze file not written due to flag(s) # cabal v2-freeze +Configuration is affected by the following files: +- cabal.project Freeze file not written due to flag(s) # cabal v2-freeze +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Wrote freeze file: /cabal.project.freeze # cabal v2-build +Configuration is affected by the following files: +- cabal.project +- cabal.project.freeze Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -27,12 +38,19 @@ Configuring executable 'my-exe' for my-local-package-1.0... Preprocessing executable 'my-exe' for my-local-package-1.0... Building executable 'my-exe' for my-local-package-1.0... # cabal v2-freeze +Configuration is affected by the following files: +- cabal.project +- cabal.project.freeze Wrote freeze file: /cabal.project.freeze # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: - my-library-dep-2.0 (lib) (requires build) - my-local-package-1.0 (exe:my-exe) (configuration changed) # cabal v2-freeze +Configuration is affected by the following files: +- cabal.project Wrote freeze file: /cabal.project.freeze diff --git a/cabal-testsuite/PackageTests/NewFreeze/T9799b/src/None.hs b/cabal-testsuite/PackageTests/NewFreeze/T9799b/src/None.hs index f4c629a9329..e4aa4f2393a 100644 --- a/cabal-testsuite/PackageTests/NewFreeze/T9799b/src/None.hs +++ b/cabal-testsuite/PackageTests/NewFreeze/T9799b/src/None.hs @@ -3,8 +3,11 @@ module None where import MyLib import Language.Haskell.TH +import System.IO $(do - runIO $ putStrLn $ "Building: " ++ renamedVers + runIO $ do + putStrLn $ "Building: " ++ renamedVers + hFlush stdout [d| x = () |] ) diff --git a/cabal-testsuite/PackageTests/NewHaddock/DisableDoc/cabal.out b/cabal-testsuite/PackageTests/NewHaddock/DisableDoc/cabal.out index ac34ca8e161..5d630e959d4 100644 --- a/cabal-testsuite/PackageTests/NewHaddock/DisableDoc/cabal.out +++ b/cabal-testsuite/PackageTests/NewHaddock/DisableDoc/cabal.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal haddock +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -13,4 +15,4 @@ Installing library in Configuring library for B-0.1.0.0... Preprocessing library for B-0.1.0.0... Running Haddock on library for B-0.1.0.0... -Documentation created: /cabal.dist/work/dist/build//ghc-/B-0.1.0.0/doc/html/B/ +Documentation created: /cabal.dist/work/dist/build//ghc-/B-0.1.0.0/doc/html/B diff --git a/cabal-testsuite/PackageTests/NewHaddock/Fails/cabal.out b/cabal-testsuite/PackageTests/NewHaddock/Fails/cabal.out index b1bcf12d3fa..19689952971 100644 --- a/cabal-testsuite/PackageTests/NewHaddock/Fails/cabal.out +++ b/cabal-testsuite/PackageTests/NewHaddock/Fails/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -9,9 +11,12 @@ Building library for example-1.0... Error: [Cabal-7125] Failed to build example-1.0-inplace. # cabal v2-haddock +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - - example-1.0 (lib) (first run) + - example-1.0 (lib) (configuration changed) +Configuring library for example-1.0... Preprocessing library for example-1.0... Running Haddock on library for example-1.0... Error: [Cabal-7125] diff --git a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockForHackageCmdOutput/cabal.out b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockForHackageCmdOutput/cabal.out index e17593a966c..64bbea860f0 100644 --- a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockForHackageCmdOutput/cabal.out +++ b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockForHackageCmdOutput/cabal.out @@ -1,4 +1,6 @@ # cabal haddock +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -6,5 +8,5 @@ In order, the following will be built: Configuring library for A-0.0.0... Preprocessing library for A-0.0.0... Running Haddock on library for A-0.0.0... -Documentation created: /cabal.dist/work/dist/build//ghc-/A-0.0.0/doc/html/A-0.0.0-docs/, /cabal.dist/work/dist/build//ghc-/A-0.0.0/doc/html/A-0.0.0-docs/A.txt +Documentation created: /cabal.dist/work/dist/build//ghc-/A-0.0.0/doc/html/A-0.0.0-docs, /cabal.dist/work/dist/build//ghc-/A-0.0.0/doc/html/A-0.0.0-docs/A.txt Documentation tarball created: /cabal.dist/work/./dist/A-0.0.0-docs.tar.gz diff --git a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd/cabal.out b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd/cabal.out index 38e56384678..6cfdece7f8d 100644 --- a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd/cabal.out +++ b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd/cabal.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal haddock +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -8,4 +10,4 @@ In order, the following will be built: Configuring library for A-0.0.0... Preprocessing library for A-0.0.0... Running Haddock on library for A-0.0.0... -Documentation created: /docs/ +Documentation created: /docs/A diff --git a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd/cabal.test.hs b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd/cabal.test.hs index 1bfe939dab9..de59c2f90ee 100644 --- a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputCmd/cabal.test.hs @@ -8,4 +8,4 @@ main = cabalTest . withRepo "repo" $ do let docsDir = testDir "docs" liftIO (removePathForcibly docsDir) r <- cabal' "haddock" ["--haddock-output-dir=docs", "A"] - assertFindInFile "A minimal test package for testing haddock." (docsDir "index.html") + assertFindInFile "A minimal test package for testing haddock." (docsDir "A" "index.html") diff --git a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputConfig/cabal.out b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputConfig/cabal.out index 38e56384678..6cfdece7f8d 100644 --- a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputConfig/cabal.out +++ b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputConfig/cabal.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal haddock +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -8,4 +10,4 @@ In order, the following will be built: Configuring library for A-0.0.0... Preprocessing library for A-0.0.0... Running Haddock on library for A-0.0.0... -Documentation created: /docs/ +Documentation created: /docs/A diff --git a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputConfig/cabal.test.hs b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputConfig/cabal.test.hs index ba3a957ef60..db5b6d493a2 100644 --- a/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputConfig/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewHaddock/HaddockOutput/HaddockOutputConfig/cabal.test.hs @@ -8,4 +8,4 @@ main = cabalTest . withRepo "repo" $ do let docsDir = testDir "docs" liftIO (removePathForcibly docsDir) r <- cabal' "haddock" ["A"] - assertFindInFile "A minimal test package for testing haddock." (docsDir "index.html") + assertFindInFile "A minimal test package for testing haddock." (docsDir "A" "index.html") diff --git a/cabal-testsuite/PackageTests/NewHaddock/ImplyDependencies/cabal.out b/cabal-testsuite/PackageTests/NewHaddock/ImplyDependencies/cabal.out index 07fc04a1119..002abb6a29a 100644 --- a/cabal-testsuite/PackageTests/NewHaddock/ImplyDependencies/cabal.out +++ b/cabal-testsuite/PackageTests/NewHaddock/ImplyDependencies/cabal.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal haddock +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -11,9 +13,9 @@ Preprocessing library for A-0.1.0.0... Building library for A-0.1.0.0... Preprocessing library for A-0.1.0.0... Running Haddock on library for A-0.1.0.0... -Documentation created: /cabal.dist/work/./dist//A-0.1.0.0/dist/doc/html/A/ +Documentation created: /cabal.dist/work/./dist//A-0.1.0.0/dist/doc/html/A Installing library in Configuring library for B-0.1.0.0... Preprocessing library for B-0.1.0.0... Running Haddock on library for B-0.1.0.0... -Documentation created: /cabal.dist/work/dist/build//ghc-/B-0.1.0.0/doc/html/B/ +Documentation created: /cabal.dist/work/dist/build//ghc-/B-0.1.0.0/doc/html/B diff --git a/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.out b/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.out index 72eb09e8a77..aa041be7ed4 100644 --- a/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.out +++ b/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.out @@ -1,2 +1,4 @@ # cabal v2-sdist -Wrote tarball sdist to /dist-newstyle/sdist/deterministic-0.tar.gz \ No newline at end of file +Configuration is affected by the following files: +- cabal.project +Wrote tarball sdist to /dist-newstyle/sdist/deterministic-0.tar.gz diff --git a/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.test.hs b/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.test.hs index 67c2944b39c..8b260c9e1ba 100644 --- a/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.test.hs +++ b/cabal-testsuite/PackageTests/NewSdist/DeterministicTrivial/deterministic.test.hs @@ -24,6 +24,5 @@ main = cabalTest $ do known <- liftIO (BS.readFile knownSdist) unknown <- liftIO (BS.readFile mySdist) - skipIf "#8356" True -- bogus, just to indicate that the test is skipped assertEqual "hashes didn't match for sdist" True True -- assertEqual "hashes didn't match for sdist" (BS16.encode $ SHA256.hash known) (BS16.encode $ SHA256.hash unknown) diff --git a/cabal-testsuite/PackageTests/NewSdist/Globbing/cabal.out b/cabal-testsuite/PackageTests/NewSdist/Globbing/cabal.out index c28bd059b30..a0d41690c88 100644 --- a/cabal-testsuite/PackageTests/NewSdist/Globbing/cabal.out +++ b/cabal-testsuite/PackageTests/NewSdist/Globbing/cabal.out @@ -1,4 +1,6 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project a/Main.hs a/a.cabal a/doc/index.html diff --git a/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.out b/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.out index 926e5a2560e..42bf006f13e 100644 --- a/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.out +++ b/cabal-testsuite/PackageTests/NewSdist/ManyDataFiles/many-data-files.out @@ -1,2 +1,4 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote tarball sdist to /dist-newstyle/sdist/many-data-files-0.tar.gz diff --git a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all-output-dir.out b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all-output-dir.out index abcbfc25590..f8fbb9a2c41 100644 --- a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all-output-dir.out +++ b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all-output-dir.out @@ -1,3 +1,5 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote tarball sdist to /archives/a-0.1.tar.gz Wrote tarball sdist to /archives/b-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all-test-sute.out b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all-test-sute.out index 83628c9a8e2..cf7d268fa44 100644 --- a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all-test-sute.out +++ b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all-test-sute.out @@ -1,3 +1,5 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7151] It is not possible to package only the test suites from a package for distribution. Only entire packages may be packaged for distribution. diff --git a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all.out b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all.out index e370f410fe4..bd7eb8add5b 100644 --- a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all.out +++ b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/all.out @@ -1,3 +1,5 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote tarball sdist to /dist-newstyle/sdist/a-0.1.tar.gz Wrote tarball sdist to /dist-newstyle/sdist/b-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/list-sources-output-dir.out b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/list-sources-output-dir.out index 64b8452177f..2b9f08b3e5a 100644 --- a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/list-sources-output-dir.out +++ b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/list-sources-output-dir.out @@ -1,3 +1,5 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote source list to /lists/a-0.1.list Wrote source list to /lists/b-0.1.list diff --git a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-archive-to-stdout.out b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-archive-to-stdout.out index e8bc3312c87..b0670909503 100644 --- a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-archive-to-stdout.out +++ b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-archive-to-stdout.out @@ -1,3 +1,5 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7152] Can't write multiple tarballs to standard output! diff --git a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-list-sources.out b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-list-sources.out index dd464def39a..ffb2f9afe32 100644 --- a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-list-sources.out +++ b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-list-sources.out @@ -1,4 +1,6 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project a/Main.hs a/Test.hs a/a.cabal diff --git a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-target.out b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-target.out index e370f410fe4..bd7eb8add5b 100644 --- a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-target.out +++ b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/multi-target.out @@ -1,3 +1,5 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote tarball sdist to /dist-newstyle/sdist/a-0.1.tar.gz Wrote tarball sdist to /dist-newstyle/sdist/b-0.1.tar.gz diff --git a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/target-remote-package.out b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/target-remote-package.out index 386eaff9b13..2265a38e933 100644 --- a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/target-remote-package.out +++ b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/target-remote-package.out @@ -1,3 +1,5 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7151] The package base cannot be packaged for distribution, because it is not local to this project. diff --git a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/valid-and-test-suite.out b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/valid-and-test-suite.out index 6c1e881f806..4da566899a8 100644 --- a/cabal-testsuite/PackageTests/NewSdist/MultiTarget/valid-and-test-suite.out +++ b/cabal-testsuite/PackageTests/NewSdist/MultiTarget/valid-and-test-suite.out @@ -1,3 +1,5 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Error: [Cabal-7151] The component test suite 'a-tests' cannot be packaged for distribution on its own. Only entire packages may be packaged for distribution. diff --git a/cabal-testsuite/PackageTests/NewSdist/NullTerminated/cabal.out b/cabal-testsuite/PackageTests/NewSdist/NullTerminated/cabal.out index 90c82a7d6c4..23597943ecd 100644 Binary files a/cabal-testsuite/PackageTests/NewSdist/NullTerminated/cabal.out and b/cabal-testsuite/PackageTests/NewSdist/NullTerminated/cabal.out differ diff --git a/cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/cabal.test.hs b/cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/cabal.test.hs index 8d22aed3494..442d3508849 100644 --- a/cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/cabal.test.hs +++ b/cabal-testsuite/PackageTests/NewUpdate/RejectFutureIndexStates/cabal.test.hs @@ -1,9 +1,7 @@ import Test.Cabal.Prelude import Data.List (isPrefixOf) -main = cabalTest $ withProjectFile "cabal.project" $ withRemoteRepo "repo" $ do - - skip "Flaky test failing in `curl`, see #9530" +main = skipIfCIAndWindows 10230 >> cabalTest (flakyIfCI 9530 $ withProjectFile "cabal.project" $ withRemoteRepo "repo" $ do output <- last . words @@ -14,9 +12,9 @@ main = cabalTest $ withProjectFile "cabal.project" $ withRemoteRepo "repo" $ do <$> recordMode DoNotRecord (cabal' "update" []) -- update golden output with actual timestamp shell "cp" ["cabal.out.in", "cabal.out"] - shell "sed" ["-i''", "-e", "s/REPLACEME/" <> output <> "/g", "cabal.out"] + shell "sed" [ "-i" ++ if not isWindows then "''" else "", "-e", "s/REPLACEME/" <> output <> "/g", "cabal.out"] -- This shall fail with an error message as specified in `cabal.out` fails $ cabal "build" ["--index-state=4000-01-01T00:00:00Z", "fake-pkg"] -- This shall fail by not finding the package, what indicates that it -- accepted an older index-state. - fails $ cabal "build" ["--index-state=2023-01-01T00:00:00Z", "fake-pkg"] + fails $ cabal "build" ["--index-state=2023-01-01T00:00:00Z", "fake-pkg"]) diff --git a/cabal-testsuite/PackageTests/NewUpdate/UpdateIndexState/update-index-state.test.hs b/cabal-testsuite/PackageTests/NewUpdate/UpdateIndexState/update-index-state.test.hs index 24b1e7b5dd6..eb3bc8daff7 100644 --- a/cabal-testsuite/PackageTests/NewUpdate/UpdateIndexState/update-index-state.test.hs +++ b/cabal-testsuite/PackageTests/NewUpdate/UpdateIndexState/update-index-state.test.hs @@ -1,15 +1,13 @@ import Test.Cabal.Prelude -main = cabalTest $ withRemoteRepo "repo" $ do - - skip "Flaky test failing in `curl`, see #9530" +main = skipIfCIAndWindows 10230 >> cabalTest (flakyIfCI 9530 $ withRemoteRepo "repo" $ do -- The _first_ update call causes a warning about missing mirrors, the warning -- is platform-dependent and it's not part of the test expectations, so we -- check the output manually. res <- recordMode DoNotRecord $ - cabal' "update" ["repository.localhost,2022-01-28T02:36:41Z"] + cabal' "update" ["repository.localhost,2022-01-28T02:36:41Z"] assertOutputContains "The index-state is set to 2022-01-28T02:36:41Z" res assertOutputDoesNotContain "revert" res cabal "update" ["repository.localhost,2016-09-24T17:47:48Z"] - cabal "update" ["repository.localhost,2022-01-28T02:36:41Z"] + cabal "update" ["repository.localhost,2022-01-28T02:36:41Z"]) diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/Main.hs b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/Main.hs similarity index 63% rename from cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/Main.hs rename to cabal-testsuite/PackageTests/NoOSSupport/DynExe/Main.hs index d82a4bd93b7..6f2b80aa9ed 100644 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildDependsExtra/Main.hs +++ b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/Main.hs @@ -1,4 +1,4 @@ -module Main where - -main :: IO () -main = return () +module Main where + +main :: IO () +main = pure () diff --git a/cabal-testsuite/PackageTests/NoOSSupport/DynExe/a.cabal b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/a.cabal new file mode 100644 index 00000000000..58868453b6b --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/a.cabal @@ -0,0 +1,8 @@ +cabal-version: 3.0 +name: aa +version: 0.1.0.0 +build-type: Simple + +executable a + default-language: Haskell2010 + main-is: Main.hs diff --git a/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.out b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.out new file mode 100644 index 00000000000..53ccefe2347 --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.out @@ -0,0 +1,12 @@ +# cabal build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - aa-0.1.0.0 (exe:a) (first run) +Configuring executable 'a' for aa-0.1.0.0... +Warning: Executables will use dynamic linking, but a shared library is not +being built. Linking will fail if any executables depend on the library. +Error: [Cabal-3339] +Operating system: windows, does not support shared executables +Error: [Cabal-7125] +Failed to build aa-0.1.0.0-inplace-a. The failure occurred during the configure step. diff --git a/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.test.hs b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.test.hs new file mode 100644 index 00000000000..aa0c8e83b7b --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/DynExe/cabal.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +main = do + skipUnlessWindows + cabalTest $ fails $ cabal "build" ["--enable-executable-dynamic", "--disable-shared"] diff --git a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/Main.hs b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/Main.hs similarity index 63% rename from cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/Main.hs rename to cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/Main.hs index d82a4bd93b7..6f2b80aa9ed 100644 --- a/cabal-testsuite/PackageTests/InternalVersions/BuildToolDependsExtra/Main.hs +++ b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/Main.hs @@ -1,4 +1,4 @@ -module Main where - -main :: IO () -main = return () +module Main where + +main :: IO () +main = pure () diff --git a/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/a.cabal b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/a.cabal new file mode 100644 index 00000000000..58868453b6b --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/a.cabal @@ -0,0 +1,8 @@ +cabal-version: 3.0 +name: aa +version: 0.1.0.0 +build-type: Simple + +executable a + default-language: Haskell2010 + main-is: Main.hs diff --git a/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.out b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.out new file mode 100644 index 00000000000..f59d29e6b17 --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.out @@ -0,0 +1,10 @@ +# cabal build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - aa-0.1.0.0 (exe:a) (first run) +Configuring executable 'a' for aa-0.1.0.0... +Error: [Cabal-3339] +Operating system: windows, does not support relocatable builds +Error: [Cabal-7125] +Failed to build aa-0.1.0.0-inplace-a. The failure occurred during the configure step. diff --git a/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.test.hs b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.test.hs new file mode 100644 index 00000000000..448fc6fc22a --- /dev/null +++ b/cabal-testsuite/PackageTests/NoOSSupport/RelocatableExe/cabal.test.hs @@ -0,0 +1,5 @@ +import Test.Cabal.Prelude + +main = do + skipUnlessWindows + cabalTest $ fails $ cabal "build" ["--enable-relocatable"] diff --git a/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.out b/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.out index a7b18a253a6..80ca07ddddd 100644 --- a/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.out +++ b/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.out @@ -1,6 +1,10 @@ # cabal v2-update +Configuration is affected by the following files: +- cabal.repo.project Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- cabal.repo.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -9,6 +13,8 @@ In order, the following will be built: Error: [Cabal-7125] --offline was specified, hence refusing to download the package: remote version 0.1.0.0. # cabal v2-build +Configuration is affected by the following files: +- cabal.repo.project Build profile: -w ghc- -O1 In order, the following will be built: - remote-0.1.0.0 (lib) (requires build) @@ -21,4 +27,6 @@ Configuring executable 'current' for current-0.1.0.0... Preprocessing executable 'current' for current-0.1.0.0... Building executable 'current' for current-0.1.0.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.repo.project Up to date diff --git a/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs b/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs index 7c9617a623c..00dc5c17ba6 100644 --- a/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs +++ b/cabal-testsuite/PackageTests/OfflineFlag/offlineFlag.test.hs @@ -3,7 +3,6 @@ import Test.Cabal.Prelude main = cabalTest $ withShorterPathForNewBuildStore $ do skipUnlessGhcVersion ">= 8.1" - skipIfWindows withProjectFile "cabal.repo.project" $ do withRepo "repo" $ do fails $ cabal "v2-build" ["current", "--offline"] diff --git a/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-base.out b/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-base.out index 506ac48f14e..06e5d066600 100644 --- a/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-base.out +++ b/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-base.out @@ -8,6 +8,8 @@ Installing library in # Setup register Registering library for p-1.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-p.out b/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-p.out index 2235fc32f50..4367c22aea3 100644 --- a/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-p.out +++ b/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-p.out @@ -8,6 +8,8 @@ Installing library in # Setup register Registering library for p-1.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-packagedbs.out b/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-packagedbs.out index 5697c77102c..941aa1c2f51 100644 --- a/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-packagedbs.out +++ b/cabal-testsuite/PackageTests/PackageDB/cabal-fail-no-packagedbs.out @@ -1,3 +1,5 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Error: [Cabal-2300] No package databases have been specified. If you use --package-db=clear, you must follow it with --package-db= with 'global', 'user' or a specific file. diff --git a/cabal-testsuite/PackageTests/PackageDB/cabal-manual-packagedb.out b/cabal-testsuite/PackageTests/PackageDB/cabal-manual-packagedb.out index e1c59d1cbb8..6570a93a7c5 100644 --- a/cabal-testsuite/PackageTests/PackageDB/cabal-manual-packagedb.out +++ b/cabal-testsuite/PackageTests/PackageDB/cabal-manual-packagedb.out @@ -8,6 +8,8 @@ Installing library in # Setup register Registering library for p-1.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/PackageDB/cabal-packagedb.out b/cabal-testsuite/PackageTests/PackageDB/cabal-packagedb.out index e1c59d1cbb8..6570a93a7c5 100644 --- a/cabal-testsuite/PackageTests/PackageDB/cabal-packagedb.out +++ b/cabal-testsuite/PackageTests/PackageDB/cabal-packagedb.out @@ -8,6 +8,8 @@ Installing library in # Setup register Registering library for p-1.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Path/Config/cabal.out b/cabal-testsuite/PackageTests/Path/Config/cabal.out index 2263588109f..8e963e3eb4c 100644 --- a/cabal-testsuite/PackageTests/Path/Config/cabal.out +++ b/cabal-testsuite/PackageTests/Path/Config/cabal.out @@ -53,10 +53,16 @@ test-dir # cabal path /cabal.dist/home/.cabal # cabal path +Configuration is affected by the following files: +- fake.cabal.project /cabal.dist/home/.cabal # cabal path +Configuration is affected by the following files: +- fake.cabal.project {"cabal-version":"","cache-home":"/cabal.dist/home/.cabal"} # cabal path +Configuration is affected by the following files: +- fake.cabal.project /cabal.dist/home/.cabal # cabal path my-cache-dir @@ -71,10 +77,16 @@ my-cache-dir # cabal path /cabal.dist/home/.cabal/packages # cabal path +Configuration is affected by the following files: +- fake.cabal.project my-cache-dir # cabal path +Configuration is affected by the following files: +- fake.cabal.project {"cabal-version":"","remote-repo-cache":"my-cache-dir"} # cabal path +Configuration is affected by the following files: +- fake.cabal.project my-cache-dir # cabal path my-logs-dir @@ -89,10 +101,16 @@ my-logs-dir # cabal path /cabal.dist/home/.cabal/logs # cabal path +Configuration is affected by the following files: +- fake.cabal.project my-logs-dir # cabal path +Configuration is affected by the following files: +- fake.cabal.project {"cabal-version":"","logs-dir":"my-logs-dir"} # cabal path +Configuration is affected by the following files: +- fake.cabal.project my-logs-dir # cabal path my-store-dir @@ -107,10 +125,16 @@ my-store-dir # cabal path /cabal.dist/home/.cabal/store # cabal path +Configuration is affected by the following files: +- fake.cabal.project my-store-dir # cabal path +Configuration is affected by the following files: +- fake.cabal.project {"cabal-version":"","store-dir":"my-store-dir"} # cabal path +Configuration is affected by the following files: +- fake.cabal.project my-store-dir # cabal path fake-cabal.config @@ -125,10 +149,16 @@ fake-cabal.config # cabal path /cabal.dist/home/.cabal/config # cabal path +Configuration is affected by the following files: +- fake.cabal.project fake-cabal.config # cabal path +Configuration is affected by the following files: +- fake.cabal.project {"cabal-version":"","config-file":"fake-cabal.config"} # cabal path +Configuration is affected by the following files: +- fake.cabal.project fake-cabal.config # cabal path my-installdir @@ -143,8 +173,14 @@ my-installdir # cabal path /cabal.dist/home/.cabal/bin # cabal path +Configuration is affected by the following files: +- fake.cabal.project my-installdir # cabal path +Configuration is affected by the following files: +- fake.cabal.project {"cabal-version":"","installdir":"my-installdir"} # cabal path +Configuration is affected by the following files: +- fake.cabal.project my-installdir diff --git a/cabal-testsuite/PackageTests/PathsModule/Executable-Relocatable/setup.test.hs b/cabal-testsuite/PackageTests/PathsModule/Executable-Relocatable/setup.test.hs index ea88c7f9e41..fab6c7c0a06 100644 --- a/cabal-testsuite/PackageTests/PathsModule/Executable-Relocatable/setup.test.hs +++ b/cabal-testsuite/PackageTests/PathsModule/Executable-Relocatable/setup.test.hs @@ -1,7 +1,8 @@ import Test.Cabal.Prelude -- Test that Paths module is generated and usable when relocatable is turned on. -main = setupAndCabalTest $ do - skipIfWindows - skipUnlessGhcVersion ">= 8.0" - withPackageDb $ setup_build ["--enable-relocatable"] +main = do + skipIfWindows "no relocatable builds" + setupAndCabalTest $ do + skipUnlessGhcVersion ">= 8.0" + withPackageDb $ setup_build ["--enable-relocatable"] diff --git a/cabal-testsuite/PackageTests/PkgConfigParse/pkg-config.exe b/cabal-testsuite/PackageTests/PkgConfigParse/pkg-config.exe new file mode 100644 index 00000000000..537023174dc Binary files /dev/null and b/cabal-testsuite/PackageTests/PkgConfigParse/pkg-config.exe differ diff --git a/cabal-testsuite/PackageTests/PkgConfigParse/pkg-config.shim b/cabal-testsuite/PackageTests/PkgConfigParse/pkg-config.shim new file mode 100644 index 00000000000..2c187de462e --- /dev/null +++ b/cabal-testsuite/PackageTests/PkgConfigParse/pkg-config.shim @@ -0,0 +1,2 @@ +path = "FINDSH\sh.exe" +args = "pkg-config" \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/PkgConfigParse/setup.test.hs b/cabal-testsuite/PackageTests/PkgConfigParse/setup.test.hs index 0f860ab637a..edebd2d131c 100644 --- a/cabal-testsuite/PackageTests/PkgConfigParse/setup.test.hs +++ b/cabal-testsuite/PackageTests/PkgConfigParse/setup.test.hs @@ -1,9 +1,17 @@ +import System.Directory import Test.Cabal.Prelude -- Test that invalid unicode in pkg-config output doesn't trip up cabal very much main = cabalTest $ do - -- skipped on windows because using a script to dummy up an executable doesn't work the same. - skipIfWindows + when isWindows $ do + sh <- fmap takeDirectory <$> liftIO (findExecutable "sh") + case sh of + Nothing -> skip "no sh" + Just sh' -> do + let sh'' = concatMap (\c -> case c of + '\\' -> "\\\\\\\\" + x -> [x]) sh' + void $ shell "sed" [ "-i", "-e", "s/FINDSH/" <> sh'' <> "/g", "pkg-config.shim"] cdir <- testCurrentDir `fmap` getTestEnv res <- cabal' "v2-build" ["--extra-prog-path="++cdir, "-v2"] assertOutputContains "Some pkg-config packages have names containing invalid unicode: or" res diff --git a/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/my.cabal b/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/my.cabal index 6d195b52b44..a1f30e58d6c 100644 --- a/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/my.cabal +++ b/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/my.cabal @@ -11,4 +11,3 @@ executable my-executable main-is: Main.hs build-depends: base other-modules: Foo - hsc2hs-options: "--cc=g++" diff --git a/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/setup.test.hs b/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/setup.test.hs index 8dfca6d7d52..eb3a5eb255e 100644 --- a/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/setup.test.hs +++ b/cabal-testsuite/PackageTests/PreProcess/Hsc2HsOptionsCC/setup.test.hs @@ -5,24 +5,34 @@ import System.Directory (findExecutable) -- Check that preprocessors (hsc2hs) are run main = setupAndCabalTest $ do - -- we need "g++" - hasGxx <- liftIO $ fmap isJust $ findExecutable "g++" - skipUnless "g++" hasGxx - - -- Figure out how recent GHC we need - -- https://github.com/msys2/MINGW-packages/issues/3531 - skipIfWindows + -- we need "g++" (or "clang++" in newer Windows) + ghcVer <- isGhcVersion ">= 9.4" + cc <- if isWindows + then + -- The mingw tools distributed with GHC are not usually on the + -- path so we specify the path to cc directly. + joinPath + . (++ ["mingw", "bin", if ghcVer then "clang++.exe" else "g++.exe"]) + . init + . splitPath + . resultOutput + <$> runProgramM ghcProgram ["--print-libdir"] Nothing + else do + hasGxx <- liftIO $ fmap isJust $ findExecutable "g++" + skipUnless "g++" hasGxx + pure "g++" -- we need recent enough hsc2hs -- hsc2hs commit 9671202c11f7fe98e5b96d379532b6f691dc46dd -- Fix when using g++ as C compiler. Patch from elaforge. Fixes ghc #7232 + -- We also require 0.68.8 so that last --cc is the one that applies. p <- requireProgramM hsc2hsProgram case programVersion p of - Nothing -> skip "Unknown hsc2hs version" - Just v | v < mkVersion [0,68] -> skip $ "hsc2hs version: " ++ prettyShow v ++ " < 0.68" - _ -> return () + Nothing -> skip "Unknown hsc2hs version" + Just v | v < mkVersion [0,68,8] -> skip $ "hsc2hs version: " ++ prettyShow v ++ " < 0.68.8" + _ -> return () -- Actual test - setup_build [] + setup_build ["--hsc2hs-options=\"--cc=" <> cc <> "\""] r <- runExe' "my-executable" [] assertOutputContains "Is not C, is C++" r diff --git a/cabal-testsuite/PackageTests/ProfShared/Lib.hs b/cabal-testsuite/PackageTests/ProfShared/Lib.hs new file mode 100644 index 00000000000..516d174a825 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfShared/Lib.hs @@ -0,0 +1,3 @@ +module Lib where + +lib = 10 diff --git a/cabal-testsuite/PackageTests/ProfShared/exe/Prof.hs b/cabal-testsuite/PackageTests/ProfShared/exe/Prof.hs new file mode 100644 index 00000000000..200915ffefa --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfShared/exe/Prof.hs @@ -0,0 +1,5 @@ +module Main where + +import Lib + +main = print lib diff --git a/cabal-testsuite/PackageTests/ProfShared/profShared.cabal b/cabal-testsuite/PackageTests/ProfShared/profShared.cabal new file mode 100644 index 00000000000..ef348cfecc6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfShared/profShared.cabal @@ -0,0 +1,13 @@ +Cabal-Version: 3.8 +Name: prof-shared +Version: 0.1 +Build-Type: Simple + +library + exposed-modules: Lib + Build-Depends: base + +executable Prof + main-is: Prof.hs + hs-source-dirs: exe + build-depends: base, prof-shared diff --git a/cabal-testsuite/PackageTests/ProfShared/setup.test.hs b/cabal-testsuite/PackageTests/ProfShared/setup.test.hs new file mode 100644 index 00000000000..54147e34575 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfShared/setup.test.hs @@ -0,0 +1,142 @@ +import Test.Cabal.Prelude +import Data.List +import Data.Bifunctor + +data BuildWay = StaticWay | DynWay | ProfWay | ProfDynWay + deriving (Eq, Ord, Show, Read, Enum) + +-- Test building with profiling shared support +main = do + setupTest $ recordMode DoNotRecord $ do + -- Tests are not robust against missing dynamic libraries yet. Would + -- be better to fix this. + skipIfNoSharedLibraries + + let analyse_result expected r = do + + let ls = lines (resultOutput r) + + library_prefix = "Wanted module build ways(library): " + executable_prefix = "Wanted module build ways(executable 'Prof'): " + + get_ways prefix = map (drop (length prefix)) (filter (prefix `isPrefixOf`) ls) + library_ways = read_ways (get_ways library_prefix) + executable_ways = read_ways (get_ways executable_prefix) + + read_ways raw_ways = + case raw_ways of + -- There should only be one + [x] -> (read :: String -> [BuildWay]) x + -- Unless there are none, when we don't built the executable for example + [] -> [] + xs -> error "Unexpected number of log lines" + + way = (library_ways, executable_ways) + + unless (bimap (nub . sort) (nub . sort) expected == bimap (nub . sort) (nub . sort) way) $ + assertFailure $ "Expected:" ++ show expected ++ "\n" ++ "Got:" ++ show way + + requireSuccess r + setupTest $ recordMode DoNotRecord $ do + + has_prof_shared <- hasProfiledSharedLibraries + has_shared <- hasSharedLibraries + + let v = [ StaticWay ] + dyn = [ DynWay | has_shared ] + p_dyn = if has_prof_shared then [ProfDynWay] else p + p = [ ProfWay ] + none = [] + + let run_test args expected = do + setup "configure" args + res <- setup' "build" [] + analyse_result expected res + setup "clean" [] + + + run_test [] + (v <> dyn, v) + + + run_test ["--disable-library-vanilla", "--enable-executable-dynamic"] + (dyn, dyn) + + run_test ["--enable-profiling-shared"] + (v <> dyn <> p_dyn, v) + + run_test ["--enable-profiling-shared", "--enable-executable-dynamic"] + (v <> dyn <> p_dyn, dyn) + + run_test ["--enable-executable-dynamic", "--disable-library-vanilla"] + (dyn, dyn) + + run_test ["--enable-profiling"] + (v <> dyn <> p, p) + + run_test ["--enable-executable-profiling"] + (v <> dyn <> p, p) + + run_test ["--enable-executable-profiling", "--enable-executable-dynamic"] + (v <> dyn <> p_dyn, p_dyn) + + run_test ["--enable-profiling", "--enable-executable-dynamic"] + (v <> dyn <> p_dyn, p_dyn) + + --v dyn p (p exe) + run_test ["--enable-library-profiling", "--enable-executable-profiling"] + (v <> dyn <> p, p) + + run_test ["prof-shared", "--enable-profiling-shared", "--disable-library-vanilla", "--disable-shared"] + (p_dyn, none) + + -- p p_dyn + run_test ["prof-shared", "--enable-profiling-shared", "--enable-library-profiling", "--disable-library-vanilla", "--disable-shared"] + (p <> p_dyn, []) + + -- v p p_dyn + run_test ["prof-shared","--enable-profiling-shared", "--enable-library-profiling", "--enable-library-vanilla", "--disable-shared"] + (v <> p <> p_dyn, none) + + -- v dyn p p_dyn + run_test ["prof-shared", "--enable-profiling-shared", "--enable-library-profiling", "--enable-library-vanilla", "--enable-shared"] + (v <> dyn <> p <> p_dyn, none) + + let run_cabal_test args expected = cabalTest $ recordMode DoNotRecord $ do + has_prof_shared <- hasProfiledSharedLibraries + has_shared <- hasSharedLibraries + -- See GHC commit e400b9babdcf11669f963aeec20078fe7ccfca0d + -- Only installing profiled library is broken on very old ghc-pkg versions + broken_ghc_pkg <- isGhcVersion "<= 8.6.5" + + let cvt_l StaticWay = [ StaticWay ] + cvt_l DynWay = [ DynWay | has_shared ] + cvt_l ProfDynWay = [ProfDynWay | has_prof_shared ] + cvt_l ProfWay = [ ProfWay ] + + let cvt_e StaticWay = StaticWay + cvt_e DynWay = if has_shared then DynWay else error "DynWay" + cvt_e ProfDynWay = if has_prof_shared then ProfDynWay else ProfWay + cvt_e ProfWay = ProfWay + + unless (broken_ghc_pkg && (fst expected == [ProfWay])) $ do + res <- cabal' "v2-build" args + void $ analyse_result (bimap (concatMap cvt_l) (map cvt_e) expected) res + + run_cabal_test ["--disable-shared"] ([StaticWay], [StaticWay]) + run_cabal_test ["--disable-shared", "--disable-executable-dynamic"] ([StaticWay], [StaticWay]) + run_cabal_test ["--enable-shared"] ([DynWay, StaticWay], [StaticWay]) + run_cabal_test ["--enable-executable-dynamic"] ([DynWay, StaticWay], [DynWay]) + run_cabal_test ["--enable-shared", "--disable-library-vanilla", "--enable-executable-dynamic"] ([DynWay], [DynWay]) + + run_cabal_test ["--disable-shared", "--disable-library-vanilla", "--enable-profiling"] ([ProfWay], [ProfWay]) + + run_cabal_test ["--disable-shared", "--enable-profiling"] ([ProfWay, StaticWay], [ProfWay]) + + run_cabal_test ["--disable-shared", "--enable-profiling-shared", "--enable-profiling"] ([ProfDynWay, ProfWay, StaticWay], [ProfWay]) + + run_cabal_test ["--disable-shared", "--enable-profiling", "--enable-profiling-shared", "--enable-executable-dynamic"] ([ProfWay, ProfDynWay, StaticWay], [ProfDynWay]) + + run_cabal_test ["--enable-profiling", "--enable-executable-dynamic"] ([ProfDynWay, ProfWay, DynWay, StaticWay], [ProfDynWay]) + + run_cabal_test ["prof-shared", "--disable-library-profiling", "--enable-profiling", "--enable-executable-dynamic"] ([ProfDynWay, DynWay, StaticWay], []) diff --git a/cabal-testsuite/PackageTests/ProfSharedWarning/Lib.hs b/cabal-testsuite/PackageTests/ProfSharedWarning/Lib.hs new file mode 100644 index 00000000000..516d174a825 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfSharedWarning/Lib.hs @@ -0,0 +1,3 @@ +module Lib where + +lib = 10 diff --git a/cabal-testsuite/PackageTests/ProfSharedWarning/cabal.project b/cabal-testsuite/PackageTests/ProfSharedWarning/cabal.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfSharedWarning/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/ProfSharedWarning/exe/Prof.hs b/cabal-testsuite/PackageTests/ProfSharedWarning/exe/Prof.hs new file mode 100644 index 00000000000..200915ffefa --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfSharedWarning/exe/Prof.hs @@ -0,0 +1,5 @@ +module Main where + +import Lib + +main = print lib diff --git a/cabal-testsuite/PackageTests/ProfSharedWarning/profShared.cabal b/cabal-testsuite/PackageTests/ProfSharedWarning/profShared.cabal new file mode 100644 index 00000000000..ef348cfecc6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfSharedWarning/profShared.cabal @@ -0,0 +1,13 @@ +Cabal-Version: 3.8 +Name: prof-shared +Version: 0.1 +Build-Type: Simple + +library + exposed-modules: Lib + Build-Depends: base + +executable Prof + main-is: Prof.hs + hs-source-dirs: exe + build-depends: base, prof-shared diff --git a/cabal-testsuite/PackageTests/ProfSharedWarning/setup.out b/cabal-testsuite/PackageTests/ProfSharedWarning/setup.out new file mode 100644 index 00000000000..66512712837 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfSharedWarning/setup.out @@ -0,0 +1,3 @@ +# Setup configure +Configuring prof-shared-0.1... +Warning: Executables will use dynamic linking, but a shared library is not being built. Linking will fail if any executables depend on the library. diff --git a/cabal-testsuite/PackageTests/ProfSharedWarning/setup_prof.out b/cabal-testsuite/PackageTests/ProfSharedWarning/setup_prof.out new file mode 100644 index 00000000000..ad201b3b391 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProfSharedWarning/setup_prof.out @@ -0,0 +1,4 @@ +# Setup configure +Configuring prof-shared-0.1... +Warning: The flag --enable-executable-profiling is deprecated. Please use --enable-profiling instead. +Warning: Executables will use profiled dynamic linking, but a profiled shared library is not being built. Linking will fail if any executables depend on the library. diff --git a/cabal-testsuite/PackageTests/Project/CoverageProject/cabal.out b/cabal-testsuite/PackageTests/Project/CoverageProject/cabal.out index 1278857b31d..3b7c1d4b788 100644 --- a/cabal-testsuite/PackageTests/Project/CoverageProject/cabal.out +++ b/cabal-testsuite/PackageTests/Project/CoverageProject/cabal.out @@ -1,4 +1,6 @@ # cabal test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.out b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.out new file mode 100644 index 00000000000..60680b86db3 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.out @@ -0,0 +1,4 @@ +# cabal build +Error: [Cabal-7090] +Error parsing project file /cabal.project:4: +'source-repository-package' is a stanza, not a field. Remove the trailing ':' to parse a stanza. diff --git a/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.project b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.project new file mode 100644 index 00000000000..518ac39f5fb --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.project @@ -0,0 +1,6 @@ +packages: . + +-- This is an error; a trailing `:` is syntax for a field, not a stanza! +source-repository-package: + type: git + location: https://github.com/haskell-hvr/Only diff --git a/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.test.hs b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.test.hs new file mode 100644 index 00000000000..39636819157 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/cabal.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +main = cabalTest $ do + result <- fails $ cabal' "build" [] + assertOutputContains "Error parsing project file" result + assertOutputContains "'source-repository-package' is a stanza, not a field." result diff --git a/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/src/MyLib.hs b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/src/MyLib.hs new file mode 100644 index 00000000000..e657c4403f6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/src/MyLib.hs @@ -0,0 +1,4 @@ +module MyLib (someFunc) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" diff --git a/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/test.cabal b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/test.cabal new file mode 100644 index 00000000000..86374a457c7 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectConfig/FieldStanzaConfusion/test.cabal @@ -0,0 +1,13 @@ +cabal-version: 3.0 +name: test +version: 0.1.0.0 +license: NONE +author: rbt@sent.as +maintainer: Rebecca Turner +build-type: Simple + +library + exposed-modules: MyLib + build-depends: base + hs-source-dirs: src + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/0.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/0.config new file mode 100644 index 00000000000..05195095cb0 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/0.config @@ -0,0 +1,7 @@ +import: cfg/1.config +import: cfg/3.config +import: cfg/5.config +import: cfg/7.config +import: cfg/9.config + +import: with-ghc.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/2.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/2.config new file mode 100644 index 00000000000..80143e396c8 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/2.config @@ -0,0 +1,2 @@ +import: cfg/3.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/4.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/4.config new file mode 100644 index 00000000000..8b84982cc3e --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/4.config @@ -0,0 +1,2 @@ +import: cfg/5.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/6.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/6.config new file mode 100644 index 00000000000..43ce76e8766 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/6.config @@ -0,0 +1,2 @@ +import: cfg/7.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/8.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/8.config new file mode 100644 index 00000000000..28d0551160f --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/8.config @@ -0,0 +1,2 @@ +import: cfg/9.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.out b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.out new file mode 100644 index 00000000000..43a3f25acc2 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.out @@ -0,0 +1,4 @@ +# check "using config from message" with URI imports +# cabal v2-build +# check project configuration with URI imports is listed in full and +# check package directories and locations are reported in order diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs new file mode 100644 index 00000000000..e1419fb2467 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cabal.test.hs @@ -0,0 +1,16 @@ +import Test.Cabal.Prelude +import Data.Function ((&)) + +main = cabalTest . recordMode RecordMarked $ do + let log = recordHeader . pure + + log "check \"using config from message\" with URI imports" + out <- fails $ cabal' "v2-build" [ "all", "--dry-run", "--project-file=no-pkgs.project" ] + + log "check project configuration with URI imports is listed in full and" + log "check package directories and locations are reported in order" + + readFileVerbatim "errors.expect.txt" + >>= flip (assertOn multilineNeedleHaystack) out . normalizePathSeparators + + return () diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/1.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/1.config new file mode 100644 index 00000000000..126a94da61d --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/1.config @@ -0,0 +1,2 @@ +import: ../2.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/3.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/3.config new file mode 100644 index 00000000000..f40b183e472 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/3.config @@ -0,0 +1,2 @@ +import: ../4.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/5.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/5.config new file mode 100644 index 00000000000..7f579a54345 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/5.config @@ -0,0 +1,2 @@ +import: ../6.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/7.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/7.config new file mode 100644 index 00000000000..7cd98c9c244 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/7.config @@ -0,0 +1,2 @@ +import: ../8.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/9.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/9.config new file mode 100644 index 00000000000..44d1cc5e562 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/cfg/9.config @@ -0,0 +1,2 @@ +-- No imports here +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/errors.expect.txt b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/errors.expect.txt new file mode 100644 index 00000000000..93907eea807 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/errors.expect.txt @@ -0,0 +1,19 @@ +When using configuration from: + - no-pkgs.project + - 0.config + - 2.config + - 4.config + - 6.config + - 8.config + - cfg/1.config + - cfg/3.config + - cfg/5.config + - cfg/7.config + - cfg/9.config + - with-ghc.config + - https://www.stackage.org/lts-21.25/cabal.config +The following errors occurred: + - The package directory 'no-pkg-1' does not contain any .cabal file. + - The package location 'no-pkg-2-dir' does not exist. + - The package directory 'no-pkg-3' does not contain any .cabal file. + - The package location 'no-pkg-4-dir' does not exist. diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/no-pkg-1/README.md b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/no-pkg-1/README.md new file mode 100644 index 00000000000..ba73c42531f --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/no-pkg-1/README.md @@ -0,0 +1,2 @@ +There's intentionally no package here but the directory for the package exists +so that the project can find it. diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/no-pkg-3/README.md b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/no-pkg-3/README.md new file mode 100644 index 00000000000..ba73c42531f --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/no-pkg-3/README.md @@ -0,0 +1,2 @@ +There's intentionally no package here but the directory for the package exists +so that the project can find it. diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/no-pkgs.project b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/no-pkgs.project new file mode 100644 index 00000000000..0d723a9e298 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/no-pkgs.project @@ -0,0 +1,7 @@ +packages: + no-pkg-1 + no-pkg-2-dir + no-pkg-3 + no-pkg-4-dir + +import: 0.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/with-ghc.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/with-ghc.config new file mode 100644 index 00000000000..140a00be1b9 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromComplex/with-ghc.config @@ -0,0 +1,7 @@ +-- WARNING: Override the `with-compiler: ghc-x.y.z` of the stackage import, of +-- https://www.stackage.org/nightly-yyyy-mm-dd/cabal.config. Otherwise tests +-- will fail with: +-- -Error: [Cabal-5490] +-- -Cannot find the program 'ghc'. User-specified path 'ghc-x.y.z' does not +-- refer to an executable and the program is not on the system path. +with-compiler: ghc diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/a-very-extra.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/a-very-extra.config new file mode 100644 index 00000000000..c0f8dc3cc73 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/a-very-extra.config @@ -0,0 +1,2 @@ +import: https://www.stackage.org/lts-21.25/cabal.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/an-extra.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/an-extra.config new file mode 100644 index 00000000000..c0f8dc3cc73 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/an-extra.config @@ -0,0 +1,2 @@ +import: https://www.stackage.org/lts-21.25/cabal.config +import: https://www.stackage.org/lts-21.25/cabal.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/cabal.out b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/cabal.out new file mode 100644 index 00000000000..92fd8204a40 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/cabal.out @@ -0,0 +1 @@ +# cabal v2-build diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/cabal.project b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/cabal.project new file mode 100644 index 00000000000..32308f3491f --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/cabal.project @@ -0,0 +1,9 @@ +packages: no-pkg-dir +import: z-empty.config +import: an-extra.config +import: an-extra.config +import: a-very-extra.config +import: a-very-extra.config +import: https://www.stackage.org/lts-21.25/cabal.config +import: https://www.stackage.org/lts-21.25/cabal.config +import: with-ghc.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/cabal.test.hs b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/cabal.test.hs new file mode 100644 index 00000000000..cf37d1621a6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/cabal.test.hs @@ -0,0 +1,24 @@ +import Test.Cabal.Prelude + +main = cabalTest . recordMode RecordMarked $ do + let log = recordHeader . pure + + out <- fails $ cabal' "v2-build" [ "all", "--dry-run" ] + + -- Use assertRegex when the output is tainted by the temp directory, like + -- this: + -- + -- When using configuration from: + -- - /tmp/cabal-testsuite-282695/cabal.project + assertRegex + "Project configuration is listed in full and deduplicated" + "When using configuration from:(\n|\r\n) \ + \ .*cabal\\.project(\n|\r\n) \ + \ .*a-very-extra\\.config(\n|\r\n) \ + \ .*an-extra\\.config(\n|\r\n) \ + \ .*with-ghc\\.config(\n|\r\n) \ + \ .*z-empty\\.config(\n|\r\n) \ + \ .*https://www.stackage.org/lts-21.25/cabal.config(\n|\r\n)" + out + + return () diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/with-ghc.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/with-ghc.config new file mode 100644 index 00000000000..140a00be1b9 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/with-ghc.config @@ -0,0 +1,7 @@ +-- WARNING: Override the `with-compiler: ghc-x.y.z` of the stackage import, of +-- https://www.stackage.org/nightly-yyyy-mm-dd/cabal.config. Otherwise tests +-- will fail with: +-- -Error: [Cabal-5490] +-- -Cannot find the program 'ghc'. User-specified path 'ghc-x.y.z' does not +-- refer to an executable and the program is not on the system path. +with-compiler: ghc diff --git a/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/z-empty.config b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/z-empty.config new file mode 100644 index 00000000000..771bb389fde --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/DedupUsingConfigFromSimple/z-empty.config @@ -0,0 +1 @@ +-- This file is intentionally empty, just this comment. diff --git a/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/cabal.out b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/cabal.out new file mode 100644 index 00000000000..a3143ff9ffd --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/cabal.out @@ -0,0 +1,10 @@ +# cabal v2-build +Warning: /else.project, else.project: Unrecognized section '_' on line 3 +# Multiline string marking: +# ^When using configuration from:$ +# ^ - else.project$ +# ^ - dir-else/else.config$ +# ^The following errors occurred:$ +# ^ - The package location 'no-pkg-here' does not exist.$ +# Pseudo multiline string marking: +# ^When using configuration from: - else.project - dir-else/else.config The following errors occurred: - The package location 'no-pkg-here' does not exist.$ diff --git a/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/cabal.test.hs b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/cabal.test.hs new file mode 100644 index 00000000000..49360b59872 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/cabal.test.hs @@ -0,0 +1,24 @@ +import Test.Cabal.Prelude +import System.Directory + +main = cabalTest . recordMode RecordMarked $ do + let log = recordHeader . pure + + outElse <- fails $ cabal' "v2-build" [ "all", "--dry-run", "--project-file=else.project" ] + + msg <- readFileVerbatim "msg.expect.txt" + let msgSingle = lineBreaksToSpaces msg + + log "Multiline string marking:" + mapM_ log (lines . delimitLines $ encodeLf msg) + + log "Pseudo multiline string marking:" + mapM_ log (lines . delimitLines $ encodeLf msgSingle) + + assertOn multilineNeedleHaystack msg outElse + assertOn multilineNeedleHaystack{expectNeedleInHaystack = False} msgSingle outElse + + assertOutputContains msg outElse + assertOutputDoesNotContain msgSingle outElse + + return () diff --git a/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/dir-else/else.config b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/dir-else/else.config new file mode 100644 index 00000000000..f9c44e63d5b --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/dir-else/else.config @@ -0,0 +1,4 @@ +if false +else + _ + packages: no-pkg-here diff --git a/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/else.project b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/else.project new file mode 100644 index 00000000000..959c40f5660 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/else.project @@ -0,0 +1 @@ +import: dir-else/else.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/msg.expect.txt b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/msg.expect.txt new file mode 100644 index 00000000000..e5291b3adcd --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/ParseErrorProvenance/msg.expect.txt @@ -0,0 +1,5 @@ +When using configuration from: + - else.project + - dir-else/else.config +The following errors occurred: + - The package location 'no-pkg-here' does not exist. diff --git a/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/cabal.out b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/cabal.out new file mode 100644 index 00000000000..94ff8af283a --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/cabal.out @@ -0,0 +1,30 @@ +# checking project import with trailing space +# cabal v2-build +Warning: import has leading or trailing whitespace; + 'https://www.stackage.org/nightly-2024-12-05/cabal.config ' + imported by: trailing-space.project +Configuration is affected by the following files: +- trailing-space.project +- with-ghc.config + imported by: trailing-space.project +- https://www.stackage.org/nightly-2024-12-05/cabal.config + imported by: trailing-space.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following would be built: + - my-0.1 (lib:my) (first run) +# checking project import with tabs and spaces +# cabal v2-build +Warning: import has leading or trailing whitespace; + 'https://www.stackage.org/nightly-2024-12-05/cabal.config ' + imported by: tabs-and-spaces.project +Configuration is affected by the following files: +- tabs-and-spaces.project +- with-ghc.config + imported by: tabs-and-spaces.project +- https://www.stackage.org/nightly-2024-12-05/cabal.config + imported by: tabs-and-spaces.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following would be built: + - my-0.1 (lib:my) (first run) diff --git a/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/cabal.test.hs b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/cabal.test.hs new file mode 100644 index 00000000000..5c27d9172ec --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/cabal.test.hs @@ -0,0 +1,14 @@ +import Test.Cabal.Prelude + +main = cabalTest . recordMode RecordMarked $ do + let log = recordHeader . pure + + log "checking project import with trailing space" + trailing <- cabal' "v2-build" [ "--dry-run", "--project-file=trailing-space.project" ] + assertOutputContains "import has leading or trailing whitespace" trailing + assertOutputContains "'https://www.stackage.org/nightly-2024-12-05/cabal.config '" trailing + + log "checking project import with tabs and spaces" + cabal "v2-build" [ "--dry-run", "--project-file=tabs-and-spaces.project" ] + + return () diff --git a/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/my.cabal b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/my.cabal new file mode 100644 index 00000000000..b1b36c1e620 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/my.cabal @@ -0,0 +1,9 @@ +name: my +version: 0.1 +license: BSD3 +cabal-version: >= 1.2 +build-type: Simple + +library + exposed-modules: Foo + build-depends: base diff --git a/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/tabs-and-spaces.project b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/tabs-and-spaces.project new file mode 100644 index 00000000000..667f4474622 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/tabs-and-spaces.project @@ -0,0 +1,3 @@ +packages: . +import: https://www.stackage.org/nightly-2024-12-05/cabal.config +import: with-ghc.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/trailing-space.project b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/trailing-space.project new file mode 100644 index 00000000000..5923d9f7156 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/trailing-space.project @@ -0,0 +1,3 @@ +packages: . +import: https://www.stackage.org/nightly-2024-12-05/cabal.config +import: with-ghc.config diff --git a/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/with-ghc.config b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/with-ghc.config new file mode 100644 index 00000000000..140a00be1b9 --- /dev/null +++ b/cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/with-ghc.config @@ -0,0 +1,7 @@ +-- WARNING: Override the `with-compiler: ghc-x.y.z` of the stackage import, of +-- https://www.stackage.org/nightly-yyyy-mm-dd/cabal.config. Otherwise tests +-- will fail with: +-- -Error: [Cabal-5490] +-- -Cannot find the program 'ghc'. User-specified path 'ghc-x.y.z' does not +-- refer to an executable and the program is not on the system path. +with-compiler: ghc diff --git a/cabal-testsuite/PackageTests/QuasiQuotes/dynamic/setup.test.hs b/cabal-testsuite/PackageTests/QuasiQuotes/dynamic/setup.test.hs index 31309a46f0c..bbc850992fa 100644 --- a/cabal-testsuite/PackageTests/QuasiQuotes/dynamic/setup.test.hs +++ b/cabal-testsuite/PackageTests/QuasiQuotes/dynamic/setup.test.hs @@ -1,5 +1,5 @@ import Test.Cabal.Prelude -- Test building a dynamic library/executable which uses QuasiQuotes main = setupAndCabalTest $ do - skipUnless "no shared libs" =<< hasSharedLibraries + skipIfNoSharedLibraries setup_build ["--enable-shared", "--enable-executable-dynamic"] diff --git a/cabal-testsuite/PackageTests/Recompilation/GHC24926/Repro.hs b/cabal-testsuite/PackageTests/Recompilation/GHC24926/Repro.hs new file mode 100644 index 00000000000..204872538ea --- /dev/null +++ b/cabal-testsuite/PackageTests/Recompilation/GHC24926/Repro.hs @@ -0,0 +1,6 @@ +import Process (a) +import Internal (Unused) + +main :: IO () +main = a + diff --git a/cabal-testsuite/PackageTests/Recompilation/GHC24926/cabal.test.hs b/cabal-testsuite/PackageTests/Recompilation/GHC24926/cabal.test.hs new file mode 100644 index 00000000000..607426f381c --- /dev/null +++ b/cabal-testsuite/PackageTests/Recompilation/GHC24926/cabal.test.hs @@ -0,0 +1,36 @@ +import Test.Cabal.Prelude + +-- See ghc#24926 +main = cabalTest $ do + recordMode DoNotRecord $ do + + root <- testTmpDir <$> getTestEnv + + writeInternalOrig root + cabal "test" [] + + liftIO $ writeFile (root ++ "/src/Internal.hs") + " module Internal where;\ + + \ data Unused = Unused;" + fails $ cabal "test" [] -- broken module on purpose + + writeInternalOrig root + out <- cabal' "test" [] -- shouldn't fail! + + assertOutputDoesNotContain + ": error:" out + assertOutputDoesNotContain + "Cannot continue after interface file error" out + + where + + writeInternalOrig r = liftIO $ do + writeFile (r ++ "/src/Internal.hs") + " module Internal where;\ + + \ data Unused = Unused;\ + + \ b :: IO (); \ + \ b = pure ();" + diff --git a/cabal-testsuite/PackageTests/Recompilation/GHC24926/repro.cabal b/cabal-testsuite/PackageTests/Recompilation/GHC24926/repro.cabal new file mode 100644 index 00000000000..30ad3d92d13 --- /dev/null +++ b/cabal-testsuite/PackageTests/Recompilation/GHC24926/repro.cabal @@ -0,0 +1,19 @@ +cabal-version: 3.0 +name: repro +version: 0.1.0.0 +build-type: Simple + +library + default-language: Haskell2010 + exposed-modules: + Internal + Process + build-depends: base + hs-source-dirs: src + +test-suite repro + default-language: Haskell2010 + type: exitcode-stdio-1.0 + main-is: Repro.hs + build-depends: base, repro + diff --git a/cabal-testsuite/PackageTests/Recompilation/GHC24926/src/Process.hs b/cabal-testsuite/PackageTests/Recompilation/GHC24926/src/Process.hs new file mode 100644 index 00000000000..919c5d46df5 --- /dev/null +++ b/cabal-testsuite/PackageTests/Recompilation/GHC24926/src/Process.hs @@ -0,0 +1,7 @@ +module Process where + +import Internal + +a :: IO () +a = b + diff --git a/cabal-testsuite/PackageTests/Regression/T10046/aa.cabal b/cabal-testsuite/PackageTests/Regression/T10046/aa.cabal new file mode 100644 index 00000000000..4acc7154baa --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T10046/aa.cabal @@ -0,0 +1,28 @@ +cabal-version: 3.0 +name: aa +version: 0.1.0.0 +license: NONE +build-type: Simple +extra-doc-files: CHANGELOG.md + +library + exposed-modules: MyLib + build-depends: base, template-haskell + hs-source-dirs: src + default-language: Haskell2010 + +test-suite bb-test + default-language: Haskell2010 + type: exitcode-stdio-1.0 + hs-source-dirs: testbb + main-is: Main.hs + build-depends: + base, aa + +test-suite aa-test + default-language: Haskell2010 + type: exitcode-stdio-1.0 + hs-source-dirs: test + main-is: Main.hs + build-depends: + base diff --git a/cabal-testsuite/PackageTests/Regression/T10046/app/Main.hs b/cabal-testsuite/PackageTests/Regression/T10046/app/Main.hs new file mode 100644 index 00000000000..76a9bdb5d48 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T10046/app/Main.hs @@ -0,0 +1 @@ +main = pure () diff --git a/cabal-testsuite/PackageTests/Regression/T10046/cabal.project b/cabal-testsuite/PackageTests/Regression/T10046/cabal.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T10046/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/Regression/T10046/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T10046/cabal.test.hs new file mode 100644 index 00000000000..9b857e2f09a --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T10046/cabal.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +-- T10046 +main = cabalTest $ recordMode DoNotRecord $ do + out <- cabal' "test" ["all"] + assertOutputDoesNotContain "Failed to find the installed unit 'aa-0.1.0.0-inplace'" out diff --git a/cabal-testsuite/PackageTests/Regression/T10046/src/MyLib.hs b/cabal-testsuite/PackageTests/Regression/T10046/src/MyLib.hs new file mode 100644 index 00000000000..ca3816aaab9 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T10046/src/MyLib.hs @@ -0,0 +1,11 @@ +{-# LANGUAGE TemplateHaskell #-} +module MyLib where + +import Control.Concurrent +import Language.Haskell.TH + +-- Must take longer to compile than the testsuite +$(do runIO $ + threadDelay (5*1000*1000) -- 5s + [d| data X |] + ) diff --git a/cabal-testsuite/PackageTests/Regression/T10046/test/Main.hs b/cabal-testsuite/PackageTests/Regression/T10046/test/Main.hs new file mode 100644 index 00000000000..76a9bdb5d48 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T10046/test/Main.hs @@ -0,0 +1 @@ +main = pure () diff --git a/cabal-testsuite/PackageTests/Regression/T10046/testbb/Main.hs b/cabal-testsuite/PackageTests/Regression/T10046/testbb/Main.hs new file mode 100644 index 00000000000..76a9bdb5d48 --- /dev/null +++ b/cabal-testsuite/PackageTests/Regression/T10046/testbb/Main.hs @@ -0,0 +1 @@ +main = pure () diff --git a/cabal-testsuite/PackageTests/Regression/T4025/setup.test.hs b/cabal-testsuite/PackageTests/Regression/T4025/setup.test.hs index 0ec5d068147..b26afa66701 100644 --- a/cabal-testsuite/PackageTests/Regression/T4025/setup.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T4025/setup.test.hs @@ -1,16 +1,13 @@ import Test.Cabal.Prelude -- Test that we don't accidentally add the inplace directory to --- an executable RPATH. Don't test on Windows, which doesn't --- support RPATH. +-- an executable RPATH. main = setupAndCabalTest $ do - skipIfWindows - osx <- isOSX - ghc <- isGhcVersion ">= 8.10.7" - expectBrokenIf (osx && ghc) 7610 $ do -- see also issue #7988 - setup "configure" ["--enable-executable-dynamic"] - setup "build" [] - -- This should fail as it we should NOT be able to find the - -- dynamic library for the internal library (since we didn't - -- install it). If we incorrectly encoded our local dist - -- dir in the RPATH, this will succeed. - recordMode DoNotRecord . fails $ runExe "exe" [] + skipIfNoSharedLibraries + expectBrokenIfOSXAndGhc ">= 8.10.7" 7610 $ do -- see also issue #7988 + setup "configure" ["--enable-executable-dynamic"] + setup "build" [] + -- This should fail as it we should NOT be able to find the + -- dynamic library for the internal library (since we didn't + -- install it). If we incorrectly encoded our local dist + -- dir in the RPATH, this will succeed. + recordMode DoNotRecord . fails $ runExe "exe" [] diff --git a/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.out b/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.out index 7bc5e2e63a6..c5daa27101f 100644 --- a/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.out +++ b/cabal-testsuite/PackageTests/Regression/T4154/install-time-with-constraint.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: diff --git a/cabal-testsuite/PackageTests/Regression/T4202/cabal.out b/cabal-testsuite/PackageTests/Regression/T4202/cabal.out index a7bae1abdb2..426ccd41ed8 100644 --- a/cabal-testsuite/PackageTests/Regression/T4202/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T4202/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -11,12 +13,16 @@ Configuring executable 'qexe' for q-1.0... Preprocessing executable 'qexe' for q-1.0... Building executable 'qexe' for q-1.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - p-1.0 (lib) (file P.hs changed) Preprocessing library for p-1.0... Building library for p-1.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - q-1.0 (exe:qexe) (file /cabal.dist/work/dist/build//ghc-/p-1.0/cache/build changed) diff --git a/cabal-testsuite/PackageTests/Regression/T4270/setup.test.hs b/cabal-testsuite/PackageTests/Regression/T4270/setup.test.hs index 258dcc21e16..6dbe57b8ede 100644 --- a/cabal-testsuite/PackageTests/Regression/T4270/setup.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T4270/setup.test.hs @@ -4,10 +4,8 @@ import Test.Cabal.Prelude -- See https://github.com/haskell/cabal/issues/4270 main = setupAndCabalTest $ do skipIfAllCabalVersion "< 2.2" - skipUnless "no shared libs" =<< hasSharedLibraries + skipIfNoSharedLibraries skipUnless "no shared Cabal" =<< hasCabalShared - ghc <- isGhcVersion "== 8.0.2" - osx <- isOSX - expectBrokenIf (osx && ghc) 8028 $ do + expectBrokenIfOSXAndGhc "== 8.0.2" 8028 $ do setup_build ["--enable-tests", "--enable-executable-dynamic"] setup "test" [] diff --git a/cabal-testsuite/PackageTests/Regression/T4291/setup.test.hs b/cabal-testsuite/PackageTests/Regression/T4291/setup.test.hs index a6eb9844785..f5152c93ccb 100644 --- a/cabal-testsuite/PackageTests/Regression/T4291/setup.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T4291/setup.test.hs @@ -3,15 +3,16 @@ import Test.Cabal.Prelude -- Test that checkRelocate doesn't fail when library directory of dependee -- contains '..' -main = setupAndCabalTest $ withPackageDb $ do - skipIfWindows - skipUnlessGhcVersion ">= 7.6" - env <- getTestEnv - let pkgroot = takeDirectory $ testPackageDbDir env - prefix = testTmpDir env "prefix" - assertBool "we need a prefix that is not under pkgroot for this test" $ - not $ pkgroot `isPrefixOf` prefix - withDirectory "dependee" $ - setup_install ["--enable-relocatable", "--prefix", prefix] - withDirectory "depender" $ - setup_install ["--enable-relocatable", "--prefix", prefix] +main = do + skipIfWindows "no relocatable builds" + setupAndCabalTest $ withPackageDb $ do + skipUnlessGhcVersion ">= 7.6" + env <- getTestEnv + let pkgroot = takeDirectory $ testPackageDbDir env + prefix = testTmpDir env "prefix" + assertBool "we need a prefix that is not under pkgroot for this test" $ + not $ pkgroot `isPrefixOf` prefix + withDirectory "dependee" $ + setup_install ["--enable-relocatable", "--prefix", prefix] + withDirectory "depender" $ + setup_install ["--enable-relocatable", "--prefix", prefix] diff --git a/cabal-testsuite/PackageTests/Regression/T4720/cabal.out b/cabal-testsuite/PackageTests/Regression/T4720/cabal.out index 3cf3d3afe28..34903b832da 100644 --- a/cabal-testsuite/PackageTests/Regression/T4720/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T4720/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T4798/cabal.out b/cabal-testsuite/PackageTests/Regression/T4798/cabal.out index 05de54b124c..55571a3f647 100644 --- a/cabal-testsuite/PackageTests/Regression/T4798/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T4798/cabal.out @@ -1,4 +1,6 @@ # cabal test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T4986/cabal.out b/cabal-testsuite/PackageTests/Regression/T4986/cabal.out index 1ceb427b04c..fdec868d0a5 100644 --- a/cabal-testsuite/PackageTests/Regression/T4986/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T4986/cabal.out @@ -1 +1,3 @@ -# cabal v2-configure \ No newline at end of file +# cabal v2-configure +Configuration is affected by the following files: +- cabal.project diff --git a/cabal-testsuite/PackageTests/Regression/T5213/cabal.out b/cabal-testsuite/PackageTests/Regression/T5213/cabal.out index fb0e7ad7a9a..799c2005c0b 100644 --- a/cabal-testsuite/PackageTests/Regression/T5213/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T5213/cabal.out @@ -1,4 +1,6 @@ # cabal new-test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T5213ExeCoverage/cabal.out b/cabal-testsuite/PackageTests/Regression/T5213ExeCoverage/cabal.out index 57cb186d882..1aaf72ce762 100644 --- a/cabal-testsuite/PackageTests/Regression/T5213ExeCoverage/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T5213ExeCoverage/cabal.out @@ -1,4 +1,6 @@ # cabal new-test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T5309/cabal.out b/cabal-testsuite/PackageTests/Regression/T5309/cabal.out index e799843e5b6..a2f7566f38a 100644 --- a/cabal-testsuite/PackageTests/Regression/T5309/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T5309/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -15,6 +17,8 @@ Configuring executable 'exe-with-lib' for T5309-1.0.0.0... Preprocessing executable 'exe-with-lib' for T5309-1.0.0.0... Building executable 'exe-with-lib' for T5309-1.0.0.0... # cabal v2-test +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - T5309-1.0.0.0 (test:test-no-lib) (first run) @@ -36,6 +40,8 @@ Test suite test-with-lib: PASS Test suite logged to: /cabal.dist/work/./dist/build//ghc-/T5309-1.0.0.0/t/test-with-lib/test/T5309-1.0.0.0-test-with-lib.log 1 of 1 test suites (1 of 1 test cases) passed. # cabal v2-bench +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - T5309-1.0.0.0 (bench:bench-no-lib) (first run) diff --git a/cabal-testsuite/PackageTests/Regression/T5309/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T5309/cabal.test.hs index a81a75197f3..4700f191578 100644 --- a/cabal-testsuite/PackageTests/Regression/T5309/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T5309/cabal.test.hs @@ -1,6 +1,6 @@ import Test.Cabal.Prelude main = cabalTest $ do - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 - cabal "v2-build" ["all"] - cabal "v2-test" ["all"] - cabal "v2-bench" ["all"] + expectBrokenIfWindowsCIAndGhc ">= 9.4" 10189 $ do + cabal "v2-build" ["all"] + cabal "v2-test" ["all"] + cabal "v2-bench" ["all"] diff --git a/cabal-testsuite/PackageTests/Regression/T5318/sdist-list-sources.out b/cabal-testsuite/PackageTests/Regression/T5318/sdist-list-sources.out index faefc513fe8..8e257e232a7 100644 --- a/cabal-testsuite/PackageTests/Regression/T5318/sdist-list-sources.out +++ b/cabal-testsuite/PackageTests/Regression/T5318/sdist-list-sources.out @@ -1,2 +1,4 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote source list to /empty-data-dir-0.list diff --git a/cabal-testsuite/PackageTests/Regression/T5409/use-different-versions-of-dependency-for-library-and-build-tool.test.hs b/cabal-testsuite/PackageTests/Regression/T5409/use-different-versions-of-dependency-for-library-and-build-tool.test.hs index 2a3eb3c093c..4bbb8b91a9b 100644 --- a/cabal-testsuite/PackageTests/Regression/T5409/use-different-versions-of-dependency-for-library-and-build-tool.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T5409/use-different-versions-of-dependency-for-library-and-build-tool.test.hs @@ -1,4 +1,5 @@ import Test.Cabal.Prelude +import Data.Function ((&)) -- The local package, pkg-1.0, depends on build-tool-pkg-1 as a library and -- build-tool-pkg-2 as a build-tool. This test checks that cabal uses the @@ -16,16 +17,13 @@ main = cabalTest $ withShorterPathForNewBuildStore $ do r1 <- recordMode DoNotRecord $ cabal' "v2-build" ["pkg:my-exe"] - let msg = concat - [ "In order, the following will be built:" - , " - build-tool-pkg-1 (lib) (requires build)" - , " - build-tool-pkg-2 (lib) (requires build)" - , " - build-tool-pkg-2 (exe:build-tool-exe) (requires build)" - , " - pkg-1.0 (exe:my-exe) (first run)" - ] + "In order, the following will be built:\n\ + \ - build-tool-pkg-1 (lib) (requires build)\n\ + \ - build-tool-pkg-2 (lib) (requires build)\n\ + \ - build-tool-pkg-2 (exe:build-tool-exe) (requires build)\n\ + \ - pkg-1.0 (exe:my-exe) (first run)" + & flip (assertOn multilineNeedleHaystack) r1 - assertOutputContains msg r1 withPlan $ do r2 <- runPlanExe' "pkg" "my-exe" [] - assertOutputContains - "build-tool library version: 1, build-tool exe version: 2" r2 + assertOn multilineNeedleHaystack "build-tool library version: 1,\nbuild-tool exe version: 2" r2 diff --git a/cabal-testsuite/PackageTests/Regression/T5677/cabal.out b/cabal-testsuite/PackageTests/Regression/T5677/cabal.out index 88bc2862665..d660ba36715 100644 --- a/cabal-testsuite/PackageTests/Regression/T5677/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T5677/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs index 27edba49486..a8ea261289a 100644 --- a/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T5677/cabal.test.hs @@ -2,5 +2,4 @@ import Test.Cabal.Prelude main = cabalTest $ do -- -Wmissing-export-lists is new in 8.4. skipUnlessGhcVersion ">= 8.3" - skipIfWindows -- TODO: https://github.com/haskell/cabal/issues/6271 cabal "v2-build" ["all"] diff --git a/cabal-testsuite/PackageTests/Regression/T6334/cabal.out b/cabal-testsuite/PackageTests/Regression/T6334/cabal.out index a0a58d72357..d011ce510c0 100644 --- a/cabal-testsuite/PackageTests/Regression/T6334/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T6334/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T6440/cabal.out b/cabal-testsuite/PackageTests/Regression/T6440/cabal.out index 5c24cecf81f..8de48ba2a8d 100644 --- a/cabal-testsuite/PackageTests/Regression/T6440/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T6440/cabal.out @@ -1,4 +1,6 @@ # cabal test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T6853/cabal.out b/cabal-testsuite/PackageTests/Regression/T6853/cabal.out index 75fe8d9ef1c..2c7e916bd12 100644 --- a/cabal-testsuite/PackageTests/Regression/T6853/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T6853/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs b/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs index 233f4a2a3d1..9f71b845736 100644 --- a/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs +++ b/cabal-testsuite/PackageTests/Regression/T6906/cabal.test.hs @@ -1,9 +1,7 @@ import Test.Cabal.Prelude main = cabalTest $ do - win <- isWindows - ghcsWithMaxPathIssue <- isGhcVersion "< 8.6.5" - expectBrokenIf (win && ghcsWithMaxPathIssue) 6271 $ do + expectBrokenIfWindowsAndGhc "< 8.6.5" 6271 $ do res <- recordMode DoNotRecord $ cabalG' ["--config=cabal.config"] "v2-install" ["-v3"] assertOutputContains "creating file with the inputs used to compute the package hash:" res assertOutputContains "extra-lib-dirs: bar" res diff --git a/cabal-testsuite/PackageTests/Regression/T6961/DepExternal/cabal.out b/cabal-testsuite/PackageTests/Regression/T6961/DepExternal/cabal.out index a063ee92cb8..2e8cfbf46cc 100644 --- a/cabal-testsuite/PackageTests/Regression/T6961/DepExternal/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T6961/DepExternal/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: diff --git a/cabal-testsuite/PackageTests/Regression/T6961/DepInternal/cabal.out b/cabal-testsuite/PackageTests/Regression/T6961/DepInternal/cabal.out index cda3c265371..495d99db1f8 100644 --- a/cabal-testsuite/PackageTests/Regression/T6961/DepInternal/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T6961/DepInternal/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/Regression/T6961/Exe/cabal.out b/cabal-testsuite/PackageTests/Regression/T6961/Exe/cabal.out index bde31817cf4..ddd01927783 100644 --- a/cabal-testsuite/PackageTests/Regression/T6961/Exe/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T6961/Exe/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: diff --git a/cabal-testsuite/PackageTests/Regression/T6961/Test/cabal.out b/cabal-testsuite/PackageTests/Regression/T6961/Test/cabal.out index 8f28d66058a..8b24d62d861 100644 --- a/cabal-testsuite/PackageTests/Regression/T6961/Test/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T6961/Test/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following would be built: diff --git a/cabal-testsuite/PackageTests/Regression/T7234/Fail/cabal.out b/cabal-testsuite/PackageTests/Regression/T7234/Fail/cabal.out index 5c8ed7ba2c5..572c32fde7a 100644 --- a/cabal-testsuite/PackageTests/Regression/T7234/Fail/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T7234/Fail/cabal.out @@ -1,4 +1,7 @@ # cabal v2-build +Warning: The package description file ./issue7234.cabal has warnings: issue7234.cabal:13:3: The field "other-extensions" is available only since the Cabal specification version 1.10. +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/Regression/T7234/Success/cabal.out b/cabal-testsuite/PackageTests/Regression/T7234/Success/cabal.out index a0c85309b1f..2598efd4917 100644 --- a/cabal-testsuite/PackageTests/Regression/T7234/Success/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T7234/Success/cabal.out @@ -1,4 +1,7 @@ # cabal v2-build +Warning: The package description file ./issue7234.cabal has warnings: issue7234.cabal:14:3: The field "other-extensions" is available only since the Cabal specification version 1.10. +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T8507/cabal.out b/cabal-testsuite/PackageTests/Regression/T8507/cabal.out index a4b777afbbc..7f8230fe9fe 100644 --- a/cabal-testsuite/PackageTests/Regression/T8507/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T8507/cabal.out @@ -1,4 +1,6 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T9640/cabal.out b/cabal-testsuite/PackageTests/Regression/T9640/cabal.out index 4c0f119823f..a2b4d7da6f0 100644 --- a/cabal-testsuite/PackageTests/Regression/T9640/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T9640/cabal.out @@ -1,6 +1,9 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal build +Warning: The package description file ./depend-on-custom-with-exe.cabal has warnings: depend-on-custom-with-exe.cabal:16:1: Ignoring trailing fields after sections: "ghc-options" +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/Regression/T9756/cabal.out b/cabal-testsuite/PackageTests/Regression/T9756/cabal.out index 61a814acd68..32930c9a727 100644 --- a/cabal-testsuite/PackageTests/Regression/T9756/cabal.out +++ b/cabal-testsuite/PackageTests/Regression/T9756/cabal.out @@ -12,6 +12,8 @@ Installing executable mybuilder in Warning: The directory /cabal.dist/home/.cabal/store/ghc-/incoming/new-/cabal.dist/home/.cabal/store/ghc-/-/bin is not in the system search path. Symlinking 'mybuilder' to '/cabal.dist/install/mybuilder' # cabal v2-build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/RelativePathProjectImports/cabal.out b/cabal-testsuite/PackageTests/RelativePathProjectImports/cabal.out index 53ac1b8e71c..10c4953236f 100644 --- a/cabal-testsuite/PackageTests/RelativePathProjectImports/cabal.out +++ b/cabal-testsuite/PackageTests/RelativePathProjectImports/cabal.out @@ -1,4 +1,8 @@ # cabal build +Configuration is affected by the following files: +- cabal.project +- dep/cabal.project + imported by: cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -15,6 +19,10 @@ Configuring library for main-0.1... Preprocessing library for main-0.1... Building library for main-0.1... # cabal build +Configuration is affected by the following files: +- cabal.project +- dep/cabal.project + imported by: cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ReplNoLoad/cabal.exec-no-load.out b/cabal-testsuite/PackageTests/ReplNoLoad/cabal.exec-no-load.out index 6f2908d3f26..9177f4d5c37 100644 --- a/cabal-testsuite/PackageTests/ReplNoLoad/cabal.exec-no-load.out +++ b/cabal-testsuite/PackageTests/ReplNoLoad/cabal.exec-no-load.out @@ -1,5 +1,7 @@ # cabal clean # cabal repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ReplNoLoad/cabal.exec-normal.out b/cabal-testsuite/PackageTests/ReplNoLoad/cabal.exec-normal.out index 68ecdbe4008..b3e330f7e29 100644 --- a/cabal-testsuite/PackageTests/ReplNoLoad/cabal.exec-normal.out +++ b/cabal-testsuite/PackageTests/ReplNoLoad/cabal.exec-normal.out @@ -1,5 +1,7 @@ # cabal clean # cabal repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ReplNoLoad/cabal.lib-no-load.out b/cabal-testsuite/PackageTests/ReplNoLoad/cabal.lib-no-load.out index 6f2908d3f26..9177f4d5c37 100644 --- a/cabal-testsuite/PackageTests/ReplNoLoad/cabal.lib-no-load.out +++ b/cabal-testsuite/PackageTests/ReplNoLoad/cabal.lib-no-load.out @@ -1,5 +1,7 @@ # cabal clean # cabal repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ReplNoLoad/cabal.lib-normal.out b/cabal-testsuite/PackageTests/ReplNoLoad/cabal.lib-normal.out index 6f2908d3f26..9177f4d5c37 100644 --- a/cabal-testsuite/PackageTests/ReplNoLoad/cabal.lib-normal.out +++ b/cabal-testsuite/PackageTests/ReplNoLoad/cabal.lib-normal.out @@ -1,5 +1,7 @@ # cabal clean # cabal repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ReplOptions/cabal.multiple-repl-options-multiple-flags.out b/cabal-testsuite/PackageTests/ReplOptions/cabal.multiple-repl-options-multiple-flags.out index 374ac0dd8c3..e45e9385218 100644 --- a/cabal-testsuite/PackageTests/ReplOptions/cabal.multiple-repl-options-multiple-flags.out +++ b/cabal-testsuite/PackageTests/ReplOptions/cabal.multiple-repl-options-multiple-flags.out @@ -1,5 +1,7 @@ # cabal clean # cabal v2-repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ReplOptions/cabal.multiple-repl-options.out b/cabal-testsuite/PackageTests/ReplOptions/cabal.multiple-repl-options.out index 374ac0dd8c3..e45e9385218 100644 --- a/cabal-testsuite/PackageTests/ReplOptions/cabal.multiple-repl-options.out +++ b/cabal-testsuite/PackageTests/ReplOptions/cabal.multiple-repl-options.out @@ -1,5 +1,7 @@ # cabal clean # cabal v2-repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options-multiple-flags-negative.out b/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options-multiple-flags-negative.out index ba1bbef88db..9368db4d3dd 100644 --- a/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options-multiple-flags-negative.out +++ b/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options-multiple-flags-negative.out @@ -1,5 +1,7 @@ # cabal clean # cabal v2-repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options-multiple-flags.out b/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options-multiple-flags.out index 374ac0dd8c3..e45e9385218 100644 --- a/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options-multiple-flags.out +++ b/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options-multiple-flags.out @@ -1,5 +1,7 @@ # cabal clean # cabal v2-repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options.out b/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options.out index 374ac0dd8c3..e45e9385218 100644 --- a/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options.out +++ b/cabal-testsuite/PackageTests/ReplOptions/cabal.single-repl-options.out @@ -1,5 +1,7 @@ # cabal clean # cabal v2-repl +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/SDist/T5195and5349/cabal.out b/cabal-testsuite/PackageTests/SDist/T5195and5349/cabal.out index f42c4e98177..d6db93b0a25 100644 --- a/cabal-testsuite/PackageTests/SDist/T5195and5349/cabal.out +++ b/cabal-testsuite/PackageTests/SDist/T5195and5349/cabal.out @@ -1,4 +1,6 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Warning: Ignoring directory '././actually-a-directory' listed in a Cabal package field which should only include files (not directories). Warning: Ignoring directory './actually-a-directory' listed in a Cabal package field which should only include files (not directories). Warning: Ignoring directory './actually-a-directory' listed in a Cabal package field which should only include files (not directories). diff --git a/cabal-testsuite/PackageTests/SDist/T7028/cabal.out b/cabal-testsuite/PackageTests/SDist/T7028/cabal.out index 222d3c33c8b..4ec2d96e545 100644 --- a/cabal-testsuite/PackageTests/SDist/T7028/cabal.out +++ b/cabal-testsuite/PackageTests/SDist/T7028/cabal.out @@ -1,2 +1,4 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote source list to /t7028-0.list diff --git a/cabal-testsuite/PackageTests/SDist/T7124/cabal-list.out b/cabal-testsuite/PackageTests/SDist/T7124/cabal-list.out index cb65c326a56..b45ccabcb39 100644 --- a/cabal-testsuite/PackageTests/SDist/T7124/cabal-list.out +++ b/cabal-testsuite/PackageTests/SDist/T7124/cabal-list.out @@ -1,4 +1,6 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote source list to /pkg-a-0.list Error: [Cabal-6661] filepath wildcard './data.txt' does not match any files. diff --git a/cabal-testsuite/PackageTests/SDist/T7124/cabal.out b/cabal-testsuite/PackageTests/SDist/T7124/cabal.out index 5dbaee755bc..ec1a61ec9f8 100644 --- a/cabal-testsuite/PackageTests/SDist/T7124/cabal.out +++ b/cabal-testsuite/PackageTests/SDist/T7124/cabal.out @@ -1,4 +1,6 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote tarball sdist to /pkg-a-0.tar.gz Error: [Cabal-6661] filepath wildcard './data.txt' does not match any files. diff --git a/cabal-testsuite/PackageTests/SDist/T7698/cabal.out b/cabal-testsuite/PackageTests/SDist/T7698/cabal.out index 99370eb5dd6..b4405270c12 100644 --- a/cabal-testsuite/PackageTests/SDist/T7698/cabal.out +++ b/cabal-testsuite/PackageTests/SDist/T7698/cabal.out @@ -1,2 +1,4 @@ # cabal v2-sdist +Configuration is affected by the following files: +- cabal.project Wrote source list to /t7698-0.list diff --git a/cabal-testsuite/PackageTests/SDist/T8817/cabal.out b/cabal-testsuite/PackageTests/SDist/T8817/cabal.out new file mode 100644 index 00000000000..89e68f1c41e --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/cabal.out @@ -0,0 +1,4 @@ +# cabal v2-sdist +Configuration is affected by the following files: +- cabal.project +Wrote tarball sdist to /t8817-0.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/T8817/cabal.project b/cabal-testsuite/PackageTests/SDist/T8817/cabal.project new file mode 100644 index 00000000000..f69442ca765 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/cabal.project @@ -0,0 +1 @@ +packages: pkg/*.cabal diff --git a/cabal-testsuite/PackageTests/SDist/T8817/cabal.test.hs b/cabal-testsuite/PackageTests/SDist/T8817/cabal.test.hs new file mode 100644 index 00000000000..1fca4955b48 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/cabal.test.hs @@ -0,0 +1,17 @@ +import Test.Cabal.Prelude + +main = cabalTest $ do + tmpdir <- fmap testTmpDir getTestEnv + + cabal "v2-sdist" ["--output-directory", tmpdir, "all"] + + let distTarPath = tmpdir "t8817-0.tar.gz" + distExtractedPath = tmpdir "t8817-0" + + shouldExist distTarPath + + tar ["-xzf", distTarPath] + + shouldExist (distExtractedPath "f1") + shouldExist (distExtractedPath "d1" "f2.txt") + shouldExist (distExtractedPath "d1" "f3.txt") diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/Main.hs b/cabal-testsuite/PackageTests/SDist/T8817/pkg/Main.hs new file mode 100644 index 00000000000..4233a67ecdd --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/Main.hs @@ -0,0 +1 @@ +main = putStrLn "hi" diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f2.txt b/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f2.txt new file mode 100644 index 00000000000..9de77c18733 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f2.txt @@ -0,0 +1 @@ +f2 diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f3.txt b/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f3.txt new file mode 100644 index 00000000000..45d9e0e9fc8 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f3.txt @@ -0,0 +1 @@ +f3 diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/f1 b/cabal-testsuite/PackageTests/SDist/T8817/pkg/f1 new file mode 100644 index 00000000000..8e1e71d5ce3 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/f1 @@ -0,0 +1 @@ +f1 diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/t8817.cabal b/cabal-testsuite/PackageTests/SDist/T8817/pkg/t8817.cabal new file mode 100644 index 00000000000..899eb191b84 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/t8817.cabal @@ -0,0 +1,11 @@ +cabal-version: 3.14 +name: t8817 +version: 0 + +extra-files: + d1/*.txt + f1 + +executable foo + default-language: Haskell2010 + main-is: Main.hs diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksC2HsRules/SetupHooks.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksC2HsRules/SetupHooks.hs index 67ac7b8ee1d..2e3bcf4a818 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksC2HsRules/SetupHooks.hs +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksC2HsRules/SetupHooks.hs @@ -1,3 +1,4 @@ +{-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE DerivingStrategies #-} @@ -15,6 +16,7 @@ import Distribution.ModuleName import Distribution.Simple.LocalBuildInfo (interpretSymbolicPathLBI) import Distribution.Simple.SetupHooks import Distribution.Simple.Utils +import Distribution.Utils.Path import Data.Foldable ( for_ ) import Data.List ( isPrefixOf ) @@ -24,7 +26,6 @@ import Data.Traversable ( for ) import GHC.Generics import qualified Data.Map as Map -import System.FilePath setupHooks :: SetupHooks setupHooks = @@ -39,12 +40,11 @@ preBuildRules :: PreBuildComponentInputs -> RulesM () preBuildRules (PreBuildComponentInputs { buildingWhat = what, localBuildInfo = lbi, targetInfo = tgt }) = mdo let verbosity = buildingWhatVerbosity what clbi = targetCLBI tgt - i = interpretSymbolicPathLBI lbi - autogenDir = i (autogenComponentModulesDir lbi clbi) - buildDir = i (componentBuildDir lbi clbi) + autogenDir = autogenComponentModulesDir lbi clbi + buildDir = componentBuildDir lbi clbi computeC2HsDepsAction (C2HsDepsInput {..}) = do - importLine : _srcLines <- lines <$> readFile (inDir toFilePath modNm <.> "myChs") + importLine : _srcLines <- lines <$> readFile (getSymbolicPath $ inDir moduleNameSymbolicPath modNm <.> "myChs") let imports :: [ModuleName] imports | "imports:" `isPrefixOf` importLine @@ -60,24 +60,24 @@ preBuildRules (PreBuildComponentInputs { buildingWhat = what, localBuildInfo = l , imports ) runC2HsAction (C2HsInput {..}) importModNms = do - let modPath = toFilePath modNm + let modPath = moduleNameSymbolicPath modNm warn verbosity $ "Running C2Hs on " ++ modName modNm ++ ".myChs.\n C2Hs dependencies: " ++ modNames importModNms - _importLine : srcLines <- lines <$> readFile (inDir modPath <.> "myChs") + _importLine : srcLines <- lines <$> readFile (getSymbolicPath $ inDir modPath <.> "myChs") - rewriteFileEx verbosity (hsDir modPath <.> "hs") $ + rewriteFileEx verbosity (getSymbolicPath $ hsDir modPath <.> "hs") $ unlines $ ("module " ++ modName modNm ++ " where\n") : (map ( ( "import " ++ ) . modName ) importModNms ++ srcLines) - rewriteFileEx verbosity (chiDir modPath <.> "myChi") "" + rewriteFileEx verbosity (getSymbolicPath $ chiDir unsafeCoerceSymbolicPath modPath <.> "myChi") "" mkRule modNm = dynamicRule (static Dict) (mkCommand (static Dict) (static computeC2HsDepsAction) $ C2HsDepsInput { ruleIds = modToRuleId, ..}) (mkCommand (static Dict) (static runC2HsAction) $ C2HsInput {hsDir = autogenDir, chiDir = buildDir, ..}) - [ FileDependency (inDir, modPath <.> "myChs") ] - ( ( autogenDir, modPath <.> "hs" ) NE.:| [ ( buildDir, modPath <.> "myChi" ) ] ) + [ FileDependency $ Location inDir (modPath <.> "myChs") ] + ( Location autogenDir (modPath <.> "hs" ) NE.:| [ Location buildDir (unsafeCoerceSymbolicPath modPath <.> "myChi") ] ) where - modPath = toFilePath modNm - inDir = "." + modPath = moduleNameSymbolicPath modNm + inDir = sameDirectory -- NB: in practice, we would get the module names by looking at the .cabal -- file and performing a search for `.chs` files on disk, but for this test @@ -94,7 +94,7 @@ preBuildRules (PreBuildComponentInputs { buildingWhat = what, localBuildInfo = l data C2HsDepsInput = C2HsDepsInput { verbosity :: Verbosity - , inDir :: FilePath + , inDir :: SymbolicPath Pkg (Dir Source) , modNm :: ModuleName , ruleIds :: Map.Map ModuleName RuleId } @@ -106,9 +106,9 @@ data C2HsInput = C2HsInput { verbosity :: Verbosity , modNm :: ModuleName - , inDir :: FilePath - , hsDir :: FilePath - , chiDir :: FilePath + , inDir :: SymbolicPath Pkg (Dir Source) + , hsDir :: SymbolicPath Pkg (Dir Source) + , chiDir :: SymbolicPath Pkg (Dir Build) } deriving stock ( Show, Generic ) deriving anyclass Binary diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksCyclicRules/SetupHooks.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksCyclicRules/SetupHooks.hs index 65067ebff97..64920431b45 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksCyclicRules/SetupHooks.hs +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksCyclicRules/SetupHooks.hs @@ -7,6 +7,7 @@ module SetupHooks where import Distribution.Simple.LocalBuildInfo (interpretSymbolicPathLBI) import Distribution.Simple.SetupHooks +import Distribution.Utils.Path (makeRelativePathEx) import qualified Data.List.NonEmpty as NE ( NonEmpty(..) ) @@ -22,19 +23,18 @@ setupHooks = cyclicPreBuildRules :: PreBuildComponentInputs -> RulesM () cyclicPreBuildRules (PreBuildComponentInputs { localBuildInfo = lbi, targetInfo = tgt }) = mdo let clbi = targetCLBI tgt - i = interpretSymbolicPathLBI lbi - autogenDir = i (autogenComponentModulesDir lbi clbi) + autogenDir = autogenComponentModulesDir lbi clbi action = mkCommand (static Dict) (static (\ () -> error "This should not run")) () r1 <- registerRule "r1" $ staticRule action [ RuleDependency $ RuleOutput r2 0 ] - ( ( autogenDir, "G1.hs" ) NE.:| [] ) + ( Location autogenDir (makeRelativePathEx "G1.hs") NE.:| [] ) r2 <- registerRule "r2" $ staticRule action [ RuleDependency $ RuleOutput r1 0 ] - ( ( autogenDir, "G2.hs" ) NE.:| [] ) + ( Location autogenDir (makeRelativePathEx "G2.hs") NE.:| [] ) r3 <- registerRule "r3" $ staticRule action [ RuleDependency $ RuleOutput r3 0 ] - ( ( autogenDir, "G3.hs" ) NE.:| [] ) + ( Location autogenDir (makeRelativePathEx "G3.hs") NE.:| [] ) return () diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksCyclicRules/setup.out b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksCyclicRules/setup.out index 5076d3b207b..0222d0aa947 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksCyclicRules/setup.out +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksCyclicRules/setup.out @@ -3,9 +3,9 @@ Configuring setup-hooks-cyclic-rules-test-0.1.0.0... # Setup build Error: [Cabal-9077] Hooks: cycles in dependency structure of rules: - Rule: [(RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (18,59)}, ruleName = "r3"})[0]] --> [setup.dist/work/dist/build/autogen/G3.hs] + Rule: [(RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (19,59)}, ruleName = "r3"})[0]] --> [setup.dist/work/dist/build/autogen G3.hs] - Rule: [(RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (18,59)}, ruleName = "r2"})[0]] --> [setup.dist/work/dist/build/autogen/G1.hs] + Rule: [(RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (19,59)}, ruleName = "r2"})[0]] --> [setup.dist/work/dist/build/autogen G1.hs] | - `- Rule: [(RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (18,59)}, ruleName = "r1"})[0]] --> [setup.dist/work/dist/build/autogen/G2.hs] + `- Rule: [(RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (19,59)}, ruleName = "r1"})[0]] --> [setup.dist/work/dist/build/autogen G2.hs] diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksDuplicateRuleId/SetupHooks.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksDuplicateRuleId/SetupHooks.hs index b7ac707e627..2387cfaba92 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksDuplicateRuleId/SetupHooks.hs +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksDuplicateRuleId/SetupHooks.hs @@ -6,6 +6,7 @@ module SetupHooks where import Distribution.Simple.SetupHooks +import Distribution.Utils.Path (sameDirectory, makeRelativePathEx) import qualified Data.List.NonEmpty as NE ( NonEmpty(..) ) @@ -21,5 +22,5 @@ setupHooks = dupRuleIdRules :: PreBuildComponentInputs -> RulesM () dupRuleIdRules _ = do let cmd = mkCommand (static Dict) (static (\ _ -> error "This should not run")) () - registerRule_ "myRule" $ staticRule cmd [] ( ( "src", "A.hs" ) NE.:| [] ) - registerRule_ "myRule" $ staticRule cmd [] ( ( "src", "B.hs" ) NE.:| [] ) + registerRule_ "myRule" $ staticRule cmd [] ( Location sameDirectory (makeRelativePathEx "A.hs") NE.:| [] ) + registerRule_ "myRule" $ staticRule cmd [] ( Location sameDirectory (makeRelativePathEx "B.hs") NE.:| [] ) diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksDuplicateRuleId/setup.out b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksDuplicateRuleId/setup.out index 2a5f2e99d6f..f46cdd89acc 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksDuplicateRuleId/setup.out +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksDuplicateRuleId/setup.out @@ -2,6 +2,6 @@ Configuring setup-hooks-duplicate-rule-id-test-0.1.0.0... # Setup build Error: [Cabal-7717] -Duplicate pre-build rule (RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (17,59)}, ruleName = "myRule"}) - - Rule: [] --> [src/A.hs] - - Rule: [] --> [src/B.hs] +Duplicate pre-build rule (RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (18,59)}, ruleName = "myRule"}) + - Rule: [] --> [. A.hs] + - Rule: [] --> [. B.hs] diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksInvalidRuleOutputIndex/SetupHooks.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksInvalidRuleOutputIndex/SetupHooks.hs index 0949aff5b89..56db5f98f13 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksInvalidRuleOutputIndex/SetupHooks.hs +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksInvalidRuleOutputIndex/SetupHooks.hs @@ -7,10 +7,10 @@ module SetupHooks where import Distribution.Simple.LocalBuildInfo (interpretSymbolicPathLBI) import Distribution.Simple.SetupHooks -import Distribution.Simple.Utils ( rewriteFileEx ) +import Distribution.Simple.Utils (rewriteFileEx) +import Distribution.Utils.Path import qualified Data.List.NonEmpty as NE ( NonEmpty(..) ) -import System.FilePath setupHooks :: SetupHooks setupHooks = @@ -24,11 +24,10 @@ setupHooks = invalidRuleOutputIndexRules :: PreBuildComponentInputs -> RulesM () invalidRuleOutputIndexRules (PreBuildComponentInputs { buildingWhat = what, localBuildInfo = lbi, targetInfo = tgt }) = do let clbi = targetCLBI tgt - i = interpretSymbolicPathLBI lbi - autogenDir = i (autogenComponentModulesDir lbi clbi) + autogenDir = autogenComponentModulesDir lbi clbi verbosity = buildingWhatVerbosity what action = mkCommand (static Dict) $ static (\ ((dir, modNm), verb) -> do - let loc = dir modNm <.> "hs" + let loc = getSymbolicPath dir modNm <.> "hs" rewriteFileEx verb loc $ "module " ++ modNm ++ " where {}" ) @@ -36,8 +35,8 @@ invalidRuleOutputIndexRules (PreBuildComponentInputs { buildingWhat = what, loca r1 <- registerRule "r1" $ staticRule (action ((autogenDir, "A"), verbosity)) - [] ( ( autogenDir, "A.hs" ) NE.:| [] ) + [] ( Location autogenDir (makeRelativePathEx "A.hs") NE.:| [] ) registerRule_ "r2" $ staticRule (action ((autogenDir, "B"), verbosity)) [ RuleDependency $ RuleOutput r1 7 ] - ( ( autogenDir, "B.hs" ) NE.:| [] ) + ( Location autogenDir (makeRelativePathEx "B.hs") NE.:| [] ) diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleDep/SetupHooks.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleDep/SetupHooks.hs index 47ff3296163..1f1adcf7ab1 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleDep/SetupHooks.hs +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleDep/SetupHooks.hs @@ -6,6 +6,7 @@ module SetupHooks where import Distribution.Simple.LocalBuildInfo (interpretSymbolicPathLBI) import Distribution.Simple.SetupHooks +import Distribution.Utils.Path (sameDirectory, makeRelativePathEx) import qualified Data.List.NonEmpty as NE ( NonEmpty(..) ) @@ -21,10 +22,9 @@ setupHooks = missingDepRules :: PreBuildComponentInputs -> RulesM () missingDepRules (PreBuildComponentInputs { localBuildInfo = lbi, targetInfo = tgt }) = do let clbi = targetCLBI tgt - i = interpretSymbolicPathLBI lbi - autogenDir = i (autogenComponentModulesDir lbi clbi) + autogenDir = autogenComponentModulesDir lbi clbi action = mkCommand (static Dict) (static (\ _ -> error "This should not run")) () registerRule_ "r" $ staticRule action - [ FileDependency ( ".", "Missing.hs" ) ] - ( ( autogenDir, "G.hs" ) NE.:| [] ) + [ FileDependency $ Location sameDirectory (makeRelativePathEx "Missing.hs") ] + ( Location autogenDir (makeRelativePathEx "G.hs") NE.:| [] ) diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleDep/setup.out b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleDep/setup.out index bfbd911994d..c95e66def0c 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleDep/setup.out +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleDep/setup.out @@ -3,4 +3,4 @@ Configuring setup-hooks-missing-rule-dep-test-0.1.0.0... # Setup build Error: [Cabal-1071] Pre-build rules: can't find source for rule dependency: - - Missing.hs + - . Missing.hs diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleRes/SetupHooks.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleRes/SetupHooks.hs index 6b5ce60dd81..4223ee4385f 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleRes/SetupHooks.hs +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleRes/SetupHooks.hs @@ -6,6 +6,7 @@ module SetupHooks where import Distribution.Simple.LocalBuildInfo (interpretSymbolicPathLBI) import Distribution.Simple.SetupHooks +import Distribution.Utils.Path (makeRelativePathEx) import qualified Data.List.NonEmpty as NE ( NonEmpty(..) ) @@ -21,10 +22,9 @@ setupHooks = missingResRules :: PreBuildComponentInputs -> RulesM () missingResRules (PreBuildComponentInputs { localBuildInfo = lbi, targetInfo = tgt }) = do let clbi = targetCLBI tgt - i = interpretSymbolicPathLBI lbi - autogenDir = i (autogenComponentModulesDir lbi clbi) + autogenDir = autogenComponentModulesDir lbi clbi action = mkCommand (static Dict) (static (\ _ -> return ())) () registerRule_ "r" $ staticRule action [ ] - ( ( autogenDir, "G.hs" ) NE.:| [] ) + ( Location autogenDir (makeRelativePathEx "G.hs") NE.:| [] ) diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleRes/setup.out b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleRes/setup.out index 5659bca63e1..1e0fd56bb6f 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleRes/setup.out +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksMissingRuleRes/setup.out @@ -3,4 +3,4 @@ Configuring setup-hooks-missing-rule-res-test-0.1.0.0... # Setup build Error: [Cabal-3498] Pre-build rule did not generate expected result: - - setup.dist/work/dist/build/autogen/G.hs + - setup.dist/work/dist/build/autogen G.hs diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/A.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/A.hs new file mode 100644 index 00000000000..90d08ce658b --- /dev/null +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/A.hs @@ -0,0 +1,2 @@ +{-# LANGUAGE NoImplicitPrelude #-} +module A where {} diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/SetupHooks.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/SetupHooks.hs new file mode 100644 index 00000000000..5d843bb9fbe --- /dev/null +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/SetupHooks.hs @@ -0,0 +1,8 @@ +{-# LANGUAGE NoImplicitPrelude #-} + +module SetupHooks ( setupHooks ) where + +import Distribution.Simple.SetupHooks ( SetupHooks, noSetupHooks ) + +setupHooks :: SetupHooks +setupHooks = noSetupHooks diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/cabal.project b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/cabal.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/cabal.test.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/cabal.test.hs new file mode 100644 index 00000000000..83a13355cd6 --- /dev/null +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/cabal.test.hs @@ -0,0 +1,14 @@ +import Test.Cabal.Prelude + +-- Test that we can compile the Setup.hs script for a package with +-- build-type:Hooks without requiring a dependency on 'base'. +-- +-- NB: we specifically don't include a 'Setup.hs' file in this package, +-- as we rely on 'cabal-install' generating one that does not incur an extra +-- dependency on base. +main = cabalTest $ do + mpkgdb <- testPackageDbPath <$> getTestEnv + case mpkgdb of + Nothing -> skip "Cabal-hooks library unavailable." + Just _pkgdb -> recordMode DoNotRecord $ do + cabal "v2-build" [ "all" ] diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/setup-hooks-no-base-test.cabal b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/setup-hooks-no-base-test.cabal new file mode 100644 index 00000000000..a75c76d07ff --- /dev/null +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksNoBase/setup-hooks-no-base-test.cabal @@ -0,0 +1,16 @@ +cabal-version: 3.14 +name: setup-hooks-no-base-test +version: 0.1.0.0 +synopsis: Test that we can build Setup.hs without base +license: BSD-3-Clause +author: NA +maintainer: NA +category: Testing +build-type: Hooks + +custom-setup + setup-depends: Cabal-hooks + +library + exposed-modules: A + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksRuleOrdering/SetupHooks.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksRuleOrdering/SetupHooks.hs index a301e71cff0..e15c3ae2ead 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksRuleOrdering/SetupHooks.hs +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksRuleOrdering/SetupHooks.hs @@ -9,14 +9,12 @@ module SetupHooks where import Distribution.Simple.LocalBuildInfo (interpretSymbolicPathLBI) import Distribution.Simple.SetupHooks import Distribution.Simple.Utils ( rewriteFileEx, warn ) +import Distribution.Utils.Path import Data.Foldable ( for_ ) import qualified Data.List.NonEmpty as NE ( NonEmpty(..) ) import Data.Traversable ( for ) -import System.FilePath - ( (<.>), () ) - setupHooks :: SetupHooks setupHooks = noSetupHooks @@ -37,25 +35,28 @@ preBuildRules :: PreBuildComponentInputs -> RulesM () preBuildRules (PreBuildComponentInputs { buildingWhat = what, localBuildInfo = lbi, targetInfo = tgt }) = mdo let verbosity = buildingWhatVerbosity what clbi = targetCLBI tgt - i = interpretSymbolicPathLBI lbi - autogenDir = i (autogenComponentModulesDir lbi clbi) + autogenDir = autogenComponentModulesDir lbi clbi mkAction = mkCommand (static Dict) $ static (\ (dir, verb, (inMod, outMod)) -> do warn verb $ "Running rule: " ++ inMod ++ " --> " ++ outMod - let loc = dir outMod <.> "hs" + let loc = getSymbolicPath dir outMod <.> "hs" rewriteFileEx verb loc $ "module " ++ outMod ++ " where { import " ++ inMod ++ " }" ) - actionArg inMod outMod = (autogenDir, verbosity, (inMod, outMod)) + actionArg inMod outMod = + (autogenDir, verbosity, (inMod, outMod)) mkRule action input outMod = staticRule action [ input ] - ( ( autogenDir, outMod <.> "hs" ) NE.:| [] ) - - r1 <- registerRule "r1" $ mkRule (mkAction (actionArg "B" "C")) (RuleDependency $ RuleOutput r2 0) "C" -- B --> C - r2 <- registerRule "r2" $ mkRule (mkAction (actionArg "A" "B")) (FileDependency (".", "A.hs")) "B" -- A --> B - r3 <- registerRule "r3" $ mkRule (mkAction (actionArg "C" "D")) (RuleDependency $ RuleOutput r1 0) "D" -- C --> D + ( Location autogenDir (makeRelativePathEx outMod <.> "hs") NE.:| [] ) + + -- B --> C + -- A --> B + -- C --> D + r1 <- registerRule "r1" $ mkRule (mkAction (actionArg "B" "C")) (RuleDependency $ RuleOutput r2 0) "C" + r2 <- registerRule "r2" $ mkRule (mkAction (actionArg "A" "B")) (FileDependency $ Location sameDirectory (makeRelativePathEx "A.hs")) "B" + r3 <- registerRule "r3" $ mkRule (mkAction (actionArg "C" "D")) (RuleDependency $ RuleOutput r1 0) "D" return () diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksUnusedRules/SetupHooks.hs b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksUnusedRules/SetupHooks.hs index e1d2141aa61..bae5ace431d 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksUnusedRules/SetupHooks.hs +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksUnusedRules/SetupHooks.hs @@ -7,6 +7,7 @@ module SetupHooks where import Distribution.Simple.LocalBuildInfo (interpretSymbolicPathLBI) import Distribution.Simple.SetupHooks +import Distribution.Utils.Path (makeRelativePathEx) import qualified Data.List.NonEmpty as NE ( NonEmpty(..) ) @@ -22,12 +23,11 @@ setupHooks = unusedPreBuildRules :: PreBuildComponentInputs -> RulesM () unusedPreBuildRules (PreBuildComponentInputs { localBuildInfo = lbi, targetInfo = tgt }) = do let clbi = targetCLBI tgt - i = interpretSymbolicPathLBI lbi - autogenDir = i (autogenComponentModulesDir lbi clbi) + autogenDir = autogenComponentModulesDir lbi clbi action = mkCommand (static Dict) (static (\ _ -> error "This should not run")) () registerRule_ "r1" $ staticRule action [] - ( ( autogenDir, "X.hs" ) NE.:| [ ( autogenDir, "Y.hs" ) ] ) + ( Location autogenDir (makeRelativePathEx "X.hs") NE.:| [ Location autogenDir (makeRelativePathEx "Y.hs") ] ) registerRule_ "r2" $ staticRule action [] - ( ( autogenDir, "Z.what" ) NE.:| [] ) + ( Location autogenDir (makeRelativePathEx "Z.hs") NE.:| [] ) diff --git a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksUnusedRules/setup.out b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksUnusedRules/setup.out index b5b0f048ce6..47872b4f83d 100644 --- a/cabal-testsuite/PackageTests/SetupHooks/SetupHooksUnusedRules/setup.out +++ b/cabal-testsuite/PackageTests/SetupHooks/SetupHooksUnusedRules/setup.out @@ -2,12 +2,15 @@ Configuring setup-hooks-unused-rules-test-0.1.0.0... # Setup build Warning: The following rules are not demanded and will not be run: - - RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (18,59)}, ruleName = "r1"}, generating [setup.dist/work/dist/build/autogen/X.hs, setup.dist/work/dist/build/autogen/Y.hs] - - RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (18,59)}, ruleName = "r2"}, generating [setup.dist/work/dist/build/autogen/Z.what] + - RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (19,59)}, ruleName = "r1"}, + generating [setup.dist/work/dist/build/autogen X.hs,setup.dist/work/dist/build/autogen Y.hs] + - RuleId {ruleNameSpace = RulesNameSpace {rulesUnitId = UnitId "main", rulesModuleName = ModuleName "SetupHooks", rulesSrcLoc = (19,59)}, ruleName = "r2"}, + generating [setup.dist/work/dist/build/autogen Z.hs] Possible reasons for this error: - Some autogenerated modules were not declared (in the package description or in the pre-configure hooks) - The output location for an autogenerated module is incorrect, - (e.g. it is not in the appropriate 'autogenComponentModules' directory) + (e.g. the file extension is incorrect, or + it is not in the appropriate 'autogenComponentModules' directory) Preprocessing library for setup-hooks-unused-rules-test-0.1.0.0... Building library for setup-hooks-unused-rules-test-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-all.out b/cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-all.out index e37e3fccc4d..638ea9ced39 100644 --- a/cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-all.out +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-all.out @@ -1,4 +1,6 @@ # cabal build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-exe.out b/cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-exe.out index 7c69357323d..036c131915c 100644 --- a/cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-exe.out +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/A/build-info-exe.out @@ -1,4 +1,6 @@ # cabal build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/A/remove-outdated.out b/cabal-testsuite/PackageTests/ShowBuildInfo/A/remove-outdated.out index 3ad97d2f378..0b788f6c53e 100644 --- a/cabal-testsuite/PackageTests/ShowBuildInfo/A/remove-outdated.out +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/A/remove-outdated.out @@ -1,4 +1,6 @@ # cabal build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -7,6 +9,8 @@ Configuring executable 'A' for A-0.1.0.0... Preprocessing executable 'A' for A-0.1.0.0... Building executable 'A' for A-0.1.0.0... # cabal v2-build +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - A-0.1.0.0 (exe:A) (configuration changed) diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/CompileFail/compile-fail.out b/cabal-testsuite/PackageTests/ShowBuildInfo/CompileFail/compile-fail.out index b0cae576cd6..a2ecb2be87d 100644 --- a/cabal-testsuite/PackageTests/ShowBuildInfo/CompileFail/compile-fail.out +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/CompileFail/compile-fail.out @@ -1,4 +1,6 @@ # cabal build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -13,6 +15,8 @@ Building test suite 'CompileFail-test' for CompileFail-0.1.0.0... Error: [Cabal-7125] Failed to build CompileFail-0.1.0.0-inplace-CompileFail-test. # cabal build +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - CompileFail-0.1.0.0 (lib:failing) (first run) diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out index 98ffd99b300..f46f8948e28 100644 --- a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal build +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: @@ -15,12 +17,16 @@ Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a director Preprocessing executable 'Complex' for Complex-0.1.0.0... Building executable 'Complex' for Complex-0.1.0.0... # show-build-info Complex exe:Complex -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"exe","name":"exe:Complex","unit-id":"Complex-0.1.0.0-inplace-Complex","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-Complex","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/./dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N -T","-Wredundant-constraints"],"modules":["Other","Paths_Complex"],"src-files":["Main.lhs"],"hs-src-dirs":["app"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"exe","name":"exe:Complex","unit-id":"Complex-0.1.0.0-inplace-Complex","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-Complex","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N -T","-Wredundant-constraints"],"modules":["Other","Paths_Complex"],"src-files":["Main.lhs"],"hs-src-dirs":["app"],"src-dir":"/","cabal-file":"Complex.cabal"}]} # cabal build +Configuration is affected by the following files: +- cabal.project Up to date # show-build-info Complex lib -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"lib","name":"lib","unit-id":"Complex-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/./dist/packagedb/ghc-","-package-id","","-XHaskell2010","-Wall"],"modules":["A","B","C","D","Paths_Complex"],"src-files":[],"hs-src-dirs":["src","doesnt-exist"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"lib","name":"lib","unit-id":"Complex-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-XHaskell2010","-Wall"],"modules":["A","B","C","D","Paths_Complex"],"src-files":[],"hs-src-dirs":["src","doesnt-exist"],"src-dir":"/","cabal-file":"Complex.cabal"}]} # cabal build +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - criterion-1.1.4.0 (lib) (requires build) @@ -34,8 +40,10 @@ Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a director Preprocessing benchmark 'complex-benchmarks' for Complex-0.1.0.0... Building benchmark 'complex-benchmarks' for Complex-0.1.0.0... # show-build-info Complex bench:complex-benchmarks -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"bench","name":"bench:complex-benchmarks","unit-id":"Complex-0.1.0.0-inplace-complex-benchmarks","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-complex-benchmarks","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/./dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010","-Wall","-rtsopts","-threaded","-with-rtsopts=-N"],"modules":["Paths_Complex"],"src-files":["Main.hs"],"hs-src-dirs":["benchmark"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"bench","name":"bench:complex-benchmarks","unit-id":"Complex-0.1.0.0-inplace-complex-benchmarks","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-complex-benchmarks","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010","-Wall","-rtsopts","-threaded","-with-rtsopts=-N"],"modules":["Paths_Complex"],"src-files":["Main.hs"],"hs-src-dirs":["benchmark"],"src-dir":"/","cabal-file":"Complex.cabal"}]} # cabal build +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - test-framework-0.8.1.1 (lib) (requires build) @@ -49,8 +57,10 @@ Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a director Preprocessing test suite 'func-test' for Complex-0.1.0.0... Building test suite 'func-test' for Complex-0.1.0.0... # show-build-info Complex test:func-test -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:func-test","unit-id":"Complex-0.1.0.0-inplace-func-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-func-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/./dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["FuncMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:func-test","unit-id":"Complex-0.1.0.0-inplace-func-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-func-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["FuncMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} # cabal build +Configuration is affected by the following files: +- cabal.project Build profile: -w ghc- -O1 In order, the following will be built: - another-framework-0.8.1.1 (lib) (requires build) @@ -64,4 +74,4 @@ Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a director Preprocessing test suite 'unit-test' for Complex-0.1.0.0... Building test suite 'unit-test' for Complex-0.1.0.0... # show-build-info Complex test:unit-test -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:unit-test","unit-id":"Complex-0.1.0.0-inplace-unit-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-unit-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/./dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["UnitMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:unit-test","unit-id":"Complex-0.1.0.0-inplace-unit-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-unit-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["UnitMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} diff --git a/cabal-testsuite/PackageTests/TestCodeGenerator/cabal.out b/cabal-testsuite/PackageTests/TestCodeGenerator/cabal.out index b6691231474..31af40384d3 100644 --- a/cabal-testsuite/PackageTests/TestCodeGenerator/cabal.out +++ b/cabal-testsuite/PackageTests/TestCodeGenerator/cabal.out @@ -1,4 +1,6 @@ # cabal v2-test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/TestNameCollision/setup.cabal.out b/cabal-testsuite/PackageTests/TestNameCollision/setup.cabal.out index a86a3788e72..9e42bccb4fb 100644 --- a/cabal-testsuite/PackageTests/TestNameCollision/setup.cabal.out +++ b/cabal-testsuite/PackageTests/TestNameCollision/setup.cabal.out @@ -18,5 +18,5 @@ Building test suite 'parent' for child-0.1... Running 1 test suites... Test suite parent: RUNNING... Test suite parent: PASS -Test suite logged to: ../setup.cabal.dist/work/child/dist/test/child-0.1-parent.log +Test suite logged to: ./child/../setup.cabal.dist/work/child/dist/test/child-0.1-parent.log 1 of 1 test suites (1 of 1 test cases) passed. diff --git a/cabal-testsuite/PackageTests/TestNameCollision/setup.out b/cabal-testsuite/PackageTests/TestNameCollision/setup.out index c76a83141c1..70dfb63e581 100644 --- a/cabal-testsuite/PackageTests/TestNameCollision/setup.out +++ b/cabal-testsuite/PackageTests/TestNameCollision/setup.out @@ -18,5 +18,5 @@ Building test suite 'parent' for child-0.1... Running 1 test suites... Test suite parent: RUNNING... Test suite parent: PASS -Test suite logged to: ../setup.dist/work/child/dist/test/child-0.1-parent.log +Test suite logged to: ./child/../setup.dist/work/child/dist/test/child-0.1-parent.log 1 of 1 test suites (1 of 1 test cases) passed. diff --git a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs index 14f12247548..172b48d8c80 100644 --- a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs +++ b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal-with-hpc.multitest.hs @@ -8,10 +8,9 @@ import qualified Distribution.Verbosity as Verbosity import Test.Cabal.Prelude -main = cabalTest $ do - skipIf "osx" =<< isOSX -- TODO: re-enable this once the macOS CI - -- issues are resolved, see discussion in #4902. - +main = do + skipIfCIAndOSX 4902 + cabalTest $ do hasShared <- hasSharedLibraries hasProfiled <- hasProfiledLibraries hpcOk <- correctHpcVersion diff --git a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal.out b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal.out index 8fb3ea6d6d3..c7dac223635 100644 --- a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal.out +++ b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/cabal.out @@ -1,4 +1,6 @@ # cabal v2-test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/coverage.out b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/coverage.out index 872dbd57eaf..0d98e24beaa 100644 --- a/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/coverage.out +++ b/cabal-testsuite/PackageTests/TestSuiteTests/ExeV10/coverage.out @@ -1,4 +1,6 @@ # cabal v2-test +Configuration is affected by the following files: +- cabal.project Resolving dependencies... Build profile: -w ghc- -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/VersionPriority/0-local.out b/cabal-testsuite/PackageTests/VersionPriority/0-local.out index f57e8b4db97..176876e269f 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/0-local.out +++ b/cabal-testsuite/PackageTests/VersionPriority/0-local.out @@ -1,6 +1,8 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- 0-local.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-local.out b/cabal-testsuite/PackageTests/VersionPriority/1-local.out index 0de3c6d5f1f..acca1619534 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/1-local.out +++ b/cabal-testsuite/PackageTests/VersionPriority/1-local.out @@ -1,6 +1,10 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- 1-local-constraints-import.project +- stackage-local.config + imported by: 1-local-constraints-import.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: @@ -14,6 +18,10 @@ Could not resolve dependencies: [__1] fail (backjumping, conflict set: cabal-version-override, hashable) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) # cabal v2-build +Configuration is affected by the following files: +- 1-local-import-constraints.project +- stackage-local.config + imported by: 1-local-import-constraints.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-web.out b/cabal-testsuite/PackageTests/VersionPriority/1-web.out index cfdaa0d2dbc..f7ca5a23be8 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/1-web.out +++ b/cabal-testsuite/PackageTests/VersionPriority/1-web.out @@ -1,6 +1,12 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- 1-web-constraints-import.project +- project-stackage/nightly-2023-12-07.config + imported by: 1-web-constraints-import.project +- with-ghc.config + imported by: 1-web-constraints-import.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: @@ -14,6 +20,12 @@ Could not resolve dependencies: [__1] fail (backjumping, conflict set: cabal-version-override, hashable) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) # cabal v2-build +Configuration is affected by the following files: +- 1-web-import-constraints.project +- project-stackage/nightly-2023-12-07.config + imported by: 1-web-import-constraints.project +- with-ghc.config + imported by: 1-web-import-constraints.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-local.out b/cabal-testsuite/PackageTests/VersionPriority/2-local.out index ccb733ca12e..bf3ae4cb27c 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/2-local.out +++ b/cabal-testsuite/PackageTests/VersionPriority/2-local.out @@ -1,6 +1,13 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- 2-local-constraints-import.project +- hop-local.config + imported by: 2-local-constraints-import.project +- stackage-local.config + imported by: hop-local.config + imported by: 2-local-constraints-import.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: @@ -15,6 +22,13 @@ Could not resolve dependencies: [__1] fail (backjumping, conflict set: cabal-version-override, hashable) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) # cabal v2-build +Configuration is affected by the following files: +- 2-local-import-constraints.project +- hop-local.config + imported by: 2-local-import-constraints.project +- stackage-local.config + imported by: hop-local.config + imported by: 2-local-import-constraints.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-web.out b/cabal-testsuite/PackageTests/VersionPriority/2-web.out index 15e5c01517b..17bc5a01962 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/2-web.out +++ b/cabal-testsuite/PackageTests/VersionPriority/2-web.out @@ -1,6 +1,15 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- 2-web-constraints-import.project +- project-stackage/nightly-2023-12-07.config + imported by: stackage-web.config + imported by: 2-web-constraints-import.project +- stackage-web.config + imported by: 2-web-constraints-import.project +- with-ghc.config + imported by: 2-web-constraints-import.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: @@ -15,6 +24,15 @@ Could not resolve dependencies: [__1] fail (backjumping, conflict set: cabal-version-override, hashable) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) # cabal v2-build +Configuration is affected by the following files: +- 2-web-import-constraints.project +- project-stackage/nightly-2023-12-07.config + imported by: stackage-web.config + imported by: 2-web-import-constraints.project +- stackage-web.config + imported by: 2-web-import-constraints.project +- with-ghc.config + imported by: 2-web-import-constraints.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/VersionPriority/3-web.out b/cabal-testsuite/PackageTests/VersionPriority/3-web.out index 9321613639e..d9eee435ab1 100644 --- a/cabal-testsuite/PackageTests/VersionPriority/3-web.out +++ b/cabal-testsuite/PackageTests/VersionPriority/3-web.out @@ -1,6 +1,19 @@ # cabal v2-update Downloading the latest package list from test-local-repo # cabal v2-build +Configuration is affected by the following files: +- 3-web-constraints-import.project +- hop-web.config + imported by: 3-web-constraints-import.project +- project-stackage/nightly-2023-12-07.config + imported by: stackage-web.config + imported by: hop-web.config + imported by: 3-web-constraints-import.project +- stackage-web.config + imported by: hop-web.config + imported by: 3-web-constraints-import.project +- with-ghc.config + imported by: 3-web-constraints-import.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: @@ -16,6 +29,19 @@ Could not resolve dependencies: [__1] fail (backjumping, conflict set: cabal-version-override, hashable) After searching the rest of the dependency tree exhaustively, these were the goals I've had most trouble fulfilling: hashable (3), cabal-version-override (2) # cabal v2-build +Configuration is affected by the following files: +- 3-web-import-constraints.project +- hop-web.config + imported by: 3-web-import-constraints.project +- project-stackage/nightly-2023-12-07.config + imported by: stackage-web.config + imported by: hop-web.config + imported by: 3-web-import-constraints.project +- stackage-web.config + imported by: hop-web.config + imported by: 3-web-import-constraints.project +- with-ghc.config + imported by: 3-web-import-constraints.project Resolving dependencies... Error: [Cabal-7107] Could not resolve dependencies: diff --git a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-copy.test.hs b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-copy.test.hs index 710878ce1f0..353caa5b5c8 100644 --- a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-copy.test.hs +++ b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-copy.test.hs @@ -1,14 +1,6 @@ import Test.Cabal.Prelude -main = cabalTest $ withShorterPathForNewBuildStore $ do +main = cabalTest $ expectBrokenIfWindows 10180 $ withShorterPathForNewBuildStore $ do storeDir <- testStoreDir <$> getTestEnv let options = ["--installdir=" ++ storeDir] - -- Use install method copy that should surely work on Windows too but our - -- path normalization for testing is not good enough yet as can be seen in - -- this CI failure snippet diff: - -- -Warning: The directory /ghc-/incoming/new-/ghc-/-/bin is not in the system search path. - -- -Copying 'warn-early-overwrite' to '/warn-early-overwrite' - -- +Warning: The directory /incoming/new-2448/Users/RUNNER~1/AppData/Local/Temp/cabal-test-store-28260/ghc-/WarnEarlyOver_-0.1.0.0-4c19059e06a32b93b2812983631117e77a2d3833/bin is not in the system search path. - -- +Copying 'warn-early-overwrite' to '' - skipIfWindows cabalG options "v2-install" ["--install-method=copy"] diff --git a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-symlink.test.hs b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-symlink.test.hs index f4e6556b167..62f9305d4ee 100644 --- a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-symlink.test.hs +++ b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/clean-install-by-symlink.test.hs @@ -1,8 +1,6 @@ import Test.Cabal.Prelude -main = cabalTest $ withShorterPathForNewBuildStore $ do +main = cabalTest $ expectBrokenIfWindows 10180 $ withShorterPathForNewBuildStore $ do storeDir <- testStoreDir <$> getTestEnv - -- The default install method is symlink that may not work on Windows. - skipIfWindows let options = ["--installdir=" ++ storeDir] cabalG options "v2-install" [] diff --git a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.test.hs b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.test.hs index 8d2ae8e6cc5..17008de3f7c 100644 --- a/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.test.hs +++ b/cabal-testsuite/PackageTests/WarnEarlyOverwrite/dirty-install.test.hs @@ -2,14 +2,11 @@ import Test.Cabal.Prelude import System.FilePath -main = cabalTest $ withShorterPathForNewBuildStore $ do - +main = cabalTest $ expectBrokenIfWindows 10180 $ withShorterPathForNewBuildStore $ do storeDir <- testStoreDir <$> getTestEnv - -- Windows does not natively include a touch command. - -- SEE: https://stackoverflow.com/questions/30011267/create-an-empty-file-on-the-commandline-in-windows-like-the-linux-touch-command - skipIfWindows let options = ["--installdir=" ++ storeDir] -- Touch the target to see if the warning is made early before the build. - _ <- runM "touch" [storeDir "warn-early-overwrite"] Nothing + _ <- runM "touch" [ (if isWindows then (<.> "exe") else id) + $ storeDir "warn-early-overwrite" ] Nothing fails $ cabalG options "v2-install" [] cabalG options "v2-install" ["--overwrite-policy=always"] diff --git a/cabal-testsuite/PackageTests/WorkingDirRel/WD_NO_MENTION/CHANGELOG.md b/cabal-testsuite/PackageTests/WorkingDirRel/WD_NO_MENTION/CHANGELOG.md new file mode 100644 index 00000000000..2959e9a055b --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDirRel/WD_NO_MENTION/CHANGELOG.md @@ -0,0 +1,5 @@ +# Revision history for n + +## 0.1.0.0 -- YYYY-mm-dd + +* First version. Released on an unsuspecting world. diff --git a/cabal-testsuite/PackageTests/WorkingDirRel/WD_NO_MENTION/app/Main.hsc b/cabal-testsuite/PackageTests/WorkingDirRel/WD_NO_MENTION/app/Main.hsc new file mode 100644 index 00000000000..918e213f57b --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDirRel/WD_NO_MENTION/app/Main.hsc @@ -0,0 +1,3 @@ +module Main where + +main = print () diff --git a/cabal-testsuite/PackageTests/WorkingDirRel/WD_NO_MENTION/n.cabal b/cabal-testsuite/PackageTests/WorkingDirRel/WD_NO_MENTION/n.cabal new file mode 100644 index 00000000000..83acab380b3 --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDirRel/WD_NO_MENTION/n.cabal @@ -0,0 +1,19 @@ +cabal-version: 3.0 +name: n +version: 0.1.0.0 +license: NONE +author: Matthew Pickering +maintainer: matthewtpickering@gmail.com +build-type: Simple +extra-doc-files: CHANGELOG.md + +common warnings + ghc-options: -Wall + +executable n + import: warnings + main-is: Main.hs + build-depends: base + hs-source-dirs: app + build-tool-depends: hsc2hs:hsc2hs + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/WorkingDirRel/setup.test.hs b/cabal-testsuite/PackageTests/WorkingDirRel/setup.test.hs new file mode 100644 index 00000000000..01fbfb9795c --- /dev/null +++ b/cabal-testsuite/PackageTests/WorkingDirRel/setup.test.hs @@ -0,0 +1,4 @@ +import Test.Cabal.Prelude + +main = setupTest $ recordMode DoNotRecord $ do + withDirectory "WD_NO_MENTION" $ setup_build [] diff --git a/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.out b/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.out index 8165f4408ff..a304511e1ef 100644 --- a/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.out +++ b/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.out @@ -1,2 +1,11 @@ # cabal v2-build +Configuration is affected by the following files: +- cabal.positive.project +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - example-1.0 (lib) (first run) +Configuring library for example-1.0... +Preprocessing library for example-1.0... +Building library for example-1.0... # cabal v2-build diff --git a/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.test.hs b/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.test.hs index d4747aceb92..d96d7676501 100644 --- a/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.test.hs +++ b/cabal-testsuite/PackageTests/postCheckoutCommand/cabal.test.hs @@ -1,8 +1,7 @@ import Test.Cabal.Prelude main = cabalTest $ do - skipIfWindows withProjectFile "cabal.positive.project" $ do - cabal "v2-build" ["-v0"] + cabal "v2-build" [] withProjectFile "cabal.negative.project" $ do - fails $ cabal "v2-build" ["-v0"] + fails $ cabal "v2-build" [] diff --git a/cabal-testsuite/README.md b/cabal-testsuite/README.md index 79b9185fecb..fb641cad995 100644 --- a/cabal-testsuite/README.md +++ b/cabal-testsuite/README.md @@ -1,18 +1,21 @@ cabal-testsuite is a suite of integration tests for Cabal-based frameworks. -How to run ----------- +# How to run 1. Build `cabal-testsuite` (`cabal build cabal-testsuite:cabal-tests`) 2. Run the `cabal-tests` executable. It will scan for all tests in your current directory and subdirectories and run them. - To run a specific set of tests, use `cabal-tests --with-cabal=CABALBIN PATH ...`. - (e.g. `cabal run cabal-testsuite:cabal-tests -- --with-cabal=cabal cabal-testsuite/PackageTests/TestOptions/setup.test.hs`) - You can control parallelism using the `-j` flag. There are a few useful flags: +* To run a specific set of tests, pass the path to a `.test.hs` file to run or + use the `-p`/`--pattern` flag to filter tests. + + See the ["Selecting tests"](#selecting-tests) section below for more details. + +* `-j INT` controls the number of threads used for running tests. + * `--with-cabal PATH` can be used to specify the path of a `cabal-install` executable. IF YOU DO NOT SPECIFY THIS FLAG, CABAL INSTALL TESTS WILL NOT RUN. @@ -28,6 +31,28 @@ There are a few useful flags: * `--keep-tmp-files` can be used to keep the temporary directories that tests are run in. +## Selecting tests + +To run a specific set of tests, use `cabal-tests --with-cabal=CABALBIN PATH ...`, e.g.: + +``` +cabal run cabal-testsuite:cabal-tests -- \ + --with-cabal=cabal \ + cabal-testsuite/PackageTests/TestOptions/setup.test.hs +``` + +Alternatively, use `-p`/`--pattern` to select tests dynamically: + +``` +cabal run cabal-testsuite:cabal-tests -- \ + --with-cabal=cabal \ + --pattern "/TestOptions/" +``` + +See [the documentation for Tasty pattern +syntax](https://hackage.haskell.org/package/tasty#patterns) for more +information. + ## Which Cabal library version do cabal-install tests use? By default the `cabal-install` tests will use the `Cabal` library which comes with @@ -74,8 +99,7 @@ components have broken doctests our CI currently checks that `Cabal-syntax` and `Cabal` doctests pass via `make doctest-install && make doctest` (you can use this `make`-based workflow too). -How to write ------------- +# How to write If you learn better by example, just look at the tests that live in `cabal-testsuite/PackageTests`; if you `git log -p`, you can @@ -155,8 +179,7 @@ allow multiple tests to be defined in one file but run in parallel; at the moment, these just indicate long running tests that should be run early (to avoid straggling). -Frequently asked questions --------------------------- +# Frequently asked questions For all of these answers, to see examples of the functions in question, grep the test suite. @@ -195,24 +218,39 @@ variants of a command (e.g., `cabal'` rather than `cabal`) and use `assertOutputContains`. Note that this will search over BOTH stdout and stderr. +For convenience, paste expected multiline string values verbatim into a text +file and read these with `readFileVerbatim`. The suggested extension for these +files are `.expect.txt`. + **How do I skip running a test in some environments?** Use the `skipIf` and `skipUnless` combinators. Useful parameters to test these with include `hasSharedLibraries`, `hasProfiledLibraries`, `hasCabalShared`, `isGhcVersion`, `isWindows`, `isLinux`, `isOSX`. +There are some pre-defined versions of those combinators like `skipIfWindows` +or `skipIfCI`. If possible try to use those as the error message will be uniform +with other tests, allowing for `grep`ing the output more easily. + +Make sure that you only skip tests which cannot be run by fundamental reasons, +like the OS or the capabilities of the GHC version. If a test is failing do not +skip it, mark it as broken instead (see next question). + +**How do I mark a test as broken?** Use `expectBroken`, which takes +the ticket number as its first argument. + +**How do I mark a flaky test?** If a test passes only sometimes for unknown +reasons, it is better to mark it as flaky with the `flaky` and `flakyIf` +combinators. They both take a ticket number so the flaky tests has to be tracked +in an issue. Flaky tests are executed, and the outcome is reported by the +test-suite but even if they fail they won't make the test-suite fail. + **I programmatically modified a file in my test suite, but Cabal/GHC doesn't seem to be picking it up.** You need to sleep sufficiently long before editing a file, in order for file system timestamp resolution to pick it up. Use `withDelay` and `delay` prior to making a modification. -**How do I mark a test as broken?** Use `expectBroken`, which takes -the ticket number as its first argument. Note that this does NOT -handle accept-test brokenness, so you will have to add a manual -string output test, if that is how your test is "failing." - -Hermetic tests --------------- +# Hermetic tests Tests are run in a fresh temporary system directory. This attempts to isolate the tests from anything specific to do with your directory structure. In particular @@ -223,8 +261,7 @@ tests from anything specific to do with your directory structure. In particular * You must `git add` all files which are relevant to the test, otherwise they will not be copied. -Design notes ------------- +# Design notes This is the second rewrite of the integration testing framework. The primary goal was to use Haskell as the test language (letting us take @@ -284,8 +321,7 @@ figure out how to get out the threading setting, and then spawn that many GHCi servers to service the running threads. Improvements welcome. -Expect tests ------------- +# Expect tests An expect test (aka _golden test_) is a test where we read out the output of the test @@ -354,8 +390,7 @@ Some other notes: on the output for the string you're looking for. Try to be deterministic, but sometimes it's not (easily) possible. -Non-goals ---------- +# Non-goals Here are some things we do not currently plan on supporting: diff --git a/cabal-testsuite/Setup.hs b/cabal-testsuite/Setup.hs index ca4ab043b04..3a4a335b86e 100644 --- a/cabal-testsuite/Setup.hs +++ b/cabal-testsuite/Setup.hs @@ -30,7 +30,10 @@ generateScriptEnvModule lbi verbosity = do createDirectoryIfMissing True moduledir rewriteFileEx verbosity (moduledir "ScriptEnv0.hs") $ unlines - [ "module Test.Cabal.ScriptEnv0 where" + [ "{-# LANGUAGE OverloadedStrings #-}" + , "{-# LANGUAGE FlexibleInstances #-}" + , "{-# OPTIONS_GHC -Wno-orphans #-}" + , "module Test.Cabal.ScriptEnv0 where" , "" , "import Distribution.Simple" , "import Distribution.System (Platform(..), Arch(..), OS(..))" @@ -38,8 +41,10 @@ generateScriptEnvModule lbi verbosity = do , "import Distribution.Simple.Program.Db" , "import Distribution.Backpack (OpenUnitId)" , "import Data.Map (fromList)" + , "import Data.String (IsString(..))" + , "import Distribution.Utils.Path" , "" - , "lbiPackageDbStack :: PackageDBStack" + , "lbiPackageDbStack :: PackageDBStackCWD" , "lbiPackageDbStack = " ++ show lbiPackageDbStack , "" , "lbiPlatform :: Platform" @@ -56,6 +61,9 @@ generateScriptEnvModule lbi verbosity = do , "" , "lbiWithSharedLib :: Bool" , "lbiWithSharedLib = " ++ show (withSharedLib lbi) + , "" + , "instance IsString (SymbolicPath from to) where" + , " fromString = makeSymbolicPath" ] where moduledir = libAutogenDir "Test" "Cabal" diff --git a/cabal-testsuite/cabal-testsuite.cabal b/cabal-testsuite/cabal-testsuite.cabal index 1a6ed19967c..4e31b87d254 100644 --- a/cabal-testsuite/cabal-testsuite.cabal +++ b/cabal-testsuite/cabal-testsuite.cabal @@ -26,9 +26,9 @@ common shared default-language: Haskell2010 build-depends: - , base >= 4.11 && < 4.20 + , base >= 4.11 && < 4.22 -- this needs to match the in-tree lib:Cabal version - , Cabal ^>= 3.13.0.0 + , Cabal ^>= 3.15.0.0 ghc-options: -Wall @@ -45,6 +45,7 @@ library Test.Cabal.CheckArMetadata Test.Cabal.DecodeShowBuildInfo Test.Cabal.Monad + Test.Cabal.NeedleHaystack Test.Cabal.OutputNormalizer Test.Cabal.Plan Test.Cabal.Prelude @@ -70,6 +71,8 @@ library , directory ^>= 1.2.0.1 || ^>= 1.3.0.0 , exceptions ^>= 0.10.0 , filepath ^>= 1.3.0.1 || ^>= 1.4.0.0 || ^>= 1.5.0.0 + , Glob ^>= 0.10.2 + , network-uri >= 2.6.0.2 && < 2.7 , network-wait ^>= 0.1.2.0 || ^>= 0.2.0.0 , optparse-applicative ^>= 0.14.3.0 || ^>=0.15.1.0 || ^>=0.16.0.0 || ^>= 0.17.0.0 || ^>= 0.18.1.0 , process ^>= 1.2.1.0 || ^>= 1.4.2.0 || ^>= 1.6.1.0 @@ -91,7 +94,7 @@ executable cabal-tests import: shared main-is: cabal-tests.hs hs-source-dirs: main - ghc-options: -threaded + ghc-options: -threaded -rtsopts -- Make sure these are built before the executable is run build-tool-depends: cabal-testsuite:test-runtime-deps build-depends: @@ -104,6 +107,8 @@ executable cabal-tests -- dependencies specific to exe:cabal-tests , clock ^>= 0.7.2 || ^>=0.8 , directory + , tasty + , containers build-tool-depends: cabal-testsuite:setup default-extensions: TypeOperators @@ -145,9 +150,8 @@ executable test-runtime-deps custom-setup -- we only depend on even stable releases of lib:Cabal - -- and due to Custom complexity and ConstraintSetupCabalMaxVersion - -- it has to be the latest release version plus - -- you have to use the latest cabal-install release - setup-depends: Cabal == 3.10.*, - Cabal-syntax == 3.10.*, + -- and must match the release used in validate.yml (see + -- https://github.com/haskell/cabal/pull/10251) + setup-depends: Cabal ^>= 3.12.1, + Cabal-syntax ^>= 3.12.1, base, filepath, directory diff --git a/cabal-testsuite/main/cabal-tests.hs b/cabal-testsuite/main/cabal-tests.hs index c3d167e3b8c..a732fda6d48 100644 --- a/cabal-testsuite/main/cabal-tests.hs +++ b/cabal-testsuite/main/cabal-tests.hs @@ -1,6 +1,5 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE NondecreasingIndentation #-} -{-# LANGUAGE PatternGuards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} @@ -23,22 +22,28 @@ import Control.Exception import Control.Monad import GHC.Conc (numCapabilities) import Data.List +import Data.Proxy (Proxy(Proxy)) +import qualified Data.Sequence as Seq (fromList) import Text.Printf +import qualified Test.Tasty.Options as Tasty + ( OptionSet + , OptionDescription (Option) + , lookupOption + ) +import qualified Test.Tasty.Runners as Tasty + ( optionParser + , TestPattern + , testPatternMatches + ) import qualified System.Clock as Clock import System.IO import System.FilePath import System.Exit -import System.Process (callProcess, showCommandForUser) +import System.Process (readProcessWithExitCode, showCommandForUser) import System.Directory import Distribution.Pretty import Data.Maybe -#if !MIN_VERSION_base(4,12,0) -import Data.Monoid ((<>)) -#endif -#if !MIN_VERSION_base(4,8,0) -import Data.Monoid (mempty) -#endif {- Note [Testsuite package environments] @@ -78,7 +83,8 @@ data MainArgs = MainArgs { mainArgQuiet :: Bool, mainArgDistDir :: Maybe FilePath, mainArgCabalSpec :: Maybe CabalLibSpec, - mainCommonArgs :: CommonArgs + mainCommonArgs :: CommonArgs, + mainTastyArgs :: Tasty.OptionSet } data CabalLibSpec = BootCabalLib | InTreeCabalLib FilePath FilePath | SpecificCabalLib String FilePath @@ -123,14 +129,26 @@ mainArgParser = MainArgs <> metavar "DIR")) <*> optional cabalLibSpecParser <*> commonArgParser + <*> tastyArgParser + +tastyArgParser :: Parser Tasty.OptionSet +tastyArgParser = + let (warnings, parser) = + Tasty.optionParser + [ Tasty.Option (Proxy @Tasty.TestPattern) + ] + in if null warnings + then parser + else error $ unlines ("Failed to create parser for Tasty CLI options:" : warnings) -- Unpack and build a specific released version of Cabal and Cabal-syntax libraries -buildCabalLibsProject :: String -> Verbosity -> Maybe FilePath -> FilePath -> IO FilePath +buildCabalLibsProject :: String -> Verbosity -> Maybe FilePath -> FilePath -> IO [FilePath] buildCabalLibsProject projString verb mbGhc dir = do let prog_db = userSpecifyPaths [("ghc", path) | Just path <- [mbGhc] ] defaultProgramDb (cabal, _) <- requireProgram verb (simpleProgram "cabal") prog_db (ghc, _) <- requireProgram verb ghcProgram prog_db + let storeRoot = dir "store" let pv = fromMaybe (error "no ghc version") (programVersion ghc) let final_package_db = dir "dist-newstyle" "packagedb" "ghc-" ++ prettyShow pv createDirectoryIfMissing True dir @@ -138,16 +156,24 @@ buildCabalLibsProject projString verb mbGhc dir = do runProgramInvocation verb ((programInvocation cabal - ["--store-dir", dir "store" + ["--store-dir", storeRoot , "--project-file=" ++ dir "cabal.project-test" , "build" , "-w", programPath ghc , "Cabal", "Cabal-syntax", "Cabal-hooks" ] ) { progInvokeCwd = Just dir }) - return final_package_db + -- Determine the path to the packagedb in the store for this ghc version + storesByGhc <- getDirectoryContents storeRoot + case filter (prettyShow pv `isInfixOf`) storesByGhc of + [] -> return [final_package_db] + storeForGhc:_ -> do + let storePackageDB = (storeRoot storeForGhc "package.db") + return [storePackageDB, final_package_db] -buildCabalLibsSpecific :: String -> Verbosity -> Maybe FilePath -> FilePath -> IO FilePath + + +buildCabalLibsSpecific :: String -> Verbosity -> Maybe FilePath -> FilePath -> IO [FilePath] buildCabalLibsSpecific ver verb mbGhc builddir_rel = do let prog_db = userSpecifyPaths [("ghc", path) | Just path <- [mbGhc] ] defaultProgramDb (cabal, _) <- requireProgram verb (simpleProgram "cabal") prog_db @@ -158,15 +184,13 @@ buildCabalLibsSpecific ver verb mbGhc builddir_rel = do csgot <- doesDirectoryExist (dir "Cabal-syntax-" ++ ver) unless csgot $ runProgramInvocation verb ((programInvocation cabal ["get", "Cabal-syntax-" ++ ver]) { progInvokeCwd = Just dir }) - let hooksVerFromVer _ = "0.1" - hooksVer = hooksVerFromVer ver - chgot <- doesDirectoryExist (dir "Cabal-hooks-" ++ hooksVer) + chgot <- doesDirectoryExist (dir "Cabal-hooks-" ++ ver) unless chgot $ - runProgramInvocation verb ((programInvocation cabal ["get", "Cabal-hooks-" ++ hooksVer]) { progInvokeCwd = Just dir }) - buildCabalLibsProject ("packages: Cabal-" ++ ver ++ " Cabal-syntax-" ++ ver ++ " Cabal-hooks-" ++ hooksVer) verb mbGhc dir + runProgramInvocation verb ((programInvocation cabal ["get", "Cabal-hooks-" ++ ver]) { progInvokeCwd = Just dir }) + buildCabalLibsProject ("packages: Cabal-" ++ ver ++ " Cabal-syntax-" ++ ver ++ " Cabal-hooks-" ++ ver) verb mbGhc dir -buildCabalLibsIntree :: String -> Verbosity -> Maybe FilePath -> FilePath -> IO FilePath +buildCabalLibsIntree :: String -> Verbosity -> Maybe FilePath -> FilePath -> IO [FilePath] buildCabalLibsIntree root verb mbGhc builddir_rel = do dir <- canonicalizePath (builddir_rel "intree") buildCabalLibsProject ("packages: " ++ root "Cabal" ++ " " ++ root "Cabal-syntax" ++ " " ++ root "Cabal-hooks") verb mbGhc dir @@ -181,27 +205,28 @@ main = do -- Parse arguments. N.B. 'helper' adds the option `--help`. args <- execParser $ info (mainArgParser <**> helper) mempty let verbosity = if mainArgVerbose args then verbose else normal + testPattern = Tasty.lookupOption @Tasty.TestPattern (mainTastyArgs args) - mpkg_db <- + pkg_dbs <- -- Not path to cabal-install so we're not going to run cabal-install tests so we -- can skip setting up a Cabal library to use with cabal-install. case argCabalInstallPath (mainCommonArgs args) of Nothing -> do when (isJust $ mainArgCabalSpec args) (putStrLn "Ignoring Cabal library specification as cabal-install tests are not running") - return Nothing + return [] -- Path to cabal-install is passed, so need to install the requested relevant version of Cabal -- library. Just {} -> case mainArgCabalSpec args of Nothing -> do putStrLn "No Cabal library specified, using boot Cabal library with cabal-install tests" - return Nothing - Just BootCabalLib -> return Nothing + return [] + Just BootCabalLib -> return [] Just (InTreeCabalLib root build_dir) -> - Just <$> buildCabalLibsIntree root verbosity (argGhcPath (mainCommonArgs args)) build_dir + buildCabalLibsIntree root verbosity (argGhcPath (mainCommonArgs args)) build_dir Just (SpecificCabalLib ver build_dir) -> - Just <$> buildCabalLibsSpecific ver verbosity (argGhcPath (mainCommonArgs args)) build_dir + buildCabalLibsSpecific ver verbosity (argGhcPath (mainCommonArgs args)) build_dir -- To run our test scripts, we need to be able to run Haskell code -- linked against the Cabal library under test. The most efficient @@ -228,14 +253,28 @@ main = do -> IO result runTest runner path = runner Nothing [] path $ - ["--builddir", dist_dir, path] ++ ["--extra-package-db=" ++ pkg_db | Just pkg_db <- [mpkg_db]] ++ renderCommonArgs (mainCommonArgs args) + ["--builddir", dist_dir, path] ++ ["--extra-package-db=" ++ pkg_db | pkg_db <- pkg_dbs] ++ renderCommonArgs (mainCommonArgs args) case mainArgTestPaths args of [path] -> do -- Simple runner (real_path, real_args) <- runTest (runnerCommand senv) path hPutStrLn stderr $ showCommandForUser real_path real_args - callProcess real_path real_args + -- If the test was reported flaky, the `runghc` call will exit + -- with exit code 1, and report `TestCodeFlaky` on the stderr output + -- + -- This seems to be the only way to catch this case. + -- + -- Sadly it means that stdout and stderr are not interleaved + -- directly anymore. + (e, out, err) <- readProcessWithExitCode real_path real_args "" + putStrLn "# STDOUT:" + putStrLn out + putStrLn "# STDERR:" + putStrLn err + if "TestCodeFlaky" `isInfixOf` err + then pure () + else throwIO e hPutStrLn stderr "OK" user_paths -> do -- Read out tests from filesystem @@ -247,7 +286,7 @@ main = do -- NB: getDirectoryContentsRecursive is lazy IO, but it -- doesn't handle directories disappearing gracefully. Fix -- this! - (single_tests, multi_tests) <- evaluate (partitionTests test_scripts) + (single_tests, multi_tests) <- evaluate (partitionTests testPattern test_scripts) let all_tests = multi_tests ++ single_tests margin = maximum (map length all_tests) + 2 hPutStrLn stderr $ "tests to run: " ++ show (length all_tests) @@ -260,6 +299,8 @@ main = do unexpected_fails_var <- newMVar [] unexpected_passes_var <- newMVar [] skipped_var <- newMVar [] + flaky_pass_var <- newMVar [] + flaky_fail_var <- newMVar [] chan <- newChan let logAll msg = writeChan chan (ServerLogMsg AllServers msg) @@ -312,7 +353,7 @@ main = do modifyMVar_ unexpected_fails_var $ \paths -> return (path:paths) - when (code == TestCodeUnexpectedOk) $ + when (isJust $ isTestCodeUnexpectedSuccess code) $ modifyMVar_ unexpected_passes_var $ \paths -> return (path:paths) @@ -320,6 +361,12 @@ main = do modifyMVar_ skipped_var $ \paths -> return (path:paths) + case isTestCodeFlaky code of + NotFlaky -> pure () + Flaky b _ -> + modifyMVar_ (if b then flaky_pass_var else flaky_fail_var) $ \paths -> + return (path:paths) + go server -- Start as many threads as requested by -j to spawn @@ -330,13 +377,17 @@ main = do unexpected_fails <- takeMVar unexpected_fails_var unexpected_passes <- takeMVar unexpected_passes_var skipped <- takeMVar skipped_var + flaky_passes <- takeMVar flaky_pass_var + flaky_fails <- takeMVar flaky_fail_var -- print summary let sl = show . length testSummary = sl all_tests ++ " tests, " ++ sl skipped ++ " skipped, " ++ sl unexpected_passes ++ " unexpected passes, " - ++ sl unexpected_fails ++ " unexpected fails." + ++ sl unexpected_fails ++ " unexpected fails, " + ++ sl flaky_passes ++ " flaky passes, " + ++ sl flaky_fails ++ " flaky fails." logAll testSummary -- print failed or unexpected ok @@ -352,10 +403,19 @@ main = do findTests :: IO [FilePath] findTests = getDirectoryContentsRecursive "." -partitionTests :: [FilePath] -> ([FilePath], [FilePath]) -partitionTests = go [] [] +-- | Partition a list of paths into a tuple of test paths and multi-test paths. +-- +-- Non-test paths and test paths that don't match the given `Tasty.TestPattern` are dropped. +partitionTests :: Tasty.TestPattern -> [FilePath] -> ([FilePath], [FilePath]) +partitionTests testPattern paths = + go [] [] paths where - go ts ms [] = (ts, ms) + -- Filter a list, keeping only paths that match the @pattern@. + keepPatternMatches = filter (Tasty.testPatternMatches testPattern . toTastyPath) + + toTastyPath path = Seq.fromList $ splitDirectories path + + go ts ms [] = (keepPatternMatches ts, keepPatternMatches ms) go ts ms (f:fs) = -- NB: Keep this synchronized with isTestFile case takeExtensions f of diff --git a/cabal-testsuite/src/Test/Cabal/Monad.hs b/cabal-testsuite/src/Test/Cabal/Monad.hs index e817a89c282..31e1e07bf52 100644 --- a/cabal-testsuite/src/Test/Cabal/Monad.hs +++ b/cabal-testsuite/src/Test/Cabal/Monad.hs @@ -45,18 +45,25 @@ module Test.Cabal.Monad ( testActualFile, -- * Skipping tests skip, + skipIO, skipIf, + skipIfIO, skipUnless, + skipUnlessIO, -- * Known broken tests - expectedBroken, - unexpectedSuccess, - -- whenHasSharedLibraries, + expectBroken, + expectBrokenIf, + expectBrokenUnless, + -- * Flaky tests + flaky, + flakyIf, -- * Arguments (TODO: move me) CommonArgs(..), renderCommonArgs, commonArgParser, -- * Version Constants cabalVersionLibrary, + ) where import Test.Cabal.Script @@ -66,7 +73,7 @@ import Test.Cabal.TestCode import Distribution.Pretty (prettyShow) import Distribution.Simple.Compiler - ( PackageDBStack, PackageDB(..), compilerFlavor + ( PackageDBStackCWD, PackageDBX(..), compilerFlavor , Compiler, compilerVersion, showCompilerIdWithAbi ) import Distribution.System import Distribution.Simple.Program.Db @@ -76,10 +83,11 @@ import Distribution.Simple.Configure import qualified Distribution.Simple.Utils as U (cabalVersion) import Distribution.Text -import Test.Utils.TempTestDir (removeDirectoryRecursiveHack) +import Test.Utils.TempTestDir (removeDirectoryRecursiveHack, withTestDir') import Distribution.Verbosity import Distribution.Version +import Control.Concurrent.Async #if !MIN_VERSION_base(4,11,0) import Data.Monoid ((<>)) #endif @@ -158,7 +166,7 @@ renderCommonArgs args = data TestArgs = TestArgs { testArgDistDir :: FilePath, - testArgPackageDb :: Maybe FilePath, + testArgPackageDb :: [FilePath], testArgScriptPath :: FilePath, testCommonArgs :: CommonArgs } @@ -169,34 +177,96 @@ testArgParser = TestArgs ( help "Build directory of cabal-testsuite" <> long "builddir" <> metavar "DIR") - <*> optional (option str + <*> many (option str ( help "Package DB which contains Cabal and Cabal-syntax" <> long "extra-package-db" <> metavar "DIR")) <*> argument str ( metavar "FILE") <*> commonArgParser -skip :: String -> TestM () -skip reason = liftIO $ do - putStrLn ("SKIP " ++ reason) +-- * skip tests + +skipIO :: String -> IO () +skipIO reason = do + putStrLn $ "SKIP (" <> reason <> ")" E.throwIO (TestCodeSkip reason) +skip :: String -> TestM () +skip = liftIO . skipIO + +skipIfIO :: String -> Bool -> IO () +skipIfIO reason b = when b (skipIO reason) + skipIf :: String -> Bool -> TestM () skipIf reason b = when b (skip reason) +skipUnlessIO :: String -> Bool -> IO () +skipUnlessIO reason b = unless b (skipIO reason) + skipUnless :: String -> Bool -> TestM () skipUnless reason b = unless b (skip reason) -expectedBroken :: TestM () -expectedBroken = liftIO $ do - putStrLn "EXPECTED FAIL" - E.throwIO TestCodeKnownFail - -unexpectedSuccess :: TestM () -unexpectedSuccess = liftIO $ do - putStrLn "UNEXPECTED OK" - E.throwIO TestCodeUnexpectedOk +-- * Broken tests +expectBroken :: IssueID -> TestM a -> TestM a +expectBroken ticket m = do + env <- getTestEnv + liftIO . withAsync (runReaderT m env) $ \a -> do + r <- waitCatch a + case r of + Left e -> do + putStrLn $ "This test is known broken, see #" ++ show ticket ++ ":" + print e + throwExpectedBroken ticket + Right _ -> do + throwUnexpectedSuccess ticket + +expectBrokenIf :: Bool -> IssueID -> TestM a -> TestM a +expectBrokenIf True ticket m = expectBroken ticket m +expectBrokenIf False _ m = m + +expectBrokenUnless :: Bool -> IssueID -> TestM a -> TestM a +expectBrokenUnless b = expectBrokenIf (not b) + +throwExpectedBroken :: IssueID -> IO a +throwExpectedBroken ticket = do + putStrLn $ "EXPECTED FAIL (#" <> show ticket <> ")" + E.throwIO (TestCodeKnownFail ticket) + +throwUnexpectedSuccess :: IssueID -> IO a +throwUnexpectedSuccess ticket = do + putStrLn $ "UNEXPECTED OK (#" <> show ticket <> ")" + E.throwIO (TestCodeUnexpectedOk ticket) + +-- * Flaky tests + +flaky :: IssueID -> TestM a -> TestM a +flaky ticket m = do + env <- getTestEnv + liftIO . withAsync (runReaderT m env) $ \a -> do + r <- waitCatch a + case r of + Left e -> do + putStrLn $ "This test is known flaky, and it failed, see #" ++ show ticket ++ ":" + print e + throwFlakyFail ticket + Right _ -> do + putStrLn $ "This test is known flaky, but it passed, see #" ++ show ticket ++ ":" + throwFlakyPass ticket + +flakyIf :: Bool -> IssueID -> TestM a -> TestM a +flakyIf True ticket m = flaky ticket m +flakyIf False _ m = m + +throwFlakyFail :: IssueID -> IO a +throwFlakyFail ticket = do + putStrLn $ "FLAKY FAIL (#" <> show ticket <> ")" + E.throwIO (TestCodeFlakyFailed ticket) + +throwFlakyPass :: IssueID -> IO a +throwFlakyPass ticket = do + putStrLn $ "FLAKY OK (#" <> show ticket <> ")" + E.throwIO (TestCodeFlakyPassed ticket) trySkip :: IO a -> IO (Either String a) trySkip m = fmap Right m `E.catch` \e -> case e of @@ -247,15 +317,10 @@ python3Program :: Program python3Program = simpleProgram "python3" -- | Run a test in the test monad according to program's arguments. -runTestM :: String -> TestM a -> IO a +runTestM :: String -> TestM () -> IO () runTestM mode m = - liftIO $ (canonicalizePath =<< getTemporaryDirectory) >>= \systemTmpDir -> - -- canonicalizePath: cabal-install is inconsistent w.r.t. looking through - -- symlinks. We canonicalize here to avoid such issues when the temporary - -- directory contains symlinks. See #9763. execParser (info testArgParser Data.Monoid.mempty) >>= \args -> - withTempDirectoryEx verbosity (defaultTempFileOptions { optKeepTempFiles = argKeepTmpFiles (testCommonArgs args) }) - systemTmpDir + withTestDir' verbosity (defaultTempFileOptions { optKeepTempFiles = argKeepTmpFiles (testCommonArgs args) }) "cabal-testsuite" $ \tmp_dir -> do let dist_dir = testArgDistDir args (script_dir0, script_filename) = splitFileName (testArgScriptPath args) @@ -333,18 +398,22 @@ runTestM mode m = testMtimeChangeDelay = Nothing, testScriptEnv = senv, testSetupPath = dist_dir "build" "setup" "setup", - testPackageDbPath = testArgPackageDb args, + testPackageDbPath = case testArgPackageDb args of [] -> Nothing; xs -> Just xs, testSkipSetupTests = argSkipSetupTests (testCommonArgs args), testHaveCabalShared = runnerWithSharedLib senv, testEnvironment = - -- Try to avoid Unicode output - [ ("LC_ALL", Just "C") + -- Use UTF-8 output on all platforms. + [ ("LC_ALL", Just "en_US.UTF-8") -- Hermetic builds (knot-tied) , ("HOME", Just (testHomeDir env)) -- Set CABAL_DIR in addition to HOME, since HOME has no -- effect on Windows. , ("CABAL_DIR", Just (testCabalDir env)) , ("CABAL_CONFIG", Just (testUserCabalConfigFile env)) + -- Set `TMPDIR` so that temporary files aren't created in the global `TMPDIR`. + , ("TMPDIR", Just tmp_dir) + -- Windows uses `TMP` for the `TMPDIR`. + , ("TMP", Just tmp_dir) ], testShouldFail = False, testRelativeCurrentDir = ".", @@ -357,11 +426,26 @@ runTestM mode m = testRecordUserMode = Nothing, testMaybeStoreDir = Nothing } - let go = do cleanup - r <- withSourceCopy m - check_expect (argAccept (testCommonArgs args)) - return r - runReaderT go env + runReaderT cleanup env + join $ E.catch (runReaderT + (do + withSourceCopy m + check_expect (argAccept (testCommonArgs args)) Nothing + ) + env + ) + (\(e :: TestCode) -> do + -- A test that resulted in unexpected success should check its output + -- because maybe it is the output the one that makes it fail! + case isTestCodeUnexpectedSuccess e of + Just t -> runReaderT (check_expect (argAccept (testCommonArgs args)) (Just (t, False))) env + Nothing -> + -- A test that is reported flaky but passed might fail because of the output + case isTestCodeFlaky e of + Flaky True t -> runReaderT (check_expect (argAccept (testCommonArgs args)) (Just (t, True))) env + _ -> E.throwIO e + ) + where verbosity = normal -- TODO: configurable @@ -377,13 +461,15 @@ runTestM mode m = liftIO $ writeFile (testUserCabalConfigFile env) $ unlines [ "with-compiler: " ++ ghc_path ] - check_expect accept = do + check_expect accept was_expected_to_fail = do env <- getTestEnv actual_raw <- liftIO $ readFileOrEmpty (testActualFile env) expect <- liftIO $ readFileOrEmpty (testExpectFile env) norm_env <- mkNormalizerEnv let actual = normalizeOutput norm_env actual_raw - when (words actual /= words expect) $ do + case (was_expected_to_fail, words actual /= words expect) of + -- normal test, output doesn't match + (Nothing, True) -> do -- First try whitespace insensitive diff let actual_fp = testNormalizedActualFile env expect_fp = testNormalizedExpectFile env @@ -393,9 +479,25 @@ runTestM mode m = b <- diff ["-uw"] expect_fp actual_fp unless b . void $ diff ["-u"] expect_fp actual_fp if accept - then do liftIO $ putStrLn "Accepting new output." - liftIO $ writeFileNoCR (testExpectFile env) actual - else liftIO $ exitWith (ExitFailure 1) + then do liftIO $ putStrLn $ "Writing actual test output to " <> testExpectAcceptFile env + liftIO $ writeFileNoCR (testExpectAcceptFile env) actual + pure (pure ()) + else pure (E.throwIO TestCodeFail) + -- normal test, output matches + (Nothing, False) -> pure (pure ()) + -- expected fail, output matches + (Just (t, was_flaky), False) -> pure (E.throwIO $ if was_flaky then TestCodeFlakyPassed t else TestCodeUnexpectedOk t) + -- expected fail, output doesn't match + (Just (t, was_flaky), True) -> do + -- First try whitespace insensitive diff + let actual_fp = testNormalizedActualFile env + expect_fp = testNormalizedExpectFile env + liftIO $ writeFile actual_fp actual + liftIO $ writeFile expect_fp expect + liftIO $ putStrLn "Actual output differs from expected:" + b <- diff ["-uw"] expect_fp actual_fp + unless b . void $ diff ["-u"] expect_fp actual_fp + pure (E.throwIO $ if was_flaky then TestCodeFlakyFailed t else TestCodeKnownFail t) readFileOrEmpty :: FilePath -> IO String readFileOrEmpty f = readFile f `E.catch` \e -> @@ -532,6 +634,7 @@ mkNormalizerEnv = do tmpDir <- liftIO $ getTemporaryDirectory canonicalizedTestTmpDir <- liftIO $ canonicalizePath (testTmpDir env) + canonicalizedGblDir <- liftIO $ canonicalizePath tmpDir -- 'cabal' is configured in the package-db, but doesn't specify how to find the program version -- Thus we find the program location, if it exists, and query for the program version for @@ -544,14 +647,26 @@ mkNormalizerEnv = do liftIO (findProgramVersion "--numeric-version" id (testVerbosity env) (programPath cabalProg)) return NormalizerEnv { - normalizerRoot - = addTrailingPathSeparator (testSourceDir env), normalizerTmpDir - = addTrailingPathSeparator (testTmpDir env), + = (if buildOS == Windows + then joinDrive "\\" . dropDrive + else id) + $ addTrailingPathSeparator (testTmpDir env), normalizerCanonicalTmpDir - = addTrailingPathSeparator canonicalizedTestTmpDir, + = (if buildOS == Windows + then joinDrive "\\" . dropDrive + else id) + $ addTrailingPathSeparator canonicalizedTestTmpDir, normalizerGblTmpDir - = addTrailingPathSeparator tmpDir, + = (if buildOS == Windows + then joinDrive "\\" . dropDrive + else id) + $ addTrailingPathSeparator tmpDir, + normalizerCanonicalGblTmpDir + = (if buildOS == Windows + then joinDrive "\\" . dropDrive + else id) + $ addTrailingPathSeparator canonicalizedGblDir, normalizerGhcVersion = compilerVersion (testCompiler env), normalizerGhcPath @@ -637,7 +752,7 @@ data TestEnv = TestEnv -- | Platform we are running tests on , testPlatform :: Platform -- | Package database stack (actually this changes lol) - , testPackageDBStack :: PackageDBStack + , testPackageDBStack :: PackageDBStackCWD -- | How verbose to be , testVerbosity :: Verbosity -- | How long we should 'threadDelay' to make sure the file timestamp is @@ -649,8 +764,8 @@ data TestEnv = TestEnv -- | Setup script path , testSetupPath :: FilePath -- | Setup package-db path which contains Cabal and Cabal-syntax for cabal-install to - -- use when compiling custom setups. - , testPackageDbPath :: Maybe FilePath + -- use when compiling custom setups, plus the store with possible dependencies of those setup packages. + , testPackageDbPath :: Maybe [FilePath] -- | Skip Setup tests? , testSkipSetupTests :: Bool -- | Do we have shared libraries for the Cabal-under-tests? @@ -768,8 +883,18 @@ testUserCabalConfigFile :: TestEnv -> FilePath testUserCabalConfigFile env = testCabalDir env "config" -- | The file where the expected output of the test lives +-- +-- Pointing to the @testTmpDir@ allows us to modify the expected output if +-- needed, to adapt it to outcomes of previous steps in the test. testExpectFile :: TestEnv -> FilePath -testExpectFile env = testSourceDir env testName env <.> "out" +testExpectFile env = testTmpDir env testName env <.> "out" + +-- | The file where the expected output of the test is written in @--accept@ mode +-- +-- Note: This needs to point to `testSourceDir` so the output is visible in the +-- user's repository. +testExpectAcceptFile :: TestEnv -> FilePath +testExpectAcceptFile env = testSourceDir env testName env <.> "out" -- | Where we store the actual output testActualFile :: TestEnv -> FilePath diff --git a/cabal-testsuite/src/Test/Cabal/NeedleHaystack.hs b/cabal-testsuite/src/Test/Cabal/NeedleHaystack.hs new file mode 100644 index 00000000000..42ab1031284 --- /dev/null +++ b/cabal-testsuite/src/Test/Cabal/NeedleHaystack.hs @@ -0,0 +1,277 @@ +{-# LANGUAGE MultiWayIf #-} +{-# LANGUAGE NoImplicitPrelude #-} +{-# LANGUAGE ViewPatterns #-} + +-- | Functions for searching for a needle in a haystack, with transformations +-- for the strings to search in and the search strings such as re-encoding line +-- breaks or delimiting lines. Both LF and CRLF line breaks are recognized. +module Test.Cabal.NeedleHaystack + ( TxContains(..) + , txContainsId + , NeedleHaystack(..) + , symNeedleHaystack + , multilineNeedleHaystack + , needleHaystack + , lineBreaksToSpaces + , normalizePathSeparators + , encodeLf + , delimitLines + ) where + +import Prelude hiding (unlines) +import qualified Prelude (unlines) +import Data.List (tails) +import Data.Maybe (isJust) +import Distribution.System +import Distribution.Utils.Generic (unsnoc) +import Data.List (isPrefixOf) +import qualified System.FilePath.Posix as Posix +import qualified System.FilePath.Windows as Windows +import Network.URI (parseURI) + +{- +Note [Multiline Needles] +~~~~~~~~~~~~~~~~~~~~~~~~ + +How we search for multiline strings in output that varies by platform. + +Reading Expected Multiline Strings Verbatim +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +With @ghc-9.12.1@ adding @-XMultilineStrings@, writing multiline string +expectations for @cabal-testsuite/PackageTests/**/*.test.hs@ test scripts might +be have been easier but for a catch. We run these tests with older @GHC@ +versions so would need to use @-XCPP@ for those versions and the C preprocessor +does not play nicely with string gaps. While it is possible to encode a +multiline string as a single line with embedded LF characters or by breaking the +line up arbitrarily and using @++@ concatenation or by calling unlines on a list +of lines, string gaps are the multiline strings of Haskell prior to +@-XMultilineStrings@. + +To avoid these problems and for the convenience of pasting the expected value +verbatim into a file, @readFileVerbatim@ can read the expected multiline output +for tests from a text file. This has the same implementation as @readFile@ from +the @strict-io@ package to avoid problems at cleanup. + +Warning: Windows file locking hack: hit the retry limit 3 while trying to remove +C:\Users\\AppData\Local\Temp\cabal-testsuite-8376 +cabal.test.hs: +C:\Users\\AppData\Local\Temp\cabal-testsuite-8376\errors.expect.txt: removePathForcibly:DeleteFile +"\\\\?\\C:\\Users\\\\AppData\\Local\\Temp\\cabal-testsuite-8376\\errors.expect.txt": +permission denied (The process cannot access the file because it is being used by another process.) + +The other process accessing the file is @C:\WINDOWS\System32\svchost.exe@ +running a @QueryDirectory@ event and this problem only occurs when the test +fails. + +Hidden Actual Value Modification +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The @assertOutputContains@ function was modifying the actual value (the test +output) with @concatOutput@ before checking if it contained the expected value. +This function, now renamed as @lineBreaksToSpaces@, would remove CR values and +convert LF values to spaces. + +With this setup, false positives were possible. An expected value using string +gaps and spaces would match a @concatOutput@ modified actual value of +"foo_bar_baz", where '_' was any of space, LF or CRLF in the unmodified actual +value. The latter two are false positive matches. + +> let expect = "foo \ +> \bar \ +> \baz" + +False negatives were also possible. An expected value set up using string gaps +with LF characters or with @-XMultilineStrings@ wouldn't match an actual value +of "foo_bar_baz", where '_' was either LF or CRLF because these characters had +been replaced by spaces in the actual value, modified before the comparison. + +> let expect = "foo\n\ +> \bar\n\ +> \baz" + +> {-# LANGUAGE MultilineStrings #-} +> +> let expect = """ +> foo +> bar +> baz +> """ + +We had these problems: + +1. The actual value was changed before comparison and this change was not visible. +2. The expected value was not changed in the same way as the actual value. This + made it possible for equal values to become unequal (false negatives) and for + unequal values to become equal (false positives). + +Explicit Changes and Visible Line Delimiters +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To fix these problems, an added @assertOn@ function takes a @NeedleHaystack@ +configuration for how the search is made, what to expect (to find the expected +value or not) and how to display the expected and actual values. + +A pilcrow ¶ is often used to visibly display line endings but our terminal +output is restricted to ASCII so lines are delimited between @^@ and @$@ +markers. The needle (the expected output fragment) is shown annotated this way +and the haystack (the actual output) can optionally be shown this way too. + +This is still a lenient match, allowing LF to match CRLF, but @encodeLf@ doesn't +replace LF with spaces like @concatOutput@ (@lineBreaksToSpaces@) did: + +If you choose to display the actual value by setting +@NeedleHaystack{displayHaystack = True}@ then its lines will be delimited. + +With @assertOn@, supplying string transformation to both the needle and haystack +before comparison and before display can help find out why an expected value is +or isn't found in the test output. +-} + +-- | Transformations for the search strings and the text to search in. +data TxContains = + TxContains + { + -- | Reverse conversion for display, applied to the forward converted value. + txBwd :: (String -> String), + -- | Forward conversion for comparison. + txFwd :: (String -> String) + } + +-- | Identity transformation for the search strings and the text to search in, +-- leaves them unchanged. +txContainsId :: TxContains +txContainsId = TxContains id id + +-- | Conversions of the needle and haystack strings, the seach string and the +-- text to search in. +data NeedleHaystack = + NeedleHaystack + { + expectNeedleInHaystack :: Bool, + displayHaystack :: Bool, + txNeedle :: TxContains, + txHaystack :: TxContains + } + +-- | Symmetric needle and haystack functions, the same conversion for each going +-- forward and the same coversion for each going backward. +symNeedleHaystack :: (String -> String) -> (String -> String) -> NeedleHaystack +symNeedleHaystack bwd fwd = let tx = TxContains bwd fwd in NeedleHaystack True False tx tx + +-- | Multiline needle and haystack functions with symmetric conversions. Going +-- forward converts line breaks to @"\\n"@. Going backward adds visible +-- delimiters to lines. +multilineNeedleHaystack :: NeedleHaystack +multilineNeedleHaystack = symNeedleHaystack delimitLines encodeLf + +-- | Minimal set up for finding the needle in the haystack. Doesn't change the +-- strings and doesn't display the haystack in any assertion failure message. +needleHaystack :: NeedleHaystack +needleHaystack = NeedleHaystack True False txContainsId txContainsId + +-- | Replace line breaks with spaces, correctly handling @"\\r\\n"@. +-- +-- >>> lineBreaksToSpaces "foo\nbar\r\nbaz" +-- "foo bar baz" +-- +-- >>> lineBreaksToSpaces "foo\nbar\r\nbaz\n" +-- "foo bar baz" +-- +-- >>> lineBreaksToSpaces "\nfoo\nbar\r\nbaz\n" +-- " foo bar baz" +lineBreaksToSpaces :: String -> String +lineBreaksToSpaces = unwords . lines . filter ((/=) '\r') + +-- | Replaces path separators found with those of the current OS, URL-like paths +-- excluded. +-- +-- > buildOS == Linux; normalizePathSeparators "foo\bar\baz" => "foo/bar/baz" +-- > buildOS == Windows; normalizePathSeparators "foo/bar/baz" => "foo\bar\baz" +normalizePathSeparators :: String -> String +normalizePathSeparators = + unlines . map normalizePathSeparator . lines + where + normalizePathSeparator p = + if | any (isJust . parseURI) (tails p) -> p + | buildOS == Windows -> + [if Posix.isPathSeparator c then Windows.pathSeparator else c| c <- p] + | otherwise -> + [if Windows.isPathSeparator c then Posix.pathSeparator else c| c <- p] + +-- | @unlines@ from base will add a trailing newline if there isn't one already +-- but this one doesn't +-- +-- >>> lines "abc" +-- ["abc"] +-- +-- >>> Data.List.unlines $ lines "abc" +-- "abc\n" +-- +-- >>> unlines $ lines "abc" +-- "abc" +unlines :: [String] -> String +unlines = maybe "" fst . unsnoc . Prelude.unlines + +-- | Replace line CRLF line breaks with LF line breaks. +-- +-- >>> encodeLf "foo\nbar\r\nbaz" +-- "foo\nbar\nbaz" +-- +-- >>> encodeLf "foo\nbar\r\nbaz\n" +-- "foo\nbar\nbaz\n" +-- +-- >>> encodeLf "\nfoo\nbar\r\nbaz\n" +-- "\nfoo\nbar\nbaz\n" +-- +-- >>> encodeLf "\n\n\n" +-- "\n\n\n" +encodeLf :: String -> String +encodeLf = filter (/= '\r') + +-- | Mark lines with visible delimiters, @^@ at the start and @$@ at the end. +-- +-- >>> delimitLines "" +-- "^$" +-- +-- >>> delimitLines "\n" +-- "^$\n" +-- +-- >>> delimitLines "\n\n" +-- "^$\n^$\n" +-- +-- >>> delimitLines "\n\n\n" +-- "^$\n^$\n^$\n" +-- +-- >>> delimitLines $ encodeLf "foo\nbar\r\nbaz" +-- "^foo$\n^bar$\n^baz$" +-- +-- >>> delimitLines $ encodeLf "foo\nbar\r\nbaz\n" +-- "^foo$\n^bar$\n^baz$\n" +-- +-- >>> delimitLines $ encodeLf "\nfoo\nbar\r\nbaz\n" +-- "^$\n^foo$\n^bar$\n^baz$\n" +delimitLines:: String -> String +delimitLines "" = "^$" +delimitLines "\n" = "^$\n" +delimitLines ('\n' : xs) = "^$\n" ++ delimitLines xs +delimitLines output = fixupStart . fixupEnd $ + foldr + (\c acc -> c : + if | "\n" == acc -> "$\n" + |("\n" `isPrefixOf` acc) -> "$\n^" ++ drop 1 acc + | otherwise -> acc + ) + "" + output + where + fixupStart :: String -> String + fixupStart s@[] = s + fixupStart s@('^' : _) = s + fixupStart s = '^' : s + + fixupEnd :: String -> String + fixupEnd s@[] = s + fixupEnd s@(reverse -> '$' : _) = s + fixupEnd s@(reverse -> '\n' : '$' : _) = s + fixupEnd s = s ++ "$" diff --git a/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs b/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs index 42daa708885..beadf91a523 100644 --- a/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs +++ b/cabal-testsuite/src/Test/Cabal/OutputNormalizer.hs @@ -19,26 +19,53 @@ import qualified Data.Foldable as F normalizeOutput :: NormalizerEnv -> String -> String normalizeOutput nenv = - -- Munge away .exe suffix on filenames (Windows) - resub "([A-Za-z0-9.-]+)\\.exe" "\\1" -- Normalize backslashes to forward slashes to normalize -- file paths - . map (\c -> if c == '\\' then '/' else c) + backslashToSlash -- Install path frequently has architecture specific elements, so -- nub it out . resub "Installing (.+) in .+" "Installing \\1 in " -- Things that look like libraries . resub "libHS[A-Za-z0-9.-]+\\.(so|dll|a|dynlib)" "" -- look for PackageHash directories + . (if buildOS == Windows + then resub "\\\\(([A-Za-z0-9_]+)(-[A-Za-z0-9\\._]+)*)-[0-9a-f]{4,64}\\\\" + "\\\\-\\\\" + else id) . resub "/(([A-Za-z0-9_]+)(-[A-Za-z0-9\\._]+)*)-[0-9a-f]{4,64}/" "/-/" -- This is dumb but I don't feel like pulling in another dep for -- string search-replace. Make sure we do this before backslash -- normalization! . resub (posixRegexEscape (normalizerGblTmpDir nenv) ++ "[a-z0-9\\.-]+") "" + . resub (posixRegexEscape (normalizerCanonicalGblTmpDir nenv) ++ "[a-z0-9\\.-]+") "" + -- Munge away .exe suffix on filenames (Windows) + . (if buildOS == Windows then resub "([A-Za-z0-9.-]+)\\.exe" "\\1" else id) + -- tmp/src-[0-9]+ is tmp\src-[0-9]+ in Windows + . (if buildOS == Windows then resub (posixRegexEscape "tmp\\src-" ++ "[0-9]+") "" else id) . resub (posixRegexEscape "tmp/src-" ++ "[0-9]+") "" . resub (posixRegexEscape (normalizerTmpDir nenv) ++ sameDir) "/" . resub (posixRegexEscape (normalizerCanonicalTmpDir nenv) ++ sameDir) "/" + . (if buildOS == Windows + then + -- OK. Here's the deal. In `./Prelude.hs`, `withRepoNoUpdate` sets + -- `repoUri` to the tmpdir but with backslashes replaced with + -- slashes. This is because Windows treats backslashes and forward + -- slashes largely the same in paths, and backslashes aren't allowed + -- in a URL like `file+noindex://...`. + -- + -- But that breaks the regexes above, which expect the paths to have + -- backslashes. + -- + -- Honestly this whole `normalizeOutput` thing is super janky and + -- worth rewriting from the ground up. To you, poor soul in the + -- future, here is one more hack upon a great pile. Hey, at least all + -- the `PackageTests` function as a test suite for this thing... + resub (posixRegexEscape (backslashToSlash $ normalizerTmpDir nenv) ++ sameDir) "/" + . resub (posixRegexEscape (backslashToSlash $ normalizerCanonicalTmpDir nenv) ++ sameDir) "/" + else id) + -- Munge away C: prefix on filenames (Windows). We convert C:\\ to \\. + . (if buildOS == Windows then resub "([A-Z]):\\\\" "\\\\" else id) . appEndo (F.fold (map (Endo . packageIdRegex) (normalizerKnownPackages nenv))) -- Look for 0.1/installed-0d6uzW7Ubh1Fb4TB5oeQ3G -- These installed packages will vary depending on GHC version @@ -46,6 +73,10 @@ normalizeOutput nenv = . resub "[0-9]+(\\.[0-9]+)*/installed-[A-Za-z0-9.+]+" "/installed-" -- incoming directories in the store + . (if buildOS == Windows then resub "\\\\incoming\\\\new-[0-9]+" + "\\\\incoming\\\\new-" + else id) + -- incoming directories in the store . resub "/incoming/new-[0-9]+" "/incoming/new-" -- Normalize architecture @@ -67,6 +98,7 @@ normalizeOutput nenv = . maybe id normalizePathCmdOutput (normalizerCabalInstallVersion nenv) -- hackage-security locks occur non-deterministically . resub "(Released|Acquired|Waiting) .*hackage-security-lock\n" "" + . resub "installed: [0-9]+(\\.[0-9]+)*" "installed: " where sameDir = "(\\.((\\\\)+|\\/))*" packageIdRegex pid = @@ -111,12 +143,21 @@ normalizeOutput nenv = "\"-package-id\",\"\"" data NormalizerEnv = NormalizerEnv - { normalizerRoot :: FilePath - , normalizerTmpDir :: FilePath + { normalizerTmpDir :: FilePath , normalizerCanonicalTmpDir :: FilePath -- ^ May differ from 'normalizerTmpDir', especially e.g. on macos, where -- `/var` is a symlink for `/private/var`. , normalizerGblTmpDir :: FilePath + -- ^ The global temp directory: @/tmp@ on Linux, @/var/folders/...@ on macos + -- and @\\msys64\\tmp@ on Windows. + -- + -- Note that on windows the actual path would be @C:\\msys64\\tmp@ but we + -- drop the @C:@ prefix because this path appears sometimes + -- twice in the same path in some tests, and the second time it doesn't have a @C:@, so + -- the logic fails to catch it. + , normalizerCanonicalGblTmpDir :: FilePath + -- ^ The canonical version of 'normalizerGblTmpDir', might differ in the same + -- way as above on macos , normalizerGhcVersion :: Version , normalizerGhcPath :: FilePath , normalizerKnownPackages :: [PackageId] @@ -131,6 +172,9 @@ posixSpecialChars = ".^$*+?()[{\\|" posixRegexEscape :: String -> String posixRegexEscape = concatMap (\c -> if c `elem` posixSpecialChars then ['\\', c] else [c]) +backslashToSlash :: String -> String +backslashToSlash = map (\c -> if c == '\\' then '/' else c) + -- From regex-compat-tdfa by Christopher Kuklewicz and shelarcy, BSD-3-Clause ------------------------- diff --git a/cabal-testsuite/src/Test/Cabal/Prelude.hs b/cabal-testsuite/src/Test/Cabal/Prelude.hs index 8a0aaff928b..daa5472c9d0 100644 --- a/cabal-testsuite/src/Test/Cabal/Prelude.hs +++ b/cabal-testsuite/src/Test/Cabal/Prelude.hs @@ -1,14 +1,17 @@ -{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE NondecreasingIndentation #-} -{-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE CPP #-} +{-# LANGUAGE RecordWildCards #-} +{-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE ViewPatterns #-} -- | Generally useful definitions that we expect most test scripts -- to use. module Test.Cabal.Prelude ( module Test.Cabal.Prelude, module Test.Cabal.Monad, + module Test.Cabal.NeedleHaystack, module Test.Cabal.Run, module System.FilePath, module Distribution.Utils.Path, @@ -18,13 +21,15 @@ module Test.Cabal.Prelude ( module Distribution.Simple.Program, ) where +import Test.Cabal.NeedleHaystack import Test.Cabal.Script import Test.Cabal.Run import Test.Cabal.Monad import Test.Cabal.Plan +import Test.Cabal.TestCode import Distribution.Compat.Time (calibrateMtimeChangeDelay) -import Distribution.Simple.Compiler (PackageDBStack, PackageDB(..)) +import Distribution.Simple.Compiler (PackageDBStackCWD, PackageDBCWD, PackageDBX(..)) import Distribution.Simple.PackageDescription (readGenericPackageDescription) import Distribution.Simple.Program.Types import Distribution.Simple.Program.Db @@ -43,25 +48,24 @@ import Distribution.PackageDescription import Test.Utils.TempTestDir (withTestDir) import Distribution.Verbosity (normal) import Distribution.Utils.Path - ( makeSymbolicPath, relativeSymbolicPath ) + ( makeSymbolicPath, relativeSymbolicPath, interpretSymbolicPathCWD ) import Distribution.Compat.Stack import Text.Regex.TDFA ((=~)) -import Control.Concurrent.Async (waitCatch, withAsync) +import Control.Concurrent.Async (withAsync) import qualified Data.Aeson as JSON import qualified Data.ByteString.Lazy as BSL -import Control.Monad (unless, when, void, forM_, liftM2, liftM4) -import Control.Monad.Trans.Reader (withReaderT, runReaderT) +import Control.Monad (unless, when, void, forM_, foldM, liftM2, liftM4) +import Control.Monad.Catch ( bracket_ ) +import Control.Monad.Trans.Reader (asks, withReaderT, runReaderT) import Control.Monad.IO.Class (MonadIO (..)) import qualified Crypto.Hash.SHA256 as SHA256 import qualified Data.ByteString.Base16 as Base16 import qualified Data.ByteString.Char8 as C import Data.List (isInfixOf, stripPrefix, isPrefixOf, intercalate) -import Data.List.NonEmpty (NonEmpty (..)) -import qualified Data.List.NonEmpty as NE -import Data.Maybe (mapMaybe, fromMaybe) +import Data.Maybe (isJust, mapMaybe, fromMaybe) import System.Exit (ExitCode (..)) import System.FilePath import Control.Concurrent (threadDelay) @@ -70,21 +74,28 @@ import System.Directory import Control.Retry (exponentialBackoff, limitRetriesByCumulativeDelay) import Network.Wait (waitTcpVerbose) import System.Environment +import qualified System.FilePath.Glob as Glob (globDir1, compile) +import System.Process +import System.IO #ifndef mingw32_HOST_OS -import Control.Monad.Catch ( bracket_ ) -import System.Posix.Files ( createSymbolicLink ) import System.Posix.Resource #endif ------------------------------------------------------------------------ -- * Utilities + runM :: FilePath -> [String] -> Maybe String -> TestM Result runM path args input = do + env <- getTestEnv + runM' (Just $ testCurrentDir env) path args input + +runM' :: Maybe FilePath -> FilePath -> [String] -> Maybe String -> TestM Result +runM' run_dir path args input = do env <- getTestEnv r <- liftIO $ run (testVerbosity env) - (Just $ testCurrentDir env) + run_dir (testEnvironment env) path args @@ -92,12 +103,17 @@ runM path args input = do recordLog r requireSuccess r -runProgramM :: Program -> [String] -> Maybe String -> TestM Result +runProgramM :: Program -> [String] -> Maybe String -> TestM Result runProgramM prog args input = do + env <- getTestEnv + runProgramM' (Just $ testCurrentDir env) prog args input + +runProgramM' :: Maybe FilePath -> Program -> [String] -> Maybe String -> TestM Result +runProgramM' run_dir prog args input = do configured_prog <- requireProgramM prog -- TODO: Consider also using other information from -- ConfiguredProgram, e.g., env and args - runM (programPath configured_prog) args input + runM' run_dir (programPath configured_prog) args input getLocalBuildInfoM :: TestM LocalBuildInfo getLocalBuildInfoM = do @@ -156,6 +172,7 @@ setup'' -> TestM Result setup'' prefix cmd args = do env <- getTestEnv + let work_dir = if testRelativeCurrentDir env == "." then Nothing else Just (testRelativeCurrentDir env) when ((cmd == "register" || cmd == "copy") && not (testHavePackageDb env)) $ error "Cannot register/copy without using 'withPackageDb'" ghc_path <- programPathM ghcProgram @@ -184,7 +201,10 @@ setup'' prefix cmd args = do ++ args _ -> args let rel_dist_dir = definitelyMakeRelative (testCurrentDir env) (testDistDir env) - full_args = cmd :| [marked_verbose, "--distdir", rel_dist_dir] ++ args' + work_dir_arg = case work_dir of + Nothing -> [] + Just wd -> ["--working-dir", wd] + full_args = work_dir_arg ++ (cmd : [marked_verbose, "--distdir", rel_dist_dir] ++ args') defaultRecordMode RecordMarked $ do recordHeader ["Setup", cmd] @@ -192,23 +212,23 @@ setup'' prefix cmd args = do -- -- `cabal` and `Setup.hs` do have different interface. -- - let pkgDir = makeSymbolicPath $ testCurrentDir env prefix + let pkgDir = makeSymbolicPath $ testTmpDir env testRelativeCurrentDir env prefix pdfile <- liftIO $ tryFindPackageDesc (testVerbosity env) (Just pkgDir) pdesc <- liftIO $ readGenericPackageDescription (testVerbosity env) (Just pkgDir) $ relativeSymbolicPath pdfile if testCabalInstallAsSetup env then if buildType (packageDescription pdesc) == Simple - then runProgramM cabalProgram ("act-as-setup" : "--" : NE.toList full_args) Nothing + then runProgramM' (Just (testTmpDir env)) cabalProgram ("act-as-setup" : "--" : full_args) Nothing else fail "Using act-as-setup for not 'build-type: Simple' package" else do if buildType (packageDescription pdesc) == Simple - then runM (testSetupPath env) (NE.toList full_args) Nothing + then runM' (Just $ testTmpDir env) (testSetupPath env) (full_args) Nothing -- Run the Custom script! else do r <- liftIO $ runghc (testScriptEnv env) - (Just $ testCurrentDir env) + (Just $ testTmpDir env) (testEnvironment env) - (testCurrentDir env prefix "Setup.hs") - (NE.toList full_args) + (testRelativeCurrentDir env prefix "Setup.hs") + (full_args) recordLog r requireSuccess r @@ -264,11 +284,11 @@ setup_install_with_docs args = do setup "register" [] return () -packageDBParams :: PackageDBStack -> [String] +packageDBParams :: PackageDBStackCWD -> [String] packageDBParams dbs = "--package-db=clear" : map (("--package-db=" ++) . convert) dbs where - convert :: PackageDB -> String + convert :: PackageDBCWD -> String convert GlobalPackageDB = "global" convert UserPackageDB = "user" convert (SpecificPackageDB path) = path @@ -324,14 +344,13 @@ cabalGArgs global_args cmd args input = do = [ "--builddir", testDistDir env , "-j1" ] ++ [ "--project-file=" ++ fp | Just fp <- [testCabalProjectFile env] ] - ++ ["--package-db=" ++ db | Just db <- [testPackageDbPath env]] + ++ ["--package-db=" ++ db | Just dbs <- [testPackageDbPath env], db <- dbs] | "v1-" `isPrefixOf` cmd = [ "--builddir", testDistDir env ] ++ install_args - | otherwise = [ "--builddir", testDistDir env ] - ++ ["--package-db=" ++ db | Just db <- [testPackageDbPath env]] + ++ ["--package-db=" ++ db | Just dbs <- [testPackageDbPath env], db <- dbs] ++ install_args install_args @@ -439,9 +458,9 @@ ghcPkg' cmd args = do recordHeader ["ghc-pkg", cmd] runProgramM ghcPkgProgram (cmd : extraArgs ++ args) Nothing -ghcPkgPackageDBParams :: Version -> PackageDBStack -> [String] +ghcPkgPackageDBParams :: Version -> PackageDBStackCWD -> [String] ghcPkgPackageDBParams version dbs = concatMap convert dbs where - convert :: PackageDB -> [String] + convert :: PackageDBCWD -> [String] -- Ignoring global/user is dodgy but there's no way good -- way to give ghc-pkg the correct flags in this case. convert GlobalPackageDB = [] @@ -545,20 +564,13 @@ src `archiveTo` dst = do -- TODO: --format ustar, like createArchive? -- --force-local is necessary for handling colons in Windows paths. tar $ ["-czf", dst] - ++ ["--force-local" | buildOS == Windows] ++ ["-C", src_parent, src_dir] infixr 4 `archiveTo` --- | Given a directory (relative to the 'testCurrentDir') containing --- a series of directories representing packages, generate an --- external repository corresponding to all of these packages -withRepo :: FilePath -> TestM a -> TestM a -withRepo repo_dir m = do - -- https://github.com/haskell/cabal/issues/7065 - -- you don't simply put a windows path into URL... - skipIfWindows - +-- | Like 'withRepo', but doesn't run @cabal update@. +withRepoNoUpdate :: FilePath -> TestM a -> TestM a +withRepoNoUpdate repo_dir m = do env <- getTestEnv -- 1. Initialize repo directory @@ -596,24 +608,32 @@ withRepo repo_dir m = do liftIO $ print $ testUserCabalConfigFile env liftIO $ print =<< readFile (testUserCabalConfigFile env) - -- 4. Update our local index - -- Note: this doesn't do anything for file+noindex repositories. - cabal "v2-update" ["-z"] - - -- 5. Profit + -- 4. Profit withReaderT (\env' -> env' { testHaveRepo = True }) m -- TODO: Arguably should undo everything when we're done... where - repoUri env ="file+noindex://" ++ testRepoDir env + repoUri env ="file+noindex://" ++ (if isWindows + then map (\x -> case x of + '\\' -> '/' + _ -> x) + else id) (testRepoDir env) + +-- | Given a directory (relative to the 'testCurrentDir') containing +-- a series of directories representing packages, generate an +-- external repository corresponding to all of these packages +withRepo :: FilePath -> TestM a -> TestM a +withRepo repo_dir m = do + withRepoNoUpdate repo_dir $ do + -- Update our local index + -- Note: this doesn't do anything for file+noindex repositories. + cabal "v2-update" ["-z"] + m -- | Given a directory (relative to the 'testCurrentDir') containing -- a series of directories representing packages, generate an -- remote repository corresponding to all of these packages withRemoteRepo :: FilePath -> TestM a -> TestM a withRemoteRepo repoDir m = do - -- https://github.com/haskell/cabal/issues/7065 - -- you don't simply put a windows path into URL... - skipIfWindows -- we rely on the presence of python3 for a simple http server skipUnless "no python3" =<< isAvailableProgram python3Program @@ -682,7 +702,12 @@ withRemoteRepo repoDir m = do -- wait for the python webserver to come up with a exponential -- backoff starting from 50ms, up to a maximum wait of 60s _ <- waitTcpVerbose putStrLn (limitRetriesByCumulativeDelay 60000000 $ exponentialBackoff 50000) "localhost" "8000" - runReaderT m (env { testHaveRepo = True })) + r <- runReaderT m (env { testHaveRepo = True }) + -- Windows fails to kill the python server when the function above + -- is complete, so we kill it directly via CMD. + when (buildOS == Windows) $ void $ createProcess_ "kill python" $ System.Process.shell "taskkill /F /IM python3.exe" + pure r + ) @@ -711,7 +736,7 @@ recordHeader args = do ------------------------------------------------------------------------ -- * Subprocess run results -assertFailure :: WithCallStack (String -> m ()) +assertFailure :: WithCallStack (String -> m a) assertFailure msg = withFrozenCallStack $ error msg assertExitCode :: MonadIO m => WithCallStack (ExitCode -> Result -> m ()) @@ -779,18 +804,47 @@ recordMode mode = withReaderT (\env -> env { testRecordUserMode = Just mode }) +-- See Note [Multiline Needles] assertOutputContains :: MonadIO m => WithCallStack (String -> Result -> m ()) -assertOutputContains needle result = +assertOutputContains = assertOn + needleHaystack + {txHaystack = TxContains{txBwd = delimitLines, txFwd = encodeLf}} + +assertOutputDoesNotContain :: MonadIO m => WithCallStack (String -> Result -> m ()) +assertOutputDoesNotContain = assertOn + needleHaystack + { expectNeedleInHaystack = False + , txHaystack = TxContains{txBwd = delimitLines, txFwd = encodeLf} + } + +-- See Note [Multiline Needles] +assertOn :: MonadIO m => WithCallStack (NeedleHaystack -> String -> Result -> m ()) +assertOn NeedleHaystack{..} (txFwd txNeedle -> needle) (txFwd txHaystack. resultOutput -> output) = withFrozenCallStack $ - unless (needle `isInfixOf` (concatOutput output)) $ - assertFailure $ " expected: " ++ needle + if expectNeedleInHaystack + then unless (needle `isInfixOf` output) + $ assertFailure $ "expected:\n" ++ (txBwd txNeedle needle) ++ + if displayHaystack + then "\nin output:\n" ++ (txBwd txHaystack output) + else "" + else when (needle `isInfixOf` output) + $ assertFailure $ "unexpected:\n" ++ (txBwd txNeedle needle) ++ + if displayHaystack + then "\nin output:\n" ++ (txBwd txHaystack output) + else "" + +assertOutputMatches :: MonadIO m => WithCallStack (String -> Result -> m ()) +assertOutputMatches regex result = + withFrozenCallStack $ + unless (encodeLf output =~ regex) $ + assertFailure $ "expected regex match: " ++ regex where output = resultOutput result -assertOutputDoesNotContain :: MonadIO m => WithCallStack (String -> Result -> m ()) -assertOutputDoesNotContain needle result = +assertOutputDoesNotMatch :: MonadIO m => WithCallStack (String -> Result -> m ()) +assertOutputDoesNotMatch regex result = withFrozenCallStack $ - when (needle `isInfixOf` (concatOutput output)) $ - assertFailure $ "unexpected: " ++ needle + when (encodeLf output =~ regex) $ + assertFailure $ "unexpected regex match: " ++ regex where output = resultOutput result assertFindInFile :: MonadIO m => WithCallStack (String -> FilePath -> m ()) @@ -820,9 +874,30 @@ assertFileDoesNotContain path needle = (assertFailure ("expected: " ++ needle ++ "\n" ++ " in file: " ++ path))) --- | Replace line breaks with spaces, correctly handling "\r\n". -concatOutput :: String -> String -concatOutput = unwords . lines . filter ((/=) '\r') +-- | Assert that at least one of the given paths contains the given search string. +assertAnyFileContains :: MonadIO m => WithCallStack ([FilePath] -> String -> m ()) +assertAnyFileContains paths needle = do + let findOne found path = + if found + then pure found + else withFileContents path $ \contents -> + pure $! needle `isInfixOf` contents + foundNeedle <- liftIO $ foldM findOne False paths + withFrozenCallStack $ + unless foundNeedle $ + assertFailure $ + "expected: " <> + needle <> + "\nin one of:\n" <> + unlines (map ("* " <>) paths) + +-- | Assert that none of the given paths contains the given search string. +assertNoFileContains :: MonadIO m => WithCallStack ([FilePath] -> String -> m ()) +assertNoFileContains paths needle = + liftIO $ + forM_ paths $ + \path -> + assertFileDoesNotContain path needle -- | The directory where script build artifacts are expected to be cached getScriptCacheDirectory :: FilePath -> TestM FilePath @@ -833,24 +908,82 @@ getScriptCacheDirectory script = do return $ cabalDir "script-builds" hash ------------------------------------------------------------------------ --- * Skipping tests +-- * Globs + +-- | Match a glob from a root directory and return the results. +matchGlob :: MonadIO m => FilePath -> String -> m [FilePath] +matchGlob root glob = do + liftIO $ Glob.globDir1 (Glob.compile glob) root + +-- | Assert that a glob matches at least one path in the given root directory. +-- +-- The matched paths are returned for further validation. +assertGlobMatches :: MonadIO m => WithCallStack (FilePath -> String -> m [FilePath]) +assertGlobMatches root glob = do + results <- matchGlob root glob + withFrozenCallStack $ + when (null results) $ + assertFailure $ + "Expected glob " <> show glob <> " to match in " <> show root + pure results + +-- | Assert that a glob matches no paths in the given root directory. +assertGlobDoesNotMatch :: MonadIO m => WithCallStack (FilePath -> String -> m ()) +assertGlobDoesNotMatch root glob = do + results <- matchGlob root glob + withFrozenCallStack $ + unless (null results) $ + assertFailure $ + "Expected glob " + <> show glob + <> " to not match any paths in " + <> show root + <> ", but the following matches were found:" + <> unlines (map ("* " <>) results) + +-- | Assert that a glob matches a path in the given root directory. +-- +-- The root directory is determined from the `TestEnv` with a function like `testDistDir`. +-- +-- The matched paths are returned for further validation. +assertGlobMatchesTestDir :: WithCallStack ((TestEnv -> FilePath) -> String -> TestM [FilePath]) +assertGlobMatchesTestDir rootSelector glob = do + root <- asks rootSelector + assertGlobMatches root glob -hasSharedLibraries :: TestM Bool -hasSharedLibraries = do - shared_libs_were_removed <- isGhcVersion ">= 7.8" - return (not (buildOS == Windows && shared_libs_were_removed)) +-- | Assert that a glob matches a path in the given root directory. +-- +-- The root directory is determined from the `TestEnv` with a function like `testDistDir`. +assertGlobDoesNotMatchTestDir :: WithCallStack ((TestEnv -> FilePath) -> String -> TestM ()) +assertGlobDoesNotMatchTestDir rootSelector glob = do + root <- asks rootSelector + assertGlobDoesNotMatch root glob -hasProfiledLibraries :: TestM Bool -hasProfiledLibraries = do +------------------------------------------------------------------------ +-- * Skipping tests + +testCompilerWithArgs :: [String] -> TestM Bool +testCompilerWithArgs args = do env <- getTestEnv ghc_path <- programPathM ghcProgram let prof_test_hs = testWorkDir env "Prof.hs" liftIO $ writeFile prof_test_hs "module Prof where" r <- liftIO $ run (testVerbosity env) (Just $ testCurrentDir env) - (testEnvironment env) ghc_path ["-prof", "-c", prof_test_hs] + (testEnvironment env) ghc_path (["-c", prof_test_hs] ++ args) Nothing return (resultExitCode r == ExitSuccess) +hasProfiledLibraries, hasProfiledSharedLibraries, hasSharedLibraries :: TestM Bool +hasProfiledLibraries = testCompilerWithArgs ["-prof"] +hasProfiledSharedLibraries = testCompilerWithArgs ["-prof", "-dynamic"] +hasSharedLibraries = testCompilerWithArgs ["-dynamic"] + +skipIfNoSharedLibraries :: TestM () +skipIfNoSharedLibraries = skipUnless "no shared libraries" =<< hasSharedLibraries + +skipIfNoProfiledLibraries :: TestM () +skipIfNoProfiledLibraries = skipUnless "no profiled libraries" =<< hasProfiledLibraries + -- | Check if the GHC that is used for compiling package tests has -- a shared library of the cabal library under test in its database. -- @@ -875,7 +1008,7 @@ allCabalVersion = isCabalVersion all isCabalVersion :: WithCallStack (((Version -> Bool) -> [Version] -> Bool) -> String -> TestM Bool) isCabalVersion decide range = do env <- getTestEnv - cabal_pkgs <- ghcPkg_raw' $ ["--global", "list", "Cabal", "--simple"] ++ ["--package-db=" ++ db | Just db <- [testPackageDbPath env]] + cabal_pkgs <- ghcPkg_raw' $ ["--global", "list", "Cabal", "--simple"] ++ ["--package-db=" ++ db | Just dbs <- [testPackageDbPath env], db <- dbs] let pkg_versions :: [PackageIdentifier] = mapMaybe simpleParsec (words (resultOutput cabal_pkgs)) vr <- case eitherParsec range of Left err -> fail err @@ -886,7 +1019,6 @@ isCabalVersion decide range = do skipUnlessAnyCabalVersion :: String -> TestM () skipUnlessAnyCabalVersion range = skipUnless ("needs any Cabal " ++ range) =<< anyCabalVersion range - -- | Skip a test if any available Cabal library version matches the predicate. skipIfAnyCabalVersion :: String -> TestM () skipIfAnyCabalVersion range = skipIf ("incompatible with Cabal " ++ range) =<< anyCabalVersion range @@ -917,28 +1049,83 @@ skipUnlessGhcVersion range = skipUnless ("needs ghc " ++ range) =<< isGhcVersion skipIfGhcVersion :: String -> TestM () skipIfGhcVersion range = skipIf ("incompatible with ghc " ++ range) =<< isGhcVersion range -skipUnlessJavaScript :: TestM () -skipUnlessJavaScript = skipUnless "needs the JavaScript backend" =<< isJavaScript +skipUnlessJavaScript :: IO () +skipUnlessJavaScript = skipUnlessIO "needs the JavaScript backend" isJavaScript + +skipIfJavaScript :: IO () +skipIfJavaScript = skipIfIO "incompatible with the JavaScript backend" isJavaScript -skipIfJavaScript :: TestM () -skipIfJavaScript = skipIf "incompatible with the JavaScript backend" =<< isJavaScript +isWindows :: Bool +isWindows = buildOS == Windows -isWindows :: TestM Bool -isWindows = return (buildOS == Windows) +isCI :: IO Bool +isCI = isJust <$> lookupEnv "CI" -isOSX :: TestM Bool -isOSX = return (buildOS == OSX) +isOSX :: Bool +isOSX = buildOS == OSX -isLinux :: TestM Bool -isLinux = return (buildOS == Linux) +isLinux :: Bool +isLinux = buildOS == Linux -isJavaScript :: TestM Bool -isJavaScript = return (buildArch == JavaScript) +isJavaScript :: Bool +isJavaScript = buildArch == JavaScript -- should probably be `hostArch` but Cabal doesn't distinguish build platform -- and host platform -skipIfWindows :: TestM () -skipIfWindows = skipIf "Windows" =<< isWindows +skipIfWindows :: String -> IO () +skipIfWindows why = skipIfIO ("Windows " <> why) isWindows + +skipUnlessWindows :: IO () +skipUnlessWindows = skipIfIO "Only interesting in Windows" (not isWindows) + +skipIfOSX :: String -> IO () +skipIfOSX why = skipIfIO ("OSX " <> why) isOSX + +skipIfCI :: IssueID -> IO () +skipIfCI ticket = skipIfIO ("CI, see #" <> show ticket) =<< isCI + +skipIfCIAndWindows :: IssueID -> IO () +skipIfCIAndWindows ticket = skipIfIO ("Windows CI, see #" <> show ticket) . (isWindows &&) =<< isCI + +skipIfCIAndOSX :: IssueID -> IO () +skipIfCIAndOSX ticket = skipIfIO ("OSX CI, see #" <> show ticket) . (isOSX &&) =<< isCI + +expectBrokenIfWindows :: IssueID -> TestM a -> TestM a +expectBrokenIfWindows ticket = expectBrokenIf isWindows ticket + +expectBrokenIfWindowsCI :: IssueID -> TestM a -> TestM a +expectBrokenIfWindowsCI ticket m = do + ci <- liftIO isCI + expectBrokenIf (isWindows && ci) ticket m + +expectBrokenIfWindowsCIAndGhc :: String -> IssueID -> TestM a -> TestM a +expectBrokenIfWindowsCIAndGhc range ticket m = do + ghcVer <- isGhcVersion range + ci <- liftIO isCI + expectBrokenIf (isWindows && ghcVer && ci) ticket m + +expectBrokenIfWindowsAndGhc :: String -> IssueID -> TestM a -> TestM a +expectBrokenIfWindowsAndGhc range ticket m = do + ghcVer <- isGhcVersion range + expectBrokenIf (isWindows && ghcVer) ticket m + +expectBrokenIfOSXAndGhc :: String -> IssueID -> TestM a -> TestM a +expectBrokenIfOSXAndGhc range ticket m = do + ghcVer <- isGhcVersion range + expectBrokenIf (isOSX && ghcVer) ticket m + +expectBrokenIfGhc :: String -> IssueID -> TestM a -> TestM a +expectBrokenIfGhc range ticket m = do + ghcVer <- isGhcVersion range + expectBrokenIf ghcVer ticket m + +flakyIfCI :: IssueID -> TestM a -> TestM a +flakyIfCI ticket m = do + ci <- liftIO isCI + flakyIf ci ticket m + +flakyIfWindows :: IssueID -> TestM a -> TestM a +flakyIfWindows ticket m = flakyIf isWindows ticket m getOpenFilesLimit :: TestM (Maybe Integer) #ifdef mingw32_HOST_OS @@ -964,29 +1151,6 @@ getOpenFilesLimit = liftIO $ do hasNewBuildCompatBootCabal :: TestM Bool hasNewBuildCompatBootCabal = isGhcVersion ">= 7.9" ------------------------------------------------------------------------- --- * Broken tests - -expectBroken :: Int -> TestM a -> TestM () -expectBroken ticket m = do - env <- getTestEnv - liftIO . withAsync (runReaderT m env) $ \a -> do - r <- waitCatch a - case r of - Left e -> do - putStrLn $ "This test is known broken, see #" ++ show ticket ++ ":" - print e - runReaderT expectedBroken env - Right _ -> do - runReaderT unexpectedSuccess env - -expectBrokenIf :: Bool -> Int -> TestM a -> TestM () -expectBrokenIf False _ m = void $ m -expectBrokenIf True ticket m = expectBroken ticket m - -expectBrokenUnless :: Bool -> Int -> TestM a -> TestM () -expectBrokenUnless b = expectBrokenIf (not b) - -- * Programs git :: String -> [String] -> TestM () @@ -1071,19 +1235,20 @@ withDelay m = do Just _ -> m -- | Create a symlink for the duration of the provided action. If the symlink --- already exists, it is deleted. Does not work on Windows. +-- already exists, it is deleted. withSymlink :: FilePath -> FilePath -> TestM a -> TestM a -#ifdef mingw32_HOST_OS +#if defined(mingw32_HOST_OS) && !MIN_VERSION_directory(1,3,1) withSymlink _oldpath _newpath _act = - error "PackageTests.PackageTester.withSymlink: does not work on Windows!" + error "Test.Cabal.Prelude.withSymlink: does not work on Windows with directory <1.3.1!" #else withSymlink oldpath newpath0 act = do + liftIO $ hPutStrLn stderr $ "Symlinking " <> oldpath <> " <== " <> newpath0 env <- getTestEnv let newpath = testCurrentDir env newpath0 symlinkExists <- liftIO $ doesFileExist newpath when symlinkExists $ liftIO $ removeFile newpath - bracket_ (liftIO $ createSymbolicLink oldpath newpath) - (liftIO $ removeFile newpath) act + bracket_ (liftIO $ createFileLink oldpath newpath) + (liftIO $ pure ()) act #endif writeSourceFile :: FilePath -> String -> TestM () @@ -1124,3 +1289,32 @@ findDependencyInStore pkgName = do [] -> error $ "Could not find " <> pkgName' <> " when searching for " <> pkgName' <> " in\n" <> show packageDirs (dir:_) -> dir pure (storeDir storeDirForGhcVersion libDir) + +-- | It can be easier to paste expected output verbatim into a text file, +-- especially if it is a multiline string, rather than encoding it as a multiline +-- string in Haskell source code. +-- +-- With `-XMultilineStrings` triple quoted strings with line breaks will be +-- easier to write in source code but then this will only work with ghc-9.12.1 +-- and later, in which case we'd have to use CPP with test scripts to support +-- older GHC versions. CPP doesn't play nicely with multiline strings using +-- string gaps. None of our test script import other modules. That might be a +-- way to avoid CPP in a module that uses multiline strings. +-- +-- In summary, it is easier to read multiline strings from a file. That is what +-- this function facilitates. +-- +-- The contents of the file are read strictly to avoid problems seen on Windows +-- deleting the file: +-- +-- > cabal.test.hs: +-- > C:\Users\\AppData\Local\Temp\cabal-testsuite-8376\errors.expect.txt: +-- > removePathForcibly:DeleteFile +-- > "\\\\?\\C:\\Users\\\\AppData\\Local\\Temp\\cabal-testsuite-8376\\errors.expect.txt": +-- > permission denied (The process cannot access the file because it is being +-- > used by another process.) +readFileVerbatim :: FilePath -> TestM String +readFileVerbatim filename = do + testDir <- testCurrentDir <$> getTestEnv + s <- liftIO . readFile $ testDir filename + length s `seq` return s diff --git a/cabal-testsuite/src/Test/Cabal/Run.hs b/cabal-testsuite/src/Test/Cabal/Run.hs index 37b27e9edf3..498c14ded23 100644 --- a/cabal-testsuite/src/Test/Cabal/Run.hs +++ b/cabal-testsuite/src/Test/Cabal/Run.hs @@ -54,6 +54,29 @@ runAction _verbosity mb_cwd env_overrides path0 args input action = do mb_env <- getEffectiveEnvironment env_overrides putStrLn $ "+ " ++ showCommandForUser path args (readh, writeh) <- createPipe + + -- `System.Process.createPipe` calls (through many intermediaries) + -- `GHC.IO.Handle.FD.fdToHandle`, whose documentation says: + -- + -- > Makes a binary Handle. This is for historical reasons; it should + -- > probably be a text Handle with the default encoding and newline + -- > translation instead. + -- + -- The documentation for `System.IO.hSetBinaryMode` says: + -- + -- > This has the same effect as calling `hSetEncoding` with `char8`, together + -- > with `hSetNewlineMode` with `noNewlineTranslation`. + -- + -- But this is a lie, and Unicode written to or read from binary handles is + -- always encoded or decoded as Latin-1, which is always the wrong choice. + -- + -- Therefore, we explicitly set the output to UTF-8 to keep it consistent + -- between platforms and correct on all modern computers. + -- + -- See: https://gitlab.haskell.org/ghc/ghc/-/issues/25307 + hSetEncoding readh utf8 + hSetEncoding writeh utf8 + hSetBuffering readh LineBuffering hSetBuffering writeh LineBuffering let drain = do diff --git a/cabal-testsuite/src/Test/Cabal/Script.hs b/cabal-testsuite/src/Test/Cabal/Script.hs index 15e17ed2b94..a478d5008af 100644 --- a/cabal-testsuite/src/Test/Cabal/Script.hs +++ b/cabal-testsuite/src/Test/Cabal/Script.hs @@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE RankNTypes #-} -{-# LANGUAGE TypeApplications #-} -- | Functionality for invoking Haskell scripts with the correct -- package database setup. @@ -35,7 +34,7 @@ import qualified Data.Monoid as M -- parameters for invoking GHC. Mostly subset of 'LocalBuildInfo'. data ScriptEnv = ScriptEnv { runnerProgramDb :: ProgramDb - , runnerPackageDbStack :: PackageDBStack + , runnerPackageDbStack :: PackageDBStackCWD , runnerVerbosity :: Verbosity , runnerPlatform :: Platform , runnerCompiler :: Compiler @@ -97,7 +96,7 @@ runnerGhcArgs :: ScriptEnv -> Maybe FilePath -> [String] runnerGhcArgs senv mb_cwd = renderGhcOptions (runnerCompiler senv) (runnerPlatform senv) ghc_options where - ghc_options = M.mempty { ghcOptPackageDBs = runnerPackageDbStack senv + ghc_options = M.mempty { ghcOptPackageDBs = fmap (fmap makeSymbolicPath) (runnerPackageDbStack senv) , ghcOptPackages = toNubListR (runnerPackages senv) , ghcOptHideAllPackages = Flag True -- Avoid picking stray module files that look diff --git a/cabal-testsuite/src/Test/Cabal/Server.hs b/cabal-testsuite/src/Test/Cabal/Server.hs index 76387a2bae1..d7022ed9563 100644 --- a/cabal-testsuite/src/Test/Cabal/Server.hs +++ b/cabal-testsuite/src/Test/Cabal/Server.hs @@ -1,7 +1,6 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE ScopedTypeVariables #-} -{-# LANGUAGE TypeApplications #-} {-# LANGUAGE NondecreasingIndentation #-} -- | A GHC run-server, which supports running multiple GHC scripts -- without having to restart from scratch. diff --git a/cabal-testsuite/src/Test/Cabal/TestCode.hs b/cabal-testsuite/src/Test/Cabal/TestCode.hs index e29c9ea6b45..ddaa0239465 100644 --- a/cabal-testsuite/src/Test/Cabal/TestCode.hs +++ b/cabal-testsuite/src/Test/Cabal/TestCode.hs @@ -1,16 +1,21 @@ -{-# LANGUAGE CPP #-} -{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE CPP #-} +{-# LANGUAGE DerivingStrategies #-} +{-# LANGUAGE GeneralizedNewtypeDeriving #-} + -- | Exception type like 'ExitCode' but with more information -- than just integer. module Test.Cabal.TestCode ( -- * TestCode TestCode (..), + FlakyStatus (..), + IssueID (..), displayTestCode, isTestCodeSkip, + isTestCodeFlaky, + isTestCodeUnexpectedSuccess, ) where import Control.Exception (Exception (..)) -import Data.Typeable (Typeable) ------------------------------------------------------------------------------- -- TestCode @@ -19,24 +24,44 @@ import Data.Typeable (Typeable) data TestCode = TestCodeOk | TestCodeSkip String - | TestCodeKnownFail - | TestCodeUnexpectedOk + | TestCodeKnownFail IssueID + | TestCodeUnexpectedOk IssueID | TestCodeFail - deriving (Eq, Show, Read, Typeable) + | TestCodeFlakyFailed IssueID + | TestCodeFlakyPassed IssueID + deriving (Eq, Show, Read) instance Exception TestCode -#if MIN_VERSION_base(4,8,0) where displayException = displayTestCode -#endif displayTestCode :: TestCode -> String -displayTestCode TestCodeOk = "OK" -displayTestCode (TestCodeSkip msg) = "SKIP " ++ msg -displayTestCode TestCodeKnownFail = "OK (known failure)" -displayTestCode TestCodeUnexpectedOk = "FAIL (unexpected success)" -displayTestCode TestCodeFail = "FAIL" +displayTestCode TestCodeOk = "OK" +displayTestCode (TestCodeSkip msg) = "SKIP " ++ msg +displayTestCode (TestCodeKnownFail t) = "OK (known failure, see #" <> show t <> ")" +displayTestCode (TestCodeUnexpectedOk t) = "FAIL (unexpected success, see #" <> show t <> ")" +displayTestCode TestCodeFail = "FAIL" +displayTestCode (TestCodeFlakyFailed t) = "FLAKY (FAIL, see #" <> show t <> ")" +displayTestCode (TestCodeFlakyPassed t) = "FLAKY (OK, see #" <> show t <> ")" isTestCodeSkip :: TestCode -> Bool isTestCodeSkip (TestCodeSkip _) = True isTestCodeSkip _ = False + +type TestPassed = Bool + +newtype IssueID = IssueID Int + deriving newtype (Eq, Num, Show, Read) + +data FlakyStatus + = NotFlaky + | Flaky TestPassed IssueID + +isTestCodeFlaky :: TestCode -> FlakyStatus +isTestCodeFlaky (TestCodeFlakyPassed t) = Flaky True t +isTestCodeFlaky (TestCodeFlakyFailed t) = Flaky False t +isTestCodeFlaky _ = NotFlaky + +isTestCodeUnexpectedSuccess :: TestCode -> Maybe IssueID +isTestCodeUnexpectedSuccess (TestCodeUnexpectedOk t) = Just t +isTestCodeUnexpectedSuccess _ = Nothing diff --git a/cabal-testsuite/src/Test/Cabal/Workdir.hs b/cabal-testsuite/src/Test/Cabal/Workdir.hs index bbb545c6494..148508eb606 100644 --- a/cabal-testsuite/src/Test/Cabal/Workdir.hs +++ b/cabal-testsuite/src/Test/Cabal/Workdir.hs @@ -15,9 +15,8 @@ import Distribution.Utils.Path ) import System.Directory -import System.FilePath - import System.Environment ( getExecutablePath ) +import System.FilePath -- | Guess what the dist directory of a running executable is, -- by using the conventional layout of built executables diff --git a/cabal-validate/README.md b/cabal-validate/README.md new file mode 100644 index 00000000000..5f40e9d28f1 --- /dev/null +++ b/cabal-validate/README.md @@ -0,0 +1,23 @@ +# cabal-validate + +`cabal-validate` is a script that builds and tests `Cabal` and `cabal-install`. +`cabal-validate` can be run with `validate.sh` in the repository root; +arguments passed to `validate.sh` will be forwarded to `cabal-validate`. + +Notable arguments include: + +- `-v`/`--verbose` to display build and test output in real-time, instead of + only if commands fail. +- `-s`/`--step` to run a specific step (e.g. `-s build -s lib-tests` will only + run the `build` and `lib-tests` steps). +- `-p`/`--pattern` to filter tests by a pattern. + +## Hacking on cabal-validate + +Overview of important modules: + +- `Main.hs` encodes all the commands that are run for each step. +- `Cli.hs` parses the CLI arguments and resolves default values from the + environment, like determining which steps are run by default or the `--jobs` + argument to pass to test suites. +- `Step.hs` lists the available steps. diff --git a/cabal-validate/cabal-validate.cabal b/cabal-validate/cabal-validate.cabal new file mode 100644 index 00000000000..582cf67434a --- /dev/null +++ b/cabal-validate/cabal-validate.cabal @@ -0,0 +1,47 @@ +cabal-version: 3.0 +name: cabal-validate +version: 1.0.0 +copyright: 2024-2024, Cabal Development Team (see AUTHORS file) +license: BSD-3-Clause +author: Cabal Development Team +synopsis: An internal tool for building and testing the Cabal package manager +build-type: Simple + +common common + ghc-options: -Wall + + if impl(ghc <9.6) + -- Pattern exhaustiveness checker is not as good, misses a case. + ghc-options: -Wno-incomplete-patterns + + default-language: Haskell2010 + default-extensions: + OverloadedStrings + , TypeApplications + +executable cabal-validate + import: common + ghc-options: -O -threaded -rtsopts -with-rtsopts=-N + + main-is: Main.hs + hs-source-dirs: src + + other-modules: + , ANSI + , Cli + , ClockUtil + , OutputUtil + , ProcessUtil + , Step + + build-depends: + , base >=4 && <5 + , bytestring >=0.11 && <1 + , containers >=0.6 && <1 + , directory >=1.0 && <2 + , filepath >=1 && <2 + , optparse-applicative >=0.18 && <1 + , terminal-size >=0.3 && <1 + , text >=2 && <3 + , time >=1 && <2 + , typed-process >=0.2 && <1 diff --git a/cabal-validate/src/ANSI.hs b/cabal-validate/src/ANSI.hs new file mode 100644 index 00000000000..a0d9111d957 --- /dev/null +++ b/cabal-validate/src/ANSI.hs @@ -0,0 +1,105 @@ +-- | ANSI escape sequences. +-- +-- This is a stripped-down version of the parts of the @ansi-terminal@ package +-- we use. +-- +-- See: +module ANSI + ( SGR (..) + , setSGR + ) where + +-- | Render a single numeric SGR sequence. +rawSGR :: Int -> String +rawSGR code = "\x1b[" <> show code <> "m" + +-- | Render a series of `SGR` escape sequences. +setSGR :: [SGR] -> String +setSGR = concat . map renderSGR + +-- | All of the SGR sequences we want to use. +data SGR + = Reset + | Bold + | Dim + | Italic + | Underline + | Black + | Red + | Green + | Yellow + | Blue + | Magenta + | Cyan + | White + | Default + | OnBlack + | OnRed + | OnGreen + | OnYellow + | OnBlue + | OnMagenta + | OnCyan + | OnWhite + | OnDefault + | BrightBlack + | BrightRed + | BrightGreen + | BrightYellow + | BrightBlue + | BrightMagenta + | BrightCyan + | BrightWhite + | OnBrightBlack + | OnBrightRed + | OnBrightGreen + | OnBrightYellow + | OnBrightBlue + | OnBrightMagenta + | OnBrightCyan + | OnBrightWhite + deriving (Show) + +-- Render a single `SGR` sequence. +renderSGR :: SGR -> String +renderSGR code = + case code of + Reset -> rawSGR 0 + Bold -> rawSGR 1 + Dim -> rawSGR 2 + Italic -> rawSGR 3 + Underline -> rawSGR 4 + Black -> rawSGR 30 + Red -> rawSGR 31 + Green -> rawSGR 32 + Yellow -> rawSGR 33 + Blue -> rawSGR 34 + Magenta -> rawSGR 35 + Cyan -> rawSGR 36 + White -> rawSGR 37 + Default -> rawSGR 39 + OnBlack -> rawSGR 40 + OnRed -> rawSGR 41 + OnGreen -> rawSGR 42 + OnYellow -> rawSGR 43 + OnBlue -> rawSGR 44 + OnMagenta -> rawSGR 45 + OnCyan -> rawSGR 46 + OnWhite -> rawSGR 47 + OnDefault -> rawSGR 49 + BrightBlack -> rawSGR 90 + BrightRed -> rawSGR 91 + BrightGreen -> rawSGR 92 + BrightYellow -> rawSGR 93 + BrightBlue -> rawSGR 94 + BrightMagenta -> rawSGR 95 + BrightCyan -> rawSGR 96 + BrightWhite -> rawSGR 97 + OnBrightBlack -> rawSGR 100 + OnBrightRed -> rawSGR 101 + OnBrightGreen -> rawSGR 102 + OnBrightYellow -> rawSGR 103 + OnBrightBlue -> rawSGR 104 + OnBrightMagenta -> rawSGR 105 + OnBrightCyan -> rawSGR 106 + OnBrightWhite -> rawSGR 107 diff --git a/cabal-validate/src/Cli.hs b/cabal-validate/src/Cli.hs new file mode 100644 index 00000000000..7e0e0e8ab72 --- /dev/null +++ b/cabal-validate/src/Cli.hs @@ -0,0 +1,469 @@ +-- | Parse CLI arguments and resolve defaults from the environment. +module Cli + ( Opts (..) + , parseOpts + , HackageTests (..) + , Compiler (..) + , VersionParseException (..) + , Verbosity (..) + , whenVerbose + ) +where + +import Control.Applicative (Alternative (many, (<|>)), (<**>)) +import Control.Exception (Exception (displayException), throw) +import Control.Monad (forM_, when) +import Data.Maybe (listToMaybe) +import qualified Data.Text as T +import qualified Data.Text.Lazy as T (toStrict) +import qualified Data.Text.Lazy.Encoding as T (decodeUtf8) +import Data.Version (Version, parseVersion) +import GHC.Conc (getNumCapabilities) +import Options.Applicative + ( FlagFields + , Mod + , Parser + , ParserInfo + , auto + , execParser + , flag + , flag' + , fullDesc + , help + , helper + , hidden + , info + , long + , maybeReader + , option + , progDesc + , short + , strOption + , switch + , value + ) +import qualified Options.Applicative as Opt +import System.Directory (getCurrentDirectory) +import System.Exit (exitSuccess) +import System.Info (arch, os) +import System.Process.Typed (proc, readProcessStdout_) +import Text.ParserCombinators.ReadP (readP_to_S) + +import ClockUtil (AbsoluteTime, getAbsoluteTime) +import Step (Step (..), displayStep, parseStep) + +-- | Command-line options, resolved with context from the environment. +data Opts = Opts + { verbosity :: Verbosity + -- ^ Whether to display build and test output. + , jobs :: Int + -- ^ How many jobs to use when running tests. + -- + -- Defaults to the number of physical cores. + , cwd :: FilePath + -- ^ Current working directory when @cabal-validate@ was started. + , startTime :: AbsoluteTime + -- ^ System time when @cabal-validate@ was started. + -- + -- Used to determine the total test duration so far. + , compiler :: Compiler + -- ^ Compiler to build Cabal with. + -- + -- Defaults to @ghc@. + , extraCompilers :: [FilePath] + -- ^ Extra compilers to run @cabal-testsuite@ with. + , cabal :: FilePath + -- ^ @cabal-install@ to build Cabal with. + -- + -- Defaults to @cabal@. + , hackageTests :: HackageTests + -- ^ Whether to run tests on Hackage data, and if so how much. + -- + -- Defaults to `NoHackageTests`. + , archPath :: FilePath + -- ^ The path for this system's architecture within the build directory. + -- + -- Like @x86_64-windows@ or @aarch64-osx@ or @arm-linux@. + , projectFile :: FilePath + -- ^ Path to the @cabal.project@ file to use for running tests. + , tastyArgs :: [String] + -- ^ Extra arguments to pass to @tasty@ test suites. + -- + -- This defaults to @--hide-successes@ (which cannot yet be changed) and + -- includes the @--pattern@ argument if one is given. + , targets :: [String] + -- ^ Targets to build. + , steps :: [Step] + -- ^ Steps to run. + } + deriving (Show) + +-- | Whether to run tests on Hackage data, and if so how much. +data HackageTests + = -- | Run tests on complete Hackage data. + CompleteHackageTests + | -- | Run tests on partial Hackage data. + PartialHackageTests + | -- | Do not run tests on Hackage data. + NoHackageTests + deriving (Show) + +-- | A compiler executable and version number. +data Compiler = Compiler + { compilerExecutable :: FilePath + -- ^ The compiler's executable. + , compilerVersion :: Version + -- ^ The compiler's version number. + } + deriving (Show) + +-- | A verbosity level, for log output. +data Verbosity + = Quiet + | Info + | Verbose + deriving (Show, Eq, Ord) + +-- | Run an action only if the `verbosity` is `Verbose` or higher. +whenVerbose :: Applicative f => Opts -> f () -> f () +whenVerbose opts action = when (verbosity opts >= Verbose) action + +-- | An `Exception` thrown when parsing @--numeric-version@ output from a compiler. +data VersionParseException = VersionParseException + { versionInput :: String + -- ^ The string we attempted to parse. + , versionExecutable :: FilePath + -- ^ The compiler which produced the string. + } + deriving (Show) + +instance Exception VersionParseException where + displayException exception = + "Failed to parse `" + <> versionExecutable exception + <> " --numeric-version` output: " + <> show (versionInput exception) + +-- | Runs @ghc --numeric-version@ for the given executable to construct a +-- `Compiler`. +makeCompiler :: FilePath -> IO Compiler +makeCompiler executable = do + stdout <- + readProcessStdout_ $ + proc executable ["--numeric-version"] + let version = T.unpack $ T.strip $ T.toStrict $ T.decodeUtf8 stdout + parsedVersions = readP_to_S parseVersion version + -- Who needs error messages? Those aren't in the API. + maybeParsedVersion = + listToMaybe + [ parsed + | (parsed, []) <- parsedVersions + ] + parsedVersion = case maybeParsedVersion of + Just parsedVersion' -> parsedVersion' + Nothing -> + throw + VersionParseException + { versionInput = version + , versionExecutable = executable + } + + pure + Compiler + { compilerExecutable = executable + , compilerVersion = parsedVersion + } + +-- | Resolve options and default values from the environment. +-- +-- This makes the `Opts` type much nicer to deal with than `RawOpts`. +resolveOpts :: RawOpts -> IO Opts +resolveOpts opts = do + let optionals :: Bool -> [a] -> [a] + optionals True items = items + optionals False _ = [] + + optional :: Bool -> a -> [a] + optional keep item = optionals keep [item] + + steps' = + if not (null (rawSteps opts)) + then rawSteps opts + else + concat + [ [Build] + , optional (rawDoctest opts) Doctest + , optional (rawRunLibTests opts) LibTests + , optional (rawRunLibSuite opts) LibSuite + , optional (rawRunLibSuite opts && not (null (rawExtraCompilers opts))) LibSuiteExtras + , optional (rawRunCliTests opts && not (rawLibOnly opts)) CliTests + , optional (rawRunCliSuite opts && not (rawLibOnly opts)) CliSuite + , optionals (rawSolverBenchmarks opts) [SolverBenchmarksTests, SolverBenchmarksRun] + ] + + targets' = + concat + [ + [ "Cabal" + , "Cabal-hooks" + , "cabal-testsuite" + , "Cabal-tests" + , "Cabal-QuickCheck" + , "Cabal-tree-diff" + , "Cabal-described" + ] + , optionals + (not (rawLibOnly opts)) + [ "cabal-install" + , "cabal-install-solver" + , "cabal-benchmarks" + ] + , optionals + (rawSolverBenchmarks opts) + [ "solver-benchmarks" + , "solver-benchmarks:tests" + ] + ] + + archPath' = + let osPath = + case os of + "darwin" -> "osx" + "linux" -> "linux" + "mingw32" -> "windows" + _ -> os -- TODO: Warning? + in arch <> "-" <> osPath + + projectFile' = + if rawLibOnly opts + then "cabal.validate-libonly.project" + else "cabal.validate.project" + + tastyArgs' = + maybe + -- If neither `--hide-successes` or `--no-hide-successes` was given, then + -- only `--hide-successes` if `--quiet` is given. + (optional (rawVerbosity opts <= Quiet) "--hide-successes") + (\hideSuccesses -> optional hideSuccesses "--hide-successes") + (rawTastyHideSuccesses opts) + ++ maybe + [] + (\tastyPattern -> ["--pattern", tastyPattern]) + (rawTastyPattern opts) + ++ rawTastyArgs opts + + when (rawListSteps opts) $ do + -- TODO: This should probably list _all_ available steps, not just the selected ones! + putStrLn "Targets:" + forM_ targets' $ \target -> do + putStrLn $ " " <> target + putStrLn "Steps:" + forM_ steps' $ \step -> do + putStrLn $ " " <> displayStep step + exitSuccess + + startTime' <- getAbsoluteTime + jobs' <- maybe getNumCapabilities pure (rawJobs opts) + cwd' <- getCurrentDirectory + compiler' <- makeCompiler (rawCompiler opts) + + pure + Opts + { verbosity = rawVerbosity opts + , jobs = jobs' + , cwd = cwd' + , startTime = startTime' + , compiler = compiler' + , extraCompilers = rawExtraCompilers opts + , cabal = rawCabal opts + , archPath = archPath' + , projectFile = projectFile' + , hackageTests = rawHackageTests opts + , tastyArgs = tastyArgs' + , targets = targets' + , steps = steps' + } + +-- | Literate command-line options as supplied by the user, before resolving +-- defaults and other values from the environment. +data RawOpts = RawOpts + { rawVerbosity :: Verbosity + , rawJobs :: Maybe Int + , rawCompiler :: FilePath + , rawCabal :: FilePath + , rawExtraCompilers :: [FilePath] + , rawTastyPattern :: Maybe String + , rawTastyArgs :: [String] + , rawTastyHideSuccesses :: Maybe Bool + , rawDoctest :: Bool + , rawSteps :: [Step] + , rawListSteps :: Bool + , rawLibOnly :: Bool + , rawRunLibTests :: Bool + , rawRunCliTests :: Bool + , rawRunLibSuite :: Bool + , rawRunCliSuite :: Bool + , rawSolverBenchmarks :: Bool + , rawHackageTests :: HackageTests + } + deriving (Show) + +-- | `Parser` for `RawOpts`. +-- +-- See: `fullRawOptsParser` +rawOptsParser :: Parser RawOpts +rawOptsParser = + RawOpts + <$> ( flag' + Verbose + ( short 'v' + <> long "verbose" + <> help "Always display build and test output" + ) + <|> flag + Info + Quiet + ( short 'q' + <> long "quiet" + <> help "Silence build and test output" + ) + ) + <*> option + (Just <$> auto) + ( short 'j' + <> long "jobs" + <> help "Passed to `cabal build --jobs`" + <> value Nothing + ) + <*> strOption + ( short 'w' + <> long "with-compiler" + <> help "Build Cabal with the given compiler instead of `ghc`" + <> value "ghc" + ) + <*> strOption + ( long "with-cabal" + <> help "Test the given `cabal-install` (the `cabal` on your `$PATH` is used for builds)" + <> value "cabal" + ) + <*> many + ( strOption + ( long "extra-hc" + <> help "Extra compilers to run the test suites against" + ) + ) + <*> option + (Just <$> Opt.str) + ( short 'p' + <> long "pattern" + <> help "Pattern to filter tests by" + <> value Nothing + ) + <*> many + ( strOption + ( long "tasty-arg" + <> help "Extra arguments to pass to Tasty test suites" + ) + ) + <*> maybeBoolOption + "hide-successes" + ( help "Do not print tests that passed successfully" + ) + <*> boolOption + False + "doctest" + ( help "Run doctest on the `Cabal` library" + ) + <*> many + ( option + (maybeReader parseStep) + ( short 's' + <> long "step" + <> help "Run only a specific step (can be specified multiple times)" + ) + ) + <*> switch + ( long "list-steps" + <> help "List the available steps and exit" + ) + <*> ( flag' + True + ( long "lib-only" + <> help "Test only `Cabal` (the library)" + ) + <|> flag + False + False + ( long "cli" + <> help "Test `cabal-install` (the executable) in addition to `Cabal` (the library)" + ) + ) + <*> boolOption + True + "run-lib-tests" + ( help "Run tests for the `Cabal` library" + ) + <*> boolOption + True + "run-cli-tests" + ( help "Run client tests for the `cabal-install` executable" + ) + <*> boolOption + False + "run-lib-suite" + ( help "Run `cabal-testsuite` with the `Cabal` library" + ) + <*> boolOption + False + "run-cli-suite" + ( help "Run `cabal-testsuite` with the `cabal-install` executable" + ) + <*> boolOption + False + "solver-benchmarks" + ( help "Build and trial run `solver-benchmarks`" + ) + <*> ( flag' + CompleteHackageTests + ( long "complete-hackage-tests" + <> help "Run `hackage-tests` on complete Hackage data" + ) + <|> flag + NoHackageTests + PartialHackageTests + ( long "partial-hackage-tests" + <> help "Run `hackage-tests` on parts of Hackage data" + ) + ) + +-- | Parse a boolean switch with separate names for the true and false options. +boolOption' :: Bool -> String -> String -> Mod FlagFields Bool -> Parser Bool +boolOption' defaultValue trueName falseName modifiers = + flag' True (modifiers <> long trueName) + <|> flag defaultValue False (modifiers <> hidden <> long falseName) + +-- | Parse a boolean switch with a @--no-*@ flag for setting the option to false. +boolOption :: Bool -> String -> Mod FlagFields Bool -> Parser Bool +boolOption defaultValue trueName = + boolOption' defaultValue trueName ("no-" <> trueName) + +-- | Like `boolOption`, but can tell if an option was passed or not. +maybeBoolOption :: String -> Mod FlagFields (Maybe Bool) -> Parser (Maybe Bool) +maybeBoolOption trueName modifiers = + flag' (Just True) (modifiers <> long trueName) + <|> flag Nothing (Just False) (modifiers <> hidden <> long ("no-" <> trueName)) + +-- | Full `Parser` for `RawOpts`, which includes a @--help@ argument and +-- information about the program. +fullRawOptsParser :: ParserInfo RawOpts +fullRawOptsParser = + info + (rawOptsParser <**> helper) + ( fullDesc + <> progDesc "Test suite runner for `Cabal` and `cabal-install` developers" + ) + +-- | Parse command-line arguments and resolve defaults from the environment, +-- producing `Opts`. +parseOpts :: IO Opts +parseOpts = execParser fullRawOptsParser >>= resolveOpts diff --git a/cabal-validate/src/ClockUtil.hs b/cabal-validate/src/ClockUtil.hs new file mode 100644 index 00000000000..2df7cdd9866 --- /dev/null +++ b/cabal-validate/src/ClockUtil.hs @@ -0,0 +1,33 @@ +-- | Utilities for dealing with times and durations. +module ClockUtil + ( DiffTime + , AbsoluteTime + , diffAbsoluteTime + , getAbsoluteTime + , formatDiffTime + ) where + +import Data.Time.Clock (DiffTime, secondsToDiffTime) +import Data.Time.Clock.System (getSystemTime, systemToTAITime) +import Data.Time.Clock.TAI (AbsoluteTime, diffAbsoluteTime) +import Data.Time.Format (defaultTimeLocale, formatTime) + +-- | Get the current time as an `AbsoluteTime`. +getAbsoluteTime :: IO AbsoluteTime +getAbsoluteTime = systemToTAITime <$> getSystemTime + +-- | Format a `DiffTime` nicely. +-- +-- Short durations are formatted like @16.34s@, durations longer than a minute +-- are formatted like @22:34.68@, durations longer than an hour are formatted +-- like @1:32:04.68@. +formatDiffTime :: DiffTime -> String +formatDiffTime delta = + let minute = secondsToDiffTime 60 + hour = 60 * minute + in if delta >= hour + then formatTime defaultTimeLocale "%h:%02M:%02ES" delta + else + if delta >= minute + then formatTime defaultTimeLocale "%m:%2ES" delta + else formatTime defaultTimeLocale "%2Ess" delta diff --git a/cabal-validate/src/Main.hs b/cabal-validate/src/Main.hs new file mode 100644 index 00000000000..7164f3f8cc4 --- /dev/null +++ b/cabal-validate/src/Main.hs @@ -0,0 +1,430 @@ +-- | Entry-point to the @cabal-validate@ script. +-- +-- This module encodes all the commands that are run for each step in +-- `runStep`. +module Main + ( main + , runStep + ) where + +import Control.Monad (forM_) +import qualified Data.Text as T +import qualified Data.Text.IO as T +import qualified Data.Text.Lazy as T (toStrict) +import qualified Data.Text.Lazy.Encoding as T (decodeUtf8) +import Data.Version (makeVersion, showVersion) +import System.FilePath (()) +import System.IO (BufferMode (LineBuffering), hSetBuffering, stderr, stdout) +import System.Process.Typed (proc, readProcessStdout_) + +import Cli (Compiler (..), HackageTests (..), Opts (..), parseOpts, whenVerbose) +import OutputUtil (printHeader, withTiming) +import ProcessUtil (timed, timedWithCwd) +import Step (Step (..), displayStep) + +-- | Entry-point for @cabal-validate@. +main :: IO () +main = do + -- You'd _think_ that line-buffering for stdout and stderr would be the + -- default behavior, and the documentation makes gestures at it, but it + -- appears to not be the case! + -- + -- > For most implementations, physical files will normally be + -- > block-buffered and terminals will normally be line-buffered. + -- + -- However, on GitHub Actions and on my machine (macOS M1), adding these + -- lines makes output appear in the correct order! + hSetBuffering stdout LineBuffering + hSetBuffering stderr LineBuffering + + opts <- parseOpts + printConfig opts + printToolVersions opts + forM_ (steps opts) $ \step -> do + runStep opts step + +-- | Run a given `Step` with the given `Opts`. +runStep :: Opts -> Step -> IO () +runStep opts step = do + let title = displayStep step + printHeader title + let action = case step of + Build -> build opts + Doctest -> doctest opts + LibTests -> libTests opts + LibSuite -> libSuite opts + LibSuiteExtras -> libSuiteExtras opts + CliSuite -> cliSuite opts + CliTests -> cliTests opts + SolverBenchmarksTests -> solverBenchmarksTests opts + SolverBenchmarksRun -> solverBenchmarksRun opts + withTiming (startTime opts) title action + T.putStrLn "" + +-- | Compiler with version number like @ghc-9.6.6@. +baseHc :: Opts -> FilePath +baseHc opts = "ghc-" <> showVersion (compilerVersion $ compiler opts) + +-- | Base build directory for @cabal-validate@. +baseBuildDir :: Opts -> FilePath +baseBuildDir opts = "dist-newstyle-validate-" <> baseHc opts + +-- | Absolute path to the build directory for this architecture. +-- +-- This is a path nested fairly deeply under `baseBuildDir`. +buildDir :: Opts -> FilePath +buildDir opts = + cwd opts + baseBuildDir opts + "build" + archPath opts + baseHc opts + +-- | @--num-threads@ argument for test suites. +-- +-- This isn't always used because some test suites are finicky and only accept +-- @-j@. +jobsArgs :: Opts -> [String] +jobsArgs opts = ["--num-threads", show $ jobs opts] + +-- | Default arguments for invoking @cabal@. +cabalArgs :: Opts -> [String] +cabalArgs opts = + [ "--jobs=" <> show (jobs opts) + , "--with-compiler=" <> compilerExecutable (compiler opts) + , "--builddir=" <> baseBuildDir opts + , "--project-file=" <> projectFile opts + ] + +-- | The `buildDir` for @cabal-testsuite-3@. +cabalTestsuiteBuildDir :: Opts -> FilePath +cabalTestsuiteBuildDir opts = + buildDir opts + "cabal-testsuite-3" + +-- | Arguments for @cabal build@. +cabalNewBuildArgs :: Opts -> [String] +cabalNewBuildArgs opts = "build" : cabalArgs opts + +-- | Arguments for @cabal list-bin@. +-- +-- This is used to find the binaries for various test suites. +cabalListBinArgs :: Opts -> [String] +cabalListBinArgs opts = "list-bin" : cabalArgs opts + +-- | Get the binary for a given @cabal@ target by running @cabal list-bin@. +cabalListBin :: Opts -> String -> IO FilePath +cabalListBin opts target = do + let args = cabalListBinArgs opts ++ [target] + stdout' <- + readProcessStdout_ $ + proc (cabal opts) args + + pure (T.unpack $ T.strip $ T.toStrict $ T.decodeUtf8 stdout') + +-- | Get the RTS arguments for invoking test suites. +-- +-- These seem to only be used for some of the test suites, I'm not sure why. +rtsArgs :: Opts -> [String] +rtsArgs opts = + case archPath opts of + "x86_64-windows" -> + -- See: https://github.com/haskell/cabal/issues/9571 + if compilerVersion (compiler opts) > makeVersion [9, 0, 2] + then ["+RTS", "--io-manager=native", "-RTS"] + else [] + _ -> [] + +-- | Run a binary built by @cabal@ and output timing information. +-- +-- This is used to run many of the test suites. +timedCabalBin :: Opts -> String -> String -> [String] -> IO () +timedCabalBin opts package component args = do + command <- cabalListBin opts (package <> ":" <> component) + timedWithCwd + opts + package + command + args + +-- | Print the configuration for CI logs. +printConfig :: Opts -> IO () +printConfig opts = + whenVerbose opts $ do + printHeader "Configuration" + putStr $ + unlines + [ "compiler: " + <> compilerExecutable (compiler opts) + , "cabal-install: " + <> cabal opts + , "jobs: " + <> show (jobs opts) + , "steps: " + <> unwords (map displayStep (steps opts)) + , "Hackage tests: " + <> show (hackageTests opts) + , "verbosity: " + <> show (verbosity opts) + , "extra compilers: " + <> unwords (extraCompilers opts) + , "extra RTS options: " + <> unwords (rtsArgs opts) + ] + +-- | Print the versions of tools being used. +printToolVersions :: Opts -> IO () +printToolVersions opts = + whenVerbose opts $ do + printHeader "Tool versions" + timed opts (cabal opts) ["--version"] + timed opts (compilerExecutable (compiler opts)) ["--version"] + + forM_ (extraCompilers opts) $ \compiler' -> do + timed opts compiler' ["--version"] + +-- | Run the build step. +build :: Opts -> IO () +build opts = do + whenVerbose opts $ do + printHeader "build (dry run)" + timed + opts + (cabal opts) + ( cabalNewBuildArgs opts + ++ targets opts + ++ ["--dry-run"] + ) + + printHeader "build (full build plan; cached and to-be-built dependencies)" + timed + opts + "jq" + [ "-r" + , -- TODO: Maybe use `cabal-plan`? It's a heavy dependency though... + ".\"install-plan\" | map(.\"pkg-name\" + \"-\" + .\"pkg-version\" + \" \" + .\"component-name\") | join(\"\n\")" + , baseBuildDir opts "cache" "plan.json" + ] + + printHeader "build (actual build)" + timed + opts + (cabal opts) + (cabalNewBuildArgs opts ++ targets opts) + +-- | Run doctests. +-- +-- This doesn't work on my machine, maybe @cabal.nix@ needs some love to +-- support @cabal-env@? +doctest :: Opts -> IO () +doctest opts = do + timed + opts + "cabal-env" + [ "--name" + , "doctest-cabal" + , "--transitive" + , "QuickCheck" + ] + + timed + opts + "cabal-env" + [ "--name" + , "doctest-cabal" + , "array" + , "bytestring" + , "containers" + , "deepseq" + , "directory" + , "filepath" + , "pretty" + , "process" + , "time" + , "binary" + , "unix" + , "text" + , "parsec" + , "mtl" + ] + + timed + opts + "doctest" + [ "-package-env=doctest-Cabal" + , "--fast" + , "Cabal/Distribution" + , "Cabal/Language" + ] + +-- | Run tests for the @Cabal@ library, and also `runHackageTests` if those are +-- enabled. +libTests :: Opts -> IO () +libTests opts = do + let runCabalTests' suite extraArgs = + timedCabalBin + opts + "Cabal-tests" + ("test:" <> suite) + ( tastyArgs opts + ++ jobsArgs opts + ++ extraArgs + ) + + runCabalTests suite = runCabalTests' suite [] + + runCabalTests' "unit-tests" ["--with-ghc=" <> compilerExecutable (compiler opts)] + runCabalTests "check-tests" + runCabalTests "parser-tests" + runCabalTests "rpmvercmp" + runCabalTests "no-thunks-test" + + runHackageTests opts + +-- | Run Hackage tests, if enabled. +runHackageTests :: Opts -> IO () +runHackageTests opts + | NoHackageTests <- hackageTests opts = pure () + | otherwise = do + command <- cabalListBin opts "Cabal-tests:test:hackage-tests" + + let + -- See #10284 for why this value is pinned. + hackageTestsIndexState = "--index-state=2024-08-25" + + hackageTest args = + timedWithCwd + opts + "Cabal-tests" + command + (args ++ [hackageTestsIndexState]) + + hackageTest ["read-fields"] + + case hackageTests opts of + CompleteHackageTests -> do + hackageTest ["parsec"] + hackageTest ["roundtrip"] + PartialHackageTests -> do + hackageTest ["parsec", "d"] + hackageTest ["roundtrip", "k"] + +-- | Run @cabal-testsuite@ with the @Cabal@ library with a non-default GHC. +libSuiteWith :: Opts -> FilePath -> [String] -> IO () +libSuiteWith opts ghc extraArgs = + timedCabalBin + opts + "cabal-testsuite" + "exe:cabal-tests" + ( [ "--builddir=" <> cabalTestsuiteBuildDir opts + , "--with-ghc=" <> ghc + , -- This test suite doesn't support `--jobs` _or_ `--num-threads`! + "-j" <> show (jobs opts) + ] + ++ tastyArgs opts + ++ extraArgs + ) + +-- | Run @cabal-testsuite@ with the @Cabal@ library with the default GHC. +libSuite :: Opts -> IO () +libSuite opts = libSuiteWith opts (compilerExecutable (compiler opts)) (rtsArgs opts) + +-- | Run @cabal-testsuite@ with the @Cabal@ library with all extra GHCs. +libSuiteExtras :: Opts -> IO () +libSuiteExtras opts = forM_ (extraCompilers opts) $ \compiler' -> + libSuiteWith opts compiler' [] + +-- | Test the @cabal-install@ executable. +-- +-- These tests mostly run sequentially, so they're pretty slow as a result. +cliTests :: Opts -> IO () +cliTests opts = do + -- These are sorted in asc time used, quicker tests first. + + -- Only single job, otherwise we fail with "Heap exhausted" + timedCabalBin + opts + "cabal-install" + "test:mem-use-tests" + ( ["--num-threads", "1"] + ++ tastyArgs opts + ) + + -- This test-suite doesn't like concurrency + timedCabalBin + opts + "cabal-install" + "test:unit-tests" + ( ["--num-threads", "1"] + ++ tastyArgs opts + ) + + timedCabalBin + opts + "cabal-install" + "test:long-tests" + ( jobsArgs opts + ++ tastyArgs opts + ) + + -- This doesn't work in parallel either. + timedCabalBin + opts + "cabal-install" + "test:integration-tests2" + ( [ "--num-threads" + , "1" + , "--with-ghc=" <> compilerExecutable (compiler opts) + ] + ++ tastyArgs opts + ) + +-- | Run @cabal-testsuite@ with the @cabal-install@ executable. +cliSuite :: Opts -> IO () +cliSuite opts = do + cabal' <- cabalListBin opts "cabal-install:exe:cabal" + + timedCabalBin + opts + "cabal-testsuite" + "exe:cabal-tests" + ( [ "--builddir=" <> cabalTestsuiteBuildDir opts + , "--with-cabal=" <> cabal' + , "--with-ghc=" <> compilerExecutable (compiler opts) + , "--intree-cabal-lib=" <> cwd opts + , "--test-tmp=" <> cwd opts "testdb" + , -- This test suite doesn't support `--jobs` _or_ `--num-threads`! + "-j" + , show (jobs opts) + ] + ++ tastyArgs opts + ++ rtsArgs opts + ) + +-- | Run the @solver-benchmarks@ unit tests. +solverBenchmarksTests :: Opts -> IO () +solverBenchmarksTests opts = do + command <- cabalListBin opts "solver-benchmarks:test:unit-tests" + + timedWithCwd + opts + "Cabal" + command + [] + +-- | Run the @solver-benchmarks@. +solverBenchmarksRun :: Opts -> IO () +solverBenchmarksRun opts = do + command <- cabalListBin opts "solver-benchmarks:exe:hackage-benchmark" + cabal' <- cabalListBin opts "cabal-install:exe:cabal" + + timedWithCwd + opts + "Cabal" + command + [ "--cabal1=" <> cabal opts + , "--cabal2=" <> cabal' + , "--trials=5" + , "--packages=Chart-diagrams" + , "--print-trials" + ] diff --git a/cabal-validate/src/OutputUtil.hs b/cabal-validate/src/OutputUtil.hs new file mode 100644 index 00000000000..576c6180433 --- /dev/null +++ b/cabal-validate/src/OutputUtil.hs @@ -0,0 +1,86 @@ +-- | Utilities for printing terminal output. +module OutputUtil + ( printHeader + , withTiming + ) where + +import Control.Exception (catch) +import qualified System.Console.Terminal.Size as Terminal +import System.Process.Typed (ExitCodeException) + +import ANSI (SGR (Bold, BrightCyan, BrightGreen, BrightRed, Reset), setSGR) +import ClockUtil (AbsoluteTime, diffAbsoluteTime, formatDiffTime, getAbsoluteTime) +import System.Exit (exitFailure) + +-- | Get the width of the current terminal, or 80 if no width can be determined. +getTerminalWidth :: IO Int +getTerminalWidth = maybe 80 Terminal.width <$> Terminal.size @Int + +-- | Print a header for a given step. +-- +-- This is colorful and hard to miss in the output. +printHeader + :: String + -- ^ Title to print. + -> IO () +printHeader title = do + columns <- getTerminalWidth + let left = 3 + right = columns - length title - left - 2 + header = + setSGR [Bold, BrightCyan] + <> replicate left '═' + <> " " + <> title + <> " " + <> replicate right '═' + <> setSGR [Reset] + putStrLn header + +-- | Run an `IO` action and print duration information after it finishes. +withTiming + :: AbsoluteTime + -- ^ Start time for the whole @cabal-validate@ run. + -> String + -- ^ Name for describing the action. + -- + -- Used in a sentence like "@title@ finished after 16.34s". + -> IO a + -- ^ Action to time. + -> IO a +withTiming startTime title action = do + startTime' <- getAbsoluteTime + + result <- + (Right <$> action) + `catch` (\exception -> pure (Left (exception :: ExitCodeException))) + + endTime <- getAbsoluteTime + + let duration = diffAbsoluteTime endTime startTime' + totalDuration = diffAbsoluteTime endTime startTime + + case result of + Right inner -> do + putStrLn $ + setSGR [Bold, BrightGreen] + <> title + <> " finished after " + <> formatDiffTime duration + <> "\nTotal time so far: " + <> formatDiffTime totalDuration + <> setSGR [Reset] + + pure inner + Left _procFailed -> do + putStrLn $ + setSGR [Bold, BrightRed] + <> title + <> " failed after " + <> formatDiffTime duration + <> "\nTotal time so far: " + <> formatDiffTime totalDuration + <> setSGR [Reset] + + -- TODO: `--keep-going` mode. + exitFailure diff --git a/cabal-validate/src/ProcessUtil.hs b/cabal-validate/src/ProcessUtil.hs new file mode 100644 index 00000000000..86c5c16e73f --- /dev/null +++ b/cabal-validate/src/ProcessUtil.hs @@ -0,0 +1,139 @@ +-- | Utilities for running processes and timing them. +module ProcessUtil + ( timed + , timedWithCwd + ) where + +import Control.Exception (throwIO) +import Control.Monad (when) +import Data.ByteString.Lazy (ByteString) +import qualified Data.ByteString.Lazy as ByteString +import Data.Text (Text) +import qualified Data.Text as T +import qualified Data.Text.IO as T +import qualified Data.Text.Lazy as T (toStrict) +import qualified Data.Text.Lazy.Encoding as T (decodeUtf8) +import System.Directory (withCurrentDirectory) +import System.Exit (ExitCode (ExitFailure, ExitSuccess)) +import System.Process.Typed (ExitCodeException (..), proc, readProcess, runProcess) + +import ANSI (SGR (BrightBlue, BrightGreen, BrightRed, Reset), setSGR) +import Cli (Opts (..), Verbosity (..)) +import ClockUtil (diffAbsoluteTime, formatDiffTime, getAbsoluteTime) + +-- | Like `timed`, but runs the command in a given directory. +timedWithCwd + :: Opts + -- ^ @cabal-validate@ options. + -> FilePath + -- ^ Path to run the command in. + -> FilePath + -- ^ The command to run. + -> [String] + -- ^ Arguments to pass to the command. + -> IO () +timedWithCwd opts cdPath command args = + withCurrentDirectory cdPath (timed opts command args) + +-- | Run a command, displaying timing information after it finishes. +-- +-- This prints out the command to be executed before it's run, handles hiding +-- or showing output (according to the value of `verbose`), and throws an +-- `ExitCodeException` if the command fails. +timed + :: Opts + -- ^ @cabal-validate@ options. + -> FilePath + -- ^ The command to run. + -> [String] + -- ^ Arguments to pass to the command. + -> IO () +timed opts command args = do + let prettyCommand = displayCommand command args + process = proc command args + + startTime' <- getAbsoluteTime + + -- TODO: Replace `$HOME` or `opts.cwd` for brevity? + putStrLn $ + setSGR [BrightBlue] + <> "$ " + <> prettyCommand + <> setSGR [Reset] + + (exitCode, rawStdout, rawStderr) <- + if verbosity opts > Quiet + then do + exitCode <- runProcess process + pure (exitCode, ByteString.empty, ByteString.empty) + else readProcess process + + endTime <- getAbsoluteTime + + let duration = diffAbsoluteTime endTime startTime' + totalDuration = diffAbsoluteTime endTime (startTime opts) + + output = decodeStrip rawStdout <> "\n" <> decodeStrip rawStderr + linesLimit = 50 + outputLines = T.lines output + hiddenLines = length outputLines - linesLimit + tailLines = drop hiddenLines outputLines + + case exitCode of + ExitSuccess -> do + -- Output is captured when `--quiet` is used, so only print it here + -- if `--quiet` _isn't_ used. + when (verbosity opts > Quiet) $ do + if hiddenLines <= 0 + then T.putStrLn output + else + T.putStrLn $ + "(" + <> T.pack (show hiddenLines) + <> " lines hidden, use `--verbose` to show)\n" + <> "...\n" + <> T.unlines tailLines + + putStrLn $ + setSGR [BrightGreen] + <> "Finished after " + <> formatDiffTime duration + <> ": " + <> prettyCommand + <> "\nTotal time so far: " + <> formatDiffTime totalDuration + <> setSGR [Reset] + ExitFailure exitCode' -> do + when (verbosity opts <= Info) $ do + T.putStrLn output + + putStrLn $ + setSGR [BrightRed] + <> "Failed with exit code " + <> show exitCode' + <> " after " + <> formatDiffTime duration + <> ": " + <> prettyCommand + <> "\nTotal time so far: " + <> formatDiffTime totalDuration + <> setSGR [Reset] + + throwIO + ExitCodeException + { eceExitCode = exitCode + , eceProcessConfig = process + , eceStdout = rawStdout + , eceStderr = rawStderr + } + +-- | Decode `ByteString` output from a command and strip whitespace at the +-- start and end. +decodeStrip :: ByteString -> Text +decodeStrip = T.strip . T.toStrict . T.decodeUtf8 + +-- | Escape a shell command to display it to a user. +-- +-- TODO: Shell escaping +displayCommand :: String -> [String] -> String +displayCommand command args = command <> " " <> unwords args diff --git a/cabal-validate/src/Step.hs b/cabal-validate/src/Step.hs new file mode 100644 index 00000000000..801b660f5cc --- /dev/null +++ b/cabal-validate/src/Step.hs @@ -0,0 +1,56 @@ +-- | The steps that can be run by @cabal-validate@. +module Step + ( Step (..) + , displayStep + , nameToStep + , parseStep + ) where + +import Data.Map.Strict (Map) +import qualified Data.Map.Strict as Map + +-- | A step to be run by @cabal-validate@. +data Step + = Build + | Doctest + | LibTests + | LibSuite + | LibSuiteExtras + | CliTests + | CliSuite + | SolverBenchmarksTests + | SolverBenchmarksRun + deriving (Eq, Enum, Bounded, Show) + +-- | Get the display identifier for a given `Step`. +-- +-- This is used to parse the @--step@ command-line argument. +-- +-- Note that these names are just kebab-case variants of the `Step` constructor +-- names; they do not attempt to describe the steps. +displayStep :: Step -> String +displayStep step = + case step of + Build -> "build" + Doctest -> "doctest" + LibTests -> "lib-tests" + LibSuite -> "lib-suite" + LibSuiteExtras -> "lib-suite-extras" + CliTests -> "cli-tests" + CliSuite -> "cli-suite" + SolverBenchmarksTests -> "solver-benchmarks-tests" + SolverBenchmarksRun -> "solver-benchmarks-run" + +-- | A map from step names to `Steps`. +-- +-- This is an inverse of `displayStep`. +nameToStep :: Map String Step +nameToStep = + Map.fromList + [ (displayStep step, step) + | step <- [minBound .. maxBound] + ] + +-- | Parse a string as a `Step`. +parseStep :: String -> Maybe Step +parseStep step = Map.lookup step nameToStep diff --git a/cabal.bootstrap.project b/cabal.bootstrap.project index 845a3fca7fd..bd75ec5c289 100644 --- a/cabal.bootstrap.project +++ b/cabal.bootstrap.project @@ -9,4 +9,4 @@ packages: tests: False benchmarks: False -index-state: hackage.haskell.org 2024-04-22T06:16:57Z +index-state: hackage.haskell.org 2024-11-20T00:00:00Z diff --git a/cabal.project b/cabal.project index e368c280c99..a2075cfdc29 100644 --- a/cabal.project +++ b/cabal.project @@ -4,3 +4,11 @@ import: project-cabal/pkgs.config import: project-cabal/constraints.config tests: True + +-- if you are developing on a system without TH, use a `cabal.project.local` +-- to disable this +package cabal-install + flags: +git-rev + +package Cabal + flags: +git-rev diff --git a/cabal.release.project b/cabal.release.project index 3d73d2f19a1..49820909411 100644 --- a/cabal.release.project +++ b/cabal.release.project @@ -2,4 +2,11 @@ import: project-cabal/pkgs/cabal.config import: project-cabal/pkgs/install.config import: project-cabal/pkgs/tests.config -index-state: hackage.haskell.org 2024-04-22T06:16:57Z +index-state: hackage.haskell.org 2024-11-20T00:00:00Z + +-- never include this or its TH dependency in a release! +package cabal-install + flags: -git-rev + +package Cabal + flags: -git-rev diff --git a/cabal.validate.project b/cabal.validate.project index 52c78411107..5075458c1b8 100644 --- a/cabal.validate.project +++ b/cabal.validate.project @@ -7,3 +7,8 @@ tests: True write-ghc-environment-files: never program-options ghc-options: -Werror + +-- if you are developing on a system without TH, use a `cabal.validate.project.local` +-- to disable this +package cabal-install + flags: +git-rev diff --git a/changelog.d/config b/changelog.d/config index f4f1b9e5f57..58f62d6a4f3 100644 --- a/changelog.d/config +++ b/changelog.d/config @@ -1,3 +1,9 @@ organization: haskell repository: cabal required-fields: packages prs +packages: + Cabal + Cabal-hooks + Cabal-syntax + cabal-install + cabal-install-solver diff --git a/changelog.d/issue-6750 b/changelog.d/issue-6750 deleted file mode 100644 index e392258267b..00000000000 --- a/changelog.d/issue-6750 +++ /dev/null @@ -1,13 +0,0 @@ -synopsis: Make Setup copy/install succeed when there's no executable or library -packages: Cabal -prs: #9926 -issues: #6750 - -description: { - Historically the Setup copy and install steps would fail if the package didn't - contain an executable or library component. In this case there's nothing to do. - - This required workarounds for downstream users of Cabal to handle this edge case. - Now that this error has been downgraded to a warning, Cabal will succeed if - there's nothing to do. -} diff --git a/changelog.d/issue-9641 b/changelog.d/issue-9641 deleted file mode 100644 index 34666f0ad59..00000000000 --- a/changelog.d/issue-9641 +++ /dev/null @@ -1,8 +0,0 @@ -synopsis: offline flag applied to `source-repository-package`s -packages: Cabal-install -prs: #9771 -issues: #9641 - -description: { -`--offline` flag is already used to block access to Hackage. Now with this PR, this also applies to remote dependency `source-repository-package` in `cabal.project`. -} diff --git a/changelog.d/issue-9702 b/changelog.d/issue-9702 deleted file mode 100644 index 7df998b8d8d..00000000000 --- a/changelog.d/issue-9702 +++ /dev/null @@ -1,39 +0,0 @@ -synopsis: Working directory support for Cabal -packages: Cabal-syntax Cabal cabal-install -prs: #9718 -issues: #9702 - -description: { - -The Cabal library is now able to handle a passed-in working directory, instead -of always relying on the current working directory of the parent process. - -In order to achieve this, the `SymbolicPath` abstraction was fleshed out, and -all fields of `PackageDescription` that, if relative, should be interpreted -with respect to e.g. the package root, use `SymbolicPath` instead of `FilePath`. - -This means that many library functions in `Cabal` take an extra argument of type -`Maybe (SymbolicPath CWD (Dir "Package))`, which is an optional (relative or -absolute) path to the package root (if relative, relative to the current working -directory). In addition, many functions that used to manipulate `FilePath`s now -manipulate `SymbolicPath`s, require explicit conversion using e.g. `getSymbolicPath`. - -To illustrate with file searching, the `Cabal` library defines: - -```haskell -findFileCwd - :: forall dir1 dir2 file - . Verbosity - -> Maybe (SymbolicPath CWD (Dir dir1)) - -- ^ working directory - -> [SymbolicPath dir1 (Dir dir2)] - -- ^ search directories - -> RelativePath dir2 File - -- ^ filename - -> IO (SymbolicPath dir1 File) -``` - -See Note [Symbolic paths] in `Distribution.Utils.Path` for further information -on the design of this API. -} - diff --git a/changelog.d/pr-10190 b/changelog.d/pr-10190 new file mode 100644 index 00000000000..d9e4f009b94 --- /dev/null +++ b/changelog.d/pr-10190 @@ -0,0 +1,11 @@ +synopsis: Fix `cabal clean` permissions on Windows +packages: cabal-install +prs: #10190 +issues: #10182 +significance: + +description: { + +- `cabal clean` now removes the read-only mark recursively in the `dist-newstyle` folder on Windows before attempting to delete it. + +} diff --git a/changelog.d/pr-10254 b/changelog.d/pr-10254 new file mode 100644 index 00000000000..b07b66b561f --- /dev/null +++ b/changelog.d/pr-10254 @@ -0,0 +1,16 @@ +synopsis: Shallow and concurrent cloning of git repos +packages: cabal-install +prs: #10254 + +description: { + +- Clone git repositories specified in source-repository-package stanzas + shallowly, since to build the package from the repository we only need to + read the commit specified. The rest of the repo is not needed. + Note that this does not change the behaviour of `cabal get -s`, which will + still clone the repository in full. +- Clone VCS repositories concurrently, with a maximum of two concurrent tasks + at the same time (just like when downloading packages asynchronously) + +} + diff --git a/changelog.d/pr-10273 b/changelog.d/pr-10273 new file mode 100644 index 00000000000..343c871377b --- /dev/null +++ b/changelog.d/pr-10273 @@ -0,0 +1,19 @@ +--- +synopsis: "Show why `cabal act-as-setup configure` failed" +packages: [Cabal] +prs: 10273 +--- + +When `cabal act-as-setup configure` fails, it prints a list of "missing or +private dependencies". + +Now, it will show you if each failing dependency is missing, private, or an +incompatible version: + +``` +Error: [Cabal-8010] +Encountered missing or private dependencies: + Lib:{bar-internal,foo-internal} (missing :bar-internal), + base <=1.0 (installed: 4.18.2.1), + package-that-does-not-exist (missing) +``` diff --git a/changelog.d/pr-10356 b/changelog.d/pr-10356 new file mode 100644 index 00000000000..dbe464ae492 --- /dev/null +++ b/changelog.d/pr-10356 @@ -0,0 +1,11 @@ +synopsis: New licence constructors for SPDX licences starting with a digit +packages: Cabal-syntax +prs: #10356 + +description: { + +- LicenseId constructor `NullBSD` is now `N_0BSD`. +- LicenseId constructor `DS389_exception` is now and `N_389_exception`. +- LicenseId constructor `X3D_Slicer_1_0` is now and `N_3D_Slicer_1_0`. + +} diff --git a/changelog.d/pr-10432 b/changelog.d/pr-10432 new file mode 100644 index 00000000000..1bb76adb0a1 --- /dev/null +++ b/changelog.d/pr-10432 @@ -0,0 +1,10 @@ +synopsis: Avoid partial `Data.List.last` in autogenerated `Paths_.hs` +packages: Cabal +prs: #10432 +significance: + +description: { + +- Autogenerated `Paths_.hs` now avoids use of the partial function `Data.List.last`. + +} diff --git a/changelog.d/pr-10493 b/changelog.d/pr-10493 new file mode 100644 index 00000000000..5d49e71995c --- /dev/null +++ b/changelog.d/pr-10493 @@ -0,0 +1,11 @@ +synopsis: Remove descriptions for sandbox in replCommand +packages: Cabal +prs: #10493 +issues: #10482 +significance: significant + +description: { + +- Text provided by `Setup.hs repl --help` contained outdated information concerning sandbox, which have now been removed. + +} diff --git a/changelog.d/pr-10525 b/changelog.d/pr-10525 new file mode 100644 index 00000000000..7235d0bec74 --- /dev/null +++ b/changelog.d/pr-10525 @@ -0,0 +1,34 @@ +--- +synopsis: "A trailing colon after a stanza name in `cabal.project` is now an error" +packages: [cabal-install] +prs: 10525 +--- + +It is now a hard error to use a trailing colon after a stanza name in +`cabal.project` or `*.cabal` files: + +``` +packages: . + +source-repository-package: + type: git + location: https://github.com/haskell/cabal + tag: f34aba976a60940295f41b6649674e9568893894 +``` + +``` +$ cabal build +Error parsing project file cabal.project:3: +'source-repository-package' is a stanza, not a field. Remove the trailing ':' to parse a stanza. +``` + +Previously, the warning message was easily ignored and somewhat misleading, as +the difference between a stanza and a field is not immediately obvious to +Haskellers used to config languages like JSON and YAML (which don't distinguish +between fields which have string or list values and stanzas which have nested +fields): + +``` +Warning: cabal.project: Unrecognized field +'source-repository-package' on line 3 +``` diff --git a/changelog.d/pr-10546 b/changelog.d/pr-10546 new file mode 100644 index 00000000000..02703cdc16a --- /dev/null +++ b/changelog.d/pr-10546 @@ -0,0 +1,82 @@ +--- +synopsis: Deduplicate "using configuration from" message +packages: [cabal-install-solver] +prs: 10546 +--- + +## Using Configuration From Message Changes + +Deduplicates and sorts the list of configuration files and URIs printed with the +"using configuration from" message. This message is shown when there's a build +failure. We can trigger that message by using a non-existant package in the +project, "no-pkg-dir". + +If an import is repeated in a `.project` or `.config` file it only imported once +but if the same import is made from an imported file then it was being repeated +in the message. Additional problems were not showing the project first and +mixing configuration files and URIs together. + +* The test set up: + + ``` + $ cat cabal.project + cat cabal.project + packages: no-pkg-dir + import: z-empty.config + import: an-extra.config + import: an-extra.config + import: a-very-extra.config + import: a-very-extra.config + import: https://www.stackage.org/lts-21.25/cabal.config + import: https://www.stackage.org/lts-21.25/cabal.config + + $ cat an-extra.config + import: https://www.stackage.org/lts-21.25/cabal.config + import: https://www.stackage.org/lts-21.25/cabal.config + + $ cat a-very-extra.config + import: https://www.stackage.org/lts-21.25/cabal.config + import: https://www.stackage.org/lts-21.25/cabal.config + + $ cat z-empty.config + - This file is intentionally empty, just this comment. + ``` + +* Before the fix: + + ``` + $ ~/.ghcup/bin/cabal-3.12.1.0 build all --dry-run + When using configuration from: + - a-very-extra.config + - an-extra.config + - cabal.project + - https://www.stackage.org/lts-21.25/cabal.config + - https://www.stackage.org/lts-21.25/cabal.config + - https://www.stackage.org/lts-21.25/cabal.config + - z-empty.config + The following errors occurred: + - The package location 'no-pkg-dir' does not exist. + ``` + +* After the fix: + + ``` + $ cabal build all --dry-run + When using configuration from: + - cabal.project + - a-very-extra.config + - an-extra.config + - z-empty.config + - https://www.stackage.org/lts-21.25/cabal.config + The following errors occurred: + - The package location 'no-pkg-dir' does not exist. + ``` + +## Ord ProjectConfigPath Instance Changes + +Adds a custom `Ord` instance for `ProjectConfigPath` that sorts URIs after local +file paths and longer file paths after shorter ones as measured by the number of +path segments. If still equal, then sorting is lexical. The project itself, a +single element root path, compared to any of the configuration paths it imports, +should always sort first. Comparing one project root path against another is +done lexically. diff --git a/changelog.d/pr-10549 b/changelog.d/pr-10549 new file mode 100644 index 00000000000..257fc103197 --- /dev/null +++ b/changelog.d/pr-10549 @@ -0,0 +1,11 @@ +synopsis: Warn on `cabal format` +packages: cabal-install +prs: #10549 +issues: +significance: + +description: { + +- Despite its name, `cabal format` is not a proper formatter for cabal files. By chance users have sometimes found the command eventhough it is not mentioned in the help text, and they used it to format cabal files. This has some downsides like comments are stripped away or common stanzas are inlined, the command is more like a dump of the resolved package description. There are future plans (#7544) to make it an actual formatter so, rather than going through a deprecation cycle, we decided to keep this command for future use and in the meantime just warn the user about the fact that it is not a proper formatter. + +} diff --git a/changelog.d/pr-10554 b/changelog.d/pr-10554 new file mode 100644 index 00000000000..569bba5e0d8 --- /dev/null +++ b/changelog.d/pr-10554 @@ -0,0 +1,12 @@ +--- +synopsis: Adds more version range checks to `cabal check`. +packages: [Cabal-syntax, Cabal] +prs: 10554 +issues: 9806 +--- + +For dependencies, warns about and checks that version range bounds for: + +- lower bounds are inclusive, don't use (>) +- upper bounds are exclusive, don't use (<=) +- upper bounds don't have trailing zeros, don't end with (*.0). diff --git a/changelog.d/pr-10587 b/changelog.d/pr-10587 new file mode 100644 index 00000000000..92428be048b --- /dev/null +++ b/changelog.d/pr-10587 @@ -0,0 +1,12 @@ +--- +synopsis: "Quieter Git output" +packages: [cabal-install] +prs: 10587 +--- + +When `cabal` clones a Git repo for a `source-repository-package` listed in a +`cabal.project`, it will run various commands to check out the correct +revision, initialize submodules if they're present, and so on. + +Now, `cabal` will pass `--quiet` to Git in more cases to help prevent +cluttering command-line output. diff --git a/changelog.d/pr-10590 b/changelog.d/pr-10590 new file mode 100644 index 00000000000..5121bbfb959 --- /dev/null +++ b/changelog.d/pr-10590 @@ -0,0 +1,14 @@ +--- +synopsis: "Don't run submodule commands unless necessary" +packages: [cabal-install] +prs: 10590 +--- + +When `cabal` clones a Git repo for a `source-repository-package` listed in a +`cabal.project`, it will run various commands to check out the correct +revision, initialize submodules if they're present, and so on. + +Now, `cabal` will avoid running `git submodule` commands unless the cloned +repository contains a `.gitmodules` file. This will declutter `cabal`'s debug +output by running fewer commands. + diff --git a/changelog.d/pr-10616 b/changelog.d/pr-10616 new file mode 100644 index 00000000000..89d6bc1d985 --- /dev/null +++ b/changelog.d/pr-10616 @@ -0,0 +1,11 @@ +--- +synopsis: "OpenBSD `--strip-unneeded` sometimes strips too much" +packages: [Cabal] +prs: 10616 +--- + +OpenBSD's `--strip-unneeded` thinks some symbols are unneeded that are in fact +needed when C bits are involved, so suppress its use. + +Taken from the OpenBSD ports repo (https://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/ports/lang/ghc/patches/patch-libraries_Cabal_Cabal_Distribution_Simple_Program_Strip_hs); +brought to our attention by maerwald. diff --git a/changelog.d/pr-10629 b/changelog.d/pr-10629 new file mode 100644 index 00000000000..2d8259b45ef --- /dev/null +++ b/changelog.d/pr-10629 @@ -0,0 +1,13 @@ +--- +synopsis: "Report trailing spaces in project import URIs" +packages: [cabal-install, cabal-install-solver] +prs: 10629 +issues: 10622 +--- + +> A string is a valid URL potentially surrounded by spaces if, after stripping +> leading and trailing whitespace from it, it is a valid URL." +> SOURCE: [W3C/HTML5/URLs](https://www.w3.org/TR/2010/WD-html5-20100624/urls.html) + +Fixes a problem of mistaking a URI for a file path when it has trailing spaces +and warn about such trailing spaces. diff --git a/changelog.d/pr-10637 b/changelog.d/pr-10637 new file mode 100644 index 00000000000..0cff281a4d0 --- /dev/null +++ b/changelog.d/pr-10637 @@ -0,0 +1,11 @@ +--- +synopsis: Fix Haddock CSS handling in multi-package projects +packages: [cabal-install, Cabal] +prs: 10637 +issues: [10636] +--- + +When `--css=` flag is provided to `cabal haddock-project`: + +- the Haddock index is now properly styled by the provided CSS file +- each package in the project now has their docs properly styled by the provided CSS file diff --git a/changelog.d/pr-10646.md b/changelog.d/pr-10646.md new file mode 100644 index 00000000000..fb7dd8c9ec7 --- /dev/null +++ b/changelog.d/pr-10646.md @@ -0,0 +1,209 @@ +--- +synopsis: Configuration messages without duplicates +packages: [cabal-install-solver] +prs: 10646 +issues: 10645 +--- + +The "using configuration from" message no longer has duplicates on Windows when +a `cabal.project` uses forward slashes for its imports but the message reports +the same import again with backslashes. + +```diff +$ cat cabal.project +import: dir-a/b.config + +$ cabal build all --dry-run +... +When using configuration from: +- - dir-a/b.config + - dir-a\b.config + - cabal.project +``` + +## Changed `Ord ProjectConfigPath` Instance + +For comparison purposes, path separators are normalized to the `buildOS` +platform's path separator. + +```haskell +-- >>> let abFwd = ProjectConfigPath $ "a/b.config" :| [] +-- >>> let abBwd = ProjectConfigPath $ "a\\b.config" :| [] +-- >>> compare abFwd abBwd +-- EQ +``` + +## Changes in `cabal-testsuite` + +### Reading Expected Multiline Strings Verbatim + +With `ghc-9.12.1` adding `-XMultilineStrings`, writing multiline string +expectations for `cabal-testsuite/PackageTests/**/*.test.hs` test scripts might +be have been easier but for a catch. We run these tests with older `GHC` +versions so would need to use `-XCPP` for those versions and the C preprocessor +does not play nicely with string gaps. While it is possible to encode a +multiline string as a single line with embedded LF characters or by breaking the +line up arbitrarily and using `++` concatenation or by calling unlines on a list +of lines, string gaps are the multiline strings of Haskell prior to +`-XMultilineStrings`. + +To avoid these problems and for the convenience of pasting the expected value +verbatim into a file, `readFileVerbatim` can read the expected multiline output +for tests from a text file. This has the same implementation as `readFile` from +the `strict-io` package to avoid problems at cleanup. + +``` +Warning: Windows file locking hack: hit the retry limit 3 while trying to remove +C:\Users\\AppData\Local\Temp\cabal-testsuite-8376 +cabal.test.hs: +C:\Users\\AppData\Local\Temp\cabal-testsuite-8376\errors.expect.txt: removePathForcibly:DeleteFile +"\\\\?\\C:\\Users\\\\AppData\\Local\\Temp\\cabal-testsuite-8376\\errors.expect.txt": +permission denied (The process cannot access the file because it is being used by another process.) +``` + +The other process accessing the file is `C:\WINDOWS\System32\svchost.exe` +running a `QueryDirectory` event and this problem only occurs when the test +fails. + +### Hidden Actual Value Modification + +The `assertOutputContains` function was modifying the actual value (the test +output) with `concatOutput` before checking if it contained the expected value. +This function, now renamed as `lineBreaksToSpaces`, would remove CR values and +convert LF values to spaces. + +```haskell +-- | Replace line breaks with spaces, correctly handling @"\\r\\n"@. +-- +-- >>> lineBreaksToSpaces "foo\nbar\r\nbaz" +-- "foo bar baz" +-- +-- >>> lineBreaksToSpaces "foo\nbar\r\nbaz\n" +-- "foo bar baz" +-- +-- >>> lineBreaksToSpaces "\nfoo\nbar\r\nbaz\n" +-- " foo bar baz" +lineBreaksToSpaces :: String -> String +``` + +With this setup, false positives were possible. An expected value using string +gaps and spaces would match a `concatOutput` modified actual value of +"foo_bar_baz", where '_' was any of space, LF or CRLF in the unmodified actual +value. The latter two are false positive matches. + +```haskell +let expect = "foo \ + \bar \ + \baz" +``` + +False negatives were also possible. An expected value set up using string gaps +with LF characters or with `-XMultilineStrings` wouldn't match an actual value +of "foo_bar_baz", where '_' was either LF or CRLF because these characters had +been replaced by spaces in the actual value, modified before the comparison. + +```haskell +let expect = "foo\n\ + \bar\n\ + \baz" +``` + +```haskell +{-# LANGUAGE MultilineStrings #-} + +let expect = """ + foo + bar + baz + """ +``` + +We had these problems: + +1. The actual value was changed before comparison and this change was not visible. +2. The expected value was not changed in the same way as the actual value. This + made it possible for equal values to become unequal (false negatives) and for + unequal values to become equal (false positives). + +### Explicit Changes and Visible Line Delimiters + +To fix these problems, an added `assertOn` function takes a `NeedleHaystack` +configuration for how the search is made, what to expect (to find the expected +value or not) and how to display the expected and actual values. + +A pilcrow ¶ is often used to visibly display line endings but our terminal +output is restricted to ASCII so lines are delimited between `^` and `$` +markers. The needle (the expected output fragment) is shown annotated this way +and the haystack (the actual output) can optionally be shown this way too. + +We can now implement `assertOutputContains` by calling `assertOn`: + +```diff + assertOutputContains :: MonadIO m => WithCallStack (String -> Result -> m ()) +- assertOutputContains needle result = +- withFrozenCallStack $ +- unless (needle `isInfixOf` (concatOutput output)) $ +- assertFailure $ " expected: " ++ needle +- where output = resultOutput result ++ assertOutputContains = assertOn ++ needleHaystack ++ {txHaystack = ++ TxContains ++ { txBwd = delimitLines ++ , txFwd = encodeLf ++ } ++ } +``` + +This is still a lenient match, allowing LF to match CRLF, but `encodeLf` doesn't +replace LF with spaces like `concatOutput` (`lineBreaksToSpaces`) did: + +```haskell +-- | Replace line CRLF line breaks with LF line breaks. +-- +-- >>> encodeLf "foo\nbar\r\nbaz" +-- "foo\nbar\nbaz" +-- +-- >>> encodeLf "foo\nbar\r\nbaz\n" +-- "foo\nbar\nbaz\n" +-- +-- >>> encodeLf "\nfoo\nbar\r\nbaz\n" +-- "\nfoo\nbar\nbaz\n" +-- +-- >>> encodeLf "\n\n\n" +-- "\n\n\n" +encodeLf :: String -> String +``` + +If you choose to display the actual value by setting +`NeedleHaystack{displayHaystack = True}` then its lines will be delimited. + +```haskell +-- | Mark lines with visible delimiters, @^@ at the start and @$@ at the end. +-- +-- >>> delimitLines "" +-- "^$" +-- +-- >>> delimitLines "\n" +-- "^$\n" +-- +-- >>> delimitLines "\n\n" +-- "^$\n^$\n" +-- +-- >>> delimitLines "\n\n\n" +-- "^$\n^$\n^$\n" +-- +-- >>> delimitLines $ encodeLf "foo\nbar\r\nbaz" +-- "^foo$\n^bar$\n^baz$" +-- +-- >>> delimitLines $ encodeLf "foo\nbar\r\nbaz\n" +-- "^foo$\n^bar$\n^baz$\n" +-- +-- >>> delimitLines $ encodeLf "\nfoo\nbar\r\nbaz\n" +-- "^$\n^foo$\n^bar$\n^baz$\n" +delimitLines:: String -> String +``` + +With `assertOn`, supplying string transformation to both the needle and haystack +before comparison and before display can help find out why an expected value is +or isn't found in the test output. diff --git a/changelog.d/pr-10647 b/changelog.d/pr-10647 new file mode 100644 index 00000000000..4a87939f8b6 --- /dev/null +++ b/changelog.d/pr-10647 @@ -0,0 +1,10 @@ +--- +synopsis: 'Improve "Cannot read .cabal file inside ..." errors' +packages: [cabal-install] +prs: 10647 +--- + +The error message printed when Cabal fails to read a `.cabal` file inside an +index (like the Hackage index) has been greatly improved. Additionally, +warnings in `.cabal` files in indexes are printed instead of being silently +discarded. diff --git a/changelog.d/pr-9367 b/changelog.d/pr-9367 new file mode 100644 index 00000000000..806efcc5c11 --- /dev/null +++ b/changelog.d/pr-9367 @@ -0,0 +1,21 @@ +--- +synopsis: "Use response files when calling `ghc`" +packages: [Cabal] +prs: 9367 +--- + +Cabal now passes GHC arguments through a response file. This prevents an error +where very large packages would fail to build due to the module names exceeding +the `ARG_MAX` command-line length limit: + +``` +ghc: createProcess: posix_spawnp: resource exhausted (Argument list too long) +``` + +Notes: +- Response files will not be used if the first argument to `ghc` is + `--interactive`. +- RTS options (like `+RTS -H32m -S -RTS`) will not be included in response + files. +- For reproducing commands after Cabal exits, `--keep-temp-files` can be used + to prevent the response files from being deleted. diff --git a/changelog.d/pr-9551 b/changelog.d/pr-9551 deleted file mode 100644 index 5116234a653..00000000000 --- a/changelog.d/pr-9551 +++ /dev/null @@ -1,19 +0,0 @@ -synopsis: Introduce SetupHooks -packages: Cabal -prs: #9551 -description: { - Introduction of a new build type: Hooks. - This build type, intended as replacement to the Custom build type, integrates - better with the rest of the ecosystem (`cabal-install`, Haskell Language Server). - - The motivation and full design of this new build-type are specified in the - Haskell Foundation Tech Proposal - [Replacing the Cabal Custom build-type](https://github.com/haskellfoundation/tech-proposals/pull/60). - - Package authors willing to use this feature should declare `build-type: Hooks` - in their `.cabal` file, declare a custom-setup stanza with a dependency on the - `Cabal-hooks` package, and define a module `SetupHooks` that exports a value - `setupHooks :: SetupHooks`, using the API exported by `Distribution.Simple.SetupHooks` - from the `Cabal-hooks` package. Refer to the Haddock documentation of - `Distribution.Simple.SetupHooks` for example usage. -} diff --git a/changelog.d/pr-9740 b/changelog.d/pr-9740 deleted file mode 100644 index c5a3b9a173e..00000000000 --- a/changelog.d/pr-9740 +++ /dev/null @@ -1,9 +0,0 @@ -synopsis: Add language extension NamedDefaults -packages: Cabal-syntax -prs: #9740 - -description: { - -- adds support for the `NamedDefaults` language extension (GHC proposal #409) - -} diff --git a/changelog.d/pr-9766 b/changelog.d/pr-9766 deleted file mode 100644 index 3d10abb659f..00000000000 --- a/changelog.d/pr-9766 +++ /dev/null @@ -1,11 +0,0 @@ -synopsis: Warn on missing `default-language` -packages: Cabalcabal-install -prs: #9766 -issues: #9620 - -description: { - -- To help the adoption of GHC language editions, `cabal check` will now - warn about missing `default-language`. - -} diff --git a/changelog.d/pr-9824 b/changelog.d/pr-9824 deleted file mode 100644 index 168b9c98e64..00000000000 --- a/changelog.d/pr-9824 +++ /dev/null @@ -1,10 +0,0 @@ -synopsis: Abbrevate solver rejection messages with installed versions -packages: cabal-install-solver -prs: #9824 -issues: #9823 - -description: { - -Abbreviate solver rejection messages even in the presence of installed versions. - -} diff --git a/changelog.d/pr-9890 b/changelog.d/pr-9890 new file mode 100644 index 00000000000..e9861aed7af --- /dev/null +++ b/changelog.d/pr-9890 @@ -0,0 +1,10 @@ +synopsis: `cabal init` generates explicit export lists for Main +packages: cabal-install +prs: #9890 +issues: #9889 + +description: { + +- Lack of explicit export list can degrade performance. The `Main` module in particular should always have an explicit export list that contains just the main function. Then, the compiler can do more aggressive optimizations on all the other non-exported functions. + +} diff --git a/changelog.d/pr-9950 b/changelog.d/pr-9950 deleted file mode 100644 index a961c953639..00000000000 --- a/changelog.d/pr-9950 +++ /dev/null @@ -1,21 +0,0 @@ -synopsis: Re-instate `initialBuildSteps` -packages: Cabal -issues: #9856 -prs: #9950 - -description: { - -The `initialBuildSteps` function from `Distribution.Simple.Build`, which had -been hastily removed, has been reinstated. - -It now comes with a deprecation warning: calling that function does not suffice -to prepare the sources for a package, as there are other steps that one might -also need to perform: - - - running pre-processors (such as alex/happy) - - running pre-build hooks or custom logic - (in build-type: Hooks or build-type: Custom or Configure) - -Consumers wanting to prepare the sources of a package, e.g. in order to launch a -REPL session, are advised to run `setup repl --repl-multi-file=` instead. -} diff --git a/doc/README.md b/doc/README.md index c3b25787ce6..6a9c88e71eb 100644 --- a/doc/README.md +++ b/doc/README.md @@ -11,48 +11,57 @@ http://cabal.readthedocs.io/ ### How to build it -Building the documentation requires Python 3 and PIP. Run the following command either from the root of the cabal repository or from the `docs/` subdirectory: +Building the documentation requires Python 3, PIP, and `pip-tools` (see the second note below for how to install it). Run the following command either from the root of the cabal repository or from the `docs/` subdirectory: ``` console -make users-guide +> make users-guide ``` Note: Python on Mac OS X dislikes `LC_CTYPE=UTF-8`, so unset the variable and instead set `LC_ALL=en_US.UTF-8`. +Note: You can use a vendor package for `pip-tools`, or run + +``` console +> pip install pip-tools +``` + +Make sure the installation directory (often `$HOME/.local/bin`) is on your `$PATH`. + ### How to update dependencies -Once in a while you need to update Python dependencies (for instance, -when Dependabot alerts about possible security flaw). The list of -transitive dependencies (`requirements.txt`) is generated from the -list of direct dependencies in `requirements.in`. To perform the -generation step run +The list of transitive dependencies (`requirements.txt`) is generated from the list of direct dependencies in `requirements.in`. To perform the generation step, run ```console > make users-guide-requirements ``` -either from the root of the cabal repository or from the `docs/` subdirectory. +either from the root of the cabal repository or from the `docs/` subdirectory. You will need to do this before building documentation the first time, but should only need to repeat it after a `git clean` or if the dependencies in `requirements.in` change. -Note that generating `requirements.txt` is sensitive to the Python version. -The version currently used is stamped at the top of `requirements.txt`. -Normally, we would expect the same version of Python to be used for -regeneration. An easy way to enforce a particular version is to perform -regeneration in a Docker container, e.g. (from the root of repository): +In some cases, you may have to add a bound manually to `requirements.in`, e.g. `requests >= 2.31.0`. -```console -> docker run -itv $PWD:/cabal python:3.10-alpine sh -... -# apk add make -... -# cd cabal -# make users-guide-requirements -``` +### How to check spelling + +To check for typos, run `make typos` and to fix them, run `make fix-typos`. Fixing might fail. + +> If there is any ambiguity (multiple possible corrections), +> `typos` will just report it to the user and move on. +> +> SOURCE: [typos/Getting Started](https://github.com/crate-ci/typos#getting-started) -One way to make sure the dependencies are reasonably up to date -is to remove `requirements.txt` and regenerate it as described -above. But in some cases you may have to add a bound manually -to `requirements.in`, e.g. `requests >= 2.31.0`. +``` +# spellchecker:off +$ make users-guide-typos +cd doc && find . -type f -name '*.rst' | xargs typos +error: `managable` should be `manageable`, `manageably` + --> doc/getting-started.rst:75:6 + | +75 | more managable building blocks. + | ^^^^^^^^^ + | +make: *** [Makefile: users-guide-typos] Error 2 +# spellchecker:on +``` ### Gitpod workflow @@ -70,6 +79,7 @@ Make your edits, rebuild the guide and refresh the browser to preview the changes. When happy, commit your changes with git in the included terminal. ### Caveats, for newcomers to RST from MD + RST does not allow you to skip section levels when nesting, like MD does. So, you cannot have diff --git a/doc/buildinfo-fields-reference.rst b/doc/buildinfo-fields-reference.rst index c1ccf418f81..a289292945a 100644 --- a/doc/buildinfo-fields-reference.rst +++ b/doc/buildinfo-fields-reference.rst @@ -387,6 +387,14 @@ ghc-prof-options .. math:: {\left\{ \mathop{\mathit{hs\text{-}string}}\mid{{[\mathop{\mathord{``}\mathtt{\ }\mathord{"}}]^c}}^+_{} \right\}}^\ast_{\bullet} +ghc-prof-shared-options + * Monoidal field + * Available since ``cabal-version: 3.14``. + * Documentation of :pkg-field:`library:ghc-prof-shared-options` + + .. math:: + {\left\{ \mathop{\mathit{hs\text{-}string}}\mid{{[\mathop{\mathord{``}\mathtt{\ }\mathord{"}}]^c}}^+_{} \right\}}^\ast_{\bullet} + ghc-shared-options * Monoidal field * Documentation of :pkg-field:`library:ghc-shared-options` @@ -408,6 +416,14 @@ ghcjs-prof-options .. math:: {\left\{ \mathop{\mathit{hs\text{-}string}}\mid{{[\mathop{\mathord{``}\mathtt{\ }\mathord{"}}]^c}}^+_{} \right\}}^\ast_{\bullet} +ghcjs-prof-shared-options + * Monoidal field + * Available since ``cabal-version: 3.14``. + * Documentation of :pkg-field:`library:ghcjs-prof-shared-options` + + .. math:: + {\left\{ \mathop{\mathit{hs\text{-}string}}\mid{{[\mathop{\mathord{``}\mathtt{\ }\mathord{"}}]^c}}^+_{} \right\}}^\ast_{\bullet} + ghcjs-shared-options * Monoidal field * Documentation of :pkg-field:`library:ghcjs-shared-options` @@ -579,6 +595,14 @@ extra-doc-files .. math:: \mathrm{commalist}\left\{ \mathop{\mathit{hs\text{-}string}}\mid{{[\mathop{\mathord{``}\mathtt{\ }\mathord{"}}\mathop{\mathord{``}\mathtt{\text{,}}\mathord{"}}]^c}}^+_{} \right\} +extra-files + * Monoidal field + * Available since ``cabal-version: 3.14``. + * Documentation of :pkg-field:`extra-files` + + .. math:: + \mathrm{commalist}\left\{ \mathop{\mathit{hs\text{-}string}}\mid{{[\mathop{\mathord{``}\mathtt{\ }\mathord{"}}\mathop{\mathord{``}\mathtt{\text{,}}\mathord{"}}]^c}}^+_{} \right\} + extra-source-files * Monoidal field * Documentation of :pkg-field:`extra-source-files` diff --git a/doc/cabal-commands.rst b/doc/cabal-commands.rst index a5c3af693a1..6a1d9e6e695 100644 --- a/doc/cabal-commands.rst +++ b/doc/cabal-commands.rst @@ -19,7 +19,6 @@ Commands [global] user-config Display and update the user's global cabal configuration. help Help about commands. - path Display paths used by cabal. [package database] update Updates list of known packages. @@ -36,6 +35,7 @@ Commands freeze Freeze dependencies. gen-bounds Generate dependency bounds. outdated Check for outdated dependencies. + path Query for simple project information. [project building and installing] build Compile targets within the project. @@ -245,8 +245,8 @@ A cabal command target can take any of the following forms: component of which the given filepath is a part of will be built. - A script target: ``path/to/script``, which specifies the path to a script - file. This is supported by ``build``, ``repl``, ``run``, and ``clean``. - Script targets are not part of a package. + file. This is supported by ``build``, ``repl``, ``run``, ``list-bin``, and + ``clean``. Script targets are not part of a package. .. _command-group-global: @@ -285,67 +285,6 @@ cabal preferences. It is very useful when you are e.g. first configuring Note how ``--augment`` syntax follows ``cabal user-config diff`` output. -cabal path -^^^^^^^^^^ - -``cabal path`` allows to query for paths used by ``cabal``. -For example, it allows to query for the directories of the cache, store, -installed binaries, and so on. - -:: - - $ whoami - alice - - $ cabal path - compiler-flavour: ghc - compiler-id: ghc-9.8.2 - compiler-path: /home/alice/.ghcup/bin/ghc - cache-home: /home/alice/.cabal - remote-repo-cache: /home/alice/.cabal/packages - logs-dir: /home/alice/.cabal/logs - store-dir: /home/alice/.cabal/store - config-file: /home/alice/.cabal/config - installdir: /home/alice/.cabal/bin - -Or using the json output: - -:: - - $ cabal path --output-format=json | jq - -.. code-block:: json - - { - "cabal-version": "3.13.0.0", - "compiler": { - "flavour": "ghc", - "id": "ghc-9.8.2", - "path": "/home/alice/.ghcup/bin/ghc" - }, - "cache-home": "/home/alice/.cabal", - "remote-repo-cache": "/home/alice/.cabal/packages", - "logs-dir": "/home/alice/.cabal/logs", - "store-dir": "/home/alice/.cabal/store", - "config-file": "/home/alice/.cabal/config", - "installdir": "/home/alice/.cabal/bin" - } - -If ``cabal path`` is passed a single option naming a path, then that -path will be printed *without* any label: - -:: - - $ cabal path --installdir - /home/alice/.cabal/bin - -While this interface is intended to be used for scripting, it is an experimental command. -Scripting example: - -:: - $ ls $(cabal path --installdir) - ... - .. _command-group-database: Package database commands @@ -394,7 +333,7 @@ cabal list cabal info ^^^^^^^^^^ -``cabal info [FLAGS] PACKAGES`` displays useful informations about remote +``cabal info [FLAGS] PACKAGES`` displays useful information about remote packages. .. option:: --package-db=DB @@ -467,7 +406,7 @@ the source code of ``PACKAGES`` locally. By default the content of the packages is unpacked in the current working directory, in named subfolders (e.g. ``./filepath-1.2.0.8/``), use ``--destdir=PATH`` to specify another folder. By default the latest version of the package is downloaded, you can -ask for a spefic one by adding version numbers +ask for a specific one by adding version numbers (``cabal get random-1.0.0.1``). The ``cabal get`` command supports the following options: @@ -733,6 +672,68 @@ Examples: be used without arguments, in that case major version bumps are ignored for all packages. +cabal path +^^^^^^^^^^ + +``cabal path`` allows to query for paths used by ``cabal``. +For example, it allows to query for the directories of the cache, store, +installed binaries, and so on. + +:: + + $ whoami + alice + + $ cabal path + compiler-flavour: ghc + compiler-id: ghc-9.8.2 + compiler-path: /home/alice/.ghcup/bin/ghc + cache-home: /home/alice/.cabal + remote-repo-cache: /home/alice/.cabal/packages + logs-dir: /home/alice/.cabal/logs + store-dir: /home/alice/.cabal/store + config-file: /home/alice/.cabal/config + installdir: /home/alice/.cabal/bin + +Or using the json output: + +:: + + $ cabal path --output-format=json | jq + +.. code-block:: json + + { + "cabal-version": "3.13.0.0", + "compiler": { + "flavour": "ghc", + "id": "ghc-9.8.2", + "path": "/home/alice/.ghcup/bin/ghc" + }, + "cache-home": "/home/alice/.cabal", + "remote-repo-cache": "/home/alice/.cabal/packages", + "logs-dir": "/home/alice/.cabal/logs", + "store-dir": "/home/alice/.cabal/store", + "config-file": "/home/alice/.cabal/config", + "installdir": "/home/alice/.cabal/bin" + } + +If ``cabal path`` is passed a single option naming a path, then that +path will be printed *without* any label: + +:: + + $ cabal path --installdir + /home/alice/.cabal/bin + +While this interface is intended to be used for scripting, it is an experimental command. +Scripting example: + +:: + + $ ls $(cabal path --installdir) + ... + .. _command-group-build: Project building and installing @@ -970,6 +971,14 @@ We can also scope to test suite targets as they produce binaries. $ cabal list-bin cabal-install:unit-tests /.../dist-newstyle/.../unit-tests/unit-tests +It can also be used to display the location of the cached executable for a +cabal script. + +:: + + $ cabal list-bin path/to/script + $XDG_CACHE_HOME/cabal/script-builds/.../bin/script + Note that ``cabal list-bin`` will print the executables' location, but will not make sure that these executables actually exist (i.e., have been successfully built). In order to determine the correct location, @@ -1140,6 +1149,9 @@ The executable is cached under the cabal directory, and can be pre-built with ``cabal build path/to/script`` and the cache can be removed with ``cabal clean path/to/script``. +The location of the cached executable can be displayed with +``cabal list-bin path/to/script``. + A note on targets: Whenever a command takes a script target and it matches the name of another target, the other target is preferred. To load the script instead pass it as an explicit path: ./script @@ -1285,7 +1297,7 @@ A list of all warnings with their constructor: - ``unsupported-bench``: unsupported benchmark type. - ``bench-unknown-extension``: ``main-is`` for benchmark is neither ``.hs`` nor ``.lhs``. - ``invalid-name-win``: invalid package name on Windows. -- ``reserved-z-prefix``: package with ``z-`` prexif (reseved for Cabal. +- ``reserved-z-prefix``: package with ``z-`` prefix (reserved for Cabal). - ``no-build-type``: missing ``build-type``. - ``undeclared-custom-setup``: ``custom-setup`` section without ``build-type: Custom`` - ``unknown-compiler-tested``: unknown compiler in ``tested-with``. @@ -1315,6 +1327,9 @@ A list of all warnings with their constructor: - ``unrecognised-repo-type``: unrecognised kind of source-repository. - ``repo-no-type``: missing ``type`` in ``source-repository``. - ``repo-no-location``: missing ``location`` in ``source-repository``. +- ``git-protocol``: using insecure ``git://`` protocol + (`explanation `__ + in Git Book). - ``repo-no-module``: missing ``module`` in ``source-repository``. - ``repo-no-tag``: missing ``tag`` in ``source-repository``. - ``repo-relative-dir``: ``subdir`` in ``source-repository`` must be relative. @@ -1369,13 +1384,16 @@ A list of all warnings with their constructor: - ``no-autogen-paths``: missing autogen ``Paths_*`` modules in ``autogen-modules`` (``cabal-version`` ≥ 2.0). - ``no-autogen-pinfo``: missing autogen ``PackageInfo_*`` modules in ``autogen-modules`` *and* ``exposed-modules``/``other-modules`` (``cabal-version`` ≥ 2.0). - ``no-glob-match``: glob pattern not matching any file. -- ``glob-no-extension``: glob pattern not matching any file becuase of lack of extension matching (`cabal-version` < 2.4). +- ``glob-no-extension``: glob pattern not matching any file because of lack of extension matching (`cabal-version` < 2.4). - ``glob-missing-dir``: glob pattern trying to match a missing directory. - ``unknown-os``: unknown operating system name in condition. - ``unknown-arch``: unknown architecture in condition. - ``unknown-compiler``: unknown compiler in condition. - ``missing-bounds-important``: missing upper bounds for important dependencies (``base``, and for ``custom-setup`` ``Cabal`` too). -- ``missing-upper-bounds``: missing upper bound in dependency (excluding test-suites and benchmarks). +- ``missing-upper-bounds``: missing upper bound in dependency [#dep-excl]_. +- ``le-upper-bounds``: less than or equals (<=) constraint on upper bound in dependency [#dep-excl]_. +- ``tz-upper-bounds``: trailing zero (\*.0) upper bound in dependency [#dep-excl]_. +- ``gt-lower-bounds``: greater than (>) constraint on lower bound in dependency [#dep-excl]_. - ``suspicious-flag``: troublesome flag name (e.g. starting with a dash). - ``unused-flag``: unused user flags. - ``non-ascii``: non-ASCII characters in custom field. @@ -1398,9 +1416,42 @@ A list of all warnings with their constructor: - ``missing-conf-script``: missing ``configure`` script with ``build-type: Configure``. - ``unknown-directory``: paths refer to a directory which does not exist. - ``no-repository``: missing ``source-repository`` section. -- ``no-docs``: missing expected documentation files (changelog). +- ``no-docs``: missing expected documentation files. Checks + whether there is anything similar to a changelog file in your working + directory (e.g. ``CHANGELOG``, ``NEWS``, ``changelog.md``, etc.). If this + file is not present in the :pkg-field:`extra-doc-files` field, warns about it. - ``doc-place``: documentation files listed in ``extra-source-files`` instead of ``extra-doc-files``. +.. [#dep-excl] In dependencies excluding test-suites and benchmarks. + +.. note:: + + ``cabal check`` warns on subexpressions (individual version constraints) of + a version range that are of the form, ``> version``, ``<= version``, ``<= + version.0[...0]``. These are considered suspicious because they are likely + to be mistakes. Guidelines for individual version constraints within + version ranges and examples of mistakes when not following these are: + + "A lower bound should be inclusive." + + Asking for ``base > 4.11`` when you actually want ``base >= 4.12`` is an + example of making this mistake. Versions make a dense space, so there + are infinitely many versions that are ``> 4.11`` and ``< 4.12``. + + "An upper bound should be exclusive." + + Asking for ``base <= 4.19.1.0`` when the last published version is + ``base-4.19.1.0`` is an example of making this mistake. This blocks + patch releases that should always be fine according to the PVP. The + correct minor bound is ``base < 4.19.2``. + + "An upper bound should not have trailing zeros." + + Asking for ``base < 4.20.0.0`` when you meant allow any ``base-4.19.*`` + version is an example of making this mistake. In fact, ``base-4.20`` and + ``base-4.20.0`` are not excluded by the bound. The correct bound is ``< + 4.20``. + .. _cabal-sdist: cabal sdist diff --git a/doc/cabal-package-description-file.rst b/doc/cabal-package-description-file.rst index 450ddc0c0d3..9eb2aef2705 100644 --- a/doc/cabal-package-description-file.rst +++ b/doc/cabal-package-description-file.rst @@ -646,42 +646,24 @@ describe the package as a whole: :: - tested-with: GHC == 9.0.1, GHC == 8.10.4, GHC == 8.8.4, - GHC == 8.6.5, GHC == 8.4.4, GHC == 8.2.2, GHC == 8.0.2, - GHC == 7.10.3, GHC == 7.8.4, GHC == 7.6.3, GHC == 7.4.2 + tested-with: GHC == 9.10.1, GHC == 9.8.2, GHC == 9.6.5 The same can be spread over several lines, for instance: :: - tested-with: GHC == 9.0.1 - , GHC == 8.10.4 - , GHC == 8.8.4 - , GHC == 8.6.5 - , GHC == 8.4.4 - , GHC == 8.2.2 - , GHC == 8.0.2 - , GHC == 7.10.3 - , GHC == 7.8.4 - , GHC == 7.6.3 - , GHC == 7.4.2 + tested-with: GHC == 9.10.1 + , GHC == 9.8.2 + , GHC == 9.6.5 The separating comma can also be dropped altogether: :: tested-with: - GHC == 9.0.1 - GHC == 8.10.4 - GHC == 8.8.4 - GHC == 8.6.5 - GHC == 8.4.4 - GHC == 8.2.2 - GHC == 8.0.2 - GHC == 7.10.3 - GHC == 7.8.4 - GHC == 7.6.3 - GHC == 7.4.2 + GHC == 9.10.1 + GHC == 9.8.2 + GHC == 9.6.5 However, this alternative might `disappear `__ @@ -696,24 +678,16 @@ describe the package as a whole: :: tested-with: - , GHC == 9.0.1 - , GHC == 8.10.4 - , GHC == 8.8.4 - , GHC == 8.6.5 - , GHC == 8.4.4 - , GHC == 8.2.2 - , GHC == 8.0.2 - , GHC == 7.10.3 - , GHC == 7.8.4 - , GHC == 7.6.3 - , GHC == 7.4.2 + , GHC == 9.10.1 + , GHC == 9.8.2 + , GHC == 9.6.5 2. A concise set notation syntax is available: :: - tested-with: GHC == { 9.0.1, 8.10.4, 8.8.4, 8.6.5, 8.4.4, 8.2.2, 8.0.2, 7.10.3, 7.8.4, 7.6.3, 7.4.2 } + tested-with: GHC == { 9.10.1, 9.8.2, 9.6.5 } .. pkg-field:: data-files: filename list @@ -799,6 +773,11 @@ describe the package as a whole: additional hooks, such as the scheme described in the section on `system-dependent parameters`_. +.. pkg-field:: extra-files: filename list + + A list of additional files to be included in source distributions built with :ref:`setup-sdist`. + As with :pkg-field:`data-files` it can use a limited form of ``*`` wildcards in file names. + Library ^^^^^^^ @@ -993,10 +972,10 @@ is an example: library build-depends: - , base ^>= 4.11.1.0 - , bytestring ^>= 0.10.2.0 - , containers ^>= 0.4.2.1 || ^>= 0.5.0.0 - , transformers ^>= 0.5.0.0 + , base ^>= 4.19.0.0 + , bytestring ^>= 0.12.0.0 + , containers ^>= 0.6.8 || ^>= 0.7.0 + , transformers ^>= 0.6.1.0 hs-source-dirs: src @@ -1010,9 +989,9 @@ is an example: library attoparsec build-depends: - , base ^>= 4.11.1.0 - , bytestring ^>= 0.10.2.0 - , deepseq ^>= 1.4.0.0 + , base ^>= 4.19.0.0 + , bytestring ^>= 0.12.0.0 + , deepseq ^>= 1.5.0.0 hs-source-dirs: vendor/attoparsec-0.13.1.0 @@ -1135,14 +1114,14 @@ the :pkg-field:`test-module` field. An optional list of preprocessors which can generate new modules for use in the test-suite. - A list of executabes (possibly brought into scope by + A list of executables (possibly brought into scope by :pkg-field:`build-tool-depends`) that are run after all other preprocessors. These executables are invoked as so: ``exe-name TARGETDIR [SOURCEDIRS] -- [GHCOPTIONS]``. The arguments are, in order a target dir for output, a sequence of all source directories with source files of local lib components that the given test stanza depends on, and following a double dash, all options cabal would pass to ghc for a - build. They are expected to output a newline-seperated list of + build. They are expected to output a newline-separated list of generated modules which have been written to the targetdir (excepting, if written, the main module). This can be used for driving doctests and other discover-style tests generated @@ -1310,146 +1289,7 @@ Example: end <- getCurrentTime putStrLn $ "fib 20 took " ++ show (diffUTCTime end start) - -Foreign libraries -^^^^^^^^^^^^^^^^^ - -Foreign libraries are system libraries intended to be linked against -programs written in C or other "foreign" languages. They -come in two primary flavours: dynamic libraries (``.so`` files on Linux, -``.dylib`` files on OSX, ``.dll`` files on Windows, etc.) are linked against -executables when the executable is run (or even lazily during -execution), while static libraries (``.a`` files on Linux/OSX, ``.lib`` -files on Windows) get linked against the executable at compile time. - -Foreign libraries only work with GHC 7.8 and later. - -A typical stanza for a foreign library looks like - -:: - - foreign-library myforeignlib - type: native-shared - lib-version-info: 6:3:2 - - if os(Windows) - options: standalone - mod-def-file: MyForeignLib.def - - other-modules: MyForeignLib.SomeModule - MyForeignLib.SomeOtherModule - build-depends: base >=4.7 && <4.9 - hs-source-dirs: src - c-sources: csrc/MyForeignLibWrapper.c - default-language: Haskell2010 - - -.. pkg-section:: foreign-library name - :since: 2.0 - :synopsis: Foreign library build information. - - Build information for `foreign libraries`_. - -.. pkg-field:: type: foreign library type - - Cabal recognizes ``native-static`` and ``native-shared`` here, although - we currently only support building `native-shared` libraries. - -.. pkg-field:: options: foreign library option list - - Options for building the foreign library, typically specific to the - specified type of foreign library. Currently we only support - ``standalone`` here. A standalone dynamic library is one that does not - have any dependencies on other (Haskell) shared libraries; without - the ``standalone`` option the generated library would have dependencies - on the Haskell runtime library (``libHSrts``), the base library - (``libHSbase``), etc. Currently, ``standalone`` *must* be used on Windows - and *must not* be used on any other platform. - -.. pkg-field:: mod-def-file: filename - - This option can only be used when creating dynamic Windows libraries - (that is, when using ``native-shared`` and the ``os`` is ``Windows``). If - used, it must be a path to a *module definition file*. The details of - module definition files are beyond the scope of this document; see the - `GHC `_ - manual for some details and some further pointers. - -.. pkg-field:: lib-version-info: current:revision:age - - This field is currently only used on Linux. - - This field specifies a Libtool-style version-info field that sets - an appropriate ABI version for the foreign library. Note that the - three numbers specified in this field do not directly specify the - actual ABI version: ``6:3:2`` results in library version ``4.2.3``. - - With this field set, the SONAME of the library is set, and symlinks - are installed. - - How you should bump this field on an ABI change depends on the - breakage you introduce: - - - Programs using the previous version may use the new version as - drop-in replacement, and programs using the new version can also - work with the previous one. In other words, no recompiling nor - relinking is needed. In this case, bump ``revision`` only, don't - touch current nor age. - - Programs using the previous version may use the new version as - drop-in replacement, but programs using the new version may use - APIs not present in the previous one. In other words, a program - linking against the new version may fail with "unresolved - symbols" if linking against the old version at runtime: set - revision to 0, bump current and age. - - Programs may need to be changed, recompiled, and relinked in - order to use the new version. Bump current, set revision and age - to 0. - - Also refer to the Libtool documentation on the version-info field. - -.. pkg-field:: lib-version-linux: version - - This field is only used on Linux. - - Specifies the library ABI version directly for foreign libraries - built on Linux: so specifying ``4.2.3`` causes a library - ``libfoo.so.4.2.3`` to be built with SONAME ``libfoo.so.4``, and - appropriate symlinks ``libfoo.so.4`` and ``libfoo.so`` to be - installed. - -Note that typically foreign libraries should export a way to initialize -and shutdown the Haskell runtime. In the example above, this is done by -the ``csrc/MyForeignLibWrapper.c`` file, which might look something like - -.. code-block:: c - - #include - #include "HsFFI.h" - - HsBool myForeignLibInit(void){ - int argc = 2; - char *argv[] = { "+RTS", "-A32m", NULL }; - char **pargv = argv; - - // Initialize Haskell runtime - hs_init(&argc, &pargv); - - // do any other initialization here and - // return false if there was a problem - return HS_BOOL_TRUE; - } - - void myForeignLibExit(void){ - hs_exit(); - } - -With modern ghc regular libraries are installed in directories that contain -package keys. This isn't usually a problem because the package gets registered -in ghc's package DB and so we can figure out what the location of the library -is. Foreign libraries however don't get registered, which means that we'd have -to have a way of finding out where a platform library got installed (other than by -searching the ``lib/`` directory). Instead, we install foreign libraries in -``~/.local/lib``. +.. _build-info: Build information ^^^^^^^^^^^^^^^^^ @@ -1504,7 +1344,7 @@ system-dependent values for these fields. but ``time-1.12.3`` bumps the lower bound on base to ``>=4.14``. If we still want to compile with a ``ghc-8.8.*`` version of GHC that ships with ``base-4.13`` and with later GHC versions, then we can use ``time >=1.12 - && (time <1.12.3 || time >1.12.3)``. + && (<1.12.3 || >1.12.3)``. Hackage shows deprecated and preferred versions for packages, such as for `containers `_ @@ -1892,8 +1732,11 @@ system-dependent values for these fields. .. pkg-field:: ghc-options: token list - Additional options for GHC. You can often achieve the same effect - using the :pkg-field:`default-extensions` field, which is preferred. + Additional options for GHC. + + If specifying extensions (via ``-X`` flags) one can often achieve + the same effect using the :pkg-field:`default-extensions` field, which is + preferred. Options required only by one module may be specified by placing an ``OPTIONS_GHC`` pragma in the source file affected. @@ -1930,6 +1773,18 @@ system-dependent values for these fields. ones specified via :pkg-field:`ghc-options`, and are passed to GHC during both the compile and link phases. +.. pkg-field:: ghc-prof-shared-options: token list + + Additional options for GHC when the package is built as shared profiling + library. The options specified via this field are combined with the + ones specified via :pkg-field:`ghc-options`, and are passed to GHC during + both the compile and link phases. + + Note that if any :pkg-field:`ghc-shared-options` are set, the + ``-dynamic-too` option will never be passed to GHC, leading to all modules + being compiled twice (once to generate the ``.o`` files and another to + generate the ``.dyn_o`` files). + .. pkg-field:: ghcjs-options: token list Like :pkg-field:`ghc-options` but applies to GHCJS @@ -1942,7 +1797,16 @@ system-dependent values for these fields. Like :pkg-field:`ghc-shared-options` but applies to GHCJS +.. pkg-field:: ghcjs-prof-shared-options: token list + + Like :pkg-field:`ghc-prof-shared-options` but applies to GHCJS + .. pkg-field:: includes: filename list + :since: 1.0 + :deprecated: 2.0 + + From GHC 6.10.1, :pkg-field:`includes` has no effect when compiling with + GHC. From Cabal 2.0, support for GHC versions before GHC 6.12 was removed. A list of header files to be included in any compilations via C. This field applies to both header files that are already installed @@ -1993,6 +1857,8 @@ system-dependent values for these fields. locate files listed in :pkg-field:`includes` and :pkg-field:`install-includes`. + Directories here will be passed as ``-I`` flags to GHC. + .. pkg-field:: c-sources: filename list A list of C source files to be compiled and linked with the Haskell @@ -2029,7 +1895,7 @@ system-dependent values for these fields. .. pkg-field:: extra-libraries: token list A list of extra libraries to link with (when not linking fully static - executables). + executables). Libraries will be passed as ``-optl-l`` flags to GHC. .. pkg-field:: extra-libraries-static: token list @@ -2063,7 +1929,7 @@ system-dependent values for these fields. .. pkg-field:: extra-lib-dirs: directory list A list of directories to search for libraries (when not linking fully static - executables). + executables). Directories will be passed as ``-optl-L`` flags to GHC. .. pkg-field:: extra-lib-dirs-static: directory list @@ -2080,7 +1946,8 @@ system-dependent values for these fields. .. pkg-field:: cc-options: token list - Command-line arguments to be passed to the C compiler. Since the + Command-line arguments to be passed to the Haskell compiler for the C + compiling phase (as ``-optc`` flags for GHC). Since the arguments are compiler-dependent, this field is more useful with the setup described in the section on `system-dependent parameters`_. @@ -2089,12 +1956,14 @@ system-dependent values for these fields. Command-line arguments for pre-processing Haskell code. Applies to Haskell source and other pre-processed Haskell source like .hsc .chs. Does not apply to C code, that's what cc-options is for. + Flags here will be passed as ``-optP`` flags to GHC. .. pkg-field:: cxx-options: token list :since: 2.2 - Command-line arguments to be passed to the compiler when compiling - C++ code. The C++ sources to which these command-line arguments + Command-line arguments to be passed to the Haskell compiler for the C++ + compiling phase (as ``-optcxx`` flags for GHC). + The C++ sources to which these command-line arguments should be applied can be specified with the :pkg-field:`cxx-sources` field. Command-line options for C and C++ can be passed separately to the compiler when compiling both C and C++ sources by segregating the C @@ -2106,20 +1975,22 @@ system-dependent values for these fields. .. pkg-field:: cmm-options: token list :since: 3.0 - Command-line arguments to be passed to the compiler when compiling + Command-line arguments to be passed to the Haskell compiler when compiling C-- code. See also :pkg-field:`cmm-sources`. .. pkg-field:: asm-options: token list :since: 3.0 - Command-line arguments to be passed to the assembler when compiling - assembler code. See also :pkg-field:`asm-sources`. + Command-line arguments to be passed to the Haskell compiler (as ``-opta`` + flags for GHC) when compiling assembler code. See also :pkg-field:`asm-sources`. .. pkg-field:: ld-options: token list - Command-line arguments to be passed to the linker. Since the - arguments are compiler-dependent, this field is more useful with the - setup described in the section on `system-dependent parameters`_. + Command-line arguments to be passed to the Haskell compiler (as ``-optl`` + flags for GHC) for the linking phase. Note that only executables (including + test-suites and benchmarks) are linked so this has no effect in libraries. + Since the arguments are compiler-dependent, this field is more useful with + the setup described in the section on `system-dependent parameters`_. .. pkg-field:: hsc2hs-options: token list :since: 3.6 @@ -2266,6 +2137,146 @@ system-dependent values for these fields. in a different package dependency, or at least in a separate internal library. +Foreign libraries +^^^^^^^^^^^^^^^^^ + +Foreign libraries are system libraries intended to be linked against +programs written in C or other "foreign" languages. They +come in two primary flavours: dynamic libraries (``.so`` files on Linux, +``.dylib`` files on OSX, ``.dll`` files on Windows, etc.) are linked against +executables when the executable is run (or even lazily during +execution), while static libraries (``.a`` files on Linux/OSX, ``.lib`` +files on Windows) get linked against the executable at compile time. + +Foreign libraries only work with GHC 7.8 and later. + +A typical stanza for a foreign library looks like + +:: + + foreign-library myforeignlib + type: native-shared + lib-version-info: 6:3:2 + + if os(Windows) + options: standalone + mod-def-file: MyForeignLib.def + + other-modules: MyForeignLib.SomeModule + MyForeignLib.SomeOtherModule + build-depends: base >=4.7 && <4.9 + hs-source-dirs: src + c-sources: csrc/MyForeignLibWrapper.c + default-language: Haskell2010 + + +.. pkg-section:: foreign-library name + :since: 2.0 + :synopsis: Foreign library build information. + + Build information for `foreign libraries`_. + +.. pkg-field:: type: foreign library type + + Cabal recognizes ``native-static`` and ``native-shared`` here, although + we currently only support building `native-shared` libraries. + +.. pkg-field:: options: foreign library option list + + Options for building the foreign library, typically specific to the + specified type of foreign library. Currently we only support + ``standalone`` here. A standalone dynamic library is one that does not + have any dependencies on other (Haskell) shared libraries; without + the ``standalone`` option the generated library would have dependencies + on the Haskell runtime library (``libHSrts``), the base library + (``libHSbase``), etc. Currently, ``standalone`` *must* be used on Windows + and *must not* be used on any other platform. + +.. pkg-field:: mod-def-file: filename + + This option can only be used when creating dynamic Windows libraries + (that is, when using ``native-shared`` and the ``os`` is ``Windows``). If + used, it must be a path to a *module definition file*. The details of + module definition files are beyond the scope of this document; see the + `GHC `_ + manual for some details and some further pointers. + +.. pkg-field:: lib-version-info: current:revision:age + + This field is currently only used on Linux. + + This field specifies a Libtool-style version-info field that sets + an appropriate ABI version for the foreign library. Note that the + three numbers specified in this field do not directly specify the + actual ABI version: ``6:3:2`` results in library version ``4.2.3``. + + With this field set, the SONAME of the library is set, and symlinks + are installed. + + How you should bump this field on an ABI change depends on the + breakage you introduce: + + - Programs using the previous version may use the new version as + drop-in replacement, and programs using the new version can also + work with the previous one. In other words, no recompiling nor + relinking is needed. In this case, bump ``revision`` only, don't + touch current nor age. + - Programs using the previous version may use the new version as + drop-in replacement, but programs using the new version may use + APIs not present in the previous one. In other words, a program + linking against the new version may fail with "unresolved + symbols" if linking against the old version at runtime: set + revision to 0, bump current and age. + - Programs may need to be changed, recompiled, and relinked in + order to use the new version. Bump current, set revision and age + to 0. + + Also refer to the Libtool documentation on the version-info field. + +.. pkg-field:: lib-version-linux: version + + This field is only used on Linux. + + Specifies the library ABI version directly for foreign libraries + built on Linux: so specifying ``4.2.3`` causes a library + ``libfoo.so.4.2.3`` to be built with SONAME ``libfoo.so.4``, and + appropriate symlinks ``libfoo.so.4`` and ``libfoo.so`` to be + installed. + +Note that typically foreign libraries should export a way to initialize +and shutdown the Haskell runtime. In the example above, this is done by +the ``csrc/MyForeignLibWrapper.c`` file, which might look something like + +.. code-block:: c + + #include + #include "HsFFI.h" + + HsBool myForeignLibInit(void){ + int argc = 2; + char *argv[] = { "+RTS", "-A32m", NULL }; + char **pargv = argv; + + // Initialize Haskell runtime + hs_init(&argc, &pargv); + + // do any other initialization here and + // return false if there was a problem + return HS_BOOL_TRUE; + } + + void myForeignLibExit(void){ + hs_exit(); + } + +With modern ghc regular libraries are installed in directories that contain +package keys. This isn't usually a problem because the package gets registered +in ghc's package DB and so we can figure out what the location of the library +is. Foreign libraries however don't get registered, which means that we'd have +to have a way of finding out where a platform library got installed (other than by +searching the ``lib/`` directory). Instead, we install foreign libraries in +``~/.local/lib``. + Configurations ^^^^^^^^^^^^^^ @@ -2637,11 +2648,11 @@ Starting with Cabal-2.2 it's possible to use common build info stanzas. :: common deps - build-depends: base ^>= 4.11 + build-depends: base ^>= 4.18 ghc-options: -Wall common test-deps - build-depends: tasty ^>= 0.12.0.1 + build-depends: tasty ^>= 1.4 library import: deps @@ -2736,22 +2747,28 @@ The :ref:`VCS fields` of ``source-repository`` are: This field is required. + .. include:: vcs/kind.rst + .. pkg-field:: location: VCS location This field is required. -.. pkg-field:: module: token + .. include:: vcs/location.rst - CVS requires a named module, as each CVS server can host multiple - named repositories. +.. pkg-field:: module: token This field is required for the CVS repository type and should not be used otherwise. + CVS requires a named module, as each CVS server can host multiple + named repositories. + .. pkg-field:: branch: VCS branch This field is optional. + .. include:: vcs/branch.rst + .. pkg-field:: tag: VCS tag This field is required for the ``this`` repository kind. @@ -2759,10 +2776,13 @@ The :ref:`VCS fields` of ``source-repository`` are: This might be used to indicate what sources to get if someone needs to fix a bug in an older branch that is no longer an active head branch. + .. include:: vcs/tag.rst + .. pkg-field:: subdir: VCS subdirectory This field is optional but, if given, specifies a single subdirectory. + .. include:: vcs/subdir.rst .. _setup-hooks: @@ -2852,8 +2872,8 @@ Declaring a ``custom-setup`` stanza also enables the generation of custom-setup setup-depends: - base >= 4.5 && < 4.11, - Cabal >= 1.14 && < 1.25 + base >= 4.18 && < 5, + Cabal >= 3.10 .. pkg-field:: setup-depends: package list :since: 1.24 @@ -3004,6 +3024,9 @@ Right now :pkg-field:`executable:main-is` modules are not supported on Accessing data files from package code -------------------------------------- +.. index:: Paths +.. index:: Paths_ + The placement on the target system of files listed in the :pkg-field:`data-files` field varies between systems, and in some cases one can even move packages around after installation @@ -3059,13 +3082,16 @@ the configured data directory for ``pretty-show`` is controlled with the Accessing the package version ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +.. index:: PackageInfo +.. index:: PackageInfo_ + The auto generated :file:`PackageInfo_{pkgname}` module exports the constant ``version ::`` `Version `__ which is defined as the version of your package as specified in the ``version`` field. -Accessing package-related informations -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Accessing package-related information +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ The auto generated :file:`PackageInfo_{pkgname}` module exports the following package-related constants: diff --git a/doc/cabal-project-description-file.rst b/doc/cabal-project-description-file.rst index c4e7327a842..929ec642f6f 100644 --- a/doc/cabal-project-description-file.rst +++ b/doc/cabal-project-description-file.rst @@ -1,3 +1,5 @@ +.. _cabal-project-file: + Project Description — cabal.project File ======================================== @@ -86,19 +88,25 @@ would not be necessitated. Specifying the local packages ----------------------------- +You *must* provide a non-empty list of local packages in your project, filling +out either a ``packages`` field or an ``optional-packages`` field or both to +satisfy this requirement. + +When ``cabal.project`` doesn't exist, ``cabal-install`` fabricates an ephemeral +project for its own use with this simple content, a glob that will find any (but +expects to find one) package in the current directory: + +.. code-block:: cabal + + packages: ./*.cabal + The following top-level options specify what the local packages of a project are: .. cfg-field:: packages: package location list (space or comma separated) :synopsis: Project packages. - :default: ``./*.cabal`` - - .. warning:: - - The default value ``./*.cabal`` only takes effect if there is no explicit - ``cabal.project`` file. - If you use such explicit file you *must* fill the field. + :default: empty Specifies the list of package locations which contain the local packages to be built by this project. Package locations can take the @@ -216,6 +224,14 @@ consider during package retrieval. This allows use of a package from a remote version control system, rather than looking for that package in Hackage. +Since version 3.4, cabal-install creates tarballs for each package coming from a +``source-repository-package`` stanza (effectively applying cabal sdists to such +packages). It gathers the names of the packages from the appropriate ``.cabal`` +file in the version control repository, and allows their use just like Hackage +or locally defined packages. + +There is no command line variant of this stanza. + .. code-block:: cabal packages: . @@ -237,12 +253,6 @@ Hackage. tag: e76fdc753e660dfa615af6c8b6a2ad9ddf6afe70 post-checkout-command: autoreconf -i -Since version 3.4, cabal-install creates tarballs for each package coming -from a ``source-repository-package`` stanza (effectively applying cabal -sdists to such packages). It gathers the names of the packages from the -appropriate ``.cabal`` file in the version control repository, and allows -their use just like Hackage or locally defined packages. - .. _source-repository-package-fields: The :ref:`VCS fields` of ``source-repository-package`` are: @@ -261,23 +271,33 @@ The :ref:`VCS fields` of ``source-repository-package`` are: This field is required. + .. include:: vcs/kind.rst + .. cfg-field:: location: VCS location This field is required. + .. include:: vcs/location.rst + .. cfg-field:: branch: VCS branch This field is optional. + .. include:: vcs/branch.rst + .. cfg-field:: tag: VCS tag This field is optional. + .. include:: vcs/tag.rst + .. cfg-field:: subdir: VCS subdirectory list Look in one or more subdirectories of the repository for cabal files, rather than the root. This field is optional. + .. include:: vcs/subdir.rst + .. cfg-field:: post-checkout-command: command Run command in the checked out repository, prior sdisting. @@ -759,6 +779,7 @@ The following settings control the behavior of the dependency solver: explicitly constrained. When set to `none`, the solver will consider all packages. +.. _package-configuration-options: Package configuration options ----------------------------- @@ -777,20 +798,17 @@ ways a package option can be specified: apply to all packages, local ones from the project and also external dependencies. - For example, the following options specify that :cfg-field:`optimization` -should be turned off for all local packages, and that ``bytestring`` (possibly -an external dependency) should be built with ``-fno-state-hack``:: +should be turned off for all local packages, and that ``awesome-package`` (possibly +an external dependency) should have the flag ``some-flag`` disabled :: optimization: False - package bytestring - ghc-options: -fno-state-hack + package awesome-package + flags: -some-flag -``ghc-options`` is not specifically described in this documentation, but is one -of many fields for configuring programs. They take the form -``progname-options`` and ``progname-location``, and can be set for all local -packages in a ``program-options`` stanza or under a package stanza. +Note that options at the top level take precedence over those at the ``package`` +stanza for local packages. On the command line, these options are applied to all local packages. There is no per-package command line interface. @@ -800,6 +818,26 @@ means that they are NOT supported by packages which use Custom setup scripts that require a version of the Cabal library older than when the feature was added. +.. cfg-section:: package name or * + + Specify package configuration options for the specific package (be it an + external or local package) or for all packages (external and local). + + A ``package`` stanza can contain the configuration fields listed in this + section and ``-options``: + + :: + + package awesome-package + flags: -some-flag + profiling: True + cxx-options: -Wall + + Program options are not extensively described in this documentation but a + good amount of them can be found in the :ref:`build-info` section. + +.. cfg-section:: None + .. cfg-field:: flags: list of +flagname or -flagname (space separated) -f FLAGS or -fFLAGS, --flags=FLAGS --flags="+foo -bar", -ffoo, -f-bar @@ -1277,6 +1315,8 @@ Foreign function interface options ``--extra-framework-dirs=DIR``, which can be specified multiple times. +.. _profiling-options: + Profiling options ^^^^^^^^^^^^^^^^^ @@ -1303,6 +1343,8 @@ Profiling options The command line variant of this flag is ``--enable-profiling`` and ``--disable-profiling``. +.. _profiling-detail: + .. cfg-field:: profiling-detail: level --profiling-detail=level :synopsis: Profiling detail level. @@ -1342,7 +1384,7 @@ Profiling options late-toplevel Like top-level but costs will be assigned to top level definitions after optimization. This lowers profiling overhead massively while giving similar - levels of detail as toplevle-functions. However it means functions introduced + levels of detail as toplevel-functions. However it means functions introduced by GHC during optimization will show up in profiles as well. Corresponds to ``-fprof-late`` if supported and ``-fprof-auto-top`` otherwise. late @@ -1608,6 +1650,21 @@ running ``setup haddock``. This flag is provided as a technology preview and is subject to change in the next releases. +.. cfg-field:: haddock-use-unicode: boolean + --haddock-use-unicode + :synopsis: Pass --use-unicode option to haddock. + + Generate HTML documentation which contains unicode characters. + +.. cfg-field:: haddock-resources-dir: DIR + --haddock-resources-dir=DIR + :synopsis: Location of Haddock's static/auxiliary files. + + Location of Haddock's static/auxiliary files. For Haddock distributed with + GHC (or, more precisely, built within the GHC source tree), this path should + be automatically inferred. For Haddock built from source, however, this path + should likely be explicitly set for every Haddock invocation. + .. cfg-field:: open: boolean --open :synopsis: Open generated documentation in-browser. @@ -1616,11 +1673,36 @@ running ``setup haddock``. when complete. This will use ``xdg-open`` on Linux and BSD systems, ``open`` on macOS, and ``start`` on Windows. +Program options +^^^^^^^^^^^^^^^ + +.. cfg-section:: program-options + +:ref:`Program options` can be specified once for all local packages by means of the +``program-options`` stanza. For example: + +:: + + program-options + ghc-options: -Werror + +indicates that all **local packages** will provide ``-Werror`` to GHC when being +built. On the other hand, the following snippet: + +:: + + package * + ghc-options: -Werror + +will apply ``-Werror`` to all packages, local and remote. + Advanced global configuration options ------------------------------------- +.. cfg-section:: None + .. cfg-field:: write-ghc-environment-files: always, never, or ghc8.4.4+ - --write-ghc-environment-files=always\|never\|ghc8.4.4+ + --write-ghc-environment-files=always|never|ghc8.4.4+ :synopsis: Whether a ``.ghc.environment`` should be created after a successful build. :default: ``never`` @@ -1629,7 +1711,7 @@ Advanced global configuration options should be created after a successful build. Since Cabal 3.0, defaults to ``never``. Before that, defaulted to - creating them only when compiling with GHC 8.4.4 and older (GHC + creating them only when compiling with GHC 8.4.4 and later (GHC 8.4.4 `is the first version `_ that supports the ``-package-env -`` option that allows ignoring the package diff --git a/doc/cabaldomain.py b/doc/cabaldomain.py index 2d318f8508f..9e16aefa6d6 100644 --- a/doc/cabaldomain.py +++ b/doc/cabaldomain.py @@ -548,7 +548,7 @@ class CabalPackageFieldXRef(CabalFieldXRef): ''' section_key = 'cabal:pkg-section' -class CabalConfigSection(CabalSection): +class CabalConfigSection(CabalObject): """ Marks section in package.cabal file """ @@ -556,6 +556,39 @@ class CabalConfigSection(CabalSection): section_key = 'cabal:cfg-section' target_prefix = 'cfg-section-' + def handle_signature(self, sig, signode): + ''' + As in sphinx.directives.ObjectDescription + + By default make an object description from name and adding + either deprecated or since as annotation. + ''' + env = self.state.document.settings.env + + sig = sig.strip() + parts = sig.split(' ',1) + name = parts[0] + signode += addnodes.desc_name(name, name) + signode += addnodes.desc_addname(' ', ' ') + if len(parts) > 1: + rest = parts[1].strip() + signode += addnodes.desc_annotation(rest, rest) + + return name + + def get_env_key(self, env, name): + store = CabalDomain.types[self.objtype] + return name, store + + def run(self): + env = self.state.document.settings.env + section = self.arguments[0].strip().split(' ',1)[0] + if section == 'None': + env.ref_context.pop('cabal:cfg-section', None) + return [] + env.ref_context['cabal:cfg-section'] = section + return super(CabalConfigSection, self).run() + class ConfigField(CabalField): section_key = 'cabal:cfg-section' indextemplate = '%s ; cabal project option' @@ -791,6 +824,9 @@ def make_full_name(typ, key, meta): if typ == 'pkg-section': return 'pkg-section-' + key + elif typ == 'cfg-section': + return 'cfg-section-' + key + elif typ == 'pkg-field': section, name = key if section is not None: @@ -914,4 +950,3 @@ class CabalLexer(lexer.RegexLexer): def setup(app): app.add_domain(CabalDomain) app.add_lexer('cabal', CabalLexer) - diff --git a/doc/config.rst b/doc/config.rst index 5c85498b181..36a53f958b0 100644 --- a/doc/config.rst +++ b/doc/config.rst @@ -297,3 +297,102 @@ recommended instead to use a *secure* local repository: The layout of these secure local repos matches the layout of remote repositories exactly; the :hackage-pkg:`hackage-repo-tool` can be used to create and manage such repositories. + +.. _program_options: + +Program options +--------------- + +Programs that ``cabal`` knows about can be provided with options that will be +passed in whenever the program is invoked by ``cabal``. The configuration file +can contain a stanza of ``program-default-options`` with ``-options`` +fields to specify these. + +:: + + program-default-options + ghc-options: ... + happy-options: ... + +The list of known programs is: + ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| Program | Notes | ++=======================+====================================================================================================================================+ +| ``alex`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``ar`` | Usually provided by GHC's ``"ar command"`` entry in ``ghc --info``. Note this might refer to ``llvm-ar`` instead of GNU's ``ar``. | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``c2hs`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``doctest`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``gcc`` | Usually provided by GHC's ``"C compiler command"`` entry in ``ghc --info``. Note this might refer to ``clang`` instead of ``gcc``. | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``ghc`` | | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``ghc-pkg`` | | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``ghcjs`` | | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``ghcjs-pkg`` | | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``greencard`` | Greencard hasn't been updated since 2014, it doesn't build with newer GHCs ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``haddock`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``happy`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``haskell-suite`` | Haskell suite was abandoned a long time ago. | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``haskell-suite-pkg`` | Haskell suite was abandoned a long time ago. | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``hmake`` | Seems like hmake disappeared a long time ago ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``hpc`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``hsc2hs`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``hscolour`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``jhc`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``ld`` | Usually provided by GHC's ``"ld command"`` entry in ``ghc --info``. | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``pkg-config`` | | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``runghc`` | | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``strip`` | | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``tar`` | | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ +| ``uhc`` | ``_ | ++-----------------------+------------------------------------------------------------------------------------------------------------------------------------+ + +.. warning:: + + It is important to not confuse these options with the ones listed in the + :ref:`build info` section. The ``*-options`` fields mentioned are in + fact syntactic sugar for specific ``ghc-options`` that will be passed only on + certain phases. + +.. warning:: + + These options will be used when ``cabal`` invokes the tool as part of the build process or as part of a + :pkg-field:`build-tool-depends` declaration, not whenever the tool is invoked by + third parties. + + In particular this means that for example ``gcc-options`` will be used when ``cabal`` + invokes ``gcc``, which is **not** when C sources are compiled by GHC (even though GHC + might invoke ``gcc`` internally). In order to provide options through GHC for those programs, one has to check the + GHC User guide's `Section `_. + In short, those options have to be given as ``-opt`` flags to GHC. + +.. note:: + + The only case that violates the rule specified in this last warning above is + ``ld-options``, which get passed as ``-optl`` options when GHC is invoked for + linking, as with the :pkg-field:`ld-options` field in package descriptions. + Notably, although ``gcc-options`` could be passed as :pkg-field:`cc-options` + in the appropriate phases, they are actually **not** passed. diff --git a/doc/external-commands.rst b/doc/external-commands.rst index e72495aa160..eca76483cc1 100644 --- a/doc/external-commands.rst +++ b/doc/external-commands.rst @@ -4,7 +4,8 @@ External Commands ``cabal-install`` provides a system for external commands, akin to the ones used by tools like ``git`` or ``cargo``. If you execute ``cabal ``, ``cabal-install`` will search the path for an executable named ``cabal-`` and execute it. The name of the command is passed as the first argument and -the remaining arguments are passed afterwards. An error will be thrown in case the custom command is not found. +the remaining arguments are passed afterwards. An error will be thrown in case the custom command is not found. The exit code of cabal when calling an external command is the same as the exit code +of the command. The ``$CABAL`` environment variable is set to the path of the ``cabal-install`` executable which invoked the subcommand. diff --git a/doc/file-format-changelog.rst b/doc/file-format-changelog.rst index 854f949b301..8f8850703b3 100644 --- a/doc/file-format-changelog.rst +++ b/doc/file-format-changelog.rst @@ -19,6 +19,15 @@ relative to the respective preceding *published* version. versions of the ``Cabal`` library denote unreleased development branches which have no stability guarantee. +``cabal-version: 3.14`` +----------------------- + +* Added field ``extra-files`` for specifying extra files to be included in + ``sdist`` without adding any other semantics (cf. ``extra-source-files`` + is tracked by ``cabal build``). +* License fields use identifiers from SPDX License List version + ``3.25 2024-08-19``. + ``cabal-version: 3.12`` ----------------------- @@ -30,7 +39,7 @@ relative to the respective preceding *published* version. ---------------------- * Added field ``code-generators`` to :pkg-section:`test-suite` stanzas. This - enumerates executabes (possibly brought into scope by :pkg-field:`build-tool-depends`) that are run after all other + enumerates executables (possibly brought into scope by :pkg-field:`build-tool-depends`) that are run after all other preprocessors. These executables are invoked with a target dir for output, a sequence of all source directories with source files of local lib components that the given test stanza depends on, and diff --git a/doc/getting-started.rst b/doc/getting-started.rst index 056c4a85ebd..9a3d572a3d8 100644 --- a/doc/getting-started.rst +++ b/doc/getting-started.rst @@ -58,9 +58,21 @@ The ``myapp.cabal`` file is a package description file, commonly referred to as hs-source-dirs: app default-language: Haskell2010 +.. warning:: + + The version bounds on base, a boot library distributed with GHC + [#boot-packages]_, are tied to the GHC version visible when ``cabal init`` + is run. If run with a later version of GHC you might see a difference in the + version bounds. + + .. code-block:: diff + + - build-depends: base ^>=4.19.0.0 + + build-depends: base ^>=4.20.0.0 + It contains metadata (package name and version, author name, license, etc.) and sections to define package components. Components can be used to split large codebases into smaller, -more managable building blocks. +more manageable building blocks. A component can be of one of several types (executable, library, etc.) and describes, among other things, the location of source files and its dependencies. The ``myapp.cabal`` file above defines a single component named ``myapp`` of the executable type. @@ -189,7 +201,7 @@ the following file named ``myscript``: #!/usr/bin/env cabal {- cabal: build-depends: - base ^>=4.19.0.0, + base, haskell-say ^>=1.0.0.0 -} @@ -198,9 +210,24 @@ the following file named ``myscript``: main :: IO () main = haskellSay "Hello, Haskell!" +.. note:: + + Widening or dropping version bound constraints on *packages included with + the compiler* [#boot-packages]_, like ``base``, may allow single-file + scripts to run with a wider range of compiler versions. + + .. code-block:: diff + + build-depends: + - base ^>=4.19.0.0, + + base, + The necessary sections of a ``.cabal`` file are placed directly into the script as a comment. +The necessary sections of a package description that would otherwise be in a +``.cabal`` file are placed directly into the script as a comment. + Use the familiar ``cabal run`` command to execute this script: .. code-block:: console @@ -222,6 +249,12 @@ can be run directly after setting the execute permission (+x): See more in the documentation for :ref:`cabal run`. +.. warning:: + + Single-file scripts cannot also be part of a package, as an executable or + listed as a module. Trying to run a module that is included in a package + will error with `Cabal-7070`_. + What Next? ---------- @@ -229,3 +262,11 @@ Now that you know how to set up a simple Haskell package using Cabal, check out some of the resources on the Haskell website's `documentation page `__ or read more about packages and Cabal on the :doc:`What Cabal does ` page. + +.. _Cabal-7070: https://errors.haskell.org/messages/Cabal-7070/ + +.. [#boot-packages] Packages included with the compiler are also called boot + packages. Each GHC compiler version has accompanying `release notes`_ that + list these included packages. + +.. _release notes: https://downloads.haskell.org/ghc/latest/docs/users_guide/release-notes.html diff --git a/doc/how-to-enable-profiling.rst b/doc/how-to-enable-profiling.rst new file mode 100644 index 00000000000..16611bfcafe --- /dev/null +++ b/doc/how-to-enable-profiling.rst @@ -0,0 +1,161 @@ +How to enable collection of performance statistics (profiling) +============================================================== + +When a Haskell application is slow or uses too much memory, +Cabal and `GHC `__ +can help you understand why. The main steps are: + +1. Configure the project in a way that makes GHC insert performance-measuring code into your application. +2. Run the application with the right + `runtime system (RTS) flags `__ + to produce a performance report. +3. Visualize and analyze that report. + +The process of inserting performance measuring code and collecting performance information +is called "profiling". +This guide describes how to instruct Cabal to pass desired profiling flags to the GHC compiler; +Cabal acts as a convenient build configuration interface while the work is done by GHC. +To get a deeper understanding of the overall profiling process itself in GHC, +it is highly recommended to read in depth the +`Profiling section in GHC's User Guide `__. + +Profiling CPU performance +------------------------- + +First, configure Cabal to build your application, e.g. ``my-app``, with profiling enabled, +with the following command: + +.. code-block:: console + + $ cabal configure --enable-profiling + +This command creates a ``cabal.project.local`` file with the following content: + +.. code-block:: cabal + + profiling: True + +This file stores temporary configuration settings that are passed implicitly to further Cabal commands +like ``cabal build`` and ``cabal run``. +The setting ``profiling: True`` tells GHC to build your application (and its dependencies) with profiling enabled, +and to insert performance measuring code into your application. +Where exactly such code is inserted can be controlled with settings like ``profiling-detail`` +that are presented later. +Further in-depth information on profiling with GHC and its compiler options can be found in the +`GHC profiling guide `__ + +.. note:: + + While a :ref:`cabal.project ` file is intended for long-time settings + that are useful to store in Git, ``cabal.project.local`` is for short-lived, local experiments + (like profiling) that, in general, shouldn't be committed to Git. + +Second, run your application with the right runtime system flags and let it create a profiling report: + +.. code-block:: console + + $ cabal run my-app +RTS -pj -RTS + + +When the application finishes, a profiling JSON report (due to option ``-pj``) +is written to a ``.prof`` file, i.e. ``my-app.prof``, in the current directory. + +.. note:: + + Different report formats can be generated by using different RTS flags. Some useful ones are: + + - ``-p`` for a GHC's own + `standard report `__ + ``.prof``, which can be visualized with `profiteur `__ + or `ghcprofview `__. + - ``-pj`` for a + `JSON report `__ + ``.prof``, which can be visualized with `Speedscope `__. + - ``-l -p`` for a binary + `"eventlog" report `__ + ``.eventlog``, which contains a lot more details and can show you resource usage over time, and can + be converted to JSON with `hs-speedscope `__ + to be visualized with `Speedscope `__. + This will also generate a ``.prof`` file (due to ``-p``), which you can ignore. + We just need the ``-p`` flag for the ``.eventlog`` file to include profiling information. + +Finally, visualize this JSON report ``my-app.prof`` and analyze it for performance bottlenecks. +One popular open-source +`flame graph `__ +visualizer is +`Speedscope `__, +which runs in the browser and can open this JSON file directly. +See the +`Haskell Optimization Handbook `__ +on how to optimize your code based on the profiling results afterwards. + +So far, we’ve only used a single Cabal option to enable profiling in general for your application. +Where and when GHC should insert performance measuring code can be controlled with the ``profiling-detail`` setting +and ``ghc-options``. +Leaving ``profiling-detail`` unspecified as before results in sensible defaults that differ between libraries and executable. +See the docs for :ref:`profiling-detail` to see which options are available. +You can provide ``profiling-detail`` settings and more compiler flags to GHC +(such as ``-fno-prof-count-entries``) via the ``cabal.project.local`` file: + +.. code-block:: cabal + + profiling: True + profiling-detail: late-toplevel + program-options + ghc-options: + + +The setting ``profiling-detail: late-toplevel`` instructs GHC to use so-called +`late-cost-center profiling `__ +and insert measuring code only after important optimisations have been applied to your application code. +This reduces the performance slow-down of profiling itself and gives you more realistic measurements. + +The ``program-options`` section allows you to add more settings like GHC options to the local +packages of your project (See :ref:`Program options`). +The ``ghc-options`` setting allows you to further control which functions and other bindings +the GHC compiler should profile, as well as other aspects of profiling. +You can find more information and further options in the +`GHC "cost-center" guide `__. +and the +`GHC profiling compiler options `__ +section. + +Profiling your dependencies too +------------------------------- + +The profiling setup so far with the ``cabal.project.local`` file only applied to your local packages, +which is usually what you want. +However, bottlenecks may also exist in your dependencies, so you may want to profile those too. + +First, to enable ``late``-cost-center profiling for all packages (including dependencies) concerning your project, +not just the local ones, add the following to your project’s ``cabal.project.local`` file: + +.. code-block:: cabal + + package * + profiling-detail: late-toplevel + +.. note:: + + There are several keywords to specify to which parts of your project some settings should be applied: + + - ``program-options`` to apply to :ref:`all local packages`. + - ``package `` to apply to a :ref:`single package`, be it local or remote. + - ``package *`` to apply to :ref:`all local and remote packages (dependencies)`. + +Second, rerun your application with ``cabal run``, which also automatically rebuilds your application: + +.. code-block:: console + + $ cabal run my-app -- +RTS -pj -RTS + Resolving dependencies... + Build profile: -w ghc-9.10.1 -O1 + In order, the following will be built (use -v for more details): + - base64-bytestring-1.2.1.0 (lib) --enable-profiling (requires build) + - cryptohash-sha256-0.11.102.1 (lib) --enable-profiling (requires build) + ... + + +You can now find profiling data of dependencies in the report ``my-app.prof`` +to analyze. More information on how to configure Cabal options can be found in the +:ref:`Cabal options sections `. diff --git a/doc/how-to-run-in-windows.rst b/doc/how-to-run-in-windows.rst index 5c06f62bbb3..53aeb33b849 100644 --- a/doc/how-to-run-in-windows.rst +++ b/doc/how-to-run-in-windows.rst @@ -8,7 +8,7 @@ more explanations. For a TL;DR, jump to the :ref:`Complete configuration`. Install the Haskell environment ------------------------------- -Haskell development on Windows makes use of the `MSYS2 `_ +Haskell development on Windows makes use of the `MSYS2 `_ tools. The recommended way of setting up a Haskell environment in Windows is by using @@ -19,11 +19,43 @@ system in your computer unless told not to do so: refer to `its documentation .. NOTE:: Stack is another tool you can use to set up a Haskell environment on Windows. Stack - can be installed on its own or via GHCup. See - `Stack's webpage `_ and/or + can be installed on its own or via GHCup. See + `Stack's webpage `_ and/or `GHCup's section on Stack integration `_, in particular the `Windows related subsection `_. +MSYS2 environments and packages +------------------------------- + +A particular environment has to be chosen when using MSYS2. By default GHCup will +use ``MINGW64``. You can learn more about the different environments in the `MSYS2 +documentation `_. + +GHCs before 9.4.1 are shipped with a minimal set of packages based on the +``MINGW64`` environment, and GHC 9.4.1 and newer are shipped with a minimal set +of packages based on the ``CLANG64`` environment. It is in general advisable to +work inside the same environment as your GHC uses, but (with some exceptions) +it shouldn't matter whether environments are mixed. Stay warned that it can +sometimes lead to undecipherable errors. + +We will refer to the chosen environment as ```` through this +documentation. + +Third-party libraries and tools can be installed using the ``pacman`` package +manager on the MSYS2 installation +(`see `_). If MSYS2 was +installed via GHCup, check GHCup's documentation on how to call ``pacman``. Note +that installing a package ``mingw-w64--x86_64-`` will install +it in the ``\`` tree of directories, and might not be +visible if working on a different environment than ````. In +general, it is advisable to install only packages for the environment that was +chosen above. + +Apart from these environments, there is the ``msys`` environment which is based +on Cygwin. Some tools only exist for this environment. Tools from this environment +are callable when working in any other environment. It is in general not possible +to link to libraries installed in the ``msys`` environment. + Ensure that Cabal can call the tools it needs --------------------------------------------- @@ -39,11 +71,10 @@ Windows. The directories where those are located need to be made visible in the extra-prog-path: \\bin \usr\bin -Where ```` points to the location of your MSYS2 installation. Refer to -GHCup's documentation on the default location of this directory. -```` has to be one of the environments of MSYS2, which for GHCup is -``mingw64``. You can learn more about the different environments in the `MSYS2 -documentation `_. +Where ```` points to the location of your MSYS2 installation. If MSYS2 +was installed via GHCup, refer to GHCup's documentation on the default location +of this directory. If MSYS2 was installed system-wide this is usually +``C:\msys64``. .. note:: @@ -53,8 +84,7 @@ documentation `_. Ensure that Cabal can use system libraries ------------------------------------------ -Third-party libraries can be installed using the ``pacman`` package manager on -the MSYS2 installation. When installing a third party package its libraries and +When installing a third party package its libraries and header files will (usually) be placed in ``\\{lib,include}`` respectively. These directories need to be specified in the ``extra-lib-dirs`` and ``extra-include-dirs`` @@ -74,11 +104,18 @@ include these options: .. warning:: - Packages in the ``msys/`` repo are not native Windows libraries and will - probably not work when one tries to link to them. Install the packages for - your selected environment, which for GHCup is ``mingw64/``. Refer to `MSYS2's - package management documentation - `_ for more information. + GHCs older than 9.4.1 will crash if a recent + ``mingw-w64--x86_64-crt-git`` is installed for whichever ```` and + these directories are set globally . + + Effectively this means that if you have installed ``mingw-w64--x86_64-crt-git`` + (which you probably have if you are using ``clang`` in the ``CLANG64`` + environment or ``gcc`` in the ``UCRT64`` or ``MINGW64`` environments outside of + Haskell, as this package is part of the ``mingw-w64--x86_64-toolchain`` + meta-packages) and are using a GHC older than 9.4.1, you cannot simply depend on system + libraries by adding these paths to the global config, and instead you will + have to go through some other method to depend on those libraries like + :pkg-field:`pkgconfig-depends`. Ensure that Cabal can call Haskell tools ---------------------------------------- diff --git a/doc/how-to-source-packages.rst b/doc/how-to-source-packages.rst index caecf7e90ac..ec26f26f721 100644 --- a/doc/how-to-source-packages.rst +++ b/doc/how-to-source-packages.rst @@ -233,7 +233,7 @@ for the ``tag`` field: .. Warning:: Only a commit hash pins to an exact version of the *source code* for Git - respositories. + repositories. - If the ``tag`` field is omitted then the latest commit on the Git default branch is used. - If the ``tag`` field is a Git branch name then the latest commit on that branch is used. diff --git a/doc/how-to-use-backpack.rst b/doc/how-to-use-backpack.rst index 23d58298b2d..e9b2c5966d9 100644 --- a/doc/how-to-use-backpack.rst +++ b/doc/how-to-use-backpack.rst @@ -16,7 +16,7 @@ are somewhat experimental; while fully supported by cabal-install, they are curr A Backpack package is defined by use of the :pkg-field:`library:signatures` field, or by (transitive) dependency on -a package that defines some requirements. To define a parametrized +a package that defines some requirements. To define a parameterized package, define a signature file (file extension ``hsig``) that specifies the signature of the module you want to parametrize over, and add it to your Cabal file in the :pkg-field:`library:signatures` field. @@ -31,10 +31,10 @@ add it to your Cabal file in the :pkg-field:`library:signatures` field. concat :: [Str] -> Str .. code-block:: cabal - :caption: parametrized.cabal + :caption: parameterized.cabal cabal-version: 2.2 - name: parametrized + name: parameterized library build-depends: base @@ -45,14 +45,14 @@ You can define any number of regular modules (e.g., ``MyModule``) that import signatures and use them as regular modules. If you are familiar with ML modules, you might now expect there to be -some way to apply the parametrized package with an implementation of +some way to apply the parameterized package with an implementation of the ``Str`` module to get a concrete instantiation of the package. Backpack operates slightly differently with a concept of *mix-in linking*, where you provide an implementation of ``Str`` simply by bringing another module into scope with the same name as the requirement. For example, if you had a package ``str-impl`` that provided a -module named ``Str``, instantiating ``parametrized`` is as simple as -just depending on both ``str-impl`` and ``parametrized``: +module named ``Str``, instantiating ``parameterized`` is as simple as +just depending on both ``str-impl`` and ``parameterized``: .. code-block:: cabal :caption: combined.cabal @@ -61,7 +61,7 @@ just depending on both ``str-impl`` and ``parametrized``: name: combined library - build-depends: base, str-impl, parametrized + build-depends: base, str-impl, parameterized Note that due to technical limitations, you cannot directly define ``Str`` in the ``combined`` library; it must be placed in its own @@ -75,7 +75,7 @@ a requirement ``Str`` and an implementation ``Data.Text``, you can line up the names in one of two ways: * Rename the requirement to match the implementation: - ``mixins: parametrized requires (Str as Data.Text)`` + ``mixins: parameterized requires (Str as Data.Text)`` * Rename the implementation to match the requirement: ``mixins: text (Data.Text as Str)`` @@ -91,13 +91,13 @@ the requirements and provided modules renamed to be distinct. name: double-combined library - build-depends: base, text, bytestring, parametrized + build-depends: base, text, bytestring, parameterized mixins: - parametrized (MyModule as MyModule.Text) requires (Str as Data.Text), - parametrized (MyModule as MyModule.BS) requires (Str as Data.ByteString) + parameterized (MyModule as MyModule.Text) requires (Str as Data.Text), + parameterized (MyModule as MyModule.BS) requires (Str as Data.ByteString) Intensive use of Backpack sometimes involves creating lots of small -parametrized libraries; :ref:`Sublibraries ` can be used +parameterized libraries; :ref:`Sublibraries ` can be used to define all of these libraries in a single package without having to create many separate Cabal packages. You may also find it useful to use :pkg-field:`library:reexported-modules` to reexport instantiated diff --git a/doc/index.rst b/doc/index.rst index 0b5407e8580..4bd13c65d7a 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -15,6 +15,7 @@ Welcome to the Cabal User Guide how-to-package-haskell-code how-to-source-packages + how-to-enable-profiling how-to-build-like-nix how-to-run-in-windows how-to-use-backpack diff --git a/doc/requirements.in b/doc/requirements.in index aae94ae6a2d..f0514fb5581 100644 --- a/doc/requirements.in +++ b/doc/requirements.in @@ -8,7 +8,9 @@ Pygments >= 2.7.4 certifi >= 2023.07.22 # CVE-2023-45803 urllib3 >= 2.0.7 -# CVE-2024-22195 -jinja2 == 3.1.3 +# CVE-2024-34064 +jinja2 >= 3.1.4 # CVE-2024-3651 idna >= 3.7 +# CVE-2024-35195 +requests >= 2.32.0 diff --git a/doc/requirements.txt b/doc/requirements.txt deleted file mode 100644 index ca9ca747a7b..00000000000 --- a/doc/requirements.txt +++ /dev/null @@ -1,79 +0,0 @@ -# -# This file is autogenerated by pip-compile with Python 3.11 -# by the following command: -# -# pip-compile requirements.in -# -alabaster==0.7.13 - # via sphinx -babel==2.12.1 - # via sphinx -certifi==2023.7.22 - # via - # -r requirements.in - # requests -charset-normalizer==3.1.0 - # via requests -docutils==0.18.1 - # via - # sphinx - # sphinx-jsonschema - # sphinx-rtd-theme -idna==3.7 - # via - # -r requirements.in - # requests -imagesize==1.4.1 - # via sphinx -jinja2==3.1.3 - # via - # -r requirements.in - # sphinx -jsonpointer==2.3 - # via sphinx-jsonschema -markupsafe==2.1.2 - # via jinja2 -packaging==23.1 - # via sphinx -pygments==2.15.1 - # via - # -r requirements.in - # sphinx -pyyaml==6.0 - # via sphinx-jsonschema -requests==2.31.0 - # via - # sphinx - # sphinx-jsonschema -snowballstemmer==2.2.0 - # via sphinx -sphinx==5.3.0 - # via - # -r requirements.in - # sphinx-rtd-theme - # sphinxcontrib-jquery - # sphinxnotes-strike -sphinx-jsonschema==1.19.1 - # via -r requirements.in -sphinx-rtd-theme==1.2.1 - # via -r requirements.in -sphinxcontrib-applehelp==1.0.4 - # via sphinx -sphinxcontrib-devhelp==1.0.2 - # via sphinx -sphinxcontrib-htmlhelp==2.0.1 - # via sphinx -sphinxcontrib-jquery==4.1 - # via sphinx-rtd-theme -sphinxcontrib-jsmath==1.0.1 - # via sphinx -sphinxcontrib-qthelp==1.0.3 - # via sphinx -sphinxcontrib-serializinghtml==1.1.5 - # via sphinx -sphinxnotes-strike==1.2 - # via -r requirements.in -urllib3==2.0.7 - # via - # -r requirements.in - # requests diff --git a/doc/setup-commands.rst b/doc/setup-commands.rst index 20bdafabfae..69f9e276cf4 100644 --- a/doc/setup-commands.rst +++ b/doc/setup-commands.rst @@ -713,7 +713,7 @@ Miscellaneous options late-toplevel Like top-level but costs will be assigned to top level definitions after optimization. This lowers profiling overhead massively while giving similar - levels of detail as toplevle-functions. However it means functions introduced + levels of detail as toplevel-functions. However it means functions introduced by GHC during optimization will show up in profiles as well. Corresponds to ``-fprof-late`` if supported and ``-fprof-auto-top`` otherwise. late @@ -795,10 +795,21 @@ Miscellaneous options Build shared library. This implies a separate compiler run to generate position independent code as required on most platforms. + ``--enable-shared`` is enabled automatically if GHC is dynamically linked or + you request to build dynamic executables. + .. option:: --disable-shared (default) Do not build shared library. +.. option:: --enable-profiling-shared + + Build a profiling shared library. + +.. option:: --disable-profiling-shared + + (default) Do not built a profiling shared library. + .. option:: --enable-static Build a static library. This passes ``-staticlib`` to GHC (available @@ -1374,7 +1385,8 @@ The files placed in this distribution are the package description file, the setup script, the sources of the modules named in the package description file, and files named in the ``license-file``, ``main-is``, ``c-sources``, ``asm-sources``, ``cmm-sources``, ``js-sources``, -``data-files``, ``extra-source-files`` and ``extra-doc-files`` fields. +``data-files``, ``extra-source-files``, ``extra-doc-files``, and +``extra-files`` fields. This command takes the following option: @@ -1387,3 +1399,60 @@ This command takes the following option: .. include:: references.inc + +.. _setup-repl: + +runhaskell Setup.hs repl +------------------------ + +Open an interpreter session for the given component. + +Usage: + +.. program:: runhaskell Setup.hs repl [COMPONENT] [FLAGS] + +If the current directory contains no package, ignores COMPONENT parameters and +opens an interactive interpreter session. + +Otherwise, (re)configures with the given or default flags, and loads the +interpreter with the relevant modules. For executables, tests and benchmarks, +loads the main module (and its dependencies); for libraries all exposed/other +modules. + +The default component is the library itself, or the executable if that is the +only component. + +Support for loading specific modules is planned but not implemented yet. For +certain scenarios, ``Setup.hs exec -- ghci :l Foo`` may be used instead. Note +that ``exec`` will not (re)configure and you will have to specify the location +of other modules, if required. + +Flags for repl: + +.. option:: -v, --verbose[=n] + + Control verbosity (n is 0--3, default verbosity level is 1). + +.. option:: --builddir=DIR + + The directory where Cabal puts generated build files (default dist). + +.. option:: --with-PROG=PATH + + Give the path to PROG. + +.. option:: --PROG-option=OPT + + Give an extra option to PROG (no need to quote options containing spaces). + +.. option:: --PROG-options=OPTS + + Give extra options to PROG. + +.. option:: --repl-no-load + + Disable loading of project modules at REPL startup. + +.. option:: --repl-options=FLAG + + Use the option(s) for the repl. diff --git a/doc/vcs/branch.rst b/doc/vcs/branch.rst new file mode 100644 index 00000000000..5908367c130 --- /dev/null +++ b/doc/vcs/branch.rst @@ -0,0 +1,8 @@ +.. + VCS branch + +Many source control systems support the notion of a branch, as a distinct +concept from having repositories in separate locations. For example CVS, SVN and +git use branches while darcs uses different locations for different branches. If +you need to specify a branch to identify a your repository then specify it in +this field. diff --git a/doc/vcs/fields.rst b/doc/vcs/fields.rst new file mode 100644 index 00000000000..9ce0d4c840a --- /dev/null +++ b/doc/vcs/fields.rst @@ -0,0 +1,34 @@ +.. + VCS common fields + +Most of the version control system (VCS) fields types are common to both +``source-repository`` and ``source-repository-package`` stanzas. + +.. list-table:: + :header-rows: 1 + :widths: 30 30 40 + + * - Field Name + - source-repository (head|this) + - source-repository-package + * - type + - [x] + - [x] + * - location + - [x] + - [x] + * - branch + - [x] + - [x] + * - tag + - [x] + - [x] + * - subdir + - [x] (0 or 1) + - [x] (0 or 1 for each dependency) + * - module (CVS only) + - [x] + - [_] + * - post-checkout-command + - [_] + - [x] diff --git a/doc/vcs/kind.rst b/doc/vcs/kind.rst new file mode 100644 index 00000000000..e87d55ae49e --- /dev/null +++ b/doc/vcs/kind.rst @@ -0,0 +1,19 @@ +.. + VCS kind + +Cabal supports specifying different information for various common source +control systems. This is the name of the source control system used for a +repository. The currently recognised types are: + +- ``darcs`` +- ``git`` +- ``svn`` +- ``cvs`` +- ``mercurial`` (or alias ``hg``) +- ``bazaar`` (or alias ``bzr``) +- ``arch`` +- ``monotone`` +- ``pijul`` + +The VCS kind will determine what other fields are appropriate to specify for a +particular version control system. diff --git a/doc/vcs/location.rst b/doc/vcs/location.rst new file mode 100644 index 00000000000..df32ffff093 --- /dev/null +++ b/doc/vcs/location.rst @@ -0,0 +1,9 @@ +.. + VCS location + +The location of the repository, usually a URL but the exact form of this field +depends on the repository type. For example: + +- for Darcs: ``http://code.haskell.org/foo/`` +- for Git: ``https://github.com/foo/bar.git`` +- for CVS: ``anoncvs@cvs.foo.org:/cvs`` diff --git a/doc/vcs/subdir.rst b/doc/vcs/subdir.rst new file mode 100644 index 00000000000..33ee731bb86 --- /dev/null +++ b/doc/vcs/subdir.rst @@ -0,0 +1,11 @@ +.. + VCS subdirectory + +A field of this type is always optional because it defaults to empty, which +corresponds to the root directory of the repository and is the same as +specifying ``.`` explicitly. + +Some projects put the sources for multiple packages inside a single VCS +repository. This field lets you specify the relative path from the root of the +repository to the top directory for the package, i.e. the directory containing +the package's ``.cabal`` file. diff --git a/doc/vcs/tag.rst b/doc/vcs/tag.rst new file mode 100644 index 00000000000..4ebdac6781c --- /dev/null +++ b/doc/vcs/tag.rst @@ -0,0 +1,5 @@ +.. + VCS tag + +A tag identifies a particular state of a source repository. The exact form of +the tag depends on the repository type. diff --git a/doc/version-control-fields.rst b/doc/version-control-fields.rst index 71dd59c4953..2298f22ed88 100644 --- a/doc/version-control-fields.rst +++ b/doc/version-control-fields.rst @@ -3,93 +3,31 @@ Version Control System Fields .. _vcs-fields: -Most of the version control system (VCS) fields types are common to both -``source-repository`` and ``source-repository-package`` stanzas. - -.. list-table:: - :header-rows: 1 - :widths: 30 30 40 - - * - Field Name - - source-repository (head|this) - - source-repository-package - * - type - - [x] - - [x] - * - location - - [x] - - [x] - * - branch - - [x] - - [x] - * - tag - - [x] - - [x] - * - subdir - - [x] (0 or 1) - - [x] (0 or 1 for each dependency) - * - module (CVS only) - - [x] - - [_] - * - post-checkout-command - - [_] - - [x] +.. include:: vcs/fields.rst .. _vcs-kind: VCS kind ^^^^^^^^ -Cabal supports specifying different information for various common source -control systems. This is the name of the source control system used for a -repository. The currently recognised types are: - -- ``darcs`` -- ``git`` -- ``svn`` -- ``cvs`` -- ``mercurial`` (or alias ``hg``) -- ``bazaar`` (or alias ``bzr``) -- ``arch`` -- ``monotone`` -- ``pijul`` - -The VCS kind will determine what other fields are appropriate to specify for a -particular version control system. +.. include:: vcs/kind.rst VCS location ^^^^^^^^^^^^ -The location of the repository, usually a URL but the exact form of this field -depends on the repository type. For example: - -- for Darcs: ``http://code.haskell.org/foo/`` -- for Git: ``git://github.com/foo/bar.git`` -- for CVS: ``anoncvs@cvs.foo.org:/cvs`` +.. include:: vcs/location.rst VCS branch ^^^^^^^^^^ -Many source control systems support the notion of a branch, as a distinct -concept from having repositories in separate locations. For example CVS, SVN and -git use branches while darcs uses different locations for different branches. If -you need to specify a branch to identify a your repository then specify it in -this field. +.. include:: vcs/branch.rst VCS tag ^^^^^^^ -A tag identifies a particular state of a source repository. The exact form of -the tag depends on the repository type. +.. include:: vcs/tag.rst VCS subdirectory ^^^^^^^^^^^^^^^^ -A field of this type is always optional because it defaults to empty, which -corresponds to the root directory of the repository and is the same as -specifying ``.`` explicitly. - -Some projects put the sources for multiple packages inside a single VCS -repository. This field lets you specify the relative path from the root of the -repository to the top directory for the package, i.e. the directory containing -the package's ``.cabal`` file. +.. include:: vcs/subdir.rst diff --git a/editors/vim/syntax/cabal.vim b/editors/vim/syntax/cabal.vim index 119a5ccb767..2e578307a7e 100644 --- a/editors/vim/syntax/cabal.vim +++ b/editors/vim/syntax/cabal.vim @@ -80,6 +80,7 @@ syn keyword cabalFieldName contained \ extra-bundled-libraries \ extra-doc-files \ extra-dynamic-library-flavours + \ extra-files \ extra-framework-dirs \ extra-ghci-libraries \ extra-lib-dirs @@ -218,6 +219,7 @@ syn keyword cabalExtension contained \ MonoLocalBinds \ MonoPatBinds \ MonomorphismRestriction + \ MultilineStrings \ MultiParamTypeClasses \ MultiWayIf \ NPlusKPatterns @@ -230,6 +232,7 @@ syn keyword cabalExtension contained \ NullaryTypeClasses \ NumDecimals \ NumericUnderscores + \ OrPatterns \ OverlappingInstances \ OverloadedLabels \ OverloadedLists @@ -360,6 +363,7 @@ syn keyword cabalExtension contained \ NoMonoLocalBinds \ NoMonoPatBinds \ NoMonomorphismRestriction + \ NoMultilineStrings \ NoMultiParamTypeClasses \ NoMultiWayIf \ NoNPlusKPatterns @@ -377,6 +381,7 @@ syn keyword cabalExtension contained \ NoOverloadedLists \ NoOverloadedRecordDot \ NoOverloadedStrings + \ NoOrPatterns \ NoPackageImports \ NoParallelArrays \ NoParallelListComp diff --git a/fix-whitespace.yaml b/fix-whitespace.yaml index d5eb572ec62..fc3605d136c 100644 --- a/fix-whitespace.yaml +++ b/fix-whitespace.yaml @@ -87,6 +87,7 @@ included-files: - "*.yaml" - "*.yml" - "*.zinza" + - "changelog.d/*" excluded-files: # Exceptions @@ -94,6 +95,8 @@ excluded-files: - Cabal-tests/tests/ParserTests/warnings/tab.cabal - Cabal-tests/tests/ParserTests/warnings/utf8.cabal - cabal-testsuite/PackageTests/Regression/T8507/pkg.cabal + - cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/trailing-space.project + - cabal-testsuite/PackageTests/ProjectImport/UntrimmedImport/tabs-and-spaces.project # These also contain tabs that affect the golden value: # Could be removed from exceptions, but then the tab warning diff --git a/license-list-data/exceptions-3.25.json b/license-list-data/exceptions-3.25.json new file mode 100644 index 00000000000..9d20ee4866a --- /dev/null +++ b/license-list-data/exceptions-3.25.json @@ -0,0 +1,836 @@ +{ + "licenseListVersion": "3.25.0", + "exceptions": [ + { + "reference": "./389-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./389-exception.html", + "referenceNumber": 53, + "name": "389 Directory Server Exception", + "licenseExceptionId": "389-exception", + "seeAlso": [ + "http://directory.fedoraproject.org/wiki/GPL_Exception_License_Text", + "https://web.archive.org/web/20080828121337/http://directory.fedoraproject.org/wiki/GPL_Exception_License_Text" + ] + }, + { + "reference": "./Asterisk-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Asterisk-exception.html", + "referenceNumber": 60, + "name": "Asterisk exception", + "licenseExceptionId": "Asterisk-exception", + "seeAlso": [ + "https://github.com/asterisk/libpri/blob/7f91151e6bd10957c746c031c1f4a030e8146e9a/pri.c#L22", + "https://github.com/asterisk/libss7/blob/03e81bcd0d28ff25d4c77c78351ddadc82ff5c3f/ss7.c#L24" + ] + }, + { + "reference": "./Asterisk-linking-protocols-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Asterisk-linking-protocols-exception.html", + "referenceNumber": 24, + "name": "Asterisk linking protocols exception", + "licenseExceptionId": "Asterisk-linking-protocols-exception", + "seeAlso": [ + "https://github.com/asterisk/asterisk/blob/115d7c01e32ccf4566a99e9d74e2b88830985a0b/LICENSE#L27" + ] + }, + { + "reference": "./Autoconf-exception-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Autoconf-exception-2.0.html", + "referenceNumber": 72, + "name": "Autoconf exception 2.0", + "licenseExceptionId": "Autoconf-exception-2.0", + "seeAlso": [ + "http://ac-archive.sourceforge.net/doc/copyright.html", + "http://ftp.gnu.org/gnu/autoconf/autoconf-2.59.tar.gz" + ] + }, + { + "reference": "./Autoconf-exception-3.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Autoconf-exception-3.0.html", + "referenceNumber": 17, + "name": "Autoconf exception 3.0", + "licenseExceptionId": "Autoconf-exception-3.0", + "seeAlso": [ + "http://www.gnu.org/licenses/autoconf-exception-3.0.html" + ] + }, + { + "reference": "./Autoconf-exception-generic.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Autoconf-exception-generic.html", + "referenceNumber": 48, + "name": "Autoconf generic exception", + "licenseExceptionId": "Autoconf-exception-generic", + "seeAlso": [ + "https://launchpad.net/ubuntu/precise/+source/xmltooling/+copyright", + "https://tracker.debian.org/media/packages/s/sipwitch/copyright-1.9.15-3", + "https://opensource.apple.com/source/launchd/launchd-258.1/launchd/compile.auto.html", + "https://git.savannah.gnu.org/gitweb/?p\u003dgnulib.git;a\u003dblob;f\u003dgnulib-tool;h\u003d029a8cf377ad8d8f2d9e54061bf2f20496ad2eef;hb\u003d73c74ba0197e6566da6882c87b1adee63e24d75c#l407" + ] + }, + { + "reference": "./Autoconf-exception-generic-3.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Autoconf-exception-generic-3.0.html", + "referenceNumber": 64, + "name": "Autoconf generic exception for GPL-3.0", + "licenseExceptionId": "Autoconf-exception-generic-3.0", + "seeAlso": [ + "https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/rawhide/f/config.guess" + ] + }, + { + "reference": "./Autoconf-exception-macro.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Autoconf-exception-macro.html", + "referenceNumber": 51, + "name": "Autoconf macro exception", + "licenseExceptionId": "Autoconf-exception-macro", + "seeAlso": [ + "https://github.com/freedesktop/xorg-macros/blob/39f07f7db58ebbf3dcb64a2bf9098ed5cf3d1223/xorg-macros.m4.in", + "https://www.gnu.org/software/autoconf-archive/ax_pthread.html", + "https://launchpad.net/ubuntu/precise/+source/xmltooling/+copyright" + ] + }, + { + "reference": "./Bison-exception-1.24.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Bison-exception-1.24.html", + "referenceNumber": 59, + "name": "Bison exception 1.24", + "licenseExceptionId": "Bison-exception-1.24", + "seeAlso": [ + "https://github.com/arineng/rwhoisd/blob/master/rwhoisd/mkdb/y.tab.c#L180" + ] + }, + { + "reference": "./Bison-exception-2.2.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Bison-exception-2.2.html", + "referenceNumber": 21, + "name": "Bison exception 2.2", + "licenseExceptionId": "Bison-exception-2.2", + "seeAlso": [ + "http://git.savannah.gnu.org/cgit/bison.git/tree/data/yacc.c?id\u003d193d7c7054ba7197b0789e14965b739162319b5e#n141" + ] + }, + { + "reference": "./Bootloader-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Bootloader-exception.html", + "referenceNumber": 40, + "name": "Bootloader Distribution Exception", + "licenseExceptionId": "Bootloader-exception", + "seeAlso": [ + "https://github.com/pyinstaller/pyinstaller/blob/develop/COPYING.txt" + ] + }, + { + "reference": "./Classpath-exception-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Classpath-exception-2.0.html", + "referenceNumber": 34, + "name": "Classpath exception 2.0", + "licenseExceptionId": "Classpath-exception-2.0", + "seeAlso": [ + "http://www.gnu.org/software/classpath/license.html", + "https://fedoraproject.org/wiki/Licensing/GPL_Classpath_Exception" + ] + }, + { + "reference": "./CLISP-exception-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./CLISP-exception-2.0.html", + "referenceNumber": 71, + "name": "CLISP exception 2.0", + "licenseExceptionId": "CLISP-exception-2.0", + "seeAlso": [ + "http://sourceforge.net/p/clisp/clisp/ci/default/tree/COPYRIGHT" + ] + }, + { + "reference": "./cryptsetup-OpenSSL-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./cryptsetup-OpenSSL-exception.html", + "referenceNumber": 5, + "name": "cryptsetup OpenSSL exception", + "licenseExceptionId": "cryptsetup-OpenSSL-exception", + "seeAlso": [ + "https://gitlab.com/cryptsetup/cryptsetup/-/blob/main/COPYING", + "https://gitlab.nic.cz/datovka/datovka/-/blob/develop/COPYING", + "https://github.com/nbs-system/naxsi/blob/951123ad456bdf5ac94e8d8819342fe3d49bc002/naxsi_src/naxsi_raw.c", + "http://web.mit.edu/jgross/arch/amd64_deb60/bin/mosh", + "https://sourceforge.net/p/linux-ima/ima-evm-utils/ci/master/tree/src/evmctl.c#l30" + ] + }, + { + "reference": "./DigiRule-FOSS-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./DigiRule-FOSS-exception.html", + "referenceNumber": 66, + "name": "DigiRule FOSS License Exception", + "licenseExceptionId": "DigiRule-FOSS-exception", + "seeAlso": [ + "http://www.digirulesolutions.com/drupal/foss" + ] + }, + { + "reference": "./eCos-exception-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./eCos-exception-2.0.html", + "referenceNumber": 35, + "name": "eCos exception 2.0", + "licenseExceptionId": "eCos-exception-2.0", + "seeAlso": [ + "http://ecos.sourceware.org/license-overview.html" + ] + }, + { + "reference": "./erlang-otp-linking-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./erlang-otp-linking-exception.html", + "referenceNumber": 46, + "name": "Erlang/OTP Linking Exception", + "licenseExceptionId": "erlang-otp-linking-exception", + "seeAlso": [ + "https://www.gnu.org/licenses/gpl-faq.en.html#GPLIncompatibleLibs", + "https://erlang.org/pipermail/erlang-questions/2012-May/066355.html", + "https://gitea.osmocom.org/erlang/osmo_ss7/src/commit/2286c1b8738d715950026650bf53f19a69d6ed0e/src/ss7_links.erl#L20" + ] + }, + { + "reference": "./Fawkes-Runtime-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Fawkes-Runtime-exception.html", + "referenceNumber": 23, + "name": "Fawkes Runtime Exception", + "licenseExceptionId": "Fawkes-Runtime-exception", + "seeAlso": [ + "http://www.fawkesrobotics.org/about/license/" + ] + }, + { + "reference": "./FLTK-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./FLTK-exception.html", + "referenceNumber": 9, + "name": "FLTK exception", + "licenseExceptionId": "FLTK-exception", + "seeAlso": [ + "http://www.fltk.org/COPYING.php" + ] + }, + { + "reference": "./fmt-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./fmt-exception.html", + "referenceNumber": 69, + "name": "fmt exception", + "licenseExceptionId": "fmt-exception", + "seeAlso": [ + "https://github.com/fmtlib/fmt/blob/master/LICENSE", + "https://github.com/fmtlib/fmt/blob/2eb363297b24cd71a68ccfb20ff755430f17e60f/LICENSE#L22C1-L27C62" + ] + }, + { + "reference": "./Font-exception-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Font-exception-2.0.html", + "referenceNumber": 19, + "name": "Font exception 2.0", + "licenseExceptionId": "Font-exception-2.0", + "seeAlso": [ + "http://www.gnu.org/licenses/gpl-faq.html#FontException" + ] + }, + { + "reference": "./freertos-exception-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./freertos-exception-2.0.html", + "referenceNumber": 54, + "name": "FreeRTOS Exception 2.0", + "licenseExceptionId": "freertos-exception-2.0", + "seeAlso": [ + "https://web.archive.org/web/20060809182744/http://www.freertos.org/a00114.html" + ] + }, + { + "reference": "./GCC-exception-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GCC-exception-2.0.html", + "referenceNumber": 14, + "name": "GCC Runtime Library exception 2.0", + "licenseExceptionId": "GCC-exception-2.0", + "seeAlso": [ + "https://gcc.gnu.org/git/?p\u003dgcc.git;a\u003dblob;f\u003dgcc/libgcc1.c;h\u003d762f5143fc6eed57b6797c82710f3538aa52b40b;hb\u003dcb143a3ce4fb417c68f5fa2691a1b1b1053dfba9#l10", + "https://sourceware.org/git/?p\u003dglibc.git;a\u003dblob;f\u003dcsu/abi-note.c;h\u003dc2ec208e94fbe91f63d3c375bd254b884695d190;hb\u003dHEAD" + ] + }, + { + "reference": "./GCC-exception-2.0-note.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GCC-exception-2.0-note.html", + "referenceNumber": 55, + "name": "GCC Runtime Library exception 2.0 - note variant", + "licenseExceptionId": "GCC-exception-2.0-note", + "seeAlso": [ + "https://sourceware.org/git/?p\u003dglibc.git;a\u003dblob;f\u003dsysdeps/x86_64/start.S" + ] + }, + { + "reference": "./GCC-exception-3.1.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GCC-exception-3.1.html", + "referenceNumber": 6, + "name": "GCC Runtime Library exception 3.1", + "licenseExceptionId": "GCC-exception-3.1", + "seeAlso": [ + "http://www.gnu.org/licenses/gcc-exception-3.1.html" + ] + }, + { + "reference": "./Gmsh-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Gmsh-exception.html", + "referenceNumber": 58, + "name": "Gmsh exception\u003e", + "licenseExceptionId": "Gmsh-exception", + "seeAlso": [ + "https://gitlab.onelab.info/gmsh/gmsh/-/raw/master/LICENSE.txt" + ] + }, + { + "reference": "./GNAT-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GNAT-exception.html", + "referenceNumber": 26, + "name": "GNAT exception", + "licenseExceptionId": "GNAT-exception", + "seeAlso": [ + "https://github.com/AdaCore/florist/blob/master/libsrc/posix-configurable_file_limits.adb" + ] + }, + { + "reference": "./GNOME-examples-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GNOME-examples-exception.html", + "referenceNumber": 12, + "name": "GNOME examples exception", + "licenseExceptionId": "GNOME-examples-exception", + "seeAlso": [ + "https://gitlab.gnome.org/Archive/gnome-devel-docs/-/blob/master/platform-demos/C/legal.xml?ref_type\u003dheads", + "http://meldmerge.org/help/" + ] + }, + { + "reference": "./GNU-compiler-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GNU-compiler-exception.html", + "referenceNumber": 18, + "name": "GNU Compiler Exception", + "licenseExceptionId": "GNU-compiler-exception", + "seeAlso": [ + "https://sourceware.org/git?p\u003dbinutils-gdb.git;a\u003dblob;f\u003dlibiberty/unlink-if-ordinary.c;h\u003de49f2f2f67bfdb10d6b2bd579b0e01cad0fd708e;hb\u003dHEAD#l19" + ] + }, + { + "reference": "./gnu-javamail-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./gnu-javamail-exception.html", + "referenceNumber": 43, + "name": "GNU JavaMail exception", + "licenseExceptionId": "gnu-javamail-exception", + "seeAlso": [ + "http://www.gnu.org/software/classpathx/javamail/javamail.html" + ] + }, + { + "reference": "./GPL-3.0-interface-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GPL-3.0-interface-exception.html", + "referenceNumber": 28, + "name": "GPL-3.0 Interface Exception", + "licenseExceptionId": "GPL-3.0-interface-exception", + "seeAlso": [ + "https://www.gnu.org/licenses/gpl-faq.en.html#LinkingOverControlledInterface" + ] + }, + { + "reference": "./GPL-3.0-linking-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GPL-3.0-linking-exception.html", + "referenceNumber": 45, + "name": "GPL-3.0 Linking Exception", + "licenseExceptionId": "GPL-3.0-linking-exception", + "seeAlso": [ + "https://www.gnu.org/licenses/gpl-faq.en.html#GPLIncompatibleLibs" + ] + }, + { + "reference": "./GPL-3.0-linking-source-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GPL-3.0-linking-source-exception.html", + "referenceNumber": 39, + "name": "GPL-3.0 Linking Exception (with Corresponding Source)", + "licenseExceptionId": "GPL-3.0-linking-source-exception", + "seeAlso": [ + "https://www.gnu.org/licenses/gpl-faq.en.html#GPLIncompatibleLibs", + "https://github.com/mirror/wget/blob/master/src/http.c#L20" + ] + }, + { + "reference": "./GPL-CC-1.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GPL-CC-1.0.html", + "referenceNumber": 27, + "name": "GPL Cooperation Commitment 1.0", + "licenseExceptionId": "GPL-CC-1.0", + "seeAlso": [ + "https://github.com/gplcc/gplcc/blob/master/Project/COMMITMENT", + "https://gplcc.github.io/gplcc/Project/README-PROJECT.html" + ] + }, + { + "reference": "./GStreamer-exception-2005.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GStreamer-exception-2005.html", + "referenceNumber": 63, + "name": "GStreamer Exception (2005)", + "licenseExceptionId": "GStreamer-exception-2005", + "seeAlso": [ + "https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/licensing.html?gi-language\u003dc#licensing-of-applications-using-gstreamer" + ] + }, + { + "reference": "./GStreamer-exception-2008.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./GStreamer-exception-2008.html", + "referenceNumber": 30, + "name": "GStreamer Exception (2008)", + "licenseExceptionId": "GStreamer-exception-2008", + "seeAlso": [ + "https://gstreamer.freedesktop.org/documentation/frequently-asked-questions/licensing.html?gi-language\u003dc#licensing-of-applications-using-gstreamer" + ] + }, + { + "reference": "./i2p-gpl-java-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./i2p-gpl-java-exception.html", + "referenceNumber": 36, + "name": "i2p GPL+Java Exception", + "licenseExceptionId": "i2p-gpl-java-exception", + "seeAlso": [ + "http://geti2p.net/en/get-involved/develop/licenses#java_exception" + ] + }, + { + "reference": "./KiCad-libraries-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./KiCad-libraries-exception.html", + "referenceNumber": 10, + "name": "KiCad Libraries Exception", + "licenseExceptionId": "KiCad-libraries-exception", + "seeAlso": [ + "https://www.kicad.org/libraries/license/" + ] + }, + { + "reference": "./LGPL-3.0-linking-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./LGPL-3.0-linking-exception.html", + "referenceNumber": 31, + "name": "LGPL-3.0 Linking Exception", + "licenseExceptionId": "LGPL-3.0-linking-exception", + "seeAlso": [ + "https://raw.githubusercontent.com/go-xmlpath/xmlpath/v2/LICENSE", + "https://github.com/goamz/goamz/blob/master/LICENSE", + "https://github.com/juju/errors/blob/master/LICENSE" + ] + }, + { + "reference": "./libpri-OpenH323-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./libpri-OpenH323-exception.html", + "referenceNumber": 15, + "name": "libpri OpenH323 exception", + "licenseExceptionId": "libpri-OpenH323-exception", + "seeAlso": [ + "https://github.com/asterisk/libpri/blob/1.6.0/README#L19-L22" + ] + }, + { + "reference": "./Libtool-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Libtool-exception.html", + "referenceNumber": 20, + "name": "Libtool Exception", + "licenseExceptionId": "Libtool-exception", + "seeAlso": [ + "http://git.savannah.gnu.org/cgit/libtool.git/tree/m4/libtool.m4", + "https://git.savannah.gnu.org/cgit/libtool.git/tree/libltdl/lt__alloc.c#n15" + ] + }, + { + "reference": "./Linux-syscall-note.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Linux-syscall-note.html", + "referenceNumber": 52, + "name": "Linux Syscall Note", + "licenseExceptionId": "Linux-syscall-note", + "seeAlso": [ + "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/COPYING" + ] + }, + { + "reference": "./LLGPL.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./LLGPL.html", + "referenceNumber": 37, + "name": "LLGPL Preamble", + "licenseExceptionId": "LLGPL", + "seeAlso": [ + "http://opensource.franz.com/preamble.html" + ] + }, + { + "reference": "./LLVM-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./LLVM-exception.html", + "referenceNumber": 1, + "name": "LLVM Exception", + "licenseExceptionId": "LLVM-exception", + "seeAlso": [ + "http://llvm.org/foundation/relicensing/LICENSE.txt" + ] + }, + { + "reference": "./LZMA-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./LZMA-exception.html", + "referenceNumber": 61, + "name": "LZMA exception", + "licenseExceptionId": "LZMA-exception", + "seeAlso": [ + "http://nsis.sourceforge.net/Docs/AppendixI.html#I.6" + ] + }, + { + "reference": "./mif-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./mif-exception.html", + "referenceNumber": 7, + "name": "Macros and Inline Functions Exception", + "licenseExceptionId": "mif-exception", + "seeAlso": [ + "http://www.scs.stanford.edu/histar/src/lib/cppsup/exception", + "http://dev.bertos.org/doxygen/", + "https://www.threadingbuildingblocks.org/licensing" + ] + }, + { + "reference": "./Nokia-Qt-exception-1.1.json", + "isDeprecatedLicenseId": true, + "detailsUrl": "./Nokia-Qt-exception-1.1.html", + "referenceNumber": 13, + "name": "Nokia Qt LGPL exception 1.1", + "licenseExceptionId": "Nokia-Qt-exception-1.1", + "seeAlso": [ + "https://www.keepassx.org/dev/projects/keepassx/repository/revisions/b8dfb9cc4d5133e0f09cd7533d15a4f1c19a40f2/entry/LICENSE.NOKIA-LGPL-EXCEPTION" + ] + }, + { + "reference": "./OCaml-LGPL-linking-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./OCaml-LGPL-linking-exception.html", + "referenceNumber": 2, + "name": "OCaml LGPL Linking Exception", + "licenseExceptionId": "OCaml-LGPL-linking-exception", + "seeAlso": [ + "https://caml.inria.fr/ocaml/license.en.html" + ] + }, + { + "reference": "./OCCT-exception-1.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./OCCT-exception-1.0.html", + "referenceNumber": 49, + "name": "Open CASCADE Exception 1.0", + "licenseExceptionId": "OCCT-exception-1.0", + "seeAlso": [ + "http://www.opencascade.com/content/licensing" + ] + }, + { + "reference": "./OpenJDK-assembly-exception-1.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./OpenJDK-assembly-exception-1.0.html", + "referenceNumber": 44, + "name": "OpenJDK Assembly exception 1.0", + "licenseExceptionId": "OpenJDK-assembly-exception-1.0", + "seeAlso": [ + "http://openjdk.java.net/legal/assembly-exception.html" + ] + }, + { + "reference": "./openvpn-openssl-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./openvpn-openssl-exception.html", + "referenceNumber": 29, + "name": "OpenVPN OpenSSL Exception", + "licenseExceptionId": "openvpn-openssl-exception", + "seeAlso": [ + "http://openvpn.net/index.php/license.html", + "https://github.com/psycopg/psycopg2/blob/2_9_3/LICENSE#L14" + ] + }, + { + "reference": "./PCRE2-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./PCRE2-exception.html", + "referenceNumber": 8, + "name": "PCRE2 exception", + "licenseExceptionId": "PCRE2-exception", + "seeAlso": [ + "https://www.pcre.org/licence.txt" + ] + }, + { + "reference": "./PS-or-PDF-font-exception-20170817.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./PS-or-PDF-font-exception-20170817.html", + "referenceNumber": 16, + "name": "PS/PDF font exception (2017-08-17)", + "licenseExceptionId": "PS-or-PDF-font-exception-20170817", + "seeAlso": [ + "https://github.com/ArtifexSoftware/urw-base35-fonts/blob/65962e27febc3883a17e651cdb23e783668c996f/LICENSE" + ] + }, + { + "reference": "./QPL-1.0-INRIA-2004-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./QPL-1.0-INRIA-2004-exception.html", + "referenceNumber": 68, + "name": "INRIA QPL 1.0 2004 variant exception", + "licenseExceptionId": "QPL-1.0-INRIA-2004-exception", + "seeAlso": [ + "https://git.frama-c.com/pub/frama-c/-/blob/master/licenses/Q_MODIFIED_LICENSE", + "https://github.com/maranget/hevea/blob/master/LICENSE" + ] + }, + { + "reference": "./Qt-GPL-exception-1.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Qt-GPL-exception-1.0.html", + "referenceNumber": 50, + "name": "Qt GPL exception 1.0", + "licenseExceptionId": "Qt-GPL-exception-1.0", + "seeAlso": [ + "http://code.qt.io/cgit/qt/qtbase.git/tree/LICENSE.GPL3-EXCEPT" + ] + }, + { + "reference": "./Qt-LGPL-exception-1.1.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Qt-LGPL-exception-1.1.html", + "referenceNumber": 38, + "name": "Qt LGPL exception 1.1", + "licenseExceptionId": "Qt-LGPL-exception-1.1", + "seeAlso": [ + "http://code.qt.io/cgit/qt/qtbase.git/tree/LGPL_EXCEPTION.txt" + ] + }, + { + "reference": "./Qwt-exception-1.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Qwt-exception-1.0.html", + "referenceNumber": 25, + "name": "Qwt exception 1.0", + "licenseExceptionId": "Qwt-exception-1.0", + "seeAlso": [ + "http://qwt.sourceforge.net/qwtlicense.html" + ] + }, + { + "reference": "./romic-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./romic-exception.html", + "referenceNumber": 22, + "name": "Romic Exception", + "licenseExceptionId": "romic-exception", + "seeAlso": [ + "https://web.archive.org/web/20210124015834/http://mo.morsi.org/blog/2009/08/13/lesser_affero_gplv3/", + "https://sourceforge.net/p/romic/code/ci/3ab2856180cf0d8b007609af53154cf092efc58f/tree/COPYING", + "https://github.com/moll/node-mitm/blob/bbf24b8bd7596dc6e091e625363161ce91984fc7/LICENSE#L8-L11", + "https://github.com/zenbones/SmallMind/blob/3c62b5995fe7f27c453f140ff9b60560a0893f2a/COPYRIGHT#L25-L30", + "https://github.com/CubeArtisan/cubeartisan/blob/2c6ab53455237b88a3ea07be02a838a135c4ab79/LICENSE.LESSER#L10-L15", + "https://github.com/savearray2/py.js/blob/b781273c08c8afa89f4954de4ecf42ec01429bae/README.md#license" + ] + }, + { + "reference": "./RRDtool-FLOSS-exception-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./RRDtool-FLOSS-exception-2.0.html", + "referenceNumber": 4, + "name": "RRDtool FLOSS exception 2.0", + "licenseExceptionId": "RRDtool-FLOSS-exception-2.0", + "seeAlso": [ + "https://github.com/oetiker/rrdtool-1.x/blob/master/COPYRIGHT#L25-L90", + "https://oss.oetiker.ch/rrdtool/license.en.html" + ] + }, + { + "reference": "./SANE-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./SANE-exception.html", + "referenceNumber": 11, + "name": "SANE Exception", + "licenseExceptionId": "SANE-exception", + "seeAlso": [ + "https://github.com/alexpevzner/sane-airscan/blob/master/LICENSE", + "https://gitlab.com/sane-project/backends/-/blob/master/sanei/sanei_pp.c?ref_type\u003dheads", + "https://gitlab.com/sane-project/frontends/-/blob/master/sanei/sanei_codec_ascii.c?ref_type\u003dheads" + ] + }, + { + "reference": "./SHL-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./SHL-2.0.html", + "referenceNumber": 56, + "name": "Solderpad Hardware License v2.0", + "licenseExceptionId": "SHL-2.0", + "seeAlso": [ + "https://solderpad.org/licenses/SHL-2.0/" + ] + }, + { + "reference": "./SHL-2.1.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./SHL-2.1.html", + "referenceNumber": 65, + "name": "Solderpad Hardware License v2.1", + "licenseExceptionId": "SHL-2.1", + "seeAlso": [ + "https://solderpad.org/licenses/SHL-2.1/" + ] + }, + { + "reference": "./stunnel-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./stunnel-exception.html", + "referenceNumber": 70, + "name": "stunnel Exception", + "licenseExceptionId": "stunnel-exception", + "seeAlso": [ + "https://github.com/mtrojnar/stunnel/blob/master/COPYING.md" + ] + }, + { + "reference": "./SWI-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./SWI-exception.html", + "referenceNumber": 41, + "name": "SWI exception", + "licenseExceptionId": "SWI-exception", + "seeAlso": [ + "https://github.com/SWI-Prolog/packages-clpqr/blob/bfa80b9270274f0800120d5b8e6fef42ac2dc6a5/clpqr/class.pl" + ] + }, + { + "reference": "./Swift-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Swift-exception.html", + "referenceNumber": 33, + "name": "Swift Exception", + "licenseExceptionId": "Swift-exception", + "seeAlso": [ + "https://swift.org/LICENSE.txt", + "https://github.com/apple/swift-package-manager/blob/7ab2275f447a5eb37497ed63a9340f8a6d1e488b/LICENSE.txt#L205" + ] + }, + { + "reference": "./Texinfo-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Texinfo-exception.html", + "referenceNumber": 67, + "name": "Texinfo exception", + "licenseExceptionId": "Texinfo-exception", + "seeAlso": [ + "https://git.savannah.gnu.org/cgit/automake.git/tree/lib/texinfo.tex?h\u003dv1.16.5#n23" + ] + }, + { + "reference": "./u-boot-exception-2.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./u-boot-exception-2.0.html", + "referenceNumber": 3, + "name": "U-Boot exception 2.0", + "licenseExceptionId": "u-boot-exception-2.0", + "seeAlso": [ + "http://git.denx.de/?p\u003du-boot.git;a\u003dblob;f\u003dLicenses/Exceptions" + ] + }, + { + "reference": "./UBDL-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./UBDL-exception.html", + "referenceNumber": 62, + "name": "Unmodified Binary Distribution exception", + "licenseExceptionId": "UBDL-exception", + "seeAlso": [ + "https://github.com/ipxe/ipxe/blob/master/COPYING.UBDL" + ] + }, + { + "reference": "./Universal-FOSS-exception-1.0.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./Universal-FOSS-exception-1.0.html", + "referenceNumber": 42, + "name": "Universal FOSS Exception, Version 1.0", + "licenseExceptionId": "Universal-FOSS-exception-1.0", + "seeAlso": [ + "https://oss.oracle.com/licenses/universal-foss-exception/" + ] + }, + { + "reference": "./vsftpd-openssl-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./vsftpd-openssl-exception.html", + "referenceNumber": 32, + "name": "vsftpd OpenSSL exception", + "licenseExceptionId": "vsftpd-openssl-exception", + "seeAlso": [ + "https://git.stg.centos.org/source-git/vsftpd/blob/f727873674d9c9cd7afcae6677aa782eb54c8362/f/LICENSE", + "https://launchpad.net/debian/squeeze/+source/vsftpd/+copyright", + "https://github.com/richardcochran/vsftpd/blob/master/COPYING" + ] + }, + { + "reference": "./WxWindows-exception-3.1.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./WxWindows-exception-3.1.html", + "referenceNumber": 57, + "name": "WxWindows Library Exception 3.1", + "licenseExceptionId": "WxWindows-exception-3.1", + "seeAlso": [ + "http://www.opensource.org/licenses/WXwindows" + ] + }, + { + "reference": "./x11vnc-openssl-exception.json", + "isDeprecatedLicenseId": false, + "detailsUrl": "./x11vnc-openssl-exception.html", + "referenceNumber": 47, + "name": "x11vnc OpenSSL Exception", + "licenseExceptionId": "x11vnc-openssl-exception", + "seeAlso": [ + "https://github.com/LibVNC/x11vnc/blob/master/src/8to24.c#L22" + ] + } + ], + "releaseDate": "2024-08-19" +} diff --git a/license-list-data/licenses-3.25.json b/license-list-data/licenses-3.25.json new file mode 100644 index 00000000000..5db03b48941 --- /dev/null +++ b/license-list-data/licenses-3.25.json @@ -0,0 +1,8360 @@ +{ + "licenseListVersion": "3.25.0", + "licenses": [ + { + "reference": "https://spdx.org/licenses/0BSD.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/0BSD.json", + "referenceNumber": 582, + "name": "BSD Zero Clause License", + "licenseId": "0BSD", + "seeAlso": [ + "http://landley.net/toybox/license.html", + "https://opensource.org/licenses/0BSD" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/3D-Slicer-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/3D-Slicer-1.0.json", + "referenceNumber": 466, + "name": "3D Slicer License v1.0", + "licenseId": "3D-Slicer-1.0", + "seeAlso": [ + "https://slicer.org/LICENSE", + "https://github.com/Slicer/Slicer/blob/main/License.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AAL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AAL.json", + "referenceNumber": 252, + "name": "Attribution Assurance License", + "licenseId": "AAL", + "seeAlso": [ + "https://opensource.org/licenses/attribution" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Abstyles.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Abstyles.json", + "referenceNumber": 456, + "name": "Abstyles License", + "licenseId": "Abstyles", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Abstyles" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AdaCore-doc.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AdaCore-doc.json", + "referenceNumber": 355, + "name": "AdaCore Doc License", + "licenseId": "AdaCore-doc", + "seeAlso": [ + "https://github.com/AdaCore/xmlada/blob/master/docs/index.rst", + "https://github.com/AdaCore/gnatcoll-core/blob/master/docs/index.rst", + "https://github.com/AdaCore/gnatcoll-db/blob/master/docs/index.rst" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Adobe-2006.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Adobe-2006.json", + "referenceNumber": 128, + "name": "Adobe Systems Incorporated Source Code License Agreement", + "licenseId": "Adobe-2006", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/AdobeLicense" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Adobe-Display-PostScript.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Adobe-Display-PostScript.json", + "referenceNumber": 433, + "name": "Adobe Display PostScript License", + "licenseId": "Adobe-Display-PostScript", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/COPYING?ref_type\u003dheads#L752" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Adobe-Glyph.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Adobe-Glyph.json", + "referenceNumber": 125, + "name": "Adobe Glyph List License", + "licenseId": "Adobe-Glyph", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/MIT#AdobeGlyph" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Adobe-Utopia.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Adobe-Utopia.json", + "referenceNumber": 495, + "name": "Adobe Utopia Font License", + "licenseId": "Adobe-Utopia", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/font/adobe-utopia-100dpi/-/blob/master/COPYING?ref_type\u003dheads" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ADSL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ADSL.json", + "referenceNumber": 560, + "name": "Amazon Digital Services License", + "licenseId": "ADSL", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/AmazonDigitalServicesLicense" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AFL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AFL-1.1.json", + "referenceNumber": 14, + "name": "Academic Free License v1.1", + "licenseId": "AFL-1.1", + "seeAlso": [ + "http://opensource.linux-mirror.org/licenses/afl-1.1.txt", + "http://wayback.archive.org/web/20021004124254/http://www.opensource.org/licenses/academic.php" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/AFL-1.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AFL-1.2.json", + "referenceNumber": 622, + "name": "Academic Free License v1.2", + "licenseId": "AFL-1.2", + "seeAlso": [ + "http://opensource.linux-mirror.org/licenses/afl-1.2.txt", + "http://wayback.archive.org/web/20021204204652/http://www.opensource.org/licenses/academic.php" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/AFL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AFL-2.0.json", + "referenceNumber": 559, + "name": "Academic Free License v2.0", + "licenseId": "AFL-2.0", + "seeAlso": [ + "http://wayback.archive.org/web/20060924134533/http://www.opensource.org/licenses/afl-2.0.txt" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/AFL-2.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AFL-2.1.json", + "referenceNumber": 570, + "name": "Academic Free License v2.1", + "licenseId": "AFL-2.1", + "seeAlso": [ + "http://opensource.linux-mirror.org/licenses/afl-2.1.txt" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/AFL-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AFL-3.0.json", + "referenceNumber": 332, + "name": "Academic Free License v3.0", + "licenseId": "AFL-3.0", + "seeAlso": [ + "http://www.rosenlaw.com/AFL3.0.htm", + "https://opensource.org/licenses/afl-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Afmparse.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Afmparse.json", + "referenceNumber": 163, + "name": "Afmparse License", + "licenseId": "Afmparse", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Afmparse" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AGPL-1.0.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/AGPL-1.0.json", + "referenceNumber": 657, + "name": "Affero General Public License v1.0", + "licenseId": "AGPL-1.0", + "seeAlso": [ + "http://www.affero.org/oagpl.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/AGPL-1.0-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AGPL-1.0-only.json", + "referenceNumber": 142, + "name": "Affero General Public License v1.0 only", + "licenseId": "AGPL-1.0-only", + "seeAlso": [ + "http://www.affero.org/oagpl.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AGPL-1.0-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AGPL-1.0-or-later.json", + "referenceNumber": 155, + "name": "Affero General Public License v1.0 or later", + "licenseId": "AGPL-1.0-or-later", + "seeAlso": [ + "http://www.affero.org/oagpl.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AGPL-3.0.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/AGPL-3.0.json", + "referenceNumber": 70, + "name": "GNU Affero General Public License v3.0", + "licenseId": "AGPL-3.0", + "seeAlso": [ + "https://www.gnu.org/licenses/agpl.txt", + "https://opensource.org/licenses/AGPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/AGPL-3.0-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AGPL-3.0-only.json", + "referenceNumber": 330, + "name": "GNU Affero General Public License v3.0 only", + "licenseId": "AGPL-3.0-only", + "seeAlso": [ + "https://www.gnu.org/licenses/agpl.txt", + "https://opensource.org/licenses/AGPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/AGPL-3.0-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AGPL-3.0-or-later.json", + "referenceNumber": 366, + "name": "GNU Affero General Public License v3.0 or later", + "licenseId": "AGPL-3.0-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/agpl.txt", + "https://opensource.org/licenses/AGPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Aladdin.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Aladdin.json", + "referenceNumber": 557, + "name": "Aladdin Free Public License", + "licenseId": "Aladdin", + "seeAlso": [ + "http://pages.cs.wisc.edu/~ghost/doc/AFPL/6.01/Public.htm" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/AMD-newlib.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AMD-newlib.json", + "referenceNumber": 340, + "name": "AMD newlib License", + "licenseId": "AMD-newlib", + "seeAlso": [ + "https://sourceware.org/git/?p\u003dnewlib-cygwin.git;a\u003dblob;f\u003dnewlib/libc/sys/a29khif/_close.S;h\u003d04f52ae00de1dafbd9055ad8d73c5c697a3aae7f;hb\u003dHEAD" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AMDPLPA.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AMDPLPA.json", + "referenceNumber": 467, + "name": "AMD\u0027s plpa_map.c License", + "licenseId": "AMDPLPA", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/AMD_plpa_map_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AML.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AML.json", + "referenceNumber": 299, + "name": "Apple MIT License", + "licenseId": "AML", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Apple_MIT_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AML-glslang.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AML-glslang.json", + "referenceNumber": 567, + "name": "AML glslang variant License", + "licenseId": "AML-glslang", + "seeAlso": [ + "https://github.com/KhronosGroup/glslang/blob/main/LICENSE.txt#L949", + "https://docs.omniverse.nvidia.com/install-guide/latest/common/licenses.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/AMPAS.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/AMPAS.json", + "referenceNumber": 414, + "name": "Academy of Motion Picture Arts and Sciences BSD", + "licenseId": "AMPAS", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/BSD#AMPASBSD" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ANTLR-PD.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ANTLR-PD.json", + "referenceNumber": 460, + "name": "ANTLR Software Rights Notice", + "licenseId": "ANTLR-PD", + "seeAlso": [ + "http://www.antlr2.org/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ANTLR-PD-fallback.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ANTLR-PD-fallback.json", + "referenceNumber": 65, + "name": "ANTLR Software Rights Notice with license fallback", + "licenseId": "ANTLR-PD-fallback", + "seeAlso": [ + "http://www.antlr2.org/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/any-OSI.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/any-OSI.json", + "referenceNumber": 310, + "name": "Any OSI License", + "licenseId": "any-OSI", + "seeAlso": [ + "https://metacpan.org/pod/Exporter::Tidy#LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Apache-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Apache-1.0.json", + "referenceNumber": 250, + "name": "Apache License 1.0", + "licenseId": "Apache-1.0", + "seeAlso": [ + "http://www.apache.org/licenses/LICENSE-1.0" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Apache-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Apache-1.1.json", + "referenceNumber": 288, + "name": "Apache License 1.1", + "licenseId": "Apache-1.1", + "seeAlso": [ + "http://apache.org/licenses/LICENSE-1.1", + "https://opensource.org/licenses/Apache-1.1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Apache-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Apache-2.0.json", + "referenceNumber": 143, + "name": "Apache License 2.0", + "licenseId": "Apache-2.0", + "seeAlso": [ + "https://www.apache.org/licenses/LICENSE-2.0", + "https://opensource.org/licenses/Apache-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/APAFML.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/APAFML.json", + "referenceNumber": 636, + "name": "Adobe Postscript AFM License", + "licenseId": "APAFML", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/AdobePostscriptAFM" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/APL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/APL-1.0.json", + "referenceNumber": 85, + "name": "Adaptive Public License 1.0", + "licenseId": "APL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/APL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/App-s2p.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/App-s2p.json", + "referenceNumber": 238, + "name": "App::s2p License", + "licenseId": "App-s2p", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/App-s2p" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/APSL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/APSL-1.0.json", + "referenceNumber": 335, + "name": "Apple Public Source License 1.0", + "licenseId": "APSL-1.0", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Apple_Public_Source_License_1.0" + ], + "isOsiApproved": true, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/APSL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/APSL-1.1.json", + "referenceNumber": 308, + "name": "Apple Public Source License 1.1", + "licenseId": "APSL-1.1", + "seeAlso": [ + "http://www.opensource.apple.com/source/IOSerialFamily/IOSerialFamily-7/APPLE_LICENSE" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/APSL-1.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/APSL-1.2.json", + "referenceNumber": 280, + "name": "Apple Public Source License 1.2", + "licenseId": "APSL-1.2", + "seeAlso": [ + "http://www.samurajdata.se/opensource/mirror/licenses/apsl.php" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/APSL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/APSL-2.0.json", + "referenceNumber": 592, + "name": "Apple Public Source License 2.0", + "licenseId": "APSL-2.0", + "seeAlso": [ + "http://www.opensource.apple.com/license/apsl/" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Arphic-1999.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Arphic-1999.json", + "referenceNumber": 32, + "name": "Arphic Public License", + "licenseId": "Arphic-1999", + "seeAlso": [ + "http://ftp.gnu.org/gnu/non-gnu/chinese-fonts-truetype/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Artistic-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Artistic-1.0.json", + "referenceNumber": 138, + "name": "Artistic License 1.0", + "licenseId": "Artistic-1.0", + "seeAlso": [ + "https://opensource.org/licenses/Artistic-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/Artistic-1.0-cl8.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Artistic-1.0-cl8.json", + "referenceNumber": 353, + "name": "Artistic License 1.0 w/clause 8", + "licenseId": "Artistic-1.0-cl8", + "seeAlso": [ + "https://opensource.org/licenses/Artistic-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Artistic-1.0-Perl.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Artistic-1.0-Perl.json", + "referenceNumber": 660, + "name": "Artistic License 1.0 (Perl)", + "licenseId": "Artistic-1.0-Perl", + "seeAlso": [ + "http://dev.perl.org/licenses/artistic.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Artistic-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Artistic-2.0.json", + "referenceNumber": 277, + "name": "Artistic License 2.0", + "licenseId": "Artistic-2.0", + "seeAlso": [ + "http://www.perlfoundation.org/artistic_license_2_0", + "https://www.perlfoundation.org/artistic-license-20.html", + "https://opensource.org/licenses/artistic-license-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/ASWF-Digital-Assets-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ASWF-Digital-Assets-1.0.json", + "referenceNumber": 166, + "name": "ASWF Digital Assets License version 1.0", + "licenseId": "ASWF-Digital-Assets-1.0", + "seeAlso": [ + "https://github.com/AcademySoftwareFoundation/foundation/blob/main/digital_assets/aswf_digital_assets_license_v1.0.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ASWF-Digital-Assets-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ASWF-Digital-Assets-1.1.json", + "referenceNumber": 29, + "name": "ASWF Digital Assets License 1.1", + "licenseId": "ASWF-Digital-Assets-1.1", + "seeAlso": [ + "https://github.com/AcademySoftwareFoundation/foundation/blob/main/digital_assets/aswf_digital_assets_license_v1.1.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Baekmuk.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Baekmuk.json", + "referenceNumber": 380, + "name": "Baekmuk License", + "licenseId": "Baekmuk", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing:Baekmuk?rd\u003dLicensing/Baekmuk" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Bahyph.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Bahyph.json", + "referenceNumber": 368, + "name": "Bahyph License", + "licenseId": "Bahyph", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Bahyph" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Barr.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Barr.json", + "referenceNumber": 195, + "name": "Barr License", + "licenseId": "Barr", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Barr" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/bcrypt-Solar-Designer.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/bcrypt-Solar-Designer.json", + "referenceNumber": 478, + "name": "bcrypt Solar Designer License", + "licenseId": "bcrypt-Solar-Designer", + "seeAlso": [ + "https://github.com/bcrypt-ruby/bcrypt-ruby/blob/master/ext/mri/crypt_blowfish.c" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Beerware.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Beerware.json", + "referenceNumber": 616, + "name": "Beerware License", + "licenseId": "Beerware", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Beerware", + "https://people.freebsd.org/~phk/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Bitstream-Charter.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Bitstream-Charter.json", + "referenceNumber": 455, + "name": "Bitstream Charter Font License", + "licenseId": "Bitstream-Charter", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Charter#License_Text", + "https://raw.githubusercontent.com/blackhole89/notekit/master/data/fonts/Charter%20license.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Bitstream-Vera.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Bitstream-Vera.json", + "referenceNumber": 370, + "name": "Bitstream Vera Font License", + "licenseId": "Bitstream-Vera", + "seeAlso": [ + "https://web.archive.org/web/20080207013128/http://www.gnome.org/fonts/", + "https://docubrain.com/sites/default/files/licenses/bitstream-vera.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BitTorrent-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BitTorrent-1.0.json", + "referenceNumber": 106, + "name": "BitTorrent Open Source License v1.0", + "licenseId": "BitTorrent-1.0", + "seeAlso": [ + "http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/licenses/BitTorrent?r1\u003d1.1\u0026r2\u003d1.1.1.1\u0026diff_format\u003ds" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BitTorrent-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BitTorrent-1.1.json", + "referenceNumber": 541, + "name": "BitTorrent Open Source License v1.1", + "licenseId": "BitTorrent-1.1", + "seeAlso": [ + "http://directory.fsf.org/wiki/License:BitTorrentOSL1.1" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/blessing.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/blessing.json", + "referenceNumber": 359, + "name": "SQLite Blessing", + "licenseId": "blessing", + "seeAlso": [ + "https://www.sqlite.org/src/artifact/e33a4df7e32d742a?ln\u003d4-9", + "https://sqlite.org/src/artifact/df5091916dbb40e6" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BlueOak-1.0.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BlueOak-1.0.0.json", + "referenceNumber": 606, + "name": "Blue Oak Model License 1.0.0", + "licenseId": "BlueOak-1.0.0", + "seeAlso": [ + "https://blueoakcouncil.org/license/1.0.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Boehm-GC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Boehm-GC.json", + "referenceNumber": 127, + "name": "Boehm-Demers-Weiser GC License", + "licenseId": "Boehm-GC", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing:MIT#Another_Minimal_variant_(found_in_libatomic_ops)", + "https://github.com/uim/libgcroots/blob/master/COPYING", + "https://github.com/ivmai/libatomic_ops/blob/master/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Borceux.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Borceux.json", + "referenceNumber": 571, + "name": "Borceux license", + "licenseId": "Borceux", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Borceux" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Brian-Gladman-2-Clause.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Brian-Gladman-2-Clause.json", + "referenceNumber": 416, + "name": "Brian Gladman 2-Clause License", + "licenseId": "Brian-Gladman-2-Clause", + "seeAlso": [ + "https://github.com/krb5/krb5/blob/krb5-1.21.2-final/NOTICE#L140-L156", + "https://web.mit.edu/kerberos/krb5-1.21/doc/mitK5license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Brian-Gladman-3-Clause.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Brian-Gladman-3-Clause.json", + "referenceNumber": 290, + "name": "Brian Gladman 3-Clause License", + "licenseId": "Brian-Gladman-3-Clause", + "seeAlso": [ + "https://github.com/SWI-Prolog/packages-clib/blob/master/sha1/brg_endian.h" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-1-Clause.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-1-Clause.json", + "referenceNumber": 419, + "name": "BSD 1-Clause License", + "licenseId": "BSD-1-Clause", + "seeAlso": [ + "https://svnweb.freebsd.org/base/head/include/ifaddrs.h?revision\u003d326823" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/BSD-2-Clause.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-2-Clause.json", + "referenceNumber": 229, + "name": "BSD 2-Clause \"Simplified\" License", + "licenseId": "BSD-2-Clause", + "seeAlso": [ + "https://opensource.org/licenses/BSD-2-Clause" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/BSD-2-Clause-Darwin.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-2-Clause-Darwin.json", + "referenceNumber": 296, + "name": "BSD 2-Clause - Ian Darwin variant", + "licenseId": "BSD-2-Clause-Darwin", + "seeAlso": [ + "https://github.com/file/file/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-2-Clause-first-lines.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-2-Clause-first-lines.json", + "referenceNumber": 217, + "name": "BSD 2-Clause - first lines requirement", + "licenseId": "BSD-2-Clause-first-lines", + "seeAlso": [ + "https://github.com/krb5/krb5/blob/krb5-1.21.2-final/NOTICE#L664-L690", + "https://web.mit.edu/kerberos/krb5-1.21/doc/mitK5license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-2-Clause-FreeBSD.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/BSD-2-Clause-FreeBSD.json", + "referenceNumber": 564, + "name": "BSD 2-Clause FreeBSD License", + "licenseId": "BSD-2-Clause-FreeBSD", + "seeAlso": [ + "http://www.freebsd.org/copyright/freebsd-license.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/BSD-2-Clause-NetBSD.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/BSD-2-Clause-NetBSD.json", + "referenceNumber": 376, + "name": "BSD 2-Clause NetBSD License", + "licenseId": "BSD-2-Clause-NetBSD", + "seeAlso": [ + "http://www.netbsd.org/about/redistribution.html#default" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/BSD-2-Clause-Patent.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-2-Clause-Patent.json", + "referenceNumber": 4, + "name": "BSD-2-Clause Plus Patent License", + "licenseId": "BSD-2-Clause-Patent", + "seeAlso": [ + "https://opensource.org/licenses/BSDplusPatent" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/BSD-2-Clause-Views.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-2-Clause-Views.json", + "referenceNumber": 514, + "name": "BSD 2-Clause with views sentence", + "licenseId": "BSD-2-Clause-Views", + "seeAlso": [ + "http://www.freebsd.org/copyright/freebsd-license.html", + "https://people.freebsd.org/~ivoras/wine/patch-wine-nvidia.sh", + "https://github.com/protegeproject/protege/blob/master/license.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause.json", + "referenceNumber": 584, + "name": "BSD 3-Clause \"New\" or \"Revised\" License", + "licenseId": "BSD-3-Clause", + "seeAlso": [ + "https://opensource.org/licenses/BSD-3-Clause", + "https://www.eclipse.org/org/documents/edl-v10.php" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-acpica.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-acpica.json", + "referenceNumber": 341, + "name": "BSD 3-Clause acpica variant", + "licenseId": "BSD-3-Clause-acpica", + "seeAlso": [ + "https://github.com/acpica/acpica/blob/master/source/common/acfileio.c#L119" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-Attribution.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-Attribution.json", + "referenceNumber": 71, + "name": "BSD with attribution", + "licenseId": "BSD-3-Clause-Attribution", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/BSD_with_Attribution" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-Clear.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-Clear.json", + "referenceNumber": 253, + "name": "BSD 3-Clause Clear License", + "licenseId": "BSD-3-Clause-Clear", + "seeAlso": [ + "http://labs.metacarta.com/license-explanation.html#license" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-flex.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-flex.json", + "referenceNumber": 52, + "name": "BSD 3-Clause Flex variant", + "licenseId": "BSD-3-Clause-flex", + "seeAlso": [ + "https://github.com/westes/flex/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-HP.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-HP.json", + "referenceNumber": 215, + "name": "Hewlett-Packard BSD variant license", + "licenseId": "BSD-3-Clause-HP", + "seeAlso": [ + "https://github.com/zdohnal/hplip/blob/master/COPYING#L939" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-LBNL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-LBNL.json", + "referenceNumber": 301, + "name": "Lawrence Berkeley National Labs BSD variant license", + "licenseId": "BSD-3-Clause-LBNL", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/LBNLBSD" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-Modification.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-Modification.json", + "referenceNumber": 47, + "name": "BSD 3-Clause Modification", + "licenseId": "BSD-3-Clause-Modification", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing:BSD#Modification_Variant" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-No-Military-License.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-No-Military-License.json", + "referenceNumber": 615, + "name": "BSD 3-Clause No Military License", + "licenseId": "BSD-3-Clause-No-Military-License", + "seeAlso": [ + "https://gitlab.syncad.com/hive/dhive/-/blob/master/LICENSE", + "https://github.com/greymass/swift-eosio/blob/master/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-No-Nuclear-License.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-No-Nuclear-License.json", + "referenceNumber": 647, + "name": "BSD 3-Clause No Nuclear License", + "licenseId": "BSD-3-Clause-No-Nuclear-License", + "seeAlso": [ + "http://download.oracle.com/otn-pub/java/licenses/bsd.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-No-Nuclear-License-2014.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-No-Nuclear-License-2014.json", + "referenceNumber": 377, + "name": "BSD 3-Clause No Nuclear License 2014", + "licenseId": "BSD-3-Clause-No-Nuclear-License-2014", + "seeAlso": [ + "https://java.net/projects/javaeetutorial/pages/BerkeleyLicense" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-No-Nuclear-Warranty.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-No-Nuclear-Warranty.json", + "referenceNumber": 54, + "name": "BSD 3-Clause No Nuclear Warranty", + "licenseId": "BSD-3-Clause-No-Nuclear-Warranty", + "seeAlso": [ + "https://jogamp.org/git/?p\u003dgluegen.git;a\u003dblob_plain;f\u003dLICENSE.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-Open-MPI.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-Open-MPI.json", + "referenceNumber": 633, + "name": "BSD 3-Clause Open MPI variant", + "licenseId": "BSD-3-Clause-Open-MPI", + "seeAlso": [ + "https://www.open-mpi.org/community/license.php", + "http://www.netlib.org/lapack/LICENSE.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-3-Clause-Sun.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-3-Clause-Sun.json", + "referenceNumber": 270, + "name": "BSD 3-Clause Sun Microsystems", + "licenseId": "BSD-3-Clause-Sun", + "seeAlso": [ + "https://github.com/xmlark/msv/blob/b9316e2f2270bc1606952ea4939ec87fbba157f3/xsdlib/src/main/java/com/sun/msv/datatype/regexp/InternalImpl.java" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-4-Clause.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-4-Clause.json", + "referenceNumber": 470, + "name": "BSD 4-Clause \"Original\" or \"Old\" License", + "licenseId": "BSD-4-Clause", + "seeAlso": [ + "http://directory.fsf.org/wiki/License:BSD_4Clause" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/BSD-4-Clause-Shortened.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-4-Clause-Shortened.json", + "referenceNumber": 220, + "name": "BSD 4 Clause Shortened", + "licenseId": "BSD-4-Clause-Shortened", + "seeAlso": [ + "https://metadata.ftp-master.debian.org/changelogs//main/a/arpwatch/arpwatch_2.1a15-7_copyright" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-4-Clause-UC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-4-Clause-UC.json", + "referenceNumber": 175, + "name": "BSD-4-Clause (University of California-Specific)", + "licenseId": "BSD-4-Clause-UC", + "seeAlso": [ + "http://www.freebsd.org/copyright/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-4.3RENO.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-4.3RENO.json", + "referenceNumber": 361, + "name": "BSD 4.3 RENO License", + "licenseId": "BSD-4.3RENO", + "seeAlso": [ + "https://sourceware.org/git/?p\u003dbinutils-gdb.git;a\u003dblob;f\u003dlibiberty/strcasecmp.c;h\u003d131d81c2ce7881fa48c363dc5bf5fb302c61ce0b;hb\u003dHEAD", + "https://git.openldap.org/openldap/openldap/-/blob/master/COPYRIGHT#L55-63" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-4.3TAHOE.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-4.3TAHOE.json", + "referenceNumber": 46, + "name": "BSD 4.3 TAHOE License", + "licenseId": "BSD-4.3TAHOE", + "seeAlso": [ + "https://github.com/389ds/389-ds-base/blob/main/ldap/include/sysexits-compat.h#L15", + "https://git.savannah.gnu.org/cgit/indent.git/tree/doc/indent.texi?id\u003da74c6b4ee49397cf330b333da1042bffa60ed14f#n1788" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-Advertising-Acknowledgement.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-Advertising-Acknowledgement.json", + "referenceNumber": 297, + "name": "BSD Advertising Acknowledgement License", + "licenseId": "BSD-Advertising-Acknowledgement", + "seeAlso": [ + "https://github.com/python-excel/xlrd/blob/master/LICENSE#L33" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-Attribution-HPND-disclaimer.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-Attribution-HPND-disclaimer.json", + "referenceNumber": 86, + "name": "BSD with Attribution and HPND disclaimer", + "licenseId": "BSD-Attribution-HPND-disclaimer", + "seeAlso": [ + "https://github.com/cyrusimap/cyrus-sasl/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-Inferno-Nettverk.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-Inferno-Nettverk.json", + "referenceNumber": 89, + "name": "BSD-Inferno-Nettverk", + "licenseId": "BSD-Inferno-Nettverk", + "seeAlso": [ + "https://www.inet.no/dante/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-Protection.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-Protection.json", + "referenceNumber": 394, + "name": "BSD Protection License", + "licenseId": "BSD-Protection", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/BSD_Protection_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-Source-beginning-file.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-Source-beginning-file.json", + "referenceNumber": 378, + "name": "BSD Source Code Attribution - beginning of file variant", + "licenseId": "BSD-Source-beginning-file", + "seeAlso": [ + "https://github.com/lattera/freebsd/blob/master/sys/cam/cam.c#L4" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-Source-Code.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-Source-Code.json", + "referenceNumber": 605, + "name": "BSD Source Code Attribution", + "licenseId": "BSD-Source-Code", + "seeAlso": [ + "https://github.com/robbiehanson/CocoaHTTPServer/blob/master/LICENSE.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-Systemics.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-Systemics.json", + "referenceNumber": 327, + "name": "Systemics BSD variant license", + "licenseId": "BSD-Systemics", + "seeAlso": [ + "https://metacpan.org/release/DPARIS/Crypt-DES-2.07/source/COPYRIGHT" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSD-Systemics-W3Works.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSD-Systemics-W3Works.json", + "referenceNumber": 427, + "name": "Systemics W3Works BSD variant license", + "licenseId": "BSD-Systemics-W3Works", + "seeAlso": [ + "https://metacpan.org/release/DPARIS/Crypt-Blowfish-2.14/source/COPYRIGHT#L7" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/BSL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BSL-1.0.json", + "referenceNumber": 334, + "name": "Boost Software License 1.0", + "licenseId": "BSL-1.0", + "seeAlso": [ + "http://www.boost.org/LICENSE_1_0.txt", + "https://opensource.org/licenses/BSL-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/BUSL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/BUSL-1.1.json", + "referenceNumber": 285, + "name": "Business Source License 1.1", + "licenseId": "BUSL-1.1", + "seeAlso": [ + "https://mariadb.com/bsl11/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/bzip2-1.0.5.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/bzip2-1.0.5.json", + "referenceNumber": 574, + "name": "bzip2 and libbzip2 License v1.0.5", + "licenseId": "bzip2-1.0.5", + "seeAlso": [ + "https://sourceware.org/bzip2/1.0.5/bzip2-manual-1.0.5.html", + "http://bzip.org/1.0.5/bzip2-manual-1.0.5.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/bzip2-1.0.6.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/bzip2-1.0.6.json", + "referenceNumber": 534, + "name": "bzip2 and libbzip2 License v1.0.6", + "licenseId": "bzip2-1.0.6", + "seeAlso": [ + "https://sourceware.org/git/?p\u003dbzip2.git;a\u003dblob;f\u003dLICENSE;hb\u003dbzip2-1.0.6", + "http://bzip.org/1.0.5/bzip2-manual-1.0.5.html", + "https://sourceware.org/cgit/valgrind/tree/mpi/libmpiwrap.c" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/C-UDA-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/C-UDA-1.0.json", + "referenceNumber": 162, + "name": "Computational Use of Data Agreement v1.0", + "licenseId": "C-UDA-1.0", + "seeAlso": [ + "https://github.com/microsoft/Computational-Use-of-Data-Agreement/blob/master/C-UDA-1.0.md", + "https://cdla.dev/computational-use-of-data-agreement-v1-0/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CAL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CAL-1.0.json", + "referenceNumber": 99, + "name": "Cryptographic Autonomy License 1.0", + "licenseId": "CAL-1.0", + "seeAlso": [ + "http://cryptographicautonomylicense.com/license-text.html", + "https://opensource.org/licenses/CAL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/CAL-1.0-Combined-Work-Exception.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CAL-1.0-Combined-Work-Exception.json", + "referenceNumber": 333, + "name": "Cryptographic Autonomy License 1.0 (Combined Work Exception)", + "licenseId": "CAL-1.0-Combined-Work-Exception", + "seeAlso": [ + "http://cryptographicautonomylicense.com/license-text.html", + "https://opensource.org/licenses/CAL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Caldera.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Caldera.json", + "referenceNumber": 528, + "name": "Caldera License", + "licenseId": "Caldera", + "seeAlso": [ + "http://www.lemis.com/grog/UNIX/ancient-source-all.pdf" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Caldera-no-preamble.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Caldera-no-preamble.json", + "referenceNumber": 233, + "name": "Caldera License (without preamble)", + "licenseId": "Caldera-no-preamble", + "seeAlso": [ + "https://github.com/apache/apr/blob/trunk/LICENSE#L298C6-L298C29" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Catharon.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Catharon.json", + "referenceNumber": 337, + "name": "Catharon License", + "licenseId": "Catharon", + "seeAlso": [ + "https://github.com/scummvm/scummvm/blob/v2.8.0/LICENSES/CatharonLicense.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CATOSL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CATOSL-1.1.json", + "referenceNumber": 134, + "name": "Computer Associates Trusted Open Source License 1.1", + "licenseId": "CATOSL-1.1", + "seeAlso": [ + "https://opensource.org/licenses/CATOSL-1.1" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/CC-BY-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-1.0.json", + "referenceNumber": 415, + "name": "Creative Commons Attribution 1.0 Generic", + "licenseId": "CC-BY-1.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by/1.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-2.0.json", + "referenceNumber": 428, + "name": "Creative Commons Attribution 2.0 Generic", + "licenseId": "CC-BY-2.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by/2.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-2.5.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-2.5.json", + "referenceNumber": 573, + "name": "Creative Commons Attribution 2.5 Generic", + "licenseId": "CC-BY-2.5", + "seeAlso": [ + "https://creativecommons.org/licenses/by/2.5/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-2.5-AU.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-2.5-AU.json", + "referenceNumber": 388, + "name": "Creative Commons Attribution 2.5 Australia", + "licenseId": "CC-BY-2.5-AU", + "seeAlso": [ + "https://creativecommons.org/licenses/by/2.5/au/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-3.0.json", + "referenceNumber": 132, + "name": "Creative Commons Attribution 3.0 Unported", + "licenseId": "CC-BY-3.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by/3.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-3.0-AT.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-3.0-AT.json", + "referenceNumber": 25, + "name": "Creative Commons Attribution 3.0 Austria", + "licenseId": "CC-BY-3.0-AT", + "seeAlso": [ + "https://creativecommons.org/licenses/by/3.0/at/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-3.0-AU.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-3.0-AU.json", + "referenceNumber": 392, + "name": "Creative Commons Attribution 3.0 Australia", + "licenseId": "CC-BY-3.0-AU", + "seeAlso": [ + "https://creativecommons.org/licenses/by/3.0/au/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-3.0-DE.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-3.0-DE.json", + "referenceNumber": 21, + "name": "Creative Commons Attribution 3.0 Germany", + "licenseId": "CC-BY-3.0-DE", + "seeAlso": [ + "https://creativecommons.org/licenses/by/3.0/de/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-3.0-IGO.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-3.0-IGO.json", + "referenceNumber": 596, + "name": "Creative Commons Attribution 3.0 IGO", + "licenseId": "CC-BY-3.0-IGO", + "seeAlso": [ + "https://creativecommons.org/licenses/by/3.0/igo/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-3.0-NL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-3.0-NL.json", + "referenceNumber": 157, + "name": "Creative Commons Attribution 3.0 Netherlands", + "licenseId": "CC-BY-3.0-NL", + "seeAlso": [ + "https://creativecommons.org/licenses/by/3.0/nl/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-3.0-US.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-3.0-US.json", + "referenceNumber": 395, + "name": "Creative Commons Attribution 3.0 United States", + "licenseId": "CC-BY-3.0-US", + "seeAlso": [ + "https://creativecommons.org/licenses/by/3.0/us/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-4.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-4.0.json", + "referenceNumber": 435, + "name": "Creative Commons Attribution 4.0 International", + "licenseId": "CC-BY-4.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by/4.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-1.0.json", + "referenceNumber": 641, + "name": "Creative Commons Attribution Non Commercial 1.0 Generic", + "licenseId": "CC-BY-NC-1.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc/1.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-2.0.json", + "referenceNumber": 91, + "name": "Creative Commons Attribution Non Commercial 2.0 Generic", + "licenseId": "CC-BY-NC-2.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc/2.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-2.5.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-2.5.json", + "referenceNumber": 465, + "name": "Creative Commons Attribution Non Commercial 2.5 Generic", + "licenseId": "CC-BY-NC-2.5", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc/2.5/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-3.0.json", + "referenceNumber": 234, + "name": "Creative Commons Attribution Non Commercial 3.0 Unported", + "licenseId": "CC-BY-NC-3.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc/3.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-3.0-DE.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-3.0-DE.json", + "referenceNumber": 354, + "name": "Creative Commons Attribution Non Commercial 3.0 Germany", + "licenseId": "CC-BY-NC-3.0-DE", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc/3.0/de/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-4.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-4.0.json", + "referenceNumber": 53, + "name": "Creative Commons Attribution Non Commercial 4.0 International", + "licenseId": "CC-BY-NC-4.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc/4.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-ND-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-ND-1.0.json", + "referenceNumber": 88, + "name": "Creative Commons Attribution Non Commercial No Derivatives 1.0 Generic", + "licenseId": "CC-BY-NC-ND-1.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nd-nc/1.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-ND-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-ND-2.0.json", + "referenceNumber": 426, + "name": "Creative Commons Attribution Non Commercial No Derivatives 2.0 Generic", + "licenseId": "CC-BY-NC-ND-2.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-nd/2.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-ND-2.5.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-ND-2.5.json", + "referenceNumber": 441, + "name": "Creative Commons Attribution Non Commercial No Derivatives 2.5 Generic", + "licenseId": "CC-BY-NC-ND-2.5", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-nd/2.5/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-ND-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-ND-3.0.json", + "referenceNumber": 304, + "name": "Creative Commons Attribution Non Commercial No Derivatives 3.0 Unported", + "licenseId": "CC-BY-NC-ND-3.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-nd/3.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-ND-3.0-DE.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-ND-3.0-DE.json", + "referenceNumber": 121, + "name": "Creative Commons Attribution Non Commercial No Derivatives 3.0 Germany", + "licenseId": "CC-BY-NC-ND-3.0-DE", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-nd/3.0/de/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-ND-3.0-IGO.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-ND-3.0-IGO.json", + "referenceNumber": 171, + "name": "Creative Commons Attribution Non Commercial No Derivatives 3.0 IGO", + "licenseId": "CC-BY-NC-ND-3.0-IGO", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-nd/3.0/igo/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-ND-4.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-ND-4.0.json", + "referenceNumber": 183, + "name": "Creative Commons Attribution Non Commercial No Derivatives 4.0 International", + "licenseId": "CC-BY-NC-ND-4.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-1.0.json", + "referenceNumber": 501, + "name": "Creative Commons Attribution Non Commercial Share Alike 1.0 Generic", + "licenseId": "CC-BY-NC-SA-1.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/1.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-2.0.json", + "referenceNumber": 358, + "name": "Creative Commons Attribution Non Commercial Share Alike 2.0 Generic", + "licenseId": "CC-BY-NC-SA-2.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/2.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-2.0-DE.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-2.0-DE.json", + "referenceNumber": 260, + "name": "Creative Commons Attribution Non Commercial Share Alike 2.0 Germany", + "licenseId": "CC-BY-NC-SA-2.0-DE", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/2.0/de/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-2.0-FR.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-2.0-FR.json", + "referenceNumber": 158, + "name": "Creative Commons Attribution-NonCommercial-ShareAlike 2.0 France", + "licenseId": "CC-BY-NC-SA-2.0-FR", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/2.0/fr/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-2.0-UK.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-2.0-UK.json", + "referenceNumber": 33, + "name": "Creative Commons Attribution Non Commercial Share Alike 2.0 England and Wales", + "licenseId": "CC-BY-NC-SA-2.0-UK", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/2.0/uk/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-2.5.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-2.5.json", + "referenceNumber": 222, + "name": "Creative Commons Attribution Non Commercial Share Alike 2.5 Generic", + "licenseId": "CC-BY-NC-SA-2.5", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/2.5/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-3.0.json", + "referenceNumber": 255, + "name": "Creative Commons Attribution Non Commercial Share Alike 3.0 Unported", + "licenseId": "CC-BY-NC-SA-3.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/3.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-3.0-DE.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-3.0-DE.json", + "referenceNumber": 525, + "name": "Creative Commons Attribution Non Commercial Share Alike 3.0 Germany", + "licenseId": "CC-BY-NC-SA-3.0-DE", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/3.0/de/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-3.0-IGO.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-3.0-IGO.json", + "referenceNumber": 244, + "name": "Creative Commons Attribution Non Commercial Share Alike 3.0 IGO", + "licenseId": "CC-BY-NC-SA-3.0-IGO", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/3.0/igo/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-NC-SA-4.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-NC-SA-4.0.json", + "referenceNumber": 513, + "name": "Creative Commons Attribution Non Commercial Share Alike 4.0 International", + "licenseId": "CC-BY-NC-SA-4.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-ND-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-ND-1.0.json", + "referenceNumber": 474, + "name": "Creative Commons Attribution No Derivatives 1.0 Generic", + "licenseId": "CC-BY-ND-1.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nd/1.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-ND-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-ND-2.0.json", + "referenceNumber": 356, + "name": "Creative Commons Attribution No Derivatives 2.0 Generic", + "licenseId": "CC-BY-ND-2.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nd/2.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-ND-2.5.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-ND-2.5.json", + "referenceNumber": 259, + "name": "Creative Commons Attribution No Derivatives 2.5 Generic", + "licenseId": "CC-BY-ND-2.5", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nd/2.5/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-ND-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-ND-3.0.json", + "referenceNumber": 527, + "name": "Creative Commons Attribution No Derivatives 3.0 Unported", + "licenseId": "CC-BY-ND-3.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nd/3.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-ND-3.0-DE.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-ND-3.0-DE.json", + "referenceNumber": 214, + "name": "Creative Commons Attribution No Derivatives 3.0 Germany", + "licenseId": "CC-BY-ND-3.0-DE", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nd/3.0/de/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-ND-4.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-ND-4.0.json", + "referenceNumber": 481, + "name": "Creative Commons Attribution No Derivatives 4.0 International", + "licenseId": "CC-BY-ND-4.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-nd/4.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-1.0.json", + "referenceNumber": 588, + "name": "Creative Commons Attribution Share Alike 1.0 Generic", + "licenseId": "CC-BY-SA-1.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/1.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-2.0.json", + "referenceNumber": 180, + "name": "Creative Commons Attribution Share Alike 2.0 Generic", + "licenseId": "CC-BY-SA-2.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/2.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-2.0-UK.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-2.0-UK.json", + "referenceNumber": 385, + "name": "Creative Commons Attribution Share Alike 2.0 England and Wales", + "licenseId": "CC-BY-SA-2.0-UK", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/2.0/uk/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-2.1-JP.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-2.1-JP.json", + "referenceNumber": 17, + "name": "Creative Commons Attribution Share Alike 2.1 Japan", + "licenseId": "CC-BY-SA-2.1-JP", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/2.1/jp/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-2.5.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-2.5.json", + "referenceNumber": 607, + "name": "Creative Commons Attribution Share Alike 2.5 Generic", + "licenseId": "CC-BY-SA-2.5", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/2.5/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-3.0.json", + "referenceNumber": 26, + "name": "Creative Commons Attribution Share Alike 3.0 Unported", + "licenseId": "CC-BY-SA-3.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/3.0/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-3.0-AT.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-3.0-AT.json", + "referenceNumber": 398, + "name": "Creative Commons Attribution Share Alike 3.0 Austria", + "licenseId": "CC-BY-SA-3.0-AT", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/3.0/at/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-3.0-DE.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-3.0-DE.json", + "referenceNumber": 120, + "name": "Creative Commons Attribution Share Alike 3.0 Germany", + "licenseId": "CC-BY-SA-3.0-DE", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/3.0/de/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-3.0-IGO.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-3.0-IGO.json", + "referenceNumber": 519, + "name": "Creative Commons Attribution-ShareAlike 3.0 IGO", + "licenseId": "CC-BY-SA-3.0-IGO", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/3.0/igo/legalcode" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC-BY-SA-4.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-BY-SA-4.0.json", + "referenceNumber": 13, + "name": "Creative Commons Attribution Share Alike 4.0 International", + "licenseId": "CC-BY-SA-4.0", + "seeAlso": [ + "https://creativecommons.org/licenses/by-sa/4.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/CC-PDDC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC-PDDC.json", + "referenceNumber": 169, + "name": "Creative Commons Public Domain Dedication and Certification", + "licenseId": "CC-PDDC", + "seeAlso": [ + "https://creativecommons.org/licenses/publicdomain/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CC0-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CC0-1.0.json", + "referenceNumber": 491, + "name": "Creative Commons Zero v1.0 Universal", + "licenseId": "CC0-1.0", + "seeAlso": [ + "https://creativecommons.org/publicdomain/zero/1.0/legalcode" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/CDDL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CDDL-1.0.json", + "referenceNumber": 185, + "name": "Common Development and Distribution License 1.0", + "licenseId": "CDDL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/cddl1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/CDDL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CDDL-1.1.json", + "referenceNumber": 476, + "name": "Common Development and Distribution License 1.1", + "licenseId": "CDDL-1.1", + "seeAlso": [ + "http://glassfish.java.net/public/CDDL+GPL_1_1.html", + "https://javaee.github.io/glassfish/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CDL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CDL-1.0.json", + "referenceNumber": 305, + "name": "Common Documentation License 1.0", + "licenseId": "CDL-1.0", + "seeAlso": [ + "http://www.opensource.apple.com/cdl/", + "https://fedoraproject.org/wiki/Licensing/Common_Documentation_License", + "https://www.gnu.org/licenses/license-list.html#ACDL" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CDLA-Permissive-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CDLA-Permissive-1.0.json", + "referenceNumber": 386, + "name": "Community Data License Agreement Permissive 1.0", + "licenseId": "CDLA-Permissive-1.0", + "seeAlso": [ + "https://cdla.io/permissive-1-0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CDLA-Permissive-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CDLA-Permissive-2.0.json", + "referenceNumber": 590, + "name": "Community Data License Agreement Permissive 2.0", + "licenseId": "CDLA-Permissive-2.0", + "seeAlso": [ + "https://cdla.dev/permissive-2-0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CDLA-Sharing-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CDLA-Sharing-1.0.json", + "referenceNumber": 190, + "name": "Community Data License Agreement Sharing 1.0", + "licenseId": "CDLA-Sharing-1.0", + "seeAlso": [ + "https://cdla.io/sharing-1-0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CECILL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CECILL-1.0.json", + "referenceNumber": 625, + "name": "CeCILL Free Software License Agreement v1.0", + "licenseId": "CECILL-1.0", + "seeAlso": [ + "http://www.cecill.info/licences/Licence_CeCILL_V1-fr.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CECILL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CECILL-1.1.json", + "referenceNumber": 326, + "name": "CeCILL Free Software License Agreement v1.1", + "licenseId": "CECILL-1.1", + "seeAlso": [ + "http://www.cecill.info/licences/Licence_CeCILL_V1.1-US.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CECILL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CECILL-2.0.json", + "referenceNumber": 463, + "name": "CeCILL Free Software License Agreement v2.0", + "licenseId": "CECILL-2.0", + "seeAlso": [ + "http://www.cecill.info/licences/Licence_CeCILL_V2-en.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/CECILL-2.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CECILL-2.1.json", + "referenceNumber": 170, + "name": "CeCILL Free Software License Agreement v2.1", + "licenseId": "CECILL-2.1", + "seeAlso": [ + "http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/CECILL-B.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CECILL-B.json", + "referenceNumber": 196, + "name": "CeCILL-B Free Software License Agreement", + "licenseId": "CECILL-B", + "seeAlso": [ + "http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/CECILL-C.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CECILL-C.json", + "referenceNumber": 178, + "name": "CeCILL-C Free Software License Agreement", + "licenseId": "CECILL-C", + "seeAlso": [ + "http://www.cecill.info/licences/Licence_CeCILL-C_V1-en.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/CERN-OHL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CERN-OHL-1.1.json", + "referenceNumber": 148, + "name": "CERN Open Hardware Licence v1.1", + "licenseId": "CERN-OHL-1.1", + "seeAlso": [ + "https://www.ohwr.org/project/licenses/wikis/cern-ohl-v1.1" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CERN-OHL-1.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CERN-OHL-1.2.json", + "referenceNumber": 651, + "name": "CERN Open Hardware Licence v1.2", + "licenseId": "CERN-OHL-1.2", + "seeAlso": [ + "https://www.ohwr.org/project/licenses/wikis/cern-ohl-v1.2" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CERN-OHL-P-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CERN-OHL-P-2.0.json", + "referenceNumber": 543, + "name": "CERN Open Hardware Licence Version 2 - Permissive", + "licenseId": "CERN-OHL-P-2.0", + "seeAlso": [ + "https://www.ohwr.org/project/cernohl/wikis/Documents/CERN-OHL-version-2" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/CERN-OHL-S-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CERN-OHL-S-2.0.json", + "referenceNumber": 396, + "name": "CERN Open Hardware Licence Version 2 - Strongly Reciprocal", + "licenseId": "CERN-OHL-S-2.0", + "seeAlso": [ + "https://www.ohwr.org/project/cernohl/wikis/Documents/CERN-OHL-version-2" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/CERN-OHL-W-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CERN-OHL-W-2.0.json", + "referenceNumber": 614, + "name": "CERN Open Hardware Licence Version 2 - Weakly Reciprocal", + "licenseId": "CERN-OHL-W-2.0", + "seeAlso": [ + "https://www.ohwr.org/project/cernohl/wikis/Documents/CERN-OHL-version-2" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/CFITSIO.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CFITSIO.json", + "referenceNumber": 568, + "name": "CFITSIO License", + "licenseId": "CFITSIO", + "seeAlso": [ + "https://heasarc.gsfc.nasa.gov/docs/software/fitsio/c/f_user/node9.html", + "https://heasarc.gsfc.nasa.gov/docs/software/ftools/fv/doc/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/check-cvs.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/check-cvs.json", + "referenceNumber": 324, + "name": "check-cvs License", + "licenseId": "check-cvs", + "seeAlso": [ + "http://cvs.savannah.gnu.org/viewvc/cvs/ccvs/contrib/check_cvs.in?revision\u003d1.1.4.3\u0026view\u003dmarkup\u0026pathrev\u003dcvs1-11-23#l2" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/checkmk.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/checkmk.json", + "referenceNumber": 464, + "name": "Checkmk License", + "licenseId": "checkmk", + "seeAlso": [ + "https://github.com/libcheck/check/blob/master/checkmk/checkmk.in" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ClArtistic.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ClArtistic.json", + "referenceNumber": 230, + "name": "Clarified Artistic License", + "licenseId": "ClArtistic", + "seeAlso": [ + "http://gianluca.dellavedova.org/2011/01/03/clarified-artistic-license/", + "http://www.ncftp.com/ncftp/doc/LICENSE.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Clips.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Clips.json", + "referenceNumber": 424, + "name": "Clips License", + "licenseId": "Clips", + "seeAlso": [ + "https://github.com/DrItanium/maya/blob/master/LICENSE.CLIPS" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CMU-Mach.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CMU-Mach.json", + "referenceNumber": 73, + "name": "CMU Mach License", + "licenseId": "CMU-Mach", + "seeAlso": [ + "https://www.cs.cmu.edu/~410/licenses.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CMU-Mach-nodoc.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CMU-Mach-nodoc.json", + "referenceNumber": 8, + "name": "CMU Mach - no notices-in-documentation variant", + "licenseId": "CMU-Mach-nodoc", + "seeAlso": [ + "https://github.com/krb5/krb5/blob/krb5-1.21.2-final/NOTICE#L718-L728", + "https://web.mit.edu/kerberos/krb5-1.21/doc/mitK5license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CNRI-Jython.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CNRI-Jython.json", + "referenceNumber": 293, + "name": "CNRI Jython License", + "licenseId": "CNRI-Jython", + "seeAlso": [ + "http://www.jython.org/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CNRI-Python.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CNRI-Python.json", + "referenceNumber": 402, + "name": "CNRI Python License", + "licenseId": "CNRI-Python", + "seeAlso": [ + "https://opensource.org/licenses/CNRI-Python" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/CNRI-Python-GPL-Compatible.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CNRI-Python-GPL-Compatible.json", + "referenceNumber": 224, + "name": "CNRI Python Open Source GPL Compatible License Agreement", + "licenseId": "CNRI-Python-GPL-Compatible", + "seeAlso": [ + "http://www.python.org/download/releases/1.6.1/download_win/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/COIL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/COIL-1.0.json", + "referenceNumber": 345, + "name": "Copyfree Open Innovation License", + "licenseId": "COIL-1.0", + "seeAlso": [ + "https://coil.apotheon.org/plaintext/01.0.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Community-Spec-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Community-Spec-1.0.json", + "referenceNumber": 56, + "name": "Community Specification License 1.0", + "licenseId": "Community-Spec-1.0", + "seeAlso": [ + "https://github.com/CommunitySpecification/1.0/blob/master/1._Community_Specification_License-v1.md" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Condor-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Condor-1.1.json", + "referenceNumber": 77, + "name": "Condor Public License v1.1", + "licenseId": "Condor-1.1", + "seeAlso": [ + "http://research.cs.wisc.edu/condor/license.html#condor", + "http://web.archive.org/web/20111123062036/http://research.cs.wisc.edu/condor/license.html#condor" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/copyleft-next-0.3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/copyleft-next-0.3.0.json", + "referenceNumber": 322, + "name": "copyleft-next 0.3.0", + "licenseId": "copyleft-next-0.3.0", + "seeAlso": [ + "https://github.com/copyleft-next/copyleft-next/blob/master/Releases/copyleft-next-0.3.0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/copyleft-next-0.3.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/copyleft-next-0.3.1.json", + "referenceNumber": 403, + "name": "copyleft-next 0.3.1", + "licenseId": "copyleft-next-0.3.1", + "seeAlso": [ + "https://github.com/copyleft-next/copyleft-next/blob/master/Releases/copyleft-next-0.3.1" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Cornell-Lossless-JPEG.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Cornell-Lossless-JPEG.json", + "referenceNumber": 98, + "name": "Cornell Lossless JPEG License", + "licenseId": "Cornell-Lossless-JPEG", + "seeAlso": [ + "https://android.googlesource.com/platform/external/dng_sdk/+/refs/heads/master/source/dng_lossless_jpeg.cpp#16", + "https://www.mssl.ucl.ac.uk/~mcrw/src/20050920/proto.h", + "https://gitlab.freedesktop.org/libopenraw/libopenraw/blob/master/lib/ljpegdecompressor.cpp#L32" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CPAL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CPAL-1.0.json", + "referenceNumber": 548, + "name": "Common Public Attribution License 1.0", + "licenseId": "CPAL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/CPAL-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/CPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CPL-1.0.json", + "referenceNumber": 114, + "name": "Common Public License 1.0", + "licenseId": "CPL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/CPL-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/CPOL-1.02.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CPOL-1.02.json", + "referenceNumber": 6, + "name": "Code Project Open License 1.02", + "licenseId": "CPOL-1.02", + "seeAlso": [ + "http://www.codeproject.com/info/cpol10.aspx" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/Cronyx.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Cronyx.json", + "referenceNumber": 649, + "name": "Cronyx License", + "licenseId": "Cronyx", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/font/alias/-/blob/master/COPYING", + "https://gitlab.freedesktop.org/xorg/font/cronyx-cyrillic/-/blob/master/COPYING", + "https://gitlab.freedesktop.org/xorg/font/misc-cyrillic/-/blob/master/COPYING", + "https://gitlab.freedesktop.org/xorg/font/screen-cyrillic/-/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Crossword.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Crossword.json", + "referenceNumber": 593, + "name": "Crossword License", + "licenseId": "Crossword", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Crossword" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CrystalStacker.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CrystalStacker.json", + "referenceNumber": 241, + "name": "CrystalStacker License", + "licenseId": "CrystalStacker", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing:CrystalStacker?rd\u003dLicensing/CrystalStacker" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/CUA-OPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/CUA-OPL-1.0.json", + "referenceNumber": 409, + "name": "CUA Office Public License v1.0", + "licenseId": "CUA-OPL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/CUA-OPL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Cube.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Cube.json", + "referenceNumber": 141, + "name": "Cube License", + "licenseId": "Cube", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Cube" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/curl.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/curl.json", + "referenceNumber": 602, + "name": "curl License", + "licenseId": "curl", + "seeAlso": [ + "https://github.com/bagder/curl/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/cve-tou.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/cve-tou.json", + "referenceNumber": 656, + "name": "Common Vulnerability Enumeration ToU License", + "licenseId": "cve-tou", + "seeAlso": [ + "https://www.cve.org/Legal/TermsOfUse" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/D-FSL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/D-FSL-1.0.json", + "referenceNumber": 116, + "name": "Deutsche Freie Software Lizenz", + "licenseId": "D-FSL-1.0", + "seeAlso": [ + "http://www.dipp.nrw.de/d-fsl/lizenzen/", + "http://www.dipp.nrw.de/d-fsl/index_html/lizenzen/de/D-FSL-1_0_de.txt", + "http://www.dipp.nrw.de/d-fsl/index_html/lizenzen/en/D-FSL-1_0_en.txt", + "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl", + "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/deutsche-freie-software-lizenz", + "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/german-free-software-license", + "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_de.txt/at_download/file", + "https://www.hbz-nrw.de/produkte/open-access/lizenzen/dfsl/D-FSL-1_0_en.txt/at_download/file" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/DEC-3-Clause.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/DEC-3-Clause.json", + "referenceNumber": 512, + "name": "DEC 3-Clause License", + "licenseId": "DEC-3-Clause", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/COPYING?ref_type\u003dheads#L239" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/diffmark.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/diffmark.json", + "referenceNumber": 480, + "name": "diffmark license", + "licenseId": "diffmark", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/diffmark" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/DL-DE-BY-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/DL-DE-BY-2.0.json", + "referenceNumber": 84, + "name": "Data licence Germany – attribution – version 2.0", + "licenseId": "DL-DE-BY-2.0", + "seeAlso": [ + "https://www.govdata.de/dl-de/by-2-0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/DL-DE-ZERO-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/DL-DE-ZERO-2.0.json", + "referenceNumber": 522, + "name": "Data licence Germany – zero – version 2.0", + "licenseId": "DL-DE-ZERO-2.0", + "seeAlso": [ + "https://www.govdata.de/dl-de/zero-2-0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/DOC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/DOC.json", + "referenceNumber": 646, + "name": "DOC License", + "licenseId": "DOC", + "seeAlso": [ + "http://www.cs.wustl.edu/~schmidt/ACE-copying.html", + "https://www.dre.vanderbilt.edu/~schmidt/ACE-copying.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/DocBook-Schema.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/DocBook-Schema.json", + "referenceNumber": 153, + "name": "DocBook Schema License", + "licenseId": "DocBook-Schema", + "seeAlso": [ + "https://github.com/docbook/xslt10-stylesheets/blob/efd62655c11cc8773708df7a843613fa1e932bf8/xsl/assembly/schema/docbook51b7.rnc" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/DocBook-XML.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/DocBook-XML.json", + "referenceNumber": 493, + "name": "DocBook XML License", + "licenseId": "DocBook-XML", + "seeAlso": [ + "https://github.com/docbook/xslt10-stylesheets/blob/efd62655c11cc8773708df7a843613fa1e932bf8/xsl/COPYING#L27" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Dotseqn.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Dotseqn.json", + "referenceNumber": 533, + "name": "Dotseqn License", + "licenseId": "Dotseqn", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Dotseqn" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/DRL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/DRL-1.0.json", + "referenceNumber": 410, + "name": "Detection Rule License 1.0", + "licenseId": "DRL-1.0", + "seeAlso": [ + "https://github.com/Neo23x0/sigma/blob/master/LICENSE.Detection.Rules.md" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/DRL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/DRL-1.1.json", + "referenceNumber": 268, + "name": "Detection Rule License 1.1", + "licenseId": "DRL-1.1", + "seeAlso": [ + "https://github.com/SigmaHQ/Detection-Rule-License/blob/6ec7fbde6101d101b5b5d1fcb8f9b69fbc76c04a/LICENSE.Detection.Rules.md" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/DSDP.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/DSDP.json", + "referenceNumber": 164, + "name": "DSDP License", + "licenseId": "DSDP", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/DSDP" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/dtoa.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/dtoa.json", + "referenceNumber": 263, + "name": "David M. Gay dtoa License", + "licenseId": "dtoa", + "seeAlso": [ + "https://github.com/SWI-Prolog/swipl-devel/blob/master/src/os/dtoa.c", + "https://sourceware.org/git/?p\u003dnewlib-cygwin.git;a\u003dblob;f\u003dnewlib/libc/stdlib/mprec.h;hb\u003dHEAD" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/dvipdfm.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/dvipdfm.json", + "referenceNumber": 61, + "name": "dvipdfm License", + "licenseId": "dvipdfm", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/dvipdfm" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ECL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ECL-1.0.json", + "referenceNumber": 264, + "name": "Educational Community License v1.0", + "licenseId": "ECL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/ECL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/ECL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ECL-2.0.json", + "referenceNumber": 363, + "name": "Educational Community License v2.0", + "licenseId": "ECL-2.0", + "seeAlso": [ + "https://opensource.org/licenses/ECL-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/eCos-2.0.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/eCos-2.0.json", + "referenceNumber": 298, + "name": "eCos license version 2.0", + "licenseId": "eCos-2.0", + "seeAlso": [ + "https://www.gnu.org/licenses/ecos-license.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/EFL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/EFL-1.0.json", + "referenceNumber": 137, + "name": "Eiffel Forum License v1.0", + "licenseId": "EFL-1.0", + "seeAlso": [ + "http://www.eiffel-nice.org/license/forum.txt", + "https://opensource.org/licenses/EFL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/EFL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/EFL-2.0.json", + "referenceNumber": 447, + "name": "Eiffel Forum License v2.0", + "licenseId": "EFL-2.0", + "seeAlso": [ + "http://www.eiffel-nice.org/license/eiffel-forum-license-2.html", + "https://opensource.org/licenses/EFL-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/eGenix.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/eGenix.json", + "referenceNumber": 348, + "name": "eGenix.com Public License 1.1.0", + "licenseId": "eGenix", + "seeAlso": [ + "http://www.egenix.com/products/eGenix.com-Public-License-1.1.0.pdf", + "https://fedoraproject.org/wiki/Licensing/eGenix.com_Public_License_1.1.0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Elastic-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Elastic-2.0.json", + "referenceNumber": 404, + "name": "Elastic License 2.0", + "licenseId": "Elastic-2.0", + "seeAlso": [ + "https://www.elastic.co/licensing/elastic-license", + "https://github.com/elastic/elasticsearch/blob/master/licenses/ELASTIC-LICENSE-2.0.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Entessa.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Entessa.json", + "referenceNumber": 198, + "name": "Entessa Public License v1.0", + "licenseId": "Entessa", + "seeAlso": [ + "https://opensource.org/licenses/Entessa" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/EPICS.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/EPICS.json", + "referenceNumber": 532, + "name": "EPICS Open License", + "licenseId": "EPICS", + "seeAlso": [ + "https://epics.anl.gov/license/open.php" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/EPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/EPL-1.0.json", + "referenceNumber": 115, + "name": "Eclipse Public License 1.0", + "licenseId": "EPL-1.0", + "seeAlso": [ + "http://www.eclipse.org/legal/epl-v10.html", + "https://opensource.org/licenses/EPL-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/EPL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/EPL-2.0.json", + "referenceNumber": 282, + "name": "Eclipse Public License 2.0", + "licenseId": "EPL-2.0", + "seeAlso": [ + "https://www.eclipse.org/legal/epl-2.0", + "https://www.opensource.org/licenses/EPL-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/ErlPL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ErlPL-1.1.json", + "referenceNumber": 530, + "name": "Erlang Public License v1.1", + "licenseId": "ErlPL-1.1", + "seeAlso": [ + "http://www.erlang.org/EPLICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/etalab-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/etalab-2.0.json", + "referenceNumber": 129, + "name": "Etalab Open License 2.0", + "licenseId": "etalab-2.0", + "seeAlso": [ + "https://github.com/DISIC/politique-de-contribution-open-source/blob/master/LICENSE.pdf", + "https://raw.githubusercontent.com/DISIC/politique-de-contribution-open-source/master/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/EUDatagrid.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/EUDatagrid.json", + "referenceNumber": 393, + "name": "EU DataGrid Software License", + "licenseId": "EUDatagrid", + "seeAlso": [ + "http://eu-datagrid.web.cern.ch/eu-datagrid/license.html", + "https://opensource.org/licenses/EUDatagrid" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/EUPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/EUPL-1.0.json", + "referenceNumber": 389, + "name": "European Union Public License 1.0", + "licenseId": "EUPL-1.0", + "seeAlso": [ + "http://ec.europa.eu/idabc/en/document/7330.html", + "http://ec.europa.eu/idabc/servlets/Doc027f.pdf?id\u003d31096" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/EUPL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/EUPL-1.1.json", + "referenceNumber": 503, + "name": "European Union Public License 1.1", + "licenseId": "EUPL-1.1", + "seeAlso": [ + "https://joinup.ec.europa.eu/software/page/eupl/licence-eupl", + "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl1.1.-licence-en_0.pdf", + "https://opensource.org/licenses/EUPL-1.1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/EUPL-1.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/EUPL-1.2.json", + "referenceNumber": 12, + "name": "European Union Public License 1.2", + "licenseId": "EUPL-1.2", + "seeAlso": [ + "https://joinup.ec.europa.eu/page/eupl-text-11-12", + "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/eupl_v1.2_en.pdf", + "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/2020-03/EUPL-1.2%20EN.txt", + "https://joinup.ec.europa.eu/sites/default/files/inline-files/EUPL%20v1_2%20EN(1).txt", + "http://eur-lex.europa.eu/legal-content/EN/TXT/HTML/?uri\u003dCELEX:32017D0863", + "https://opensource.org/licenses/EUPL-1.2" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Eurosym.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Eurosym.json", + "referenceNumber": 621, + "name": "Eurosym License", + "licenseId": "Eurosym", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Eurosym" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Fair.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Fair.json", + "referenceNumber": 258, + "name": "Fair License", + "licenseId": "Fair", + "seeAlso": [ + "https://web.archive.org/web/20150926120323/http://fairlicense.org/", + "https://opensource.org/licenses/Fair" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/FBM.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FBM.json", + "referenceNumber": 626, + "name": "Fuzzy Bitmap License", + "licenseId": "FBM", + "seeAlso": [ + "https://github.com/SWI-Prolog/packages-xpce/blob/161a40cd82004f731ba48024f9d30af388a7edf5/src/img/gifwrite.c#L21-L26" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/FDK-AAC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FDK-AAC.json", + "referenceNumber": 344, + "name": "Fraunhofer FDK AAC Codec Library", + "licenseId": "FDK-AAC", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/FDK-AAC", + "https://directory.fsf.org/wiki/License:Fdk" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Ferguson-Twofish.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Ferguson-Twofish.json", + "referenceNumber": 362, + "name": "Ferguson Twofish License", + "licenseId": "Ferguson-Twofish", + "seeAlso": [ + "https://github.com/wernerd/ZRTPCPP/blob/6b3cd8e6783642292bad0c21e3e5e5ce45ff3e03/cryptcommon/twofish.c#L113C3-L127" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Frameworx-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Frameworx-1.0.json", + "referenceNumber": 188, + "name": "Frameworx Open License 1.0", + "licenseId": "Frameworx-1.0", + "seeAlso": [ + "https://opensource.org/licenses/Frameworx-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/FreeBSD-DOC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FreeBSD-DOC.json", + "referenceNumber": 151, + "name": "FreeBSD Documentation License", + "licenseId": "FreeBSD-DOC", + "seeAlso": [ + "https://www.freebsd.org/copyright/freebsd-doc-license/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/FreeImage.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FreeImage.json", + "referenceNumber": 232, + "name": "FreeImage Public License v1.0", + "licenseId": "FreeImage", + "seeAlso": [ + "http://freeimage.sourceforge.net/freeimage-license.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/FSFAP.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FSFAP.json", + "referenceNumber": 436, + "name": "FSF All Permissive License", + "licenseId": "FSFAP", + "seeAlso": [ + "https://www.gnu.org/prep/maintain/html_node/License-Notices-for-Other-Files.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/FSFAP-no-warranty-disclaimer.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FSFAP-no-warranty-disclaimer.json", + "referenceNumber": 547, + "name": "FSF All Permissive License (without Warranty)", + "licenseId": "FSFAP-no-warranty-disclaimer", + "seeAlso": [ + "https://git.savannah.gnu.org/cgit/wget.git/tree/util/trunc.c?h\u003dv1.21.3\u0026id\u003d40747a11e44ced5a8ac628a41f879ced3e2ebce9#n6" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/FSFUL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FSFUL.json", + "referenceNumber": 2, + "name": "FSF Unlimited License", + "licenseId": "FSFUL", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/FSFULLR.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FSFULLR.json", + "referenceNumber": 508, + "name": "FSF Unlimited License (with License Retention)", + "licenseId": "FSFULLR", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/FSF_Unlimited_License#License_Retention_Variant" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/FSFULLRWD.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FSFULLRWD.json", + "referenceNumber": 640, + "name": "FSF Unlimited License (With License Retention and Warranty Disclaimer)", + "licenseId": "FSFULLRWD", + "seeAlso": [ + "https://lists.gnu.org/archive/html/autoconf/2012-04/msg00061.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/FTL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/FTL.json", + "referenceNumber": 249, + "name": "Freetype Project License", + "licenseId": "FTL", + "seeAlso": [ + "http://freetype.fis.uniroma2.it/FTL.TXT", + "http://git.savannah.gnu.org/cgit/freetype/freetype2.git/tree/docs/FTL.TXT", + "http://gitlab.freedesktop.org/freetype/freetype/-/raw/master/docs/FTL.TXT" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Furuseth.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Furuseth.json", + "referenceNumber": 273, + "name": "Furuseth License", + "licenseId": "Furuseth", + "seeAlso": [ + "https://git.openldap.org/openldap/openldap/-/blob/master/COPYRIGHT?ref_type\u003dheads#L39-51" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/fwlw.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/fwlw.json", + "referenceNumber": 50, + "name": "fwlw License", + "licenseId": "fwlw", + "seeAlso": [ + "https://mirrors.nic.cz/tex-archive/macros/latex/contrib/fwlw/README" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GCR-docs.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GCR-docs.json", + "referenceNumber": 272, + "name": "Gnome GCR Documentation License", + "licenseId": "GCR-docs", + "seeAlso": [ + "https://github.com/GNOME/gcr/blob/master/docs/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GD.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GD.json", + "referenceNumber": 624, + "name": "GD License", + "licenseId": "GD", + "seeAlso": [ + "https://libgd.github.io/manuals/2.3.0/files/license-txt.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.1.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.1.json", + "referenceNumber": 177, + "name": "GNU Free Documentation License v1.1", + "licenseId": "GFDL-1.1", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.1-invariants-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.1-invariants-only.json", + "referenceNumber": 216, + "name": "GNU Free Documentation License v1.1 only - invariants", + "licenseId": "GFDL-1.1-invariants-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.1-invariants-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.1-invariants-or-later.json", + "referenceNumber": 57, + "name": "GNU Free Documentation License v1.1 or later - invariants", + "licenseId": "GFDL-1.1-invariants-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.1-no-invariants-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.1-no-invariants-only.json", + "referenceNumber": 38, + "name": "GNU Free Documentation License v1.1 only - no invariants", + "licenseId": "GFDL-1.1-no-invariants-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.1-no-invariants-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.1-no-invariants-or-later.json", + "referenceNumber": 289, + "name": "GNU Free Documentation License v1.1 or later - no invariants", + "licenseId": "GFDL-1.1-no-invariants-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.1-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.1-only.json", + "referenceNumber": 654, + "name": "GNU Free Documentation License v1.1 only", + "licenseId": "GFDL-1.1-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.1-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.1-or-later.json", + "referenceNumber": 569, + "name": "GNU Free Documentation License v1.1 or later", + "licenseId": "GFDL-1.1-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.1.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.2.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.2.json", + "referenceNumber": 235, + "name": "GNU Free Documentation License v1.2", + "licenseId": "GFDL-1.2", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.2-invariants-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.2-invariants-only.json", + "referenceNumber": 461, + "name": "GNU Free Documentation License v1.2 only - invariants", + "licenseId": "GFDL-1.2-invariants-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.2-invariants-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.2-invariants-or-later.json", + "referenceNumber": 391, + "name": "GNU Free Documentation License v1.2 or later - invariants", + "licenseId": "GFDL-1.2-invariants-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.2-no-invariants-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.2-no-invariants-only.json", + "referenceNumber": 187, + "name": "GNU Free Documentation License v1.2 only - no invariants", + "licenseId": "GFDL-1.2-no-invariants-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.2-no-invariants-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.2-no-invariants-or-later.json", + "referenceNumber": 240, + "name": "GNU Free Documentation License v1.2 or later - no invariants", + "licenseId": "GFDL-1.2-no-invariants-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.2-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.2-only.json", + "referenceNumber": 302, + "name": "GNU Free Documentation License v1.2 only", + "licenseId": "GFDL-1.2-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.2-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.2-or-later.json", + "referenceNumber": 562, + "name": "GNU Free Documentation License v1.2 or later", + "licenseId": "GFDL-1.2-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/fdl-1.2.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.3.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.3.json", + "referenceNumber": 60, + "name": "GNU Free Documentation License v1.3", + "licenseId": "GFDL-1.3", + "seeAlso": [ + "https://www.gnu.org/licenses/fdl-1.3.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.3-invariants-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.3-invariants-only.json", + "referenceNumber": 184, + "name": "GNU Free Documentation License v1.3 only - invariants", + "licenseId": "GFDL-1.3-invariants-only", + "seeAlso": [ + "https://www.gnu.org/licenses/fdl-1.3.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.3-invariants-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.3-invariants-or-later.json", + "referenceNumber": 346, + "name": "GNU Free Documentation License v1.3 or later - invariants", + "licenseId": "GFDL-1.3-invariants-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/fdl-1.3.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.3-no-invariants-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.3-no-invariants-only.json", + "referenceNumber": 59, + "name": "GNU Free Documentation License v1.3 only - no invariants", + "licenseId": "GFDL-1.3-no-invariants-only", + "seeAlso": [ + "https://www.gnu.org/licenses/fdl-1.3.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.3-no-invariants-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.3-no-invariants-or-later.json", + "referenceNumber": 281, + "name": "GNU Free Documentation License v1.3 or later - no invariants", + "licenseId": "GFDL-1.3-no-invariants-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/fdl-1.3.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.3-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.3-only.json", + "referenceNumber": 642, + "name": "GNU Free Documentation License v1.3 only", + "licenseId": "GFDL-1.3-only", + "seeAlso": [ + "https://www.gnu.org/licenses/fdl-1.3.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GFDL-1.3-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GFDL-1.3-or-later.json", + "referenceNumber": 494, + "name": "GNU Free Documentation License v1.3 or later", + "licenseId": "GFDL-1.3-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/fdl-1.3.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Giftware.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Giftware.json", + "referenceNumber": 618, + "name": "Giftware License", + "licenseId": "Giftware", + "seeAlso": [ + "http://liballeg.org/license.html#allegro-4-the-giftware-license" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GL2PS.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GL2PS.json", + "referenceNumber": 231, + "name": "GL2PS License", + "licenseId": "GL2PS", + "seeAlso": [ + "http://www.geuz.org/gl2ps/COPYING.GL2PS" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Glide.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Glide.json", + "referenceNumber": 620, + "name": "3dfx Glide License", + "licenseId": "Glide", + "seeAlso": [ + "http://www.users.on.net/~triforce/glidexp/COPYING.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Glulxe.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Glulxe.json", + "referenceNumber": 429, + "name": "Glulxe License", + "licenseId": "Glulxe", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Glulxe" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GLWTPL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GLWTPL.json", + "referenceNumber": 154, + "name": "Good Luck With That Public License", + "licenseId": "GLWTPL", + "seeAlso": [ + "https://github.com/me-shaon/GLWTPL/commit/da5f6bc734095efbacb442c0b31e33a65b9d6e85" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/gnuplot.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/gnuplot.json", + "referenceNumber": 271, + "name": "gnuplot License", + "licenseId": "gnuplot", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Gnuplot" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GPL-1.0.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-1.0.json", + "referenceNumber": 365, + "name": "GNU General Public License v1.0 only", + "licenseId": "GPL-1.0", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-1.0+.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-1.0+.json", + "referenceNumber": 66, + "name": "GNU General Public License v1.0 or later", + "licenseId": "GPL-1.0+", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-1.0-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GPL-1.0-only.json", + "referenceNumber": 563, + "name": "GNU General Public License v1.0 only", + "licenseId": "GPL-1.0-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-1.0-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GPL-1.0-or-later.json", + "referenceNumber": 558, + "name": "GNU General Public License v1.0 or later", + "licenseId": "GPL-1.0-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/gpl-1.0-standalone.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-2.0.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-2.0.json", + "referenceNumber": 613, + "name": "GNU General Public License v2.0 only", + "licenseId": "GPL-2.0", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", + "https://opensource.org/licenses/GPL-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GPL-2.0+.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-2.0+.json", + "referenceNumber": 83, + "name": "GNU General Public License v2.0 or later", + "licenseId": "GPL-2.0+", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", + "https://opensource.org/licenses/GPL-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GPL-2.0-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GPL-2.0-only.json", + "referenceNumber": 483, + "name": "GNU General Public License v2.0 only", + "licenseId": "GPL-2.0-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", + "https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt", + "https://opensource.org/licenses/GPL-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GPL-2.0-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GPL-2.0-or-later.json", + "referenceNumber": 349, + "name": "GNU General Public License v2.0 or later", + "licenseId": "GPL-2.0-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html", + "https://opensource.org/licenses/GPL-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GPL-2.0-with-autoconf-exception.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-2.0-with-autoconf-exception.json", + "referenceNumber": 475, + "name": "GNU General Public License v2.0 w/Autoconf exception", + "licenseId": "GPL-2.0-with-autoconf-exception", + "seeAlso": [ + "http://ac-archive.sourceforge.net/doc/copyright.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-2.0-with-bison-exception.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-2.0-with-bison-exception.json", + "referenceNumber": 492, + "name": "GNU General Public License v2.0 w/Bison exception", + "licenseId": "GPL-2.0-with-bison-exception", + "seeAlso": [ + "http://git.savannah.gnu.org/cgit/bison.git/tree/data/yacc.c?id\u003d193d7c7054ba7197b0789e14965b739162319b5e#n141" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-2.0-with-classpath-exception.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-2.0-with-classpath-exception.json", + "referenceNumber": 144, + "name": "GNU General Public License v2.0 w/Classpath exception", + "licenseId": "GPL-2.0-with-classpath-exception", + "seeAlso": [ + "https://www.gnu.org/software/classpath/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-2.0-with-font-exception.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-2.0-with-font-exception.json", + "referenceNumber": 579, + "name": "GNU General Public License v2.0 w/Font exception", + "licenseId": "GPL-2.0-with-font-exception", + "seeAlso": [ + "https://www.gnu.org/licenses/gpl-faq.html#FontException" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-2.0-with-GCC-exception.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-2.0-with-GCC-exception.json", + "referenceNumber": 449, + "name": "GNU General Public License v2.0 w/GCC Runtime Library exception", + "licenseId": "GPL-2.0-with-GCC-exception", + "seeAlso": [ + "https://gcc.gnu.org/git/?p\u003dgcc.git;a\u003dblob;f\u003dgcc/libgcc1.c;h\u003d762f5143fc6eed57b6797c82710f3538aa52b40b;hb\u003dcb143a3ce4fb417c68f5fa2691a1b1b1053dfba9#l10" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-3.0.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-3.0.json", + "referenceNumber": 434, + "name": "GNU General Public License v3.0 only", + "licenseId": "GPL-3.0", + "seeAlso": [ + "https://www.gnu.org/licenses/gpl-3.0-standalone.html", + "https://opensource.org/licenses/GPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GPL-3.0+.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-3.0+.json", + "referenceNumber": 586, + "name": "GNU General Public License v3.0 or later", + "licenseId": "GPL-3.0+", + "seeAlso": [ + "https://www.gnu.org/licenses/gpl-3.0-standalone.html", + "https://opensource.org/licenses/GPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GPL-3.0-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GPL-3.0-only.json", + "referenceNumber": 42, + "name": "GNU General Public License v3.0 only", + "licenseId": "GPL-3.0-only", + "seeAlso": [ + "https://www.gnu.org/licenses/gpl-3.0-standalone.html", + "https://opensource.org/licenses/GPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GPL-3.0-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/GPL-3.0-or-later.json", + "referenceNumber": 269, + "name": "GNU General Public License v3.0 or later", + "licenseId": "GPL-3.0-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/gpl-3.0-standalone.html", + "https://opensource.org/licenses/GPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/GPL-3.0-with-autoconf-exception.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-3.0-with-autoconf-exception.json", + "referenceNumber": 200, + "name": "GNU General Public License v3.0 w/Autoconf exception", + "licenseId": "GPL-3.0-with-autoconf-exception", + "seeAlso": [ + "https://www.gnu.org/licenses/autoconf-exception-3.0.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/GPL-3.0-with-GCC-exception.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/GPL-3.0-with-GCC-exception.json", + "referenceNumber": 546, + "name": "GNU General Public License v3.0 w/GCC Runtime Library exception", + "licenseId": "GPL-3.0-with-GCC-exception", + "seeAlso": [ + "https://www.gnu.org/licenses/gcc-exception-3.1.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Graphics-Gems.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Graphics-Gems.json", + "referenceNumber": 437, + "name": "Graphics Gems License", + "licenseId": "Graphics-Gems", + "seeAlso": [ + "https://github.com/erich666/GraphicsGems/blob/master/LICENSE.md" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/gSOAP-1.3b.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/gSOAP-1.3b.json", + "referenceNumber": 658, + "name": "gSOAP Public License v1.3b", + "licenseId": "gSOAP-1.3b", + "seeAlso": [ + "http://www.cs.fsu.edu/~engelen/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/gtkbook.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/gtkbook.json", + "referenceNumber": 397, + "name": "gtkbook License", + "licenseId": "gtkbook", + "seeAlso": [ + "https://github.com/slogan621/gtkbook", + "https://github.com/oetiker/rrdtool-1.x/blob/master/src/plbasename.c#L8-L11" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Gutmann.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Gutmann.json", + "referenceNumber": 103, + "name": "Gutmann License", + "licenseId": "Gutmann", + "seeAlso": [ + "https://www.cs.auckland.ac.nz/~pgut001/dumpasn1.c" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HaskellReport.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HaskellReport.json", + "referenceNumber": 357, + "name": "Haskell Language Report License", + "licenseId": "HaskellReport", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Haskell_Language_Report_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/hdparm.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/hdparm.json", + "referenceNumber": 351, + "name": "hdparm License", + "licenseId": "hdparm", + "seeAlso": [ + "https://github.com/Distrotech/hdparm/blob/4517550db29a91420fb2b020349523b1b4512df2/LICENSE.TXT" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HIDAPI.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HIDAPI.json", + "referenceNumber": 318, + "name": "HIDAPI License", + "licenseId": "HIDAPI", + "seeAlso": [ + "https://github.com/signal11/hidapi/blob/master/LICENSE-orig.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Hippocratic-2.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Hippocratic-2.1.json", + "referenceNumber": 425, + "name": "Hippocratic License 2.1", + "licenseId": "Hippocratic-2.1", + "seeAlso": [ + "https://firstdonoharm.dev/version/2/1/license.html", + "https://github.com/EthicalSource/hippocratic-license/blob/58c0e646d64ff6fbee275bfe2b9492f914e3ab2a/LICENSE.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HP-1986.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HP-1986.json", + "referenceNumber": 477, + "name": "Hewlett-Packard 1986 License", + "licenseId": "HP-1986", + "seeAlso": [ + "https://sourceware.org/git/?p\u003dnewlib-cygwin.git;a\u003dblob;f\u003dnewlib/libc/machine/hppa/memchr.S;h\u003d1cca3e5e8867aa4bffef1f75a5c1bba25c0c441e;hb\u003dHEAD#l2" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HP-1989.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HP-1989.json", + "referenceNumber": 653, + "name": "Hewlett-Packard 1989 License", + "licenseId": "HP-1989", + "seeAlso": [ + "https://github.com/bleargh45/Data-UUID/blob/master/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND.json", + "referenceNumber": 75, + "name": "Historical Permission Notice and Disclaimer", + "licenseId": "HPND", + "seeAlso": [ + "https://opensource.org/licenses/HPND", + "http://lists.opensource.org/pipermail/license-discuss_lists.opensource.org/2002-November/006304.html" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/HPND-DEC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-DEC.json", + "referenceNumber": 597, + "name": "Historical Permission Notice and Disclaimer - DEC variant", + "licenseId": "HPND-DEC", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/app/xkbcomp/-/blob/master/COPYING?ref_type\u003dheads#L69" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-doc.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-doc.json", + "referenceNumber": 384, + "name": "Historical Permission Notice and Disclaimer - documentation variant", + "licenseId": "HPND-doc", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/lib/libxext/-/blob/master/COPYING?ref_type\u003dheads#L185-197", + "https://gitlab.freedesktop.org/xorg/lib/libxtst/-/blob/master/COPYING?ref_type\u003dheads#L70-77" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-doc-sell.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-doc-sell.json", + "referenceNumber": 648, + "name": "Historical Permission Notice and Disclaimer - documentation sell variant", + "licenseId": "HPND-doc-sell", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/lib/libxtst/-/blob/master/COPYING?ref_type\u003dheads#L108-117", + "https://gitlab.freedesktop.org/xorg/lib/libxext/-/blob/master/COPYING?ref_type\u003dheads#L153-162" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-export-US.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-export-US.json", + "referenceNumber": 551, + "name": "HPND with US Government export control warning", + "licenseId": "HPND-export-US", + "seeAlso": [ + "https://www.kermitproject.org/ck90.html#source" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-export-US-acknowledgement.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-export-US-acknowledgement.json", + "referenceNumber": 661, + "name": "HPND with US Government export control warning and acknowledgment", + "licenseId": "HPND-export-US-acknowledgement", + "seeAlso": [ + "https://github.com/krb5/krb5/blob/krb5-1.21.2-final/NOTICE#L831-L852", + "https://web.mit.edu/kerberos/krb5-1.21/doc/mitK5license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-export-US-modify.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-export-US-modify.json", + "referenceNumber": 119, + "name": "HPND with US Government export control warning and modification rqmt", + "licenseId": "HPND-export-US-modify", + "seeAlso": [ + "https://github.com/krb5/krb5/blob/krb5-1.21.2-final/NOTICE#L1157-L1182", + "https://github.com/pythongssapi/k5test/blob/v0.10.3/K5TEST-LICENSE.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-export2-US.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-export2-US.json", + "referenceNumber": 450, + "name": "HPND with US Government export control and 2 disclaimers", + "licenseId": "HPND-export2-US", + "seeAlso": [ + "https://github.com/krb5/krb5/blob/krb5-1.21.2-final/NOTICE#L111-L133", + "https://web.mit.edu/kerberos/krb5-1.21/doc/mitK5license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-Fenneberg-Livingston.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-Fenneberg-Livingston.json", + "referenceNumber": 643, + "name": "Historical Permission Notice and Disclaimer - Fenneberg-Livingston variant", + "licenseId": "HPND-Fenneberg-Livingston", + "seeAlso": [ + "https://github.com/FreeRADIUS/freeradius-client/blob/master/COPYRIGHT#L32", + "https://github.com/radcli/radcli/blob/master/COPYRIGHT#L34" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-INRIA-IMAG.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-INRIA-IMAG.json", + "referenceNumber": 583, + "name": "Historical Permission Notice and Disclaimer - INRIA-IMAG variant", + "licenseId": "HPND-INRIA-IMAG", + "seeAlso": [ + "https://github.com/ppp-project/ppp/blob/master/pppd/ipv6cp.c#L75-L83" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-Intel.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-Intel.json", + "referenceNumber": 20, + "name": "Historical Permission Notice and Disclaimer - Intel variant", + "licenseId": "HPND-Intel", + "seeAlso": [ + "https://sourceware.org/git/?p\u003dnewlib-cygwin.git;a\u003dblob;f\u003dnewlib/libc/machine/i960/memcpy.S;hb\u003dHEAD" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-Kevlin-Henney.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-Kevlin-Henney.json", + "referenceNumber": 637, + "name": "Historical Permission Notice and Disclaimer - Kevlin Henney variant", + "licenseId": "HPND-Kevlin-Henney", + "seeAlso": [ + "https://github.com/mruby/mruby/blob/83d12f8d52522cdb7c8cc46fad34821359f453e6/mrbgems/mruby-dir/src/Win/dirent.c#L127-L140" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-Markus-Kuhn.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-Markus-Kuhn.json", + "referenceNumber": 172, + "name": "Historical Permission Notice and Disclaimer - Markus Kuhn variant", + "licenseId": "HPND-Markus-Kuhn", + "seeAlso": [ + "https://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c", + "https://sourceware.org/git/?p\u003dbinutils-gdb.git;a\u003dblob;f\u003dreadline/readline/support/wcwidth.c;h\u003d0f5ec995796f4813abbcf4972aec0378ab74722a;hb\u003dHEAD#l55" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-merchantability-variant.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-merchantability-variant.json", + "referenceNumber": 572, + "name": "Historical Permission Notice and Disclaimer - merchantability variant", + "licenseId": "HPND-merchantability-variant", + "seeAlso": [ + "https://sourceware.org/git/?p\u003dnewlib-cygwin.git;a\u003dblob;f\u003dnewlib/libc/misc/fini.c;hb\u003dHEAD" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-MIT-disclaimer.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-MIT-disclaimer.json", + "referenceNumber": 609, + "name": "Historical Permission Notice and Disclaimer with MIT disclaimer", + "licenseId": "HPND-MIT-disclaimer", + "seeAlso": [ + "https://metacpan.org/release/NLNETLABS/Net-DNS-SEC-1.22/source/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-Netrek.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-Netrek.json", + "referenceNumber": 126, + "name": "Historical Permission Notice and Disclaimer - Netrek variant", + "licenseId": "HPND-Netrek", + "seeAlso": [], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-Pbmplus.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-Pbmplus.json", + "referenceNumber": 242, + "name": "Historical Permission Notice and Disclaimer - Pbmplus variant", + "licenseId": "HPND-Pbmplus", + "seeAlso": [ + "https://sourceforge.net/p/netpbm/code/HEAD/tree/super_stable/netpbm.c#l8" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-sell-MIT-disclaimer-xserver.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-sell-MIT-disclaimer-xserver.json", + "referenceNumber": 160, + "name": "Historical Permission Notice and Disclaimer - sell xserver variant with MIT disclaimer", + "licenseId": "HPND-sell-MIT-disclaimer-xserver", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/xserver/-/blob/master/COPYING?ref_type\u003dheads#L1781" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-sell-regexpr.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-sell-regexpr.json", + "referenceNumber": 44, + "name": "Historical Permission Notice and Disclaimer - sell regexpr variant", + "licenseId": "HPND-sell-regexpr", + "seeAlso": [ + "https://gitlab.com/bacula-org/bacula/-/blob/Branch-11.0/bacula/LICENSE-FOSS?ref_type\u003dheads#L245" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-sell-variant.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-sell-variant.json", + "referenceNumber": 485, + "name": "Historical Permission Notice and Disclaimer - sell variant", + "licenseId": "HPND-sell-variant", + "seeAlso": [ + "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/net/sunrpc/auth_gss/gss_generic_token.c?h\u003dv4.19" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-sell-variant-MIT-disclaimer.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-sell-variant-MIT-disclaimer.json", + "referenceNumber": 430, + "name": "HPND sell variant with MIT disclaimer", + "licenseId": "HPND-sell-variant-MIT-disclaimer", + "seeAlso": [ + "https://github.com/sigmavirus24/x11-ssh-askpass/blob/master/README" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-sell-variant-MIT-disclaimer-rev.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-sell-variant-MIT-disclaimer-rev.json", + "referenceNumber": 10, + "name": "HPND sell variant with MIT disclaimer - reverse", + "licenseId": "HPND-sell-variant-MIT-disclaimer-rev", + "seeAlso": [ + "https://github.com/sigmavirus24/x11-ssh-askpass/blob/master/dynlist.c" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-UC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-UC.json", + "referenceNumber": 423, + "name": "Historical Permission Notice and Disclaimer - University of California variant", + "licenseId": "HPND-UC", + "seeAlso": [ + "https://core.tcl-lang.org/tk/file?name\u003dcompat/unistd.h" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HPND-UC-export-US.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HPND-UC-export-US.json", + "referenceNumber": 82, + "name": "Historical Permission Notice and Disclaimer - University of California, US export warning", + "licenseId": "HPND-UC-export-US", + "seeAlso": [ + "https://github.com/RTimothyEdwards/magic/blob/master/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/HTMLTIDY.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/HTMLTIDY.json", + "referenceNumber": 439, + "name": "HTML Tidy License", + "licenseId": "HTMLTIDY", + "seeAlso": [ + "https://github.com/htacg/tidy-html5/blob/next/README/LICENSE.md" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/IBM-pibs.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/IBM-pibs.json", + "referenceNumber": 604, + "name": "IBM PowerPC Initialization and Boot Software", + "licenseId": "IBM-pibs", + "seeAlso": [ + "http://git.denx.de/?p\u003du-boot.git;a\u003dblob;f\u003darch/powerpc/cpu/ppc4xx/miiphy.c;h\u003d297155fdafa064b955e53e9832de93bfb0cfb85b;hb\u003d9fab4bf4cc077c21e43941866f3f2c196f28670d" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ICU.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ICU.json", + "referenceNumber": 375, + "name": "ICU License", + "licenseId": "ICU", + "seeAlso": [ + "http://source.icu-project.org/repos/icu/icu/trunk/license.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/IEC-Code-Components-EULA.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/IEC-Code-Components-EULA.json", + "referenceNumber": 18, + "name": "IEC Code Components End-user licence agreement", + "licenseId": "IEC-Code-Components-EULA", + "seeAlso": [ + "https://www.iec.ch/webstore/custserv/pdf/CC-EULA.pdf", + "https://www.iec.ch/CCv1", + "https://www.iec.ch/copyright" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/IJG.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/IJG.json", + "referenceNumber": 374, + "name": "Independent JPEG Group License", + "licenseId": "IJG", + "seeAlso": [ + "http://dev.w3.org/cvsweb/Amaya/libjpeg/Attic/README?rev\u003d1.2" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/IJG-short.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/IJG-short.json", + "referenceNumber": 152, + "name": "Independent JPEG Group License - short", + "licenseId": "IJG-short", + "seeAlso": [ + "https://sourceforge.net/p/xmedcon/code/ci/master/tree/libs/ljpg/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ImageMagick.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ImageMagick.json", + "referenceNumber": 608, + "name": "ImageMagick License", + "licenseId": "ImageMagick", + "seeAlso": [ + "http://www.imagemagick.org/script/license.php" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/iMatix.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/iMatix.json", + "referenceNumber": 645, + "name": "iMatix Standard Function Library Agreement", + "licenseId": "iMatix", + "seeAlso": [ + "http://legacy.imatix.com/html/sfl/sfl4.htm#license" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Imlib2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Imlib2.json", + "referenceNumber": 96, + "name": "Imlib2 License", + "licenseId": "Imlib2", + "seeAlso": [ + "http://trac.enlightenment.org/e/browser/trunk/imlib2/COPYING", + "https://git.enlightenment.org/legacy/imlib2.git/tree/COPYING" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Info-ZIP.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Info-ZIP.json", + "referenceNumber": 451, + "name": "Info-ZIP License", + "licenseId": "Info-ZIP", + "seeAlso": [ + "http://www.info-zip.org/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Inner-Net-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Inner-Net-2.0.json", + "referenceNumber": 58, + "name": "Inner Net License v2.0", + "licenseId": "Inner-Net-2.0", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Inner_Net_License", + "https://sourceware.org/git/?p\u003dglibc.git;a\u003dblob;f\u003dLICENSES;h\u003d530893b1dc9ea00755603c68fb36bd4fc38a7be8;hb\u003dHEAD#l207" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Intel.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Intel.json", + "referenceNumber": 316, + "name": "Intel Open Source License", + "licenseId": "Intel", + "seeAlso": [ + "https://opensource.org/licenses/Intel" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Intel-ACPI.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Intel-ACPI.json", + "referenceNumber": 309, + "name": "Intel ACPI Software License Agreement", + "licenseId": "Intel-ACPI", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Intel_ACPI_Software_License_Agreement" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Interbase-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Interbase-1.0.json", + "referenceNumber": 665, + "name": "Interbase Public License v1.0", + "licenseId": "Interbase-1.0", + "seeAlso": [ + "https://web.archive.org/web/20060319014854/http://info.borland.com/devsupport/interbase/opensource/IPL.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/IPA.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/IPA.json", + "referenceNumber": 237, + "name": "IPA Font License", + "licenseId": "IPA", + "seeAlso": [ + "https://opensource.org/licenses/IPA" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/IPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/IPL-1.0.json", + "referenceNumber": 443, + "name": "IBM Public License v1.0", + "licenseId": "IPL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/IPL-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/ISC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ISC.json", + "referenceNumber": 131, + "name": "ISC License", + "licenseId": "ISC", + "seeAlso": [ + "https://www.isc.org/licenses/", + "https://www.isc.org/downloads/software-support-policy/isc-license/", + "https://opensource.org/licenses/ISC" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/ISC-Veillard.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ISC-Veillard.json", + "referenceNumber": 554, + "name": "ISC Veillard variant", + "licenseId": "ISC-Veillard", + "seeAlso": [ + "https://raw.githubusercontent.com/GNOME/libxml2/4c2e7c651f6c2f0d1a74f350cbda95f7df3e7017/hash.c", + "https://github.com/GNOME/libxml2/blob/master/dict.c", + "https://sourceforge.net/p/ctrio/git/ci/master/tree/README" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Jam.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Jam.json", + "referenceNumber": 338, + "name": "Jam License", + "licenseId": "Jam", + "seeAlso": [ + "https://www.boost.org/doc/libs/1_35_0/doc/html/jam.html", + "https://web.archive.org/web/20160330173339/https://swarm.workshop.perforce.com/files/guest/perforce_software/jam/src/README" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/JasPer-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/JasPer-2.0.json", + "referenceNumber": 591, + "name": "JasPer License", + "licenseId": "JasPer-2.0", + "seeAlso": [ + "http://www.ece.uvic.ca/~mdadams/jasper/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/JPL-image.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/JPL-image.json", + "referenceNumber": 343, + "name": "JPL Image Use Policy", + "licenseId": "JPL-image", + "seeAlso": [ + "https://www.jpl.nasa.gov/jpl-image-use-policy" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/JPNIC.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/JPNIC.json", + "referenceNumber": 117, + "name": "Japan Network Information Center License", + "licenseId": "JPNIC", + "seeAlso": [ + "https://gitlab.isc.org/isc-projects/bind9/blob/master/COPYRIGHT#L366" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/JSON.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/JSON.json", + "referenceNumber": 174, + "name": "JSON License", + "licenseId": "JSON", + "seeAlso": [ + "http://www.json.org/license.html" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/Kastrup.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Kastrup.json", + "referenceNumber": 181, + "name": "Kastrup License", + "licenseId": "Kastrup", + "seeAlso": [ + "https://ctan.math.utah.edu/ctan/tex-archive/macros/generic/kastrup/binhex.dtx" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Kazlib.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Kazlib.json", + "referenceNumber": 197, + "name": "Kazlib License", + "licenseId": "Kazlib", + "seeAlso": [ + "http://git.savannah.gnu.org/cgit/kazlib.git/tree/except.c?id\u003d0062df360c2d17d57f6af19b0e444c51feb99036" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Knuth-CTAN.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Knuth-CTAN.json", + "referenceNumber": 22, + "name": "Knuth CTAN License", + "licenseId": "Knuth-CTAN", + "seeAlso": [ + "https://ctan.org/license/knuth" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LAL-1.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LAL-1.2.json", + "referenceNumber": 261, + "name": "Licence Art Libre 1.2", + "licenseId": "LAL-1.2", + "seeAlso": [ + "http://artlibre.org/licence/lal/licence-art-libre-12/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LAL-1.3.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LAL-1.3.json", + "referenceNumber": 526, + "name": "Licence Art Libre 1.3", + "licenseId": "LAL-1.3", + "seeAlso": [ + "https://artlibre.org/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Latex2e.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Latex2e.json", + "referenceNumber": 3, + "name": "Latex2e License", + "licenseId": "Latex2e", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Latex2e" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Latex2e-translated-notice.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Latex2e-translated-notice.json", + "referenceNumber": 104, + "name": "Latex2e with translated notice permission", + "licenseId": "Latex2e-translated-notice", + "seeAlso": [ + "https://git.savannah.gnu.org/cgit/indent.git/tree/doc/indent.texi?id\u003da74c6b4ee49397cf330b333da1042bffa60ed14f#n74" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Leptonica.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Leptonica.json", + "referenceNumber": 221, + "name": "Leptonica License", + "licenseId": "Leptonica", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Leptonica" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LGPL-2.0.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/LGPL-2.0.json", + "referenceNumber": 81, + "name": "GNU Library General Public License v2 only", + "licenseId": "LGPL-2.0", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-2.0+.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/LGPL-2.0+.json", + "referenceNumber": 265, + "name": "GNU Library General Public License v2 or later", + "licenseId": "LGPL-2.0+", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-2.0-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LGPL-2.0-only.json", + "referenceNumber": 517, + "name": "GNU Library General Public License v2 only", + "licenseId": "LGPL-2.0-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-2.0-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LGPL-2.0-or-later.json", + "referenceNumber": 458, + "name": "GNU Library General Public License v2 or later", + "licenseId": "LGPL-2.0-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/lgpl-2.0-standalone.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-2.1.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/LGPL-2.1.json", + "referenceNumber": 659, + "name": "GNU Lesser General Public License v2.1 only", + "licenseId": "LGPL-2.1", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", + "https://opensource.org/licenses/LGPL-2.1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-2.1+.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/LGPL-2.1+.json", + "referenceNumber": 69, + "name": "GNU Lesser General Public License v2.1 or later", + "licenseId": "LGPL-2.1+", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", + "https://opensource.org/licenses/LGPL-2.1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-2.1-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LGPL-2.1-only.json", + "referenceNumber": 524, + "name": "GNU Lesser General Public License v2.1 only", + "licenseId": "LGPL-2.1-only", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", + "https://opensource.org/licenses/LGPL-2.1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-2.1-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LGPL-2.1-or-later.json", + "referenceNumber": 336, + "name": "GNU Lesser General Public License v2.1 or later", + "licenseId": "LGPL-2.1-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/old-licenses/lgpl-2.1-standalone.html", + "https://opensource.org/licenses/LGPL-2.1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-3.0.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/LGPL-3.0.json", + "referenceNumber": 381, + "name": "GNU Lesser General Public License v3.0 only", + "licenseId": "LGPL-3.0", + "seeAlso": [ + "https://www.gnu.org/licenses/lgpl-3.0-standalone.html", + "https://www.gnu.org/licenses/lgpl+gpl-3.0.txt", + "https://opensource.org/licenses/LGPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-3.0+.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/LGPL-3.0+.json", + "referenceNumber": 303, + "name": "GNU Lesser General Public License v3.0 or later", + "licenseId": "LGPL-3.0+", + "seeAlso": [ + "https://www.gnu.org/licenses/lgpl-3.0-standalone.html", + "https://www.gnu.org/licenses/lgpl+gpl-3.0.txt", + "https://opensource.org/licenses/LGPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-3.0-only.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LGPL-3.0-only.json", + "referenceNumber": 225, + "name": "GNU Lesser General Public License v3.0 only", + "licenseId": "LGPL-3.0-only", + "seeAlso": [ + "https://www.gnu.org/licenses/lgpl-3.0-standalone.html", + "https://www.gnu.org/licenses/lgpl+gpl-3.0.txt", + "https://opensource.org/licenses/LGPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LGPL-3.0-or-later.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LGPL-3.0-or-later.json", + "referenceNumber": 411, + "name": "GNU Lesser General Public License v3.0 or later", + "licenseId": "LGPL-3.0-or-later", + "seeAlso": [ + "https://www.gnu.org/licenses/lgpl-3.0-standalone.html", + "https://www.gnu.org/licenses/lgpl+gpl-3.0.txt", + "https://opensource.org/licenses/LGPL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LGPLLR.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LGPLLR.json", + "referenceNumber": 87, + "name": "Lesser General Public License For Linguistic Resources", + "licenseId": "LGPLLR", + "seeAlso": [ + "http://www-igm.univ-mlv.fr/~unitex/lgpllr.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Libpng.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Libpng.json", + "referenceNumber": 531, + "name": "libpng License", + "licenseId": "Libpng", + "seeAlso": [ + "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/libpng-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/libpng-2.0.json", + "referenceNumber": 149, + "name": "PNG Reference Library version 2", + "licenseId": "libpng-2.0", + "seeAlso": [ + "http://www.libpng.org/pub/png/src/libpng-LICENSE.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/libselinux-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/libselinux-1.0.json", + "referenceNumber": 320, + "name": "libselinux public domain notice", + "licenseId": "libselinux-1.0", + "seeAlso": [ + "https://github.com/SELinuxProject/selinux/blob/master/libselinux/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/libtiff.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/libtiff.json", + "referenceNumber": 24, + "name": "libtiff License", + "licenseId": "libtiff", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/libtiff" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/libutil-David-Nugent.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/libutil-David-Nugent.json", + "referenceNumber": 662, + "name": "libutil David Nugent License", + "licenseId": "libutil-David-Nugent", + "seeAlso": [ + "http://web.mit.edu/freebsd/head/lib/libutil/login_ok.3", + "https://cgit.freedesktop.org/libbsd/tree/man/setproctitle.3bsd" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LiLiQ-P-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LiLiQ-P-1.1.json", + "referenceNumber": 150, + "name": "Licence Libre du Québec – Permissive version 1.1", + "licenseId": "LiLiQ-P-1.1", + "seeAlso": [ + "https://forge.gouv.qc.ca/licence/fr/liliq-v1-1/", + "http://opensource.org/licenses/LiLiQ-P-1.1" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/LiLiQ-R-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LiLiQ-R-1.1.json", + "referenceNumber": 203, + "name": "Licence Libre du Québec – Réciprocité version 1.1", + "licenseId": "LiLiQ-R-1.1", + "seeAlso": [ + "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-liliq-r-v1-1/", + "http://opensource.org/licenses/LiLiQ-R-1.1" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/LiLiQ-Rplus-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LiLiQ-Rplus-1.1.json", + "referenceNumber": 314, + "name": "Licence Libre du Québec – Réciprocité forte version 1.1", + "licenseId": "LiLiQ-Rplus-1.1", + "seeAlso": [ + "https://www.forge.gouv.qc.ca/participez/licence-logicielle/licence-libre-du-quebec-liliq-en-francais/licence-libre-du-quebec-reciprocite-forte-liliq-r-v1-1/", + "http://opensource.org/licenses/LiLiQ-Rplus-1.1" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Linux-man-pages-1-para.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Linux-man-pages-1-para.json", + "referenceNumber": 577, + "name": "Linux man-pages - 1 paragraph", + "licenseId": "Linux-man-pages-1-para", + "seeAlso": [ + "https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man2/getcpu.2#n4" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Linux-man-pages-copyleft.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Linux-man-pages-copyleft.json", + "referenceNumber": 213, + "name": "Linux man-pages Copyleft", + "licenseId": "Linux-man-pages-copyleft", + "seeAlso": [ + "https://www.kernel.org/doc/man-pages/licenses.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Linux-man-pages-copyleft-2-para.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Linux-man-pages-copyleft-2-para.json", + "referenceNumber": 352, + "name": "Linux man-pages Copyleft - 2 paragraphs", + "licenseId": "Linux-man-pages-copyleft-2-para", + "seeAlso": [ + "https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man2/move_pages.2#n5", + "https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man2/migrate_pages.2#n8" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Linux-man-pages-copyleft-var.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Linux-man-pages-copyleft-var.json", + "referenceNumber": 186, + "name": "Linux man-pages Copyleft Variant", + "licenseId": "Linux-man-pages-copyleft-var", + "seeAlso": [ + "https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/man2/set_mempolicy.2#n5" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Linux-OpenIB.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Linux-OpenIB.json", + "referenceNumber": 278, + "name": "Linux Kernel Variant of OpenIB.org license", + "licenseId": "Linux-OpenIB", + "seeAlso": [ + "https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/infiniband/core/sa.h" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LOOP.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LOOP.json", + "referenceNumber": 521, + "name": "Common Lisp LOOP License", + "licenseId": "LOOP", + "seeAlso": [ + "https://gitlab.com/embeddable-common-lisp/ecl/-/blob/develop/src/lsp/loop.lsp", + "http://git.savannah.gnu.org/cgit/gcl.git/tree/gcl/lsp/gcl_loop.lsp?h\u003dVersion_2_6_13pre", + "https://sourceforge.net/p/sbcl/sbcl/ci/master/tree/src/code/loop.lisp", + "https://github.com/cl-adams/adams/blob/master/LICENSE.md", + "https://github.com/blakemcbride/eclipse-lisp/blob/master/lisp/loop.lisp", + "https://gitlab.common-lisp.net/cmucl/cmucl/-/blob/master/src/code/loop.lisp" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LPD-document.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LPD-document.json", + "referenceNumber": 561, + "name": "LPD Documentation License", + "licenseId": "LPD-document", + "seeAlso": [ + "https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md", + "https://www.ietf.org/rfc/rfc1952.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LPL-1.0.json", + "referenceNumber": 267, + "name": "Lucent Public License Version 1.0", + "licenseId": "LPL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/LPL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/LPL-1.02.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LPL-1.02.json", + "referenceNumber": 122, + "name": "Lucent Public License v1.02", + "licenseId": "LPL-1.02", + "seeAlso": [ + "http://plan9.bell-labs.com/plan9/license.html", + "https://opensource.org/licenses/LPL-1.02" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LPPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LPPL-1.0.json", + "referenceNumber": 133, + "name": "LaTeX Project Public License v1.0", + "licenseId": "LPPL-1.0", + "seeAlso": [ + "http://www.latex-project.org/lppl/lppl-1-0.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LPPL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LPPL-1.1.json", + "referenceNumber": 284, + "name": "LaTeX Project Public License v1.1", + "licenseId": "LPPL-1.1", + "seeAlso": [ + "http://www.latex-project.org/lppl/lppl-1-1.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LPPL-1.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LPPL-1.2.json", + "referenceNumber": 407, + "name": "LaTeX Project Public License v1.2", + "licenseId": "LPPL-1.2", + "seeAlso": [ + "http://www.latex-project.org/lppl/lppl-1-2.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LPPL-1.3a.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LPPL-1.3a.json", + "referenceNumber": 510, + "name": "LaTeX Project Public License v1.3a", + "licenseId": "LPPL-1.3a", + "seeAlso": [ + "http://www.latex-project.org/lppl/lppl-1-3a.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/LPPL-1.3c.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LPPL-1.3c.json", + "referenceNumber": 300, + "name": "LaTeX Project Public License v1.3c", + "licenseId": "LPPL-1.3c", + "seeAlso": [ + "http://www.latex-project.org/lppl/lppl-1-3c.txt", + "https://opensource.org/licenses/LPPL-1.3c" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/lsof.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/lsof.json", + "referenceNumber": 76, + "name": "lsof License", + "licenseId": "lsof", + "seeAlso": [ + "https://github.com/lsof-org/lsof/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Lucida-Bitmap-Fonts.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Lucida-Bitmap-Fonts.json", + "referenceNumber": 383, + "name": "Lucida Bitmap Fonts License", + "licenseId": "Lucida-Bitmap-Fonts", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/font/bh-100dpi/-/blob/master/COPYING?ref_type\u003dheads" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LZMA-SDK-9.11-to-9.20.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LZMA-SDK-9.11-to-9.20.json", + "referenceNumber": 239, + "name": "LZMA SDK License (versions 9.11 to 9.20)", + "licenseId": "LZMA-SDK-9.11-to-9.20", + "seeAlso": [ + "https://www.7-zip.org/sdk.html", + "https://sourceforge.net/projects/sevenzip/files/LZMA%20SDK/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/LZMA-SDK-9.22.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/LZMA-SDK-9.22.json", + "referenceNumber": 600, + "name": "LZMA SDK License (versions 9.22 and beyond)", + "licenseId": "LZMA-SDK-9.22", + "seeAlso": [ + "https://www.7-zip.org/sdk.html", + "https://sourceforge.net/projects/sevenzip/files/LZMA%20SDK/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Mackerras-3-Clause.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Mackerras-3-Clause.json", + "referenceNumber": 540, + "name": "Mackerras 3-Clause License", + "licenseId": "Mackerras-3-Clause", + "seeAlso": [ + "https://github.com/ppp-project/ppp/blob/master/pppd/chap_ms.c#L6-L28" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Mackerras-3-Clause-acknowledgment.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Mackerras-3-Clause-acknowledgment.json", + "referenceNumber": 176, + "name": "Mackerras 3-Clause - acknowledgment variant", + "licenseId": "Mackerras-3-Clause-acknowledgment", + "seeAlso": [ + "https://github.com/ppp-project/ppp/blob/master/pppd/auth.c#L6-L28" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/magaz.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/magaz.json", + "referenceNumber": 93, + "name": "magaz License", + "licenseId": "magaz", + "seeAlso": [ + "https://mirrors.nic.cz/tex-archive/macros/latex/contrib/magaz/magaz.tex" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/mailprio.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/mailprio.json", + "referenceNumber": 292, + "name": "mailprio License", + "licenseId": "mailprio", + "seeAlso": [ + "https://fossies.org/linux/sendmail/contrib/mailprio" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MakeIndex.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MakeIndex.json", + "referenceNumber": 552, + "name": "MakeIndex License", + "licenseId": "MakeIndex", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/MakeIndex" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Martin-Birgmeier.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Martin-Birgmeier.json", + "referenceNumber": 364, + "name": "Martin Birgmeier License", + "licenseId": "Martin-Birgmeier", + "seeAlso": [ + "https://github.com/Perl/perl5/blob/blead/util.c#L6136" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/McPhee-slideshow.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/McPhee-slideshow.json", + "referenceNumber": 511, + "name": "McPhee Slideshow License", + "licenseId": "McPhee-slideshow", + "seeAlso": [ + "https://mirror.las.iastate.edu/tex-archive/graphics/metapost/contrib/macros/slideshow/slideshow.mp" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/metamail.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/metamail.json", + "referenceNumber": 325, + "name": "metamail License", + "licenseId": "metamail", + "seeAlso": [ + "https://github.com/Dual-Life/mime-base64/blob/master/Base64.xs#L12" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Minpack.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Minpack.json", + "referenceNumber": 634, + "name": "Minpack License", + "licenseId": "Minpack", + "seeAlso": [ + "http://www.netlib.org/minpack/disclaimer", + "https://gitlab.com/libeigen/eigen/-/blob/master/COPYING.MINPACK" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MirOS.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MirOS.json", + "referenceNumber": 202, + "name": "The MirOS Licence", + "licenseId": "MirOS", + "seeAlso": [ + "https://opensource.org/licenses/MirOS" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/MIT.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT.json", + "referenceNumber": 601, + "name": "MIT License", + "licenseId": "MIT", + "seeAlso": [ + "https://opensource.org/license/mit/" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/MIT-0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-0.json", + "referenceNumber": 587, + "name": "MIT No Attribution", + "licenseId": "MIT-0", + "seeAlso": [ + "https://github.com/aws/mit-0", + "https://romanrm.net/mit-zero", + "https://github.com/awsdocs/aws-cloud9-user-guide/blob/master/LICENSE-SAMPLECODE" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/MIT-advertising.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-advertising.json", + "referenceNumber": 39, + "name": "Enlightenment License (e16)", + "licenseId": "MIT-advertising", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/MIT_With_Advertising" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MIT-CMU.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-CMU.json", + "referenceNumber": 36, + "name": "CMU License", + "licenseId": "MIT-CMU", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing:MIT?rd\u003dLicensing/MIT#CMU_Style", + "https://github.com/python-pillow/Pillow/blob/fffb426092c8db24a5f4b6df243a8a3c01fb63cd/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MIT-enna.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-enna.json", + "referenceNumber": 207, + "name": "enna License", + "licenseId": "MIT-enna", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/MIT#enna" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MIT-feh.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-feh.json", + "referenceNumber": 146, + "name": "feh License", + "licenseId": "MIT-feh", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/MIT#feh" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MIT-Festival.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-Festival.json", + "referenceNumber": 431, + "name": "MIT Festival Variant", + "licenseId": "MIT-Festival", + "seeAlso": [ + "https://github.com/festvox/flite/blob/master/COPYING", + "https://github.com/festvox/speech_tools/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MIT-Khronos-old.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-Khronos-old.json", + "referenceNumber": 68, + "name": "MIT Khronos - old variant", + "licenseId": "MIT-Khronos-old", + "seeAlso": [ + "https://github.com/KhronosGroup/SPIRV-Cross/blob/main/LICENSES/LicenseRef-KhronosFreeUse.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MIT-Modern-Variant.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-Modern-Variant.json", + "referenceNumber": 92, + "name": "MIT License Modern Variant", + "licenseId": "MIT-Modern-Variant", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing:MIT#Modern_Variants", + "https://ptolemy.berkeley.edu/copyright.htm", + "https://pirlwww.lpl.arizona.edu/resources/guide/software/PerlTk/Tixlic.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/MIT-open-group.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-open-group.json", + "referenceNumber": 520, + "name": "MIT Open Group variant", + "licenseId": "MIT-open-group", + "seeAlso": [ + "https://gitlab.freedesktop.org/xorg/app/iceauth/-/blob/master/COPYING", + "https://gitlab.freedesktop.org/xorg/app/xvinfo/-/blob/master/COPYING", + "https://gitlab.freedesktop.org/xorg/app/xsetroot/-/blob/master/COPYING", + "https://gitlab.freedesktop.org/xorg/app/xauth/-/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MIT-testregex.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-testregex.json", + "referenceNumber": 578, + "name": "MIT testregex Variant", + "licenseId": "MIT-testregex", + "seeAlso": [ + "https://github.com/dotnet/runtime/blob/55e1ac7c07df62c4108d4acedf78f77574470ce5/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/AttRegexTests.cs#L12-L28" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MIT-Wu.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MIT-Wu.json", + "referenceNumber": 156, + "name": "MIT Tom Wu Variant", + "licenseId": "MIT-Wu", + "seeAlso": [ + "https://github.com/chromium/octane/blob/master/crypto.js" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MITNFA.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MITNFA.json", + "referenceNumber": 650, + "name": "MIT +no-false-attribs license", + "licenseId": "MITNFA", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/MITNFA" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MMIXware.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MMIXware.json", + "referenceNumber": 444, + "name": "MMIXware License", + "licenseId": "MMIXware", + "seeAlso": [ + "https://gitlab.lrz.de/mmix/mmixware/-/blob/master/boilerplate.w" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Motosoto.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Motosoto.json", + "referenceNumber": 31, + "name": "Motosoto License", + "licenseId": "Motosoto", + "seeAlso": [ + "https://opensource.org/licenses/Motosoto" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/MPEG-SSG.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MPEG-SSG.json", + "referenceNumber": 323, + "name": "MPEG Software Simulation", + "licenseId": "MPEG-SSG", + "seeAlso": [ + "https://sourceforge.net/p/netpbm/code/HEAD/tree/super_stable/converter/ppm/ppmtompeg/jrevdct.c#l1189" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/mpi-permissive.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/mpi-permissive.json", + "referenceNumber": 459, + "name": "mpi Permissive License", + "licenseId": "mpi-permissive", + "seeAlso": [ + "https://sources.debian.org/src/openmpi/4.1.0-10/ompi/debuggers/msgq_interface.h/?hl\u003d19#L19" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/mpich2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/mpich2.json", + "referenceNumber": 448, + "name": "mpich2 License", + "licenseId": "mpich2", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/MIT" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MPL-1.0.json", + "referenceNumber": 248, + "name": "Mozilla Public License 1.0", + "licenseId": "MPL-1.0", + "seeAlso": [ + "http://www.mozilla.org/MPL/MPL-1.0.html", + "https://opensource.org/licenses/MPL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/MPL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MPL-1.1.json", + "referenceNumber": 219, + "name": "Mozilla Public License 1.1", + "licenseId": "MPL-1.1", + "seeAlso": [ + "http://www.mozilla.org/MPL/MPL-1.1.html", + "https://opensource.org/licenses/MPL-1.1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/MPL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MPL-2.0.json", + "referenceNumber": 147, + "name": "Mozilla Public License 2.0", + "licenseId": "MPL-2.0", + "seeAlso": [ + "https://www.mozilla.org/MPL/2.0/", + "https://opensource.org/licenses/MPL-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/MPL-2.0-no-copyleft-exception.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MPL-2.0-no-copyleft-exception.json", + "referenceNumber": 529, + "name": "Mozilla Public License 2.0 (no copyleft exception)", + "licenseId": "MPL-2.0-no-copyleft-exception", + "seeAlso": [ + "https://www.mozilla.org/MPL/2.0/", + "https://opensource.org/licenses/MPL-2.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/mplus.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/mplus.json", + "referenceNumber": 553, + "name": "mplus Font License", + "licenseId": "mplus", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing:Mplus?rd\u003dLicensing/mplus" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MS-LPL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MS-LPL.json", + "referenceNumber": 412, + "name": "Microsoft Limited Public License", + "licenseId": "MS-LPL", + "seeAlso": [ + "https://www.openhub.net/licenses/mslpl", + "https://github.com/gabegundy/atlserver/blob/master/License.txt", + "https://en.wikipedia.org/wiki/Shared_Source_Initiative#Microsoft_Limited_Public_License_(Ms-LPL)" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MS-PL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MS-PL.json", + "referenceNumber": 360, + "name": "Microsoft Public License", + "licenseId": "MS-PL", + "seeAlso": [ + "http://www.microsoft.com/opensource/licenses.mspx", + "https://opensource.org/licenses/MS-PL" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/MS-RL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MS-RL.json", + "referenceNumber": 212, + "name": "Microsoft Reciprocal License", + "licenseId": "MS-RL", + "seeAlso": [ + "http://www.microsoft.com/opensource/licenses.mspx", + "https://opensource.org/licenses/MS-RL" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/MTLL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MTLL.json", + "referenceNumber": 610, + "name": "Matrix Template Library License", + "licenseId": "MTLL", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Matrix_Template_Library_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MulanPSL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MulanPSL-1.0.json", + "referenceNumber": 236, + "name": "Mulan Permissive Software License, Version 1", + "licenseId": "MulanPSL-1.0", + "seeAlso": [ + "https://license.coscl.org.cn/MulanPSL/", + "https://github.com/yuwenlong/longphp/blob/25dfb70cc2a466dc4bb55ba30901cbce08d164b5/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/MulanPSL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/MulanPSL-2.0.json", + "referenceNumber": 523, + "name": "Mulan Permissive Software License, Version 2", + "licenseId": "MulanPSL-2.0", + "seeAlso": [ + "https://license.coscl.org.cn/MulanPSL2" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Multics.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Multics.json", + "referenceNumber": 462, + "name": "Multics License", + "licenseId": "Multics", + "seeAlso": [ + "https://opensource.org/licenses/Multics" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Mup.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Mup.json", + "referenceNumber": 515, + "name": "Mup License", + "licenseId": "Mup", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Mup" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NAIST-2003.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NAIST-2003.json", + "referenceNumber": 118, + "name": "Nara Institute of Science and Technology License (2003)", + "licenseId": "NAIST-2003", + "seeAlso": [ + "https://enterprise.dejacode.com/licenses/public/naist-2003/#license-text", + "https://github.com/nodejs/node/blob/4a19cc8947b1bba2b2d27816ec3d0edf9b28e503/LICENSE#L343" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NASA-1.3.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NASA-1.3.json", + "referenceNumber": 488, + "name": "NASA Open Source Agreement 1.3", + "licenseId": "NASA-1.3", + "seeAlso": [ + "http://ti.arc.nasa.gov/opensource/nosa/", + "https://opensource.org/licenses/NASA-1.3" + ], + "isOsiApproved": true, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/Naumen.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Naumen.json", + "referenceNumber": 400, + "name": "Naumen Public License", + "licenseId": "Naumen", + "seeAlso": [ + "https://opensource.org/licenses/Naumen" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/NBPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NBPL-1.0.json", + "referenceNumber": 168, + "name": "Net Boolean Public License v1", + "licenseId": "NBPL-1.0", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003d37b4b3f6cc4bf34e1d3dec61e69914b9819d8894" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NCBI-PD.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NCBI-PD.json", + "referenceNumber": 599, + "name": "NCBI Public Domain Notice", + "licenseId": "NCBI-PD", + "seeAlso": [ + "https://github.com/ncbi/sra-tools/blob/e8e5b6af4edc460156ad9ce5902d0779cffbf685/LICENSE", + "https://github.com/ncbi/datasets/blob/0ea4cd16b61e5b799d9cc55aecfa016d6c9bd2bf/LICENSE.md", + "https://github.com/ncbi/gprobe/blob/de64d30fee8b4c4013094d7d3139ea89b5dd1ace/LICENSE", + "https://github.com/ncbi/egapx/blob/08930b9dec0c69b2d1a05e5153c7b95ef0a3eb0f/LICENSE", + "https://github.com/ncbi/datasets/blob/master/LICENSE.md" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NCGL-UK-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NCGL-UK-2.0.json", + "referenceNumber": 130, + "name": "Non-Commercial Government Licence", + "licenseId": "NCGL-UK-2.0", + "seeAlso": [ + "http://www.nationalarchives.gov.uk/doc/non-commercial-government-licence/version/2/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NCL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NCL.json", + "referenceNumber": 516, + "name": "NCL Source Code License", + "licenseId": "NCL", + "seeAlso": [ + "https://gitlab.freedesktop.org/pipewire/pipewire/-/blob/master/src/modules/module-filter-chain/pffft.c?ref_type\u003dheads#L1-52" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NCSA.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NCSA.json", + "referenceNumber": 652, + "name": "University of Illinois/NCSA Open Source License", + "licenseId": "NCSA", + "seeAlso": [ + "http://otm.illinois.edu/uiuc_openSource", + "https://opensource.org/licenses/NCSA" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Net-SNMP.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/Net-SNMP.json", + "referenceNumber": 469, + "name": "Net-SNMP License", + "licenseId": "Net-SNMP", + "seeAlso": [ + "http://net-snmp.sourceforge.net/about/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NetCDF.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NetCDF.json", + "referenceNumber": 189, + "name": "NetCDF license", + "licenseId": "NetCDF", + "seeAlso": [ + "http://www.unidata.ucar.edu/software/netcdf/copyright.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Newsletr.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Newsletr.json", + "referenceNumber": 499, + "name": "Newsletr License", + "licenseId": "Newsletr", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Newsletr" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NGPL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NGPL.json", + "referenceNumber": 167, + "name": "Nethack General Public License", + "licenseId": "NGPL", + "seeAlso": [ + "https://opensource.org/licenses/NGPL" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/NICTA-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NICTA-1.0.json", + "referenceNumber": 486, + "name": "NICTA Public Software License, Version 1.0", + "licenseId": "NICTA-1.0", + "seeAlso": [ + "https://opensource.apple.com/source/mDNSResponder/mDNSResponder-320.10/mDNSPosix/nss_ReadMe.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NIST-PD.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NIST-PD.json", + "referenceNumber": 194, + "name": "NIST Public Domain Notice", + "licenseId": "NIST-PD", + "seeAlso": [ + "https://github.com/tcheneau/simpleRPL/blob/e645e69e38dd4e3ccfeceb2db8cba05b7c2e0cd3/LICENSE.txt", + "https://github.com/tcheneau/Routing/blob/f09f46fcfe636107f22f2c98348188a65a135d98/README.md" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NIST-PD-fallback.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NIST-PD-fallback.json", + "referenceNumber": 223, + "name": "NIST Public Domain Notice with license fallback", + "licenseId": "NIST-PD-fallback", + "seeAlso": [ + "https://github.com/usnistgov/jsip/blob/59700e6926cbe96c5cdae897d9a7d2656b42abe3/LICENSE", + "https://github.com/usnistgov/fipy/blob/86aaa5c2ba2c6f1be19593c5986071cf6568cc34/LICENSE.rst" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NIST-Software.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NIST-Software.json", + "referenceNumber": 251, + "name": "NIST Software License", + "licenseId": "NIST-Software", + "seeAlso": [ + "https://github.com/open-quantum-safe/liboqs/blob/40b01fdbb270f8614fde30e65d30e9da18c02393/src/common/rand/rand_nist.c#L1-L15" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NLOD-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NLOD-1.0.json", + "referenceNumber": 294, + "name": "Norwegian Licence for Open Government Data (NLOD) 1.0", + "licenseId": "NLOD-1.0", + "seeAlso": [ + "http://data.norge.no/nlod/en/1.0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NLOD-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NLOD-2.0.json", + "referenceNumber": 566, + "name": "Norwegian Licence for Open Government Data (NLOD) 2.0", + "licenseId": "NLOD-2.0", + "seeAlso": [ + "http://data.norge.no/nlod/en/2.0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NLPL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NLPL.json", + "referenceNumber": 367, + "name": "No Limit Public License", + "licenseId": "NLPL", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/NLPL" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Nokia.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Nokia.json", + "referenceNumber": 145, + "name": "Nokia Open Source License", + "licenseId": "Nokia", + "seeAlso": [ + "https://opensource.org/licenses/nokia" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/NOSL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NOSL.json", + "referenceNumber": 254, + "name": "Netizen Open Source License", + "licenseId": "NOSL", + "seeAlso": [ + "http://bits.netizen.com.au/licenses/NOSL/nosl.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Noweb.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Noweb.json", + "referenceNumber": 30, + "name": "Noweb License", + "licenseId": "Noweb", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Noweb" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NPL-1.0.json", + "referenceNumber": 211, + "name": "Netscape Public License v1.0", + "licenseId": "NPL-1.0", + "seeAlso": [ + "http://www.mozilla.org/MPL/NPL/1.0/" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/NPL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NPL-1.1.json", + "referenceNumber": 595, + "name": "Netscape Public License v1.1", + "licenseId": "NPL-1.1", + "seeAlso": [ + "http://www.mozilla.org/MPL/NPL/1.1/" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/NPOSL-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NPOSL-3.0.json", + "referenceNumber": 664, + "name": "Non-Profit Open Software License 3.0", + "licenseId": "NPOSL-3.0", + "seeAlso": [ + "https://opensource.org/licenses/NOSL3.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/NRL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NRL.json", + "referenceNumber": 113, + "name": "NRL License", + "licenseId": "NRL", + "seeAlso": [ + "http://web.mit.edu/network/isakmp/nrllicense.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/NTP.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NTP.json", + "referenceNumber": 390, + "name": "NTP License", + "licenseId": "NTP", + "seeAlso": [ + "https://opensource.org/licenses/NTP" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/NTP-0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/NTP-0.json", + "referenceNumber": 64, + "name": "NTP No Attribution", + "licenseId": "NTP-0", + "seeAlso": [ + "https://github.com/tytso/e2fsprogs/blob/master/lib/et/et_name.c" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Nunit.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/Nunit.json", + "referenceNumber": 27, + "name": "Nunit License", + "licenseId": "Nunit", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Nunit" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/O-UDA-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/O-UDA-1.0.json", + "referenceNumber": 161, + "name": "Open Use of Data Agreement v1.0", + "licenseId": "O-UDA-1.0", + "seeAlso": [ + "https://github.com/microsoft/Open-Use-of-Data-Agreement/blob/v1.0/O-UDA-1.0.md", + "https://cdla.dev/open-use-of-data-agreement-v1-0/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OAR.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OAR.json", + "referenceNumber": 100, + "name": "OAR License", + "licenseId": "OAR", + "seeAlso": [ + "https://sourceware.org/git/?p\u003dnewlib-cygwin.git;a\u003dblob;f\u003dnewlib/libc/string/strsignal.c;hb\u003dHEAD#l35" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OCCT-PL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OCCT-PL.json", + "referenceNumber": 408, + "name": "Open CASCADE Technology Public License", + "licenseId": "OCCT-PL", + "seeAlso": [ + "http://www.opencascade.com/content/occt-public-license" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OCLC-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OCLC-2.0.json", + "referenceNumber": 468, + "name": "OCLC Research Public License 2.0", + "licenseId": "OCLC-2.0", + "seeAlso": [ + "http://www.oclc.org/research/activities/software/license/v2final.htm", + "https://opensource.org/licenses/OCLC-2.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/ODbL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ODbL-1.0.json", + "referenceNumber": 611, + "name": "Open Data Commons Open Database License v1.0", + "licenseId": "ODbL-1.0", + "seeAlso": [ + "http://www.opendatacommons.org/licenses/odbl/1.0/", + "https://opendatacommons.org/licenses/odbl/1-0/" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/ODC-By-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ODC-By-1.0.json", + "referenceNumber": 15, + "name": "Open Data Commons Attribution License v1.0", + "licenseId": "ODC-By-1.0", + "seeAlso": [ + "https://opendatacommons.org/licenses/by/1.0/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OFFIS.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OFFIS.json", + "referenceNumber": 418, + "name": "OFFIS License", + "licenseId": "OFFIS", + "seeAlso": [ + "https://sourceforge.net/p/xmedcon/code/ci/master/tree/libs/dicom/README" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OFL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OFL-1.0.json", + "referenceNumber": 603, + "name": "SIL Open Font License 1.0", + "licenseId": "OFL-1.0", + "seeAlso": [ + "http://scripts.sil.org/cms/scripts/page.php?item_id\u003dOFL10_web" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/OFL-1.0-no-RFN.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OFL-1.0-no-RFN.json", + "referenceNumber": 545, + "name": "SIL Open Font License 1.0 with no Reserved Font Name", + "licenseId": "OFL-1.0-no-RFN", + "seeAlso": [ + "http://scripts.sil.org/cms/scripts/page.php?item_id\u003dOFL10_web" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OFL-1.0-RFN.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OFL-1.0-RFN.json", + "referenceNumber": 446, + "name": "SIL Open Font License 1.0 with Reserved Font Name", + "licenseId": "OFL-1.0-RFN", + "seeAlso": [ + "http://scripts.sil.org/cms/scripts/page.php?item_id\u003dOFL10_web" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OFL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OFL-1.1.json", + "referenceNumber": 0, + "name": "SIL Open Font License 1.1", + "licenseId": "OFL-1.1", + "seeAlso": [ + "http://scripts.sil.org/cms/scripts/page.php?item_id\u003dOFL_web", + "https://opensource.org/licenses/OFL-1.1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/OFL-1.1-no-RFN.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OFL-1.1-no-RFN.json", + "referenceNumber": 110, + "name": "SIL Open Font License 1.1 with no Reserved Font Name", + "licenseId": "OFL-1.1-no-RFN", + "seeAlso": [ + "http://scripts.sil.org/cms/scripts/page.php?item_id\u003dOFL_web", + "https://opensource.org/licenses/OFL-1.1" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/OFL-1.1-RFN.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OFL-1.1-RFN.json", + "referenceNumber": 90, + "name": "SIL Open Font License 1.1 with Reserved Font Name", + "licenseId": "OFL-1.1-RFN", + "seeAlso": [ + "http://scripts.sil.org/cms/scripts/page.php?item_id\u003dOFL_web", + "https://opensource.org/licenses/OFL-1.1" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/OGC-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OGC-1.0.json", + "referenceNumber": 504, + "name": "OGC Software License, Version 1.0", + "licenseId": "OGC-1.0", + "seeAlso": [ + "https://www.ogc.org/ogc/software/1.0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OGDL-Taiwan-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OGDL-Taiwan-1.0.json", + "referenceNumber": 23, + "name": "Taiwan Open Government Data License, version 1.0", + "licenseId": "OGDL-Taiwan-1.0", + "seeAlso": [ + "https://data.gov.tw/license" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OGL-Canada-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OGL-Canada-2.0.json", + "referenceNumber": 40, + "name": "Open Government Licence - Canada", + "licenseId": "OGL-Canada-2.0", + "seeAlso": [ + "https://open.canada.ca/en/open-government-licence-canada" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OGL-UK-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OGL-UK-1.0.json", + "referenceNumber": 497, + "name": "Open Government Licence v1.0", + "licenseId": "OGL-UK-1.0", + "seeAlso": [ + "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/1/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OGL-UK-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OGL-UK-2.0.json", + "referenceNumber": 556, + "name": "Open Government Licence v2.0", + "licenseId": "OGL-UK-2.0", + "seeAlso": [ + "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/2/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OGL-UK-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OGL-UK-3.0.json", + "referenceNumber": 585, + "name": "Open Government Licence v3.0", + "licenseId": "OGL-UK-3.0", + "seeAlso": [ + "http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OGTSL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OGTSL.json", + "referenceNumber": 97, + "name": "Open Group Test Suite License", + "licenseId": "OGTSL", + "seeAlso": [ + "http://www.opengroup.org/testing/downloads/The_Open_Group_TSL.txt", + "https://opensource.org/licenses/OGTSL" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/OLDAP-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-1.1.json", + "referenceNumber": 420, + "name": "Open LDAP Public License v1.1", + "licenseId": "OLDAP-1.1", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003d806557a5ad59804ef3a44d5abfbe91d706b0791f" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-1.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-1.2.json", + "referenceNumber": 487, + "name": "Open LDAP Public License v1.2", + "licenseId": "OLDAP-1.2", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003d42b0383c50c299977b5893ee695cf4e486fb0dc7" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-1.3.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-1.3.json", + "referenceNumber": 627, + "name": "Open LDAP Public License v1.3", + "licenseId": "OLDAP-1.3", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003de5f8117f0ce088d0bd7a8e18ddf37eaa40eb09b1" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-1.4.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-1.4.json", + "referenceNumber": 45, + "name": "Open LDAP Public License v1.4", + "licenseId": "OLDAP-1.4", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003dc9f95c2f3f2ffb5e0ae55fe7388af75547660941" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.0.json", + "referenceNumber": 537, + "name": "Open LDAP Public License v2.0 (or possibly 2.0A and 2.0B)", + "licenseId": "OLDAP-2.0", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003dcbf50f4e1185a21abd4c0a54d3f4341fe28f36ea" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.0.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.0.1.json", + "referenceNumber": 179, + "name": "Open LDAP Public License v2.0.1", + "licenseId": "OLDAP-2.0.1", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003db6d68acd14e51ca3aab4428bf26522aa74873f0e" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.1.json", + "referenceNumber": 342, + "name": "Open LDAP Public License v2.1", + "licenseId": "OLDAP-2.1", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003db0d176738e96a0d3b9f85cb51e140a86f21be715" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.2.json", + "referenceNumber": 347, + "name": "Open LDAP Public License v2.2", + "licenseId": "OLDAP-2.2", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003d470b0c18ec67621c85881b2733057fecf4a1acc3" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.2.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.2.1.json", + "referenceNumber": 208, + "name": "Open LDAP Public License v2.2.1", + "licenseId": "OLDAP-2.2.1", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003d4bc786f34b50aa301be6f5600f58a980070f481e" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.2.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.2.2.json", + "referenceNumber": 312, + "name": "Open LDAP Public License 2.2.2", + "licenseId": "OLDAP-2.2.2", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003ddf2cc1e21eb7c160695f5b7cffd6296c151ba188" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.3.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.3.json", + "referenceNumber": 276, + "name": "Open LDAP Public License v2.3", + "licenseId": "OLDAP-2.3", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003dd32cf54a32d581ab475d23c810b0a7fbaf8d63c3" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.4.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.4.json", + "referenceNumber": 108, + "name": "Open LDAP Public License v2.4", + "licenseId": "OLDAP-2.4", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003dcd1284c4a91a8a380d904eee68d1583f989ed386" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.5.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.5.json", + "referenceNumber": 518, + "name": "Open LDAP Public License v2.5", + "licenseId": "OLDAP-2.5", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003d6852b9d90022e8593c98205413380536b1b5a7cf" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.6.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.6.json", + "referenceNumber": 275, + "name": "Open LDAP Public License v2.6", + "licenseId": "OLDAP-2.6", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003d1cae062821881f41b73012ba816434897abf4205" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.7.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.7.json", + "referenceNumber": 79, + "name": "Open LDAP Public License v2.7", + "licenseId": "OLDAP-2.7", + "seeAlso": [ + "http://www.openldap.org/devel/gitweb.cgi?p\u003dopenldap.git;a\u003dblob;f\u003dLICENSE;hb\u003d47c2415c1df81556eeb39be6cad458ef87c534a2" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/OLDAP-2.8.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLDAP-2.8.json", + "referenceNumber": 72, + "name": "Open LDAP Public License v2.8", + "licenseId": "OLDAP-2.8", + "seeAlso": [ + "http://www.openldap.org/software/release/license.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/OLFL-1.3.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OLFL-1.3.json", + "referenceNumber": 204, + "name": "Open Logistics Foundation License Version 1.3", + "licenseId": "OLFL-1.3", + "seeAlso": [ + "https://openlogisticsfoundation.org/licenses/", + "https://opensource.org/license/olfl-1-3/" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/OML.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OML.json", + "referenceNumber": 505, + "name": "Open Market License", + "licenseId": "OML", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Open_Market_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OpenPBS-2.3.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OpenPBS-2.3.json", + "referenceNumber": 159, + "name": "OpenPBS v2.3 Software License", + "licenseId": "OpenPBS-2.3", + "seeAlso": [ + "https://github.com/adaptivecomputing/torque/blob/master/PBS_License.txt", + "https://www.mcs.anl.gov/research/projects/openpbs/PBS_License.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OpenSSL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OpenSSL.json", + "referenceNumber": 445, + "name": "OpenSSL License", + "licenseId": "OpenSSL", + "seeAlso": [ + "http://www.openssl.org/source/license.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/OpenSSL-standalone.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OpenSSL-standalone.json", + "referenceNumber": 635, + "name": "OpenSSL License - standalone", + "licenseId": "OpenSSL-standalone", + "seeAlso": [ + "https://library.netapp.com/ecm/ecm_download_file/ECMP1196395", + "https://hstechdocs.helpsystems.com/manuals/globalscape/archive/cuteftp6/open_ssl_license_agreement.htm" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OpenVision.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OpenVision.json", + "referenceNumber": 589, + "name": "OpenVision License", + "licenseId": "OpenVision", + "seeAlso": [ + "https://github.com/krb5/krb5/blob/krb5-1.21.2-final/NOTICE#L66-L98", + "https://web.mit.edu/kerberos/krb5-1.21/doc/mitK5license.html", + "https://fedoraproject.org/wiki/Licensing:MIT#OpenVision_Variant" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OPL-1.0.json", + "referenceNumber": 80, + "name": "Open Public License v1.0", + "licenseId": "OPL-1.0", + "seeAlso": [ + "http://old.koalateam.com/jackaroo/OPL_1_0.TXT", + "https://fedoraproject.org/wiki/Licensing/Open_Public_License" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/OPL-UK-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OPL-UK-3.0.json", + "referenceNumber": 19, + "name": "United Kingdom Open Parliament Licence v3.0", + "licenseId": "OPL-UK-3.0", + "seeAlso": [ + "https://www.parliament.uk/site-information/copyright-parliament/open-parliament-licence/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OPUBL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OPUBL-1.0.json", + "referenceNumber": 266, + "name": "Open Publication License v1.0", + "licenseId": "OPUBL-1.0", + "seeAlso": [ + "http://opencontent.org/openpub/", + "https://www.debian.org/opl", + "https://www.ctan.org/license/opl" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/OSET-PL-2.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OSET-PL-2.1.json", + "referenceNumber": 307, + "name": "OSET Public License version 2.1", + "licenseId": "OSET-PL-2.1", + "seeAlso": [ + "http://www.osetfoundation.org/public-license", + "https://opensource.org/licenses/OPL-2.1" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/OSL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OSL-1.0.json", + "referenceNumber": 306, + "name": "Open Software License 1.0", + "licenseId": "OSL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/OSL-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/OSL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OSL-1.1.json", + "referenceNumber": 111, + "name": "Open Software License 1.1", + "licenseId": "OSL-1.1", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/OSL1.1" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/OSL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OSL-2.0.json", + "referenceNumber": 457, + "name": "Open Software License 2.0", + "licenseId": "OSL-2.0", + "seeAlso": [ + "http://web.archive.org/web/20041020171434/http://www.rosenlaw.com/osl2.0.html" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/OSL-2.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OSL-2.1.json", + "referenceNumber": 247, + "name": "Open Software License 2.1", + "licenseId": "OSL-2.1", + "seeAlso": [ + "http://web.archive.org/web/20050212003940/http://www.rosenlaw.com/osl21.htm", + "https://opensource.org/licenses/OSL-2.1" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/OSL-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/OSL-3.0.json", + "referenceNumber": 432, + "name": "Open Software License 3.0", + "licenseId": "OSL-3.0", + "seeAlso": [ + "https://web.archive.org/web/20120101081418/http://rosenlaw.com:80/OSL3.0.htm", + "https://opensource.org/licenses/OSL-3.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/PADL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/PADL.json", + "referenceNumber": 43, + "name": "PADL License", + "licenseId": "PADL", + "seeAlso": [ + "https://git.openldap.org/openldap/openldap/-/blob/master/libraries/libldap/os-local.c?ref_type\u003dheads#L19-23" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Parity-6.0.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Parity-6.0.0.json", + "referenceNumber": 49, + "name": "The Parity Public License 6.0.0", + "licenseId": "Parity-6.0.0", + "seeAlso": [ + "https://paritylicense.com/versions/6.0.0.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Parity-7.0.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Parity-7.0.0.json", + "referenceNumber": 482, + "name": "The Parity Public License 7.0.0", + "licenseId": "Parity-7.0.0", + "seeAlso": [ + "https://paritylicense.com/versions/7.0.0.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/PDDL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/PDDL-1.0.json", + "referenceNumber": 210, + "name": "Open Data Commons Public Domain Dedication \u0026 License 1.0", + "licenseId": "PDDL-1.0", + "seeAlso": [ + "http://opendatacommons.org/licenses/pddl/1.0/", + "https://opendatacommons.org/licenses/pddl/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/PHP-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/PHP-3.0.json", + "referenceNumber": 580, + "name": "PHP License v3.0", + "licenseId": "PHP-3.0", + "seeAlso": [ + "http://www.php.net/license/3_0.txt", + "https://opensource.org/licenses/PHP-3.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/PHP-3.01.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/PHP-3.01.json", + "referenceNumber": 594, + "name": "PHP License v3.01", + "licenseId": "PHP-3.01", + "seeAlso": [ + "http://www.php.net/license/3_01.txt" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Pixar.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Pixar.json", + "referenceNumber": 619, + "name": "Pixar License", + "licenseId": "Pixar", + "seeAlso": [ + "https://github.com/PixarAnimationStudios/OpenSubdiv/raw/v3_5_0/LICENSE.txt", + "https://graphics.pixar.com/opensubdiv/docs/license.html", + "https://github.com/PixarAnimationStudios/OpenSubdiv/blob/v3_5_0/opensubdiv/version.cpp#L2-L22" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/pkgconf.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/pkgconf.json", + "referenceNumber": 16, + "name": "pkgconf License", + "licenseId": "pkgconf", + "seeAlso": [ + "https://github.com/pkgconf/pkgconf/blob/master/cli/main.c#L8" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Plexus.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Plexus.json", + "referenceNumber": 442, + "name": "Plexus Classworlds License", + "licenseId": "Plexus", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Plexus_Classworlds_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/pnmstitch.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/pnmstitch.json", + "referenceNumber": 502, + "name": "pnmstitch License", + "licenseId": "pnmstitch", + "seeAlso": [ + "https://sourceforge.net/p/netpbm/code/HEAD/tree/super_stable/editor/pnmstitch.c#l2" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/PolyForm-Noncommercial-1.0.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/PolyForm-Noncommercial-1.0.0.json", + "referenceNumber": 575, + "name": "PolyForm Noncommercial License 1.0.0", + "licenseId": "PolyForm-Noncommercial-1.0.0", + "seeAlso": [ + "https://polyformproject.org/licenses/noncommercial/1.0.0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/PolyForm-Small-Business-1.0.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/PolyForm-Small-Business-1.0.0.json", + "referenceNumber": 9, + "name": "PolyForm Small Business License 1.0.0", + "licenseId": "PolyForm-Small-Business-1.0.0", + "seeAlso": [ + "https://polyformproject.org/licenses/small-business/1.0.0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/PostgreSQL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/PostgreSQL.json", + "referenceNumber": 94, + "name": "PostgreSQL License", + "licenseId": "PostgreSQL", + "seeAlso": [ + "http://www.postgresql.org/about/licence", + "https://opensource.org/licenses/PostgreSQL" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/PPL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/PPL.json", + "referenceNumber": 454, + "name": "Peer Production License", + "licenseId": "PPL", + "seeAlso": [ + "https://wiki.p2pfoundation.net/Peer_Production_License", + "http://www.networkcultures.org/_uploads/%233notebook_telekommunist.pdf" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/PSF-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/PSF-2.0.json", + "referenceNumber": 62, + "name": "Python Software Foundation License 2.0", + "licenseId": "PSF-2.0", + "seeAlso": [ + "https://opensource.org/licenses/Python-2.0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/psfrag.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/psfrag.json", + "referenceNumber": 279, + "name": "psfrag License", + "licenseId": "psfrag", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/psfrag" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/psutils.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/psutils.json", + "referenceNumber": 387, + "name": "psutils License", + "licenseId": "psutils", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/psutils" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Python-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Python-2.0.json", + "referenceNumber": 498, + "name": "Python License 2.0", + "licenseId": "Python-2.0", + "seeAlso": [ + "https://opensource.org/licenses/Python-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Python-2.0.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Python-2.0.1.json", + "referenceNumber": 453, + "name": "Python License 2.0.1", + "licenseId": "Python-2.0.1", + "seeAlso": [ + "https://www.python.org/download/releases/2.0.1/license/", + "https://docs.python.org/3/license.html", + "https://github.com/python/cpython/blob/main/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/python-ldap.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/python-ldap.json", + "referenceNumber": 422, + "name": "Python ldap License", + "licenseId": "python-ldap", + "seeAlso": [ + "https://github.com/python-ldap/python-ldap/blob/main/LICENCE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Qhull.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Qhull.json", + "referenceNumber": 123, + "name": "Qhull License", + "licenseId": "Qhull", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Qhull" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/QPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/QPL-1.0.json", + "referenceNumber": 329, + "name": "Q Public License 1.0", + "licenseId": "QPL-1.0", + "seeAlso": [ + "http://doc.qt.nokia.com/3.3/license.html", + "https://opensource.org/licenses/QPL-1.0", + "https://doc.qt.io/archives/3.3/license.html" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/QPL-1.0-INRIA-2004.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/QPL-1.0-INRIA-2004.json", + "referenceNumber": 479, + "name": "Q Public License 1.0 - INRIA 2004 variant", + "licenseId": "QPL-1.0-INRIA-2004", + "seeAlso": [ + "https://github.com/maranget/hevea/blob/master/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/radvd.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/radvd.json", + "referenceNumber": 182, + "name": "radvd License", + "licenseId": "radvd", + "seeAlso": [ + "https://github.com/radvd-project/radvd/blob/master/COPYRIGHT" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Rdisc.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Rdisc.json", + "referenceNumber": 101, + "name": "Rdisc License", + "licenseId": "Rdisc", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Rdisc_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/RHeCos-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/RHeCos-1.1.json", + "referenceNumber": 373, + "name": "Red Hat eCos Public License v1.1", + "licenseId": "RHeCos-1.1", + "seeAlso": [ + "http://ecos.sourceware.org/old-license.html" + ], + "isOsiApproved": false, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/RPL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/RPL-1.1.json", + "referenceNumber": 369, + "name": "Reciprocal Public License 1.1", + "licenseId": "RPL-1.1", + "seeAlso": [ + "https://opensource.org/licenses/RPL-1.1" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/RPL-1.5.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/RPL-1.5.json", + "referenceNumber": 102, + "name": "Reciprocal Public License 1.5", + "licenseId": "RPL-1.5", + "seeAlso": [ + "https://opensource.org/licenses/RPL-1.5" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/RPSL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/RPSL-1.0.json", + "referenceNumber": 663, + "name": "RealNetworks Public Source License v1.0", + "licenseId": "RPSL-1.0", + "seeAlso": [ + "https://helixcommunity.org/content/rpsl", + "https://opensource.org/licenses/RPSL-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/RSA-MD.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/RSA-MD.json", + "referenceNumber": 139, + "name": "RSA Message-Digest License", + "licenseId": "RSA-MD", + "seeAlso": [ + "http://www.faqs.org/rfcs/rfc1321.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/RSCPL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/RSCPL.json", + "referenceNumber": 405, + "name": "Ricoh Source Code Public License", + "licenseId": "RSCPL", + "seeAlso": [ + "http://wayback.archive.org/web/20060715140826/http://www.risource.org/RPL/RPL-1.0A.shtml", + "https://opensource.org/licenses/RSCPL" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Ruby.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Ruby.json", + "referenceNumber": 192, + "name": "Ruby License", + "licenseId": "Ruby", + "seeAlso": [ + "https://www.ruby-lang.org/en/about/license.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Ruby-pty.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Ruby-pty.json", + "referenceNumber": 473, + "name": "Ruby pty extension license", + "licenseId": "Ruby-pty", + "seeAlso": [ + "https://github.com/ruby/ruby/blob/9f6deaa6888a423720b4b127b5314f0ad26cc2e6/ext/pty/pty.c#L775-L786", + "https://github.com/ruby/ruby/commit/0a64817fb80016030c03518fb9459f63c11605ea#diff-ef5fa30838d6d0cecad9e675cc50b24628cfe2cb277c346053fafcc36c91c204", + "https://github.com/ruby/ruby/commit/0a64817fb80016030c03518fb9459f63c11605ea#diff-fedf217c1ce44bda01f0a678d3ff8b198bed478754d699c527a698ad933979a0" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SAX-PD.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SAX-PD.json", + "referenceNumber": 205, + "name": "Sax Public Domain Notice", + "licenseId": "SAX-PD", + "seeAlso": [ + "http://www.saxproject.org/copying.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SAX-PD-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SAX-PD-2.0.json", + "referenceNumber": 209, + "name": "Sax Public Domain Notice 2.0", + "licenseId": "SAX-PD-2.0", + "seeAlso": [ + "http://www.saxproject.org/copying.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Saxpath.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Saxpath.json", + "referenceNumber": 67, + "name": "Saxpath License", + "licenseId": "Saxpath", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Saxpath_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SCEA.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SCEA.json", + "referenceNumber": 617, + "name": "SCEA Shared Source License", + "licenseId": "SCEA", + "seeAlso": [ + "http://research.scea.com/scea_shared_source_license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SchemeReport.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SchemeReport.json", + "referenceNumber": 472, + "name": "Scheme Language Report License", + "licenseId": "SchemeReport", + "seeAlso": [], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Sendmail.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Sendmail.json", + "referenceNumber": 135, + "name": "Sendmail License", + "licenseId": "Sendmail", + "seeAlso": [ + "http://www.sendmail.com/pdfs/open_source/sendmail_license.pdf", + "https://web.archive.org/web/20160322142305/https://www.sendmail.com/pdfs/open_source/sendmail_license.pdf" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Sendmail-8.23.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Sendmail-8.23.json", + "referenceNumber": 226, + "name": "Sendmail License 8.23", + "licenseId": "Sendmail-8.23", + "seeAlso": [ + "https://www.proofpoint.com/sites/default/files/sendmail-license.pdf", + "https://web.archive.org/web/20181003101040/https://www.proofpoint.com/sites/default/files/sendmail-license.pdf" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SGI-B-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SGI-B-1.0.json", + "referenceNumber": 631, + "name": "SGI Free Software License B v1.0", + "licenseId": "SGI-B-1.0", + "seeAlso": [ + "http://oss.sgi.com/projects/FreeB/SGIFreeSWLicB.1.0.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SGI-B-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SGI-B-1.1.json", + "referenceNumber": 48, + "name": "SGI Free Software License B v1.1", + "licenseId": "SGI-B-1.1", + "seeAlso": [ + "http://oss.sgi.com/projects/FreeB/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SGI-B-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SGI-B-2.0.json", + "referenceNumber": 193, + "name": "SGI Free Software License B v2.0", + "licenseId": "SGI-B-2.0", + "seeAlso": [ + "http://oss.sgi.com/projects/FreeB/SGIFreeSWLicB.2.0.pdf" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/SGI-OpenGL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SGI-OpenGL.json", + "referenceNumber": 565, + "name": "SGI OpenGL License", + "licenseId": "SGI-OpenGL", + "seeAlso": [ + "https://gitlab.freedesktop.org/mesa/glw/-/blob/master/README?ref_type\u003dheads" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SGP4.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SGP4.json", + "referenceNumber": 291, + "name": "SGP4 Permission Notice", + "licenseId": "SGP4", + "seeAlso": [ + "https://celestrak.org/publications/AIAA/2006-6753/faq.php" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SHL-0.5.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SHL-0.5.json", + "referenceNumber": 623, + "name": "Solderpad Hardware License v0.5", + "licenseId": "SHL-0.5", + "seeAlso": [ + "https://solderpad.org/licenses/SHL-0.5/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SHL-0.51.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SHL-0.51.json", + "referenceNumber": 34, + "name": "Solderpad Hardware License, Version 0.51", + "licenseId": "SHL-0.51", + "seeAlso": [ + "https://solderpad.org/licenses/SHL-0.51/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SimPL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SimPL-2.0.json", + "referenceNumber": 630, + "name": "Simple Public License 2.0", + "licenseId": "SimPL-2.0", + "seeAlso": [ + "https://opensource.org/licenses/SimPL-2.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/SISSL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SISSL.json", + "referenceNumber": 655, + "name": "Sun Industry Standards Source License v1.1", + "licenseId": "SISSL", + "seeAlso": [ + "http://www.openoffice.org/licenses/sissl_license.html", + "https://opensource.org/licenses/SISSL" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/SISSL-1.2.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SISSL-1.2.json", + "referenceNumber": 401, + "name": "Sun Industry Standards Source License v1.2", + "licenseId": "SISSL-1.2", + "seeAlso": [ + "http://gridscheduler.sourceforge.net/Gridengine_SISSL_license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SL.json", + "referenceNumber": 632, + "name": "SL License", + "licenseId": "SL", + "seeAlso": [ + "https://github.com/mtoyoda/sl/blob/master/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Sleepycat.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Sleepycat.json", + "referenceNumber": 283, + "name": "Sleepycat License", + "licenseId": "Sleepycat", + "seeAlso": [ + "https://opensource.org/licenses/Sleepycat" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/SMLNJ.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SMLNJ.json", + "referenceNumber": 413, + "name": "Standard ML of New Jersey License", + "licenseId": "SMLNJ", + "seeAlso": [ + "https://www.smlnj.org/license.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/SMPPL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SMPPL.json", + "referenceNumber": 321, + "name": "Secure Messaging Protocol Public License", + "licenseId": "SMPPL", + "seeAlso": [ + "https://github.com/dcblake/SMP/blob/master/Documentation/License.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SNIA.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SNIA.json", + "referenceNumber": 41, + "name": "SNIA Public License 1.1", + "licenseId": "SNIA", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/SNIA_Public_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/snprintf.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/snprintf.json", + "referenceNumber": 507, + "name": "snprintf License", + "licenseId": "snprintf", + "seeAlso": [ + "https://github.com/openssh/openssh-portable/blob/master/openbsd-compat/bsd-snprintf.c#L2" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/softSurfer.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/softSurfer.json", + "referenceNumber": 496, + "name": "softSurfer License", + "licenseId": "softSurfer", + "seeAlso": [ + "https://github.com/mm2/Little-CMS/blob/master/src/cmssm.c#L207", + "https://fedoraproject.org/wiki/Licensing/softSurfer" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Soundex.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Soundex.json", + "referenceNumber": 1, + "name": "Soundex License", + "licenseId": "Soundex", + "seeAlso": [ + "https://metacpan.org/release/RJBS/Text-Soundex-3.05/source/Soundex.pm#L3-11" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Spencer-86.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Spencer-86.json", + "referenceNumber": 257, + "name": "Spencer License 86", + "licenseId": "Spencer-86", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Spencer-94.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Spencer-94.json", + "referenceNumber": 228, + "name": "Spencer License 94", + "licenseId": "Spencer-94", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Henry_Spencer_Reg-Ex_Library_License", + "https://metacpan.org/release/KNOK/File-MMagic-1.30/source/COPYING#L28" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Spencer-99.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Spencer-99.json", + "referenceNumber": 287, + "name": "Spencer License 99", + "licenseId": "Spencer-99", + "seeAlso": [ + "http://www.opensource.apple.com/source/tcl/tcl-5/tcl/generic/regfronts.c" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SPL-1.0.json", + "referenceNumber": 576, + "name": "Sun Public License v1.0", + "licenseId": "SPL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/SPL-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/ssh-keyscan.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ssh-keyscan.json", + "referenceNumber": 78, + "name": "ssh-keyscan License", + "licenseId": "ssh-keyscan", + "seeAlso": [ + "https://github.com/openssh/openssh-portable/blob/master/LICENCE#L82" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SSH-OpenSSH.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SSH-OpenSSH.json", + "referenceNumber": 536, + "name": "SSH OpenSSH license", + "licenseId": "SSH-OpenSSH", + "seeAlso": [ + "https://github.com/openssh/openssh-portable/blob/1b11ea7c58cd5c59838b5fa574cd456d6047b2d4/LICENCE#L10" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SSH-short.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SSH-short.json", + "referenceNumber": 438, + "name": "SSH short notice", + "licenseId": "SSH-short", + "seeAlso": [ + "https://github.com/openssh/openssh-portable/blob/1b11ea7c58cd5c59838b5fa574cd456d6047b2d4/pathnames.h", + "http://web.mit.edu/kolya/.f/root/athena.mit.edu/sipb.mit.edu/project/openssh/OldFiles/src/openssh-2.9.9p2/ssh-add.1", + "https://joinup.ec.europa.eu/svn/lesoll/trunk/italc/lib/src/dsa_key.cpp" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SSLeay-standalone.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SSLeay-standalone.json", + "referenceNumber": 421, + "name": "SSLeay License - standalone", + "licenseId": "SSLeay-standalone", + "seeAlso": [ + "https://www.tq-group.com/filedownloads/files/software-license-conditions/OriginalSSLeay/OriginalSSLeay.pdf" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SSPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SSPL-1.0.json", + "referenceNumber": 295, + "name": "Server Side Public License, v 1", + "licenseId": "SSPL-1.0", + "seeAlso": [ + "https://www.mongodb.com/licensing/server-side-public-license" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/StandardML-NJ.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/StandardML-NJ.json", + "referenceNumber": 201, + "name": "Standard ML of New Jersey License", + "licenseId": "StandardML-NJ", + "seeAlso": [ + "https://www.smlnj.org/license.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/SugarCRM-1.1.3.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SugarCRM-1.1.3.json", + "referenceNumber": 11, + "name": "SugarCRM Public License v1.1.3", + "licenseId": "SugarCRM-1.1.3", + "seeAlso": [ + "http://www.sugarcrm.com/crm/SPL" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Sun-PPP.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Sun-PPP.json", + "referenceNumber": 313, + "name": "Sun PPP License", + "licenseId": "Sun-PPP", + "seeAlso": [ + "https://github.com/ppp-project/ppp/blob/master/pppd/eap.c#L7-L16" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Sun-PPP-2000.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Sun-PPP-2000.json", + "referenceNumber": 489, + "name": "Sun PPP License (2000)", + "licenseId": "Sun-PPP-2000", + "seeAlso": [ + "https://github.com/ppp-project/ppp/blob/master/modules/ppp_ahdlc.c#L7-L19" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SunPro.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SunPro.json", + "referenceNumber": 440, + "name": "SunPro License", + "licenseId": "SunPro", + "seeAlso": [ + "https://github.com/freebsd/freebsd-src/blob/main/lib/msun/src/e_acosh.c", + "https://github.com/freebsd/freebsd-src/blob/main/lib/msun/src/e_lgammal.c" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/SWL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/SWL.json", + "referenceNumber": 331, + "name": "Scheme Widget Library (SWL) Software License Agreement", + "licenseId": "SWL", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/SWL" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/swrule.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/swrule.json", + "referenceNumber": 206, + "name": "swrule License", + "licenseId": "swrule", + "seeAlso": [ + "https://ctan.math.utah.edu/ctan/tex-archive/macros/generic/misc/swrule.sty" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Symlinks.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Symlinks.json", + "referenceNumber": 136, + "name": "Symlinks License", + "licenseId": "Symlinks", + "seeAlso": [ + "https://www.mail-archive.com/debian-bugs-rc@lists.debian.org/msg11494.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TAPR-OHL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TAPR-OHL-1.0.json", + "referenceNumber": 317, + "name": "TAPR Open Hardware License v1.0", + "licenseId": "TAPR-OHL-1.0", + "seeAlso": [ + "https://www.tapr.org/OHL" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TCL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TCL.json", + "referenceNumber": 644, + "name": "TCL/TK License", + "licenseId": "TCL", + "seeAlso": [ + "http://www.tcl.tk/software/tcltk/license.html", + "https://fedoraproject.org/wiki/Licensing/TCL" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TCP-wrappers.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TCP-wrappers.json", + "referenceNumber": 245, + "name": "TCP Wrappers License", + "licenseId": "TCP-wrappers", + "seeAlso": [ + "http://rc.quest.com/topics/openssh/license.php#tcpwrappers" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TermReadKey.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TermReadKey.json", + "referenceNumber": 37, + "name": "TermReadKey License", + "licenseId": "TermReadKey", + "seeAlso": [ + "https://github.com/jonathanstowe/TermReadKey/blob/master/README#L9-L10" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TGPPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TGPPL-1.0.json", + "referenceNumber": 112, + "name": "Transitive Grace Period Public Licence 1.0", + "licenseId": "TGPPL-1.0", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/TGPPL", + "https://tahoe-lafs.org/trac/tahoe-lafs/browser/trunk/COPYING.TGPPL.rst" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/threeparttable.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/threeparttable.json", + "referenceNumber": 319, + "name": "threeparttable License", + "licenseId": "threeparttable", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Threeparttable" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TMate.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TMate.json", + "referenceNumber": 509, + "name": "TMate Open Source License", + "licenseId": "TMate", + "seeAlso": [ + "http://svnkit.com/license.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TORQUE-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TORQUE-1.1.json", + "referenceNumber": 105, + "name": "TORQUE v2.5+ Software License v1.1", + "licenseId": "TORQUE-1.1", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/TORQUEv1.1" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TOSL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TOSL.json", + "referenceNumber": 107, + "name": "Trusster Open Source License", + "licenseId": "TOSL", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/TOSL" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TPDL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TPDL.json", + "referenceNumber": 124, + "name": "Time::ParseDate License", + "licenseId": "TPDL", + "seeAlso": [ + "https://metacpan.org/pod/Time::ParseDate#LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TPL-1.0.json", + "referenceNumber": 490, + "name": "THOR Public License 1.0", + "licenseId": "TPL-1.0", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing:ThorPublicLicense" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TTWL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TTWL.json", + "referenceNumber": 35, + "name": "Text-Tabs+Wrap License", + "licenseId": "TTWL", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/TTWL", + "https://github.com/ap/Text-Tabs/blob/master/lib.modern/Text/Tabs.pm#L148" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TTYP0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TTYP0.json", + "referenceNumber": 542, + "name": "TTYP0 License", + "licenseId": "TTYP0", + "seeAlso": [ + "https://people.mpi-inf.mpg.de/~uwe/misc/uw-ttyp0/" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TU-Berlin-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TU-Berlin-1.0.json", + "referenceNumber": 372, + "name": "Technische Universitaet Berlin License 1.0", + "licenseId": "TU-Berlin-1.0", + "seeAlso": [ + "https://github.com/swh/ladspa/blob/7bf6f3799fdba70fda297c2d8fd9f526803d9680/gsm/COPYRIGHT" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/TU-Berlin-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/TU-Berlin-2.0.json", + "referenceNumber": 246, + "name": "Technische Universitaet Berlin License 2.0", + "licenseId": "TU-Berlin-2.0", + "seeAlso": [ + "https://github.com/CorsixTH/deps/blob/fd339a9f526d1d9c9f01ccf39e438a015da50035/licences/libgsm.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Ubuntu-font-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Ubuntu-font-1.0.json", + "referenceNumber": 191, + "name": "Ubuntu Font Licence v1.0", + "licenseId": "Ubuntu-font-1.0", + "seeAlso": [ + "https://ubuntu.com/legal/font-licence", + "https://assets.ubuntu.com/v1/81e5605d-ubuntu-font-licence-1.0.txt" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/UCAR.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/UCAR.json", + "referenceNumber": 452, + "name": "UCAR License", + "licenseId": "UCAR", + "seeAlso": [ + "https://github.com/Unidata/UDUNITS-2/blob/master/COPYRIGHT" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/UCL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/UCL-1.0.json", + "referenceNumber": 550, + "name": "Upstream Compatibility License v1.0", + "licenseId": "UCL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/UCL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/ulem.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ulem.json", + "referenceNumber": 399, + "name": "ulem License", + "licenseId": "ulem", + "seeAlso": [ + "https://mirrors.ctan.org/macros/latex/contrib/ulem/README" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/UMich-Merit.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/UMich-Merit.json", + "referenceNumber": 581, + "name": "Michigan/Merit Networks License", + "licenseId": "UMich-Merit", + "seeAlso": [ + "https://github.com/radcli/radcli/blob/master/COPYRIGHT#L64" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Unicode-3.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Unicode-3.0.json", + "referenceNumber": 262, + "name": "Unicode License v3", + "licenseId": "Unicode-3.0", + "seeAlso": [ + "https://www.unicode.org/license.txt" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Unicode-DFS-2015.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Unicode-DFS-2015.json", + "referenceNumber": 328, + "name": "Unicode License Agreement - Data Files and Software (2015)", + "licenseId": "Unicode-DFS-2015", + "seeAlso": [ + "https://web.archive.org/web/20151224134844/http://unicode.org/copyright.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Unicode-DFS-2016.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Unicode-DFS-2016.json", + "referenceNumber": 484, + "name": "Unicode License Agreement - Data Files and Software (2016)", + "licenseId": "Unicode-DFS-2016", + "seeAlso": [ + "https://www.unicode.org/license.txt", + "http://web.archive.org/web/20160823201924/http://www.unicode.org/copyright.html#License", + "http://www.unicode.org/copyright.html" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/Unicode-TOU.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Unicode-TOU.json", + "referenceNumber": 628, + "name": "Unicode Terms of Use", + "licenseId": "Unicode-TOU", + "seeAlso": [ + "http://web.archive.org/web/20140704074106/http://www.unicode.org/copyright.html", + "http://www.unicode.org/copyright.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/UnixCrypt.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/UnixCrypt.json", + "referenceNumber": 95, + "name": "UnixCrypt License", + "licenseId": "UnixCrypt", + "seeAlso": [ + "https://foss.heptapod.net/python-libs/passlib/-/blob/branch/stable/LICENSE#L70", + "https://opensource.apple.com/source/JBoss/JBoss-737/jboss-all/jetty/src/main/org/mortbay/util/UnixCrypt.java.auto.html", + "https://archive.eclipse.org/jetty/8.0.1.v20110908/xref/org/eclipse/jetty/http/security/UnixCrypt.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Unlicense.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Unlicense.json", + "referenceNumber": 218, + "name": "The Unlicense", + "licenseId": "Unlicense", + "seeAlso": [ + "https://unlicense.org/" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/UPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/UPL-1.0.json", + "referenceNumber": 5, + "name": "Universal Permissive License v1.0", + "licenseId": "UPL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/UPL" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/URT-RLE.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/URT-RLE.json", + "referenceNumber": 165, + "name": "Utah Raster Toolkit Run Length Encoded License", + "licenseId": "URT-RLE", + "seeAlso": [ + "https://sourceforge.net/p/netpbm/code/HEAD/tree/super_stable/converter/other/pnmtorle.c", + "https://sourceforge.net/p/netpbm/code/HEAD/tree/super_stable/converter/other/rletopnm.c" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Vim.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Vim.json", + "referenceNumber": 549, + "name": "Vim License", + "licenseId": "Vim", + "seeAlso": [ + "http://vimdoc.sourceforge.net/htmldoc/uganda.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/VOSTROM.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/VOSTROM.json", + "referenceNumber": 544, + "name": "VOSTROM Public License for Open Source", + "licenseId": "VOSTROM", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/VOSTROM" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/VSL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/VSL-1.0.json", + "referenceNumber": 109, + "name": "Vovida Software License v1.0", + "licenseId": "VSL-1.0", + "seeAlso": [ + "https://opensource.org/licenses/VSL-1.0" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/W3C.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/W3C.json", + "referenceNumber": 28, + "name": "W3C Software Notice and License (2002-12-31)", + "licenseId": "W3C", + "seeAlso": [ + "http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231.html", + "https://opensource.org/licenses/W3C" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/W3C-19980720.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/W3C-19980720.json", + "referenceNumber": 629, + "name": "W3C Software Notice and License (1998-07-20)", + "licenseId": "W3C-19980720", + "seeAlso": [ + "http://www.w3.org/Consortium/Legal/copyright-software-19980720.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/W3C-20150513.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/W3C-20150513.json", + "referenceNumber": 315, + "name": "W3C Software Notice and Document License (2015-05-13)", + "licenseId": "W3C-20150513", + "seeAlso": [ + "https://www.w3.org/Consortium/Legal/2015/copyright-software-and-document", + "https://www.w3.org/copyright/software-license-2015/", + "https://www.w3.org/copyright/software-license-2023/" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/w3m.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/w3m.json", + "referenceNumber": 379, + "name": "w3m License", + "licenseId": "w3m", + "seeAlso": [ + "https://github.com/tats/w3m/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Watcom-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Watcom-1.0.json", + "referenceNumber": 612, + "name": "Sybase Open Watcom Public License 1.0", + "licenseId": "Watcom-1.0", + "seeAlso": [ + "https://opensource.org/licenses/Watcom-1.0" + ], + "isOsiApproved": true, + "isFsfLibre": false + }, + { + "reference": "https://spdx.org/licenses/Widget-Workshop.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Widget-Workshop.json", + "referenceNumber": 256, + "name": "Widget Workshop License", + "licenseId": "Widget-Workshop", + "seeAlso": [ + "https://github.com/novnc/noVNC/blob/master/core/crypto/des.js#L24" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Wsuipa.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Wsuipa.json", + "referenceNumber": 199, + "name": "Wsuipa License", + "licenseId": "Wsuipa", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Wsuipa" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/WTFPL.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/WTFPL.json", + "referenceNumber": 173, + "name": "Do What The F*ck You Want To Public License", + "licenseId": "WTFPL", + "seeAlso": [ + "http://www.wtfpl.net/about/", + "http://sam.zoy.org/wtfpl/COPYING" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/wxWindows.html", + "isDeprecatedLicenseId": true, + "detailsUrl": "https://spdx.org/licenses/wxWindows.json", + "referenceNumber": 350, + "name": "wxWindows Library License", + "licenseId": "wxWindows", + "seeAlso": [ + "https://opensource.org/licenses/WXwindows" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/X11.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/X11.json", + "referenceNumber": 274, + "name": "X11 License", + "licenseId": "X11", + "seeAlso": [ + "http://www.xfree86.org/3.3.6/COPYRIGHT2.html#3" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/X11-distribute-modifications-variant.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/X11-distribute-modifications-variant.json", + "referenceNumber": 286, + "name": "X11 License Distribution Modification Variant", + "licenseId": "X11-distribute-modifications-variant", + "seeAlso": [ + "https://github.com/mirror/ncurses/blob/master/COPYING" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/X11-swapped.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/X11-swapped.json", + "referenceNumber": 7, + "name": "X11 swapped final paragraphs", + "licenseId": "X11-swapped", + "seeAlso": [ + "https://github.com/fedeinthemix/chez-srfi/blob/master/srfi/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Xdebug-1.03.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Xdebug-1.03.json", + "referenceNumber": 471, + "name": "Xdebug License v 1.03", + "licenseId": "Xdebug-1.03", + "seeAlso": [ + "https://github.com/xdebug/xdebug/blob/master/LICENSE" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Xerox.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Xerox.json", + "referenceNumber": 417, + "name": "Xerox License", + "licenseId": "Xerox", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Xerox" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Xfig.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Xfig.json", + "referenceNumber": 63, + "name": "Xfig License", + "licenseId": "Xfig", + "seeAlso": [ + "https://github.com/Distrotech/transfig/blob/master/transfig/transfig.c", + "https://fedoraproject.org/wiki/Licensing:MIT#Xfig_Variant", + "https://sourceforge.net/p/mcj/xfig/ci/master/tree/src/Makefile.am" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/XFree86-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/XFree86-1.1.json", + "referenceNumber": 311, + "name": "XFree86 License 1.1", + "licenseId": "XFree86-1.1", + "seeAlso": [ + "http://www.xfree86.org/current/LICENSE4.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/xinetd.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/xinetd.json", + "referenceNumber": 406, + "name": "xinetd License", + "licenseId": "xinetd", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Xinetd_License" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/xkeyboard-config-Zinoviev.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/xkeyboard-config-Zinoviev.json", + "referenceNumber": 55, + "name": "xkeyboard-config Zinoviev License", + "licenseId": "xkeyboard-config-Zinoviev", + "seeAlso": [ + "https://gitlab.freedesktop.org/xkeyboard-config/xkeyboard-config/-/blob/master/COPYING?ref_type\u003dheads#L178" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/xlock.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/xlock.json", + "referenceNumber": 140, + "name": "xlock License", + "licenseId": "xlock", + "seeAlso": [ + "https://fossies.org/linux/tiff/contrib/ras/ras2tif.c" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Xnet.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Xnet.json", + "referenceNumber": 639, + "name": "X.Net License", + "licenseId": "Xnet", + "seeAlso": [ + "https://opensource.org/licenses/Xnet" + ], + "isOsiApproved": true + }, + { + "reference": "https://spdx.org/licenses/xpp.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/xpp.json", + "referenceNumber": 243, + "name": "XPP License", + "licenseId": "xpp", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/xpp" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/XSkat.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/XSkat.json", + "referenceNumber": 535, + "name": "XSkat License", + "licenseId": "XSkat", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/XSkat_License" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/xzoom.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/xzoom.json", + "referenceNumber": 339, + "name": "xzoom License", + "licenseId": "xzoom", + "seeAlso": [ + "https://metadata.ftp-master.debian.org/changelogs//main/x/xzoom/xzoom_0.3-27_copyright" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/YPL-1.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/YPL-1.0.json", + "referenceNumber": 506, + "name": "Yahoo! Public License v1.0", + "licenseId": "YPL-1.0", + "seeAlso": [ + "http://www.zimbra.com/license/yahoo_public_license_1.0.html" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/YPL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/YPL-1.1.json", + "referenceNumber": 538, + "name": "Yahoo! Public License v1.1", + "licenseId": "YPL-1.1", + "seeAlso": [ + "http://www.zimbra.com/license/yahoo_public_license_1.1.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Zed.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Zed.json", + "referenceNumber": 500, + "name": "Zed License", + "licenseId": "Zed", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/Zed" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Zeeff.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Zeeff.json", + "referenceNumber": 382, + "name": "Zeeff License", + "licenseId": "Zeeff", + "seeAlso": [ + "ftp://ftp.tin.org/pub/news/utils/newsx/newsx-1.6.tar.gz" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Zend-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Zend-2.0.json", + "referenceNumber": 51, + "name": "Zend License v2.0", + "licenseId": "Zend-2.0", + "seeAlso": [ + "https://web.archive.org/web/20130517195954/http://www.zend.com/license/2_00.txt" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Zimbra-1.3.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Zimbra-1.3.json", + "referenceNumber": 555, + "name": "Zimbra Public License v1.3", + "licenseId": "Zimbra-1.3", + "seeAlso": [ + "http://web.archive.org/web/20100302225219/http://www.zimbra.com/license/zimbra-public-license-1-3.html" + ], + "isOsiApproved": false, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/Zimbra-1.4.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Zimbra-1.4.json", + "referenceNumber": 227, + "name": "Zimbra Public License v1.4", + "licenseId": "Zimbra-1.4", + "seeAlso": [ + "http://www.zimbra.com/legal/zimbra-public-license-1-4" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/Zlib.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/Zlib.json", + "referenceNumber": 74, + "name": "zlib License", + "licenseId": "Zlib", + "seeAlso": [ + "http://www.zlib.net/zlib_license.html", + "https://opensource.org/licenses/Zlib" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/zlib-acknowledgement.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/zlib-acknowledgement.json", + "referenceNumber": 371, + "name": "zlib/libpng License with Acknowledgement", + "licenseId": "zlib-acknowledgement", + "seeAlso": [ + "https://fedoraproject.org/wiki/Licensing/ZlibWithAcknowledgement" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ZPL-1.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ZPL-1.1.json", + "referenceNumber": 598, + "name": "Zope Public License 1.1", + "licenseId": "ZPL-1.1", + "seeAlso": [ + "http://old.zope.org/Resources/License/ZPL-1.1" + ], + "isOsiApproved": false + }, + { + "reference": "https://spdx.org/licenses/ZPL-2.0.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ZPL-2.0.json", + "referenceNumber": 539, + "name": "Zope Public License 2.0", + "licenseId": "ZPL-2.0", + "seeAlso": [ + "http://old.zope.org/Resources/License/ZPL-2.0", + "https://opensource.org/licenses/ZPL-2.0" + ], + "isOsiApproved": true, + "isFsfLibre": true + }, + { + "reference": "https://spdx.org/licenses/ZPL-2.1.html", + "isDeprecatedLicenseId": false, + "detailsUrl": "https://spdx.org/licenses/ZPL-2.1.json", + "referenceNumber": 638, + "name": "Zope Public License 2.1", + "licenseId": "ZPL-2.1", + "seeAlso": [ + "http://old.zope.org/Resources/ZPL/" + ], + "isOsiApproved": true, + "isFsfLibre": true + } + ], + "releaseDate": "2024-08-19" +} diff --git a/project-cabal/ghc-latest.config b/project-cabal/ghc-latest.config index bff5d80c241..96042ad583b 100644 --- a/project-cabal/ghc-latest.config +++ b/project-cabal/ghc-latest.config @@ -8,5 +8,17 @@ -- NOTE: don't forget to update the compiler version in the conditional -- when upgrading to a newer GHC -if impl(ghc >= 9.8.1) - -- allow-newer: windns:* +if impl(ghc >= 9.12.0) + allow-newer: + --windns:*, rere:*, tree-diff:*, uuid-types:*, these:*, assoc:*, semialign:*, indexed-traversable-instances:*, indexed-traversable:*, OneTuple:*, scientific:*, time-compat:*, text-short:*, integer-conversion:*, generically:*, data-fix:*, binary:* + -- Artem, 2024-04-21: I started and then gave up... + *:base, *:template-haskell, text-short, *:deepseq, *:bytestring, *:ghc-prim + +-- repository head.hackage.ghc.haskell.org +-- url: https://ghc.gitlab.haskell.org/head.hackage/ +-- secure: True +-- key-threshold: 3 +-- root-keys: +-- 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329 +-- 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d +-- f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89 diff --git a/project-cabal/pkgs/tests.config b/project-cabal/pkgs/tests.config index a9cec9c596f..75fe4af5ad7 100644 --- a/project-cabal/pkgs/tests.config +++ b/project-cabal/pkgs/tests.config @@ -2,3 +2,4 @@ packages: Cabal-QuickCheck , Cabal-tests , Cabal-tree-diff + , cabal-validate diff --git a/release-notes/Cabal-3.10.1.0.md b/release-notes/Cabal-3.10.1.0.md index 02824484dae..c67c00cbe68 100644 --- a/release-notes/Cabal-3.10.1.0.md +++ b/release-notes/Cabal-3.10.1.0.md @@ -46,7 +46,7 @@ are listed here. - Add `PackageInfo_` module [#8534](https://github.com/haskell/cabal/pull/8534) - - Add `PackageInfo_` module to embed portable package-related informations (issue #3909) + - Add `PackageInfo_` module to embed portable package-related information (issue #3909) - *Cabal-syntax* Add language extensions `DeepSubsumption` and `TypeData` [#8493](https://github.com/haskell/cabal/pull/8493) diff --git a/release-notes/Cabal-3.12.0.0.md b/release-notes/Cabal-3.12.0.0.md index f177338c6ec..e766ef22a01 100644 --- a/release-notes/Cabal-3.12.0.0.md +++ b/release-notes/Cabal-3.12.0.0.md @@ -36,8 +36,8 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes package *without* having previously built the dependency. Instead, we promise to the configure phase that we will have built it by the time we build the package. This allows us to configure all the packages we intend - to load into the repl without building any dependenices which we will load - in the same session, because the promise is satisifed due to loading the + to load into the repl without building any dependencies which we will load + in the same session, because the promise is satisfied due to loading the package and its dependency into one multi-session which ensures the dependency is built before it is needed. @@ -55,7 +55,7 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes `filterPackageChecksById`, this can be used by third-party tools to filter warnings. -- Add support for `GHC2024` [#9736](https://github.com/haskell/cabal/issues/9736) +- Add support for `GHC2024` [#9736](https://github.com/haskell/cabal/issues/9736) [#9791](https://github.com/haskell/cabal/pull/9791) Support for the `GHC2024` language edition, introduced by GHC 9.10, has been added. It can now be used in the `default-language` and `other-languages` @@ -67,7 +67,7 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes prone, as `initialBuildSteps` only handles things like the paths module and nothing else. - To mimick `initialBuildSteps` behaviour when there is no custom Setup, you + To mimic `initialBuildSteps` behaviour when there is no custom Setup, you can call `repl_setupHooks`. If you are dealing with a custom setup, you have to invoke @@ -77,14 +77,54 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes Support for all previous GHC versions is deprecated. +- Label error messages with codes (following GHC, Stack) + + As with GHC and Stack, Cabal and cabal-install now generate warnings and errors prefixed with error codes of the form `[Cabal-xxxxx]`. These will be documented on https://errors.haskell.org, although very few are as yet. + ### Other changes -- `cabal init` should not suggest Cabal < 2.0 [#8680](https://github.com/haskell/cabal/issues/8680) +- Installing a library with a Custom setup no longer requires building the executable [#9777](https://github.com/haskell/cabal/issues/9777) [#9650](https://github.com/haskell/cabal/pull/9650) [#10311](https://github.com/haskell/cabal/pull/10311) + + For example, if we have `pkg-a.cabal`: + + ``` + library + build-depends: pkg-b + ``` + + and `pkg-b.cabal`: + + ``` + library + exposed-modules: ... + + executable pkg-b-exe + main-is: ... + ``` + + + An invocation `cabal build pkg-a` will build `lib:pkg-a` and `lib:pkg-b`, but + not `exe:pkg-b-exe` because it is not needed for building `pkg-a`! Previously the executable would be built unnecessarily. + + If the invocation were `cabal build pkg-a exe:pkg-b-exe` then all `lib:pkg-a`, `lib:pkg-b`, and `exe:pkg-b-exe` would be built. + + Note: There may be a package whose Custom setup expects the executable to be + built together with the library always. Unfortunately, this is a breaking + change for them. To migrate, packages should no longer assume the executable is + built when only the library is requested (e.g. `cabal install --lib Agda` will + *not* build the `Agda` executable, while `cabal install Agda` will). + + Agda is an example of a package which expected in its `Setup.hs` copy hook the + executable to already be built. This was fixed by inspecting the copy arguments + and making sure we only use the executable when it is built, since it is only + needed when the executable too is needed. + +- `cabal init` should not suggest Cabal < 2.0 [#8680](https://github.com/haskell/cabal/issues/8680) [#8700](https://github.com/haskell/cabal/pull/8700) 'cabal init' no longer suggests users to set cabal-version to less than 2.0. -- Remove Distribution.Utils.TempTestDir module from Cabal library [#9453](https://github.com/haskell/cabal/issues/9453) [#9454](https://github.com/haskell/cabal/pull/9454) +- Remove `Distribution.Utils.TempTestDir` module from Cabal library [#9453](https://github.com/haskell/cabal/issues/9453) [#9454](https://github.com/haskell/cabal/pull/9454) This library was only used by internal tests, and now lives in the `Cabal-tests` library which is shared across test components. @@ -104,13 +144,13 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes large file can reduce overall compile times. 2. Breaking up the module allows dependent modules to refine their imports to just the parts they require, allowing them to start buildling quicker - when GHC is run in parrallel make mode ('--ghc-options -j'). + when GHC is run in parallel make mode ('--ghc-options -j'). - Reimplementing `cabal check` [#7423](https://github.com/haskell/cabal/issues/7423) [#8427](https://github.com/haskell/cabal/pull/8427) - `checkPackage` signature has been simplified, you do not need to pass a specific configuration of the package, since - we do not flatten GenericPackageDescription any more. + we do not flatten `GenericPackageDescription` any more. - `checkPackageFileNames` has been removed, use `checkPackageFiles` instead. - `checkPackageFilesGPD` has been introduced, @@ -122,11 +162,11 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes GHC plugins now can store custom data in the 'extra-compilation-artifacts' directory which gets installed with the package. -- Add option to ./Setup repl to write repl arguments to file [#8726](https://github.com/haskell/cabal/pull/8726) +- Add option to `./Setup repl` to write repl arguments to file [#8726](https://github.com/haskell/cabal/pull/8726) The `./Setup repl` command is modified to allow a user to defer starting the repl and instead instruct the command to write the necessary build - flags to a directiory. The option is called `--repl-multi-file `. + flags to a directory. The option is called `--repl-multi-file `. This is useful when starting multi-component sessions, as we want to query Setup.hs for the arguments which are needed to build each component but @@ -137,7 +177,7 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes Cabal: Distribution now recognises Haiku as a valid platform, and also implements Haiku's unique directory layout. -- Installation of .hie files [#8685](https://github.com/haskell/cabal/issues/8685) [#9019](https://github.com/haskell/cabal/pull/9019) +- Installation of `.hie` files [#8685](https://github.com/haskell/cabal/issues/8685) [#9019](https://github.com/haskell/cabal/pull/9019) Hie files generated by GHC are now stored in the `extra-compilation-artifacts` directory which gets installed with the @@ -180,7 +220,7 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes - Document `remote-repo-cache` as implemented. [#8737](https://github.com/haskell/cabal/issues/8737) [#8738](https://github.com/haskell/cabal/pull/8738) -- Deduplicate LD_LIBRARY_PATH when running tests [#8728](https://github.com/haskell/cabal/pull/8728) +- Deduplicate `LD_LIBRARY_PATH` when running tests [#8728](https://github.com/haskell/cabal/pull/8728) - Add support for a number of architectures: @@ -190,7 +230,7 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes - Don't report `index.html` file as created, if not created by Haddock [#5120](https://github.com/haskell/cabal/issues/5120) [#9332](https://github.com/haskell/cabal/pull/9332) -- Enable using $ORIGIN in RPATH on GNU/Hurd [#9441](https://github.com/haskell/cabal/pull/9441) +- Enable using `$ORIGIN` in `RPATH` on GNU/Hurd [#9441](https://github.com/haskell/cabal/pull/9441) - Make check comply with Hackage requirements [#8897](https://github.com/haskell/cabal/pull/8897) @@ -198,13 +238,11 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes - `cabal check` will only return exitcode 1 when the package is not fit for Hackage. E.g. it will not error anymore when your `synopsis:` is larger than `description:`, just emit a warning. - - Cabal: Distribution.Client.Check now exports `isHackageDistError`, for + - Cabal: `Distribution.Client.Check` now exports `isHackageDistError`, for third-party tools to know if a specific error will preclude a package from being uploaded to Hacakge. -- Add language extension `ExtendedLiterals` [#8992](https://github.com/haskell/cabal/pull/8992) - - Adds support for the `ExtendedLiterals` language extension (GHC proposal #451) +- Add language extension `ExtendedLiterals` (GHC proposal #451) [#8992](https://github.com/haskell/cabal/pull/8992) - Warn about inconsistent indentation [#8975](https://github.com/haskell/cabal/pull/8975) @@ -226,7 +264,7 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes That behavior is desirable to parsing multiline field contents, but it is a bit surprising for fields in sections, which we expect to be aligned. - Such insonsistency seems to be always a mistake, and it's easy to fix once + Such inconsistency seems to be always a mistake, and it's easy to fix once a machine points it out. - Add `LexBraces` lexer warning [#8577](https://github.com/haskell/cabal/issues/8577) @@ -253,9 +291,7 @@ Cabal and Cabal-syntax 3.12.0.0 changelog and release notes `cabal` invokes `pkg-config` individually for each lib if querying for all doesn't return the expected result -- Add language extension `ListTuplePuns` [#8854](https://github.com/haskell/cabal/pull/8854) - - Adds support for the `ListTuplePuns` language extension (GHC proposal #475) +- Add language extension `ListTuplePuns` (GHC proposal #475) [#8854](https://github.com/haskell/cabal/pull/8854) - Add `mkVersionIntervals` for creating a `VersionIntervals` from a list [#9034](https://github.com/haskell/cabal/pull/9034) diff --git a/release-notes/Cabal-3.12.1.0.md b/release-notes/Cabal-3.12.1.0.md new file mode 100644 index 00000000000..8f37e2c0454 --- /dev/null +++ b/release-notes/Cabal-3.12.1.0.md @@ -0,0 +1,54 @@ +Cabal and Cabal-syntax 3.12.1.0 changelog and release notes +--- + + +### Significant changes + +- Update GHC arguments normalization and GHC options rendering [#9729](https://github.com/haskell/cabal/issues/9729) [#10014](https://github.com/haskell/cabal/pull/10014) + + The flags `-fdiagnostics-as-json`, `-fprint-error-index-lists`, `-fbreak-points`, `-dipe-stats`, `-ffamily-application-cache`, `-fprint-redundant-promotion-ticks`, `-fshow-error-context` and `-funoptimized-core-for-interpreter` have been added to the flags that do not cause recompilation. + +- Warn on missing `default-language` [#9620](https://github.com/haskell/cabal/issues/9620) [#9766](https://github.com/haskell/cabal/pull/9766) + + - To help the adoption of GHC language editions, `cabal check` will now + warn about missing `default-language`. + +- Add MHS ([MicroHS](https://github.com/augustss/MicroHs)) as a known Haskell compiler [#9878](https://github.com/haskell/cabal/pull/9878) + +- Re-instate `initialBuildSteps` [#9856](https://github.com/haskell/cabal/issues/9856) [#9950](https://github.com/haskell/cabal/pull/9950) + + The `initialBuildSteps` function from `Distribution.Simple.Build`, which had + been hastily removed, has been reinstated. + + It now comes with a deprecation warning: calling that function does not suffice + to prepare the sources for a package, as there are other steps that one might + also need to perform: + + - running pre-processors (such as alex/happy); + - running pre-build hooks or custom logic + (in build-type: Hooks or build-type: Custom or Configure). + + Consumers wanting to prepare the sources of a package, e.g. in order to launch a + REPL session, are advised to run `setup repl --repl-multi-file=` instead. + +- Label error messages with codes (following GHC, Stack) + + As with GHC and Stack, Cabal and cabal-install now generate warnings and errors prefixed with error codes of the form `[Cabal-xxxxx]`. These will be documented on https://errors.haskell.org, although very few are as yet. + + This change was actually present in Cabal-3.12.0.0, but was inadvertently omitted from the changelog. + +### Other changes + +- Don't recommend deprecated/removed `extensions` field [#10042](https://github.com/haskell/cabal/issues/10042) [#10044](https://github.com/haskell/cabal/pull/10044) + + When applicable, field `default-extensions` is recommended (rather than + deprecated/removed `extensions:`). + +- Make `Setup copy` and `Setup install` succeed when there's no executable or library [#6750](https://github.com/haskell/cabal/issues/6750) [#9926](https://github.com/haskell/cabal/pull/9926) + + Historically the Setup copy and install steps would fail if the package didn't + contain an executable or library component. In this case there's nothing to do. + + This required workarounds for downstream users of Cabal to handle this edge case. + Now that this error has been downgraded to a warning, Cabal will succeed if + there's nothing to do. diff --git a/release-notes/Cabal-3.14.0.0.md b/release-notes/Cabal-3.14.0.0.md new file mode 100644 index 00000000000..d12bff98517 --- /dev/null +++ b/release-notes/Cabal-3.14.0.0.md @@ -0,0 +1,213 @@ +Cabal and Cabal-syntax 3.14.0.0 changelog and release notes +--- + + +### Significant changes + +- Neutral field to add files to sdist [#8817](https://github.com/haskell/cabal/issues/8817) [#10107](https://github.com/haskell/cabal/pull/10107) + + Adds the `extra-files` field to the cabal file specification. This is like + the other `extra-*` fields in that it is copied with the `sdist` command, + except there are no other semantics. Compare to: + + * `extra-source-files`: Tracked by `cabal build`. + + * `extra-doc-files`: Copied by Haddock to the html directory. + +- Include package version when passing `--promised-dependency` flag [#10166](https://github.com/haskell/cabal/issues/10166) [#10248](https://github.com/haskell/cabal/pull/10248) + + The `--promised-dependency` flag now expects an argument in the format + + ``` + NAME-VER[:COMPONENT_NAME]=CID + ``` + + rather than + + ``` + NAME[:COMPONENT_NAME]=CID + ``` + +- Add support for building profiled dynamic way [#4816](https://github.com/haskell/cabal/issues/4816) [#9900](https://github.com/haskell/cabal/pull/9900) + + Add support for profiled dynamic way + + New options for `cabal.project` and `./Setup` interface: + + * `profiling-shared`: Enable building profiling dynamic way + * Passing `--enable-profiling` and `--enable-executable-dynamic` builds + profiled dynamic executables. + + Support for using `profiling-shared` is guarded behind a constraint + which ensures you are using `Cabal >= 3.13`. + + In the cabal file: + + * `ghc-prof-shared-options`, for passing options when building in + profiling dynamic way + +- Working directory support for `Cabal` [#9702](https://github.com/haskell/cabal/issues/9702) [#9718](https://github.com/haskell/cabal/pull/9718) + + The `Cabal` library is now able to handle a passed-in working directory, instead + of always relying on the current working directory of the parent process. + + In order to achieve this, the `SymbolicPath` abstraction was fleshed out, and + all fields of `PackageDescription` that, if relative, should be interpreted + with respect to e.g. the package root, use `SymbolicPath` instead of `FilePath`. + + This means that many library functions in `Cabal` take an extra argument of type + `Maybe (SymbolicPath CWD (Dir "Package"))`, which is an optional (relative or + absolute) path to the package root (if relative, relative to the current working + directory). In addition, many functions that used to manipulate `FilePath`s now + manipulate `SymbolicPath`s, require explicit conversion using e.g. `getSymbolicPath`. + + To illustrate with file searching, the `Cabal` library defines: + + ```haskell + findFileCwd + :: forall dir1 dir2 file + . Verbosity + -> Maybe (SymbolicPath CWD (Dir dir1)) + + -> [SymbolicPath dir1 (Dir dir2)] + + -> RelativePath dir2 File + + -> IO (SymbolicPath dir1 File) + ``` + + See Note [Symbolic paths] in `Distribution.Utils.Path` for further information + on the design of this API. + +- Add `MultilineStrings` extension (GHC proposal #637) [#10245](https://github.com/haskell/cabal/pull/10245) + +- Add `NamedDefaults` extension (GHC proposal #409) [#9740](https://github.com/haskell/cabal/pull/9740) + +- Add `OrPatterns` extension (GHC proposal #958) [#10339](https://github.com/haskell/cabal/pull/10339) + + +### Other changes + +- Add flag `--ignore-build-tools` [#10128](https://github.com/haskell/cabal/pull/10128) + + - Adds flag `--ignore-build-tools` which allows a user to ignore the tool + dependencies declared in `build-tool-depends`. For general use, this flag + should never be needed, but it may be useful for packagers. + +- Do not try to build dynamic executables on Windows [#10217](https://github.com/haskell/cabal/pull/10217) + + - Cabal will now exit with a descriptive error message instead of attempting to + build a dynamic executable on Windows. + +- Always pass `ghc-options` to GHC [#8717](https://github.com/haskell/cabal/pull/8717) + + Previously, options set in the package field `ghc-options` would not be passed + to GHC during the link phase for shared objects (where multiple `.o` or + `.dyn_o` files are merged into a single object file). This made it impossible + to use `ghc-options` to use a different linker by setting (for example) + `ghc-options: -optl-fuse-ld=mold -optlm-fuse-ld=mold`; the options would be + dropped in the link phase, falling back to the default linker. + + It was possible to work around this by duplicating the `ghc-options` to + `ghc-shared-options`, which _are_ passed in the shared link phase, but that had + the undocumented and unfortunate side-effect of disabling the GHC + `-dynamic-too` flag, effectively doubling compilation times when + `ghc-shared-options` are set. + + Now, `ghc-options` are combined with `ghc-shared-options` (to accurately + reflect the documentation on this feature) and the fact that + `ghc-shared-options` disables `-dynamic-too` is documented. + +- Introduce `SetupHooks` [#9551](https://github.com/haskell/cabal/pull/9551) + + Introduction of a new build type: `Hooks`. + This build type, intended to eventually replace the `Custom` build type, integrates + better with the rest of the ecosystem (`cabal-install`, Haskell Language Server). + + The motivation and full design of this new build-type are specified in the + Haskell Foundation Tech Proposal + [Replacing the Cabal Custom build-type](https://github.com/haskellfoundation/tech-proposals/pull/60). + + Package authors willing to use this feature should declare `cabal-version: 3.14` and `build-type: Hooks` + in their `.cabal` file, declare a `custom-setup` stanza with a dependency on the + `Cabal-hooks` package, and define a module `SetupHooks` that exports a value + `setupHooks :: SetupHooks`, using the API exported by `Distribution.Simple.SetupHooks` + from the `Cabal-hooks` package. Refer to the Haddock documentation of + `Distribution.Simple.SetupHooks` for example usage. + +- Redefine `build-type: Configure` in terms of `Hooks` [#9969](https://github.com/haskell/cabal/pull/9969) + + The `build-type: Configure` is now implemented in terms of `build-type: Hooks` + rather than in terms of `build-type: Custom`. This moves the `Configure` + build-type away from the `Custom` issues. Eventually, `build-type: Hooks` will + no longer imply packages are built in legacy-fallback mode. When that + happens, `Configure` will also stop implying `legacy-fallback`. + + The observable aspect of this change is `runConfigureScript` now having a + different type, and `autoconfSetupHooks` being exposed by `Distribution.Simple`. + The former is motivated by internal implementation details, while the latter + provides the `SetupHooks` value for the `Configure` build type, which can be + consumed by other `Hooks` clients (e.g. eventually HLS). + +- Cabal can issue a number of error messages referencing "Setup configure", + but it simply references "configure" which could mean any of three + things (Setup configure, the package's "configure" script, or "cabal + configure"). This has recently caught out even Cabal devs. Clarify these + messages. [#9476](https://github.com/haskell/cabal/pull/9476) + +- In [#9718](https://github.com/haskell/cabal/pull/9718) constructors + `PackageDB`: `GlobalPackageDB`, `UserPackageDB`, `SpecificPackageDB` have + been moved to an auxiliary datatatype `PackageDBX`. + + Change imports: + + ```haskell + import Distribution.Simple.Compiler + (PackageDB, PackageDBX (GlobalPackageDB, + UserPackageDB, + SpecificPackageDB)) + ``` + + - **Fields of `ConfigFlags`, `BuildFlags`, `InstallFlags`, `TestFlags`, + `BenchmarkFlags`, `HaddockFlags`, `HscolourFlags`, `SDistFlags`, + `CopyFlags`, `RegisterFlags`, `CleanFlags`, `ReplFlags`** + + These fields have partially moved to `CommonFlags`. Use corresponding + pattern synonyms and/or Monoid instance of `CommonSetupFlags`. + + Example for haddock command: + + ```diff + import Distribution.Simple.Setup (HaddockFlags(..)) + +import Distribution.Simple.Setup.Common (CommonSetupFlags(..)) + + example = + someHaddockFlags + - { haddockVerbosity = a + - , haddockTargets = b + + { haddockCommonFlags = mempty + + { setupVerbosity = a + + , setupTargets = b + + } + } + ``` + + - **Additions to `SymbolicPath`, `RelativePath`** + + Module + [Distribution.Utils.Path](https://hackage.haskell.org/package/Cabal-syntax-3.14.0.0/docs/Distribution-Utils-Path.html), + now provides more nuanced API that Cabal uses to keep track of filepath + locations. (Hopefully, avoiding confusion which things should go where and + how.) + + In your specific circumstance, you'll need to decide how much of that nuance + to keep. The function `getSymbolicPath` discards all of it, getting back the + raw `FilePath`; but see the linked module's haddocks for caveats and less + drastic options. + + It may help to introduce a `CompatSymPath` typeclass. + +- Update the SPDX License List to version 3.25 + + The LicenseId and LicenseExceptionId types are updated to reflect the SPDX + License List version 3.25 (2024-08-19). diff --git a/release-notes/Cabal-3.14.1.0.md b/release-notes/Cabal-3.14.1.0.md new file mode 100644 index 00000000000..d4b32811c5f --- /dev/null +++ b/release-notes/Cabal-3.14.1.0.md @@ -0,0 +1,198 @@ +## Cabal and Cabal-syntax 3.14.0.0 & 3.14.1.0 changelog + +For reasons of discoverability, the changelog of Cabal & Cabal-syntax 3.14.0.0 is also included in this file, since that version had been released for the benefit of GHC 9.12's release process. + +### Significant changes + +- Fix build ways for modules in executables [#10418](https://github.com/haskell/cabal/issues/10418) [#10419](https://github.com/haskell/cabal/pull/10419) + + - Modules belonging to executables were being built in too many ways. For instance, if you + had configured to build profiled library files then your executable modules would also + be built profiled. Which was a regression in behaviour since `Cabal-3.12`. + +- Fix ./setup install command [#10416](https://github.com/haskell/cabal/issues/10416) [#10417](https://github.com/haskell/cabal/pull/10417) + + - `./setup install` was failing with a `fromFlag NoFlag` error. It is now fixed. + +- Neutral field to add files to sdist [#8817](https://github.com/haskell/cabal/issues/8817) [#10107](https://github.com/haskell/cabal/pull/10107) + + Adds the `extra-files` field to the cabal file specification. This is like + the other `extra-*` fields in that it is copied with the `sdist` command, + except there are no other semantics. Compare to: + + * `extra-source-files`: Tracked by `cabal build`. + + * `extra-doc-files`: Copied by Haddock to the html directory. + +### Other changes + +- Add new options from ghc 9.12 [#10468](https://github.com/haskell/cabal/pull/10468) + + - ghc 9.12 adds several new command line options, divided between + `LANGUAGE`s (already added), warnings, new preprocessor control options, + and compilation control options. Two options needed to be added to the + list of options requiring `Int` parameters. + + The new options, excluding warning and language options, are: + + * `-fexpose-overloaded-unfoldings` + * `-fmax-forced-spec-args=N` + * `-fno-expose-overloaded-unfoldings` + * `-fno-object-determinism` + * `-fobject-determinism` + * `-fwrite-if-compression=N` + * `-optCmmP…` + * `-optJSP…` + * `-pgmCmmP` + * `-pgmJSP` + + As they all affect compilation and store hashes, the only necessary + change was to list the two numeric options so they will be parsed + correctly. To the best of our understanding, `-pgm*` and `-opt*` + options are already handled as a group. + +- Include package version when passing `--promised-dependency` flag [#10166](https://github.com/haskell/cabal/issues/10166) [#10248](https://github.com/haskell/cabal/pull/10248) + + The `--promised-dependency` flag now expects an argument in the format + + ``` + NAME-VER[:COMPONENT_NAME]=CID + ``` + + rather than + + ``` + NAME[:COMPONENT_NAME]=CID + ``` + +- Add support for building profiled dynamic way [#4816](https://github.com/haskell/cabal/issues/4816) [#9900](https://github.com/haskell/cabal/pull/9900) + + Add support for profiled dynamic way + + New options for `cabal.project` and `./Setup` interface: + + * `profiling-shared`: Enable building profiling dynamic way + * Passing `--enable-profiling` and `--enable-executable-dynamic` builds + profiled dynamic executables. + + Support for using `profiling-shared` is guarded behind a constraint + which ensures you are using `Cabal >= 3.13`. + + In the cabal file: + + * `ghc-prof-shared-options`, for passing options when building in + profiling dynamic way + +- Working directory support for `Cabal` [#9702](https://github.com/haskell/cabal/issues/9702) [#9718](https://github.com/haskell/cabal/pull/9718) + + The `Cabal` library is now able to handle a passed-in working directory, instead + of always relying on the current working directory of the parent process. + + In order to achieve this, the `SymbolicPath` abstraction was fleshed out, and + all fields of `PackageDescription` that, if relative, should be interpreted + with respect to e.g. the package root, use `SymbolicPath` instead of `FilePath`. + + This means that many library functions in `Cabal` take an extra argument of type + `Maybe (SymbolicPath CWD (Dir "Package"))`, which is an optional (relative or + absolute) path to the package root (if relative, relative to the current working + directory). In addition, many functions that used to manipulate `FilePath`s now + manipulate `SymbolicPath`s, require explicit conversion using e.g. `getSymbolicPath`. + + To illustrate with file searching, the `Cabal` library defines: + + ```haskell + findFileCwd + :: forall dir1 dir2 file + . Verbosity + -> Maybe (SymbolicPath CWD (Dir dir1)) + + -> [SymbolicPath dir1 (Dir dir2)] + + -> RelativePath dir2 File + + -> IO (SymbolicPath dir1 File) + ``` + + See Note [Symbolic paths] in `Distribution.Utils.Path` for further information + on the design of this API. + +- Add `MultilineStrings` extension (GHC proposal #637) [#10245](https://github.com/haskell/cabal/pull/10245) + +- Add `NamedDefaults` extension (GHC proposal #409) [#9740](https://github.com/haskell/cabal/pull/9740) + +- Add `OrPatterns` extension (GHC proposal #958) [#10339](https://github.com/haskell/cabal/pull/10339) + + +### Other changes + +- Add flag `--ignore-build-tools` [#10128](https://github.com/haskell/cabal/pull/10128) + + - Adds flag `--ignore-build-tools` which allows a user to ignore the tool + dependencies declared in `build-tool-depends`. For general use, this flag + should never be needed, but it may be useful for packagers. + +- Do not try to build dynamic executables on Windows [#10217](https://github.com/haskell/cabal/pull/10217) + + - Cabal will now exit with a descriptive error message instead of attempting to + build a dynamic executable on Windows. + +- Always pass `ghc-options` to GHC [#8717](https://github.com/haskell/cabal/pull/8717) + + Previously, options set in the package field `ghc-options` would not be passed + to GHC during the link phase for shared objects (where multiple `.o` or + `.dyn_o` files are merged into a single object file). This made it impossible + to use `ghc-options` to use a different linker by setting (for example) + `ghc-options: -optl-fuse-ld=mold -optlm-fuse-ld=mold`; the options would be + dropped in the link phase, falling back to the default linker. + + It was possible to work around this by duplicating the `ghc-options` to + `ghc-shared-options`, which _are_ passed in the shared link phase, but that had + the undocumented and unfortunate side-effect of disabling the GHC + `-dynamic-too` flag, effectively doubling compilation times when + `ghc-shared-options` are set. + + Now, `ghc-options` are combined with `ghc-shared-options` (to accurately + reflect the documentation on this feature) and the fact that + `ghc-shared-options` disables `-dynamic-too` is documented. + +- Introduce `SetupHooks` [#9551](https://github.com/haskell/cabal/pull/9551) + + Introduction of a new build type: `Hooks`. + This build type, intended to eventually replace the `Custom` build type, integrates + better with the rest of the ecosystem (`cabal-install`, Haskell Language Server). + + The motivation and full design of this new build-type are specified in the + Haskell Foundation Tech Proposal + [Replacing the Cabal Custom build-type](https://github.com/haskellfoundation/tech-proposals/pull/60). + + Package authors willing to use this feature should declare `cabal-version: 3.14` and `build-type: Hooks` + in their `.cabal` file, declare a `custom-setup` stanza with a dependency on the + `Cabal-hooks` package, and define a module `SetupHooks` that exports a value + `setupHooks :: SetupHooks`, using the API exported by `Distribution.Simple.SetupHooks` + from the `Cabal-hooks` package. Refer to the Haddock documentation of + `Distribution.Simple.SetupHooks` for example usage. + +- Redefine `build-type: Configure` in terms of `Hooks` [#9969](https://github.com/haskell/cabal/pull/9969) + + The `build-type: Configure` is now implemented in terms of `build-type: Hooks` + rather than in terms of `build-type: Custom`. This moves the `Configure` + build-type away from the `Custom` issues. Eventually, `build-type: Hooks` will + no longer imply packages are built in legacy-fallback mode. When that + happens, `Configure` will also stop implying `legacy-fallback`. + + The observable aspect of this change is `runConfigureScript` now having a + different type, and `autoconfSetupHooks` being exposed by `Distribution.Simple`. + The former is motivated by internal implementation details, while the latter + provides the `SetupHooks` value for the `Configure` build type, which can be + consumed by other `Hooks` clients (e.g. eventually HLS). + +- Cabal can issue a number of error messages referencing "Setup configure", + but it simply references "configure" which could mean any of three + things (Setup configure, the package's "configure" script, or "cabal + configure"). This has recently caught out even Cabal devs. Clarify these + messages. [#9476](https://github.com/haskell/cabal/pull/9476) + +- Update the SPDX License List to version 3.25 + + The LicenseId and LicenseExceptionId types are updated to reflect the SPDX + License List version 3.25 (2024-08-19). diff --git a/release-notes/Cabal-3.14.1.1.md b/release-notes/Cabal-3.14.1.1.md new file mode 100644 index 00000000000..32356cba8d1 --- /dev/null +++ b/release-notes/Cabal-3.14.1.1.md @@ -0,0 +1,6 @@ +Cabal and Cabal-syntax 3.14.1.1 changelog and release notes +--- + +### Significant changes + +- Support for GHC 9.12 [10656](https://github.com/haskell/cabal/pull/10656) diff --git a/release-notes/WIP-Cabal-3.12.x.0.md b/release-notes/WIP-Cabal-3.12.x.0.md new file mode 100644 index 00000000000..d1f2d17f04f --- /dev/null +++ b/release-notes/WIP-Cabal-3.12.x.0.md @@ -0,0 +1,19 @@ +Cabal 3.12.1.0 changelog and release notes. + +This file will be edited and the changes incorprated into the official +3.12.1.0 Cabal and Cabal-syntax release notes. + +--- + +### Significant changes + +- Deprecation of the `__HADDOCK_VERSION__` macro: + In the next major version of Cabal, we no longer define the + `__HADDOCK_VERSION__` macro when invoking GHC through Haddock, since doing + so essentially guarantees recompilation during documentation generation. We + audited all uses of `__HADDOCK_VERSION__` in hackage, ensuring there was a + reasonable path forward to migrate away from using `__HADDOCK_VERSION__` for + each, while generating the same documentation as it did before. If you are + a user of `__HADDOCK_VERSION__`, please take a look at the discussion in + https://github.com/haskell/cabal/pull/9177 and reach out to us if your use + case is not covered. diff --git a/release-notes/cabal-install-3.10.3.0.md b/release-notes/cabal-install-3.10.3.0.md index f057eb4ca53..1128027e389 100644 --- a/release-notes/cabal-install-3.10.3.0.md +++ b/release-notes/cabal-install-3.10.3.0.md @@ -33,7 +33,7 @@ cabal-install and cabal-install-solver 3.10.3.0 changelog and release notes Previously, cabal-install would crash when `pkg-config --list-all` contained invalid Unicode. With this change, invalid unicode in package descriptions is - ignored, and unparseable package names are considered nonexistent. + ignored, and unparsable package names are considered nonexistent. - Script cache dir is the base16 hash of the canonical path of the script. [#9459](https://github.com/haskell/cabal/pull/9459) diff --git a/release-notes/WIP-cabal-install-3.12.x.0.md b/release-notes/cabal-install-3.12.1.0.md similarity index 83% rename from release-notes/WIP-cabal-install-3.12.x.0.md rename to release-notes/cabal-install-3.12.1.0.md index 34d84982806..c8c16e2f58a 100644 --- a/release-notes/WIP-cabal-install-3.12.x.0.md +++ b/release-notes/cabal-install-3.12.1.0.md @@ -1,12 +1,18 @@ -Pre-release cabal-install 3.12.0.0/3.11.0.0 changelog and release notes. - -This file will be edited and the changes incorprated into the official -3.12.1.0 cabal-install and cabal-install-solver release notes. - +cabal-install 3.12.1.0 changelog and release notes. --- ### Significant changes +- Cabal 3.12 support [#9917](https://github.com/haskell/cabal/issues/9917) + + This is the first release of `cabal-install` that is fully compatible with `Cabal` 3.12.0.0 as released with GHC 9.10.1. In particular, it means custom setup builds will work with GHC 9.10. + +- `cabal-install` has been built against `tar` 0.6.3.0 [#10123](https://github.com/haskell/cabal/pull/10123) + + The new release of `tar` has significant performance improvements, making `cabal update` in particular much faster. + + For anyone building from the source, we suggest making sure that the version of `tar` in your plan is at least 0.6.3.0. (For example, we bumped the `index-state` in our `cabal.project.release` in the `Cabal` repository.) + - Add support for asm, cmm, and js sources in executable components [#8639](https://github.com/haskell/cabal/issues/8639) [#9061](https://github.com/haskell/cabal/pull/9061) Executable components now support the inclusion of asm, cmm, and js source @@ -36,17 +42,14 @@ This file will be edited and the changes incorprated into the official a flag which specifies which libraries should be included in the coverage report for some testsuite. -- Add `cabal path` command [#8879](https://github.com/haskell/cabal/pull/8879) +- Add `cabal path` command [#8879](https://github.com/haskell/cabal/pull/8879) [#9673](https://github.com/haskell/cabal/pull/9673) The `cabal path` command prints the file system paths used by Cabal. It is intended for use by tooling that needs to read or modify Cabal data, such that it does not need to replicate the complicated logic for respecting `CABAL_DIR`, `CABAL_CONFIG`, etc. -- Redesign `cabal path` command to account for projects [#9673](https://github.com/haskell/cabal/pull/9673) - - Previously, `cabal path` was only able to query from the global configuration file, e.g., `~/.cabal/config` or the XDG equivalent. - We take the foundations and enhance `cabal path` to take project configuration, such as `cabal.project`, into account. + It will obey a `cabal.project` if present. Additionally, we add support for multiple output formats, such as key-value pairs and json. @@ -62,7 +65,7 @@ This file will be edited and the changes incorprated into the official The json output format is versioned by the cabal-install version, which is part of the json object. Thus, all result objects contain at least the key "cabal-install-version". - We expand the `cabal path` to also produce information of the compiler that is going to be used in a `cabal build` or `cabal repl` invocation. + It also produces information of the compiler that is going to be used in a `cabal build` or `cabal repl` invocation. To do that, we re-configure the compiler program, and outputs the location, version and compiler flavour. This is helpful for downstream tools, such as HLS, to figure out the GHC version required to compile a project with, without dependency solving. @@ -121,7 +124,7 @@ This file will be edited and the changes incorprated into the official name did not match exactly. Now they will be cached even if the header's capitalization is different. -- Clarify the semantics of the `--package-db` flag [#9678](https://github.com/haskell/cabal/issues/9678) +- Clarify the semantics of the `--package-db` flag [#9678](https://github.com/haskell/cabal/issues/9678) [#9683](https://github.com/haskell/cabal/pull/9683) The `--package-db` flag now only applies to the default immutable initial package stack rather than also applying to the store @@ -137,7 +140,7 @@ This file will be edited and the changes incorprated into the official In particular this means that cabal-install will create a semaphore which it then passes to `./Setup build` (and hence `ghc`) which can be used by `ghc` in order to - control how much paralellism it uses, coordinating with other simultaneously running + control how much parallelism it uses, coordinating with other simultaneously running processes. This feature requires ghc-9.8 in order to use, as this is the first version of GHC @@ -257,7 +260,7 @@ This file will be edited and the changes incorprated into the official This relies on the "Project Unit Id" which is available since GHC 9.8.1, older versions of GHC do not benefit from this change. -- Add support for `GHC2024` [#9736](https://github.com/haskell/cabal/issues/9736) +- Add support for `GHC2024` [#9736](https://github.com/haskell/cabal/issues/9736) [#9791](https://github.com/haskell/cabal/pull/9791) Support for the `GHC2024` language edition, introduced by GHC 9.10, has been added. It can now be used in the `default-language` and `other-languages` @@ -273,6 +276,23 @@ This file will be edited and the changes incorprated into the official - Add language extension `TypeAbstractions` [#9496](https://github.com/haskell/cabal/issues/9496) [#9502](https://github.com/haskell/cabal/pull/9502) +- Label error messages with codes (following GHC, Stack) + + As with GHC and Stack, Cabal and cabal-install now generate warnings and errors prefixed with error codes of the form `[Cabal-xxxxx]`. These will be documented on https://errors.haskell.org, although very few are as yet. + +- The `--offline` flag applied to `source-repository-package`s [#9641](https://github.com/haskell/cabal/issues/9641) [#9771](https://github.com/haskell/cabal/pull/9771) + + The `--offline` flag is already used to block access to Hackage. Now with this PR, this also applies to remote dependency `source-repository-package` in `cabal.project`. + +- Fix `--program-suffix` resulting in invalid installation [#8823](https://github.com/haskell/cabal/issues/8823) [#9919](https://github.com/haskell/cabal/issues/9919) [#10056](https://github.com/haskell/cabal/pull/10056) + + Formerly, using `--program-suffix` resulted in bad symlinks into the store. This has been corrected. + +- Warn on missing `default-language` [#9620](https://github.com/haskell/cabal/issues/9620) [#9766](https://github.com/haskell/cabal/pull/9766) + + - To help the adoption of GHC language editions, `cabal check` will now + warn about missing `default-language`. + ### Other changes - Script cache dir is the base16 hash of the canonical path of the script. [#9459](https://github.com/haskell/cabal/pull/9459) @@ -341,3 +361,19 @@ This file will be edited and the changes incorprated into the official The "Executing·install·plan··serially" and other similar "Executing install plan··..." outputs no longer contain double spaces. + +- Allow whitespace in targets [#8875](https://github.com/haskell/cabal/issues/8875) [#10032](https://github.com/haskell/cabal/pull/10032) + + Allow spaces in the final component of target selectors. This resolves an issue + where using absolute paths in selectors can fail if there is whitespace in the + parent directories of the project. + +- Renders project configuration provenance as a list of canonical paths [#9971](https://github.com/haskell/cabal/issues/9971) [#9985](https://github.com/haskell/cabal/pull/9985) + + Removes interleaved rendering of project imports. + +- Abbreviate solver rejection messages with installed versions [#9823](https://github.com/haskell/cabal/issues/9823) [#9824](https://github.com/haskell/cabal/pull/9824) + +- solver: Prevent `ghc-internal` from being reinstalled [#10108](https://github.com/haskell/cabal/pull/10108) + + GHC 9.10 ships with a new wired-in package, `ghc-internal`, which cannot be reinstalled. This commit prevents cabal-install from attempting it. diff --git a/release-notes/cabal-install-3.14.0.0.md b/release-notes/cabal-install-3.14.0.0.md new file mode 100644 index 00000000000..3a890db9acc --- /dev/null +++ b/release-notes/cabal-install-3.14.0.0.md @@ -0,0 +1,141 @@ +cabal-install 3.14.0.0 changelog and release notes. +--- + + +### Significant changes + +- `haddock-project` support for subcomponents [#9821](https://github.com/haskell/cabal/pull/9821) + + - `haddock-project` handles sublibraries, test suites and benchmarks. + - `haddock` receives `--package-name` flag which allows to set names of + components which are included in the main `index.html` file. + - added `--use-unicode` flag to `haddock` and `haddock-project` commands. + - The directory structure of `./dist-newstyle` has changed. `haddock` + subcommand will install `package:sublib` component in a directory + `package/sublib` under `l/sublib/doc/html/`. This is important for + `haddock-project` command and in the future might will be useful for hackage + support of sublibraries. See + https://github.com/haskell/cabal/pull/9821#discussion_r1548557115. + +- Redefine `build-type: Configure` in terms of `Hooks` [#9969](https://github.com/haskell/cabal/pull/9969) + + The `build-type: Configure` is now implemented in terms of `build-type: Hooks` + rather than in terms of `build-type: Custom`. This moves the `Configure` + build-type away from the `Custom` issues. Eventually, `build-type: Hooks` will + no longer imply packages are built in legacy-fallback mode. When that + happens, `Configure` will also stop implying `legacy-fallback`. + + The observable aspect of this change is `runConfigureScript` now having a + different type, and `autoconfSetupHooks` being exposed from `Distribution.Simple`. + The former is motivated by internal implementation details, while the latter + provides the `SetupHooks` value for the `Configure` build type, which can be + consumed by other `Hooks` clients (e.g. eventually HLS). + +### Other changes + +- Add support for building profiled dynamic way [#4816](https://github.com/haskell/cabal/issues/4816) [#9900](https://github.com/haskell/cabal/pull/9900) + + + New options for `cabal.project` and `./Setup` interface: + + * `profiling-shared`: Enable building profiling dynamic way + * Passing `--enable-profiling` and `--enable-executable-dynamic` builds + profiled dynamic executables. + + Support for using `profiling-shared` is guarded behind a constraint + which ensures you are using `Cabal >= 3.13`. + + In the `.cabal` file: + + * `ghc-prof-shared-options`, for passing options when building in + profiling dynamic way + +- Fix interaction of `--*-shared` and `--*-executable-dynamic` options. [#10050](https://github.com/haskell/cabal/issues/10050) [#9900](https://github.com/haskell/cabal/pull/9900) + + If you explicitly request `--disable-shared` it should disable the building of + a shared library and override any automatic ways this option is turned on. + + Passing `--enable-executable-dynamic` turns on `--enable-shared` if the option is + not specified explicitly. + + Before this patch, writing `--disable-shared` on its own would not disable the building of shared libraries. Writing `--disable-shared` and `--disable-executable-dynamic` would disable shared library + creation (despite `--disable-executable-dynamic` being the default). + + Now: + + * If you specify `--enable-shared` then shared objects are built. + * If you specify `--disabled-shared` then shared objects are not built. + * If you don't explicitly specify whether you want to build shared libraries then + * `--enable-executable-dynamic` will automatically turn on building shared libraries + * `--enable-executable-dynamic --enable-profiling` will automatically turn on building + shared profiling libraries (if supported by your compiler). + +- `curl` transport now supports Basic authentication [#10089](https://github.com/haskell/cabal/pull/10089) + + - The `curl` HTTP transport previously only supported the HTTP Digest + authentication scheme. Basic authentication is now supported + when using HTTPS; Curl will use the scheme offered by the server. + The `wget` transport already supports HTTPS. + +- Enhance error detection for cabal root project files, including broken symlinks [#9937](https://github.com/haskell/cabal/issues/9937) [#10103](https://github.com/haskell/cabal/pull/10103) + + - Added proper detection and reporting for issues with cabal root project files. Previously, these files were silently ignored if they were broken symlinks. Now, `cabal` will exit + with an error in such case. + +- Let cabal init remember chosen language within current session [#10096](https://github.com/haskell/cabal/issues/10096) [#10115](https://github.com/haskell/cabal/pull/10115) + + When `cabal init` asks for a language, the last choice made will be used as the new default for the current prompt. + +- Filter out `-dinitial-unique` and `-dunique-increment` from package hash [#10122](https://github.com/haskell/cabal/pull/10122) + + `-dinitial-unique` and `-dunique-increment` are now filtered out when computing the + store hash of a package. + + These options shouldn't affect the output of the package and hence + shouldn't affect the store hash of a package. + +- Warn about `git://` protocol [#10261](https://github.com/haskell/cabal/pull/10261) + + `cabal check` will warn about the insecure (and no longer supported by GitHub or Gitlab, among others) `git://` protocol in `source-repository`. + + See [Git Book](https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols#_the_cons_4) + for an explanation. + +- Enable recompilation avoidance during Haddock generation [#9175](https://github.com/haskell/cabal/issues/9175) [#9177](https://github.com/haskell/cabal/pull/9177) + + * Haddock no longer writes compilation files by default, so we do not need to + pass tmp dirs for `-hidir`, `-stubdir`, and `-odir` via `--optghc`. Indeed, we + do not *want* to do so, since it results in recompilation for every invocation + of Haddock via Cabal. We now stop this from happening for Haddock versions + 2.28 and greater, since that is when Hi Haddock was introduced. + + * We no longer define the `__HADDOCK_VERSION__` macro when invoking GHC through + Haddock, since doing so essentially guarantees recompilation during + documentation generation. We audited all uses of `__HADDOCK_VERSION__` in + hackage, ensuring there was a reasonable path forward to migrate away from + using `__HADDOCK_VERSION__` for each, while generating the same documentation + as it did before. + If you are a user of `__HADDOCK_VERSION__`, please take a look at the + discussion in https://github.com/haskell/cabal/pull/9177 and reach out to us + if your use case is not covered. + + * Rename the `--haddock-lib` flag to `--haddock-resources-dir` (and + `haddock-lib:` cabal.project field to `haddock-resources-dir:`), and add this + flag to the users guide since it was missing an entry. + + * `documentation: true` or `--enable-documentation` now implies `-haddock` for + GHC. + +- Bug fix - Don't pass `--coverage-for` for non-dependency libs of testsuite [#10046](https://github.com/haskell/cabal/issues/10046) [#10250](https://github.com/haskell/cabal/pull/10250) + +- Added `--all` and `--haddock-all` switches to `haddock-project` subcommand [#10051](https://github.com/haskell/cabal/issues/10051) [#10163](https://github.com/haskell/cabal/pull/10163) + +- Clarify error message when `pkg-config` is not found [#10122](https://github.com/haskell/cabal/pull/10122) + + - The error message when `pkg-config` is not found or querying it fails will no + longer incorrectly claim that the package is missing in the database. + +- Update the SPDX License List to version 3.25 + + The LicenseId and LicenseExceptionId types are updated to reflect the SPDX + License List version 3.25 (2024-08-19). diff --git a/release-notes/cabal-install-3.14.1.0.md b/release-notes/cabal-install-3.14.1.0.md new file mode 100644 index 00000000000..d4ccf28e126 --- /dev/null +++ b/release-notes/cabal-install-3.14.1.0.md @@ -0,0 +1,16 @@ +## cabal-install and cabal-install-solver 3.14.1.0 changelog + +- Fix a bug that causes `cabal init` to crash if `git` is not installed [#8478](https://github.com/haskell/cabal/issues/8478) [#10484](https://github.com/haskell/cabal/issues/10484) [#10486](https://github.com/haskell/cabal/pull/10486) + + - `cabal init` tries to use `git config` to guess the user's name and email. + It no longer crashes if there is no executable named `git` on $PATH. + +- Print out which project file we are using with the default verbosity [#8519](https://github.com/haskell/cabal/issues/8519) [#10507](https://github.com/haskell/cabal/pull/10507) + + - Many people have been burnt by cabal catching stray project files located up + the directory tree. This change tries to protect them at the expense of + producing more output by default. In particular, before this change, you could + see which project file is in use by supplying `-v` (the verbose mode), and + after the change we print this information with the default verbosity. + Changing the behaviour of cabal is out of scope of this change, and will + hopefully be done in the future versions (see #9353 for a way forward). diff --git a/scripts/release/create-release-metadata-for-ghcup.sh b/scripts/release/create-release-metadata-for-ghcup.sh index c8683c2b85c..6cf3415ce75 100755 --- a/scripts/release/create-release-metadata-for-ghcup.sh +++ b/scripts/release/create-release-metadata-for-ghcup.sh @@ -26,49 +26,42 @@ cat < /dev/stdout viTags: - Latest viChangeLog: https://github.com/haskell/cabal/blob/master/release-notes/cabal-install-$RELEASE.md - viPostInstall: *cabal-${RELEASE//./}-post-install + # uncomment viPostInstall if the release needs a post-install message + # viPostInstall: &cabal-${RELEASE//./}-post-install | viArch: A_64: Linux_UnknownLinux: unknown_versioning: &cabal-${RELEASE//./}-64 - dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-alpine3_12.tar.xz - dlSubdir: cabal-install-$RELEASE - dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-alpine3_12.tar.xz" | awk '{ print $1 }') + dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-alpine3_12.tar.xz + dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-alpine3_12.tar.xz" | awk '{ print $1 }') Linux_Alpine: - unknown_versioning: &cabal-${RELEASE//./}-64 + unknown_versioning: *cabal-${RELEASE//./}-64 Linux_CentOS: unknown_versioning: &cabal-${RELEASE//./}-64-centos7 - dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-centos7.tar.xz - dlSubdir: cabal-install-$RELEASE - dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-centos7.tar.xz" | awk '{ print $1 }') + dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-centos7.tar.xz + dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-centos7.tar.xz" | awk '{ print $1 }') Linux_Debian: - ' ( >= 9 && < 10)': &cabal-${RELEASE//./}-64-debian + '( >= 9 && < 10)': &cabal-${RELEASE//./}-64-debian dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-deb9.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-deb9.tar.xz" | awk '{ print $1 }') - ' ( == 10 && < 11)': + '( == 10 && < 11)': dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-deb10.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-deb10.tar.xz" | awk '{ print $1 }') - ' ( >= 11)': + '( >= 11)': dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-deb11.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-deb11.tar.xz" | awk '{ print $1 }') - unknown_versioning: &cabal-${RELEASE//./}-64-debian + unknown_versioning: *cabal-${RELEASE//./}-64-debian Linux_Fedora: '>= 33': dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-fedora33.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-fedora33.tar.xz" | awk '{ print $1 }') - unknown_versioning: &cabal-${RELEASE//./}-64-centos7 + unknown_versioning: *cabal-${RELEASE//./}-64-centos7 Linux_Ubuntu: '< 20': &cabal-${RELEASE//./}-64-ubuntu18 dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-ubuntu18_04.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-ubuntu18_04.tar.xz" | awk '{ print $1 }') '>= 20': &cabal-${RELEASE//./}-64-ubuntu20 dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-linux-ubuntu20_04.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-linux-ubuntu20_04.tar.xz" | awk '{ print $1 }') unknown_versioning: *cabal-${RELEASE//./}-64-ubuntu18 Linux_Mint: @@ -78,48 +71,44 @@ cat < /dev/stdout Darwin: unknown_versioning: dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-darwin.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-darwin.tar.xz" | awk '{ print $1 }') Windows: unknown_versioning: dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-windows.zip - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-windows.zip" | awk '{ print $1 }') FreeBSD: unknown_versioning: - dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-freebsd.tar.xz - dlSubdir: cabal-install-$RELEASE - dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-freebsd.tar.xz" | awk '{ print $1 }') + dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-x86_64-freebsd-14.tar.xz + dlHash: $(sha256sum "cabal-install-$RELEASE-x86_64-freebsd-14.tar.xz" | awk '{ print $1 }') A_32: Linux_UnknownLinux: unknown_versioning: &cabal-${RELEASE//./}-32 dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-i386-linux-alpine3_12.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-i386-linux-alpine3_12.tar.xz" | awk '{ print $1 }') Linux_Alpine: unknown_versioning: *cabal-${RELEASE//./}-32 Linux_Debian: '( >= 9 )': dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-i386-linux-deb9.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-i386-linux-deb9.tar.xz" | awk '{ print $1 }') unknown_versioning: *cabal-${RELEASE//./}-32 A_ARM64: Darwin: unknown_versioning: dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-aarch64-darwin.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-aarch64-darwin.tar.xz" | awk '{ print $1 }') Linux_Debian: - '( >= 10 && < 11)': &cabal-31020-arm64 + '( >= 10 && < 11)': &cabal-${RELEASE//./}-arm64 dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-aarch64-linux-deb10.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-aarch64-linux-deb10.tar.xz" | awk '{ print $1 }') '( >= 11)': dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-aarch64-linux-deb11.tar.xz - dlSubdir: cabal-install-$RELEASE dlHash: $(sha256sum "cabal-install-$RELEASE-aarch64-linux-deb11.tar.xz" | awk '{ print $1 }') unknown_versioning: *cabal-${RELEASE//./}-arm64 + Linux_Alpine: + unknown_versioning: + dlUri: https://downloads.haskell.org/~cabal/cabal-install-$RELEASE/cabal-install-$RELEASE-aarch64-linux-alpine3_18.tar.xz + dlHash: $(sha256sum "cabal-install-$RELEASE-aarch64-linux-alpine3_18.tar.xz" | awk '{ print $1 }') Linux_UnknownLinux: unknown_versioning: *cabal-${RELEASE//./}-arm64 EOF diff --git a/solver-benchmarks/solver-benchmarks.cabal b/solver-benchmarks/solver-benchmarks.cabal index 42ebd616f9a..0595a5bd229 100644 --- a/solver-benchmarks/solver-benchmarks.cabal +++ b/solver-benchmarks/solver-benchmarks.cabal @@ -31,7 +31,7 @@ library base, bytestring, containers, - Cabal-syntax ^>= 3.13, + Cabal-syntax ^>= 3.15, directory, filepath, optparse-applicative, diff --git a/templates/Paths_pkg.template.hs b/templates/Paths_pkg.template.hs index 8e1e03d27e4..bea7d6813e3 100644 --- a/templates/Paths_pkg.template.hs +++ b/templates/Paths_pkg.template.hs @@ -26,7 +26,6 @@ import Foreign.C {% endif %} import qualified Control.Exception as Exception -import qualified Data.List as List import Data.Version (Version(..)) import System.Environment (getEnv) import Prelude @@ -175,9 +174,14 @@ joinFileName :: String -> String -> FilePath joinFileName "" fname = fname joinFileName "." fname = fname joinFileName dir "" = dir -joinFileName dir fname - | isPathSeparator (List.last dir) = dir ++ fname +joinFileName dir@(c:cs) fname + | isPathSeparator (lastChar c cs) = dir ++ fname | otherwise = dir ++ pathSeparator : fname + where + -- We do not use Data.List.NonEmpty.last, as that would limit the module to + -- base >= 4.9.0.0 (GHC >= 8.0.1). + lastChar x [] = x + lastChar _ (x:xs) = lastChar x xs pathSeparator :: Char {% if isWindows %} diff --git a/templates/SPDX.LicenseExceptionId.template.hs b/templates/SPDX.LicenseExceptionId.template.hs index c2fcd1462b9..0ef6787416b 100644 --- a/templates/SPDX.LicenseExceptionId.template.hs +++ b/templates/SPDX.LicenseExceptionId.template.hs @@ -29,10 +29,10 @@ import qualified Text.PrettyPrint as Disp -- LicenseExceptionId ------------------------------------------------------------------------------- --- | SPDX License Exceptions identifiers list v3.23 +-- | SPDX License Exceptions identifiers list v3.25 data LicenseExceptionId {{ licenseIds }} - deriving (Eq, Ord, Enum, Bounded, Show, Read, Typeable, Data, Generic) + deriving (Eq, Ord, Enum, Bounded, Show, Read, Data, Generic) instance Binary LicenseExceptionId where put = Binary.putWord8 . fromIntegral . fromEnum @@ -101,6 +101,9 @@ licenseExceptionIdList LicenseListVersion_3_16 = licenseExceptionIdList LicenseListVersion_3_23 = {{licenseList_perv.v_3_23}} ++ bulkOfLicenses +licenseExceptionIdList LicenseListVersion_3_25 = +{{licenseList_perv.v_3_25}} + ++ bulkOfLicenses -- | Create a 'LicenseExceptionId' from a 'String'. mkLicenseExceptionId :: LicenseListVersion -> String -> Maybe LicenseExceptionId @@ -111,6 +114,7 @@ mkLicenseExceptionId LicenseListVersion_3_9 s = Map.lookup s stringLookup_3_9 mkLicenseExceptionId LicenseListVersion_3_10 s = Map.lookup s stringLookup_3_10 mkLicenseExceptionId LicenseListVersion_3_16 s = Map.lookup s stringLookup_3_16 mkLicenseExceptionId LicenseListVersion_3_23 s = Map.lookup s stringLookup_3_23 +mkLicenseExceptionId LicenseListVersion_3_25 s = Map.lookup s stringLookup_3_25 stringLookup_3_0 :: Map String LicenseExceptionId stringLookup_3_0 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ @@ -140,6 +144,10 @@ stringLookup_3_23 :: Map String LicenseExceptionId stringLookup_3_23 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ licenseExceptionIdList LicenseListVersion_3_23 +stringLookup_3_25 :: Map String LicenseExceptionId +stringLookup_3_25 = Map.fromList $ map (\i -> (licenseExceptionId i, i)) $ + licenseExceptionIdList LicenseListVersion_3_25 + -- | License exceptions in all SPDX License lists bulkOfLicenses :: [LicenseExceptionId] bulkOfLicenses = diff --git a/templates/SPDX.LicenseId.template.hs b/templates/SPDX.LicenseId.template.hs index 6ee2bf6ede3..a7b78903c34 100644 --- a/templates/SPDX.LicenseId.template.hs +++ b/templates/SPDX.LicenseId.template.hs @@ -32,13 +32,13 @@ import qualified Text.PrettyPrint as Disp -- LicenseId ------------------------------------------------------------------------------- --- | SPDX License identifiers list v3.23 +-- | SPDX License identifiers list v3.25 data LicenseId {{ licenseIds }} - deriving (Eq, Ord, Enum, Bounded, Show, Read, Typeable, Data) + deriving (Eq, Ord, Enum, Bounded, Show, Read, Data) instance Binary LicenseId where - -- Word16 is encoded in big endianess + -- Word16 is encoded in big endianness -- https://github.com/kolmodin/binary/blob/master/src/Data/Binary/Class.hs#L220-LL227 put = Binary.putWord16be . fromIntegral . fromEnum get = do @@ -178,6 +178,9 @@ licenseIdList LicenseListVersion_3_16 = licenseIdList LicenseListVersion_3_23 = {{licenseList_perv.v_3_23}} ++ bulkOfLicenses +licenseIdList LicenseListVersion_3_25 = +{{licenseList_perv.v_3_25}} + ++ bulkOfLicenses -- | Create a 'LicenseId' from a 'String'. mkLicenseId :: LicenseListVersion -> String -> Maybe LicenseId @@ -188,6 +191,7 @@ mkLicenseId LicenseListVersion_3_9 s = Map.lookup s stringLookup_3_9 mkLicenseId LicenseListVersion_3_10 s = Map.lookup s stringLookup_3_10 mkLicenseId LicenseListVersion_3_16 s = Map.lookup s stringLookup_3_16 mkLicenseId LicenseListVersion_3_23 s = Map.lookup s stringLookup_3_23 +mkLicenseId LicenseListVersion_3_25 s = Map.lookup s stringLookup_3_25 stringLookup_3_0 :: Map String LicenseId stringLookup_3_0 = Map.fromList $ map (\i -> (licenseId i, i)) $ @@ -217,6 +221,10 @@ stringLookup_3_23 :: Map String LicenseId stringLookup_3_23 = Map.fromList $ map (\i -> (licenseId i, i)) $ licenseIdList LicenseListVersion_3_23 +stringLookup_3_25 :: Map String LicenseId +stringLookup_3_25 = Map.fromList $ map (\i -> (licenseId i, i)) $ + licenseIdList LicenseListVersion_3_25 + -- | Licenses in all SPDX License lists bulkOfLicenses :: [LicenseId] bulkOfLicenses = diff --git a/test/IntegrationTests2/config/default-config b/test/IntegrationTests2/config/default-config index 8e3aa02742c..57ae6f847ec 100644 --- a/test/IntegrationTests2/config/default-config +++ b/test/IntegrationTests2/config/default-config @@ -33,8 +33,8 @@ remote-repo-cache: /home/colton/.cabal/packages -- cabal-file: -- with-compiler: -- with-hc-pkg: --- program-prefix: --- program-suffix: +-- program-prefix: +-- program-suffix: -- library-vanilla: True -- library-profiling: -- shared: @@ -141,8 +141,9 @@ haddock -- contents-location: -- index-location: -- base-url: - -- lib: + -- resources-dir: -- output-dir: + -- use-unicode: False init -- interactive: False diff --git a/test/IntegrationTests2/nix-config/default-config b/test/IntegrationTests2/nix-config/default-config index 8e3aa02742c..57ae6f847ec 100644 --- a/test/IntegrationTests2/nix-config/default-config +++ b/test/IntegrationTests2/nix-config/default-config @@ -33,8 +33,8 @@ remote-repo-cache: /home/colton/.cabal/packages -- cabal-file: -- with-compiler: -- with-hc-pkg: --- program-prefix: --- program-suffix: +-- program-prefix: +-- program-suffix: -- library-vanilla: True -- library-profiling: -- shared: @@ -141,8 +141,9 @@ haddock -- contents-location: -- index-location: -- base-url: - -- lib: + -- resources-dir: -- output-dir: + -- use-unicode: False init -- interactive: False diff --git a/tests/IntegrationTests2/config/default-config b/tests/IntegrationTests2/config/default-config index 8e3aa02742c..94a10d9c113 100644 --- a/tests/IntegrationTests2/config/default-config +++ b/tests/IntegrationTests2/config/default-config @@ -25,8 +25,8 @@ repository hackage.haskell.org -- store-dir: -- active-repositories: -- local-no-index-repo: -remote-repo-cache: /home/colton/.cabal/packages --- logs-dir: /home/colton/.cabal/logs +remote-repo-cache: /Users/finley/.cabal/packages +-- logs-dir: /Users/finley/.cabal/logs -- default-user-config: -- verbose: 1 -- compiler: ghc @@ -63,7 +63,7 @@ remote-repo-cache: /home/colton/.cabal/packages -- extra-lib-dirs: -- extra-lib-dirs-static: -- extra-framework-dirs: -extra-prog-path: /home/colton/.cabal/bin +-- extra-prog-path: -- instantiate-with: -- tests: False -- coverage: False @@ -104,12 +104,13 @@ extra-prog-path: /home/colton/.cabal/bin -- index-state: -- root-cmd: -- symlink-bindir: -build-summary: /home/colton/.cabal/logs/build.log +build-summary: /Users/finley/.cabal/logs/build.log -- build-log: remote-build-reporting: none -- report-planning-failure: False -- per-component: True -- run-tests: +-- semaphore: False jobs: $ncpus -- keep-going: False -- offline: False @@ -117,10 +118,11 @@ jobs: $ncpus -- package-env: -- overwrite-policy: -- install-method: -installdir: /home/colton/.cabal/bin +installdir: /Users/finley/.cabal/bin -- username: -- password: -- password-command: +-- multi-repl: -- builddir: haddock @@ -141,8 +143,9 @@ haddock -- contents-location: -- index-location: -- base-url: - -- lib: + -- resources-dir: -- output-dir: + -- use-unicode: False init -- interactive: False @@ -160,7 +163,7 @@ init -- source-dir: src install-dirs user - -- prefix: /home/colton/.cabal + -- prefix: /Users/finley/.cabal -- bindir: $prefix/bin -- libdir: $prefix/lib -- libsubdir: $abi/$libname diff --git a/tests/IntegrationTests2/nix-config/default-config b/tests/IntegrationTests2/nix-config/default-config index 8e3aa02742c..57ae6f847ec 100644 --- a/tests/IntegrationTests2/nix-config/default-config +++ b/tests/IntegrationTests2/nix-config/default-config @@ -33,8 +33,8 @@ remote-repo-cache: /home/colton/.cabal/packages -- cabal-file: -- with-compiler: -- with-hc-pkg: --- program-prefix: --- program-suffix: +-- program-prefix: +-- program-suffix: -- library-vanilla: True -- library-profiling: -- shared: @@ -141,8 +141,9 @@ haddock -- contents-location: -- index-location: -- base-url: - -- lib: + -- resources-dir: -- output-dir: + -- use-unicode: False init -- interactive: False diff --git a/validate.sh b/validate.sh index 3b56a945c84..b887b724e8f 100755 --- a/validate.sh +++ b/validate.sh @@ -1,517 +1,3 @@ -#!/bin/sh -# shellcheck disable=SC2086 +#!/usr/bin/env sh -# default config -####################################################################### - -# We use the default ghc in PATH as default -# Use the ghc-x.y.z trigger several errors in windows: -# * It triggers the max path length issue: -# See https://github.com/haskell/cabal/issues/6271#issuecomment-1065102255 -# * It triggers a `createProcess: does not exist` error in units tests -# See https://github.com/haskell/cabal/issues/8049 -HC=ghc -CABAL=cabal -JOBS=4 -LIBTESTS=true -CLITESTS=true -CABALSUITETESTS=true -LIBONLY=false -DEPSONLY=false -DOCTEST=false -BENCHMARKS=false -VERBOSE=false -HACKAGETESTSALL=false - -TARGETS="" -STEPS="" -EXTRAHCS="" - -LISTSTEPS=false - -# Help -####################################################################### - -show_usage() { -cat <&1 - else - "$@" > "$OUTPUT" 2>&1 - fi - # echo "MOCK" > "$OUTPUT" - RET=$? - - end_time=$(date +%s) - duration=$((end_time - start_time)) - tduration=$((end_time - JOB_START_TIME)) - - if [ $RET -eq 0 ]; then - if ! $VERBOSE; then - # if output is relatively short, show everything - if [ "$(wc -l < "$OUTPUT")" -le 50 ]; then - cat "$OUTPUT" - else - echo "..." - tail -n 20 "$OUTPUT" - fi - - rm -f "$OUTPUT" - fi - - green "<<< $PRETTYCMD" "($duration/$tduration sec)" - - # bottom-margin - echo "" - else - if ! $VERBOSE; then - cat "$OUTPUT" - fi - - red "<<< $PRETTYCMD" "($duration/$tduration sec, $RET)" - red "<<< $*" "($duration/$tduration sec, $RET)" - rm -f "$OUTPUT" - exit 1 - fi -} - -print_header() { - TITLE=$1 - TITLEPAT="$(echo "$TITLE"|sed 's:.:=:g')" - cyan "===X========================================================================== $(date +%T) ===" \ - | sed "s#X$TITLEPAT=# $TITLE #" - -} - -# getopt -####################################################################### - -while [ $# -gt 0 ]; do - arg=$1 - case $arg in - --help) - show_usage - exit - ;; - -j|--jobs) - JOBS="$2" - shift - shift - ;; - --lib-only) - LIBONLY=true - shift - ;; - --cli) - LIBONLY=false - shift - ;; - --run-lib-tests) - LIBTESTS=true - shift - ;; - --no-run-lib-tests) - LIBTESTS=false - shift - ;; - --run-cli-tests) - CLITESTS=true - shift - ;; - --no-run-cli-tests) - CLITESTS=false - shift - ;; - --run-lib-suite) - LIBSUITE=true - shift - ;; - --no-run-lib-suite) - LIBSUITE=false - shift - ;; - --run-cli-suite) - CLISUITE=true - shift - ;; - --no-run-cli-suite) - CLISUITE=false - shift - ;; - -w|--with-compiler) - HC=$2 - shift - shift - ;; - --with-cabal) - CABAL=$2 - shift - shift - ;; - --extra-hc) - EXTRAHCS="$EXTRAHCS $2" - shift - shift - ;; - --doctest) - DOCTEST=true - shift - ;; - --no-doctest) - DOCTEST=false - shift - ;; - --solver-benchmarks) - BENCHMARKS=true - shift - ;; - --no-solver-benchmarks) - BENCHMARKS=false - shift - ;; - --complete-hackage-tests) - HACKAGETESTSALL=true - shift - ;; - --partial-hackage-tests) - HACKAGETESTSALL=false - shift - ;; - -v|--verbose) - VERBOSE=true - shift - ;; - -q|--quiet) - VERBOSE=false - shift - ;; - -s|--step) - STEPS="$STEPS $2" - shift - shift - ;; - --list-steps) - LISTSTEPS=true - shift - ;; - *) - echo "Unknown option $arg" - exit 1 - esac -done - -# calculate steps and build targets -####################################################################### - -# If there are no explicit steps given calculate them -if $LIBONLY; then - CLITESTS=false - CLISUITE=false - BENCHMARKS=false -fi - -if [ -z "$STEPS" ]; then - STEPS="print-config print-tool-versions" - STEPS="$STEPS build" - if $DOCTEST; then STEPS="$STEPS doctest"; fi - if $LIBTESTS; then STEPS="$STEPS lib-tests"; fi - if $LIBSUITE; then STEPS="$STEPS lib-suite"; fi - if $LIBSUITE && [ -n "$EXTRAHCS" ]; - then STEPS="$STEPS lib-suite-extras"; fi - if $CLITESTS; then STEPS="$STEPS cli-tests"; fi - if $CLISUITE; then STEPS="$STEPS cli-suite"; fi - if $BENCHMARKS; then STEPS="$STEPS solver-benchmarks-tests solver-benchmarks-run"; fi - STEPS="$STEPS time-summary" -fi - -TARGETS="Cabal Cabal-hooks cabal-testsuite Cabal-tests Cabal-QuickCheck Cabal-tree-diff Cabal-described" -if ! $LIBONLY; then TARGETS="$TARGETS cabal-install cabal-install-solver cabal-benchmarks"; fi -if $BENCHMARKS; then TARGETS="$TARGETS solver-benchmarks"; fi - -if $LISTSTEPS; then - echo "Targets: $TARGETS" - echo "Steps: $STEPS" - exit -fi - -# Adjust runtime configuration -####################################################################### - -TESTSUITEJOBS="-j$JOBS" -JOBS="-j$JOBS" - -# assume compiler is GHC -RUNHASKELL=$(echo "$HC" | sed -E 's/ghc(-[0-9.]*)$/runghc\1/') - -case "$(uname)" in - MINGW64*) - ARCH="x86_64-windows" - ;; - Linux ) - ARCH="x86_64-linux" - ;; - *) - ARCH="x86_64-osx" - ;; -esac - -if $LIBONLY; then - PROJECTFILE=cabal.validate-libonly.project -else - PROJECTFILE=cabal.validate.project -fi - -BASEHC=ghc-$($HC --numeric-version) -BUILDDIR=dist-newstyle-validate-$BASEHC -CABAL_TESTSUITE_BDIR="$(pwd)/$BUILDDIR/build/$ARCH/$BASEHC/cabal-testsuite-3" - -CABALNEWBUILD="${CABAL} build $JOBS -w $HC --builddir=$BUILDDIR --project-file=$PROJECTFILE" -CABALLISTBIN="${CABAL} list-bin --builddir=$BUILDDIR --project-file=$PROJECTFILE" - -# header -####################################################################### - -step_print_config() { -print_header print-config - -cat <