-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy patharchive.sh
executable file
·84 lines (72 loc) · 1.72 KB
/
archive.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
#! /bin/bash
# set -x # force debug
set -eo pipefail # add flag to stop when command returns an error
SRCDIR=python_magnetgeo
PACKAGE=python-magnetgeo
usage(){
echo ""
echo "Description:"
echo " Builds a debian package"
echo ""
echo "Usage:"
echo " archive.sh [ <option> ] ... ]"
echo ""
echo "Options:"
echo "-d Specify the distribution to use"
echo "-v <x.y.z> Specify version to build."
echo ""
exit 1
}
while getopts "hd:v:" option ; do
case $option in
h ) usage ;;
d ) DIST=$OPTARG ;;
v ) VERSION=$OPTARG ;;
? ) usage ;;
esac
done
# shift to have the good number of other args
shift $((OPTIND - 1))
# add parameters
: ${VERSION:="0.4.0"}
: ${DIST:="bookworm"}
# cleanup source
find . -type d -name __pycache__ | xargs rm -rf
# create archive
cd ..
tar \
--exclude-vcs \
--exclude=feelppdb \
--exclude=tmp \
--exclude=data \
--exclude=debian \
--exclude=.pc \
--exclude=.devcontainer \
--exclude=.vscode \
--exclude=*.sif \
--exclude=*.crt \
--exclude=*.pem \
--exclude=*.log \
--exclude=*~ \
--exclude=#*# \
--exclude=pyproject.toml \
--exclude=poetry.lock \
-zcvf ${PACKAGE}_${VERSION}.orig.tar.gz ${SRCDIR}
# build package
# disable use of hooks in pbuilder
mkdir -p tmp
cd tmp
cp ../${PACKAGE}_${VERSION}.orig.tar.gz .
tar zxvf ./${PACKAGE}_$VERSION.orig.tar.gz
cp -r ../${SRCDIR}/debian ${SRCDIR}
cd ${SRCDIR}
DIST=${DIST} pdebuild
# clean up
cd ..
rm -rf ${PACKAGE}*
rm -rf ${SRCDIR}
# # upload new package to Lncmi package repository
# cd /var/cache/pbuilder/$DIST-amd64/results
# dupload -t euler_$DIST
# connect to Lncmi repository server
# update server