From d1cc2d26a5b9bded29c6c573d3816c51f8c2366b Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Thu, 19 Jan 2023 12:05:59 -0500 Subject: [PATCH] Package up the static lib on Ubuntu Rather than the shared lib. Remove libraft0 package. Update packaging/. Skip-PR-comments: true Signed-off-by: Brian J. Murrell --- debian/changelog | 23 +++++++----- debian/control | 13 ------- debian/libraft-dev.dirs | 1 + debian/libraft-dev.install | 1 + debian/libraft0.dirs | 1 - debian/libraft0.install | 1 - debian/rules | 8 +++-- packaging/Dockerfile.mockbuild | 20 +++++++---- packaging/Dockerfile.ubuntu.20.04 | 58 ++++++++++++++++++++++--------- packaging/Makefile_packaging.mk | 18 ++-------- packaging/debian_chrootbuild | 22 +++++++----- packaging/rpm_chrootbuild | 3 +- 12 files changed, 94 insertions(+), 75 deletions(-) delete mode 100644 debian/libraft0.dirs delete mode 100644 debian/libraft0.install diff --git a/debian/changelog b/debian/changelog index 9e7fae0a..77a933c1 100755 --- a/debian/changelog +++ b/debian/changelog @@ -1,10 +1,17 @@ +raft (0.9.1-2) unstable; urgency=medium + + [ Brian J. Murrell ] + * Package the static lib, not the shared lib + + -- Brian J. Murrell Thu, 19 Jan 2023 12:03:53 -0500 + raft (0.9.1-1) unstable; urgency=medium [ Li Wei ] * Fix membership changes * Fix node ID initialization - -- Li Wei Wed, Apr 06 2022 20:04:00 +0800 + -- Li Wei Wed, 06 Apr 2022 20:04:00 +0800 raft (0.9.0-1) unstable; urgency=medium @@ -12,7 +19,7 @@ raft (0.9.0-1) unstable; urgency=medium * Remove the upstream optimization that allows election-less leaders * Update packaging - -- Li Wei Wed, Jan 05 2022 14:51:00 +0800 + -- Li Wei Wed, 05 Jan 2022 14:51:00 +0800 raft (0.8.1-1) unstable; urgency=medium @@ -20,42 +27,42 @@ raft (0.8.1-1) unstable; urgency=medium * Optimize InstallSnapshot performance * Update packaging - -- Li Wei Mon, Aug 30 2021 17:47:00 +0800 + -- Li Wei Mon, 30 Aug 2021 17:47:00 +0800 raft (0.8.0-1) unstable; urgency=medium [ Li Wei ] * Add Pre-Vote - -- Li Wei Mon, May 31 2021 17:25:00 +0800 + -- Li Wei Mon, 31 May 2021 17:25:00 +0800 raft (0.7.3-1) unstable; urgency=medium [ Li Wei ] * Fix disruptions from removed replicas - -- Li Wei Wed, Feb 24 2021 11:53:00 +0800 + -- Li Wei Wed, 24 Feb 2021 11:53:00 +0800 raft (0.7.2-1) unstable; urgency=medium [ Kenneth Cain ] * Fix more Coverity issues in test_server - -- Kenneth Cain Tue, Feb 09 2021 15:20:00 +0800 + -- Kenneth Cain Tue, 09 Feb 2021 15:20:00 +0800 raft (0.7.1-1) unstable; urgency=medium [ Li Wei ] * Fix Coverity issues - -- Li Wei Wed, Dec 02 2020 11:30:00 +0800 + -- Li Wei Wed, 02 Dec 2020 11:30:00 +0800 raft (0.7.0-1) unstable; urgency=medium [ Li Wei ] * Use 63-bit log indices and terms - -- Li Wei Tue, Nov 10 2020 10:12:37 +0800 + -- Li Wei Tue, 10 Nov 2020 10:12:37 +0800 raft (0.6.0-1) unstable; urgency=medium diff --git a/debian/control b/debian/control index ed8c76a2..12066eb6 100644 --- a/debian/control +++ b/debian/control @@ -12,7 +12,6 @@ Package: libraft-dev Section: libdevel Architecture: any Multi-Arch: same -Depends: libraft0 (= ${binary:Version}), ${misc:Depends} Description: C implementation of the Raft consensus protocol Raft is a consensus algorithm that is designed to be easy to understand. It's equivalent to Paxos in fault-tolerance and performance. The difference @@ -21,15 +20,3 @@ Description: C implementation of the Raft consensus protocol . This package is needed to compile programs against raft. It contains the header files and links needed for compiling. - -Package: libraft0 -Architecture: any -Multi-Arch: same -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: C implementation of the Raft consensus protocol - Raft is a consensus algorithm that is designed to be easy to understand. - It's equivalent to Paxos in fault-tolerance and performance. The difference - is that it's decomposed into relatively independent subproblems, and it - cleanly addresses all major pieces needed for practical systems. - . - This package contains the shared libraries. diff --git a/debian/libraft-dev.dirs b/debian/libraft-dev.dirs index 44188162..c5566afe 100644 --- a/debian/libraft-dev.dirs +++ b/debian/libraft-dev.dirs @@ -1,2 +1,3 @@ usr/lib usr/include +lib/x86_64-linux-gnu diff --git a/debian/libraft-dev.install b/debian/libraft-dev.install index 41a14144..ecc3f0ed 100644 --- a/debian/libraft-dev.install +++ b/debian/libraft-dev.install @@ -1 +1,2 @@ usr/include/* +lib/x86_64-linux-gnu/libraft.a diff --git a/debian/libraft0.dirs b/debian/libraft0.dirs deleted file mode 100644 index 68457717..00000000 --- a/debian/libraft0.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/lib diff --git a/debian/libraft0.install b/debian/libraft0.install deleted file mode 100644 index 36662362..00000000 --- a/debian/libraft0.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/lib*.so diff --git a/debian/rules b/debian/rules index 7ac90707..86ebc5c5 100755 --- a/debian/rules +++ b/debian/rules @@ -16,7 +16,7 @@ name := raft prefix := /usr includedir := $(prefix)/include -libdir := $(prefix)/lib/$(DEB_BUILD_MULTIARCH) +libdir := /lib/$(DEB_BUILD_MULTIARCH) buildroot := debian/tmp install_includedir := $(buildroot)$(includedir) install_libdir := $(buildroot)$(libdir) @@ -26,9 +26,11 @@ install_libdir := $(buildroot)$(libdir) %: dh $@ +override_dh_auto_build: + dh_auto_build -- GCOV_CCFLAGS= static + override_dh_auto_install: mkdir -p $(install_libdir) mkdir -p $(install_includedir) - cp libraft.so $(install_libdir) + cp libraft.a $(install_libdir) cp include/* $(install_includedir) - diff --git a/packaging/Dockerfile.mockbuild b/packaging/Dockerfile.mockbuild index e51357c9..c8048190 100644 --- a/packaging/Dockerfile.mockbuild +++ b/packaging/Dockerfile.mockbuild @@ -34,18 +34,24 @@ RUN echo "$USER:$PASSWD" | chpasswd # add the user to the mock group so it can run mock RUN usermod -a -G mock $USER +ARG CB0 +RUN dnf -y upgrade && \ + dnf clean all + # Monkey-patch rpmlint until a new release is made with # https://github.com/rpm-software-management/rpmlint/pull/795 in it +# But make sure to patch after dnf upgrade so that an upgraded rpmlint +# RPM doesn't wipe out our patch COPY packaging/rpmlint--ignore-unused-rpmlintrc.patch . -RUN (cd $(python3 -c 'import site; print(site.getsitepackages()[-1])') && \ - patch -p1 && \ - rm -f rpmlint/__pycache__/{cli,lint}.*.pyc) < rpmlint--ignore-unused-rpmlintrc.patch && \ +RUN (cd $(python3 -c 'import site; print(site.getsitepackages()[-1])') && \ + if ! grep -e --ignore-unused-rpmlintrc rpmlint/cli.py; then \ + if ! patch -p1; then \ + exit 1; \ + fi; \ + rm -f rpmlint/__pycache__/{cli,lint}.*.pyc; \ + fi) < rpmlint--ignore-unused-rpmlintrc.patch; \ rm -f rpmlint--ignore-unused-rpmlintrc.patch -ARG CB0 -RUN dnf -y upgrade && \ - dnf clean all - # show the release that was built ARG CACHEBUST RUN cat /etc/os-release diff --git a/packaging/Dockerfile.ubuntu.20.04 b/packaging/Dockerfile.ubuntu.20.04 index cf49ac8a..c2b18285 100644 --- a/packaging/Dockerfile.ubuntu.20.04 +++ b/packaging/Dockerfile.ubuntu.20.04 @@ -7,33 +7,59 @@ FROM ubuntu:20.04 LABEL org.opencontainers.image.authors="daos@daos.groups.io" -# use same UID as host and default value of 1000 if not specified -ARG UID=1000 -ARG REPO_URL="" -ARG REPO_UBUNTU_20_04="" +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + curl gpg + +ARG REPO_FILE_URL +RUN if [ -n "$REPO_FILE_URL" ]; then \ + cd /etc/apt/sources.list.d && \ + curl -f -o daos_ci-ubuntu20.04-artifactory.list.tmp \ + "$REPO_FILE_URL"daos_ci-ubuntu20.04-artifactory.list && \ + true > ../sources.list && \ + mv daos_ci-ubuntu20.04-artifactory.list.tmp \ + daos_ci-ubuntu20.04-artifactory.list; \ + fi; \ + cd -; \ + curl -f -O "$REPO_FILE_URL"esad_repo.key; \ + gpg --no-default-keyring --keyring ./temp-keyring.gpg \ + --import esad_repo.key; \ + mkdir -p /usr/local/share/keyrings/; \ + gpg --no-default-keyring --keyring ./temp-keyring.gpg --export \ + --output /usr/local/share/keyrings/daos-stack-public.gpg; \ + rm ./temp-keyring.gpg; \ + url_prefix=https://downloads.linux.hpe.com/SDR/; \ + for url in hpPublicKey2048.pub \ + hpPublicKey2048_key1.pub \ + hpePublicKey2048_key1.pub; do \ + curl -f -O "$url_prefix$url"; \ + gpg --no-default-keyring --keyring ./temp-keyring.gpg \ + --import "$(basename $url)"; \ + done; \ + gpg --no-default-keyring --keyring ./temp-keyring.gpg --export \ + --output /usr/local/share/keyrings/hpe-sdr-public.gpg; \ + rm ./temp-keyring.gpg # Install basic tools RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ autoconf bash ca-certificates curl debhelper dh-make \ dpkg-dev dh-python doxygen gcc git git-buildpackage locales \ make patch pbuilder pkg-config python3-dev python3-distro \ - python3-distutils rpm scons wget cmake valgrind + python3-distutils rpm scons wget cmake valgrind rpmdevtools -# rpmdevtools -RUN echo "deb [trusted=yes] ${REPO_URL}${REPO_UBUNTU_20_04} focal main" > /etc/apt/sources.list.d/daos-stack-ubuntu-stable-local.list -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - rpmdevtools +# use same UID as host and default value of 1000 if not specified +ARG UID=1000 # Add build user (to keep chrootbuild happy) ENV USER build RUN useradd -u $UID -ms /bin/bash $USER # need to run the build command as root, as it needs to chroot -RUN if ! grep "^#includedir /etc/sudoers.d" /etc/sudoers; then \ - echo "#includedir /etc/sudoers.d" >> /etc/sudoers; \ - fi; \ - echo "Defaults env_keep += \"DPKG_GENSYMBOLS_CHECK_LEVEL\"" > /etc/sudoers.d/build; \ - echo "build ALL=(ALL) NOPASSWD: /usr/sbin/pbuilder" >> /etc/sudoers.d/build; \ - chmod 0440 /etc/sudoers.d/build; \ - visudo -c; \ +RUN if ! grep "^#includedir /etc/sudoers.d" /etc/sudoers; then \ + echo "#includedir /etc/sudoers.d" >> /etc/sudoers; \ + fi; \ + echo "Defaults env_keep += \"DPKG_GENSYMBOLS_CHECK_LEVEL\"" > /etc/sudoers.d/build; \ + echo "build ALL=(ALL) NOPASSWD: /usr/bin/tee /root/.pbuilderrc" >> /etc/sudoers.d/build; \ + echo "build ALL=(ALL) NOPASSWD: /usr/sbin/pbuilder" >> /etc/sudoers.d/build; \ + chmod 0440 /etc/sudoers.d/build; \ + visudo -c; \ sudo -l -U build diff --git a/packaging/Makefile_packaging.mk b/packaging/Makefile_packaging.mk index 8e3e8d6e..23a49b79 100644 --- a/packaging/Makefile_packaging.mk +++ b/packaging/Makefile_packaging.mk @@ -317,20 +317,6 @@ patch: echo "PKG_GIT_COMMIT is not defined" endif -# *_LOCAL_* repos are locally built packages. -ifeq ($(LOCAL_REPOS),true) - ifneq ($(ARTIFACTORY_URL),) - ifneq ($(DAOS_STACK_$(DISTRO_BASE)_LOCAL_REPO),) - DISTRO_REPOS = disabled # any non-empty value here works and is not used beyond testing if the value is empty or not - # convert to artifactory url - DAOS_STACK_$(DISTRO_BASE)_LOCAL_REPO := $(subst reposi,artifac,$(DAOS_STACK_$(DISTRO_BASE)_LOCAL_REPO)) - # $(DISTRO_BASE)_LOCAL_REPOS is a list separated by | because you cannot pass lists - # of values with spaces as environment variables - $(DISTRO_BASE)_LOCAL_REPOS := [trusted=yes] $(ARTIFACTORY_URL)$(subst stack,stack-daos,$(DAOS_STACK_$(DISTRO_BASE)_LOCAL_REPO)) - $(DISTRO_BASE)_LOCAL_REPOS += |[trusted=yes] $(ARTIFACTORY_URL)$(subst stack,stack-deps,$(DAOS_STACK_$(DISTRO_BASE)_LOCAL_REPO)) - endif #ifneq ($(DAOS_STACK_$(DISTRO_BASE)_LOCAL_REPO),) - endif # ifneq ($(ARTIFACTORY_URL),) -endif # ifeq ($(LOCAL_REPOS),true) ifeq ($(ID_LIKE),debian) chrootbuild: $(DEB_TOP)/$(DEB_DSC) $(call distro_map) \ @@ -346,6 +332,8 @@ chrootbuild: $(DEB_TOP)/$(DEB_DSC) DEB_TOP="$(DEB_TOP)" \ DEB_DSC="$(DEB_DSC)" \ DISTRO_ID_OPT="$(DISTRO_ID_OPT)" \ + LOCAL_REPOS='$(LOCAL_REPOS)' \ + ARTIFACTORY_URL="$(ARTIFACTORY_URL)" \ packaging/debian_chrootbuild else chrootbuild: $(SRPM) $(CALLING_MAKEFILE) @@ -360,7 +348,7 @@ chrootbuild: $(SRPM) $(CALLING_MAKEFILE) REPO_FILE_URL="$(REPO_FILE_URL)" \ MOCK_OPTIONS="$(MOCK_OPTIONS)" \ RPM_BUILD_OPTIONS='$(RPM_BUILD_OPTIONS)' \ - DISTRO_REPOS='$(DISTRO_REPOS)' \ + LOCAL_REPOS='$(LOCAL_REPOS)' \ ARTIFACTORY_URL="$(ARTIFACTORY_URL)" \ DISTRO_VERSION="$(DISTRO_VERSION)" \ TARGET="$<" \ diff --git a/packaging/debian_chrootbuild b/packaging/debian_chrootbuild index ba821419..03b232a0 100755 --- a/packaging/debian_chrootbuild +++ b/packaging/debian_chrootbuild @@ -2,14 +2,13 @@ set -uex -# shellcheck disable=SC2153 -IFS=\| read -r -a distro_base_local_repos <<< "$DISTRO_BASE_LOCAL_REPOS" +if [ -n "${ARTIFACTORY_URL:-}" ] && "$LOCAL_REPOS"; then + echo "MIRRORSITE=${ARTIFACTORY_URL}artifactory/ubuntu-proxy" | sudo tee /root/.pbuilderrc +fi # shellcheck disable=SC2086 -sudo pbuilder create \ - --extrapackages "gnupg ca-certificates" \ - --othermirror \ - "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $VERSION_CODENAME universe|deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ $VERSION_CODENAME-updates main universe" \ +sudo pbuilder create \ + --extrapackages "gnupg ca-certificates" \ $DISTRO_ID_OPT repo_args="" @@ -26,13 +25,18 @@ for repo in $DISTRO_BASE_PR_REPOS $PR_REPOS; do fi repo_args="$repo_args|deb [trusted=yes] ${JENKINS_URL:-https://build.hpdd.intel.com/}job/daos-stack/job/$repo/job/$branch/$build_number/artifact/artifacts/$DISTRO/ ./" done -for repo in $JOB_REPOS "${distro_base_local_repos[@]}"; do - repo_args="$repo_args|deb ${repo} $VERSION_CODENAME main" + +repo_args+="|$(curl -sSf "$REPO_FILE_URL"daos_ci-"$DISTRO"-artifactory.list | + sed -e 's/#.*//' -e '/ubuntu-proxy/d' -e '/^$/d' -e '/^$/d' \ + -e 's/signed-by=.*\.gpg/trusted=yes/' | + sed -e ':a; N; $!ba; s/\n/|/g')" +for repo in $JOB_REPOS; do + repo_args+="|deb ${repo} $VERSION_CODENAME main" done # NB: This PPA is needed to support modern go toolchains on ubuntu 20.04. # After the build is updated to use 22.04, which supports go >= 1.18, it # should no longer be needed. -repo_args="$repo_args|deb [trusted=yes] https://ppa.launchpadcontent.net/longsleep/golang-backports/ubuntu focal main" +repo_args="$repo_args|deb [trusted=yes] https://ppa.launchpadcontent.net/longsleep/golang-backports/ubuntu $VERSION_CODENAME main" echo "$repo_args" if [ "$repo_args" = "|" ]; then repo_args="" diff --git a/packaging/rpm_chrootbuild b/packaging/rpm_chrootbuild index 2effdbba..fb6aa004 100755 --- a/packaging/rpm_chrootbuild +++ b/packaging/rpm_chrootbuild @@ -39,8 +39,7 @@ repo_dels=() echo -e "config_opts['yum.conf'] += \"\"\"\n" >> "$cfg_file" -if [ -n "${ARTIFACTORY_URL:-}" ] && - [ -n "$DISTRO_REPOS" ]; then +if [ -n "${ARTIFACTORY_URL:-}" ] && "$LOCAL_REPOS"; then repo_dels+=("--disablerepo=\*") if [ -n "${REPO_FILE_URL:-}" ]; then