Skip to contentSkip to conversation

PublishArtifacts.py: generate md5sums for buildtools

PATCH Applied Bill Randle 2 participants 2 messages Aug 13, 2016 – Aug 17, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 PublishArtifacts.py: generate md5sums for buildtools

Md5sum files were not being generated for the buildtools artifacts. Also, ignore files with a .md5sum extension when doing the sum.

---
 .../autobuilder/buildsteps/PublishArtifacts.py     | 27 ++++++++++++++--------
 1 file changed, 18 insertions(+), 9 deletions(-)
lib/python2.7/site-packages/autobuilder/buildsteps/PublishArtifacts.py +18 -9
index f9ff4f6..1a938fc 100644
@@ -112,9 +112,11 @@ class PublishArtifacts(ShellCommand):
                                         os.path.join(self.tmpdir, "deploy/images/*.zip") + \
                                         " " + DEST + "/" + BA_PUBLISH_DIR + ";"
                 elif artifact == "buildtools-tarball":
+                    artifact_name, deploy_image_dir = self.getDeployNames(artifact, buildername)
+                    command=command+self.generateMD5cmd(artifact, deploy_image_dir)
                     command=command+"mkdir -p " + DEST + "/buildtools;"
                     command=command+"cp -R --no-dereference --preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/*buildtools*") + \
+                                    os.path.join(deploy_image_dir, "*buildtools*") + \
                                     " " + DEST + "/buildtools;"
                 elif artifact == "rpm":
                     command=command+"mkdir -p " + os.path.join(DEST, RPM_PUBLISH_DIR) + ";"
@@ -144,22 +146,26 @@ class PublishArtifacts(ShellCommand):
                     else:
                         command=command+"echo 'Skipping copy of sstate, PUBLISH_SSTATE not set.';"
                 elif artifact == "toolchain":
+                    artifact_name, deploy_image_dir = self.getDeployNames(artifact, buildername)
+                    command=command+self.generateMD5cmd(artifact, deploy_image_dir)
                     command=command+"mkdir -p " + os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"
                     command=command+"cp -R --no-dereference --preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/poky-*i686-core-image*.sh ") + \
+                                    os.path.join(deploy_image_dir, "poky-*i686-core-image*.sh ") + \
                                     os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"
                     command=command+"mkdir -p " + os.path.join(DEST, X8664TC_PUBLISH_DIR) + ";"
                     command=command+"cp -R --no-dereference --preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/poky-*x86_64-core-image*.sh ") + \
+                                    os.path.join(deploy_image_dir, "poky-*x86_64-core-image*.sh ") + \
                                     os.path.join(DEST, X8664TC_PUBLISH_DIR) + ";"
                 elif artifact == "uninative":
+                    artifact_name, deploy_image_dir = self.getDeployNames(artifact, buildername)
+                    command=command+self.generateMD5cmd(artifact, deploy_image_dir)
                     command=command+"mkdir -p " + os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"
                     command=command+"cp -R --no-dereference --preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/i686-nativesdk-libc* ") + \
+                                    os.path.join(deploy_image_dir, "i686-nativesdk-libc* ") + \
                                     os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"
                     command=command+"mkdir -p " + os.path.join(DEST, X8664TC_PUBLISH_DIR) + ";"
                     command=command+"cp -R --no-dereference --preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/x86_64-nativesdk-libc* ") + \
+                                    os.path.join(deploy_image_dir, "x86_64-nativesdk-libc* ") + \
                                     os.path.join(DEST, X8664TC_PUBLISH_DIR) + ";"
                 elif artifact == "oe-toolchain":
                     command=command+"mkdir -p " + os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"
@@ -209,7 +215,7 @@ class PublishArtifacts(ShellCommand):
                                      os.path.join(self.basedir, "conf/") + \
                                      "/* " + DEST + "/" + MACHINE_PUBLISH_DIR + "/" + artifact_name + "/conf;"
                 elif artifact == "md5sums":
