1010# - The URL listed in the cgmanifets is valid (can be downloaded)
1111
1212# $1 - Path to worker chroot's archive
13- # $2+ - Paths to spec files to check
13+ # $2 - Path to macros.releaseversions file to copy to the chroot for rpmspec parsing
14+ # $3+ - Paths to spec files to check
1415
1516set -euo pipefail
1617
@@ -90,14 +91,16 @@ chroot_rpmspec() {
9091prepare_chroot_environment () {
9192 local chroot_archive
9293 local chroot_dir_path
94+ local macros_file
9395 local chroot_rpm_macros_dir_path
9496 local dist_name
9597 local dist_number
9698 local dist_tag
9799 local rpm_macros_dir_path
98100
99101 chroot_archive=" $1 "
100- chroot_dir_path=" $2 "
102+ chroot_dir_path=" $3 "
103+ macros_file=" $2 "
101104
102105 echo " Creating worker chroot under '$chroot_dir_path '."
103106
@@ -124,10 +127,13 @@ prepare_chroot_environment() {
124127 sudo cp -v " $macro_file " " $chroot_rpm_macros_dir_path "
125128 done
126129
130+ echo " Copying the version/release macros file to the chroot."
131+ sudo cp -v " $macros_file " " $chroot_rpm_macros_dir_path "
132+
127133 echo
128134}
129135
130- if [[ $# -lt 2 ]]; then
136+ if [[ $# -lt 3 ]]; then
131137 echo " No specs passed to validate."
132138 exit 1
133139fi
@@ -137,6 +143,11 @@ if [[ ! -f "$1" ]]; then
137143 exit 1
138144fi
139145
146+ if [[ ! -f " $2 " ]]; then
147+ echo " Second argument is not a valid file. Please pass the path to the macros.releaseversions file to copy to the chroot."
148+ exit 1
149+ fi
150+
140151rm -f bad_registrations.txt
141152
142153WORK_DIR=$( mktemp -d -t)
@@ -146,9 +157,10 @@ function clean_up {
146157}
147158trap clean_up EXIT SIGINT SIGTERM
148159
149- prepare_chroot_environment " $1 " " $WORK_DIR "
160+ prepare_chroot_environment " $1 " " $2 " " $ WORK_DIR"
150161
151162shift # Remove the first argument (the chroot archive) from the list of specs to check.
163+ shift # Remove the second argument (the macros.releaseversions file) from the list of specs to check.
152164echo " Checking $# specs."
153165
154166i=0
0 commit comments