Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r15243 - main/branches/2.1.7/bin
Date: Fri, 29 Jan 2010 18:46:59
Message-Id: E1Navrr-0006QS-Js@stork.gentoo.org
1 Author: zmedico
2 Date: 2010-01-29 18:46:55 +0000 (Fri, 29 Jan 2010)
3 New Revision: 15243
4
5 Modified:
6 main/branches/2.1.7/bin/repoman
7 Log:
8 Add Bazaar (bzr) support for repoman, test-driven by Fauli (Christian Faulhammer)
9 (trunk r15185)
10
11 Modified: main/branches/2.1.7/bin/repoman
12 ===================================================================
13 --- main/branches/2.1.7/bin/repoman 2010-01-29 18:46:45 UTC (rev 15242)
14 +++ main/branches/2.1.7/bin/repoman 2010-01-29 18:46:55 UTC (rev 15243)
15 @@ -483,11 +483,13 @@
16 vcs = "svn"
17 elif os.path.isdir(os.path.join(portdir_overlay, ".git")):
18 vcs = "git"
19 +elif os.path.isdir(os.path.join(portdir_overlay, ".bzr")):
20 + vcs = "bzr"
21
22 vcs_local_opts = repoman_settings.get("REPOMAN_VCS_LOCAL_OPTS", "").split()
23 vcs_global_opts = repoman_settings.get("REPOMAN_VCS_GLOBAL_OPTS")
24 if vcs_global_opts is None:
25 - if vcs != "git":
26 + if vcs not in ["git", "bzr"]:
27 vcs_global_opts = "-q"
28 else:
29 vcs_global_opts = ""
30 @@ -925,6 +927,11 @@
31 mynew = [elem[repo_subdir_len:] for elem in mynew \
32 if elem[:repo_subdir_len] == repo_subdir]
33 mynew = ["./" + elem[:-1] for elem in mynew]
34 +elif vcs == "bzr":
35 + bzrstatus = os.popen("bzr status -S").readlines()
36 + mychanged = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem and elem[1:2] == "M" ]
37 + mynew = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem and ( elem[1:2] == "NK" or elem[0:1] == "R" ) ]
38 +
39 if vcs:
40 new_ebuilds.update(x for x in mynew if x.endswith(".ebuild"))
41 modified_changelogs.update(x for x in chain(mychanged, mynew) \
42 @@ -1094,12 +1101,14 @@
43 os.path.join(x, os.path.basename(l[:-1])))
44 myf.close()
45
46 - if vcs in ("cvs", "svn") and check_ebuild_notadded:
47 + if vcs in ("cvs", "svn", "bzr") and check_ebuild_notadded:
48 try:
49 if vcs == "cvs":
50 myf=open(checkdir+"/CVS/Entries","r")
51 if vcs == "svn":
52 myf = os.popen("svn status --depth=files --verbose " + checkdir)
53 + if vcs == "bzr":
54 + myf = os.popen("bzr status -S " + checkdir)
55 myl = myf.readlines()
56 myf.close()
57 for l in myl:
58 @@ -1120,6 +1129,12 @@
59 l = l.split()[-1]
60 if l[-7:] == ".ebuild":
61 eadded.append(os.path.basename(l[:-7]))
62 + if vcs == "bzr":
63 + if l[1:2] == "?":
64 + continue
65 + l = l.split()[-1]
66 + if l[-7:] == ".ebuild":
67 + eadded.append(os.path.basename(l[:-7]))
68 if vcs == "svn":
69 myf = os.popen("svn status " + checkdir)
70 myl=myf.readlines()
71 @@ -1130,12 +1145,16 @@
72 if l[-7:] == ".ebuild":
73 eadded.append(os.path.basename(l[:-7]))
74 except IOError:
75 - if options.mode == 'commit' and vcs == "cvs":
76 - stats["CVS/Entries.IO_error"] += 1
77 - fails["CVS/Entries.IO_error"].append(checkdir+"/CVS/Entries")
78 - if options.mode == 'commit' and vcs == "svn":
79 - stats["svn.IO_error"] += 1
80 - fails["svn.IO_error"].append(checkdir+"svn info")
81 + if options.mode == 'commit':
82 + if vcs == "cvs":
83 + stats["CVS/Entries.IO_error"] += 1
84 + fails["CVS/Entries.IO_error"].append(checkdir+"/CVS/Entries")
85 + elif vcs == "svn":
86 + stats["svn.IO_error"] += 1
87 + fails["svn.IO_error"].append(checkdir)
88 + elif vcs == "bzr":
89 + stats["bzr.IO_error"] += 1
90 + fails["bzr.IO_error"].append(checkdir)
91 continue
92
93 mf = Manifest(checkdir, repoman_settings["DISTDIR"])
94 @@ -1304,7 +1323,7 @@
95 if stat.S_IMODE(os.stat(full_path).st_mode) & 0o111:
96 stats["file.executable"] += 1
97 fails["file.executable"].append(x+"/"+y+".ebuild")
98 - if vcs in ("cvs", "svn") and check_ebuild_notadded and y not in eadded:
99 + if vcs in ("cvs", "svn", "bzr") and check_ebuild_notadded and y not in eadded:
100 #ebuild not added to vcs
101 stats["ebuild.notadded"]=stats["ebuild.notadded"]+1
102 fails["ebuild.notadded"].append(x+"/"+y+".ebuild")
103 @@ -1949,7 +1968,16 @@
104 myf = os.popen("git ls-files --others")
105 myunadded = [ "./" + elem[:-1] for elem in myf ]
106 myf.close()
107 + if vcs == "bzr":
108 + try:
109 + bzrstatus=os.popen("bzr status -S").readlines()
110 + myunadded = [ "./"+elem.rstrip().split()[1].split('/')[-1:][0] for elem in bzrstatus if elem.startswith("?") or elem[0:2] == " D" ]
111 + except SystemExit as e:
112 + raise # TODO propogate this
113 + except:
114 + err("Error retrieving bzr info; exiting.")
115
116 +
117 myautoadd=[]
118 if myunadded:
119 for x in range(len(myunadded)-1,-1,-1):
120 @@ -1967,18 +1995,22 @@
121 if options.pretend:
122 if vcs == "cvs":
123 print("(cvs add "+" ".join(myautoadd)+")")
124 - if vcs == "svn":
125 + elif vcs == "svn":
126 print("(svn add "+" ".join(myautoadd)+")")
127 elif vcs == "git":
128 print("(git add "+" ".join(myautoadd)+")")
129 + elif vcs == "bzr":
130 + print("(bzr add "+" ".join(myautoadd)+")")
131 retval=0
132 else:
133 if vcs == "cvs":
134 retval=os.system("cvs add "+" ".join(myautoadd))
135 - if vcs == "svn":
136 + elif vcs == "svn":
137 retval=os.system("svn add "+" ".join(myautoadd))
138 elif vcs == "git":
139 retval=os.system("git add "+" ".join(myautoadd))
140 + elif vcs == "bzr":
141 + retval=os.system("bzr add "+" ".join(myautoadd))
142 if retval:
143 writemsg_level("!!! Exiting on %s (shell) error code: %s\n" % \
144 (vcs, retval), level=logging.ERROR, noiselevel=-1)
145 @@ -2043,6 +2075,14 @@
146 if elem[:repo_subdir_len] == repo_subdir]
147 myremoved = ["./" + elem[:-1] for elem in myremoved]
148
149 + if vcs == "bzr":
150 + bzrstatus = os.popen("bzr status -S").readlines()
151 + mychanged = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem and elem[1:2] == "M" ]
152 + mynew = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem and ( elem[1:2] in "NK" or elem[0:1] == "R" ) ]
153 + myremoved = [ "./" + elem.split()[-1:][0].split('/')[-1:][0] for elem in bzrstatus if elem.startswith("-") ]
154 + myremoved = [ "./" + elem.split()[-3:-2][0].split('/')[-1:][0] for elem in bzrstatus if elem and ( elem[1:2] == "K" or elem[0:1] == "R" ) ]
155 + # Bazaar expands nothing.
156 +
157 if vcs:
158 if not (mychanged or mynew or myremoved):
159 print(green("RepoMan sez:"), "\"Doing nothing is not always good for QA.\"")
160 @@ -2085,9 +2125,9 @@
161 myheaders.append(myfile)
162
163 print("* %s files being committed..." % green(str(len(myupdates))), end=' ')
164 - if vcs == 'git':
165 - # With git, there's never any keyword expansion, so there's
166 - # no need to regenerate manifests and all files will be
167 + if vcs in ('git', 'bzr'):
168 + # With git and bzr, there's never any keyword expansion, so
169 + # there's no need to regenerate manifests and all files will be
170 # committed in one big commit at the end.
171 print()
172 else:
173 @@ -2141,7 +2181,7 @@
174 commitmessage += ", RepoMan options: --force"
175 commitmessage += ")"
176
177 - if vcs != 'git' and (myupdates or myremoved):
178 + if vcs not in ['git', 'bzr'] and (myupdates or myremoved):
179 myfiles = myupdates + myremoved
180 if not myheaders and "sign" not in repoman_settings.features:
181 myfiles += mymanifests
182 @@ -2234,7 +2274,7 @@
183 write_atomic(x, "".join(mylines))
184
185 manifest_commit_required = True
186 - if vcs != 'git' and (myupdates or myremoved):
187 + if vcs not in ['git', 'bzr'] and (myupdates or myremoved):
188 myfiles = myupdates + myremoved
189 for x in range(len(myfiles)-1, -1, -1):
190 if myfiles[x].count("/") < 4-repolevel:
191 @@ -2377,10 +2417,10 @@
192 level=logging.ERROR, noiselevel=-1)
193 sys.exit(retval)
194
195 - if vcs == 'git' or manifest_commit_required or signed:
196 + if vcs in ['git', 'bzr'] or manifest_commit_required or signed:
197
198 myfiles = mymanifests[:]
199 - if vcs == 'git':
200 + if vcs in ['git', 'bzr']:
201 myfiles += myupdates
202 myfiles += myremoved
203 myfiles.sort()