pastebin - collaborative debugging tool
eckelmann.kpaste.net RSS

Difference between
modified post c0b73 by Anonymous on Fri 7th Feb 2020 15:29
original post 02f43b2226 by Anonymous on Fri 7th Feb 2020 11:42
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 ln	|| exit 1 # broken Debian ksh93 package config, grrr...
2122
builtin mkdir	|| exit 1
2223
builtin printf	|| exit 1
2324
#builtin rm	|| exit 1 # broken Debian ksh93 package config, grrr...
2425
builtin wc	|| exit 1
2526
2627
2728
# clean data from previous run
28-
rm -Rf gitsvnclone1 svnstore
29+
rm -Rf gitsvnclone1 svnstore convertedsrc compare_oldnew
2930
3031
3132
# squish locale settings, we need the POSIX defaults
3233
if [[ "${!LC_*}" != '' ]] ; then
3334
	unset "${!LC_@}"
3435
fi
3536
unset LANG
3637
export LANG='POSIX'
3738
3839
typeset -r infile='rauch_svndump20200128.svndump.bz2'
3940
41+
typeset -r basedir="$PWD"
4042
compound svninfo
4143
4244
[[ ! -f "${infile}" ]] && exit 1
4345
[[ ! -r "${infile}" ]] && exit 1
4446
4547
# create empty SVN repository
4648
svnadmin create svnstore
4749
# add dummy hook to allow property changes for "svnrdump load"
4850
printf '#!/bin/sh\nexit 0\n' >'svnstore/hooks/pre-revprop-change'
4951
chmod a+x 'svnstore/hooks/pre-revprop-change'
5052
51-
bunzip2 -c <"${infile}" | svnrdump load "file://$PWD/svnstore/"
53+
bunzip2 -c <"${infile}" | svnrdump load "file://$basedir/svnstore/"
5254
5355
# get HEAD revision (number) from svn repository
5456
integer svninfo.revision
55-
svninfo.cmdout="$(svn info "file://$PWD/svnstore")"
57+
svninfo.cmdout="$(svn info "file://$basedir/svnstore")"
5658
dummy="${svninfo.cmdout/~(E)Revision:[[:space:]]+([[:digit:]]+)/ }"
5759
(( svninfo.revision=.sh.match[1] ))
5860
5961
printf '# Subversion info:\n'
6062
print -v svninfo
6163
6264
mkdir 'gitsvnclone1'
6365
cd 'gitsvnclone1'
64-
git svn clone "file://$(realpath "$PWD/../svnstore")"
66+
git svn clone "file://$basedir/svnstore"
6567
6668
ls -lad 'svnstore/trunk/projekt/ptxdist/'
6769
6870
6971
cd 'svnstore/trunk/projekt/ptxdist/'
7172
73+
# extract all patches from git repository previously
7277
# remove patch files which are empty
7378
(for i in *.patch ; do if [[ ! -s "$i" ]] ; then rm -- "$i" ; fi ; done)
7479
7580
# list remaining patches
76-
patchlist="$(ls -1 -- *.patch)"
81+
IFS=$'\n' ; typeset -a patchlist=( $(ls -1ad $PWD/*.patch ) )
77-
printf '## Patches:\n%s\n# Number of patches: %d\n' "${patchlist}" "$(wc -l <<<"$patchlist")"
82+
printf '\n#### Patches:\n'
83+
printf '%q\n' "${patchlist[@]}"
7885
79-
printf '# DONE!\n'
86+
cd "$basedir"
80-
# EOF.
87+
mkdir 'convertedsrc'
88+
cd 'convertedsrc'
8189
82-
90+
printf '%s\n' "${patchlist[@]}" | sort -n | while read i ; do
83-
91+
	# 1. use "|| true" to circumvent -o errexit for now since
84-
92+
	# GNU patch does not support GIT binary patches and returns
85-
93+
	# a non-0 exit code for such patches
86-
94+
	# 2. use --force to avoid interactive queries about binary patches
87-
95+
	patch -p3 --force <"$i" || true
88-
96+
done
8997
90-
98+
cd "$basedir"
91-
99+
mkdir 'compare_oldnew'
92-
100+
cd 'compare_oldnew'
93-
101+
(mkdir 'old' && cd 'old' && svn export "file://$basedir/svnstore/trunk/projekt/ptxdist")
94-
102+
mkdir new
95-
103+
ln -s '../../convertedsrc/ptxdist' 'new/.'
96104
97-
105+
cd "$basedir"
98-
106+
(diff -r -u 'compare_oldnew/old/ptxdist/' 'compare_oldnew/new/ptxdist/' || true) 2>&1 |
99-
107+
	egrep -v '^Only in .+(barebox-image|bareboxenv|libEMC|lin|\.(app|png|jpg|jpeg|gz|bin|iop|pdf|so\..+|crc|vtg))$'
100108
101109
102-
110+
printf '# DONE!\n'
103-
111+
exit 0
104-
112+
# EOF.
105113

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