Merge lp:~brian.curtin/ubuntuone-windows-installer/jenkins-output-fixes into lp:ubuntuone-windows-installer

Proposed by Brian Curtin
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 117
Merged at revision: 117
Proposed branch: lp:~brian.curtin/ubuntuone-windows-installer/jenkins-output-fixes
Merge into: lp:ubuntuone-windows-installer
Diff against target: 41 lines (+19/-5)
1 file modified
scripts/build_installer.py (+19/-5)
To merge this branch: bzr merge lp:~brian.curtin/ubuntuone-windows-installer/jenkins-output-fixes
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Review via email: mp+107273@code.launchpad.net

Commit message

- Look in BitRock's installation folder for output files when running on Jenkins

Description of the change

Due to how the Jenkins service runs, running build_installer.py as a target doesn't result in BitRock placing the AutoUpdate and InstallBuilder output files in the expected place like they do when you run it on your own machine. We now check if we're on Jenkins and then look in the expected places to find the executables, which is in the BitRock installation folder.

To post a comment you must log in.
Revision history for this message
Manuel de la Peña (mandel) wrote :

Nice work!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/build_installer.py'
2--- scripts/build_installer.py 2012-05-23 21:29:35 +0000
3+++ scripts/build_installer.py 2012-05-24 19:41:18 +0000
4@@ -38,11 +38,21 @@
5 return path if os.path.exists(path) else None
6
7 def _find_output_dir(type):
8- user_dir = os.getenv("USERPROFILE")
9- if not user_dir:
10- return None
11- folder = "My Documents" if "Windows-2008" in platform() else "Documents"
12- output = os.path.join(user_dir, folder, type, "output")
13+ if os.getenv("JENKINS"):
14+ # On Jenkins, InstallBuilder goes straight to `output` while
15+ # AutoUpdate gets its own folder. Both of these folders are under
16+ # the BitRock installation.
17+ args = ["output"]
18+ if type == "AutoUpdate":
19+ args.insert(0, type)
20+ output = os.path.join(_find_bitrock(), *args)
21+ else:
22+ user_dir = os.getenv("USERPROFILE")
23+ if not user_dir:
24+ print("No USERPROFILE available")
25+ return None
26+ dir = "My Documents" if "Windows-2008" in platform() else "Documents"
27+ output = os.path.join(user_dir, dir, type, "output")
28 return output if os.path.exists(output) else None
29
30 def _get_last_file(dir):
31@@ -63,6 +73,10 @@
32
33 def bitrock_command(cmd, rename=False):
34 """Run one of the BitRock binaries with some arguments"""
35+
36+ if not cmd.output:
37+ raise Exception("Unable to find {} output".format(cmd.bin))
38+
39 print("Running BitRock", cmd.bin)
40 subprocess.check_output(
41 [os.path.join(_find_bitrock(), cmd.bin)] + cmd.args,

Subscribers

People subscribed via source and target branches