Quantcast

[GHC] #5977: Allow ignoring global package db

classic Classic list List threaded Threaded
14 messages Options
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[GHC] #5977: Allow ignoring global package db

GHC
#5977: Allow ignoring global package db
------------------------------+---------------------------------------------
 Reporter:  duncan            |          Owner:                  
     Type:  feature request   |         Status:  new            
 Priority:  normal            |      Component:  Compiler        
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
 For sandboxing, users want to be able to use only local package dbs. To
 handle rts, base etc, they copy those specific packages from the global
 package db into a local package db.

 Currently however there is no sensible way to tell ghc to look '''only'''
 at the listed package dbs, and not the global db. There is a flag `-no-
 user-package-conf` to avoid looking at the per-user one, but no equivalent
 to ignore or to specify the global one.

 (Note: as a quirky non-sensible way, you can use `GHC_PACKAGE_PATH=""` to
 clear the package db stack, but this should be possible using command line
 flags.)

 The user interface we're now using in cabal is like this:

   * `--global` sets the initial db stack to `[GlobalPackageDB]`
   * `--user` sets the initial db stack to `[GlobalPackageDB,
 UserPackageDB]`
   * `--package-db=clear` clears the db stack to `[]`
   * `--package-db=global` pushes `GlobalPackageDB` on the top of the stack
   * `--package-db=user` pushes `UserPackageDB` on the top of the stack
   * `--package-db=`''${otherfile}'' pushes `SpecificPackageDB`
 ''${otherfile}'' on the top of the stack

 It seems to me we could do something similar with ghc. Currently in ghc we
 have a `-hide-all-packages` flag that resets the package set to empty. We
 could do with an equivalent for the package database stack. I suggest
 something like:

   * `-clear-package-conf`
   * `-global-package-conf`
   * `-user-package-conf` (and the existing `-no-user-package-conf`)
   * `-package-conf` file

 The default would remain that the global and user dbs are used, but this
 can be reset using `-clear-package-conf`.

 Personally I prefer the nomenclarture "package db" rather than "package
 conf" here, but it's not that important.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
#5977: Allow ignoring global package db
------------------------------+---------------------------------------------
 Reporter:  duncan            |          Owner:                  
     Type:  feature request   |         Status:  new            
 Priority:  normal            |      Component:  Compiler        
  Version:  7.4.1             |       Keywords:                  
       Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
  Failure:  None/Unknown      |       Testcase:                  
Blockedby:                    |       Blocking:                  
  Related:                    |  
------------------------------+---------------------------------------------
Changes (by JeremyShaw):

 * cc: JeremyShaw (added)


--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:                  
        Type:  feature request   |      Status:  new            
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by simonmar):

  * priority:  normal => high
  * difficulty:  => Unknown
  * milestone:  => 7.6.1


Comment:

 Yep, let's do something for 7.6.1.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  pcapriotti      
        Type:  feature request   |      Status:  new            
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by simonpj):

  * owner:  => pcapriotti


--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  pcapriotti      
        Type:  feature request   |      Status:  patch          
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by pcapriotti):

  * status:  new => patch


Comment:

 The attached patch series adds the extra flags described in this ticket
 (with the addition of `no-global-package-conf`, for symmetry), and renames
 them to `*-package-db`.

 You can find the corresponding patch for Cabal in my github fork:
 https://github.com/pcapriotti/cabal

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  simonmar        
        Type:  feature request   |      Status:  patch          
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by simonpj):

  * owner:  pcapriotti => simonmar


--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  simonmar        
        Type:  feature request   |      Status:  patch          
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by simonmar):

 I had a look at the patches.  The situation in `DynFlags` is now a bit
 strange - we have both the `Opt_ReadGlobalPackageConf` options ''and'' the
 `[PkgConfRef]`. I think we should have just the `[PkgConfRef]`
 representing the stack, and all the flags should manipulate it directly.

 So

  * We start with `[global,user]`
  * `-no-user-package-db` removes user from the list (similarly for global)
  * `-user-package-db` adds user to the end (similarly for global)
  * `-package-conf file` adds file to the end
  * `-clear-package-db` sets the list to empty

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  pcapriotti      
        Type:  feature request   |      Status:  patch          
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------
Changes (by simonmar):

  * owner:  simonmar => pcapriotti


