gen-δtail 1.41 KB
Newer Older
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
1 2 3 4
#!/bin/bash -e
# δtail.go.in -> specialized with concrete types
# gen-δtail KIND ID out

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
5 6
# Copyright (C) 2018-2019  Nexedi SA and Contributors.
#                          Kirill Smelkov <kirr@nexedi.com>
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
#
# This program is free software: you can Use, Study, Modify and Redistribute
# it under the terms of the GNU General Public License version 3, or (at your
# option) any later version, as published by the Free Software Foundation.
#
# You can also Link and Combine this program with other software covered by
# the terms of any of the Free Software licenses or any of the Open Source
# Initiative approved licenses and Convey the resulting work. Corresponding
# source of such a combination shall include the source code for all other
# software used.
#
# This program is distributed WITHOUT ANY WARRANTY; without even the implied
# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#
# See COPYING file for full licensing terms.
# See https://www.nexedi.com/licensing for rationale and options.

KIND=$1
ID=$2
out=$3

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
28 29 30
zodb=lab.nexedi.com/kirr/neo/go/zodb
zdir=`go list -f '{{.Dir}}' $zodb`
zrev=`git -C $zdir describe --always`
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
31

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
32
echo "// Code generated by gen-δtail $KIND $ID; DO NOT EDIT." >$out
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
33
echo "// (from $zodb @ $zrev)" >>$out
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
34 35
echo >>$out

Kirill Smelkov's avatar
.  
Kirill Smelkov committed
36 37 38 39
$zdir/δtail.go.cat-generic | sed		\
	-e "s/PACKAGE/main/g"			\
	-e "s/ID/$ID/g"				\
	-e "s/ΔTail/ΔTail${KIND}/g"		\
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
40
	-e "s/δRevEntry/δRevEntry${KIND}/g"	\
Kirill Smelkov's avatar
.  
Kirill Smelkov committed
41
	>>$out