Skip to content
This repository was archived by the owner on Aug 17, 2021. It is now read-only.

Commit ef2eb60

Browse files
committed
Intial release
0 parents  commit ef2eb60

File tree

4 files changed

+159
-0
lines changed

4 files changed

+159
-0
lines changed

Dockerfile

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
FROM debian:buster-slim AS build-system
2+
RUN echo 'deb http://deb.debian.org/debian bullseye main\n\
3+
deb-src http://deb.debian.org/debian bullseye main'\
4+
>> /etc/apt/sources.list
5+
RUN echo 'Package: *\n\
6+
Pin: release n=bullseye\n\
7+
Pin-Priority: 1'\
8+
> /etc/apt/preferences.d/99bullseye-testing
9+
RUN apt-get update && apt-get upgrade -y
10+
RUN apt-get install -y build-essential fakeroot devscripts
11+
WORKDIR /usr/local/src
12+
RUN apt-get source python3.8
13+
RUN mv python3.8*/ python-source
14+
WORKDIR python-source
15+
ADD distutils-dep.diff debian/patches/
16+
RUN echo 'distutils-dep.diff' >> debian/patches/series
17+
ARG NAME
18+
ARG EMAIL
19+
ARG CHANGE=Backport
20+
RUN dch --bpo "$CHANGE"
21+
22+
FROM build-system AS native
23+
RUN mk-build-deps --install --tool 'apt-get -y --no-install-recommends'
24+
RUN debuild -b -uc -us
25+
RUN mkdir debs && mv ../*.deb debs
26+
27+
FROM build-system AS crossbuild
28+
ARG CROSSBUILD
29+
RUN [ ! -z "$CROSSBUILD" ]
30+
RUN dpkg --add-architecture $CROSSBUILD
31+
RUN apt-get update
32+
COPY --from=native /usr/local/src/python-source/debs native-debs
33+
RUN cd native-debs && apt-get install -y ./libpython3.8-minimal*.deb \
34+
./libpython3.8-stdlib*.deb \
35+
./libpython3.8_*.deb \
36+
./python3.8-minimal*.deb \
37+
./python3.8_*.deb
38+
ADD crossbuild-dep.diff .
39+
RUN patch -p1 < crossbuild-dep.diff
40+
# For some reason mk-build-deps cannot install directly when cross-compiling
41+
RUN mk-build-deps --arch $CROSSBUILD --host-arch $CROSSBUILD
42+
RUN apt-get install -y ./python3.8-cross-build-deps*.deb
43+
RUN DEB_BUILD_OPTIONS='nocheck nobench' debuild -b -uc -us -a$CROSSBUILD
44+
RUN mkdir debs && mv ../*.deb debs

README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Python 3.8 Backport for Debian buster
2+
3+
The aim of this project is to provide a Python 3.8 backport to Debian buster. Packages are of course much better manageable then compiling the source from scratch.
4+
5+
Motivation for this project was the [deprecation of Python 3.7 support in Home Assistant](https://www.home-assistant.io/blog/2020/10/07/release-116/#python-37-deprecated). Support ends in version 0.118 which is scheduled for somewhere in December. While Debian bullseye will not be released anytime before Apil 2021. In the meantime, you can use this backport.
6+
7+
## Scope
8+
The scope of this project is limited to backporting just Python 3.8 itself. So no defaults (which provide virtual packages so `python3` get's automatically linked to `python3.8`), no pip and no pip-packages. This version should be an extension to your system, but it's not meant to replace an existing Python installation.
9+
10+
### Virtual enviroment
11+
To make the `venv` module work without backporting all pip-related packages, the `python3.8-venv` package depends on `python3-distutils` which is present in buster. After you have created your virtual enviroment you can then update pip itself and any packages as usual.
12+
13+
## Repository
14+
You can download the packages in my repository at `deb.pascalroeleven.nl` by adding this line to your sources.list:
15+
```sh
16+
deb http://deb.pascalroeleven.nl/python3.8 buster-backports main
17+
```
18+
You should also add my PGP (which you can get from my website via https) to APT's sources keyring:
19+
```sh
20+
wget https://pascalroeleven.nl/deb-pascalroeleven.gpg
21+
sudo apt-key add deb-pascalroeleven.gpg
22+
```
23+
24+
## Support
25+
Currently there is support for **`amd64`** and **`armhf`** architectures. The `amd64` packages are build natively while the `armhf` packages are crossbuilt. Testing is not possible while crossbuilding, so these packages did not undergo the same amount of testing as usual Debian packages do.
26+
27+
## Building the packages yourself
28+
If you want to build the packages yourself, you can use the Dockerfile and the patches in this repository. Patches will be applied by the Dockerfile.
29+
30+
Two targets are supported: `native` and `crossbuild`. You should specify either of these:
31+
```sh
32+
docker build --target native .
33+
```
34+
35+
When crossbuilding, you can specify the architecture by adding the `CROSSBUILD` build argument:
36+
```sh
37+
docker build --target crossbuild --build-arg CROSSBUILD=armhf .
38+
```
39+
40+
You can also specify your name, email and changelog message when building which will then be added to the changelog.
41+
```sh
42+
docker build --target native --build-arg NAME="James Smith" --build-arg EMAIL="[email protected]" --build-arg CHANGE="Initial backport for buster" .
43+
```
44+
45+
Building natively takes about 2 hours on a modern decent PC because of the extensive testing. Cross building takes about 30 minutes (but uses native binaries so requires the extra 2 hours the first time).

crossbuild-dep.diff

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
Index: b/debian/control
2+
===================================================================
3+
--- a/debian/control
4+
+++ b/debian/control
5+
@@ -18,7 +18,7 @@
6+
mime-support, netbase, bzip2, time, python3@bd_qual@, @PVER@@bd_qual@ <cross>,
7+
net-tools, xvfb <!nocheck>, xauth <!nocheck>,
8+
systemtap-sdt-dev
9+
-Build-Depends-Indep: python3-sphinx, python3-docs-theme, texinfo
10+
+Build-Depends-Indep: python3-sphinx:all, python3-docs-theme:all, texinfo
11+
Standards-Version: 4.5.0
12+
Vcs-Browser: https://salsa.debian.org/cpython-team/python3/tree/python3.8
13+
Vcs-Git: https://salsa.debian.org/cpython-team/python3.git -b python3.8
14+
15+
Index: b/debian/rules
16+
===================================================================
17+
--- a/debian/rules
18+
+++ b/debian/rules
19+
@@ -1353,7 +1353,7 @@
20+
done
21+
22+
: # devhelp docs
23+
- cd $(buildd_static) && ./python ../debian/pyhtml2devhelp.py \
24+
+ cd $(buildd_static) && python3.8 ../debian/pyhtml2devhelp.py \
25+
../$(d_doc)/usr/share/doc/$(p_base)/html index.html $(VER) \
26+
> ../$(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp
27+
gzip -9nv $(d_doc)/usr/share/doc/$(p_base)/html/$(PVER).devhelp

distutils-dep.diff

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
Index: b/debian/control.in
2+
===================================================================
3+
--- a/debian/control.in
4+
+++ b/debian/control.in
5+
@@ -45,7 +45,7 @@
6+
Architecture: any
7+
Multi-Arch: allowed
8+
Priority: @PRIO@
9+
-Depends: @PVER@ (= ${binary:Version}),
10+
+Depends: @PVER@ (= ${binary:Version}), python3-distutils (>=3.7.3-1),
11+
python-pip-whl (>= 8.1.0-2), ${shlibs:Depends}, ${misc:Depends},
12+
Breaks: python3-pip (<< 1.5.6-4)
13+
Description: Interactive high-level object-oriented language (pyvenv binary, version @VER@)
14+
15+
Index: b/debian/PVER-venv.postinst.in
16+
===================================================================
17+
--- a/debian/PVER-venv.postinst.in
18+
+++ b/debian/PVER-venv.postinst.in
19+
@@ -15,6 +15,9 @@
20+
fi
21+
esac
22+
23+
+rm -rf /usr/lib/@PVER@/distutils
24+
+ln -s /usr/lib/python3.7/distutils /usr/lib/@PVER@
25+
+
26+
#DEBHELPER#
27+
28+
exit 0
29+
30+
Index: b/debian/PVER-venv.postrm.in
31+
===================================================================
32+
--- a/debian/PVER-venv.postrm.in
33+
+++ b/debian/PVER-venv.postrm.in
34+
@@ -7,6 +7,8 @@
35+
rm -rf /var/lib/python-wheels
36+
fi
37+
38+
+rm /usr/lib/@PVER@/distutils
39+
+
40+
#DEBHELPER#
41+
42+
exit 0
43+

0 commit comments

Comments
 (0)