haskell / cabal

Official upstream development repository for Cabal and cabal-install
https://haskell.org/cabal
Other
1.61k stars 691 forks source link

Commandline flags for `cabal update` seem to be wrong #9288

Closed BinderDavid closed 11 months ago

BinderDavid commented 11 months ago

Describe the bug

The command cabal update should be simple and have a small set of flags. Instead, we have the enormous set of flags which are used for building.

To Reproduce

$ cabal update --help
Updates list of known packages.

Usage: cabal update [FLAGS] [REPOS]

For all known remote repositories, download the package list.

Flags for update:
 -h, --help                     Show this help text
 -v, --verbose[=n]              Control verbosity (n is 0--3, default
                                verbosity level is 1)
 --builddir=DIR                 The directory where Cabal puts generated build
                                files (default dist)
 -g, --ghc                      compile with GHC
 --ghcjs                        compile with GHCJS
 --uhc                          compile with UHC
 --haskell-suite                compile with a haskell-suite compiler
 --cabal-file=PATH              use this Cabal file
 -w, --with-compiler=PATH       give the path to a particular compiler
 --with-hc-pkg=PATH             give the path to the package tool
 --prefix=DIR                   bake this prefix in preparation of
                                installation
 --bindir=DIR                   installation directory for executables
 --libdir=DIR                   installation directory for libraries
 --libsubdir=DIR                subdirectory of libdir in which libs are
                                installed
 --dynlibdir=DIR                installation directory for dynamic libraries
 --libexecdir=DIR               installation directory for program executables
 --libexecsubdir=DIR            subdirectory of libexecdir in which private
                                executables are installed
 --datadir=DIR                  installation directory for read-only data
 --datasubdir=DIR               subdirectory of datadir in which data files
                                are installed
 --docdir=DIR                   installation directory for documentation
 --htmldir=DIR                  installation directory for HTML documentation
 --haddockdir=DIR               installation directory for haddock interfaces
 --sysconfdir=DIR               installation directory for configuration files
 --program-prefix=PREFIX        prefix to be applied to installed executables
 --program-suffix=SUFFIX        suffix to be applied to installed executables
 --enable-library-vanilla       Enable Vanilla libraries
 --disable-library-vanilla      Disable Vanilla libraries
 -p, --enable-library-profiling
                                Enable Library profiling
 --disable-library-profiling    Disable Library profiling
 --enable-shared                Enable Shared library
 --disable-shared               Disable Shared library
 --enable-static                Enable Static library
 --disable-static               Disable Static library
 --enable-executable-dynamic    Enable Executable dynamic linking
 --disable-executable-dynamic   Disable Executable dynamic linking
 --enable-executable-static     Enable Executable fully static linking
 --disable-executable-static    Disable Executable fully static linking
 --enable-profiling             Enable Executable and library profiling
 --disable-profiling            Disable Executable and library profiling
 --enable-executable-profiling  Enable Executable profiling (DEPRECATED)
 --disable-executable-profiling
                                Disable Executable profiling (DEPRECATED)
 --profiling-detail=level       Profiling detail level for executable and
                                library (default, none, exported-functions,
                                toplevel-functions, all-functions, late).
 --library-profiling-detail=level
                                Profiling detail level for libraries only.
 -O, --enable-optimization[=n]  Build with optimization (n is 0--2, default is
                                1)
 --disable-optimization         Build without optimization
 --enable-debug-info[=n]        Emit debug info (n is 0--3, default is 0)
 --disable-debug-info           Don't emit debug info
 --enable-build-info            Enable build information generation during
                                project building
 --disable-build-info           Disable build information generation during
                                project building
 --enable-library-for-ghci      Enable compile library for use with GHCi
 --disable-library-for-ghci     Disable compile library for use with GHCi
 --enable-split-sections        Enable compile library code such that unneeded
                                definitions can be dropped from the final
                                executable (GHC 7.8+)
 --disable-split-sections       Disable compile library code such that
                                unneeded definitions can be dropped from the
                                final executable (GHC 7.8+)
 --enable-split-objs            Enable split library into smaller objects to
                                reduce binary sizes (GHC 6.6+)
 --disable-split-objs           Disable split library into smaller objects to
                                reduce binary sizes (GHC 6.6+)
 --enable-executable-stripping  Enable strip executables upon installation to
                                reduce binary sizes
 --disable-executable-stripping
                                Disable strip executables upon installation to
                                reduce binary sizes
 --enable-library-stripping     Enable strip libraries upon installation to
                                reduce binary sizes
 --disable-library-stripping    Disable strip libraries upon installation to
                                reduce binary sizes
 --configure-option=OPT         Extra option for configure
 --user                         Enable doing a per-user installation
 --global                       Disable doing a per-user installation
 --package-db=DB                Append the given package database to the list
                                of package databases used (to satisfy
                                dependencies and register into). May be a
                                specific file, 'global' or 'user'. The initial
                                list is ['global'], ['global', 'user'], or
                                ['global', $sandbox], depending on context.
                                Use 'clear' to reset the list to empty. See
                                the user guide for details.
 -f, --flags=FLAGS              Force values for the given flags in Cabal
                                conditionals in the .cabal file. E.g.,
                                --flags="debug -usebytestrings" forces the
                                flag "debug" to true and "usebytestrings" to
                                false.
 --extra-include-dirs=PATH      A list of directories to search for header
                                files
 --enable-deterministic         Enable Try to be as deterministic as possible
                                (used by the test suite)
 --disable-deterministic        Disable Try to be as deterministic as possible
                                (used by the test suite)
 --ipid=IPID                    Installed package ID to compile this package
                                as
 --cid=CID                      Installed component ID to compile this
                                component as
 --extra-lib-dirs=PATH          A list of directories to search for external
                                libraries
 --extra-lib-dirs-static=PATH   A list of directories to search for external
                                libraries when linking fully static
                                executables
 --extra-framework-dirs=PATH    A list of directories to search for external
                                frameworks (OS X only)
 --extra-prog-path=PATH         A list of directories to search for required
                                programs (in addition to the normal search
                                locations)
 --instantiate-with=NAME=MOD    A mapping of signature names to concrete
                                module instantiations.
 --enable-tests                 Enable dependency checking and compilation for
                                test suites listed in the package description
                                file.
 --disable-tests                Disable dependency checking and compilation
                                for test suites listed in the package
                                description file.
 --enable-coverage              Enable build package with Haskell Program
                                Coverage. (GHC only)
 --disable-coverage             Disable build package with Haskell Program
                                Coverage. (GHC only)
 --enable-library-coverage      Enable build package with Haskell Program
                                Coverage. (GHC only) (DEPRECATED)
 --disable-library-coverage     Disable build package with Haskell Program
                                Coverage. (GHC only) (DEPRECATED)
 --enable-benchmarks            Enable dependency checking and compilation for
                                benchmarks listed in the package description
                                file.
 --disable-benchmarks           Disable dependency checking and compilation
                                for benchmarks listed in the package
                                description file.
 --enable-relocatable           Enable building a package that is relocatable.
                                (GHC only)
 --disable-relocatable          Disable building a package that is
                                relocatable. (GHC only)
 --disable-response-files       enable workaround for old versions of programs
                                like "ar" that do not support @file arguments
 --allow-depending-on-private-libs
                                Allow depending on private libraries. If set,
                                the library visibility check MUST be done
                                externally.
 --with-PROG=PATH               give the path to PROG
 --PROG-option=OPT              give an extra option to PROG (no need to quote
                                options containing spaces)
 --PROG-options=OPTS            give extra options to PROG
 --cabal-lib-version=VERSION    Select which version of the Cabal lib to use
                                to build packages (useful for testing).
 --enable-append                Enable appending the new config to the old
                                config file
 --disable-append               Disable appending the new config to the old
                                config file
 --enable-backup                Enable the backup of the config file before
                                any alterations
 --disable-backup               Disable the backup of the config file before
                                any alterations
 -c, --constraint=CONSTRAINT    Specify constraints on a package (version,
                                installed/source, flags)
 --preference=CONSTRAINT        Specify preferences (soft constraints) on the
                                version of a package
 --solver=SOLVER                Select dependency solver to use (default:
                                modular). Choices: modular.
 --allow-older[=DEPS]           Ignore lower bounds in all dependencies or
                                DEPS
 --allow-newer[=DEPS]           Ignore upper bounds in all dependencies or
                                DEPS
 --write-ghc-environment-files=always|never|ghc8.4.4+
                                Whether to create a .ghc.environment file
                                after a successful build (v2-build only)
 --enable-documentation         Enable building of documentation
 --disable-documentation        Disable building of documentation
 --doc-index-file=TEMPLATE      A central index of haddock API documentation
                                (template cannot use $pkgid)
 --dry-run                      Do not install anything, only print what would
                                be installed.
 --only-download                Do not build anything, only fetch the
                                packages.
 --max-backjumps=NUM            Maximum number of backjumps allowed while
                                solving (default: 4000). Use a negative number
                                to enable unlimited backtracking. Use 0 to
                                disable backtracking completely.
 --reorder-goals                Try to reorder goals according to certain
                                heuristics. Slows things down on average, but
                                may make backtracking faster for some
                                packages.
 --count-conflicts              Try to speed up solving by preferring goals
                                that are involved in a lot of conflicts
                                (default).
 --fine-grained-conflicts       Skip a version of a package if it does not
                                resolve the conflicts encountered in the last
                                version, as a solver optimization (default).
 --minimize-conflict-set        When there is no solution, try to improve the
                                error message by finding a minimal conflict
                                set (default: false). May increase run time
                                significantly.
 --independent-goals            Treat several goals on the command line as
                                independent. If several goals depend on the
                                same package, different versions can be
                                chosen.
 --prefer-oldest                Prefer the oldest (instead of the latest)
                                versions of packages available. Useful to
                                determine lower bounds in the build-depends
                                section.
 --shadow-installed-packages    If multiple package instances of the same
                                version are installed, treat all but one as
                                shadowed.
 --strong-flags                 Do not defer flag choices (this used to be the
                                default in cabal-install <= 1.20).
 --allow-boot-library-installs  Allow cabal to install base, ghc-prim,
                                integer-simple, integer-gmp, and
                                template-haskell.
 --reject-unconstrained-dependencies=none|all
                                Require these packages to have constraints on
                                them if they are to be selected (default:
                                none).
 --reinstall                    Install even if it means installing the same
                                version again.
 --avoid-reinstalls             Do not select versions that would
                                destructively overwrite installed packages.
 --force-reinstalls             Reinstall packages even if they will most
                                likely break other installed packages.
 --upgrade-dependencies         Pick the latest version for all dependencies,
                                rather than trying to pick an installed
                                version.
 --only-dependencies            Install only the dependencies necessary to
                                build the given packages
 --dependencies-only            A synonym for --only-dependencies
 --index-state=STATE            Use source package index state as it existed
                                at a previous time. Accepts unix-timestamps
                                (e.g. '@1474732068'), ISO8601 UTC timestamps
                                (e.g. '2016-09-24T17:47:48Z'), or 'HEAD'
                                (default: 'HEAD').
 --root-cmd=COMMAND             (No longer supported, do not use.)
 --build-summary=TEMPLATE       Save build summaries to file (name template
                                can use $pkgid, $compiler, $os, $arch)
 --build-log=TEMPLATE           Log all builds to file (name template can use
                                $pkgid, $compiler, $os, $arch)
 --remote-build-reporting=LEVEL
                                Generate build reports to send to a remote
                                server (none, anonymous or detailed).
 --report-planning-failure      Generate build reports when the dependency
                                solver fails. This is used by the Hackage
                                build bot.
 --enable-per-component         Enable Per-component builds when possible
 --disable-per-component        Disable Per-component builds when possible
 --run-tests                    Run package test suites during installation.
 -j, --jobs[=NUM]               Run NUM jobs simultaneously (or '$ncpus' if no
                                NUM is given).
 --keep-going                   After a build failure, continue to build other
                                unaffected packages.
 --offline                      Don't download packages from the Internet.
 --haddock-hoogle               Generate a hoogle database
 --haddock-html                 Generate HTML documentation (the default)
 --haddock-html-location=URL    Location of HTML documentation for
                                pre-requisite packages
 --haddock-for-hackage          Collection of flags to generate documentation
                                suitable for upload to hackage
 --haddock-executables          Run haddock for Executables targets
 --haddock-tests                Run haddock for Test Suite targets
 --haddock-benchmarks           Run haddock for Benchmark targets
 --haddock-all                  Run haddock for all targets
 --haddock-internal             Run haddock for internal modules and include
                                all symbols
 --haddock-css=PATH             Use PATH as the haddock stylesheet
 --haddock-hyperlink-source     Hyperlink the documentation to the source code
 --haddock-quickjump            Generate an index for interactive
                                documentation navigation
 --haddock-hscolour-css=PATH    Use PATH as the HsColour stylesheet
 --haddock-contents-location=URL
                                Bake URL in as the location for the contents
                                page
 --haddock-base-url=URL         Base URL for static files.
 --haddock-lib=DIR              location of Haddocks static / auxiliary files
 --test-log=TEMPLATE            Log all test suite results to file (name
                                template can use $pkgid, $compiler, $os,
                                $arch, $test-suite, $result)
 --test-machine-log=TEMPLATE    Produce a machine-readable log file (name
                                template can use $pkgid, $compiler, $os,
                                $arch, $result)
 --test-show-details=FILTER     'always': always show results of individual
                                test cases. 'never': never show results of
                                individual test cases. 'failures': show
                                results of failing test cases. 'streaming':
                                show results of test cases in real
                                time.'direct': send results of test cases in
                                real time; no log file.
 --test-keep-tix-files          keep .tix files for HPC between test runs
 --test-wrapper=FILE            Run test through a wrapper.
 --test-fail-when-no-test-suites
                                Exit with failure when no test suites are
                                found.
 --test-options=TEMPLATES       give extra options to test executables (name
                                templates can use $pkgid, $compiler, $os,
                                $arch, $test-suite)
 --test-option=TEMPLATE         give extra option to test executables (no need
                                to quote options containing spaces, name
                                template can use $pkgid, $compiler, $os,
                                $arch, $test-suite)
 --benchmark-options=TEMPLATES  give extra options to benchmark executables
                                (name templates can use $pkgid, $compiler,
                                $os, $arch, $benchmark)
 --benchmark-option=TEMPLATE    give extra option to benchmark executables (no
                                need to quote options containing spaces, name
                                template can use $pkgid, $compiler, $os,
                                $arch, $benchmark)
 --project-file=FILE            Set the name of the cabal.project file to
                                search for in parent directories
 -z, --ignore-project           Ignore local project configuration

