Skip to content

Commit

Permalink
Merge pull request #132 from ggtakec/update_support_os
Browse files Browse the repository at this point in the history
Changed support OS (fedora and ubuntu) and updated tool
  • Loading branch information
ggtakec committed Oct 27, 2023
2 parents 523f7f6 + 6e61024 commit a7f9e19
Show file tree
Hide file tree
Showing 6 changed files with 178 additions and 36 deletions.
171 changes: 164 additions & 7 deletions .github/workflows/build_helper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# These tools were recreated to reduce the number of fixes and
# reduce the workload of developers when there is a change in
# the project configuration.
#
#
# For the full copyright and license information, please view
# the license file that was distributed with this source code.
#
Expand Down Expand Up @@ -418,9 +418,47 @@ run_publish_package()
PRNERR "Token for uploading to packagecloud.io is not specified."
return 1
fi
if ! PACKAGECLOUD_TOKEN="${CI_PACKAGECLOUD_TOKEN}" /bin/sh -c "package_cloud push ${CI_PACKAGECLOUD_OWNER}/${CI_PACKAGECLOUD_PUBLISH_REPO}/${DIST_TAG} ${SRCTOP}/${PKG_OUTPUT_DIR}/*.${PKG_EXT}"; then
PRNERR "Failed to publish *.${PKG_EXT} packages to ${CI_PACKAGECLOUD_OWNER}/${CI_PACKAGECLOUD_PUBLISH_REPO}/${DIST_TAG}"
return 1

# [NOTE]
# The Ruby environment of some OS uses RVM (Ruby Version Manager) and requires a Bash shell environment.
#
if [ "${IS_OS_DEBIAN}" -eq 1 ] && echo "${CI_OSTYPE}" | sed -e 's#:##g' | grep -q -i -e 'debian10' -e 'debianbuster'; then
#
# Case for Debian 10(buster)
#
{
#
# Create bash script for run package_cloud command, because using RVM(Ruby Version Manager).
#
echo '#!/bin/bash'
echo ''
echo 'source /etc/profile.d/rvm.sh'
echo ''
echo 'if ! '"PACKAGECLOUD_TOKEN=${CI_PACKAGECLOUD_TOKEN} package_cloud push ${CI_PACKAGECLOUD_OWNER}/${CI_PACKAGECLOUD_PUBLISH_REPO}/${DIST_TAG} ${SRCTOP}/${PKG_OUTPUT_DIR}/*.${PKG_EXT}; then"
echo ' exit 1'
echo 'fi'
echo ''
echo 'exit 0'
} > /tmp/run_package_cloud.sh
chmod +x /tmp/run_package_cloud.sh

