From 485de4e6eabae70e71eb7cff35cca9efd28c4e30 Mon Sep 17 00:00:00 2001 From: houyu <524860213@qq.com> Date: Fri, 3 Feb 2023 17:20:24 +0800 Subject: [PATCH] BIGTOP-3904: Introduce bigtop-select deb package to Bigtop --- .../src/common/bigtop-select/distro-select | 3 ++ .../common/bigtop-select/install_select.sh | 4 ++ .../deb/bigtop-select/bigtop-select.install | 1 + .../src/deb/bigtop-select/changelog | 5 +++ bigtop-packages/src/deb/bigtop-select/control | 15 +++++++ .../src/deb/bigtop-select/copyright | 43 +++++++++++++++++++ bigtop-packages/src/deb/bigtop-select/rules | 40 +++++++++++++++++ .../src/deb/bigtop-select/source/format | 1 + .../bigtop-select/SPECS/bigtop-select.spec | 7 +-- bigtop.bom | 1 - packages.gradle | 9 ++++ 11 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 bigtop-packages/src/deb/bigtop-select/bigtop-select.install create mode 100644 bigtop-packages/src/deb/bigtop-select/changelog create mode 100644 bigtop-packages/src/deb/bigtop-select/control create mode 100644 bigtop-packages/src/deb/bigtop-select/copyright create mode 100644 bigtop-packages/src/deb/bigtop-select/rules create mode 100644 bigtop-packages/src/deb/bigtop-select/source/format diff --git a/bigtop-packages/src/common/bigtop-select/distro-select b/bigtop-packages/src/common/bigtop-select/distro-select index 7a5bbf8638..6b376be109 100644 --- a/bigtop-packages/src/common/bigtop-select/distro-select +++ b/bigtop-packages/src/common/bigtop-select/distro-select @@ -321,6 +321,9 @@ def checkCommandParameters(cmd, realLen, rightLen): # # Start of main +if not os.path.exists(root): + os.makedirs(root) + sanityCheckTables() parser = optparse.OptionParser(add_help_option=False) diff --git a/bigtop-packages/src/common/bigtop-select/install_select.sh b/bigtop-packages/src/common/bigtop-select/install_select.sh index b5b88c9543..0011c6758e 100644 --- a/bigtop-packages/src/common/bigtop-select/install_select.sh +++ b/bigtop-packages/src/common/bigtop-select/install_select.sh @@ -77,6 +77,10 @@ LIB_DIR=${LIB_DIR:-/usr/lib/bigtop-select} BIN_DIR=${BIN_DIR:-/usr/bin} CONF_DIR=${CONF_DIR:-/etc/bigtop-select/conf.dist} +if [[ ${PARENT_DIR} == "" ]];then + PARENT_DIR=/usr/bigtop/${BIGTOP_BASE_VERSION} +fi + STACK_ROOT_DIR=$(echo ${PARENT_DIR} | sed -e "s/\/${BIGTOP_BASE_VERSION}$//") STACK_SELECTOR=distro-select CONF_SELECTOR=conf-select diff --git a/bigtop-packages/src/deb/bigtop-select/bigtop-select.install b/bigtop-packages/src/deb/bigtop-select/bigtop-select.install new file mode 100644 index 0000000000..5ff72048fa --- /dev/null +++ b/bigtop-packages/src/deb/bigtop-select/bigtop-select.install @@ -0,0 +1 @@ +/usr/lib/bigtop-select \ No newline at end of file diff --git a/bigtop-packages/src/deb/bigtop-select/changelog b/bigtop-packages/src/deb/bigtop-select/changelog new file mode 100644 index 0000000000..9c110b9e92 --- /dev/null +++ b/bigtop-packages/src/deb/bigtop-select/changelog @@ -0,0 +1,5 @@ +bigtop-select (3.2.1-1) unstable; urgency=medium + + * Initial release (Closes: #nnnn) + + -- Bigtop Wed, 01 Feb 2023 12:51:18 +0000 diff --git a/bigtop-packages/src/deb/bigtop-select/control b/bigtop-packages/src/deb/bigtop-select/control new file mode 100644 index 0000000000..4af571d2ee --- /dev/null +++ b/bigtop-packages/src/deb/bigtop-select/control @@ -0,0 +1,15 @@ +Source: bigtop-select +Section: unknown +Priority: optional +Maintainer: Bigtop +Build-Depends: debhelper-compat (= 12) +Standards-Version: 4.4.1 +Homepage: +#Vcs-Browser: https://salsa.debian.org/debian/bigtop-select +#Vcs-Git: https://salsa.debian.org/debian/bigtop-select.git + +Package: bigtop-select +Architecture: all +Depends: ${misc:Depends} +Description: + diff --git a/bigtop-packages/src/deb/bigtop-select/copyright b/bigtop-packages/src/deb/bigtop-select/copyright new file mode 100644 index 0000000000..eaebff04d5 --- /dev/null +++ b/bigtop-packages/src/deb/bigtop-select/copyright @@ -0,0 +1,43 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: bigtop-select +Upstream-Contact: +Source: + +Files: * +Copyright: + +License: + + + . + + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2023 Bigtop +License: GPL-2+ + This package is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + . + This package is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see + . + On Debian systems, the complete text of the GNU General + Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". + +# Please also look if there are files or directories which have a +# different copyright/license attached and list them here. +# Please avoid picking licenses with terms that are more restrictive than the +# packaged work, as it may make Debian's contributions unacceptable upstream. +# +# If you need, there are some extra license texts available in two places: +# /usr/share/debhelper/dh_make/licenses/ +# /usr/share/common-licenses/ diff --git a/bigtop-packages/src/deb/bigtop-select/rules b/bigtop-packages/src/deb/bigtop-select/rules new file mode 100644 index 0000000000..aedb89e9a1 --- /dev/null +++ b/bigtop-packages/src/deb/bigtop-select/rules @@ -0,0 +1,40 @@ +#!/usr/bin/make -f +# See debhelper(7) (uncomment to enable) +# output every command that modifies files on the build system. +#export DH_VERBOSE = 1 + + +# see FEATURE AREAS in dpkg-buildflags(1) +#export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +# see ENVIRONMENT in dpkg-buildflags(1) +# package maintainers to append CFLAGS +#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic +# package maintainers to append LDFLAGS +#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed + +# Uncomment this to turn on verbose mode. +export DH_VERBOSE=1 + +# This has to be exported to make some magic below work. +export DH_OPTIONS + +%: + dh $@ + + +# dh_make generated override targets +# This is example for Cmake (See https://bugs.debian.org/641051 ) +#override_dh_auto_configure: +# dh_auto_configure -- # -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) + +override_dh_auto_install: + bash -x debian/install_select.sh \ + --prefix=debian/tmp \ + --distro-dir=debian \ + --build-dir=`pwd` \ + --parent-dir=$(PARENT_DIR) \ + --bigtop-base-version=$(BIGTOP_BASE_VERSION) + + rm -f debian/distro-select + rm -f debian/conf-select \ No newline at end of file diff --git a/bigtop-packages/src/deb/bigtop-select/source/format b/bigtop-packages/src/deb/bigtop-select/source/format new file mode 100644 index 0000000000..163aaf8d82 --- /dev/null +++ b/bigtop-packages/src/deb/bigtop-select/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec b/bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec index e62abdc254..1fd02b01f9 100644 --- a/bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec +++ b/bigtop-packages/src/rpm/bigtop-select/SPECS/bigtop-select.spec @@ -15,10 +15,6 @@ %define lib_dir /usr/lib/bigtop-select %define bin_dir /usr/bin -%define default_parent_dir /usr/bigtop/%{bigtop_base_version} -%if "%{parent_dir}" != "" -%define default_parent_dir %{parent_dir} -%endif Name: bigtop-select Version: %{bigtop_select_version} @@ -64,7 +60,7 @@ bash %{SOURCE0} \ --distro-dir=${RPM_SOURCE_DIR} \ --build-dir=${PWD} \ --prefix=${RPM_BUILD_ROOT} \ - --parent-dir=%{default_parent_dir} \ + --parent-dir=%{parent_dir} \ --bigtop-base-version=%{bigtop_base_version} %clean @@ -76,7 +72,6 @@ rm -rf $RPM_BUILD_ROOT %doc LICENSE %{lib_dir} -%{default_parent_dir} %changelog diff --git a/bigtop.bom b/bigtop.bom index 2c2edd6029..e0ba862e53 100644 --- a/bigtop.bom +++ b/bigtop.bom @@ -275,7 +275,6 @@ bigtop { relNotes = "Service package for Apache Bigtop information to use Ambari" version { base = bigtop.version; pkg = base-"-SNAPSHOT"; release = 1 } tarball { destination = "bigtop-select-${version.base}.tar.gz" } - packaging = 'rpm' } 'bigtop-jsvc' { name = "bigtop-jsvc" diff --git a/packages.gradle b/packages.gradle index ba929452bd..910e1d49fb 100644 --- a/packages.gradle +++ b/packages.gradle @@ -336,6 +336,13 @@ def genTasks = { target -> def final SRCDEB = "${PKG_NAME}_$PKG_VERSION-${BIGTOP_BUILD_STAMP}.dsc" def final HADOOP_VERSION = config.bigtop.components["hadoop"].version.pkg + def final BIGTOP_BASE_VERSION = "${config.bigtop.base_version}" + def final PARENT_DIR = project.hasProperty("parentDir") ? project.property('parentDir') : "" + def FULL_PARENT_DIR = "${PARENT_DIR}" + if (PARENT_DIR != "") { + FULL_PARENT_DIR = "${PARENT_DIR}/${BIGTOP_BASE_VERSION}" + } + exec { workingDir PKG_OUTPUT_DIR commandLine "dpkg-source -x $SRCDEB".split(' ') @@ -352,6 +359,8 @@ def genTasks = { target -> --set-envvar=${toOldStyleName(target)}_BASE_VERSION=$BASE_VERSION \ --set-envvar=${toOldStyleName(target)}_VERSION=$PKG_VERSION \ --set-envvar=${toOldStyleName(target)}_RELEASE=$BIGTOP_BUILD_STAMP \ +--set-envvar=PARENT_DIR=$FULL_PARENT_DIR \ +--set-envvar=BIGTOP_BASE_VERSION=$BIGTOP_BASE_VERSION \ -uc -us -b """ exec {