Ticket #277: cabal-add-data-dir-field.patch

File cabal-add-data-dir-field.patch, 13.8 KB (added by guest, 5 years ago)

proposed implementation

Line 
1
2New patches:
3
4[add data-dir field to package config
5Bertram Felgenhauer <int-e@gmx.de>**20080509130448
6 Cabal will look for data files to install relative to the directory given
7 in the data-dir field, allowing package authors to better structure their
8 source tree. There's no behavioural change by default.
9] {
10hunk ./Distribution/PackageDescription/Parse.hs 146
11+ , simpleField "data-dir"
12+           showFilePath           parseFilePathQ
13+           dataDir                (\val pkg -> pkg{dataDir=val})
14hunk ./Distribution/PackageDescription.hs 132
15+        dataDir        :: FilePath,
16hunk ./Distribution/PackageDescription.hs 163
17+                      dataDir      = "",
18hunk ./Distribution/Simple/Install.hs 106
19-      copyFileVerbose verbosity file (dataPref </> file)
20+      copyFileVerbose verbosity (dataDir pkg_descr </> file) (dataPref </> file)
21hunk ./Distribution/Simple/SrcDist.hs 151
22-  flip mapM_ (dataFiles pkg_descr) $ \ file -> do
23-    let dir = takeDirectory file
24+  flip mapM_ (dataFiles pkg_descr) $ \ filename -> do
25+    let file = dataDir pkg_descr </> filename
26+        dir = takeDirectory file
27}
28
29[document data-dir field
30Bertram Felgenhauer <int-e@gmx.de>**20080509131306] {
31hunk ./doc/Cabal.xml 671
32+            <term>
33+              <literal>data-dir:</literal>
34+              <replaceable>directory</replaceable>
35+            </term>
36+            <listitem>
37+              <para>The directory where Cabal looks for data files to install,
38+                relative to the source directory. By default, Cabal will look
39+                in the source directory itself.</para>
40+            </listitem>
41+          </varlistentry>
42+
43+          <varlistentry>
44}
45
46Context:
47
48[Add PackageIndex.reverseDependencyClosure
49Duncan Coutts <duncan@haskell.org>**20080506234902
50 It's similar to dependencyClosure but looks at reverse dependencies.
51 For example it's useful to find all packages that depend on broken
52 packages and are thus themselves broken.
53]
54[Improve style and performance of PackageIndex.dependencyClosure
55Duncan Coutts <duncan@haskell.org>**20080506234447
56 Keep the completed set as another PackageIndex rather than a list.
57 We want to return an index at the end anyway and in the mean time
58 we want to do lots of lookups to see if we've visited previously.
59]
60[Add PackageIndex.dependencyGraph that builds a Graph
61Duncan Coutts <duncan@haskell.org>**20080506234326
62 Useful for some more tricky queries.
63]
64[Add PackageIndex.delete
65Duncan Coutts <duncan@haskell.org>**20080506131603
66 We occasionally need to remove packages from an index
67 eg to restrict the choices of a dependency resolver.
68]
69[Remove a test for the specific kind of exception for nhc98 compatibility
70Duncan Coutts <duncan@haskell.org>**20080506102804
71 This was the check for ghc-pkg failing. We cannot check for the
72 exception being an ExitException since that assumes ghc's
73 representation of the Exception type, whereas nhc98 defines:
74 type Exception = IOError
75]
76[Cope better with ghc bug #2201, display a better error message
77Duncan Coutts <duncan@haskell.org>**20080505085746
78 Otherwise it can (and does) really confuse people.
79 The problem is that the command $ ghc-pkg-6.9 describe '*' --user
80 returns a non-zero exit code if the user package db is empty.
81 ghc-pkg intends this exit code to tell us if the query returned
82 any results (one can use more complex queries as tests) but Cabal
83 interprets it as failure. Indeed we cannot distinguish it from
84 any other kind of failure from ghc-pkg.
85]
86[Add PackageIndex.dependencyCycles
87Duncan Coutts <duncan@haskell.org>**20080504131626
88 Finds any cycles (strongly connected components) in the dependencies
89 of set of packages. This is useful for checking the correctness of
90 installation plans.
91]
92[Change dependencyInconsistencies to not take the pseudo top package
93Duncan Coutts <duncan@haskell.org>**20080504130802
94 The one case where we need the pseudo top package we can use
95 PackageIndex.insert instead to get the same effect and there
96 are other cases in cabal-install where we do not want a pseudo
97 top package.
98]
99[Reverse the order of the args to PackageIndex.insert
100Duncan Coutts <duncan@haskell.org>**20080504130317
101 To take the index last like the other functions and like Data.Map.
102 It is actually more convenient that way round.
103]
104[Revert the change about the --internal flag and a warning about haddock
105Duncan Coutts <duncan@haskell.org>**20080501223131
106 Just a bit of confusion over the behaviour of the --executable flag.
107]
108[Document --internal in Cabal.xml
109Joachim Breitner <mail@joachim-breitner.de>**20080501153356]
110[With --executable, --internal just adds --ignore-all-exports
111Joachim Breitner <mail@joachim-breitner.de>**20080501152544]
112[Implement --internal flag
113Joachim Breitner <mail@joachim-breitner.de>**20080501152421
114 Passing --internal to the haddock stage does these things:
115  * Does not pass --hide parameter to haddock
116  * Passes --ignore-all-exports parameter
117  * Appends "(internal documentation)" to the title
118]
119[Add an --internal flag to HaddockFlags
120Joachim Breitner <mail@joachim-breitner.de>**20080501145103]
121[Revert the other `fmap` to (.)
122Malcolm.Wallace@cs.york.ac.uk**20080501110006
123 To avoid needing a non-H'98 instance of Functor for (->).
124]
125[Revert one change of (.) to fmap. It was not necessary and broke nhc98.
126Duncan Coutts <duncan@haskell.org>**20080501104620
127 The other one was needed as we changed a type from Bool to Maybe Bool.
128]
129[Add help command as per ticket #272
130Duncan Coutts <duncan@haskell.org>**20080430133740
131 "cabal help" behaves like "cabal --help"
132 "cabal help cmd" behaves like "cabal cmd --help"
133 Should still work with command line completion.
134]
135[Change handling of bool command line args to allow an unset state
136Duncan Coutts <duncan@haskell.org>**20080429201123
137 For bool valued flags we were always producing the command line
138 string corresponding to a false flag value, even if the flag was
139 not set. For example we'd always get "--disable-shared".
140 It is important for cabal-install to be able to take an empty set
141 of flags, override a few flags and turn the flags back into
142 command line strings without getting a lot of extra defaults.
143 Partly this is because we have to work with older versions of the
144 Cabal library command line which does not recognise the new options.
145]
146[Remove the feature for highlighting the default cases in --help output
147Duncan Coutts <duncan@haskell.org>**20080429191206
148 Turns out it doesn't help us much because in many cases the initial/default
149 flags are actually empty so we cannot identify the default values.
150]
151[Make the old test code compile
152Duncan Coutts <duncan@haskell.org>**20080428225729
153 Still a lot of bit rot, many of the full tests fail due to changed paths
154]
155[Fix license parsing
156Duncan Coutts <duncan@haskell.org>**20080428192255
157 Spotted by the testsuite which I'm trying to resurrect.
158]
159[Fix fix for #224.
160Thomas Schilling <nominolo@gmail.com>**20080426164537
161 
162 Changing from list of Dependencies to Maps resulted in the wrong Monoid
163 instance being used.  I'd still like to be able to run a test suite on
164 this but that'd require a lot more work to do properly...
165]
166[When multiple specifying list fields in the same section combine them
167Duncan Coutts <duncan@haskell.org>**20080423201519
168 eg if you had:
169 extensions: Foo
170 extensions: Bar, Baz
171 then previously we only ended up with [Bar, Baz]. Now we get them all.
172 Only applies to list fields, for single fields the second value is taken
173 and the first is silently discarded. This isn't good of course but the
174 fix is harder since we're not in a context where we can report errors.
175 Really we should just declare up front what kind of field it is and
176 inherit the right behaviour automagically, either duplicates disallowed
177 or allowed and combined with mappend.
178]
179[Normalise file names in warning messages
180Duncan Coutts <duncan@haskell.org>**20080423190457
181 We already do this for error messages.
182]
183[Fix the check for -XFooBar ghc-options flags to be more permissive
184Duncan Coutts <duncan@haskell.org>**20080423190243
185 Previously we rejected all such flags but that posed the problem that older
186 versions of Cabal, like 1.1.6 did not understand new extensions so we
187 could not actually follow the advice and use the extenion. So now we only
188 warn about -X flags if they refer to old extensions that Cabal 1.1.6 knew
189 about. If the .cabal file specifies cabal-version: >= 1.2 or similar
190 (anything that excludes 1.1.6) then we warn about all -X flags.
191]
192[Add checks for unknown OS Arch and Compiler names
193Duncan Coutts <duncan@haskell.org>**20080423151410
194 They're ok locally but for distribution they need to be known.
195]
196[Package check now take a GenericPackageDescription
197Duncan Coutts <duncan@haskell.org>**20080423150354
198 Unfortunately in some cases we only have a already-configured
199 PackageDescription to we have to expose a checkConfiguredPackage.
200 We should refactor things so that we keep all the information
201 even in a configured PackageDescription.
202]
203[Make warning messages show the file name
204Duncan Coutts <duncan@haskell.org>**20080422141909]
205[Update UTF8 code
206Duncan Coutts <duncan@haskell.org>**20080422141539
207 Some code and test cases taken from the utf8-string package.
208 Updated copyright notice appropriately (I think).
209]
210[fix import for nhc98
211Malcolm.Wallace@cs.york.ac.uk**20080422133009]
212[Don't nub extra-libs in unionBuildInfo
213Duncan Coutts <duncan@haskell.org>**20080420192312
214 It's possible that we sometimes need to list the same library
215 more than once if there are circular symbol references.
216]
217[Fix unionBuildInfo
218Duncan Coutts <duncan@haskell.org>**20080420180520
219 Fix ticket #264 to use nub only on the fields which are treated as sets.
220 Probably we should be using the right types and mappend for each field.
221 Change to construct a new value from scratch rather than overriding one
222 of the two args. This helps to make sure we're updating all the field
223 as we get a warning if we miss any. Turns out we were missing the ghc
224 profiling and shared libs options which meant they were getting dropped.
225 That had the effect of ghc-prof-options: in .cabal files being ignored.
226 Thanks to 'midfield' from #haskell for spotting this.
227]
228[Add newtype FlagName and FlagAssignment type alias
229Duncan Coutts <duncan@haskell.org>**20080415204854
230 and use them in the appropriate places.
231]
232[Add PackageIndex.insert and reverse merge/mappend
233Duncan Coutts <duncan@haskell.org>**20080415203637
234 Packages in the second argument to merge now mask those in the first.
235]
236[Make finalizePackageDescription use CompilerId type
237Duncan Coutts <duncan@haskell.org>**20080413224111
238 Use the proper data type rather than a tuple (CompilerFlavor, Version)
239]
240[Fix #224.  We do not yet warn if the user specified a dependency that
241Thomas Schilling <nominolo@gmail.com>**20080413182659
242 did not occur in the package (it is just silently ignored.)
243]
244[Add 'readP_to_E' function that takes the longest parse.
245Thomas Schilling <nominolo@gmail.com>**20080413182042]
246[Add simple test case for the dependency resolution case.  This should
247Thomas Schilling <nominolo@gmail.com>**20080413132002
248 go into the test suite one day.
249]
250[Fix/Add documentation.
251Thomas Schilling <nominolo@gmail.com>**20080413131839]
252[Change dependency resolution algorithm.
253Thomas Schilling <nominolo@gmail.com>**20080413131807
254 
255 There were two reasons to do this.  Firstly, this formulation makes it
256 easier to add the --constraint command line flag that adds additional
257 constraints on the packages that should be used.
258 
259 Secondly, with the orgininal algorithm it was possible to satisfy the
260 constraint "foo < 1, foo > 2" if we had two versions of package "foo"
261 which each satisfy one constraint.  This patch fixes this by requiring
262 the same package to satisfy both constraints (which of course is
263 impossible in this case).
264]
265[expose ghcOptions
266jeanphilippe.bernardy@gmail.com**20080417211221
267 This helps finding the options to pass to GHC API in various tools
268]
269[expose tryGetConfigStateFile
270jeanphilippe.bernardy@gmail.com**20080417180248
271 This is needed by Yi to (try to) load an arbitrary
272 project.
273]
274[fix for #187 -- directory of Paths_packagename is included when looking for source files
275Andres Loeh <mail@andres-loeh.de>**20080412204904]
276[Check for the required cabal version early in parsing
277Duncan Coutts <duncan@haskell.org>**20080409154655
278 Previously we only checked the "cabal-version" field after parsing
279 and all other configure processing. If the package really needs a
280 later Cabal version it is of course highly likely that parsing or
281 configure are going to fail and the user is not going to get the
282 helpful error message about the version of Cabal required. So now
283 we do the check early during parsing. If a later version is
284 required and parsing subsequently fails, we now report the version
285 issue, not the subsequent parse error. If parsing succeeds we
286 still issue a warning which should be a useful hint to the user if
287 subsequent configure processing fails.
288]
289[Use relative file paths in .cabal parse error messages
290Duncan Coutts <duncan@haskell.org>**20080409154030
291 Do this by normalising the file path in the error message
292 and when looking for .cabal files, by looking in '.' rather
293 than the absolute path of the current directory.
294]
295[Remove unused import
296Duncan Coutts <duncan@haskell.org>**20080409073352]
297[Fix for detecting ~/.cabal/ dir as a .cabal file
298Duncan Coutts <duncan@haskell.org>**20080409073236
299 Which happened if you use cabal configure in your home dir.
300 Now produced the right error message, or if you actually put
301 a cabal project in your home dir, it might actually work.
302 Also, do the same fix for findHookedPackageDesc.
303]
304[Fix spelling in error message
305Duncan Coutts <duncan@haskell.org>**20080408134610]
306[Fix names of profiling libs
307Duncan Coutts <duncan@haskell.org>**20080407013449
308 I broke this recently when refactoring. Restore the original behaviour.
309 Was generating "libHSfoo_p-1.0.a" when it should be "libHSfoo-1.0_p.a".
310]
311[TAG 1.5.1
312Duncan Coutts <duncan@haskell.org>**20080329181329]
313Patch bundle hash:
314a6515671a687e1d4af3085fbe6c9be5ab22055a5