Skip to content

Commit d313ce1

Browse files
author
paas-bot
authored
Merge pull request #507 from johnbieren/master
2 parents a477c16 + dadcbde commit d313ce1

File tree

2 files changed

+48
-7
lines changed

2 files changed

+48
-7
lines changed

JenkinsfileTrigger

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ node('master') {
8383
fi
8484

8585

86-
# Save the bramch in job.properties
86+
# Save the branch in job.properties
8787
echo "branch=${branch}" >> ${WORKSPACE}/job.properties
8888

8989
# Verify this is a branch in our list of targets defined above in the parameters
@@ -93,12 +93,28 @@ node('master') {
9393
else
9494
# Verify this is a package we are interested in
9595
valid=0
96-
for package in $(cat ${PROJECT_REPO}/config/package_list); do
97-
if [ "${package}" = "${fed_repo}" ]; then
98-
valid=1
99-
break
100-
fi
101-
done
96+
97+
# Get the upstream package list
98+
rm -rf fedora-atomic
99+
git clone http://pagure.io/fedora-atomic
100+
pushd fedora-atomic
101+
git checkout ${fed_branch}
102+
popd
103+
104+
python ${PROJECT_REPO}/utils/package_checker.py ${fed_repo}
105+
CHKR_RC=$?
106+
# If $? -eq 0, we care about package
107+
if [ $CHKR_RC -eq 0 ]; then
108+
valid=1
109+
# If $? -eq 2, upstream package list didn't exist so use legacy method to check
110+
elif [ $CHKR_RC -eq 2 ]; then
111+
for package in $(cat ${PROJECT_REPO}/config/package_list); do
112+
if [ "${package}" = "${fed_repo}" ]; then
113+
valid=1
114+
break
115+
fi
116+
done
117+
fi
102118

103119
if [ $valid -eq 0 ]; then
104120
echo "Not a package we are interested in"

utils/package_checker.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# !/bin/env python
2+
import json
3+
import sys
4+
5+
# Exit 2 if upstream package list doesn't exist
6+
# Exit 1 if file exists, but package isn't in the list
7+
# Exit 0 if file exists, and package is in the list
8+
9+
jsonpath = 'fedora-atomic/fedora-atomic-host-base.json'
10+
11+
try:
12+
with open(jsonpath, 'r') as f:
13+
atomicjson = json.load(f)
14+
mypackage = sys.argv[1]
15+
16+
# Check if package exists in the json file
17+
# Check both all packages and x86_64 specific packages
18+
if mypackage in atomicjson["packages"] or mypackage in atomicjson["packages-x86_64"]:
19+
print ("Package of interest!")
20+
sys.exit(0)
21+
# Fail if not
22+
sys.exit(1)
23+
except IOError as e:
24+
print("Could not find upstream package json file")
25+
sys.exit(2)

0 commit comments

Comments
 (0)