#
# Run bash script
#
if ({ RUNCMD /tmp/run_package_cloud.sh || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to publish *.${PKG_EXT} packages to ${CI_PACKAGECLOUD_OWNER}/${CI_PACKAGECLOUD_PUBLISH_REPO}/${DIST_TAG}"
rm -f /tmp/run_package_cloud.sh
return 1
fi
rm -f /tmp/run_package_cloud.sh
else
#
# Case for other than Debian 10(buster)
#
if ! PACKAGECLOUD_TOKEN="${CI_PACKAGECLOUD_TOKEN}" /bin/sh -c "package_cloud push ${CI_PACKAGECLOUD_OWNER}/${CI_PACKAGECLOUD_PUBLISH_REPO}/${DIST_TAG} ${SRCTOP}/${PKG_OUTPUT_DIR}/*.${PKG_EXT}"; then
PRNERR "Failed to publish *.${PKG_EXT} packages to ${CI_PACKAGECLOUD_OWNER}/${CI_PACKAGECLOUD_PUBLISH_REPO}/${DIST_TAG}"
return 1
fi
fi
else
PRNINFO "Not need to publish packages"
Expand Down Expand Up @@ -1062,11 +1100,11 @@ if [ "${CI_DO_PUBLISH}" -eq 1 ]; then
PRNERR "Failed to install SCL packages"
exit 1
fi
if ({ RUNCMD "${INSTALLER_BIN}" "${INSTALL_CMD}" "${INSTALL_CMD_ARG}" "${INSTALL_AUTO_ARG}" "${INSTALL_QUIET_ARG}" rh-ruby24 rh-ruby24-ruby-devel rh-ruby24-rubygem-rake || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
if ({ RUNCMD "${INSTALLER_BIN}" "${INSTALL_CMD}" "${INSTALL_CMD_ARG}" "${INSTALL_AUTO_ARG}" "${INSTALL_QUIET_ARG}" rh-ruby26 rh-ruby26-ruby-devel rh-ruby26-rubygem-rake || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install ruby packages"
exit 1
fi
. /opt/rh/rh-ruby24/enable
. /opt/rh/rh-ruby26/enable

if ({ RUNCMD "${GEM_BIN}" "${GEM_INSTALL_CMD}" package_cloud || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install packagecloud.io upload tools"
Expand All @@ -1082,9 +1120,128 @@ if [ "${CI_DO_PUBLISH}" -eq 1 ]; then
exit 1
fi

elif [ "${IS_OS_ROCKY}" -eq 1 ] && echo "${CI_OSTYPE}" | sed -e 's#:##g' | grep -q -i -e 'rockylinux8' -e 'rocky8'; then
#
# Case for Rocky Linux 8 (default ruby 2.5)
#

#
# Switch ruby module
#
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" reset ruby || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to reset ruby module"
exit 1
fi
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" install ruby:2.6 || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install ruby 2.6 module"
exit 1
fi
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" enable ruby:2.6 || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to enable ruby 2.6 module"
exit 1
fi
if ({ RUNCMD "${INSTALLER_BIN}" module "${INSTALL_AUTO_ARG}" update ruby:2.6 || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to update ruby 2.6 module"
exit 1
fi

#
# Install package_cloud tool
#
if ({ RUNCMD "${GEM_BIN}" "${GEM_INSTALL_CMD}" package_cloud || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install packagecloud.io upload tools"
exit 1
fi

elif [ "${IS_OS_DEBIAN}" -eq 1 ] && echo "${CI_OSTYPE}" | sed -e 's#:##g' | grep -q -i -e 'debian10' -e 'debianbuster'; then
#
# Case for Debian 10/buster (default ruby 2.5)
#

#
# Set RVM(Ruby Version Manager) and install Ruby 2.6 and package_cloud
#
# [NOTE]
# Install Ruby2.6 using RVM tools.
# Installation and running RVM tools must be done in Bash.
# This set of installations will create a Bash script and run it.
#
# The script does the following:
# First, we need to install the GPG key before installing RVM.
# This is done with one of the following commands:
#
# sudo gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
# or
# command curl -sSL https://rvm.io/mpapis.asc | sudo gpg --import -
# command curl -sSL https://rvm.io/pkuczynski.asc | sudo gpg --import -
#
# After that, install RVM installation, RVM environment settings, Ruby2.6 installation, and package_cloud tools.
#
# [NOTE]
# The RVM installation requires running from a bash shell.
# So create a Bash script and run it.
{
echo '#!/bin/bash'
echo ''
echo 'if ! curl -sSL https://rvm.io/mpapis.asc | gpg --import - 2>&1; then'
echo ' echo "Failed to run [ curl -sSL https://rvm.io/mpapis.asc | gpg --import - ] command."'
echo ' exit 1'
echo 'fi'
echo 'if ! curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - 2>&1; then'
echo ' echo "Failed to run [ curl -sSL https://rvm.io/pkuczynski.asc | gpg --import - ] command."'
echo ' exit 1'
echo 'fi'
echo ''
echo 'if ! curl -sSL https://get.rvm.io | bash -s stable --ruby 2>&1; then'
echo ' echo "Failed to install RVM tool."'
echo ' exit 1'
echo 'fi'
echo ''
echo 'if [ ! -f /etc/profile.d/rvm.sh ]; then'
echo ' echo "Not found /etc/profile.d/rvm.sh file."'
echo ' exit 1'
echo 'fi'
echo 'source /etc/profile.d/rvm.sh'
echo ''
echo 'if ! rvm get stable --autolibs=enable 2>&1; then'
echo ' echo "Failed to get/update RVM stable."'
echo ' exit 1'
echo 'fi'
echo 'if ! usermod -a -G rvm root 2>&1; then'
echo ' echo "Failed to add rvm user to root group."'
echo ' exit 1'
echo 'fi'
echo 'if ! rvm install ruby-2.6 2>&1; then'
echo ' echo "Failed to install ruby 2.6."'
echo ' exit 1'
echo 'fi'
echo 'if ! rvm --default use ruby-2.6 2>&1; then'
echo ' echo "Failed to set ruby 2.6 as default."'
echo ' exit 1'
echo 'fi'
echo ''
echo 'if ! '"${GEM_BIN} ${GEM_INSTALL_CMD} package_cloud 2>&1; then"
echo ' echo "Failed to install packagecloud.io upload tools"'
echo ' exit 1'
echo 'fi'
echo ''
echo 'exit 0'
} > /tmp/rvm_setup.sh
chmod +x /tmp/rvm_setup.sh

#
# Run bash script
#
if ({ RUNCMD /tmp/rvm_setup.sh || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to set up RVM."
rm -f /tmp/rvm_setup.sh
exit 1
fi
rm -f /tmp/rvm_setup.sh

else
#
# Case for other than CentOS
# Case for other than CentOS / Alpine / Debian 10 / Rocky Linux 8
#
if ({ RUNCMD "${GEM_BIN}" "${GEM_INSTALL_CMD}" rake package_cloud || echo > "${PIPEFAILURE_FILE}"; } | sed -e 's/^/ /g') && rm "${PIPEFAILURE_FILE}" >/dev/null 2>&1; then
PRNERR "Failed to install packagecloud.io upload tools"
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,14 @@ jobs:
container:
- ubuntu:22.04
- ubuntu:20.04
- ubuntu:18.04
- debian:bookworm
- debian:bullseye
- debian:buster
- rockylinux:9
- rockylinux:8
- centos:centos7
- fedora:38
- fedora:37
- fedora:36
- alpine:3.18

container:
Expand Down
22 changes: 4 additions & 18 deletions .github/workflows/ostypevars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,20 +122,6 @@ elif [ "${CI_OSTYPE}" = "ubuntu:20.04" ] || [ "${CI_OSTYPE}" = "ubuntu:focal" ];
PKG_EXT="deb"
IS_OS_UBUNTU=1

elif [ "${CI_OSTYPE}" = "ubuntu:18.04" ] || [ "${CI_OSTYPE}" = "ubuntu:bionic" ]; then
DIST_TAG="ubuntu/bionic"
INSTALL_PKG_LIST="git autoconf autotools-dev gcc g++ make gdb dh-make fakeroot dpkg-dev devscripts libtool pkg-config ruby-dev rubygems rubygems-integration procps libyaml-dev k2hash-dev gnutls-dev dh-systemd"
INSTALLER_BIN="apt-get"
UPDATE_CMD="update"
UPDATE_CMD_ARG=""
INSTALL_CMD="install"
INSTALL_CMD_ARG=""
INSTALL_AUTO_ARG="-y"
INSTALL_QUIET_ARG="-qq"
PKG_OUTPUT_DIR="debian_build"
PKG_EXT="deb"
IS_OS_UBUNTU=1

elif [ "${CI_OSTYPE}" = "debian:12" ] || [ "${CI_OSTYPE}" = "debian:bookworm" ]; then
DIST_TAG="debian/bookworm"
INSTALL_PKG_LIST="git autoconf autotools-dev gcc g++ make gdb dh-make fakeroot dpkg-dev devscripts libtool pkg-config ruby-dev rubygems rubygems-integration procps libyaml-dev k2hash-dev gnutls-dev"
Expand Down Expand Up @@ -242,8 +228,8 @@ elif [ "${CI_OSTYPE}" = "centos:7" ] || [ "${CI_OSTYPE}" = "centos:centos7" ]; t
PKG_EXT="rpm"
IS_OS_CENTOS=1

elif [ "${CI_OSTYPE}" = "fedora:37" ]; then
DIST_TAG="fedora/37"
elif [ "${CI_OSTYPE}" = "fedora:38" ]; then
DIST_TAG="fedora/38"
INSTALL_PKG_LIST="git autoconf automake gcc gcc-c++ gdb make libtool pkgconfig redhat-rpm-config rpm-build ruby-devel rubygems procps libyaml-devel k2hash-devel nss-devel"
INSTALLER_BIN="dnf"
UPDATE_CMD="update"
Expand All @@ -256,8 +242,8 @@ elif [ "${CI_OSTYPE}" = "fedora:37" ]; then
PKG_EXT="rpm"
IS_OS_FEDORA=1

elif [ "${CI_OSTYPE}" = "fedora:36" ]; then
DIST_TAG="fedora/36"
elif [ "${CI_OSTYPE}" = "fedora:37" ]; then
DIST_TAG="fedora/37"
INSTALL_PKG_LIST="git autoconf automake gcc gcc-c++ gdb make libtool pkgconfig redhat-rpm-config rpm-build ruby-devel rubygems procps libyaml-devel k2hash-devel nss-devel"
INSTALLER_BIN="dnf"
UPDATE_CMD="update"
Expand Down
8 changes: 4 additions & 4 deletions buildutils/chmpx.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ License: @PKGLICENSE@
@RPMPKG_GROUP@
URL: https://@GIT_DOMAIN@/@GIT_ORG@/@PACKAGE_NAME@
Source0: https://@GIT_DOMAIN@/@GIT_ORG@/@PACKAGE_NAME@/archive/%{gittag}/%{name}-%{version}.tar.gz
Requires: k2hash%{?_isa} >= 1.0.89, libfullock%{?_isa} >= 1.0.53, nss-tools
Requires: k2hash%{?_isa} >= 1.0.91, libfullock%{?_isa} >= 1.0.55, nss-tools
%if 0%{?rhel} == 6
BuildRequires: git-core gcc-c++ make libtool k2hash-devel >= 1.0.89, libfullock-devel >= 1.0.53, libyaml-devel, nss-devel
BuildRequires: git-core gcc-c++ make libtool k2hash-devel >= 1.0.91, libfullock-devel >= 1.0.55, libyaml-devel, nss-devel
%else
BuildRequires: systemd git-core gcc-c++ make libtool k2hash-devel >= 1.0.89, libfullock-devel >= 1.0.53, libyaml-devel, nss-devel
BuildRequires: systemd git-core gcc-c++ make libtool k2hash-devel >= 1.0.91, libfullock-devel >= 1.0.55, libyaml-devel, nss-devel
%endif

%description
Expand Down Expand Up @@ -134,7 +134,7 @@ rm -rf %{buildroot}
#
%package devel
Summary: @SHORTDESC@ (development)
Requires: %{name}%{?_isa} = %{version}-%{release}, k2hash-devel%{?_isa} >= 1.0.89, libfullock-devel%{?_isa} >= 1.0.53, libyaml-devel, nss-devel
Requires: %{name}%{?_isa} = %{version}-%{release}, k2hash-devel%{?_isa} >= 1.0.91, libfullock-devel%{?_isa} >= 1.0.55, libyaml-devel, nss-devel

%description devel
Development package for building with @PACKAGE_NAME@ shared library.
Expand Down
6 changes: 3 additions & 3 deletions buildutils/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Source: @PACKAGE_NAME@
Section: net
Priority: optional
Maintainer: @DEV_NAME@ <@DEV_EMAIL@>
Build-Depends: @DEBHELPER_DEP@, k2hash-dev (>= 1.0.89), libfullock-dev (>= 1.0.53), libyaml-dev, gnutls-dev
Build-Depends: @DEBHELPER_DEP@, k2hash-dev (>= 1.0.91), libfullock-dev (>= 1.0.55), libyaml-dev, gnutls-dev
Standards-Version: 3.9.8
Homepage: https://@GIT_DOMAIN@/@GIT_ORG@/@GIT_REPO@
Vcs-Git: git://@GIT_DOMAIN@/@GIT_ORG@/@[email protected]
Expand All @@ -11,14 +11,14 @@ Vcs-Browser: https://@GIT_DOMAIN@/@GIT_ORG@/@GIT_REPO@
Package: @PACKAGE_NAME@-dev
Section: devel
Architecture: amd64
Depends: ${misc:Depends}, @PACKAGE_NAME@ (= ${binary:Version}), k2hash-dev (>= 1.0.89), libfullock-dev (>= 1.0.53), libyaml-dev, gnutls-dev
Depends: ${misc:Depends}, @PACKAGE_NAME@ (= ${binary:Version}), k2hash-dev (>= 1.0.91), libfullock-dev (>= 1.0.55), libyaml-dev, gnutls-dev
Description: @SHORTDESC@ (development)
Development package for building with @PACKAGE_NAME@ shared library.
This package has header files and symbols for it.

Package: @PACKAGE_NAME@
Section: net
Architecture: amd64
Depends: ${shlibs:Depends}, ${misc:Depends}, init-system-helpers (>= 1.14), k2hash (>= 1.0.89), libfullock (>= 1.0.53)
Depends: ${shlibs:Depends}, ${misc:Depends}, init-system-helpers (>= 1.14), k2hash (>= 1.0.91), libfullock (>= 1.0.55)
Description: @SHORTDESC@
@DEBLONGDESC@
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ AC_ARG_ENABLE(check-depend-libs,
esac]
)
AS_IF([test ${check_depend_libs} = 1], [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([k2hash], [libk2hash >= 1.0.89], [], [AC_MSG_ERROR(not found k2hash package)])])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([fullock], [libfullock >= 1.0.53], [], [AC_MSG_ERROR(not found libfullock package)])])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([k2hash], [libk2hash >= 1.0.91], [], [AC_MSG_ERROR(not found k2hash package)])])
AS_IF([test ${check_depend_libs} = 1], [PKG_CHECK_MODULES([fullock], [libfullock >= 1.0.55], [], [AC_MSG_ERROR(not found libfullock package)])])

#
# CFLAGS/CXXFLAGS
Expand Down

0 comments on commit a7f9e19

Please sign in to comment.