annotate README.txt @ 53:81fe0523a078

documentation
author Jeff Hammel <jhammel@mozilla.com>
date Tue, 15 Nov 2011 16:17:55 -0800
parents 738d84b4de52
children 2dfdff7549b2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 fetch
20
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
2 =====
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4 fetch stuff from the interwebs
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
5
53
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
6 `fetch.py <http://k0s.org/mozilla/hg/fetch/raw-file/tip/fetch.py>`_ is
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
7 a single-file python module bundled as a
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
8 `package <http://k0s.org/mozilla/hg/fetch/>`_ for easy installation
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
9 and python importing. The purpose of fetch is to mirror remote
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
10 resources (URLs) to a local filesystem in order to synchronize and
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
11 update dependencies that are desired to be mirrored in this way.
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
12
20
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
13
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 Format
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 ------
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
16
53
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
17 ``fetch`` fetches from a manifest of the format::
20
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
18
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
19 [URL] [Destination] [Type]
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
20
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
21 A URL can contain a hash tag (e.g. http://example.com/foo#bar/fleem)
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
22 which is used to extract the subdirectories from a multi-directory
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
23 resource.
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
24
53
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
25 The ``Type`` of the resource is used to dispatch to the included
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
26 Fetchers that take care of fetching the object.
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
27
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
28 Manifests are used so that a number of resources may be fetched from a
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
29 particular ``fetch`` run.
20
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
30
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
31
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
32 Fetchers
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
33 --------
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
34
53
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
35 ``fetch`` includes several objects for fetching resources::
13
3fee8ecd1af8 restructure while we still just have one module
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
36
20
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
37 file : fetch a single file
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
38 tar : fetch and extract a tarball
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
39 hg : checkout a mercurial repository
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
40 git : checkout a git repository
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
41
53
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
42 The ``file`` fetcher cannot have a hash tag subpath since it is a single
20
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
43 resource.
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
44
53
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
45 Though ``fetch`` has a set of fetchers included, you can pass an
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
46 arbitrary list into ``fetch.Fetch``'s constructor.
20
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
47
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
48
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
49 Version Control
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
50 ---------------
738d84b4de52 start documenting
Jeff Hammel <jhammel@mozilla.com>
parents: 13
diff changeset
51
53
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
52 The ``hg`` and the ``git`` fetchers fetch from version control systems and
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
53 have additional options. The only current option to the constructor
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
54 is ``export``, which is by default True. If ``export`` is True, then
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
55 the repository will be exported into a non-versioned structure. If a
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
56 subpath is specified with a ``#`` in the URL, the repository will also
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
57 be exported.
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
58
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
59
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
60 TODO
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
61 ----
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
62
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
63 * use `manifestparser <https://github.com/mozilla/mozbase/blob/master/manifestdestiny/manifestparser.py>`_
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
64 ``.ini`` files versus another manifest
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
65 format: when I started work on ``fetch``, I thought a
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
66 domain-specific manifest would be a big win. But, now, maybe a
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
67 ``.ini`` type manifest looks about the same, and is something that
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
68 is already used. The switch internally wouldn't be that bad, but
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
69 if ``fetch.py`` is used as a single file, it cannot have
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
70 "traditional" python dependencies. Since ``manifestparser.py`` is
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
71 also a single file, and ``fetch`` is only usable with internet
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
72 access anyway, maybe the
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
73 `require <http://k0s.org/hg/config/file/tip/python/require.py>`_
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
74 pattern could be used for this purpose
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
75
53
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
76 * clobber: generally, you will want the existing resource to be
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
77 clobbered, avoiding renames regarding upstream dependencies
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
78
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
79 * outputting only subpaths: often, you will not to fetch from the
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
80 whole manifest, only from certain subpaths of the manifest. You
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
81 should be able to output a subset of what is to be mirrored based
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
82 on destination subpaths. The CLI option ``--dest`` is intended for
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
83 this purpose but currently unused.
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
84
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
85 * fetcher options:
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
86
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
87 * note python 2.5+ specifics:
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
88
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
89 Unsolved Problems
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
90 -----------------
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
91
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
92 A common story for ``fetch`` is mirroring files into a VCS repository
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
93 because the remote resources are needed as part of the repository and
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
94 there is no better way to retrieve and/or update them. However, what
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
95 do you do if these remote resources are altered? In an ideal
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
96 ecosystem, the fixes would be automatically triaged and triggered for
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
97 upstream inclusion, or the diffs from the upstream are kept in local
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
98 modifications (although vendor branches, etc, are more suitable for
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
99 the latter class of problems, and in general discouraged when a less
81fe0523a078 documentation
Jeff Hammel <jhammel@mozilla.com>
parents: 20
diff changeset
100 intrusive system of consuming upstream dependencies are available).
0
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
101
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
102 ----
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
103
3497a30190d2 initial commit of fetch, WIP
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
104 Jeff Hammel
13
3fee8ecd1af8 restructure while we still just have one module
Jeff Hammel <jhammel@mozilla.com>
parents: 0
diff changeset
105 http://k0s.org/mozilla/hg/fetch