Skip to content

Commit b8dad85

Browse files
committed
Initial commit of scripts and configs for creating deb packages
1 parent eaab68d commit b8dad85

File tree

9 files changed

+177
-0
lines changed

9 files changed

+177
-0
lines changed

debian/build.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
4+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
6+
7+
echo BUILDING DEB PACKAGE...
8+
9+
(cd $SCRIPT_DIR && fakeroot dpkg-deb -b phenix-apps)
10+
11+
echo DONE BUILDING DEB PACKAGE

debian/phenix-apps/DEBIAN/control

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Package: phenix-apps
2+
Version: 0.1
3+
Section: utils
4+
Priority: extra
5+
Architecture: amd64
6+
Depends: golang-phenix-apps, python3-phenix-apps
7+
Maintainer: Bryan Richardson <[email protected]>
8+
Description:
9+
some stuff
10+
.
11+
and some other stuff

src/go/build.sh

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash -e
2+
3+
4+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
6+
7+
mkdir -p $SCRIPT_DIR/bin
8+
9+
GOBIN=$SCRIPT_DIR/bin go install ./...

src/go/debian/build.sh

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
4+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5+
APPS=$SCRIPT_DIR/..
6+
7+
8+
which docker &> /dev/null
9+
DOCKER=$?
10+
11+
if (( $DOCKER == 0 )); then
12+
echo "Docker detected, so Docker will be used to build golang-phenix-apps."
13+
14+
(cd $APPS && $APPS/docker-build.sh)
15+
else
16+
echo "Docker not detected, using natively installed Go."
17+
18+
(cd $APPS && $APPS/build.sh)
19+
fi
20+
21+
22+
echo COPYING FILES...
23+
24+
DST=$SCRIPT_DIR/golang-phenix-apps/usr
25+
26+
mkdir -p $DST
27+
28+
cp -r $APPS/bin $DST/
29+
30+
echo COPIED FILES
31+
32+
33+
echo BUILDING DEB PACKAGE...
34+
35+
(cd $SCRIPT_DIR && fakeroot dpkg-deb -b golang-phenix-apps)
36+
37+
echo DONE BUILDING DEB PACKAGE

src/go/debian/clean.sh

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/bash -e
2+
3+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4+
5+
rm -r $SCRIPT_DIR/golang-phenix-apps/usr
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Package: golang-phenix-apps
2+
Version: 0.1
3+
Section: utils
4+
Priority: extra
5+
Architecture: amd64
6+
Depends:
7+
Maintainer: Bryan Richardson <[email protected]>
8+
Description:
9+
some stuff
10+
.
11+
and some other stuff

src/go/docker-build.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash -e
2+
3+
4+
which docker &> /dev/null
5+
6+
if (( $? )); then
7+
echo "Docker must be installed (and in your PATH) to use this build script. Exiting."
8+
exit 1
9+
fi
10+
11+
12+
USER_UID=$(id -u)
13+
USERNAME=builder
14+
15+
16+
docker build -t golang-phenix-apps:builder -f - . <<EOF
17+
FROM golang:1.14
18+
19+
RUN groupadd --gid $USER_UID $USERNAME \
20+
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_UID -m $USERNAME
21+
EOF
22+
23+
24+
echo BUILDING golang-phenix-apps...
25+
26+
docker run -it --rm -v $(pwd):/phenix-apps -w /phenix-apps -u $USERNAME \
27+
golang-phenix-apps:builder ./build.sh
28+
29+
echo DONE BUILDING golang-phenix-apps

src/python/docker-build.sh

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash -e
2+
3+
4+
which docker &> /dev/null
5+
6+
if (( $? )); then
7+
echo "Docker must be installed (and in your PATH) to use this build script. Exiting."
8+
exit 1
9+
fi
10+
11+
12+
USER_UID=$(id -u)
13+
USERNAME=builder
14+
15+
16+
docker build -t python-phenix-apps:builder -f - . <<EOF
17+
FROM ubuntu:focal
18+
19+
RUN groupadd --gid $USER_UID $USERNAME \
20+
&& useradd -s /bin/bash --uid $USER_UID --gid $USER_UID -m $USERNAME
21+
22+
ENV TZ=Etc/UTC
23+
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
24+
25+
RUN apt update && apt install -y \
26+
apt-file \
27+
build-essential \
28+
debhelper \
29+
devscripts \
30+
dpkg-dev \
31+
fakeroot \
32+
python3 \
33+
python3-apt \
34+
python3-distro \
35+
python3-pip
36+
37+
RUN python3 -m pip install wheel2deb
38+
EOF
39+
40+
41+
echo PACKAGING python-phenix-apps...
42+
43+
docker run -it --rm -v $(pwd):/phenix-apps -w /phenix-apps -u $USERNAME python-phenix-apps:builder ./package.sh
44+
45+
echo DONE PACKAGING python-phenix-apps

src/python/package.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash -e
2+
3+
cat > wheel2deb.yml << EOF
4+
.:
5+
maintainer_name: Bryan Richardson
6+
maintainer_email: [email protected]
7+
EOF
8+
9+
# Build wheel for phenix-apps
10+
python3 -m pip wheel .
11+
12+
# Convert all wheels to debian source packages
13+
wheel2deb --map attrs=attr
14+
15+
# Call dpkg-buildpackages for each source package
16+
wheel2deb build
17+
18+
rm -f *.whl
19+
rm wheel2deb.yml

0 commit comments

Comments
 (0)