Merge lp:~gesha/linaro-license-protection/fix-dir-sanitizing into lp:~linaro-automation/linaro-license-protection/trunk

Proposed by Georgy Redkozubov
Status: Merged
Merged at revision: 124
Proposed branch: lp:~gesha/linaro-license-protection/fix-dir-sanitizing
Merge into: lp:~linaro-automation/linaro-license-protection/trunk
Diff against target: 30 lines (+10/-8)
1 file modified
scripts/publish_to_snapshots.py (+10/-8)
To merge this branch: bzr merge lp:~gesha/linaro-license-protection/fix-dir-sanitizing
Reviewer Review Type Date Requested Status
Deepti B. Kalakeri (community) Approve
Review via email: mp+121703@code.launchpad.net

Description of the change

This branch fixes sanitizing of dir with subdirs.
Previously it worked only with files in dir and failed on first found subdir with following error: In main() Exception details: [Errno 21] Is a directory: '/srv/staging.snapshots.linaro.org/uploads/android/gesha_staging-publishing-test/7/target'
Now recursion works correctly.

To post a comment you must log in.
Revision history for this message
James Tunnicliffe (dooferlad) wrote :

Do you want os.makedirs rather than os.mkdir (it is more like mkdir -p)?

Revision history for this message
Deepti B. Kalakeri (deeptik) wrote :

Looks good. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'scripts/publish_to_snapshots.py'
--- scripts/publish_to_snapshots.py 2012-08-24 19:12:20 +0000
+++ scripts/publish_to_snapshots.py 2012-08-28 20:33:19 +0000
@@ -265,17 +265,19 @@
265 dest = os.path.join(dest_dir, file)265 dest = os.path.join(dest_dir, file)
266 if os.path.exists(dest):266 if os.path.exists(dest):
267 if os.path.isdir(dest):267 if os.path.isdir(dest):
268 self.move_dir_content(src, dest)
269 continue268 continue
270 else:269 else:
271 os.remove(dest)270 os.remove(dest)
272 if sanitize and not self.is_accepted_for_staging(src):271 if os.path.isdir(src):
273 # Perform the sanitization before moving the file272 os.mkdir(dest)
274 # into place.273 self.move_dir_content(src, dest, sanitize)
275 print "Sanitizing contents of '%s'." % src274 else:
276 self.sanitize_file(src)275 if sanitize and not self.is_accepted_for_staging(src):
277 print "Moving the src '", src, "'to dest'", dest, "'"276 # Perform the sanitization before moving the file
278 shutil.move(src, dest)277 # into place.
278 print "Sanitizing contents of '%s'." % src
279 self.sanitize_file(src)
280 shutil.move(src, dest)
279 except shutil.Error:281 except shutil.Error:
280 print "Error while moving the content"282 print "Error while moving the content"
281283

Subscribers

People subscribed via source and target branches