specs/stx-jv.rbspec
changeset 110 da2585640b0c
parent 109 d4103254e0a8
child 118 a0139b2e60b1
child 159 cbc152f322a8
--- a/specs/stx-jv.rbspec	Sun Dec 25 22:24:40 2016 +0000
+++ b/specs/stx-jv.rbspec	Fri Dec 30 00:47:33 2016 +0000
@@ -1,3 +1,7 @@
+def build_platform_id() 
+  return "#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}"
+end
+
 # A helper function to download and unpack pre-built stc and librun
 # for those who are not lucky enough to have an access to sources
 def download_blob_matching(pattern, directory)
@@ -11,9 +15,10 @@
   else        
     error_unsupported_platform()
   end
-  build = Jenkins::Build.new(%Q{https://swing.fit.cvut.cz/jenkins/job/stx_jv/ARCH=#{ARCH},PLATFORM=#{plat}N/lastSuccessfulBuild})
-  build.artifacts.each do | artifact |
-    if pattern =~ artifact.name then
+  build = Jenkins::Build.new(%Q{https://swing.fit.cvut.cz/jenkins/job/stx_jv/lastSuccessfulBuild})
+  platform = build_platform_id()
+  build.artifacts.each do | artifact |    
+    if (pattern =~ artifact.name) and (artifact.name.include? platform) then
       if artifact.name.end_with? '.sha256' then
         sha256 = artifact
       else
@@ -294,14 +299,14 @@
       else
         # Be paranoid, do cleanup here. Should have been done, but who knows...
         cleanup_stc() 
-    	  zip BUILD_DIR / 'stx' / 'stc' , archive: ARTIFACTS_DIR / "#{project.app_name}-#{project.app_version}_#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}_prebuilt-stc"
+    	  zip BUILD_DIR / 'stx' / 'stc' , archive: ARTIFACTS_DIR / "#{project.app_name}-#{project.app_version}_#{build_platform_id()}_prebuilt-stc"
       end
       if core_developer? || (File.exist? BUILD_DIR / 'stx' / 'librun' / '.hg') || (File.exist? BUILD_DIR / 'stx' / 'librun' / 'CVS') then
         puts  "WARNING: NOT CREATING librun archive since directory contains sources!!!"
       else
         # Be paranoid, do cleanup here. Should have been done, but who knows...
         cleanup_librun() 
-    	  zip BUILD_DIR / 'stx' / 'librun' , archive: ARTIFACTS_DIR / "#{project.app_name}-#{project.app_version}_#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}_prebuilt-librun"
+    	  zip BUILD_DIR / 'stx' / 'librun' , archive: ARTIFACTS_DIR / "#{project.app_name}-#{project.app_version}_#{build_platform_id()}_prebuilt-librun"
       end
     end
   end
@@ -323,7 +328,7 @@
   ver = (ver.split(".")[0..2]).join(".")
   project.app_version "#{ver}_#{BUILD_ID}"
   # This is really ugly. We need to clean that up...
-  BUILD_NAME.replace "#{project.app_name}-#{project.app_version}_#{ARCH}-#{win32? ? 'win32' : RbConfig::CONFIG['host_os']}"
+  BUILD_NAME.replace "#{project.app_name}-#{project.app_version}_#{build_platform_id()}"
 end