Merge lp:~thomas-voss/jenkins.pbuilder.plugin/fix-973101 into lp:~thomas-voss/jenkins.pbuilder.plugin/trunk

Proposed by Thomas Voß
Status: Merged
Merge reported by: Thomas Voß
Merged at revision: not available
Proposed branch: lp:~thomas-voss/jenkins.pbuilder.plugin/fix-973101
Merge into: lp:~thomas-voss/jenkins.pbuilder.plugin/trunk
Diff against target: 196 lines (+40/-53)
2 files modified
src/main/java/com/ubuntu/builder/HelloWorldBuilder.java (+37/-53)
src/main/resources/com/ubuntu/builder/HelloWorldBuilder/config.jelly (+3/-0)
To merge this branch: bzr merge lp:~thomas-voss/jenkins.pbuilder.plugin/fix-973101
Reviewer Review Type Date Requested Status
Martin Mrazik (community) Approve
Review via email: mp+100749@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Martin Mrazik (mrazik) wrote :

Looks good to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/main/java/com/ubuntu/builder/HelloWorldBuilder.java'
--- src/main/java/com/ubuntu/builder/HelloWorldBuilder.java 2012-03-22 11:09:35 +0000
+++ src/main/java/com/ubuntu/builder/HelloWorldBuilder.java 2012-04-04 08:47:19 +0000
@@ -64,6 +64,7 @@
64 private final String pbuilderSetupBranch;64 private final String pbuilderSetupBranch;
65 private final String mainBranch;65 private final String mainBranch;
66 private final String packagingBranch;66 private final String packagingBranch;
67 private final boolean chrootedBuild;
67 private final String workDirectory;68 private final String workDirectory;
68 private final String resultsDirectory;69 private final String resultsDirectory;
69 // Fields in config.jelly must match the parameter names in the "DataBoundConstructor"70 // Fields in config.jelly must match the parameter names in the "DataBoundConstructor"
@@ -71,6 +72,7 @@
71 public HelloWorldBuilder(String pbuilderSetupBranch,72 public HelloWorldBuilder(String pbuilderSetupBranch,
72 String mainBranch,73 String mainBranch,
73 String packagingBranch,74 String packagingBranch,
75 boolean chrootedBuild,
74 String workDirectory,76 String workDirectory,
75 String resultsDirectory) {77 String resultsDirectory) {
7678
@@ -80,6 +82,7 @@
80 82
81 this.workDirectory = workDirectory;83 this.workDirectory = workDirectory;
82 this.resultsDirectory = resultsDirectory;84 this.resultsDirectory = resultsDirectory;
85 this.chrootedBuild = chrootedBuild;
83 this.name = null;86 this.name = null;
84 }87 }
8588
@@ -102,6 +105,14 @@
102 return packagingBranch;105 return packagingBranch;
103 }106 }
104107
108 public boolean IsChrootedBuild() {
109 return chrootedBuild;
110 }
111
112 public boolean GetChrootedBuild() {
113 return chrootedBuild;
114 }
115
105 public String getWorkDirectory() {116 public String getWorkDirectory() {
106 return workDirectory;117 return workDirectory;
107 }118 }
@@ -120,8 +131,9 @@
120 try {131 try {
121 envVars = build.getEnvironment(listener);132 envVars = build.getEnvironment(listener);
122 } catch(Exception e) {133 } catch(Exception e) {
123 listener.getLogger().println("Problem getting build env: " + envVars); 134 listener.getLogger().println("Problem getting build env: " + e);
124 }135 }
136
125 String psb = pbuilderSetupBranch;137 String psb = pbuilderSetupBranch;
126 String mb = mainBranch;138 String mb = mainBranch;
127 String pb = packagingBranch;139 String pb = packagingBranch;
@@ -158,21 +170,6 @@
158 listener.getLogger().println("Problem branching or updating pbuilder setup.");170 listener.getLogger().println("Problem branching or updating pbuilder setup.");
159 return false;171 return false;
160 }172 }
161 // Get the pbuilder setup
162 /*if(launcher.launch().
163 cmds("bzr",
164 "checkout",
165 pbuilderSetupBranch,
166 build.getWorkspace().child(this.CHECKOUT_DIRECTORY).toString()).
167 stdout(listener.getLogger()).
168 stderr(listener.getLogger()).
169 pwd(build.getWorkspace()).
170 join() != this.EXIT_SUCCESS) {
171
172 listener.getLogger().println("Problem branching pbuilder setup ... aborting.");
173 return false;
174 }*/
175
176 if(launcher.launch().173 if(launcher.launch().
177 cmds("sudo",174 cmds("sudo",
178 "./Builder.sh",175 "./Builder.sh",
@@ -181,17 +178,18 @@
181 "-h",178 "-h",
182 "./hooks",179 "./hooks",
183 "-r",180 "-r",
184 resultDir.toString(),//"../results",181 resultDir.toString(),
185 "-m",182 "-m",
186 mb,183 mb,
187 "-p",184 "-p",
188 pb).185 pb,
186 chrootedBuild ? "-c" : "").
189 pwd(build.getWorkspace() + "/pbuilder_setup").187 pwd(build.getWorkspace() + "/pbuilder_setup").
190 stdout(listener.getLogger()).188 stdout(listener.getLogger()).
191 stderr(listener.getLogger()).189 stderr(listener.getLogger()).
192 join() != this.EXIT_SUCCESS) {190 join() != this.EXIT_SUCCESS) {
193191
194 listener.getLogger().println("Problem invoking pbuilder ... aborting.");192 listener.getLogger().println("pbuilder returned ERROR.");
195 return false;193 return false;
196 }194 }
197 195
@@ -213,26 +211,33 @@
213 int exitCode = -1;211 int exitCode = -1;
214 212
215 if(pbuilderSetupDir.exists()) {213 if(pbuilderSetupDir.exists()) {
216 exitCode = launcher.launch().214 /*exitCode = launcher.launch().
217 cmds("bzr",215 cmds("bzr",
218 "pull",216 "pull",
219 branch). 217 branch).
220 stdout(listener.getLogger()).218 stdout(listener.getLogger()).
221 stderr(listener.getLogger()).219 stderr(listener.getLogger()).
222 pwd(pbuilderSetupDir).220 pwd(pbuilderSetupDir).
223 join();221 join();*/
224 } else {222
225 exitCode = launcher.launch().223 try {
226 cmds("bzr",224 pbuilderSetupDir.deleteRecursive();
227 "checkout",225 } catch(Exception e) {
228 branch,226 listener.getLogger().println("Problem deleting pbuilder setup dir: " + e);
229 pbuilderSetupDir.toString()).227 return false;
230 stdout(listener.getLogger()).228 }
231 stderr(listener.getLogger()).
232 pwd(build.getWorkspace()).
233 join();
234 }229 }
235230
231 exitCode = launcher.launch().
232 cmds("bzr",
233 "checkout",
234 branch,
235 pbuilderSetupDir.toString()).
236 stdout(listener.getLogger()).
237 stderr(listener.getLogger()).
238 pwd(build.getWorkspace()).
239 join();
240
236 return exitCode == EXIT_SUCCESS;241 return exitCode == EXIT_SUCCESS;
237 }242 }
238 243
@@ -255,15 +260,6 @@
255 @Extension // This indicates to Jenkins that this is an implementation of an extension point.260 @Extension // This indicates to Jenkins that this is an implementation of an extension point.
256 public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {261 public static final class DescriptorImpl extends BuildStepDescriptor<Builder> {
257 /**262 /**
258 * To persist global configuration information,
259 * simply store it in a field and call save().
260 *
261 * <p>
262 * If you don't want fields to be persisted, use <tt>transient</tt>.
263 */
264 private boolean useFrench;
265
266 /**
267 * Performs on-the-fly validation of the form field 'name'.263 * Performs on-the-fly validation of the form field 'name'.
268 *264 *
269 * @param value265 * @param value
@@ -353,21 +349,9 @@
353349
354 @Override350 @Override
355 public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {351 public boolean configure(StaplerRequest req, JSONObject formData) throws FormException {
356 // To persist global configuration information,
357 // set that to properties and call save().
358 useFrench = formData.getBoolean("useFrench");
359 // ^Can also use req.bindJSON(this, formData);
360 // (easier when there are many fields; need set* methods for this, like setUseFrench)
361 save();
362 return super.configure(req,formData);352 return super.configure(req,formData);
363 }353 }
364354
365 /**
366 * This method returns true if the global configuration says we should speak French.
367 */
368 public boolean useFrench() {
369 return useFrench;
370 }
371 }355 }
372}356}
373357
374358
=== modified file 'src/main/resources/com/ubuntu/builder/HelloWorldBuilder/config.jelly'
--- src/main/resources/com/ubuntu/builder/HelloWorldBuilder/config.jelly 2012-02-14 13:09:11 +0000
+++ src/main/resources/com/ubuntu/builder/HelloWorldBuilder/config.jelly 2012-04-04 08:47:19 +0000
@@ -19,6 +19,9 @@
19 <f:textbox />19 <f:textbox />
20 </f:entry>20 </f:entry>
21 <f:optionalBlock title="Advanced Options" inline="true">21 <f:optionalBlock title="Advanced Options" inline="true">
22 <f:entry title="Build in a chroot'ed environment" field="chrootedBuild">
23 <f:checkbox value="false"/>
24 </f:entry>
22 <f:entry title="Work Directory" field="workDirectory">25 <f:entry title="Work Directory" field="workDirectory">
23 <f:textbox value="work"/>26 <f:textbox value="work"/>
24 </f:entry>27 </f:entry>

Subscribers

People subscribed via source and target branches

to all changes: