Merge lp:~deeptik/linaro-license-protection/fixing_bug_955813 into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Deepti B. Kalakeri
Status: Merged
Merged at revision: 53
Proposed branch: lp:~deeptik/linaro-license-protection/fixing_bug_955813
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 169 lines (+106/-14)
2 files modified
scripts/publish_to_snapshots.py (+33/-14)
testing/test_publish_to_snapshots.py (+73/-0)
To merge this branch: bzr merge lp:~deeptik/linaro-license-protection/fixing_bug_955813
Reviewer Review Type Date Requested Status
Fathi Boudra Approve
Linaro Infrastructure Pending
Review via email: mp+101151@code.launchpad.net

Description of the change

Images/hwpacks from https://ci.linaro.org/jenkins/view/Ubuntu Build Service/ should be published on snapshots.linaro.org. The changes push the hwpacks from /srv3/snapshots.linaro.org/uploads/precise-armhf-nano/1 to /srv3/snapshots.linaro.org/www/precise/images/nano/1 and addresses the bug 955813.

To post a comment you must log in.
Revision history for this message
Fathi Boudra (fboudra) wrote :

Ship it!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'scripts/publish_to_snapshots.py'
2--- scripts/publish_to_snapshots.py 2012-03-28 16:38:32 +0000
3+++ scripts/publish_to_snapshots.py 2012-04-06 19:36:19 +0000
4@@ -25,8 +25,10 @@
5 FAIL = 1
6 acceptable_job_types = [
7 'android',
8+ 'prebuilt',
9 'kernel-hwpack',
10- 'prebuilt'
11+ 'ubuntu-hwpacks',
12+ 'ubuntu-images'
13 ]
14
15 class SnapshotsPublisher(object):
16@@ -49,6 +51,9 @@
17 ret_val = jobname.split("_")
18 elif args.job_type == "kernel-hwpack":
19 ret_val = jobname.split('_')[0].replace(".", "_")
20+ elif args.job_type == "ubuntu-hwpacks" or \
21+ args.job_type == "ubuntu-images":
22+ ret_val = jobname.split('-', 2)
23 elif args.job_type == "prebuilt":
24 ret_val = '' #just need non-null since its isn't needed
25 return ret_val
26@@ -74,6 +79,16 @@
27 target_dir = '/'.join([args.job_type, kernel_tree,
28 args.job_name])
29 target_dir_path = os.path.join(target_path, target_dir)
30+ elif args.job_type == "ubuntu-hwpacks" or \
31+ args.job_type == "ubuntu-images":
32+ dist_name = ret_val[0]
33+ hwpack_image = args.job_type.split("-")[1]
34+ board_rootfs_name = ret_val[2]
35+ build_dir_path = os.path.join(uploads_path, args.job_name,
36+ str(args.build_num))
37+ target_dir = '/'.join([dist_name, hwpack_image,
38+ board_rootfs_name, str(args.build_num)])
39+ target_dir_path = os.path.join(target_path, target_dir)
40 elif args.job_type == "prebuilt":
41 build_path = '%s/%d' % (args.job_name, args.build_num)
42 build_dir_path = os.path.join(uploads_path, build_path)
43@@ -149,6 +164,7 @@
44 continue
45 else:
46 os.remove(dest)
47+ print "Moving the src '", src, "'to dest'", dest, "'"
48 shutil.move(src, dest)
49 except shutil.Error:
50 print "Error while moving the content"
51@@ -189,18 +205,21 @@
52 publisher = SnapshotsPublisher()
53 args = parser.parse_args()
54 publisher.validate_args(args)
55- build_dir_path, target_dir_path = publisher.validate_paths(args, uploads_path,
56- target_path)
57- if build_dir_path == None or target_dir_path == None:
58- print "Problem with build/target path, move failed"
59- return FAIL
60-
61- ret = publisher.move_artifacts(args, build_dir_path, target_dir_path)
62- if ret != PASS:
63- print "Move Failed"
64- return FAIL
65- else:
66- print "Move succeeded"
67- return PASS
68+ try:
69+ build_dir_path, target_dir_path = publisher.validate_paths(args, uploads_path,
70+ target_path)
71+ if build_dir_path == None or target_dir_path == None:
72+ print "Problem with build/target path, move failed"
73+ return FAIL
74+ ret = publisher.move_artifacts(args, build_dir_path, target_dir_path)
75+ if ret != PASS:
76+ print "Move Failed"
77+ return FAIL
78+ else:
79+ print "Move succeeded"
80+ return PASS
81+ except Exception, details:
82+ print "In main() Exception details:", details
83+ return FAIL
84 if __name__ == '__main__':
85 sys.exit(main())
86
87=== modified file 'testing/test_publish_to_snapshots.py'
88--- testing/test_publish_to_snapshots.py 2012-03-28 19:47:42 +0000
89+++ testing/test_publish_to_snapshots.py 2012-04-06 19:36:19 +0000
90@@ -216,6 +216,79 @@
91 stdout.seek(0)
92 self.assertIn("Moved the files from", stdout.read())
93
94+ def test_move_artifacts_ubuntu_hwpacks_successful_move(self):
95+ orig_stdout = sys.stdout
96+ stdout = sys.stdout = StringIO()
97+ self.publisher = SnapshotsPublisher()
98+ param = self.parser.parse_args(['-t', 'ubuntu-hwpacks', '-j',
99+ 'precise-armhf-lt-panda', '-n', '1'])
100+ self.publisher.validate_args(param)
101+ build_dir = '/'.join([param.job_name, str(param.build_num)])
102+ build_path = os.path.join(self.uploads_path, build_dir)
103+ os.makedirs(build_path)
104+ tempfiles = tempfile.mkstemp(dir=build_path)
105+ try:
106+ uploads_dir_path, target_dir_path = self.publisher.validate_paths(param,
107+ self.uploads_path, self.target_path)
108+ uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path)
109+ target_dir_path = os.path.join(self.orig_dir, target_dir_path)
110+ self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path)
111+ finally:
112+ sys.stdout = orig_stdout
113+ pass
114+
115+ stdout.seek(0)
116+ self.assertIn("Moved the files from", stdout.read())
117+
118+ def test_move_artifacts_ubuntu_images_successful_move(self):
119+ orig_stdout = sys.stdout
120+ stdout = sys.stdout = StringIO()
121+ self.publisher = SnapshotsPublisher()
122+ param = self.parser.parse_args(['-t', 'ubuntu-images', '-j',
123+ 'precise-armhf-ubuntu-desktop', '-n', '1'])
124+ self.publisher.validate_args(param)
125+ build_dir = '/'.join([param.job_name, str(param.build_num)])
126+ build_path = os.path.join(self.uploads_path, build_dir)
127+ os.makedirs(build_path)
128+ tempfiles = tempfile.mkstemp(dir=build_path)
129+ try:
130+ uploads_dir_path, target_dir_path = self.publisher.validate_paths(param,
131+ self.uploads_path, self.target_path)
132+ uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path)
133+ target_dir_path = os.path.join(self.orig_dir, target_dir_path)
134+ self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path)
135+ finally:
136+ sys.stdout = orig_stdout
137+ pass
138+
139+ stdout.seek(0)
140+ self.assertIn("Moved the files from", stdout.read())
141+
142+
143+ def test_move_artifacts_android_successful_move(self):
144+ orig_stdout = sys.stdout
145+ stdout = sys.stdout = StringIO()
146+ self.publisher = SnapshotsPublisher()
147+ param = self.parser.parse_args(['-t', 'android', '-j', 'dummy_job_name',
148+ '-n', '1'])
149+ self.publisher.validate_args(param)
150+ build_dir = '/'.join([param.job_type, param.job_name, str(param.build_num)])
151+ build_path = os.path.join(self.uploads_path, build_dir)
152+ os.makedirs(build_path)
153+ tempfiles = tempfile.mkstemp(dir=build_path)
154+ try:
155+ uploads_dir_path, target_dir_path = self.publisher.validate_paths(param,
156+ self.uploads_path, self.target_path)
157+ uploads_dir_path = os.path.join(self.orig_dir, uploads_dir_path)
158+ target_dir_path = os.path.join(self.orig_dir, target_dir_path)
159+ self.publisher.move_artifacts(param, uploads_dir_path, target_dir_path)
160+ finally:
161+ sys.stdout = orig_stdout
162+ pass
163+
164+ stdout.seek(0)
165+ self.assertIn("Moved the files from", stdout.read())
166+
167 def test_create_symlink(self):
168 orig_stdout = sys.stdout
169 stdout = sys.stdout = StringIO()

Subscribers

People subscribed via source and target branches