aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorGeorgy Redkozubov <georgy.redkozubov@linaro.org>2012-12-05 17:47:59 +0400
committerGeorgy Redkozubov <georgy.redkozubov@linaro.org>2012-12-05 17:47:59 +0400
commitf4983fe1250336e2a68bc51592dfc545a3c22ee5 (patch)
treedd4c327fa57dc82b5cefb8f96903578f0f4e11fe /scripts
parentb33a811803cc801ed182e40d115a3f452dd88939 (diff)
Added reshuffling of android artifacts
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/publish_to_snapshots.py27
1 files changed, 27 insertions, 0 deletions
diff --git a/scripts/publish_to_snapshots.py b/scripts/publish_to_snapshots.py
index 65f9720..d1128ea 100755
--- a/scripts/publish_to_snapshots.py
+++ b/scripts/publish_to_snapshots.py
@@ -12,6 +12,7 @@ uploads_path = '/srv/snapshots.linaro.org/uploads/'
target_path = '/srv/snapshots.linaro.org/www/'
staging_uploads_path = '/srv/staging.snapshots.linaro.org/uploads/'
staging_target_path = '/srv/staging.snapshots.linaro.org/www/'
+product_dir_path = 'target/product'
PASS = 0
FAIL = 1
acceptable_job_types = [
@@ -263,6 +264,29 @@ class SnapshotsPublisher(object):
os.chdir(orig_dir)
return FAIL
+ def reshuffle_android_artifacts(self, src_dir):
+ dst_dir = src_dir
+ full_product_path = os.path.join(src_dir, product_dir_path)
+ filelist = os.listdir(full_product_path)
+ try:
+ for file in filelist:
+ src = os.path.join(full_product_path, file)
+ if os.path.isdir(src):
+ for artifact in os.listdir(src):
+ dest = os.path.join(dst_dir, artifact)
+ if os.path.exists(dest):
+ if os.path.isdir(dest):
+ continue
+ else:
+ os.remove(dest)
+ shutil.move(os.path.join(src, artifact), dest)
+ except shutil.Error:
+ print "Error while reshuffling the content"
+ try:
+ shutil.rmtree(os.path.dirname(full_product_path))
+ except shutil.Error:
+ print "Error removing empty product dir"
+
def move_dir_content(self, src_dir, dest_dir, sanitize=False):
filelist = os.listdir(src_dir)
try:
@@ -300,6 +324,9 @@ class SnapshotsPublisher(object):
if not os.path.isdir(target_dir_path):
raise OSError
+ if (args.job_type == "android"):
+ self.reshuffle_android_artifacts(build_dir_path)
+
self.move_dir_content(build_dir_path, target_dir_path,
sanitize=args.staging)