11#!/usr/bin/env python3
22import argparse
3- import subprocess
43import json
54import os
65import re
7-
8- DEVNULL = open ( os . devnull , 'w' )
6+ import subprocess
7+ from subprocess import DEVNULL
98
109XS_buildhosts = [
1110 '1b68968c4e4e' ,
@@ -43,9 +42,9 @@ def update_vendor_tag_for_build(build, is_bootstrap=False):
4342 rpm_path = ""
4443 for line in output .splitlines ():
4544 first_element = line .split ()[0 ]
46- if re .match ('.+/src/.+\.src\.rpm' , first_element ):
45+ if re .match (r '.+/src/.+\.src\.rpm' , first_element ):
4746 srpm_path = ""
48- if re .match ('.+\.rpm' , first_element ):
47+ if re .match (r '.+\.rpm' , first_element ):
4948 rpm_path = first_element
5049
5150 if not rpm_path :
@@ -62,7 +61,9 @@ def update_vendor_tag_for_build(build, is_bootstrap=False):
6261 ['rpm' , '-qp' , rpm_path , '--qf' , '%{vendor};;%{buildhost}' ], stderr = DEVNULL
6362 ).decode ()
6463 vendor , buildhost = output .split (';;' )
65- package = re .search ('/packages/([^/]+)/' , rpm_path ).group (1 )
64+ rpm_match = re .search ('/packages/([^/]+)/' , rpm_path )
65+ assert rpm_match is not None
66+ package = rpm_match .group (1 )
6667
6768 tag = None
6869 if buildhost in XS_buildhosts :
@@ -121,6 +122,7 @@ def main():
121122 last_sync_event_filepath = os .path .join (data_dir , 'last_sync_event' )
122123
123124 need_update = True
125+ timestamp = 0
124126 if os .path .exists (last_sync_event_filepath ):
125127 with open (last_sync_event_filepath ) as f :
126128 last_sync_event = json .loads (f .read ())
@@ -129,9 +131,6 @@ def main():
129131 need_update = False
130132 else :
131133 timestamp = last_sync_event ['ts' ]
132- else :
133- timestamp = 0 # first update ever
134-
135134
136135 if not need_update :
137136 if not quiet :
0 commit comments