@@ -2676,43 +2676,32 @@ Starting with Cabal-2.2 it's possible to use common build info stanzas.
2676
2676
2677
2677
TBW
2678
2678
2679
- Source Repositories
2680
- ^^^^^^^^^^^^^^^^^^^
2679
+
2680
+ .. _pkg-author-source :
2681
+
2682
+ *Source code * repository marker
2683
+ -------------------------------
2681
2684
2682
2685
.. pkg-section :: source-repository
2683
2686
:since: 1.6
2684
2687
2685
- It is often useful to be able to specify a source revision control
2686
- repository for a package. Cabal lets you specify this information in
2687
- a relatively structured form which enables other tools to interpret and
2688
- make effective use of the information. For example the information
2689
- should be sufficient for an automatic tool to checkout the sources.
2690
-
2691
- Cabal supports specifying different information for various common
2692
- source control systems. Obviously not all automated tools will support
2693
- all source control systems.
2688
+ A marker that points to the *source code * for this package within a
2689
+ **source code repository **.
2694
2690
2695
- Cabal supports specifying repositories for different use cases. By
2696
- declaring which case we mean automated tools can be more useful. There
2697
- are currently two kinds defined:
2691
+ There are two kinds. You can specify one or the other or both at once:
2698
2692
2699
2693
- The ``head `` kind refers to the latest development branch of the
2700
2694
package. This may be used for example to track activity of a project
2701
2695
or as an indication to outside developers what sources to get for
2702
2696
making new contributions.
2703
2697
2704
2698
- The ``this `` kind refers to the branch and tag of a repository that
2705
- contains the sources for this version or release of a package. For
2706
- most source control systems this involves specifying a tag, id or
2707
- hash of some form and perhaps a branch. The purpose is to be able to
2708
- reconstruct the sources corresponding to a particular package
2709
- version. This might be used to indicate what sources to get if
2710
- someone needs to fix a bug in an older branch that is no longer an
2711
- active head branch.
2712
-
2713
- You can specify one kind or the other or both. As an example here are
2714
- the repositories for the Cabal library. Note that the ``this `` kind of
2715
- repository specifies a tag.
2699
+ contains the sources for this version or release of a package. For most
2700
+ source control systems this involves specifying a tag, id or hash of some
2701
+ form and perhaps a branch.
2702
+
2703
+ As an example, here are the repositories for the Cabal library. Note that the
2704
+ ``this `` kind of repository specifies a tag.
2716
2705
2717
2706
::
2718
2707
@@ -2725,32 +2714,29 @@ repository specifies a tag.
2725
2714
location: https://github.com/haskell/cabal
2726
2715
tag: 1.6.1
2727
2716
2728
- The exact fields are as follows:
2729
-
2730
- .. pkg-field :: type: token
2717
+ The :ref: `cabal get<cabal-get> ` command uses the kind of repository with
2718
+ its ``--source-repository `` option, if provided.
2731
2719
2732
- The name of the source control system used for this repository. The
2733
- currently recognised types are:
2720
+ .. _source-repository-fields :
2734
2721
2735
- - ``darcs ``
2736
- - ``git ``
2737
- - ``svn ``
2738
- - ``cvs ``
2739
- - ``mercurial `` (or alias ``hg ``)
2740
- - ``bazaar `` (or alias ``bzr ``)
2741
- - ``arch ``
2742
- - ``monotone ``
2722
+ The :ref: `VCS fields<vcs-fields> ` of ``source-repository `` are:
2743
2723
2744
- This field is required.
2724
+ ..
2725
+ data SourceRepo = SourceRepo
2726
+ { repoKind :: RepoKind
2727
+ , repoType :: Maybe RepoType
2728
+ , repoLocation :: Maybe String
2729
+ , repoModule :: Maybe String
2730
+ , repoBranch :: Maybe String
2731
+ , repoTag :: Maybe String
2732
+ , repoSubdir :: Maybe FilePath
2733
+ }
2745
2734
2746
- .. pkg-field :: location: URL
2735
+ .. pkg-field :: type: VCS kind
2747
2736
2748
- The location of the repository. The exact form of this field depends
2749
- on the repository type. For example:
2737
+ This field is required.
2750
2738
2751
- - for darcs: ``http://code.haskell.org/foo/ ``
2752
- - for git: ``git://github.com/foo/bar.git ``
2753
- - for CVS: ``
[email protected] :/cvs``
2739
+ .. pkg-field :: location: VCS location
2754
2740
2755
2741
This field is required.
2756
2742
@@ -2762,35 +2748,20 @@ The exact fields are as follows:
2762
2748
This field is required for the CVS repository type and should not be
2763
2749
used otherwise.
2764
2750
2765
- .. pkg-field :: branch: token
2766
-
2767
- Many source control systems support the notion of a branch, as a
2768
- distinct concept from having repositories in separate locations. For
2769
- example CVS, SVN and git use branches while darcs uses different
2770
- locations for different branches. If you need to specify a branch to
2771
- identify a your repository then specify it in this field.
2751
+ .. pkg-field :: branch: VCS branch
2772
2752
2773
2753
This field is optional.
2774
2754
2775
- .. pkg-field :: tag: token
2776
-
2777
- A tag identifies a particular state of a source repository. The tag
2778
- can be used with a ``this `` repository kind to identify the state of
2779
- a repository corresponding to a particular package version or
2780
- release. The exact form of the tag depends on the repository type.
2755
+ .. pkg-field :: tag: VCS tag
2781
2756
2782
2757
This field is required for the ``this `` repository kind.
2783
2758
2784
- .. pkg-field :: subdir: directory
2759
+ This might be used to indicate what sources to get if someone needs to fix a
2760
+ bug in an older branch that is no longer an active head branch.
2785
2761
2786
- Some projects put the sources for multiple packages under a single
2787
- source repository. This field lets you specify the relative path
2788
- from the root of the repository to the top directory for the
2789
- package, i.e. the directory containing the package's ``.cabal ``
2790
- file.
2762
+ .. pkg-field :: subdir: VCS subdirectory
2791
2763
2792
- This field is optional. It defaults to empty which corresponds to the
2793
- root directory of the repository.
2764
+ This field is optional but, if given, specifies a single subdirectory.
2794
2765
2795
2766
2796
2767
.. _setup-hooks :
0 commit comments