diff options
author | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-05-15 21:17:45 -0700 |
---|---|---|
committer | Edward Z. Yang <ezyang@cs.stanford.edu> | 2017-05-16 18:59:53 -0700 |
commit | d9e9a9b3016a05e6153de3803998877f91c6cdf4 (patch) | |
tree | 053ab552a3be5b95502bf94146d0d19a27ae2386 /testsuite/tests/cabal | |
parent | cec7d580c2c033c3aaeba093752328d8f3635cd0 (diff) | |
download | haskell-d9e9a9b3016a05e6153de3803998877f91c6cdf4.tar.gz |
Fix #13703 by correctly using munged names in ghc-pkg.
Summary:
Cabal internal libraries are implemented using a trick, where the 'name'
field in ghc-pkg registration file is munged into a new form to keep
each internal library looking like a distinct package to ghc-pkg and
other tools; e.g. the internal library q from package p is named
z-p-z-q.
Later, Cabal library got refactored so that we made a closer distinction
between these "munged" package names and the true package name of a
package. Unfortunately, this is an example of a refactor for clarity in
the source code which ends up causing problems downstream, because the
point of "munging" the package name was to make it so that ghc-pkg and
similar tools transparently used MungedPackageName whereever they
previously used PackageName (in preparation for them learning proper
syntax for package name + component name). Failing to do this meant
that internal libraries from the same package (but with different
names) clobber each other.
This commit search-replaces most occurrences of PackageName in
ghc-pkg and turns them into MungedPackageName. Otherwise there
shouldn't be any functional differenes.
Signed-off-by: Edward Z. Yang <ezyang@cs.stanford.edu>
Test Plan: validate
Reviewers: bgamari, austin
Subscribers: rwbarton, thomie
GHC Trac Issues: #13703
Differential Revision: https://phabricator.haskell.org/D3590
Diffstat (limited to 'testsuite/tests/cabal')
-rw-r--r-- | testsuite/tests/cabal/Makefile | 8 | ||||
-rw-r--r-- | testsuite/tests/cabal/T13703.stdout | 4 | ||||
-rw-r--r-- | testsuite/tests/cabal/all.T | 2 | ||||
-rw-r--r-- | testsuite/tests/cabal/test13703a.pkg | 20 | ||||
-rw-r--r-- | testsuite/tests/cabal/test13703b.pkg | 20 |
5 files changed, 54 insertions, 0 deletions
diff --git a/testsuite/tests/cabal/Makefile b/testsuite/tests/cabal/Makefile index 64034d4ac4..791e3269f0 100644 --- a/testsuite/tests/cabal/Makefile +++ b/testsuite/tests/cabal/Makefile @@ -287,3 +287,11 @@ ghcpkg07: recache_reexport: @rm -rf recache_reexport_db/package.cache '$(GHC_PKG)' --no-user-package-db --global-package-db=recache_reexport_db recache + +T13703: + @rm -rf T13703.package.conf + '$(GHC_PKG)' init T13703.package.conf + '$(GHC_PKG)' --no-user-package-db -f T13703.package.conf register --force test13703a.pkg 2>/dev/null + '$(GHC_PKG)' --no-user-package-db -f T13703.package.conf register --force test13703b.pkg 2>/dev/null + '$(GHC_PKG)' --no-user-package-db -f T13703.package.conf field z-p-z-q lib-name + '$(GHC_PKG)' --no-user-package-db -f T13703.package.conf field z-p-z-r lib-name diff --git a/testsuite/tests/cabal/T13703.stdout b/testsuite/tests/cabal/T13703.stdout new file mode 100644 index 0000000000..5d5503b000 --- /dev/null +++ b/testsuite/tests/cabal/T13703.stdout @@ -0,0 +1,4 @@ +Reading package info from "test13703a.pkg" ... done. +Reading package info from "test13703b.pkg" ... done. +lib-name: q +lib-name: r diff --git a/testsuite/tests/cabal/all.T b/testsuite/tests/cabal/all.T index 23c4826e35..82c1b1584b 100644 --- a/testsuite/tests/cabal/all.T +++ b/testsuite/tests/cabal/all.T @@ -52,3 +52,5 @@ test('T5442d', [extra_files(['shadow1.pkg', 'shadow2.pkg', 'shadow4.pkg'])], run test('shadow', [], run_command, ['$MAKE -s --no-print-directory shadow']) test('T12485a', [extra_files(['shadow1.pkg', 'shadow2.pkg', 'shadow3.pkg'])], run_command, ['$MAKE -s --no-print-directory T12485a']) + +test('T13703', [extra_files(['test13703a.pkg', 'test13703b.pkg'])], run_command, ['$MAKE -s --no-print-directory T13703']) diff --git a/testsuite/tests/cabal/test13703a.pkg b/testsuite/tests/cabal/test13703a.pkg new file mode 100644 index 0000000000..55d3b38a1f --- /dev/null +++ b/testsuite/tests/cabal/test13703a.pkg @@ -0,0 +1,20 @@ +name: z-p-z-q +version: 1.2.3.4 +id: p-1.2.3.4-XXX-q +key: p-1.2.3.4-XXX-q +package-name: p +lib-name: q +license: BSD3 +copyright: (c) The University of Glasgow 2004 +maintainer: glasgow-haskell-users@haskell.org +stability: stable +homepage: http://www.haskell.org/ghc +package-url: http://www.haskell.org/ghc +description: A Test Package +category: none +author: simonmar@microsoft.com +exposed: True +exposed-modules: A +import-dirs: /usr/local/lib/testpkg +library-dirs: /usr/local/lib/testpkg +include-dirs: /usr/local/include/testpkg diff --git a/testsuite/tests/cabal/test13703b.pkg b/testsuite/tests/cabal/test13703b.pkg new file mode 100644 index 0000000000..f04b7b1b23 --- /dev/null +++ b/testsuite/tests/cabal/test13703b.pkg @@ -0,0 +1,20 @@ +name: z-p-z-r +version: 1.2.3.4 +id: p-1.2.3.4-XXX-r +key: p-1.2.3.4-XXX-r +package-name: p +lib-name: r +license: BSD3 +copyright: (c) The University of Glasgow 2004 +maintainer: glasgow-haskell-users@haskell.org +stability: stable +homepage: http://www.haskell.org/ghc +package-url: http://www.haskell.org/ghc +description: A Test Package +category: none +author: simonmar@microsoft.com +exposed: True +exposed-modules: A +import-dirs: /usr/local/lib/testpkg +library-dirs: /usr/local/lib/testpkg +include-dirs: /usr/local/include/testpkg |