diff --git a/build-rpm.sh b/build-rpm.sh index c2f763c..74e9617 100755 --- a/build-rpm.sh +++ b/build-rpm.sh @@ -221,16 +221,17 @@ test_rpm() { fi echo '--> Checking if rpm packages can be installed.' >> $test_log - $MOCK_BIN -v --init --configdir $config_dir $OUTPUT_FOLDER/*.src.rpm >> "${test_log}".tmp - $MOCK_BIN -v --init --configdir $config_dir --install $(ls "$OUTPUT_FOLDER"/*.rpm | grep -v .src.rpm) >> "${test_log}".tmp 2>&1 - - cat $test_log.tmp >> $test_log - echo '--> Checking if same or newer version of the package already exists in repositories' >> $test_log 2>&1 - python /mdv/check_newer_versions.py $chroot_path >> $test_log 2>&1 + $MOCK_BIN -v --init --configdir $config_dir $OUTPUT_FOLDER/*.src.rpm >> "${test_log}" + $MOCK_BIN -v --init --configdir $config_dir --install $(ls "$OUTPUT_FOLDER"/*.rpm | grep -v .src.rpm) >> "${test_log}" 2>&1 test_code=$? - echo "--> Tests finished at `date -u`" >> $test_log - echo 'Test code output: ' $test_code >> $test_log 2>&1 - rm -f $test_log.tmp + if [ $test_code == 0 ]; then + cat $test_log.tmp >> $test_log + echo '--> Checking if same or newer version of the package already exists in repositories' >> $test_log 2>&1 + python /mdv/check_newer_versions.py $chroot_path >> $test_log 2>&1 + test_code=$? + echo "--> Tests finished at `date -u`" >> $test_log + echo 'Test code output: ' $test_code >> $test_log 2>&1 + fi # Check exit code after testing if [ $test_code != 0 ]; then