Skip to content

Commit 449fef3

Browse files
authored
Merge pull request noironetworks#299 from noironetworks/new-py3-deb
First pass at python3 packaging for DEB
2 parents 83b61f2 + 4da3a22 commit 449fef3

File tree

3 files changed

+52
-5
lines changed

3 files changed

+52
-5
lines changed

debian/build-deb.sh

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ if [ ! -f debian/changelog.in ]; then
1010
echo "Debian changelog file not found"
1111
exit 1
1212
fi
13+
14+
# Build python2 package
1315
BUILD_DIR=${BUILD_DIR:-`pwd`/debbuild}
1416
mkdir -p $BUILD_DIR
1517
rm -rf $BUILD_DIR/*
@@ -28,3 +30,43 @@ mv $BUILD_DIR/$SOURCE_FILE $BUILD_DIR/${NAME}_${VERSION}.orig.tar.gz
2830
pushd ${SOURCE_DIR}
2931
debuild -d -us -uc
3032
popd
33+
34+
# Save the python2 package
35+
cp debbuild/*.deb .
36+
rm -rf debbuild
37+
38+
# Prepare build scripts for python3
39+
cp debian/control .
40+
cp debian/rules .
41+
sed -i "s/python/python3/g" debian/control
42+
sed -i "s/Package: aci-integration-module/Package: python3-aci-integration-module/g" debian/control
43+
sed -i "s/Python2.7/Python3/g" debian/control
44+
sed -i "s/2.7/3.3/g" debian/control
45+
sed -i "s/acitoolkit/python3-acitoolkit/g" debian/control
46+
sed -i "s/apicapi/python3-apicapi/g" debian/control
47+
sed -i "s/python2/python3/g" debian/rules
48+
49+
# Build the python3 package
50+
BUILD_DIR=${BUILD_DIR:-`pwd`/debbuild}
51+
mkdir -p $BUILD_DIR
52+
rm -rf $BUILD_DIR/*
53+
NAME=`python3 setup.py --name`
54+
VERSION_PY=`python3 setup.py --version`
55+
VERSION=`echo $VERSION_PY | sed -nre 's,([^\.]+.[^\.]+.[^\.]+)((\.)(0[^\.]+))?((\.)(dev.*))?,\1 \4 \7,p' | sed -re 's/ *$//g' | sed -re 's/ +/~/g'`
56+
REVISION=${REVISION:-1}
57+
python3 setup.py sdist --dist-dir $BUILD_DIR
58+
SOURCE_FILE=${NAME}-${VERSION_PY}.tar.gz
59+
tar -C $BUILD_DIR -xf $BUILD_DIR/$SOURCE_FILE
60+
SOURCE_DIR=$BUILD_DIR/${NAME}-${VERSION_PY}
61+
cp -H -r debian $SOURCE_DIR/
62+
sed -e "s/@VERSION@/$VERSION/" -e "s/@REVISION@/$REVISION/" ${SOURCE_DIR}/debian/changelog.in > ${SOURCE_DIR}/debian/changelog
63+
64+
mv $BUILD_DIR/$SOURCE_FILE $BUILD_DIR/${NAME}_${VERSION}.orig.tar.gz
65+
pushd ${SOURCE_DIR}
66+
debuild -d -us -uc
67+
popd
68+
69+
# restore the original files and debian packages
70+
mv control debian/control
71+
mv rules debian/rules
72+
mv *.deb debbuild/

debian/control

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Source: aci-integration-module
22
Section: python
33
Priority: optional
4-
Maintainer: Cisco Systems, Inc. <apicapi@noironetworks.com>
4+
Maintainer: Cisco Systems, Inc. <aci-integration-module@noironetworks.com>
55
Build-Depends: debhelper (>= 9), dh-systemd, python-setuptools (>= 3.3), python-all (>= 2.7)
66
Standards-Version: 3.9.5
77
Homepage: http://github.com/noironetworks/aci-integration-module/
@@ -11,7 +11,7 @@ Vcs-Browser: http://github.com/noironetworks/aci-integration-module
1111
Package: aci-integration-module
1212
Architecture: all
1313
Depends: python-click-cli (>=3.3) | python-click (>=6.2), python-oslo.config (>=1.4),
14-
${misc:Depends}, alembic, acitoolkit, python-apicapi, python-click, python-jsonschema,
14+
${misc:Depends}, alembic, acitoolkit, apicapi, python-click, python-jsonschema,
1515
python-pbr, python-tabulate, python-semantic-version
16-
Description: Python library for programming ACI
16+
Description: Python2.7 library for programming ACI
1717
Library for programming ACI

debian/rules

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,16 @@ DPKG_EXPORT_BUILDFLAGS = 1
66
include /usr/share/dpkg/default.mk
77

88
%:
9-
dh $@ --with systemd --with python2 --buildsystem=python_distutils
9+
dh $@ --with systemd --with python2 --buildsystem=pybuild
1010

1111
override_dh_auto_clean:
1212
dh_clean
1313

1414
override_dh_auto_install:
15-
dh_auto_install -- -O1 --install-data /
15+
dh_auto_install
1616

17+
ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS)))
18+
override_dh_auto_test:
19+
#testr init && ./run_tests.sh -N -P
20+
true
21+
endif

0 commit comments

Comments
 (0)