Ticket #5977: 0002-Rename-package-conf-flags-to-package-db.patch

File 0002-Rename-package-conf-flags-to-package-db.patch, 16.0 KB (added by pcapriotti, 2 years ago)
  • aclocal.m4

    From 93301b81cb8d19051bebde0db2e46115749d3945 Mon Sep 17 00:00:00 2001
    From: Paolo Capriotti <p.capriotti@gmail.com>
    Date: Fri, 4 May 2012 13:04:43 +0100
    Subject: [PATCH 2/3] Rename package-conf flags to package-db.
    
    ---
     aclocal.m4                    |    2 +-
     bindisttest/Makefile          |    4 ++--
     bindisttest/ghc.mk            |    4 ++--
     compiler/main/DynFlags.hs     |   16 ++++++++--------
     compiler/main/Packages.lhs    |    4 ++--
     configure.ac                  |    4 ++++
     ghc.mk                        |    2 +-
     mk/config.mk.in               |    2 ++
     rules/distdir-way-opts.mk     |    2 +-
     rules/package-config.mk       |    8 ++++----
     utils/ghc-cabal/Main.hs       |    2 +-
     utils/ghc-cabal/ghc.mk        |    2 +-
     utils/ghc-pkg/Main.hs         |   20 ++++++++++----------
     utils/ghc-pkg/ghc-pkg.wrapper |    2 +-
     utils/ghc-pkg/ghc.mk          |    6 +++---
     15 files changed, 43 insertions(+), 37 deletions(-)
    
    diff --git a/aclocal.m4 b/aclocal.m4
    index c196bdf..f05dfe9 100644
    a b AC_MSG_NOTICE(Building in-tree ghc-pwd) 
    18081808    dnl except we don't want to have to know what make is called. Sigh. 
    18091809    rm -rf utils/ghc-pwd/dist-boot 
    18101810    mkdir  utils/ghc-pwd/dist-boot 
    1811     if ! "$WithGhc" -v0 -no-user-package-conf -hidir utils/ghc-pwd/dist-boot -odir utils/ghc-pwd/dist-boot -stubdir utils/ghc-pwd/dist-boot --make utils/ghc-pwd/Main.hs -o utils/ghc-pwd/dist-boot/ghc-pwd 
     1811    if ! "$WithGhc" -v0 -no-user-$GHC_PACKAGE_DB_FLAG -hidir utils/ghc-pwd/dist-boot -odir utils/ghc-pwd/dist-boot -stubdir utils/ghc-pwd/dist-boot --make utils/ghc-pwd/Main.hs -o utils/ghc-pwd/dist-boot/ghc-pwd 
    18121812    then 
    18131813        AC_MSG_ERROR([Building ghc-pwd failed]) 
    18141814    fi 
  • bindisttest/Makefile

    diff --git a/bindisttest/Makefile b/bindisttest/Makefile
    index 238bce7..7d20bdb 100644
    a b endif 
    4848        $(BIN_DIST_INST_DIR)/bin/ghc --make HelloWorld 
    4949        ./HelloWorld > output 
    5050        $(CONTEXT_DIFF) output expected_output 
    51 # Without --no-user-package-conf we might pick up random packages from ~/.ghc 
    52         $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-conf 
     51# Without --no-user-package-db we might pick up random packages from ~/.ghc 
     52        $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-db 
    5353 
    5454clean distclean: 
    5555        "$(RM)" $(RM_OPTS_REC) $(BIN_DIST_INST_SUBDIR) 
  • bindisttest/ghc.mk

    diff --git a/bindisttest/ghc.mk b/bindisttest/ghc.mk
    index e051be0..c911da5 100644
    a b endif 
    4848        $(BIN_DIST_INST_DIR)/bin/ghc --make bindisttest/HelloWorld 
    4949        bindisttest/HelloWorld > bindisttest/output 
    5050        $(CONTEXT_DIFF) bindisttest/output bindisttest/expected_output 
    51 # Without --no-user-package-conf we might pick up random packages from ~/.ghc 
    52         $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-conf 
     51# Without --no-user-package-db we might pick up random packages from ~/.ghc 
     52        $(BIN_DIST_INST_DIR)/bin/ghc-pkg check --no-user-package-db 
    5353 
    5454$(eval $(call clean-target,bindisttest,all,$(BIN_DIST_INST_DIR) $(wildcard bindisttest/a/b/c/*) bindisttest/HelloWorld bindisttest/HelloWorld.o bindisttest/HelloWorld.hi bindisttest/output)) 
    5555 
  • compiler/main/DynFlags.hs

    diff --git a/compiler/main/DynFlags.hs b/compiler/main/DynFlags.hs
    index f49da93..7d22a7b 100644
    a b data DynFlags = DynFlags { 
    551551 
    552552  --  Package flags 
    553553  extraPkgConfs         :: [PkgConfRef], 
    554         -- ^ The @-package-conf@ flags given on the command line, in the order 
     554        -- ^ The @-package-db@ flags given on the command line, in the order 
    555555        -- they appeared. 
    556556 
    557557  packageFlags          :: [PackageFlag], 
    parseDynamicFlagsCmdLine :: Monad m => 
    13421342parseDynamicFlagsCmdLine dflags args = parseDynamicFlags dflags args True 
    13431343 
    13441344-- | Like 'parseDynamicFlagsCmdLine' but does not allow the package flags 
    1345 -- (-package, -hide-package, -ignore-package, -hide-all-packages, -package-conf). 
     1345-- (-package, -hide-package, -ignore-package, -hide-all-packages, -package-db). 
    13461346-- Used to parse flags set in a modules pragma. 
    13471347parseDynamicFilePragma :: Monad m => 
    13481348                     DynFlags -> [Located String] 
    dynamic_flags = [ 
    17571757package_flags :: [Flag (CmdLineP DynFlags)] 
    17581758package_flags = [ 
    17591759        ------- Packages ---------------------------------------------------- 
    1760     Flag "package-conf"          (HasArg (extraPkgConf_ . PkgConfFile)) 
    1761   , Flag "clear-package-conf"    (NoArg clearPkgConf) 
    1762   , Flag "no-global-package-conf" (NoArg (unSetDynFlag Opt_ReadGlobalPackageConf)) 
    1763   , Flag "no-user-package-conf"  (NoArg (unSetDynFlag Opt_ReadUserPackageConf)) 
    1764   , Flag "global-package-conf"   (NoArg (extraPkgConf_ GlobalPkgConf)) 
    1765   , Flag "user-package-conf"     (NoArg (extraPkgConf_ UserPkgConf)) 
     1760    Flag "package-db"            (HasArg (extraPkgConf_ . PkgConfFile)) 
     1761  , Flag "clear-package-db"      (NoArg clearPkgConf) 
     1762  , Flag "no-global-package-db" (NoArg (unSetDynFlag Opt_ReadGlobalPackageConf)) 
     1763  , Flag "no-user-package-db"    (NoArg (unSetDynFlag Opt_ReadUserPackageConf)) 
     1764  , Flag "global-package-db"     (NoArg (extraPkgConf_ GlobalPkgConf)) 
     1765  , Flag "user-package-db"       (NoArg (extraPkgConf_ UserPkgConf)) 
    17661766 
    17671767  , Flag "package-name"          (hasArg setPackageName) 
    17681768  , Flag "package-id"            (HasArg exposePackageId) 
  • compiler/main/Packages.lhs

    diff --git a/compiler/main/Packages.lhs b/compiler/main/Packages.lhs
    index 12aefc0..6d917fa 100644
    a b initPackages dflags = do 
    184184 
    185185readPackageConfigs :: DynFlags -> IO [PackageConfig] 
    186186readPackageConfigs dflags = do 
    187   let -- Read global package db, unless the -no-user-package-conf flag was given 
     187  let -- Read global package db, unless the -no-user-package-db flag was given 
    188188      global_conf_refs = [GlobalPkgConf | dopt Opt_ReadGlobalPackageConf dflags] 
    189189      -- Read user's package conf (eg. ~/.ghc/i386-linux-6.3/package.conf) 
    190       -- unless the -no-user-package-conf flag was given. 
     190      -- unless the -no-user-package-db flag was given. 
    191191      user_conf_refs = [UserPkgConf | dopt Opt_ReadUserPackageConf dflags] 
    192192 
    193193      system_conf_refs = global_conf_refs ++ user_conf_refs 
  • configure.ac

    diff --git a/configure.ac b/configure.ac
    index 8e3d9d2..aeea6a4 100644
    a b if test "$BootingFromHc" = "NO"; then 
    161161     or --with-ghc to specify a different GHC to use.]) 
    162162     fi 
    163163  fi 
     164 
     165  GHC_PACKAGE_DB_FLAG=package-db 
     166  FP_COMPARE_VERSIONS([$GhcVersion],[-lt],[7.5],GHC_PACKAGE_DB_FLAG=package-conf) 
     167  AC_SUBST(GHC_PACKAGE_DB_FLAG) 
    164168fi; 
    165169 
    166170# GHC is passed to Cabal, so we need a native path 
  • ghc.mk

    diff --git a/ghc.mk b/ghc.mk
    index 195310b..a23171c 100644
    a b install_packages: rts/package.conf.install 
    899899        $(call INSTALL_DIR,"$(DESTDIR)$(topdir)") 
    900900        $(call removeTrees,"$(INSTALLED_PACKAGE_CONF)") 
    901901        $(call INSTALL_DIR,"$(INSTALLED_PACKAGE_CONF)") 
    902         "$(INSTALLED_GHC_PKG_REAL)" --force --global-conf "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install 
     902        "$(INSTALLED_GHC_PKG_REAL)" --force --global-package-db "$(INSTALLED_PACKAGE_CONF)" update rts/package.conf.install 
    903903        $(foreach p, $(INSTALLED_PKG_DIRS),                           \ 
    904904            $(call make-command,                                      \ 
    905905                   CROSS_COMPILE="$(CrossCompilePrefix)"              \ 
  • mk/config.mk.in

    diff --git a/mk/config.mk.in b/mk/config.mk.in
    index b998946..1cf8685 100644
    a b compiler/cmm/Bitmap_HC_OPTS += -ffull-laziness 
    543543# for some unknown reason, so turn full-laziness back on for this module. 
    544544endif 
    545545 
     546GHC_PACKAGE_DB_FLAG = @GHC_PACKAGE_DB_FLAG@ 
     547 
    546548#----------------------------------------------------------------------------- 
    547549# C compiler 
    548550# 
  • rules/distdir-way-opts.mk

    diff --git a/rules/distdir-way-opts.mk b/rules/distdir-way-opts.mk
    index dcbd9cb..bbd37d1 100644
    a b define distdir-way-opts # args: $1 = dir, $2 = distdir, $3 = way, $4 = stage 
    6161#    
    6262#  $1_$2_EXTRA_HC_OPTS   GHC options for this dir/distdir  mk/build.mk 
    6363#    
    64 #  $1_$2_HC_PKGCONF      -package-conf flag if necessary   rules/package-config.mk 
     64#  $1_$2_HC_PKGCONF      -package-db flag if necessary   rules/package-config.mk 
    6565#    
    6666#  $1_$2_HS_SRC_DIRS     dirs relative to $1 containing    $1/$2/package-data.mk 
    6767#                        source files    
  • rules/package-config.mk

    diff --git a/rules/package-config.mk b/rules/package-config.mk
    index e0c9757..1173e5f 100644
    a b $1_$2_HC_MK_DEPEND = $$($1_$2_HC) 
    3434# on cygwin we get a dep on c:/ghc/..., and make gets confused by the : 
    3535$1_$2_HC_MK_DEPEND_DEP = 
    3636$1_$2_HC_DEP = 
    37 $1_$2_HC_PKGCONF = -package-conf $$(BOOTSTRAPPING_CONF) 
    38 $1_$2_GHC_PKG_OPTS = --package-conf=$$(BOOTSTRAPPING_CONF) 
     37$1_$2_HC_PKGCONF = -$(GHC_PACKAGE_DB_FLAG) $$(BOOTSTRAPPING_CONF) 
     38$1_$2_GHC_PKG_OPTS = --$(GHC_PACKAGE_DB_FLAG)=$$(BOOTSTRAPPING_CONF) 
    3939$1_$2_CONFIGURE_OPTS += --package-db=$$(TOP)/$$(BOOTSTRAPPING_CONF) 
    40 $1_$2_MORE_HC_OPTS += -no-user-package-conf 
     40$1_$2_MORE_HC_OPTS += -no-user-$(GHC_PACKAGE_DB_FLAG) 
    4141$1_$2_MORE_HC_OPTS += -rtsopts 
    4242else 
    4343$1_$2_HC_PKGCONF =  
    $1_$2_GHC_PKG_OPTS = 
    5151$1_$2_HC_MK_DEPEND = $$(GHC_STAGE1) 
    5252$1_$2_HC_MK_DEPEND_DEP = $$($1_$2_HC_MK_DEPEND) 
    5353$1_$2_HC_DEP = $$($1_$2_HC) 
    54 $1_$2_MORE_HC_OPTS += -no-user-package-conf 
     54$1_$2_MORE_HC_OPTS += -no-user-package-db 
    5555$1_$2_MORE_HC_OPTS += -rtsopts 
    5656endif 
    5757 
  • utils/ghc-cabal/Main.hs

    diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs
    index c24f127..0f11eea 100644
    a b doInstall ghc ghcpkg strip topdir directory distDir 
    190190                    programPostConf = \_ _ -> return ["-B" ++ topdir], 
    191191                    programFindLocation = \_ -> return (Just ghc) } 
    192192                ghcPkgProgram' = ghcPkgProgram { 
    193                     programPostConf = \_ _ -> return $ ["--global-conf", ghcpkgconf] 
     193                    programPostConf = \_ _ -> return $ ["--global-package-db", ghcpkgconf] 
    194194                                                    ++ ["--force" | not (null myDestDir) ], 
    195195                    programFindLocation = \_ -> return (Just ghcpkg) } 
    196196                stripProgram' = stripProgram { 
  • utils/ghc-cabal/ghc.mk

    diff --git a/utils/ghc-cabal/ghc.mk b/utils/ghc-cabal/ghc.mk
    index 3ee2b13..0a3e920 100644
    a b $(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(wildcard libraries/Cabal/C 
    2727 
    2828$(GHC_CABAL_DIR)/dist/build/tmp/ghc-cabal$(exeext): $(GHC_CABAL_DIR)/Main.hs $(TOUCH_DEP) | $$(dir $$@)/. bootstrapping/. 
    2929        "$(GHC)" $(SRC_HC_OPTS) --make $(GHC_CABAL_DIR)/Main.hs -o $@ \ 
    30                -no-user-package-conf \ 
     30               -no-user-$(GHC_PACKAGE_DB_FLAG) \ 
    3131               -Wall \ 
    3232               -DCABAL_VERSION=$(CABAL_VERSION) \ 
    3333               -odir  bootstrapping \ 
  • utils/ghc-pkg/Main.hs

    diff --git a/utils/ghc-pkg/Main.hs b/utils/ghc-pkg/Main.hs
    index e29301d..e63139e 100644
    a b flags = [ 
    119119        "use the current user's package database", 
    120120  Option [] ["global"] (NoArg FlagGlobal) 
    121121        "use the global package database", 
    122   Option ['f'] ["package-conf"] (ReqArg FlagConfig "FILE") 
     122  Option ['f'] ["package-db"] (ReqArg FlagConfig "FILE") 
    123123        "use the specified package config file", 
    124   Option [] ["global-conf"] (ReqArg FlagGlobalConfig "FILE") 
     124  Option [] ["global-package-db"] (ReqArg FlagGlobalConfig "FILE") 
    125125        "location of the global package config", 
    126   Option [] ["no-user-package-conf"] (NoArg FlagNoUserDb) 
     126  Option [] ["no-user-package-db"] (NoArg FlagNoUserDb) 
    127127        "never read the user package database", 
    128128  Option [] ["force"] (NoArg FlagForce) 
    129129         "ignore missing dependencies, directories, and libraries", 
    usageHeader prog = substProg prog $ 
    177177  "  $p init {path}\n" ++ 
    178178  "    Create and initialise a package database at the location {path}.\n" ++ 
    179179  "    Packages can be registered in the new database using the register\n" ++ 
    180   "    command with --package-conf={path}.  To use the new database with GHC,\n" ++ 
    181   "    use GHC's -package-conf flag.\n" ++ 
     180  "    command with --package-db={path}.  To use the new database with GHC,\n" ++ 
     181  "    use GHC's -package-db flag.\n" ++ 
    182182  "\n" ++ 
    183183  "  $p register {filename | -}\n" ++ 
    184184  "    Register the package using the specified installed package\n" ++ 
    usageHeader prog = substProg prog $ 
    247247  "    Regenerate the package database cache.  This command should only be\n" ++ 
    248248  "    necessary if you added a package to the database by dropping a file\n" ++ 
    249249  "    into the database directory manually.  By default, the global DB\n" ++ 
    250   "    is recached; to recache a different DB use --user or --package-conf\n" ++ 
     250  "    is recached; to recache a different DB use --user or --package-db\n" ++ 
    251251  "    as appropriate.\n" ++ 
    252252  "\n" ++ 
    253253  " Substring matching is supported for {module} in find-module and\n" ++ 
    usageHeader prog = substProg prog $ 
    257257  "  When asked to modify a database (register, unregister, update,\n"++ 
    258258  "  hide, expose, and also check), ghc-pkg modifies the global database by\n"++ 
    259259  "  default.  Specifying --user causes it to act on the user database,\n"++ 
    260   "  or --package-conf can be used to act on another database\n"++ 
     260  "  or --package-db can be used to act on another database\n"++ 
    261261  "  entirely. When multiple of these options are given, the rightmost\n"++ 
    262262  "  one is used as the database to act upon.\n"++ 
    263263  "\n"++ 
    264264  "  Commands that query the package database (list, tree, latest, describe,\n"++ 
    265265  "  field) operate on the list of databases specified by the flags\n"++ 
    266   "  --user, --global, and --package-conf.  If none of these flags are\n"++ 
     266  "  --user, --global, and --package-db.  If none of these flags are\n"++ 
    267267  "  given, the default is --global --user.\n"++ 
    268268  "\n" ++ 
    269269  " The following optional flags are also accepted:\n" 
    getPkgDatabases :: Verbosity 
    471471getPkgDatabases verbosity modify use_cache expand_vars my_flags = do 
    472472  -- first we determine the location of the global package config.  On Windows, 
    473473  -- this is found relative to the ghc-pkg.exe binary, whereas on Unix the 
    474   -- location is passed to the binary using the --global-config flag by the 
     474  -- location is passed to the binary using the --global-package-db flag by the 
    475475  -- wrapper script. 
    476   let err_msg = "missing --global-conf option, location of global package.conf unknown\n" 
     476  let err_msg = "missing --global-package-db option, location of global package database unknown\n" 
    477477  global_conf <- 
    478478     case [ f | FlagGlobalConfig f <- my_flags ] of 
    479479        [] -> do mb_dir <- getLibDir 
  • utils/ghc-pkg/ghc-pkg.wrapper

    diff --git a/utils/ghc-pkg/ghc-pkg.wrapper b/utils/ghc-pkg/ghc-pkg.wrapper
    index fad4bdf..3a14de1 100644
    a b  
    11#!/bin/sh 
    22 
    33PKGCONF="$topdir/package.conf.d" 
    4 exec "$executablename" --global-conf "$PKGCONF" ${1+"$@"} 
     4exec "$executablename" --global-package-db "$PKGCONF" ${1+"$@"} 
    55 
  • utils/ghc-pkg/ghc.mk

    diff --git a/utils/ghc-pkg/ghc.mk b/utils/ghc-pkg/ghc.mk
    index 4f4967e..8ec3fd0 100644
    a b else 
    2424        $(call removeFiles,$@) 
    2525        echo "#!/bin/sh" >>$@ 
    2626        echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@ 
    27         echo '$(TOP)/$< --global-conf $$PKGCONF $${1+"$$@"}' >> $@ 
     27        echo '$(TOP)/$< --global-package-db $$PKGCONF $${1+"$$@"}' >> $@ 
    2828        chmod +x $@ 
    2929endif 
    3030 
    else 
    3838        $(call removeFiles,$@) 
    3939        echo "#!/bin/sh" >>$@ 
    4040        echo "PKGCONF=$(TOP)/$(INPLACE_PACKAGE_CONF)" >>$@ 
    41         echo '$(TOP)/$< --global-conf $$PKGCONF $${1+"$$@"}' >> $@ 
     41        echo '$(TOP)/$< --global-package-db $$PKGCONF $${1+"$$@"}' >> $@ 
    4242        chmod +x $@ 
    4343endif 
    4444 
    endif 
    5353# 
    5454utils/ghc-pkg/dist/build/tmp/$(utils/ghc-pkg_dist_PROG)$(exeext): utils/ghc-pkg/Main.hs utils/ghc-pkg/Version.hs | bootstrapping/. $$(dir $$@)/. $(GHC_CABAL_INPLACE)  
    5555        "$(GHC)" $(SRC_HC_OPTS) --make utils/ghc-pkg/Main.hs -o $@ \ 
    56                -no-user-package-conf \ 
     56               -no-user-$(GHC_PACKAGE_DB_FLAG) \ 
    5757               -Wall -fno-warn-unused-imports -fno-warn-warnings-deprecations \ 
    5858               $(SRC_HC_WARNING_OPTS) \ 
    5959               -DCABAL_VERSION=$(CABAL_VERSION) \