-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support building Debian source / binary packages
- Loading branch information
1 parent
1049450
commit 436ad04
Showing
12 changed files
with
152 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,6 +10,7 @@ __pycache__/ | |
.Python | ||
build/ | ||
develop-eggs/ | ||
deb_dist/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
smartmeter-datacollector (0.4.1-1) unstable; urgency=low | ||
|
||
* support building Debian source and binary packages for distribution on Debian Buster amd64 and raspios | ||
|
||
-- Supercomputing Systems AG <[email protected]> Sun, 29 Aug 2021 21:04:55 +0000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Source: smartmeter-datacollector | ||
Maintainer: Supercomputing Systems AG <[email protected]> | ||
Section: python | ||
Priority: optional | ||
Build-Depends: python3-setuptools, python3-all, debhelper (>= 9) | ||
Standards-Version: 3.9.1 | ||
Homepage: https://github.com/scs/smartmeter-datacollector | ||
|
||
Package: python3-smartmeter-datacollector | ||
Architecture: all | ||
Depends: ${misc:Depends}, ${python3:Depends} | ||
Description: Smart Meter Data Collector | ||
# Smart Meter Data Collector | ||
. | ||
<p align="center"> | ||
<a href="LICENSE"><img alt="License: GPL-2.0-only" src="https://img.shields.io/badge/license-GPLv2-blue.svg"></a> <a href="https://github.com/scs/smartmeter-datacollector/pulls"><img alt="Pull Requests Welcome" src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg"></a> <a href="https://github.com/scs/smartmeter-datacollector/pulls"><img alt="Contributions Welcome" src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg"></a> | ||
<br /> | ||
<img alt="Python Code Checks" src="https://github.com/scs/smartmeter-datacollector/actions/workflows/python-code-checks.yml/badge.svg?branch=master"> <a href="https://pypi.org/project/smartmeter-datacollector/"><img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/smartmeter-datacollector"></a> | ||
</p> | ||
. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/usr/bin/make -f | ||
|
||
%: | ||
dh $@ --with python3 --buildsystem=python_distutils | ||
|
||
override_dh_auto_clean: | ||
python3 setup.py clean -a | ||
find . -name \*.pyc -exec rm {} \; | ||
|
||
override_dh_auto_build: | ||
python3 setup.py build --force | ||
|
||
override_dh_auto_install: | ||
python3 setup.py install --force --root=debian/python3-smartmeter-datacollector --no-compile -O0 --install-layout=deb --prefix=/usr | ||
rm -rf debian/python-smartmeter-datacollector/trash | ||
|
||
override_dh_python2: | ||
dh_python2 --no-guessing-versions | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
3.0 (quilt) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
extend-diff-ignore="\.egg-info$" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/usr/bin/env bash | ||
|
||
# exit on any error | ||
set -e | ||
|
||
# re-use build_srcdeb.sh | ||
pipenv run build_srcdeb full |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
#!/usr/bin/env bash | ||
|
||
# exit on any error | ||
set -e | ||
|
||
BUILD_TYPE=source | ||
if [[ "$#" -eq 1 ]]; then | ||
BUILD_TYPE=$1 | ||
fi | ||
|
||
PACKAGE_NAME=smartmeter-datacollector | ||
|
||
CWD=$PWD | ||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" | ||
WORK_DIR=${SCRIPT_DIR}/.. | ||
|
||
OUTPUT_DIR=${WORK_DIR}/deb_dist | ||
DIST_DIR=${WORK_DIR}/dist | ||
|
||
# Delete previously built Debian distribution | ||
echo -n "Cleaning up from previous builds.." | ||
rm -rf ${OUTPUT_DIR} ${DIST_DIR} | ||
|
||
# remove the source Debian package from the root folder | ||
rm -f ${WORK_DIR}/${PACKAGE_NAME}-*.tar.gz | ||
echo "..done" | ||
|
||
# build the Python source distribution package | ||
echo -n "Building Python source distribution package.." | ||
pipenv run build > /dev/null 2>&1 | ||
echo "..done" | ||
|
||
# prepare the output directory | ||
mkdir -p ${OUTPUT_DIR} | ||
|
||
# get and extract the Python source distribution package | ||
echo -n "Extracting the Python source distribution package.." | ||
cp ${DIST_DIR}/${PACKAGE_NAME}-*.tar.gz ${OUTPUT_DIR} | ||
tar -xf ${OUTPUT_DIR}/${PACKAGE_NAME}-*.tar.gz -C ${OUTPUT_DIR} | ||
echo "..done" | ||
|
||
PACKAGE_DIR=$(find ${OUTPUT_DIR} -type d -name "${PACKAGE_NAME}-*") | ||
|
||
# go into the output directory | ||
cd ${OUTPUT_DIR} | ||
|
||
# rename <package name>-<version>.tar.gz to <package name>_<version>.orig.tar.gz | ||
echo -n "Preparing the Debian source package.." | ||
PACKAGE_FILENAME_FULL=$(find . -type f -name "${PACKAGE_NAME}-*.tar.gz") | ||
PACKAGE_FILENAME="${PACKAGE_FILENAME_FULL%.tar.gz}" | ||
PACKAGE_FILENAME=$(echo ${PACKAGE_FILENAME} | sed "s/${PACKAGE_NAME}-\(.*\)$/${PACKAGE_NAME}_\1/") | ||
mv ${PACKAGE_FILENAME_FULL} ${PACKAGE_FILENAME}.orig.tar.gz | ||
|
||
# copy the prepared "debian" directory | ||
cp -R ${WORK_DIR}/debian ${PACKAGE_DIR}/ | ||
echo "..done" | ||
|
||
# build the Debian source package | ||
echo -n "Building the Debian package (${BUILD_TYPE}).." | ||
cd ${PACKAGE_DIR}/ | ||
dpkg-buildpackage --build=${BUILD_TYPE} -rfakeroot -sa -us -uc > /dev/null 2>&1 | ||
echo "..done" | ||
|
||
cd ${CWD} | ||
|
||
echo "SUCCESS: Debian package (${BUILD_TYPE}) has been successfully built at ${OUTPUT_DIR}/" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
# exit on any error | ||
set -e | ||
|
||
# delete previously generated debian directory | ||
rm -rf debian | ||
|
||
# create the debian directory | ||
python setup.py \ | ||
--command-packages=stdeb.command debianize \ | ||
--with-python2=false \ | ||
--with-python3=true \ | ||
--no-python2-scripts=true | ||
|
||
echo "SUCCESS: Project has been successfully debianized at debian/" |