dist/debian: support package renaming on build script

To automatically rename packages on enterprise release, added package name
prefix as a variable on build_deb.sh.

Signed-off-by: Takuya ASADA <syuu@scylladb.com>
Message-Id: <20180828010445.11920-2-syuu@scylladb.com>
This commit is contained in:
Takuya ASADA 2018-08-28 10:04:44 +09:00 committed by Avi Kivity
parent a27d9601f5
commit cd1c79f90f
5 changed files with 39 additions and 22 deletions

View File

@ -1,5 +1,7 @@
#!/bin/bash -e
PRODUCT=scylla
. /etc/os-release
print_usage() {
echo "build_deb.sh -target <codename>"
@ -111,9 +113,14 @@ VERSION=$(./SCYLLA-VERSION-GEN)
SCYLLA_VERSION=$(cat build/SCYLLA-VERSION-FILE | sed 's/\.rc/~rc/')
SCYLLA_RELEASE=$(cat build/SCYLLA-RELEASE-FILE)
echo $VERSION > version
./scripts/git-archive-all --extra version --force-submodules --prefix scylla-jmx ../scylla-jmx_$SCYLLA_VERSION-$SCYLLA_RELEASE.orig.tar.gz
./scripts/git-archive-all --extra version --force-submodules --prefix $PRODUCT-jmx ../$PRODUCT-jmx_$SCYLLA_VERSION-$SCYLLA_RELEASE.orig.tar.gz
cp -a dist/debian/debian debian
if [ "$PRODUCT" != "scylla" ]; then
for i in debian/scylla-*;do
mv $i ${i/scylla-/$PRODUCT-}
done
fi
if is_debian $TARGET; then
REVISION="1~$TARGET"
elif is_ubuntu $TARGET; then
@ -122,28 +129,28 @@ else
echo "Unknown distribution: $TARGET"
fi
MUSTACHE_DIST="\"debian\": true, \"$TARGET\": true"
pystache dist/debian/changelog.mustache "{ \"version\": \"$SCYLLA_VERSION\", \"release\": \"$SCYLLA_RELEASE\", \"revision\": \"$REVISION\", \"codename\": \"$TARGET\" }" > debian/changelog
MUSTACHE_DIST="\"debian\": true, \"$TARGET\": true, \"product\": \"$PRODUCT\", \"$PRODUCT\": true"
pystache dist/debian/changelog.mustache "{ $MUSTACHE_DIST, \"version\": \"$SCYLLA_VERSION\", \"release\": \"$SCYLLA_RELEASE\", \"revision\": \"$REVISION\", \"codename\": \"$TARGET\" }" > debian/changelog
pystache dist/debian/rules.mustache "{ $MUSTACHE_DIST }" > debian/rules
chmod a+rx debian/rules
pystache dist/debian/control.mustache "{ $MUSTACHE_DIST }" > debian/control
if [ "$TARGET" != "trusty" ]; then
pystache dist/common/systemd/scylla-jmx.service.mustache "{ $MUSTACHE_DIST }" > debian/scylla-jmx.service
fi
cp ./dist/debian/pbuilderrc ~/.pbuilderrc
sudo rm -fv /var/cache/pbuilder/scylla-jmx-$TARGET.tgz
sudo -E DIST=$TARGET /usr/sbin/pbuilder clean
sudo -E DIST=$TARGET /usr/sbin/pbuilder create
sudo -E DIST=$TARGET /usr/sbin/pbuilder update
sudo rm -fv /var/cache/pbuilder/$PRODUCT-jmx-$TARGET.tgz
sudo PRODUCT=$PRODUCT DIST=$TARGET /usr/sbin/pbuilder clean --configfile ./dist/debian/pbuilderrc
sudo PRODUCT=$PRODUCT DIST=$TARGET /usr/sbin/pbuilder create --configfile ./dist/debian/pbuilderrc
sudo PRODUCT=$PRODUCT DIST=$TARGET /usr/sbin/pbuilder update --configfile ./dist/debian/pbuilderrc
if [ "$TARGET" = "jessie" ]; then
echo "apt-get install -y -t jessie-backports ca-certificates-java" > build/jessie-pkginst.sh
chmod a+rx build/jessie-pkginst.sh
sudo -E DIST=$TARGET /usr/sbin/pbuilder execute build/jessie-pkginst.sh
sudo PRODUCT=$PRODUCT DIST=$TARGET /usr/sbin/pbuilder execute --configfile ./dist/debian/pbuilderrc build/jessie-pkginst.sh
elif [ "$TARGET" = "bionic" ]; then
echo "apt-get install -y ca-certificates-java openjdk-8-jdk-headless" > build/bionic-workaround.sh
echo "update-ca-certificates -f" >> build/bionic-workaround.sh
chmod a+rx build/bionic-workaround.sh
sudo -E DIST=$TARGET /usr/sbin/pbuilder execute --save-after-exec build/bionic-workaround.sh
sudo PRODUCT=$PRODUCT DIST=$TARGET /usr/sbin/pbuilder execute --configfile ./dist/debian/pbuilderrc --save-after-exec build/bionic-workaround.sh
fi
sudo -E DIST=$TARGET pdebuild --buildresult build/debs
sudo PRODUCT=$PRODUCT DIST=$TARGET pdebuild --configfile ./dist/debian/pbuilderrc --buildresult build/debs

View File

@ -1,4 +1,4 @@
scylla-jmx ({{version}}-{{release}}-{{revision}}) {{codename}}; urgency=medium
{{product}}-jmx ({{version}}-{{release}}-{{revision}}) {{codename}}; urgency=medium
* Initial release.

View File

@ -1,4 +1,4 @@
Source: scylla-jmx
Source: {{product}}-jmx
Maintainer: Takuya ASADA <syuu@scylladb.com>
Homepage: http://scylladb.com
Section: database
@ -6,9 +6,9 @@ Priority: optional
Standards-Version: 3.9.5
Build-Depends: debhelper (>= 9), maven, openjdk-8-jdk-headless
Package: scylla-jmx
Package: {{product}}-jmx
Architecture: all
Depends: ${shlibs:Depends}, ${misc:Depends}, openjdk-8-jre-headless | openjdk-8-jre | oracle-java8-set-default, scylla-server
Depends: ${shlibs:Depends}, ${misc:Depends}, openjdk-8-jre-headless | openjdk-8-jre | oracle-java8-set-default, {{product}}-server
Description: Scylla JMX server binaries
Scylla is a highly scalable, eventually consistent, distributed,
partitioned row DB.

View File

@ -1,9 +1,9 @@
USENETWORK=yes
BUILD_HOME=/tmp
BASETGZ="/var/cache/pbuilder/scylla-jmx-$DIST.tgz"
BASETGZ="/var/cache/pbuilder/$PRODUCT-jmx-$DIST.tgz"
DISTRIBUTION="$DIST"
BUILDRESULT="/var/cache/pbuilder/scylla-jmx-$DIST/result/"
APTCACHE="/var/cache/pbuilder/scylla-jmx-$DIST/aptcache/"
BUILDRESULT="/var/cache/pbuilder/$PRODUCT-jmx-$DIST/result/"
APTCACHE="/var/cache/pbuilder/$PRODUCT-jmx-$DIST/aptcache/"
ALLOWUNTRUSTED=yes
if [ "$DIST" = "trusty" ] || [ "$DIST" = "xenial" ] || [ "$DIST" = "yakkety" ] || [ "$DIST" = "zesty" ] || [ "$DIST" = "artful" ] || [ "$DIST" = "bionic" ]; then

View File

@ -1,7 +1,7 @@
#!/usr/bin/make -f
DOC = $(CURDIR)/debian/scylla-jmx/usr/share/doc/scylla-jmx
DEST = $(CURDIR)/debian/scylla-jmx/usr/lib/scylla/jmx
DOC = $(CURDIR)/debian/{{product}}-jmx/usr/share/doc/{{product}}-jmx
DEST = $(CURDIR)/debian/{{product}}-jmx/usr/lib/scylla/jmx
M2_REPO= $(CURDIR)/m2
override_dh_auto_build:
@ -11,9 +11,9 @@ override_dh_auto_clean:
rm -rf target m2
override_dh_auto_install:
mkdir -p $(CURDIR)/debian/scylla-jmx/etc/default/ && \
mkdir -p $(CURDIR)/debian/{{product}}-jmx/etc/default/ && \
cp $(CURDIR)/dist/common/sysconfig/scylla-jmx \
$(CURDIR)/debian/scylla-jmx/etc/default/
$(CURDIR)/debian/{{product}}-jmx/etc/default/
mkdir -p $(DOC) && \
cp $(CURDIR)/*.md $(DOC)
@ -27,10 +27,20 @@ override_dh_auto_install:
override_dh_installinit:
{{#trusty}}
{{#scylla}}
dh_installinit --no-start --upstart-only
{{/scylla}}
{{^scylla}}
dh_installinit --no-start --name scylla-jmx --upstart-only
{{/scylla}}
{{/trusty}}
{{^trusty}}
{{#scylla}}
dh_installinit --no-start
{{/scylla}}
{{^scylla}}
dh_installinit --no-start --name scylla-jmx
{{/scylla}}
{{/trusty}}
%: