diff options
author | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-07-11 17:33:43 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-07-19 10:24:50 +0100 |
commit | bfd279de3275abbfaf3e630383ec244131e0375f (patch) | |
tree | 0d1c90461a890d21444f5d2afb13c52b302427f1 /meta/classes/metadata_scm.bbclass | |
parent | 99203edda6f0b09d817454d656c100b7a8806b18 (diff) | |
download | poky-bfd279de3275abbfaf3e630383ec244131e0375f.tar.gz |
Convert tab indentation in python functions into four-space
(From OE-Core rev: 604d46c686d06d62d5a07b9c7f4fa170f99307d8)
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/classes/metadata_scm.bbclass')
-rw-r--r-- | meta/classes/metadata_scm.bbclass | 102 |
1 files changed, 51 insertions, 51 deletions
diff --git a/meta/classes/metadata_scm.bbclass b/meta/classes/metadata_scm.bbclass index 62650be675..502d400cbb 100644 --- a/meta/classes/metadata_scm.bbclass +++ b/meta/classes/metadata_scm.bbclass | |||
@@ -2,76 +2,76 @@ METADATA_BRANCH ?= "${@base_detect_branch(d)}" | |||
2 | METADATA_REVISION ?= "${@base_detect_revision(d)}" | 2 | METADATA_REVISION ?= "${@base_detect_revision(d)}" |
3 | 3 | ||
4 | def base_detect_revision(d): | 4 | def base_detect_revision(d): |
5 | path = base_get_scmbasepath(d) | 5 | path = base_get_scmbasepath(d) |
6 | 6 | ||
7 | scms = [base_get_metadata_git_revision, \ | 7 | scms = [base_get_metadata_git_revision, \ |
8 | base_get_metadata_svn_revision] | 8 | base_get_metadata_svn_revision] |
9 | 9 | ||
10 | for scm in scms: | 10 | for scm in scms: |
11 | rev = scm(path, d) | 11 | rev = scm(path, d) |
12 | if rev <> "<unknown>": | 12 | if rev <> "<unknown>": |
13 | return rev | 13 | return rev |
14 | 14 | ||
15 | return "<unknown>" | 15 | return "<unknown>" |
16 | 16 | ||
17 | def base_detect_branch(d): | 17 | def base_detect_branch(d): |
18 | path = base_get_scmbasepath(d) | 18 | path = base_get_scmbasepath(d) |
19 | 19 | ||
20 | scms = [base_get_metadata_git_branch] | 20 | scms = [base_get_metadata_git_branch] |
21 | 21 | ||
22 | for scm in scms: | 22 | for scm in scms: |
23 | rev = scm(path, d) | 23 | rev = scm(path, d) |
24 | if rev <> "<unknown>": | 24 | if rev <> "<unknown>": |
25 | return rev.strip() | 25 | return rev.strip() |
26 | 26 | ||
27 | return "<unknown>" | 27 | return "<unknown>" |
28 | 28 | ||
29 | def base_get_scmbasepath(d): | 29 | def base_get_scmbasepath(d): |
30 | return d.getVar( 'COREBASE', True) | 30 | return d.getVar( 'COREBASE', True) |
31 | 31 | ||
32 | def base_get_metadata_monotone_branch(path, d): | 32 | def base_get_metadata_monotone_branch(path, d): |
33 | monotone_branch = "<unknown>" | 33 | monotone_branch = "<unknown>" |
34 | try: | 34 | try: |
35 | monotone_branch = file( "%s/_MTN/options" % path ).read().strip() | 35 | monotone_branch = file( "%s/_MTN/options" % path ).read().strip() |
36 | if monotone_branch.startswith( "database" ): | 36 | if monotone_branch.startswith( "database" ): |
37 | monotone_branch_words = monotone_branch.split() | 37 | monotone_branch_words = monotone_branch.split() |
38 | monotone_branch = monotone_branch_words[ monotone_branch_words.index( "branch" )+1][1:-1] | 38 | monotone_branch = monotone_branch_words[ monotone_branch_words.index( "branch" )+1][1:-1] |
39 | except: | 39 | except: |
40 | pass | 40 | pass |
41 | return monotone_branch | 41 | return monotone_branch |
42 | 42 | ||
43 | def base_get_metadata_monotone_revision(path, d): | 43 | def base_get_metadata_monotone_revision(path, d): |
44 | monotone_revision = "<unknown>" | 44 | monotone_revision = "<unknown>" |
45 | try: | 45 | try: |
46 | monotone_revision = file( "%s/_MTN/revision" % path ).read().strip() | 46 | monotone_revision = file( "%s/_MTN/revision" % path ).read().strip() |
47 | if monotone_revision.startswith( "format_version" ): | 47 | if monotone_revision.startswith( "format_version" ): |
48 | monotone_revision_words = monotone_revision.split() | 48 | monotone_revision_words = monotone_revision.split() |
49 | monotone_revision = monotone_revision_words[ monotone_revision_words.index( "old_revision" )+1][1:-1] | 49 | monotone_revision = monotone_revision_words[ monotone_revision_words.index( "old_revision" )+1][1:-1] |
50 | except IOError: | 50 | except IOError: |
51 | pass | 51 | pass |
52 | return monotone_revision | 52 | return monotone_revision |
53 | 53 | ||
54 | def base_get_metadata_svn_revision(path, d): | 54 | def base_get_metadata_svn_revision(path, d): |
55 | revision = "<unknown>" | 55 | revision = "<unknown>" |
56 | try: | 56 | try: |
57 | revision = file( "%s/.svn/entries" % path ).readlines()[3].strip() | 57 | revision = file( "%s/.svn/entries" % path ).readlines()[3].strip() |
58 | except IOError: | 58 | except IOError: |
59 | pass | 59 | pass |
60 | return revision | 60 | return revision |
61 | 61 | ||
62 | def base_get_metadata_git_branch(path, d): | 62 | def base_get_metadata_git_branch(path, d): |
63 | branch = os.popen('cd %s; git branch 2>&1 | grep "^* " | tr -d "* "' % path).read() | 63 | branch = os.popen('cd %s; git branch 2>&1 | grep "^* " | tr -d "* "' % path).read() |
64 | 64 | ||
65 | if len(branch) != 0: | 65 | if len(branch) != 0: |
66 | return branch | 66 | return branch |
67 | return "<unknown>" | 67 | return "<unknown>" |
68 | 68 | ||
69 | def base_get_metadata_git_revision(path, d): | 69 | def base_get_metadata_git_revision(path, d): |
70 | f = os.popen("cd %s; git log -n 1 --pretty=oneline -- 2>&1" % path) | 70 | f = os.popen("cd %s; git log -n 1 --pretty=oneline -- 2>&1" % path) |
71 | data = f.read() | 71 | data = f.read() |
72 | if f.close() is None: | 72 | if f.close() is None: |
73 | rev = data.split(" ")[0] | 73 | rev = data.split(" ")[0] |
74 | if len(rev) != 0: | 74 | if len(rev) != 0: |
75 | return rev | 75 | return rev |
76 | return "<unknown>" | 76 | return "<unknown>" |
77 | 77 | ||