-
Notifications
You must be signed in to change notification settings - Fork 0
Add Debian package (.deb) support to Python binary builds #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -59,7 +59,9 @@ jobs: | |||||||||||||||||||||||||||
curl \ | ||||||||||||||||||||||||||||
llvm \ | ||||||||||||||||||||||||||||
make \ | ||||||||||||||||||||||||||||
xz-utils | ||||||||||||||||||||||||||||
xz-utils \ | ||||||||||||||||||||||||||||
dpkg-deb \ | ||||||||||||||||||||||||||||
fakeroot | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
- name: Download Python source | ||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||
|
@@ -141,10 +143,45 @@ jobs: | |||||||||||||||||||||||||||
cd .. | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
- name: Create deb package | ||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||
PACKAGE_NAME="python-${{ github.event.inputs.python_version }}-linux-glibc236-$(uname -m)" | ||||||||||||||||||||||||||||
PY_VERSION="${{ github.event.inputs.python_version }}" | ||||||||||||||||||||||||||||
PY_MAJOR_MINOR=$(echo $PY_VERSION | cut -d. -f1,2) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
# Create deb package structure | ||||||||||||||||||||||||||||
mkdir -p deb_package/DEBIAN | ||||||||||||||||||||||||||||
mkdir -p deb_package/opt/python-$PY_VERSION-glibc236 | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
# Copy Python installation to deb package structure | ||||||||||||||||||||||||||||
cp -r python_install/* deb_package/opt/python-$PY_VERSION-glibc236/ | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
# Create DEBIAN control file | ||||||||||||||||||||||||||||
INSTALLED_SIZE=$(du -sk deb_package/opt | cut -f1) | ||||||||||||||||||||||||||||
echo "Package: python${PY_MAJOR_MINOR}-custom-glibc236" > deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo "Version: $PY_VERSION" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo "Section: interpreters" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo "Priority: optional" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo "Architecture: amd64" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo "Installed-Size: $INSTALLED_SIZE" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo "Depends: libc6 (>= 2.17), libssl3 | libssl1.1 | libssl1.0.0, zlib1g, libbz2-1.0, libffi8 | libffi7 | libffi6, libgdbm6 | libgdbm5 | libgdbm3, liblzma5, libncurses6 | libncurses5, libreadline8 | libreadline7 | libreadline6, libsqlite3-0, uuid-runtime" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This long dependency line is difficult to read and maintain. Consider breaking it into multiple echo statements or using a multi-line approach for better readability.
Suggested change
Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove unnecessary dependencies just keep important ones |
||||||||||||||||||||||||||||
echo "Maintainer: anubhavkrishna1 <noreply@github.com>" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo "Description: Custom Python $PY_VERSION interpreter (glibc 2.36 compatible)" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo " This package provides a custom-built Python $PY_VERSION interpreter" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo " with optimizations enabled and built for glibc 2.36 compatibility." >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo " Built from source with LTO and PGO optimizations for better performance" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo " while maintaining compatibility with older Linux distributions." >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo " ." >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo " The Python installation is located in /opt/python-$PY_VERSION-glibc236/" >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
echo " and includes pip, setuptools, and wheel." >> deb_package/DEBIAN/control | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
# Build deb package | ||||||||||||||||||||||||||||
fakeroot dpkg-deb --build deb_package $PACKAGE_NAME.deb | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
- name: Create checksum file | ||||||||||||||||||||||||||||
run: | | ||||||||||||||||||||||||||||
sha256sum ${{ env.PACKAGE_NAME }}.tar.gz ${{ env.PACKAGE_NAME }}.zip > SHA256SUMS.txt | ||||||||||||||||||||||||||||
sha256sum ${{ env.PACKAGE_NAME }}.tar.gz ${{ env.PACKAGE_NAME }}.zip ${{ env.PACKAGE_NAME }}.deb > SHA256SUMS.txt | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
- name: Create Release | ||||||||||||||||||||||||||||
id: create_release | ||||||||||||||||||||||||||||
|
@@ -172,16 +209,21 @@ jobs: | |||||||||||||||||||||||||||
- SQLite extensions support | ||||||||||||||||||||||||||||
- Optimized with LTO and PGO | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
**Available Formats:** | ||||||||||||||||||||||||||||
- `.tar.gz` - Extract to any directory | ||||||||||||||||||||||||||||
- `.zip` - Extract to any directory | ||||||||||||||||||||||||||||
- `.deb` - Debian/Ubuntu package (installs to /opt/python-${{ github.event.inputs.python_version }}-glibc236/) | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
**Installation:** | ||||||||||||||||||||||||||||
1. Download the tar.gz file | ||||||||||||||||||||||||||||
2. Download and run the install.sh script: `bash install.sh [install_path]` | ||||||||||||||||||||||||||||
3. Or extract manually: `tar -xzf ${{ env.PACKAGE_NAME }}.tar.gz -C /your/install/path` | ||||||||||||||||||||||||||||
- **Debian/Ubuntu**: `sudo dpkg -i ${{ env.PACKAGE_NAME }}.deb` | ||||||||||||||||||||||||||||
- **Manual**: Extract tar.gz or zip to desired location | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
draft: false | ||||||||||||||||||||||||||||
prerelease: false | ||||||||||||||||||||||||||||
files: | | ||||||||||||||||||||||||||||
${{ env.PACKAGE_NAME }}.tar.gz | ||||||||||||||||||||||||||||
${{ env.PACKAGE_NAME }}.zip | ||||||||||||||||||||||||||||
${{ env.PACKAGE_NAME }}.deb | ||||||||||||||||||||||||||||
SHA256SUMS.txt | ||||||||||||||||||||||||||||
env: | ||||||||||||||||||||||||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,7 +24,7 @@ jobs: | |
- name: Cache apt packages | ||
uses: awalsh128/cache-apt-pkgs-action@latest | ||
with: | ||
packages: build-essential gdb lcov pkg-config libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev wget curl llvm make | ||
packages: build-essential gdb lcov pkg-config libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev lzma lzma-dev tk-dev uuid-dev zlib1g-dev wget curl llvm make dpkg-deb fakeroot | ||
version: 1.0 | ||
|
||
- name: Download Python source | ||
|
@@ -78,10 +78,44 @@ jobs: | |
cd .. | ||
|
||
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV | ||
|
||
- name: Create deb package | ||
run: | | ||
PACKAGE_NAME="python-${{ github.event.inputs.python_version }}-linux-$(uname -m)" | ||
PY_VERSION="${{ github.event.inputs.python_version }}" | ||
PY_MAJOR_MINOR=$(echo $PY_VERSION | cut -d. -f1,2) | ||
|
||
# Create deb package structure | ||
mkdir -p deb_package/DEBIAN | ||
mkdir -p deb_package/opt/python-$PY_VERSION | ||
|
||
# Copy Python installation to deb package structure | ||
cp -r python_install/* deb_package/opt/python-$PY_VERSION/ | ||
|
||
# Create DEBIAN control file | ||
INSTALLED_SIZE=$(du -sk deb_package/opt | cut -f1) | ||
echo "Package: python${PY_MAJOR_MINOR}-custom" > deb_package/DEBIAN/control | ||
echo "Version: $PY_VERSION" >> deb_package/DEBIAN/control | ||
echo "Section: interpreters" >> deb_package/DEBIAN/control | ||
echo "Priority: optional" >> deb_package/DEBIAN/control | ||
echo "Architecture: amd64" >> deb_package/DEBIAN/control | ||
anubhavkrishna1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
echo "Installed-Size: $INSTALLED_SIZE" >> deb_package/DEBIAN/control | ||
echo "Depends: libc6 (>= 2.17), libssl3 | libssl1.1, zlib1g, libbz2-1.0, libffi8 | libffi7 | libffi6, libgdbm6 | libgdbm5, liblzma5, libncurses6 | libncurses5, libreadline8 | libreadline7 | libreadline6, libsqlite3-0, uuid-runtime" >> deb_package/DEBIAN/control | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This long dependency line is difficult to read and maintain. Consider breaking it into multiple echo statements or using a multi-line approach for better readability. Copilot uses AI. Check for mistakes. Positive FeedbackNegative Feedback |
||
echo "Maintainer: anubhavkrishna1 <noreply@github.com>" >> deb_package/DEBIAN/control | ||
echo "Description: Custom Python $PY_VERSION interpreter" >> deb_package/DEBIAN/control | ||
echo " This package provides a custom-built Python $PY_VERSION interpreter" >> deb_package/DEBIAN/control | ||
echo " with optimizations enabled. Built from source with LTO and PGO" >> deb_package/DEBIAN/control | ||
echo " optimizations for better performance." >> deb_package/DEBIAN/control | ||
echo " ." >> deb_package/DEBIAN/control | ||
echo " The Python installation is located in /opt/python-$PY_VERSION/" >> deb_package/DEBIAN/control | ||
echo " and includes pip, setuptools, and wheel." >> deb_package/DEBIAN/control | ||
|
||
# Build deb package | ||
fakeroot dpkg-deb --build deb_package $PACKAGE_NAME.deb | ||
|
||
- name: Create checksum file | ||
run: | | ||
sha256sum ${{ env.PACKAGE_NAME }}.tar.gz ${{ env.PACKAGE_NAME }}.zip > SHA256SUMS.txt | ||
sha256sum ${{ env.PACKAGE_NAME }}.tar.gz ${{ env.PACKAGE_NAME }}.zip ${{ env.PACKAGE_NAME }}.deb > SHA256SUMS.txt | ||
|
||
- name: Create Release | ||
id: create_release | ||
|
@@ -100,11 +134,21 @@ jobs: | |
- Build Date: ${{ env.BUILD_DATE }} | ||
- Built by: anubhavkrishna1 | ||
|
||
**Available Formats:** | ||
- `.tar.gz` - Extract to any directory | ||
- `.zip` - Extract to any directory | ||
- `.deb` - Debian/Ubuntu package (installs to /opt/python-${{ github.event.inputs.python_version }}/) | ||
|
||
**Installation:** | ||
- **Debian/Ubuntu**: `sudo dpkg -i ${{ env.PACKAGE_NAME }}.deb` | ||
- **Manual**: Extract tar.gz or zip to desired location | ||
|
||
draft: false | ||
prerelease: false | ||
files: | | ||
${{ env.PACKAGE_NAME }}.tar.gz | ||
${{ env.PACKAGE_NAME }}.zip | ||
${{ env.PACKAGE_NAME }}.deb | ||
SHA256SUMS.txt | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Uh oh!
There was an error while loading. Please reload this page.