forked from pool/build-compare
- Remove usage of readarray to remain compatible with bash3
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/build-compare?expand=0&rev=277
This commit is contained in:
parent
8908bc34d3
commit
6e953eae7c
@ -1,3 +1,8 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri May 29 19:20:21 UTC 2020 - olaf@aepfle.de
|
||||||
|
|
||||||
|
- Remove usage of readarray to remain compatible with bash3
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Fri May 29 07:30:51 UTC 2020 - olaf@aepfle.de
|
Fri May 29 07:30:51 UTC 2020 - olaf@aepfle.de
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ Summary: Build Result Compare Script
|
|||||||
License: GPL-2.0+
|
License: GPL-2.0+
|
||||||
Group: Development/Tools/Building
|
Group: Development/Tools/Building
|
||||||
Url: https://github.com/openSUSE/build-compare
|
Url: https://github.com/openSUSE/build-compare
|
||||||
Version: 20200529T185052.7a95d20
|
Version: 20200529T212652.102d844
|
||||||
Release: 0
|
Release: 0
|
||||||
Source1: COPYING
|
Source1: COPYING
|
||||||
Source2: same-build-result.sh
|
Source2: same-build-result.sh
|
||||||
|
13
functions.sh
13
functions.sh
@ -276,7 +276,7 @@ function set_regex() {
|
|||||||
# 0 in case of same content
|
# 0 in case of same content
|
||||||
# 1 in case of errors or difference
|
# 1 in case of errors or difference
|
||||||
# 2 in case of differences that need further investigation
|
# 2 in case of differences that need further investigation
|
||||||
# Sets $files with list of files that need further investigation
|
# Sets ${files[@]} array with list of files that need further investigation
|
||||||
function cmp_rpm_meta ()
|
function cmp_rpm_meta ()
|
||||||
{
|
{
|
||||||
local RES
|
local RES
|
||||||
@ -366,13 +366,18 @@ function cmp_rpm_meta ()
|
|||||||
get_value QF_CHECKSUM $rpm_meta_new | grep -v " 64$" | trim_release_new > $file2
|
get_value QF_CHECKSUM $rpm_meta_new | grep -v " 64$" | trim_release_new > $file2
|
||||||
RES=2
|
RES=2
|
||||||
# done if the same
|
# done if the same
|
||||||
|
files=()
|
||||||
echo "comparing file checksum"
|
echo "comparing file checksum"
|
||||||
if cmp -s $file1 $file2; then
|
if cmp -s $file1 $file2; then
|
||||||
RES=0
|
RES=0
|
||||||
fi
|
else
|
||||||
|
|
||||||
# Get only files with different MD5sums
|
# Get only files with different MD5sums
|
||||||
files=`diff -U0 $file1 $file2 | fgrep -v +++ | grep ^+ | cut -b2- | sed -E -e 's/ [0-9a-f]+ [0-9]+$//'`
|
while read
|
||||||
|
do
|
||||||
|
: "${REPLY}"
|
||||||
|
files+=( "${REPLY}" )
|
||||||
|
done < <(diff -U0 $file1 $file2 | sed -E -n -e '/^-\//{s/^-//;s/ [0-9a-f]+ [0-9]+$//;p}')
|
||||||
|
fi
|
||||||
|
|
||||||
if test -n "$sh"; then
|
if test -n "$sh"; then
|
||||||
echo "creating rename script"
|
echo "creating rename script"
|
||||||
|
31
pkg-diff.sh
31
pkg-diff.sh
@ -761,6 +761,7 @@ compare_archive()
|
|||||||
local f
|
local f
|
||||||
local -a content
|
local -a content
|
||||||
local -i ret=1
|
local -i ret=1
|
||||||
|
local -a filelist
|
||||||
|
|
||||||
"${handler}" 'f' "${file}" || return 1
|
"${handler}" 'f' "${file}" || return 1
|
||||||
|
|
||||||
@ -783,8 +784,12 @@ compare_archive()
|
|||||||
"${handler}" 'x' "${new}" || return 1
|
"${handler}" 'x' "${new}" || return 1
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
fi
|
fi
|
||||||
readarray -t content < 'cn'
|
while read
|
||||||
for f in "${content[@]}"
|
do
|
||||||
|
: "${REPLY}"
|
||||||
|
filelist+=( "${REPLY}" )
|
||||||
|
done < 'cn'
|
||||||
|
for f in "${filelist[@]}"
|
||||||
do
|
do
|
||||||
if ! check_single_file "${file}/${f}"
|
if ! check_single_file "${file}/${f}"
|
||||||
then
|
then
|
||||||
@ -1157,6 +1162,10 @@ fi
|
|||||||
echo "Comparing `basename $oldpkg` to `basename $newpkg`"
|
echo "Comparing `basename $oldpkg` to `basename $newpkg`"
|
||||||
|
|
||||||
case $oldpkg in
|
case $oldpkg in
|
||||||
|
*.deb|*.ipk)
|
||||||
|
: cmp_deb_meta missing
|
||||||
|
RES=0
|
||||||
|
;;
|
||||||
*.rpm)
|
*.rpm)
|
||||||
cmp_rpm_meta "$rename_script" "$oldpkg" "$newpkg"
|
cmp_rpm_meta "$rename_script" "$oldpkg" "$newpkg"
|
||||||
RES=$?
|
RES=$?
|
||||||
@ -1192,18 +1201,15 @@ unpackage $newpkg $dir/new
|
|||||||
case $oldpkg in
|
case $oldpkg in
|
||||||
*.deb|*.ipk)
|
*.deb|*.ipk)
|
||||||
adjust_controlfile $dir/old $dir/new
|
adjust_controlfile $dir/old $dir/new
|
||||||
|
files=()
|
||||||
|
while read
|
||||||
|
do
|
||||||
|
: "${REPLY}"
|
||||||
|
files+=( "${REPLY}" )
|
||||||
|
done < <(cd ${dir} ; find old new -type f | sed -e 's/^...//' | sort -u)
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# files is set in cmp_rpm_meta for rpms, so if RES is empty we should assume
|
|
||||||
# it wasn't an rpm and pick all files for comparison.
|
|
||||||
if [ -z $RES ]; then
|
|
||||||
oldfiles=`cd $dir/old; find . -type f`
|
|
||||||
newfiles=`cd $dir/new; find . -type f`
|
|
||||||
|
|
||||||
files=`echo -e "$oldfiles\n$newfiles" | sort -u`
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $dir
|
cd $dir
|
||||||
bash $rename_script
|
bash $rename_script
|
||||||
|
|
||||||
@ -1218,8 +1224,7 @@ fi
|
|||||||
|
|
||||||
# preserve cmp_rpm_meta result for check_all runs
|
# preserve cmp_rpm_meta result for check_all runs
|
||||||
ret=$RES
|
ret=$RES
|
||||||
readarray -t filesarray <<<"$files"
|
for file in "${files[@]}"; do
|
||||||
for file in "${filesarray[@]}"; do
|
|
||||||
if ! check_single_file "$file"; then
|
if ! check_single_file "$file"; then
|
||||||
ret=1
|
ret=1
|
||||||
if test -z "$check_all"; then
|
if test -z "$check_all"; then
|
||||||
|
@ -87,7 +87,7 @@ check_single_file()
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret=0
|
ret=0
|
||||||
for file in $files; do
|
for file in "${files[@]}"; do
|
||||||
if ! check_single_file $file; then
|
if ! check_single_file $file; then
|
||||||
ret=1
|
ret=1
|
||||||
if test -z "$check_all"; then
|
if test -z "$check_all"; then
|
||||||
|
Loading…
Reference in New Issue
Block a user