pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS

Difference between
modified post 66d56222 by Anonymous on Fri 7th Feb 2020 17:30
original post 77d by Anonymous on Fri 7th Feb 2020 16:22
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
2122
#builtin ln	|| exit 1 # broken Debian ksh93 package config, grrr...
2223
builtin mkdir	|| exit 1
2324
builtin printf	|| exit 1
2425
#builtin rm	|| exit 1 # broken Debian ksh93 package config, grrr...
2526
builtin wc	|| exit 1
2627
2728
2829
# clean data from previous run
2930
rm -Rf gitsvnclone1 svnstore convertedsrc compare_oldnew
3031
3132
3233
# squish locale settings, we need the POSIX defaults
3334
if [[ "${!LC_*}" != '' ]] ; then
3435
	unset "${!LC_@}"
3536
fi
3637
unset LANG
3738
export LANG='POSIX'
3839
3940
typeset -r infile='rauch_svndump20200128.svndump.bz2'
4041
4142
typeset -r basedir="$PWD"
4243
compound svninfo
4344
45+
typeset i dummy
4447
[[ ! -f "${infile}" ]] && exit 1
4548
[[ ! -r "${infile}" ]] && exit 1
4649
4750
# create empty SVN repository
4851
svnadmin create svnstore
4952
# add dummy hook to allow property changes for "svnrdump load"
5053
printf '#!/bin/sh\nexit 0\n' >'svnstore/hooks/pre-revprop-change'
5154
chmod a+x 'svnstore/hooks/pre-revprop-change'
5255
5356
bunzip2 -c <"${infile}" | svnrdump load "file://$basedir/svnstore/"
5457
5558
# get HEAD revision (number) from svn repository
5659
integer svninfo.revision
5760
svninfo.cmdout="$(svn info "file://$basedir/svnstore")"
5861
dummy="${svninfo.cmdout/~(E)Revision:[[:space:]]+([[:digit:]]+)/ }"
5962
(( svninfo.revision=.sh.match[1] ))
6063
6164
printf '# Subversion info:\n'
6265
print -v svninfo
6366
6467
mkdir 'gitsvnclone1'
6568
cd 'gitsvnclone1'
6669
git svn clone "file://$basedir/svnstore"
6770
6871
ls -lad 'svnstore/trunk/projekt/ptxdist/'
6972
7073
71-
cd 'svnstore/trunk/projekt/ptxdist/'
7274
75+
#
7376
# extract all patches from git repository previously
7477
# stored by "git svn" there
78+
#
7580
git format-patch -$(( svninfo.revision+1 ))
7681
7782
# remove patch files which are empty
78-
(for i in *.patch ; do if [[ ! -s "$i" ]] ; then rm -- "$i" ; fi ; done)
83+
for i in *.patch ; do if [[ ! -s "$i" ]] ; then rm -- "$i" ; fi ; done
7984
8085
# list remaining patches
8186
IFS=$'\n' ; typeset -a patchlist=( $(ls -1ad $PWD/*.patch ) )
8287
printf '\n#### Patches:\n'
8388
printf '%q\n' "${patchlist[@]}"
8489
printf '\n#### Number of patches: %d\n' "$(wc -l <<<"$patchlist")"
8590
91+
8692
cd "$basedir"
8793
mkdir 'convertedsrc'
8894
cd 'convertedsrc'
8995
9096
printf '%s\n' "${patchlist[@]}" | sort -n | while read i ; do
9197
	# 1. use "|| true" to circumvent -o errexit for now since
9298
	# GNU patch does not support GIT binary patches and returns
9399
	# a non-0 exit code for such patches
94100
	# 2. use --force to avoid interactive queries about GIT binary patches
95101
	patch -p3 --force <"$i" || true
96102
done
97103
104+
98105
cd "$basedir"
99106
mkdir 'compare_oldnew'
100107
cd 'compare_oldnew'
101108
(mkdir 'old' && cd 'old' && svn export "file://$basedir/svnstore/trunk/projekt/ptxdist")
102-
mkdir new
109+
mkdir 'new' ; ln -s '../../convertedsrc/ptxdist' 'new/.'
104110
108111
109-
112+
#
110-
printf '# DONE!\n'
113+
# Check whether the sources differ
111-
exit 0
114+
# We exclude binaries here because GNU patch doesn't support GIT binary
112-
# EOF.
115+
# patches and the previous state skipped them completely. Instead, we let
113-
116+
# grep(1) filter complains of diff(1) that those files only exists in
114-
117+
# compare_oldnew/old/ptxdist/ but not in compare_oldnew/new/ptxdist/
115-
118+
#
116-
119+
cd "$basedir"
117-
120+
(diff -r -u 'compare_oldnew/old/ptxdist/' 'compare_oldnew/new/ptxdist/' || true) 2>&1 |
118-
121+
	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))$'
119122
120123
121-
124+
printf '# DONE!\n'
122-
125+
exit 0
123-
126+
# EOF.
124127

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