Kaynağa Gözat

Added git hash of ardupilot repository in status table

willpiper 4 yıl önce
ebeveyn
işleme
dc067b3893
2 değiştirilmiş dosya ile 10 ekleme ve 4 silme
  1. 7 1
      app.py
  2. 3 3
      templates/status.html

+ 7 - 1
app.py

@@ -233,6 +233,7 @@ def get_build_status():
         app.logger.info('Opening ' + feature_file)
         selected_features_dict = json.loads(open(feature_file).read())
         selected_features = selected_features_dict['selected_features']
+        git_hash_short = selected_features_dict['git_hash_short']
         features = ''
         for feature in selected_features:
             if features == '':
@@ -253,7 +254,7 @@ def get_build_status():
                 status = "Running"
             else:
                 status = "Failed"
-        ret.append((status,age_str,board,vehicle,link,features))
+        ret.append((status,age_str,board,vehicle,link,features,git_hash_short))
     return ret
 
 def create_status():
@@ -380,8 +381,13 @@ def generate():
         git_hash = subprocess.check_output(['git', 'rev-parse', 'HEAD'], 
                                             cwd = sourcedir,
                                             encoding = 'utf-8')
+        git_hash_short = subprocess.check_output(['git', 'rev-parse',
+                                                 '--short', 'HEAD'], 
+                                                cwd = sourcedir,
+                                                encoding = 'utf-8')
         git_hash = git_hash[:len(git_hash)-1]
         app.logger.info('Git hash = ' + git_hash)
+        selected_features_dict['git_hash_short'] =git_hash_short
 
         # create directories using concatenated token 
         # of vehicle, board, git-hash of source, and md5sum of hwdef

+ 3 - 3
templates/status.html

@@ -1,10 +1,10 @@
 <table class="status-table">
   <thead>
-  <tr><th>Status</th><th>Age (hr:min)</th><th>Board</th><th>Vehicle</th><th>Features</th></tr>
+  <tr><th>Status</th><th>Age (hr:min)</th><th>Board</th><th>Vehicle</th><th>Features</th><th>ArduPilot Git Hash</th></tr>
   </thead>
   <tbody>
-  {% for (status,age,board,vehicle,link,features) in build_status %}
-  <tr class="{{status}}"><td><a href="{{link}}" target="_blank">{{status}}</a></td><td>{{age}}</td><td>{{board}}</td><td>{{vehicle}}</td><td>{{features}}</td></tr>
+  {% for (status,age,board,vehicle,link,features,git_hash_short) in build_status %}
+  <tr class="{{status}}"><td><a href="{{link}}" target="_blank">{{status}}</a></td><td>{{age}}</td><td>{{board}}</td><td>{{vehicle}}</td><td>{{features}}</td><td>{{git_hash_short}}</td></tr>
   {% endfor %}
   </tbody>
 </table>