--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:7>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  pcapriotti      
        Type:  feature request   |      Status:  patch          
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by pcapriotti):

 I'm not sure how that would interact with GHC_PACKAGE_PATH. For example,
 if I run:

 {{{
 GHC_PACKAGE_PATH="foo:" ghc --no-user-package-db
 }}}

 I'd expect it to use `[global, foo]` as db stack, but we can't remove
 `user` from the stack originating from `GHC_PACKAGE_PATH` unless we keep
 the information somewhere (currently it's in `Opt_ReadUserPackageConf`).

 So at the moment there is an "initial stack", which is `[global, user]` by
 default, and is affected by `-no-user-package-db`, `-no-global-package-
 db`, `-clear-package-db`, and `GHC_PACKAGE_PATH`. The other flags append
 to the stack *after* the initial stack has been determined.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  pcapriotti      
        Type:  feature request   |      Status:  patch          
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by simonmar):

 I find it weird that `-no-user-package-db` affects the "initial stack",
 but `-user-package-db` appends the user db to the final stack.  So e.g.
 `-user-package-db -no-user-package-db` does not do what you expect.

 So I see two alternatives.  One is to modify my proposal to take into
 account `GHC_PACKAGE_PATH`: just initialise the stack from
 `GHC_PACKAGE_PATH` before processing the arguments, defaulting to
 `[global,user]` if `GHC_PACKAGE_PATH` is not set.

 The other alternative is to keep the concept of the "initial stack", but
 make `-user-package-db` and `-global-package-db` just the inverses of
 `-no-user-package-db` and `-no-global-package-db` respectively.  I'd be ok
 with that too.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:9>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  pcapriotti      
        Type:  feature request   |      Status:  patch          
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by pcapriotti):

 The attached patch implements option 1. The list of flags is now
 maintained as a `[PkgConfRef] -> [PkgConfRef]`, which is later applied to
 the base stack obtained by `GHC_PACKAGE_PATH`.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  pcapriotti      
        Type:  feature request   |      Status:  patch          
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by simonmar):

 Yes, that looks ok.

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
---------------------------------+------------------------------------------
    Reporter:  duncan            |       Owner:  pcapriotti      
        Type:  feature request   |      Status:  patch          
    Priority:  high              |   Milestone:  7.6.1          
   Component:  Compiler          |     Version:  7.4.1          
    Keywords:                    |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple  |     Failure:  None/Unknown    
  Difficulty:  Unknown           |    Testcase:                  
   Blockedby:                    |    Blocking:                  
     Related:                    |  
---------------------------------+------------------------------------------

Comment(by p.capriotti@…):

 commit 6a831be4aa73e86568256813ffa862d7cfd5732d
 {{{
 Author: Paolo Capriotti <[hidden email]>
 Date:   Thu May 3 11:29:51 2012 +0100

     Add flags to manipulate package db stack (#5977)

     Introduce new flags to allow any package database stack to be set up.
     The `-no-user-package-conf` and `-no-global-package-conf` flags remove
     the corresponding package db from the initial stack, while
     `-user-package-conf` and `-global-package-conf` push it back on top of
     the stack.

  compiler/main/DynFlags.hs  |   24 +++++++++++--
  compiler/main/Packages.lhs |   81
 +++++++++++++++++++++-----------------------
  2 files changed, 60 insertions(+), 45 deletions(-)
 }}}

--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:12>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
GHC
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [GHC] #5977: Allow ignoring global package db

GHC
In reply to this post by GHC
#5977: Allow ignoring global package db
-------------------------------+--------------------------------------------
  Reporter:  duncan            |          Owner:  pcapriotti      
      Type:  feature request   |         Status:  closed          
  Priority:  high              |      Milestone:  7.6.1          
 Component:  Compiler          |        Version:  7.4.1          
Resolution:  fixed             |       Keywords:                  
        Os:  Unknown/Multiple  |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown      |     Difficulty:  Unknown        
  Testcase:                    |      Blockedby:                  
  Blocking:                    |        Related:                  
-------------------------------+--------------------------------------------
Changes (by pcapriotti):

  * status:  patch => closed
  * resolution:  => fixed


--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5977#comment:13>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler

_______________________________________________
Glasgow-haskell-bugs mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs
Loading...