forked from PDAL/PDAL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.sh
executable file
·100 lines (78 loc) · 1.95 KB
/
package.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/bash
# Build PDAL package
# ./package.sh
if [ $# -gt 1 ]
then
echo "Usage: package [RELEASE SUFFIX]"
exit
fi
GITSHA="$(git rev-parse HEAD)"
echo "Cutting release for SHA $GITSHA"
HERE=`pwd`
CONTAINER="condaforge/mambaforge"
DOCKER="docker"
CONTAINERRUN="$DOCKER run -it -d --entrypoint /bin/sh -v $HERE:/data $CONTAINER"
CONTAINERID=`$CONTAINERRUN`
cat > docker-package.sh << "EOF"
#!/bin/sh
if [ $# -eq 1 ]
then
RELEASE_SUFFIX=$1
fi
mamba update --all -y -n base
mamba install -c conda-forge -y -n base cmake make ninja gdal compilers
git clone https://github.com/PDAL/PDAL.git;
cd /PDAL;
EOF
echo "git checkout $GITSHA" >> docker-package.sh
cat >> docker-package.sh << "EOF"
mkdir build; cd build;
cmake -G Ninja ..
ninja dist
chmod u+x ./bin/pdal-config
RELEASE=$(./bin/pdal-config --version)
echo "Suffix = $RELEASE_SUFFIX"
if [ -n "${RELEASE_SUFFIX+x}" ]
then
RELEASE=${RELEASE}${RELEASE_SUFFIX}
fi
OUTPUTDIR="/data/release-$RELEASE"
if [ ! -e $OUTPUTDIR ]
then
mkdir $OUTPUTDIR
fi
extensions=".tar.gz .tar.bz2"
for ext in $extensions
do
for filename in $(ls *$ext)
do
if [ -n "${RELEASE_SUFFIX+x}" ]
then
root=${filename%-*}
ext=${filename##*-}
outname=$root$RELEASE_SUFFIX-$ext
mv $filename $outname
filename=$outname
fi
`md5sum $filename > $filename.md5`
`sha256sum $filename > $filename.sha256sum`
`sha512sum $filename > $filename.sha512sum`
cp $filename $OUTPUTDIR
cp $filename.md5 $OUTPUTDIR
cp $filename.sha256sum $OUTPUTDIR
cp $filename.sha512sum $OUTPUTDIR
done
done
EOF
chmod +x docker-package.sh
docker cp docker-package.sh $CONTAINERID:/docker-package.sh
if [ $# -eq 1 ]
then
RELNAME=$1
fi
docker exec -it $CONTAINERID /docker-package.sh $RELNAME
# run this to halt into the container
#docker exec -it $CONTAINERID bash
command="$DOCKER stop $CONTAINERID"
echo $command
$command