diff options
Diffstat (limited to 'build-deb.sh')
-rwxr-xr-x | build-deb.sh | 131 |
1 files changed, 84 insertions, 47 deletions
diff --git a/build-deb.sh b/build-deb.sh index 208b706..4c738d7 100755 --- a/build-deb.sh +++ b/build-deb.sh @@ -3,7 +3,7 @@ # Project: Silx # https://github.com/silx-kit/silx # -# Copyright (C) 2015-2017 European Synchrotron Radiation Facility, Grenoble, France +# Copyright (C) 2015-2023 European Synchrotron Radiation Facility, Grenoble, France # # Principal author: Jérôme Kieffer (Jerome.Kieffer@ESRF.eu) # @@ -29,9 +29,6 @@ project=silx source_project=silx -version=$(python -c"import version; print(version.version)") -strictversion=$(python -c"import version; print(version.strictversion)") -debianversion=$(python -c"import version; print(version.debianversion)") deb_name=$(echo "$source_project" | tr '[:upper:]' '[:lower:]') @@ -44,17 +41,17 @@ then #we are probably on a ubuntu platform debian_version=$(cat /etc/debian_version | cut -d/ -f1) case $debian_version in - squeeze) - debian_version=6 + stretch) + debian_version=9 ;; - wheezy) - debian_version=7 + buster) + debian_version=10 ;; - jessie) - debian_version=8 + bullseye) + debian_version=11 ;; - stretch) - debian_version=9 + bookworm) + debian_version=12 ;; esac fi @@ -69,6 +66,13 @@ project_directory="`( cd \"$project_directory\" && pwd )`" # absolutized dist_directory=${project_directory}/dist/${target_system} build_directory=${project_directory}/build/${target_system} +cd ${project_directory} + +# Get version info +version=$(python3 -c"import sys; sys.path.insert(0, './src/${project}'); import _version; print(_version.version)") +strictversion=$(python3 -c"import sys; sys.path.insert(0, './src/${project}'); import _version; print(_version.strictversion)") +debianversion=$(python3 -c"import sys; sys.path.insert(0, './src/${project}'); import _version; print(_version.debianversion)") + if [ -d /usr/lib/ccache ]; then export PATH=/usr/lib/ccache:$PATH @@ -82,16 +86,20 @@ If the build succeed the directory dist/debian${debian_version} will contains the packages. optional arguments: - --help show this help text - --install install the packages generated at the end of - the process using 'sudo dpkg' - --debian7 Simulate a debian7 system (fail-safe) - --debian8 Simulate a debian 8 Jessie system - --debian9 Simulate a debian 9 Stretch system + --help Show this help text + --install Install the packages generated at the end of + the process using 'sudo dpkg' + --stdeb-py3 Build using stdeb for python3 + --stdeb-py2.py3 Build using stdeb for python2 and python3 + --debian9 Simulate a debian 9 Stretch system + --debian10 Simulate a debian 10 Buster system + --debian11 Simulate a debian 11 Bullseye system + --debian12 Simulate a debian 12 Bookworm system " install=0 -use_python3=0 #used only for stdeb +use_stdeb=0 +stdeb_all_python=0 while : do @@ -104,26 +112,39 @@ do install=1 shift ;; - --python3) - use_python3=1 + --stdeb-py2) + use_stdeb=1 + stdeb_all_python=0 + shift + ;; + --stdeb-py2.py3) + use_stdeb=1 + stdeb_all_python=1 + shift + ;; + --debian9) + debian_version=9 + target_system=debian${debian_version} + dist_directory=${project_directory}/dist/${target_system} + build_directory=${project_directory}/build/${target_system} shift ;; - --debian7) - debian_version=7 + --debian10) + debian_version=10 target_system=debian${debian_version} dist_directory=${project_directory}/dist/${target_system} build_directory=${project_directory}/build/${target_system} shift ;; - --debian8) - debian_version=8 + --debian11) + debian_version=11 target_system=debian${debian_version} dist_directory=${project_directory}/dist/${target_system} build_directory=${project_directory}/build/${target_system} shift ;; - --debian9) - debian_version=9 + --debian12) + debian_version=12 target_system=debian${debian_version} dist_directory=${project_directory}/dist/${target_system} build_directory=${project_directory}/build/${target_system} @@ -149,12 +170,11 @@ clean_up() mkdir -p ${build_directory} } -build_deb_8_plus () { - echo "Build for debian 8 or newer using actual packaging" +build_deb() { tarname=${project}_${debianversion}.orig.tar.gz clean_up - python setup.py debian_src - cp -f dist/${tarname} ${build_directory} + python3 setup.py sdist + cp -f dist/${project}-${strictversion}.tar.gz ${build_directory}/${tarname} if [ -f dist/${project}-testimages.tar.gz ] then cp -f dist/${project}-testimages.tar.gz ${build_directory} @@ -205,9 +225,25 @@ build_deb_8_plus () { #export PYBUILD_DISABLE_python3=test #export DEB_BUILD_OPTIONS=nocheck fi - + + case $debian_version in + 9) + debian_name=stretch + ;; + 10) + debian_name=buster + ;; + 11) + debian_name=bullseye + ;; + 12) + debain_name=bookworm + ;; + esac + dch -v ${debianversion}-1 "upstream development build of ${project} ${version}" - dch --bpo "${project} snapshot ${version} built for ${target_system}" + dch -D ${debian_name}-backports -l~bpo${debian_version}+ "${project} snapshot ${version} built for ${target_system}" + #dch --bpo "${project} snapshot ${version} built for ${target_system}" dpkg-buildpackage -r rc=$? @@ -227,45 +263,46 @@ build_deb_8_plus () { fi } -build_deb_7_minus () { - echo "Build for debian 7 or older using stdeb" + +build_stdeb () { + echo "Build for debian using stdeb" tarname=${project}-${strictversion}.tar.gz clean_up - + python setup.py sdist cp -f dist/${tarname} ${build_directory} cd ${build_directory} tar -xzf ${tarname} cd ${project}-${strictversion} - - if [ $use_python3 = 1 ] - then + + if [ $stdeb_all_python -eq 1 ]; then echo Using Python 2+3 python3 setup.py --command-packages=stdeb.command sdist_dsc --with-python2=True --with-python3=True --no-python3-scripts=True build --no-cython bdist_deb rc=$? else - echo Using Python 2 + echo Using Python 3 # bdist_deb feed /usr/bin using setup.py entry-points - python setup.py --command-packages=stdeb.command build --no-cython bdist_deb + python3 setup.py --command-packages=stdeb.command build --no-cython bdist_deb rc=$? fi - + # move packages to dist directory rm -rf ${dist_directory} mkdir -p ${dist_directory} mv -f deb_dist/*.deb ${dist_directory} - + # back to the root cd ../../.. } -if [ $debian_version -ge 8 ] -then - build_deb_8_plus + +if [ $use_stdeb -eq 1 ]; then + build_stdeb else - build_deb_7_minus + build_deb fi + if [ $install -eq 1 ]; then sudo -v su -c "dpkg -i ${dist_directory}/*.deb" fi |