-                    command = command + "echo 'MD5sums are generated and deployed from the image artifact';"
+                    command = command + "echo 'MD5sums are generated and deployed from the image or toolchain artifact';"
                 elif artifact == "None":
                     command=command+"echo 'Skipping copy of " + artifact + ".';"
                 else:
@@ -248,8 +254,8 @@ class PublishArtifacts(ShellCommand):
     def generateMD5cmd(self, artifact, deploy_dir):
         cmd = ""
         if os.environ.get('GEN_IMG_MD5') == "True":
-            cmd += "for x in `find " + deploy_dir + " -type f -maxdepth 5`;"
-            cmd += "do md5sum $x >> " + "$x.md5sum; done;"
+            cmd += "for x in `find " + deploy_dir + " -maxdepth 5 -type f`;"
+            cmd += "do if [[ $x != *.md5sum ]]; then md5sum $x >> " + "$x.md5sum; fi; done;"
         return cmd
 
     def getDeployNames(self, artifact, buildername):
@@ -258,8 +264,11 @@ class PublishArtifacts(ShellCommand):
             artifact_name = artifact_name + "-lsb"
         if "-wic" in buildername:
             deploy_dir_image = os.path.join(os.path.join(self.tmpdir, "deploy/wic_images/"), artifact)
-        elif artifact_name is "md5sums":
+        elif artifact_name == "md5sums":
             deploy_dir_image = os.path.join(self.tmpdir, "deploy/images/")
+        elif artifact_name == "uninative" or artifact_name == "buildtools-tarball" \
+          or artifact_name == "toolchain":
+            deploy_dir_image = os.path.join(self.tmpdir, "deploy/sdk/")
         else:
             if self.layerversion_core is not None and int(self.layerversion_core) > 2:
                 deploy_dir_image = os.path.join(os.path.join(self.tmpdir, "deploy/images/"), artifact)
Signature · 1 line
2.5.5
#1 lore raw
Quoted 3 lines · Bill Randle

Md5sum files were not being generated for the buildtools artifacts. Also,
ignore files with a .md5sum extension when doing the sum.

Pushed to master, thanks.

Joshua

Quoted 143 lines

---
 .../autobuilder/buildsteps/PublishArtifacts.py     | 27
++++++++++++++--------

 1 file changed, 18 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

packages/autobuilder/buildsteps/PublishArtifacts.py b/lib/python2.7/site- packages/autobuilder/buildsteps/PublishArtifacts.py index f9ff4f6..1a938fc 100644
--- a/lib/python2.7/site- packages/autobuilder/buildsteps/PublishArtifacts.py +++ b/lib/python2.7/site- packages/autobuilder/buildsteps/PublishArtifacts.py

(quoted diff) +0 -0
@@ -112,9 +112,11 @@ class PublishArtifacts(ShellCommand):
                                          os.path.join(self.tmpdir,
 "deploy/images/*.zip") + \

                                         " " + DEST + "/" + BA_PUBLISH_DIR + ";"
                 elif artifact == "buildtools-tarball":
+                    artifact_name, deploy_image_dir = self.getDeployNames(artifact, buildername)
+                    command=command+self.generateMD5cmd(artifact, deploy_image_dir)
                     command=command+"mkdir -p " + DEST + "/buildtools;"
                     command=command+"cp -R --no-dereference -- preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/*buildtools*") + \
+                                    os.path.join(deploy_image_dir, "*buildtools*") + \
                                     " " + DEST + "/buildtools;" elif artifact == "rpm":
                     command=command+"mkdir -p " + os.path.join(DEST, RPM_PUBLISH_DIR) + ";"

(quoted diff) +0 -0
@@ -144,22 +146,26 @@ class PublishArtifacts(ShellCommand):

                     else:
                         command=command+"echo 'Skipping copy of sstate, PUBLISH_SSTATE not set.';"
                 elif artifact == "toolchain":
+                    artifact_name, deploy_image_dir = self.getDeployNames(artifact, buildername)
+                    command=command+self.generateMD5cmd(artifact, deploy_image_dir)
                     command=command+"mkdir -p " + os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"
                     command=command+"cp -R --no-dereference -- preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/poky-*i686-core-image*.sh ") + \
