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
1=== modified file 'scripts/publish_to_snapshots.py'
2--- scripts/publish_to_snapshots.py 2012-08-24 19:12:20 +0000
3+++ scripts/publish_to_snapshots.py 2012-08-28 20:33:19 +0000
4@@ -265,17 +265,19 @@
5 dest = os.path.join(dest_dir, file)
6 if os.path.exists(dest):
7 if os.path.isdir(dest):
8- self.move_dir_content(src, dest)
9 continue
10 else:
11 os.remove(dest)
12- if sanitize and not self.is_accepted_for_staging(src):
13- # Perform the sanitization before moving the file
14- # into place.
15- print "Sanitizing contents of '%s'." % src
16- self.sanitize_file(src)
17- print "Moving the src '", src, "'to dest'", dest, "'"
18- shutil.move(src, dest)
19+ if os.path.isdir(src):
20+ os.mkdir(dest)
21+ self.move_dir_content(src, dest, sanitize)
22+ else:
23+ if sanitize and not self.is_accepted_for_staging(src):
24+ # Perform the sanitization before moving the file
25+ # into place.
26+ print "Sanitizing contents of '%s'." % src
27+ self.sanitize_file(src)
28+ shutil.move(src, dest)
29 except shutil.Error:
30 print "Error while moving the content"
31

Subscribers

People subscribed via source and target branches