REPO has the format <repo-id>[,<index-state>] where index-state follows
the same format and syntax that is supported by the --index-state flag.

Examples:
  cabal update
    Download the package list for all known remote repositories.

  cabal update hackage.haskell.org,@1474732068
  cabal update hackage.haskell.org,2016-09-24T17:47:48Z
  cabal update hackage.haskell.org,HEAD
  cabal update hackage.haskell.org
    Download hackage.haskell.org at a specific index state.

  cabal update hackage.haskell.org head.hackage
    Download hackage.haskell.org and head.hackage
    head.hackage must be a known repo-id. E.g. from
    your cabal.project(.local) file.

Expected behavior

A small set of flags specific for cabal update. For example, something like the flags for the cabal list command:

cabal list --help
List packages matching a search string.

Usage: cabal list [FLAGS]
   or: cabal list [FLAGS] STRINGS

List all packages, or all packages matching one of the search strings.

Use the package database specified with --package-db. If not specified, use
the user package database.

Flags for list:
 -h, --help                     Show this help text
 -v, --verbose[=n]              Control verbosity (n is 0--3, default
                                verbosity level is 1)
 --installed                    Only print installed packages
 --simple-output                Print in a easy-to-parse format
 -i, --ignore-case              Enable Ignore case distinctions
 -I, --strict-case              Disable Ignore case distinctions
 --package-db=DB                Append the given package database to the list
                                of package databases used (to satisfy
                                dependencies and register into). May be a
                                specific file, 'global' or 'user'. The initial
                                list is ['global'], ['global', 'user'],
                                depending on context. Use 'clear' to reset the
                                list to empty. See the user guide for details.
 -w, --with-compiler=PATH       give the path to a particular compiler

Examples:
  cabal list pandoc
    Will find pandoc, pandoc-citeproc, pandoc-lens, ...

System information

fgaz commented 11 months ago

I think this is a duplicate of #7437

BinderDavid commented 11 months ago

Ok, sorry. I searched specifically for cabal update in the issues, but not for command line options in general. I will see if I can take a stab at solving this for cabal update in particular.

Mikolaj commented 11 months ago

I will see if I can take a stab at solving this for cabal update in particular.

That may be hard to do, but perhaps solving this for all v2 commands is not that hard?