pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS

Difference between
modified post 5ba7a by Anonymous on Mon 10th Feb 2020 17:52
original post 66d56222 by Anonymous on Fri 7th Feb 2020 17:30
Download diff
Show old version | new version | both versions

    
11
#!/bin/ksh93
22
33
#
44
# merge Rauchs Subversion tree into our git,
55
# one patch at the time
66
#
77
88
set -o xtrace
99
set -o errexit
1010
set -o pipefail
1111
1212
which bunzip2	|| exit 1
1313
which git	|| exit 1
1414
which realpath	|| exit 1
1515
which svn	|| exit 1
1616
which svnadmin	|| exit 1
1717
which svnrdump	|| exit 1
1818
1919
2020
builtin chmod	|| exit 1
21-
#builtin grep	|| exit 1
21+
#builtin grep	|| exit 1 # broken Debian ksh93 package config, grrr...
2222
#builtin ln	|| exit 1 # broken Debian ksh93 package config, grrr...
2323
builtin mkdir	|| exit 1
2424
builtin printf	|| exit 1
2525
#builtin rm	|| exit 1 # broken Debian ksh93 package config, grrr...
2626
builtin wc	|| exit 1
2727
2828
2929
# clean data from previous run
30-
rm -Rf gitsvnclone1 svnstore convertedsrc compare_oldnew
30+
rm -Rf \
31+
	'gitsvnclone1' \
3135
3236
3337
# squish locale settings, we need the POSIX defaults
3438
if [[ "${!LC_*}" != '' ]] ; then
3539
	unset "${!LC_@}"
3640
fi
3741
unset LANG
3842
export LANG='POSIX'
3943
4044
typeset -r infile='rauch_svndump20200128.svndump.bz2'
4145
4246
typeset -r basedir="$PWD"
4347
compound svninfo
4448
45-
typeset i dummy
49+
typeset s dummy
4650
4751
[[ ! -f "${infile}" ]] && exit 1
4852
[[ ! -r "${infile}" ]] && exit 1
4953
5054
# create empty SVN repository
5155
svnadmin create svnstore
5256
# add dummy hook to allow property changes for "svnrdump load"
5357
printf '#!/bin/sh\nexit 0\n' >'svnstore/hooks/pre-revprop-change'
5458
chmod a+x 'svnstore/hooks/pre-revprop-change'
5559
5660
bunzip2 -c <"${infile}" | svnrdump load "file://$basedir/svnstore/"
5761
5862
# get HEAD revision (number) from svn repository
5963
integer svninfo.revision
6064
svninfo.cmdout="$(svn info "file://$basedir/svnstore")"
6165
dummy="${svninfo.cmdout/~(E)Revision:[[:space:]]+([[:digit:]]+)/ }"
6266
(( svninfo.revision=.sh.match[1] ))
6367
6468
printf '# Subversion info:\n'
6569
print -v svninfo
6670
6771
mkdir 'gitsvnclone1'
6872
cd 'gitsvnclone1'
6973
git svn clone "file://$basedir/svnstore"
7074
7175
ls -lad 'svnstore/trunk/projekt/ptxdist/'
7276
7377
7478
7579
#
7680
# extract all patches from git repository previously
7781
# stored by "git svn" there
7882
#
7983
cd 'svnstore/trunk/projekt/ptxdist/'
80-
git format-patch -$(( svninfo.revision+1 ))
84+
time git format-patch -$(( svninfo.revision+1 ))
8185
8286
# remove patch files which are empty
83-
for i in *.patch ; do if [[ ! -s "$i" ]] ; then rm -- "$i" ; fi ; done
87+
for s in *.patch ; do if [[ ! -s "$s" ]] ; then rm -- "$s" ; fi ; done
8488
8589
# list remaining patches
86-
IFS=$'\n' ; typeset -a patchlist=( $(ls -1ad $PWD/*.patch ) )
90+
IFS=$'\n' ; typeset -a patchlist=( $(ls -1ad $PWD/*.patch ) ) ; IFS=$' \t\n'
8791
printf '\n#### Patches:\n'
8892
printf '%q\n' "${patchlist[@]}"
8993
printf '\n#### Number of patches: %d\n' "$(wc -l <<<"$patchlist")"
9094
9195
9296
cd "$basedir"
9397
mkdir 'convertedsrc'
9498
cd 'convertedsrc'
9599
96-
printf '%s\n' "${patchlist[@]}" | sort -n | while read i ; do
100+
printf '%s\n' "${patchlist[@]}" | sort -n | while read s ; do
97101
	# 1. use "|| true" to circumvent -o errexit for now since
98102
	# GNU patch does not support GIT binary patches and returns
99103
	# a non-0 exit code for such patches
100104
	# 2. use --force to avoid interactive queries about GIT binary patches
101-
	patch -p3 --force <"$i" || true
105+
	patch -p3 --force <"$s" || true
102106
done
103107
104108
105109
cd "$basedir"
106110
mkdir 'compare_oldnew'
107111
cd 'compare_oldnew'
108112
(mkdir 'old' && cd 'old' && svn export "file://$basedir/svnstore/trunk/projekt/ptxdist")
109113
mkdir 'new' ; ln -s '../../convertedsrc/ptxdist' 'new/.'
110114
111115
112116
#
113117
# Check whether the sources differ
114118
# We exclude binaries here because GNU patch doesn't support GIT binary
115119
# patches and the previous state skipped them completely. Instead, we let
116120
# grep(1) filter complains of diff(1) that those files only exists in
117121
# compare_oldnew/old/ptxdist/ but not in compare_oldnew/new/ptxdist/
118122
#
119123
cd "$basedir"
120124
(diff -r -u 'compare_oldnew/old/ptxdist/' 'compare_oldnew/new/ptxdist/' || true) 2>&1 |
121125
	grep -E -v '^Only in compare_oldnew/old/.+: (ecu-jobctl-demo|barebox-image|bareboxenv|libEMC|lin|.+\.(app|png|jpg|jpeg|gz|bin|iop|pdf|so\.[[:digit:]]+.+|crc|vtg))$'
122126
123127
124128
printf '# DONE!\n'
125129
exit 0
126130
# EOF.
127131

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at