Various fixes
authorJan Vrany <jan.vrany@fit.cvut.cz>
Thu, 22 Dec 2016 22:25:06 +0000
changeset 108 054919e32ff0
parent 107 e6d325dbc81b
child 109 d4103254e0a8
child 111 767f2ace9b82
Various fixes * make `update` task to work with binary STC and librun * don't push STC and librun to upstream - this always has to be done manually.
rakelib/workflow.rake
specs/stx-jv.rbspec
--- a/rakelib/workflow.rake	Tue Dec 20 17:50:14 2016 +0000
+++ b/rakelib/workflow.rake	Thu Dec 22 22:25:06 2016 +0000
@@ -11,14 +11,14 @@
         repo = Rake::Stx::Configuration::Repository::find(pkg.repository)
         if repo.type == :'hg' then
           hg = HG::Repository.new(BUILD_DIR / pkg.directory)          
-          yield hg          
+          yield pkg, hg          
         end
       end
     end    
   end
   
   def push(remote, user, pass, review_only, push_bookmark)  
-    hg_repositories do | hg |
+    hg_repositories do | pkg, hg |
       opts = {
         :user => user,
         :pass => pass,
@@ -36,6 +36,19 @@
           return
         end
       end
+
+      # STC and librun are special - never push them automatically
+      # to upstream / canonical repo, must be done manually. This is 
+      # mainly beacuse there are on separate protected repositories 
+      # not accessible without a special setup. Sigh...
+      if (remote == 'upstream') or (remote == 'canonical') then
+        if (pkg.name == 'stx:stc') or (pkg.name == 'stx:librun') then
+          puts ""
+          puts "== Skipping push of #{pkg.name} - you must push manually =="
+          puts ""          
+          return
+        end
+      end      
       
       if review_only then
         opts[:rev] = '.'
@@ -95,7 +108,7 @@
       error "Cannot find 'hg-automerge.rb' in PATH"
     end    
     hg_repositories_failed_to_merge = []
-    hg_repositories do | hg |
+    hg_repositories do | pkg, hg |
       if File.exist? (hg.path / '.hgautomerge') then
         info "Merging #{hg.path}"
         sh "hg-automerge.rb --cwd #{hg.path}"
--- a/specs/stx-jv.rbspec	Tue Dec 20 17:50:14 2016 +0000
+++ b/specs/stx-jv.rbspec	Thu Dec 22 22:25:06 2016 +0000
@@ -43,21 +43,37 @@
   import :'stx:baseline'
 
   # FORKED STC and librun
-  package "stx:stc", :repository => :'swing:private:hg', :branch => 'jv', :checkout => (Proc.new do | pkg |
+  package "stx:stc", :repository => :'swing:private:hg', :branch => 'jv', 
+    :checkout => (Proc.new do | pkg |
     # Download pre-compiled binary if user has no access to source code    
     if Rake::Stx::Configuration::Repository::find(pkg.repository) then
-        checkout pkg.repository, 'stx/stc', :branch => pkg.branch
+          checkout pkg.repository, 'stx/stc', :branch => pkg.branch, :revision => pkg.revision
     else
         download_blob_matching(/prebuilt-stc/, BUILD_DIR / 'stx')
+      end
+    end),
+    :update => (Proc.new do | pkg |
+      if (File.exists? BUILD_DIR / 'stx' / 'stc' / '.hg' / 'hgrc') then
+        update pkg.repository, 'stx/stc', :branch => pkg.branch, :revision => pkg.revision
+      else
+        warn "Not updating #{pkg.name} as no HG repository found in #{BUILD_DIR / 'stx' / 'stc'}"
     end
   end)
 
-  package "stx:librun", :repository => :'swing:private:hg', :branch => 'jv', :checkout => (Proc.new do | pkg |
+  package "stx:librun", :repository => :'swing:private:hg', :branch => 'jv', 
+    :checkout => (Proc.new do | pkg |
     # Download pre-compiled binary if user has no access to source code
     if Rake::Stx::Configuration::Repository::find(pkg.repository) then
-        checkout pkg.repository, 'stx/librun', :branch => pkg.branch
+          checkout pkg.repository, 'stx/librun', :branch => pkg.branch, :revision => pkg.revision
     else
         download_blob_matching(/prebuilt-librun/, BUILD_DIR / 'stx')
+      end
+    end),
+    :update => (Proc.new do | pkg |
+      if (File.exists? BUILD_DIR / 'stx' / 'librun' / '.hg' / 'hgrc') then
+        update pkg.repository, 'stx/stc', :branch => pkg.branch, :revision => pkg.revision
+      else
+        warn "Not updating #{pkg.name} as no HG repository found in #{BUILD_DIR / 'stx' / 'librun'}"
     end
   end)
 
@@ -208,7 +224,7 @@
   package 'stx:libjava/tools', :test => true;
   package 'stx:goodies/regression', :test => true;
   package 'stx:libscm/mercurial', :test => true;
-  
+
   tasks do
     # We need to checkout CharacterEncoderCodeGenerator from stx:goodies
     # because RegressionTests::CharacterTests>>test01_CaseTesting needs that.