+                                    os.path.join(deploy_image_dir, "poky-*i686-core-image*.sh ") + \
                                     os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"
                     command=command+"mkdir -p " + os.path.join(DEST, X8664TC_PUBLISH_DIR) + ";"
                     command=command+"cp -R --no-dereference -- preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/poky-*x86_64-core-image*.sh ") + \
+                                    os.path.join(deploy_image_dir, "poky-*x86_64-core-image*.sh ") + \
                                     os.path.join(DEST, X8664TC_PUBLISH_DIR) + ";"
                 elif artifact == "uninative":
+                    artifact_name, deploy_image_dir = self.getDeployNames(artifact, buildername)
+                    command=command+self.generateMD5cmd(artifact, deploy_image_dir)
                     command=command+"mkdir -p " + os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"
                     command=command+"cp -R --no-dereference -- preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/i686-nativesdk-libc* ") + \
+                                    os.path.join(deploy_image_dir, "i686-nativesdk-libc* ") + \
                                     os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"
                     command=command+"mkdir -p " + os.path.join(DEST, X8664TC_PUBLISH_DIR) + ";"
                     command=command+"cp -R --no-dereference -- preserve=links " + \
-                                    os.path.join(self.tmpdir, "deploy/sdk/x86_64-nativesdk-libc* ") + \
+                                    os.path.join(deploy_image_dir, "x86_64-nativesdk-libc* ") + \
                                     os.path.join(DEST, X8664TC_PUBLISH_DIR) + ";"
                 elif artifact == "oe-toolchain":
                     command=command+"mkdir -p " + os.path.join(DEST, X86TC_PUBLISH_DIR) + ";"

(quoted diff) +0 -0
@@ -209,7 +215,7 @@ class PublishArtifacts(ShellCommand):
                                       os.path.join(self.basedir,
 "conf/") + \

                                      "/* " + DEST + "/" + MACHINE_PUBLISH_DIR + "/" + artifact_name + "/conf;"
                 elif artifact == "md5sums":
-                    command = command + "echo 'MD5sums are generated and deployed from the image artifact';"
+                    command = command + "echo 'MD5sums are generated and deployed from the image or toolchain artifact';"
                 elif artifact == "None":
                     command=command+"echo 'Skipping copy of " + artifact + ".';"
                 else:

(quoted diff) +0 -0
@@ -248,8 +254,8 @@ class PublishArtifacts(ShellCommand):

     def generateMD5cmd(self, artifact, deploy_dir):
         cmd = ""
         if os.environ.get('GEN_IMG_MD5') == "True":
-            cmd += "for x in `find " + deploy_dir + " -type f

(quoted diff) +3 -3
-maxdepth 5`;"
-            cmd += "do md5sum $x >> " + "$x.md5sum; done;"
+            cmd += "for x in `find " + deploy_dir + " -maxdepth 5
-type f`;"
+            cmd += "do if [[ $x != *.md5sum ]]; then md5sum $x >> "
+ "$x.md5sum; fi; done;"

         return cmd

     def getDeployNames(self, artifact, buildername):

(quoted diff) +0 -0
@@ -258,8 +264,11 @@ class PublishArtifacts(ShellCommand):

             artifact_name = artifact_name + "-lsb"
         if "-wic" in buildername:
             deploy_dir_image = os.path.join(os.path.join(self.tmpdir, "deploy/wic_images/"), artifact)
-        elif artifact_name is "md5sums":
+        elif artifact_name == "md5sums":
             deploy_dir_image = os.path.join(self.tmpdir, "deploy/images/")
+        elif artifact_name == "uninative" or artifact_name == "buildtools-tarball" \
+          or artifact_name == "toolchain":
+            deploy_dir_image = os.path.join(self.tmpdir, "deploy/sdk/")
         else:
             if self.layerversion_core is not None and int(self.layerversion_core) > 2:
                 deploy_dir_image = os.path.join(os.path.join(self.tmpdir, "deploy/images/"), artifact)