2019-02-04 20:05:36 +00:00
|
|
|
#!/bin/bash
|
|
|
|
cd `dirname $0`
|
2019-02-11 18:54:49 +00:00
|
|
|
PKGNAME=$(basename $(pwd))
|
|
|
|
DPKGNAME=$(basename $(pwd) | sed -e s/_/-/)
|
2019-03-26 17:49:54 +00:00
|
|
|
OPKGNAME=$(basename $(pwd) | sed -e s/_/-/)
|
2020-01-14 14:52:16 +00:00
|
|
|
PYEXEC=python3
|
|
|
|
DSCARGS="--with-python3=True --with-python2=False"
|
2019-03-19 19:03:06 +00:00
|
|
|
if grep wheezy /etc/os-release; then
|
|
|
|
DPKGNAME=python-$DPKGNAME
|
2020-01-14 14:52:16 +00:00
|
|
|
PYEXEC=python
|
2020-02-20 13:05:21 +00:00
|
|
|
DSCARGS=""
|
2019-03-19 19:03:06 +00:00
|
|
|
fi
|
2019-02-11 20:16:24 +00:00
|
|
|
cd ..
|
|
|
|
mkdir -p /tmp/confluent # $DPKGNAME
|
|
|
|
cp -a * .git /tmp/confluent # $DPKGNAME
|
|
|
|
cd /tmp/confluent/$PKGNAME
|
2019-02-04 20:05:36 +00:00
|
|
|
if [ -x ./makeman ]; then
|
|
|
|
./makeman
|
|
|
|
fi
|
|
|
|
./makesetup
|
|
|
|
VERSION=`cat VERSION`
|
2019-02-05 18:12:35 +00:00
|
|
|
cat > setup.cfg << EOF
|
|
|
|
[install]
|
|
|
|
install-purelib=/opt/confluent/lib/python
|
|
|
|
install-scripts=/opt/confluent/bin
|
|
|
|
|
|
|
|
[sdist_dsc]
|
2019-02-05 20:41:03 +00:00
|
|
|
package=$DPKGNAME
|
2019-02-05 18:12:35 +00:00
|
|
|
EOF
|
|
|
|
|
2020-01-14 14:52:16 +00:00
|
|
|
$PYEXEC setup.py sdist > /dev/null 2>&1
|
|
|
|
py2dsc $DSCARGS dist/*.tar.gz
|
2019-02-04 20:05:36 +00:00
|
|
|
shopt -s extglob
|
|
|
|
cd deb_dist/!(*.orig)/
|
2019-03-26 17:49:54 +00:00
|
|
|
if [ "$OPKGNAME" = "confluent-server" ]; then
|
2019-02-12 21:18:21 +00:00
|
|
|
if grep wheezy /etc/os-release; then
|
2019-08-30 14:22:17 +00:00
|
|
|
sed -i 's/^\(Depends:.*\)/\1, python-confluent-client, python-lxml, python-eficompressor, python-pycryptodomex, python-dateutil, python-pyopenssl/' debian/control
|
2019-02-12 21:18:21 +00:00
|
|
|
else
|
2020-01-14 14:52:16 +00:00
|
|
|
sed -i 's/^\(Depends:.*\)/\1, confluent-client, python3-lxml, python3-eficompressor, python3-pycryptodome, python3-websocket/' debian/control
|
2019-02-12 21:18:21 +00:00
|
|
|
fi
|
2019-03-26 17:46:39 +00:00
|
|
|
if grep wheezy /etc/os-release; then
|
|
|
|
echo 'confluent_client python-confluent-client' >> debian/pydist-overrides
|
|
|
|
else
|
|
|
|
echo 'confluent_client confluent-client' >> debian/pydist-overrides
|
|
|
|
fi
|
2019-02-11 15:09:02 +00:00
|
|
|
fi
|
2019-02-26 16:09:23 +00:00
|
|
|
head -n -1 debian/control > debian/control1
|
|
|
|
mv debian/control1 debian/control
|
2019-07-02 18:42:45 +00:00
|
|
|
echo 'export PYBUILD_INSTALL_ARGS=--install-lib=/opt/confluent/lib/python' >> debian/rules
|
2019-03-26 17:49:54 +00:00
|
|
|
#echo 'Provides: python-'$DPKGNAME >> debian/control
|
2019-02-26 18:39:11 +00:00
|
|
|
#echo 'Conflicts: python-'$DPKGNAME >> debian/control
|
2019-03-26 17:49:54 +00:00
|
|
|
#echo 'Replaces: python-'$DPKGNAME' (<<2)' >> debian/control
|
|
|
|
#echo 'Breaks: python-'$DPKGNAME' (<<2)' >> debian/control
|
2019-02-12 21:18:21 +00:00
|
|
|
|
2019-02-04 20:05:36 +00:00
|
|
|
dpkg-buildpackage -rfakeroot -uc -us -i
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "[ERROR] rpmbuild returned non-zero, run: rpmbuild -ba ~/rpmbuild/SPECS/$PKGNAME.spec"
|
|
|
|
exit 1
|
|
|
|
else
|
2019-02-04 20:35:55 +00:00
|
|
|
cd -
|
2019-02-04 20:05:36 +00:00
|
|
|
# Clean up the generated files in this directory
|
|
|
|
rm -rf $PKGNAME.egg-info dist setup.py
|
2019-02-04 20:14:39 +00:00
|
|
|
rm -rf $(find deb_dist -mindepth 1 -maxdepth 1 -type d)
|
2019-02-05 15:29:31 +00:00
|
|
|
if [ ! -z "$1" ]; then
|
2019-02-05 15:36:06 +00:00
|
|
|
mv deb_dist/* $1/
|
2019-02-05 15:29:31 +00:00
|
|
|
fi
|
2019-02-04 20:05:36 +00:00
|
|
|
fi
|
|
|
|
exit 0
|