PublishArtifacts.py: check files before copy
PATCH 1/1 PublishArtifacts.py: check files before copy
Check files existence before copy, otherwise might fail. For example, if I do not enable "MakeImageMD5s" step, "PublishArtifacts" will fail.
Signed-off-by Yin Kangkai <[email protected]>
--- .../autobuilder/buildsteps/PublishArtifacts.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
lib/python2.7/site-packages/autobuilder/buildsteps/PublishArtifacts.py +11 -5
@@ -12,7 +12,7 @@ __email__ = "[email protected]" from buildbot.steps.shell import ShellCommand from twisted.python import log -import os, datetime +import os, datetime, glob from autobuilder.config import * class PublishArtifacts(ShellCommand):
@@ -152,7 +152,8 @@ class PublishArtifacts(ShellCommand): command=command+"cp -R --no-dereference --preserve=links " + \ deploy_image_dir + \ "/*" + artifact + "* " + DEST + "/" + QEMU_PUBLISH_DIR + "/" + artifact_name + ";" - command=command+"cp -R --no-dereference --preserve=links " + \ + if glob.glob(os.path.join(self.basedir, "tmp/deploy/images/") + "*.md5sum"): + command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/") + \ "/*.md5sum " + DEST + "/" + QEMU_PUBLISH_DIR + "/" + artifact_name + ";" elif "mpc8315e" in artifact:
@@ -161,7 +162,8 @@ class PublishArtifacts(ShellCommand): command=command+"cp -R --no-dereference --preserve=links " + \ deploy_image_dir + \ "/*mpc8315* " + DEST + "/" + MACHINE_PUBLISH_DIR + "/" + artifact_name + ";" - command=command+"cp -R --no-dereference --preserve=links " + \ + if glob.glob(os.path.join(self.basedir, "tmp/deploy/images/") + "*.md5sum"): + command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/") + \ "/*.md5sum " + DEST + "/" + MACHINE_PUBLISH_DIR + "/" + artifact_name + ";" elif artifact == "tiny":
@@ -174,7 +176,9 @@ class PublishArtifacts(ShellCommand): command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/*") + \ DEST + "/" + QEMU_PUBLISH_DIR + "/qemu-tiny;" - command=command+"cp -R --no-dereference --preserve=links " + \ + + if glob.glob(os.path.join(self.basedir, "tmp/deploy/images/") + "*.md5sum"): + command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/") + \ "/*.md5sum " + DEST + "/" + QEMU_PUBLISH_DIR + "/qemu-tiny;"
@@ -205,7 +209,9 @@ class PublishArtifacts(ShellCommand): command=command+"cp -R --no-dereference --preserve=links " + \ deploy_image_dir + \ "/*"+artifact+"* " + DEST + "/" + MACHINE_PUBLISH_DIR +"/" + artifact_name + ";" - command=command+"cp -R --no-dereference --preserve=links " + \ + + if glob.glob(os.path.join(self.basedir, "tmp/deploy/images/") + "*.md5sum"): + command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/") + \ "/*.md5sum " + DEST + "/" + MACHINE_PUBLISH_DIR + "/" + artifact_name + ";"
Signature · 1 line
1.8.2.1
I'm going to pull this, but I'm also going to open a bug as the "right way" to do this is to pass md5sums in as an artifact.
-b
Quoted 66 lines · Yin Kangkai
Check files existence before copy, otherwise might fail. For example, if I do not enable "MakeImageMD5s" step, "PublishArtifacts" will fail.
Signed-off-by Yin Kangkai <[email protected]>--- .../autobuilder/buildsteps/PublishArtifacts.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)lib/python2.7/site-packages/autobuilder/buildsteps/PublishArtifacts.py +11
-6@@ -12,7 +12,7 @@ __email__ = "[email protected]" from buildbot.steps.shell import ShellCommand from twisted.python import log -import os, datetime +import os, datetime, glob from autobuilder.config import * class PublishArtifacts(ShellCommand):@@ -152,7 +152,8 @@ class PublishArtifacts(ShellCommand): command=command+"cp -R --no-dereference --preserve=links " + \ deploy_image_dir + \ "/*" + artifact + "* " + DEST + "/" + QEMU_PUBLISH_DIR + "/" + artifact_name + ";" - command=command+"cp -R --no-dereference --preserve=links " + \ + if glob.glob(os.path.join(self.basedir, "tmp/deploy/images/") + "*.md5sum"): + command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/") + \ "/*.md5sum " + DEST + "/" + QEMU_PUBLISH_DIR + "/" + artifact_name + ";" elif "mpc8315e" in artifact:@@ -161,7 +162,8 @@ class PublishArtifacts(ShellCommand): command=command+"cp -R --no-dereference --preserve=links " + \ deploy_image_dir + \ "/*mpc8315* " + DEST + "/" + MACHINE_PUBLISH_DIR + "/" + artifact_name + ";" - command=command+"cp -R --no-dereference --preserve=links " + \ + if glob.glob(os.path.join(self.basedir, "tmp/deploy/images/") + "*.md5sum"): + command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/") + \ "/*.md5sum " + DEST + "/" + MACHINE_PUBLISH_DIR + "/" + artifact_name + ";" elif artifact == "tiny":@@ -174,7 +176,9 @@ class PublishArtifacts(ShellCommand): command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/*") + \ DEST + "/" + QEMU_PUBLISH_DIR + "/qemu-tiny;" - command=command+"cp -R --no-dereference --preserve=links " + \ + + if glob.glob(os.path.join(self.basedir, "tmp/deploy/images/") + "*.md5sum"): + command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/") + \ "/*.md5sum " + DEST + "/" + QEMU_PUBLISH_DIR + "/qemu-tiny;"@@ -205,7 +209,9 @@ class PublishArtifacts(ShellCommand): command=command+"cp -R --no-dereference --preserve=links " + \ deploy_image_dir + \ "/*"+artifact+"* " + DEST + "/" + MACHINE_PUBLISH_DIR +"/" + artifact_name + ";" - command=command+"cp -R --no-dereference --preserve=links " + \ + + if glob.glob(os.path.join(self.basedir, "tmp/deploy/images/") + "*.md5sum"): + command=command+"cp -R --no-dereference --preserve=links " + \ os.path.join(self.basedir, "tmp/deploy/images/") + \ "/*.md5sum " + DEST + "/" + MACHINE_PUBLISH_DIR + "/" + artifact_name + ";" --1.8.2.1
Signature · 3 lines
Elizabeth Flanagan Yocto Project Build and Release