-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharchive.sh
More file actions
executable file
·90 lines (78 loc) · 1.91 KB
/
Copy patharchive.sh
File metadata and controls
executable file
·90 lines (78 loc) · 1.91 KB
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
#! /bin/bash
# set -x # force debug
set -eo pipefail # add flag to stop when command returns an error
SRCDIR=python_magnetcooling
PACKAGE=python-magnetcooling
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.1.0"}"
: "${DIST:="trixie"}"
# cleanup source
find . -type d -name __pycache__ -print0 | 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=*.old \
--exclude=*.orig \
--exclude=*~ \
--exclude=#*# \
--exclude=venv \
--exclude=python_magnetcooling.egg-info \
--exclude=.pytest_cache \
--exclude=poetry.lock \
--exclude=htmlcov \
--exclude=.git \
-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 zxf ./"${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