Skip to content

Commit 1578a0a

Browse files
authored
Merge pull request #138 from okurz/feature/refactor
Slightly simplify script/cfg.py
2 parents ef0a065 + fa18bc1 commit 1578a0a

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

script/cfg.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,8 @@ def rsync_commands(checksum):
9191
break
9292
fi
9393
done
94-
if [[ $src =~ .iso$ ]]; then
95-
echo "rsync --timeout=3600 -tlp4 --specials PRODUCTISOPATH/$folder/$src /var/lib/openqa/factory/iso/"
96-
else
97-
echo "rsync --timeout=3600 -tlp4 --specials PRODUCTISOPATH/$folder/$src /var/lib/openqa/factory/hdd/"
98-
fi
94+
[[ $src =~ .iso$ ]] && asset="iso" || asset="hdd"
95+
echo "rsync --timeout=3600 -tlp4 --specials PRODUCTISOPATH/$folder/$src /var/lib/openqa/factory/$asset/"
9996
echo "rsync --timeout=3600 -tlp4 --specials PRODUCTISOPATH/$folder/$src.sha256 /var/lib/openqa/factory/other/"
10097
echo ""
10198
done < <(grep ${arch} __envsub/files_iso.lst | sort)
@@ -183,11 +180,12 @@ def openqa_call_start_fix_iso(archs):
183180
return ''
184181

185182
def openqa_call_news(news, news_archs):
186-
if news and news_archs:
187-
return '''[[ ! "$flavor" =~ ''' + news + ''' ]] || [ "$arch" != ''' + news_archs + ''' ] || news["$flavor"]="$destiso"'''
188-
if news:
189-
return '''[[ ! "$flavor" =~ ''' + news + ''' ]] || news["$flavor"]="$destiso"'''
190-
return ''
183+
if not news:
184+
return ''
185+
news_str = '''[[ ! "$flavor" =~ ''' + news + ''' ]]'''
186+
if news_archs:
187+
news_str += ''' || [ "$arch" != ''' + news_archs + ''' ]'''
188+
return news_str + ''' || news["$flavor"]="$destiso"'''
191189

192190
def openqa_call_start_distri(flavor_distri):
193191
if flavor_distri:
@@ -257,7 +255,7 @@ def openqa_call_start_iso(checksum):
257255
def openqa_call_start_ex1(checksum, tag):
258256
res = tag + '=${destiso} \\\\'
259257
if checksum:
260-
res = res + '''
258+
res += '''
261259
CHECKSUM_''' + tag + '''=\$(cut -b-64 /var/lib/openqa/factory/other/${destiso}.sha256 | grep -E '[0-9a-f]{5,40}' | head -n1) \\\\
262260
ASSET_256=${destiso}.sha256 \\\\'''
263261
return res

0 commit comments

Comments
 (0)