From 237749ee774d162ee87411aab57fa34a54881115 Mon Sep 17 00:00:00 2001 From: "Brian J. Murrell" Date: Thu, 8 Oct 2020 20:34:51 -0400 Subject: [PATCH] Update to build with libdaos 1.2.0 Signed-off-by: Brian J. Murrell --- hdf5.spec | 7 +- packaging/Dockerfile.centos.7 | 4 +- packaging/Dockerfile.mockbuild | 4 +- packaging/Dockerfile.ubuntu.18.04 | 29 ---- packaging/Dockerfile.ubuntu.20.04 | 39 +++++ packaging/Makefile_distro_vars.mk | 27 ++-- packaging/Makefile_packaging.mk | 237 ++++++++++++++---------------- packaging/debian_chrootbuild | 43 ++++++ packaging/rpm_chrootbuild | 40 +++++ 9 files changed, 259 insertions(+), 171 deletions(-) delete mode 100644 packaging/Dockerfile.ubuntu.18.04 create mode 100644 packaging/Dockerfile.ubuntu.20.04 create mode 100755 packaging/debian_chrootbuild create mode 100755 packaging/rpm_chrootbuild diff --git a/hdf5.spec b/hdf5.spec index a46ba1e..8b69900 100644 --- a/hdf5.spec +++ b/hdf5.spec @@ -1,7 +1,7 @@ %global macrosdir %(d=%{_rpmconfigdir}/macros.d; [ -d $d ] || d=%{_sysconfdir}/rpm; echo $d) %{!?_fmoddir:%global _fmoddir %{_libdir}/gfortran/modules} -%global daos_major 0 +%global daos_major 1 # Patch version? %global snaprel %{nil} @@ -13,7 +13,7 @@ # You need to recompile all users of HDF5 for each version change Name: hdf5 Version: %{major}.%{minor} -Release: 4%{?dist} +Release: 5%{?dist} Summary: A general purpose library and file format for storing scientific data License: BSD URL: https://portal.hdfgroup.org/display/HDF5/HDF5 @@ -607,6 +607,9 @@ done %endif %changelog +* Thu Oct 08 2020 Maureen Jean - 1.12.0-5 +- Rebuild for libdaos 1.2.0 + * Mon Aug 24 2020 Maureen Jean - 1.12.0-4 - Fix SLES15 mpi include and lib paths diff --git a/packaging/Dockerfile.centos.7 b/packaging/Dockerfile.centos.7 index 70ba804..2514d84 100644 --- a/packaging/Dockerfile.centos.7 +++ b/packaging/Dockerfile.centos.7 @@ -1,5 +1,5 @@ # -# Copyright 2018-2019, Intel Corporation +# Copyright 2018-2020, Intel Corporation # # 'recipe' for Docker to build an RPM # @@ -28,7 +28,7 @@ RUN echo "$USER:$PASSWD" | chpasswd RUN usermod -a -G mock $USER # mock in Docker needs to use the old-chroot option -RUN grep use_nspawn || \ +RUN grep use_nspawn /etc/mock/site-defaults.cfg || \ echo "config_opts['use_nspawn'] = False" >> /etc/mock/site-defaults.cfg RUN chmod g+w /etc/mock/default.cfg diff --git a/packaging/Dockerfile.mockbuild b/packaging/Dockerfile.mockbuild index 9e239e4..a55b2be 100644 --- a/packaging/Dockerfile.mockbuild +++ b/packaging/Dockerfile.mockbuild @@ -1,5 +1,5 @@ # -# Copyright 2018-2019, Intel Corporation +# Copyright 2018-2020, Intel Corporation # # 'recipe' for Docker to build an RPM # @@ -25,7 +25,7 @@ RUN echo "$USER:$PASSWD" | chpasswd RUN usermod -a -G mock $USER # mock in Docker needs to use the old-chroot option -RUN grep use_nspawn || \ +RUN grep use_nspawn /etc/mock/site-defaults.cfg || \ echo "config_opts['use_nspawn'] = False" >> /etc/mock/site-defaults.cfg RUN chmod g+w /etc/mock/* diff --git a/packaging/Dockerfile.ubuntu.18.04 b/packaging/Dockerfile.ubuntu.18.04 deleted file mode 100644 index 2180c9a..0000000 --- a/packaging/Dockerfile.ubuntu.18.04 +++ /dev/null @@ -1,29 +0,0 @@ -# -# Copyright 2019, Intel Corporation -# -# 'recipe' for Docker to build an Debian package -# -# Pull base image -FROM ubuntu:18.04 -Maintainer daos-stack - -# use same UID as host and default value of 1000 if not specified -ARG UID=1000 - -# Install basic tools -RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ - autoconf bash curl debhelper dh-make dpkg-dev doxygen gcc \ - git git-buildpackage locales make patch pbuilder rpm wget - -# 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 "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/Dockerfile.ubuntu.20.04 b/packaging/Dockerfile.ubuntu.20.04 new file mode 100644 index 0000000..cf16bce --- /dev/null +++ b/packaging/Dockerfile.ubuntu.20.04 @@ -0,0 +1,39 @@ +# +# Copyright 2019-2020, Intel Corporation +# +# 'recipe' for Docker to build an Debian package +# +# Pull base image +FROM ubuntu:20.04 +MAINTAINER daos-stack + +# use same UID as host and default value of 1000 if not specified +ARG UID=1000 +ARG REPO_URL="" +ARG REPO_UBUNTU_20_04="" + +# Install basic tools +RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ + autoconf bash curl debhelper dh-make dpkg-dev doxygen gcc \ + git git-buildpackage locales make patch pbuilder rpm wget \ + ca-certificates scons python3-distutils pkg-config \ + python3-dev python3-distro + +# 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 + +# 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; \ + sudo -l -U build diff --git a/packaging/Makefile_distro_vars.mk b/packaging/Makefile_distro_vars.mk index c2fc9e2..c126c81 100644 --- a/packaging/Makefile_distro_vars.mk +++ b/packaging/Makefile_distro_vars.mk @@ -1,20 +1,25 @@ +DOT := . + +DOCKER := docker + # Find out what we are -ID_LIKE := $(shell . /etc/os-release; echo $$ID_LIKE) +ID_LIKE := $(shell . /etc/os-release; echo $$ID_LIKE) # Of course that does not work for SLES-12 -ID := $(shell . /etc/os-release; echo $$ID) -VERSION_ID := $(shell . /etc/os-release; echo $$VERSION_ID) +ID := $(shell . /etc/os-release; echo $$ID) +VERSION_ID := $(shell . /etc/os-release; echo $$VERSION_ID) +VERSION_CODENAME := $(shell . /etc/os-release; echo $$VERSION_CODENAME) + ifeq ($(ID_LIKE),debian) -UBUNTU_VERS := $(shell . /etc/os-release; echo $$VERSION) -ifeq ($(VERSION_ID),19.04) -# Bug - distribution is set to "devel" -DISTRO_ID_OPT = --distribution disco -endif -DISTRO_ID := ubuntu$(VERSION_ID) -DISTRO_BASE = $(basename UBUNTU_$(VERSION_ID)) +SPECTOOL := spectool +UBUNTU_VERS := $(shell . /etc/os-release; echo $$VERSION) +DISTRO_ID_OPT := --distribution $(VERSION_CODENAME) +DISTRO_ID := ubuntu$(VERSION_ID) VERSION_ID_STR := $(subst $(DOT),_,$(VERSION_ID)) +DISTRO_BASE := UBUNTU_$(VERSION_ID_STR) endif ifeq ($(ID),fedora) -SPECTOOL := spectool +DOCKER := podman +SPECTOOL := spectool # a Fedora-based mock builder # derive the the values of: # VERSION_ID (i.e. 7) diff --git a/packaging/Makefile_packaging.mk b/packaging/Makefile_packaging.mk index 6dd86b3..0dee0b3 100644 --- a/packaging/Makefile_packaging.mk +++ b/packaging/Makefile_packaging.mk @@ -3,6 +3,9 @@ # NAME := # SRC_EXT := +# force bash (looking at you Ubuntu) +SHELL=/bin/bash + # Put site overrides (i.e. REPOSITORY_URL, DAOS_STACK_*_LOCAL_REPO) in here -include Makefile.local @@ -16,36 +19,46 @@ endif CALLING_MAKEFILE := $(word 1, $(MAKEFILE_LIST)) +TOPDIR ?= $(CURDIR) +BUILD_PREFIX ?= . + DOT := . RPM_BUILD_OPTIONS += $(EXTERNAL_RPM_BUILD_OPTIONS) # some defaults the caller can override -BUILD_OS ?= leap.15 PACKAGING_CHECK_DIR ?= ../packaging LOCAL_REPOS ?= true TEST_PACKAGES ?= ${NAME} -PR_REPOS := $(shell git show -s --format=%B | sed -ne 's/^PR-repos: *\(.*\)/\1/p') -LEAP_15_PR_REPOS := $(shell git show -s --format=%B | sed -ne 's/^PR-repos-leap15: *\(.*\)/\1/p') -EL_7_PR_REPOS := $(shell git show -s --format=%B | sed -ne 's/^PR-repos-el7: *\(.*\)/\1/p') -COMMON_RPM_ARGS := --define "%_topdir $$PWD/_topdir" $(BUILD_DEFINES) +# unfortunately we cannot always name the repo the same as the project +REPO_NAME ?= $(NAME) + +PR_REPOS ?= $(shell git show -s --format=%B | sed -ne 's/^PR-repos: *\(.*\)/\1/p') +LEAP_15_PR_REPOS ?= $(shell git show -s --format=%B | sed -ne 's/^PR-repos-leap15: *\(.*\)/\1/p') +EL_7_PR_REPOS ?= $(shell git show -s --format=%B | sed -ne 's/^PR-repos-el7: *\(.*\)/\1/p') +UBUNTU_20_04_PR_REPOS ?= $(shell git show -s --format=%B | sed -ne 's/^PR-repos-ubuntu20: *\(.*\)/\1/p') + +COMMON_RPM_ARGS := --define "_topdir $$PWD/_topdir" $(BUILD_DEFINES) SPEC := $(shell if [ -f $(NAME)-$(DISTRO_BASE).spec ]; then echo $(NAME)-$(DISTRO_BASE).spec; else echo $(NAME).spec; fi) VERSION = $(eval VERSION := $(shell rpm $(COMMON_RPM_ARGS) --specfile --qf '%{version}\n' $(SPEC) | sed -n '1p'))$(VERSION) -DEB_VERS := $(subst rc,~rc,$(VERSION)) -DEB_RVERS := $(subst $(DOT),\$(DOT),$(DEB_VERS)) -DEB_BVERS := $(basename $(subst ~rc,$(DOT)rc,$(DEB_VERS))) +DEB_RVERS := $(subst $(DOT),\$(DOT),$(VERSION)) +DEB_BVERS := $(basename $(subst ~rc,$(DOT)rc,$(VERSION))) RELEASE = $(eval RELEASE := $(shell rpm $(COMMON_RPM_ARGS) --specfile --qf '%{release}\n' $(SPEC) | sed -n '$(SED_EXPR)'))$(RELEASE) SRPM = _topdir/SRPMS/$(NAME)-$(VERSION)-$(RELEASE)$(DIST).src.rpm RPMS = $(eval RPMS := $(addsuffix .rpm,$(addprefix _topdir/RPMS/x86_64/,$(shell rpm --specfile $(SPEC)))))$(RPMS) DEB_TOP := _topdir/BUILD -DEB_BUILD := $(DEB_TOP)/$(NAME)-$(DEB_VERS) -DEB_TARBASE := $(DEB_TOP)/$(DEB_NAME)_$(DEB_VERS) -SOURCE ?= $(eval SOURCE := $(shell CHROOT_NAME=$(CHROOT_NAME) $(SPECTOOL) -S -l $(SPEC) | sed -e 2,\$$d -e 's/\\\#/\\\\\#/g' -e 's/.*: *//'))$(SOURCE) -PATCHES ?= $(eval PATCHES := $(shell CHROOT_NAME=$(CHROOT_NAME) $(SPECTOOL) -l $(SPEC) | sed -e 1d -e 's/.*: *//' -e 's/.*\///'))$(PATCHES) -SOURCES := $(addprefix _topdir/SOURCES/,$(notdir $(SOURCE)) $(PATCHES)) +DEB_BUILD := $(DEB_TOP)/$(NAME)-$(VERSION) +DEB_TARBASE := $(DEB_TOP)/$(DEB_NAME)_$(VERSION) +SOURCE ?= $(eval SOURCE := $(shell CHROOT_NAME=$(CHROOT_NAME) $(SPECTOOL) $(COMMON_RPM_ARGS) -S -l $(SPEC) | sed -e 2,\$$d -e 's/\\\#/\\\\\#/g' -e 's/.*: *//'))$(SOURCE) +PATCHES ?= $(eval PATCHES := $(shell CHROOT_NAME=$(CHROOT_NAME) $(SPECTOOL) $(COMMON_RPM_ARGS) -l $(SPEC) | sed -ne 1d -e 's/.*: *//' -e 's/.*\///' -e '/\.patch/p'))$(PATCHES) +OTHER_SOURCES := $(eval OTHER_SOURCES := $(shell CHROOT_NAME=$(CHROOT_NAME) $(SPECTOOL) $(COMMON_RPM_ARGS) -l $(SPEC) | sed -ne 1d -e 's/.*: *//' -e 's/.*\///' -e '/\.patch/d' -e p))$(OTHER_SOURCES) +SOURCES := $(addprefix _topdir/SOURCES/,$(notdir $(SOURCE)) $(PATCHES) $(OTHER_SOURCES)) ifeq ($(ID_LIKE),debian) -DEBS := $(addsuffix _$(DEB_VERS)-1_amd64.deb,$(shell sed -n '/-udeb/b; s,^Package:[[:blank:]],$(DEB_TOP)/,p' debian/control)) -DEB_PREV_RELEASE := $(shell dpkg-parsechangelog -S version) +DEBS := $(addsuffix _$(VERSION)-1_amd64.deb,$(shell sed -n '/-udeb/b; s,^Package:[[:blank:]],$(DEB_TOP)/,p' $(TOPDIR)/debian/control)) +DEB_PREV_RELEASE := $(shell cd $(TOPDIR) && dpkg-parsechangelog -S version) +ifneq ($(GIT_SHORT),) +GIT_INFO ?= .$(GIT_NUM_COMMITS).g$(GIT_SHORT) +endif DEB_DSC := $(DEB_NAME)_$(DEB_PREV_RELEASE)$(GIT_INFO).dsc TARGETS := $(DEBS) else @@ -53,24 +66,28 @@ TARGETS := $(RPMS) $(SRPM) endif define distro_map - case $(DISTRO_ID) in \ - el7) distro="centos7" \ - ;; \ - el8) distro="centos8" \ - ;; \ - sle12.3) distro="sles12.3" \ - ;; \ - sl42.3) distro="leap42.3" \ - ;; \ - sl15.*) distro="leap15" \ - ;; \ - esac; + case $(DISTRO_ID) in \ + el7) distro="centos7" \ + ;; \ + el8) distro="centos8" \ + ;; \ + sle12.3) distro="sles12.3" \ + ;; \ + sl42.3) distro="leap42.3" \ + ;; \ + sl15.*) distro="leap15" \ + ;; \ + ubuntu*) distro="$(DISTRO_ID)" \ + ;; \ + esac; endef define install_repos - for baseurl in $($(DISTRO_BASE)_LOCAL_REPOS); do \ + IFS='|' read -ra BASES <<< "$($(DISTRO_BASE)_LOCAL_REPOS)"; \ + for baseurl in "$${BASES[@]}"; do \ + baseurl="$${baseurl# *}"; \ $(call install_repo,$$baseurl); \ - done + done for repo in $($(DISTRO_BASE)_PR_REPOS) \ $(PR_REPOS) $(1); do \ branch="master"; \ @@ -120,23 +137,23 @@ ifeq ($(DL_NAME),) DL_NAME = $(NAME) endif -$(DL_NAME)-$(DL_VERSION).tar.$(SRC_EXT).asc: +$(DL_NAME)-$(DL_VERSION).tar.$(SRC_EXT).asc: $(SPEC) $(CALLING_MAKEFILE) rm -f ./$(DL_NAME)-*.tar.{gz,bz*,xz}.asc curl -f -L -O '$(SOURCE).asc' -$(DL_NAME)-$(DL_VERSION).tar.$(SRC_EXT).sig: +$(DL_NAME)-$(DL_VERSION).tar.$(SRC_EXT).sig: $(SPEC) $(CALLING_MAKEFILE) rm -f ./$(DL_NAME)-*.tar.{gz,bz*,xz}.sig curl -f -L -O '$(SOURCE).sig' -$(DL_NAME)-$(DL_VERSION).tar.$(SRC_EXT): +$(DL_NAME)-$(DL_VERSION).tar.$(SRC_EXT): $(SPEC) $(CALLING_MAKEFILE) rm -f ./$(DL_NAME)-*.tar.{gz,bz*,xz} curl -f -L -O '$(SOURCE)' -v$(DL_VERSION).tar.$(SRC_EXT): +v$(DL_VERSION).tar.$(SRC_EXT): $(SPEC) $(CALLING_MAKEFILE) rm -f ./v*.tar.{gz,bz*,xz} curl -f -L -O '$(SOURCE)' -$(DL_VERSION).tar.$(SRC_EXT): +$(DL_VERSION).tar.$(SRC_EXT): $(SPEC) $(CALLING_MAKEFILE) rm -f ./*.tar.{gz,bz*,xz} curl -f -L -O '$(SOURCE)' @@ -147,7 +164,7 @@ $(DEB_BUILD)/%: % | $(DEB_BUILD)/ $(DEB_BUILD).tar.$(SRC_EXT): $(notdir $(SOURCE)) | $(DEB_TOP)/ ln -f $< $@ -$(DEB_TARBASE).orig.tar.$(SRC_EXT) : $(DEB_BUILD).tar.$(SRC_EXT) +$(DEB_TARBASE).orig.tar.$(SRC_EXT): $(DEB_BUILD).tar.$(SRC_EXT) rm -f $(DEB_TOP)/*.orig.tar.* ln -f $< $@ @@ -190,19 +207,20 @@ $(DEB_TOP)/.patched: $(PATCHES) check-env deb_detar | \ # Move the debian files into the Debian directory. ifeq ($(ID_LIKE),debian) -$(DEB_TOP)/.deb_files : $(shell find debian -type f) deb_detar | \ +$(DEB_TOP)/.deb_files: $(shell find $(TOPDIR)/debian -type f) deb_detar | \ $(DEB_BUILD)/debian/ - find debian -maxdepth 1 -type f -exec cp '{}' '$(DEB_BUILD)/{}' ';' - if [ -e debian/source ]; then \ - cp -r debian/source $(DEB_BUILD)/debian; fi - if [ -e debian/local ]; then \ - cp -r debian/local $(DEB_BUILD)/debian; fi - if [ -e debian/examples ]; then \ - cp -r debian/examples $(DEB_BUILD)/debian; fi - if [ -e debian/upstream ]; then \ - cp -r debian/upstream $(DEB_BUILD)/debian; fi - if [ -e debian/tests ]; then \ - cp -r debian/tests $(DEB_BUILD)/debian; fi + cd $(TOPDIR)/ && \ + find debian -maxdepth 1 -type f -exec cp '{}' '$(BUILD_PREFIX)/$(DEB_BUILD)/{}' ';' + if [ -e $(TOPDIR)/debian/source ]; then \ + cp -r $(TOPDIR)/debian/source $(DEB_BUILD)/debian; fi + if [ -e $(TOPDIR)/debian/local ]; then \ + cp -r $(TOPDIR)/debian/local $(DEB_BUILD)/debian; fi + if [ -e $(TOPDIR)/debian/examples ]; then \ + cp -r $(TOPDIR)/debian/examples $(DEB_BUILD)/debian; fi + if [ -e $(TOPDIR)/debian/upstream ]; then \ + cp -r $(TOPDIR)/debian/upstream $(DEB_BUILD)/debian; fi + if [ -e $(TOPDIR)/debian/tests ]; then \ + cp -r $(TOPDIR)/debian/tests $(DEB_BUILD)/debian; fi rm -f $(DEB_BUILD)/debian/*.ex $(DEB_BUILD)/debian/*.EX rm -f $(DEB_BUILD)/debian/*.orig ifneq ($(GIT_INFO),) @@ -229,7 +247,7 @@ $(subst deb,%,$(DEBS)): $(DEB_BUILD).tar.$(SRC_EXT) \ cd $(DEB_BUILD); debuild -- clean git status rm -rf $(DEB_TOP)/$(NAME)-tmp - lfile1=$(shell echo $(DEB_TOP)/$(NAME)[0-9]*_$(DEB_VERS)-1_amd64.deb);\ + lfile1=$(shell echo $(DEB_TOP)/$(NAME)[0-9]*_$(VERSION)-1_amd64.deb);\ lfile=$$(ls $${lfile1}); \ lfile2=$${lfile##*/}; lname=$${lfile2%%_*}; \ dpkg-deb -R $${lfile} \ @@ -270,95 +288,58 @@ ls: $(TARGETS) # *_LOCAL_* repos are locally built packages. # *_GROUP_* repos are a local mirror of a group of upstream repos. # *_GROUP_* repos may not supply a repomd.xml.key. +ifeq ($(LOCAL_REPOS),true) ifneq ($(REPOSITORY_URL),) ifneq ($(DAOS_STACK_$(DISTRO_BASE)_LOCAL_REPO),) -$(DISTRO_BASE)_LOCAL_REPOS := $(REPOSITORY_URL)$(DAOS_STACK_$(DISTRO_BASE)_LOCAL_REPO)/ -endif -ifneq ($(DAOS_STACK_$(DISTRO_BASE)_GROUP_REPO),) -$(DISTRO_BASE)_LOCAL_REPOS += $(REPOSITORY_URL)$(DAOS_STACK_$(DISTRO_BASE)_GROUP_REPO)/ -endif -endif - ifeq ($(ID_LIKE),debian) -ifneq ($(DAOS_STACK_REPO_SUPPORT),) -TEST_STR := $(DAOS_STACK_REPO_UBUNTU_$(VERSION_ID_STR)_LIST) -ifneq ($(TEST_STR),) -UBUNTU_REPOS := $(shell curl $(DAOS_STACK_REPO_SUPPORT)$(TEST_STR)) -# Additional repos can be added but must be separated by a | character. -UBUNTU_ADD_REPOS = --othermirror "$(UBUNTU_REPOS)" -else -ifneq ($(DAOS_STACK_REPO_UBUNTU_ROLLING_LIST),) -UBUNTU_REPOS := $(shell curl $(DAOS_STACK_REPO_SUPPORT)$(DAOS_STACK_REPO_UBUNTU_ROLLING_LIST)) -# Additional repos can be added but must be separated by a | character. -UBUNTU_ADD_REPOS = --othermirror "$(UBUNTU_REPOS)" +# $(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] endif +$(DISTRO_BASE)_LOCAL_REPOS := $($(DISTRO_BASE)_LOCAL_REPOS) $(REPOSITORY_URL)$(DAOS_STACK_$(DISTRO_BASE)_LOCAL_REPO)/ endif -# Need to figure out how to support multiple keys, such as for IPMCTL -ifneq ($(DAOS_STACK_REPO_PUB_KEY),) -HAVE_DAOS_STACK_KEY := TRUE - -$(DAOS_STACK_REPO_PUB_KEY): - curl -f -L -O '$(DAOS_STACK_REPO_SUPPORT)$(DAOS_STACK_REPO_PUB_KEY)' +$(DISTRO_BASE)_LOCAL_REPOS := $($(DISTRO_BASE)_LOCAL_REPOS)| +ifneq ($(DAOS_STACK_$(DISTRO_BASE)_GROUP_REPO),) +$(DISTRO_BASE)_LOCAL_REPOS := $($(DISTRO_BASE)_LOCAL_REPOS)$(REPOSITORY_URL)$(DAOS_STACK_$(DISTRO_BASE)_GROUP_REPO)/| endif endif - -chrootbuild: $(DEB_TOP)/$(DEB_DSC) $(DAOS_STACK_REPO_PUB_KEY) - sudo pbuilder create \ - --extrapackages "gnupg ca-certificates" $(DISTRO_ID_OPT) -ifneq ($(HAVE_DAOS_STACK_KEY),) - printf "apt-key add - <> /etc/mock/$(CHROOT_NAME).cfg; \ - $(call distro_map) \ - for repo in $($(DISTRO_BASE)_PR_REPOS) $(PR_REPOS); do \ - branch="master"; \ - build_number="lastSuccessfulBuild"; \ - if [[ $$repo = *@* ]]; then \ - branch="$${repo#*@}"; \ - repo="$${repo%@*}"; \ - if [[ $$branch = *:* ]]; then \ - build_number="$${branch#*:}"; \ - branch="$${branch%:*}"; \ - fi; \ - fi; \ - echo -e "[$$repo:$$branch:$$build_number]\n\ -name=$$repo:$$branch:$$build_number\n\ -baseurl=$${JENKINS_URL:-https://build.hpdd.intel.com/}job/daos-stack/job/$$repo/job/$$branch/$$build_number/artifact/artifacts/$$distro/\n\ -enabled=1\n\ -gpgcheck=False\n" >> /etc/mock/$(CHROOT_NAME).cfg; \ - done; \ - if ! $(LOCAL_REPOS); then \ - LOCAL_REPOS=""; \ - else \ - LOCAL_REPOS="$($(DISTRO_BASE)_LOCAL_REPOS)"; \ - fi; \ - for repo in $(JOB_REPOS) $$LOCAL_REPOS $($(DISTRO_BASE)_REPOS); do \ - repo_name=$${repo##*://}; \ - repo_name=$${repo_name//\//_}; \ - echo -e "[$${repo_name//@/_}]\n\ -name=$${repo_name}\n\ -baseurl=$${repo}\n\ -enabled=1\n" >> /etc/mock/$(CHROOT_NAME).cfg; \ - done; \ - echo "\"\"\"" >> /etc/mock/$(CHROOT_NAME).cfg; \ - else \ - echo "Unable to update /etc/mock/$(CHROOT_NAME).cfg."; \ - echo "You need to make sure it has the needed repos in it yourself."; \ - fi - mock -r $(CHROOT_NAME) $(MOCK_OPTIONS) $(RPM_BUILD_OPTIONS) $< + $(call distro_map) \ + DISTRO="$$distro" \ + CHROOT_NAME="$(CHROOT_NAME)" \ + PR_REPOS="$(PR_REPOS)" \ + DISTRO_BASE_PR_REPOS="$($(DISTRO_BASE)_PR_REPOS)" \ + JENKINS_URL="$${JENKINS_URL}" \ + JOB_REPOS="$(JOB_REPOS)" \ + DISTRO_BASE_LOCAL_REPOS="$($(DISTRO_BASE)_LOCAL_REPOS)" \ + MOCK_OPTIONS="$(MOCK_OPTIONS)" \ + RPM_BUILD_OPTIONS='$(RPM_BUILD_OPTIONS)' \ + TARGET="$<" \ + packaging/rpm_chrootbuild endif docker_chrootbuild: - docker build --build-arg UID=$$(id -u) -t $(BUILD_OS)-chrootbuild \ - -f packaging/Dockerfile.$(BUILD_OS) . - docker run --privileged=true -w $$PWD -v=$$PWD:$$PWD \ - -it $(BUILD_OS)-chrootbuild bash -c "make chrootbuild" + $(DOCKER) build --build-arg UID=$$(id -u) -t chrootbuild \ + -f packaging/Dockerfile.mockbuild . + $(DOCKER) run --privileged=true -w $(TOPDIR) -v=$(TOPDIR):$(TOPDIR) \ + -it chrootbuild bash -c "make -C $(CURDIR) \ + CHROOT_NAME=$(CHROOT_NAME) chrootbuild" rpmlint: $(SPEC) rpmlint $< @@ -394,7 +375,7 @@ endif test: # Test the rpmbuild by installing the built RPM - $(call install_repos,$(NAME)@$(BRANCH_NAME):$(BUILD_NUMBER)) + $(call install_repos,$(REPO_NAME)@$(BRANCH_NAME):$(BUILD_NUMBER)) yum -y install $(TEST_PACKAGES) show_version: @@ -409,9 +390,15 @@ show_rpms: show_source: @echo $(SOURCE) +show_patches: + @echo $(PATCHES) + show_sources: @echo $(SOURCES) +show_other_sources: + @echo $(OTHER_SOURCES) + show_targets: @echo $(TARGETS) diff --git a/packaging/debian_chrootbuild b/packaging/debian_chrootbuild new file mode 100755 index 0000000..5ea4ead --- /dev/null +++ b/packaging/debian_chrootbuild @@ -0,0 +1,43 @@ +#!/bin/bash + +set -uex + +# shellcheck disable=SC2153 +IFS=\| read -r -a distro_base_local_repos <<< "$DISTRO_BASE_LOCAL_REPOS" + +# 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" \ + $DISTRO_ID_OPT + +repo_args="" +for repo in $DISTRO_BASE_PR_REPOS $PR_REPOS; do + branch="master" + build_number="lastSuccessfulBuild" + if [[ $repo = *@* ]]; then + branch="${repo#*@}" + repo="${repo%@*}" + if [[ $branch = *:* ]]; then + build_number="${branch#*:}" + branch="${branch%:*}" + fi + 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" +done +echo "$repo_args" +if [ "$repo_args" = "|" ]; then + repo_args="" +else + #repo_args="--othermirror"${repo_args#|}\"" + repo_args="${repo_args#|}" +fi +cd "$DEB_TOP" +# shellcheck disable=SC2086 +sudo pbuilder update --override-config $DISTRO_ID_OPT ${repo_args:+--othermirror "$repo_args"} +# fail the build if the *.symbols file(s) need updating +sudo DPKG_GENSYMBOLS_CHECK_LEVEL="${DPKG_GENSYMBOLS_CHECK_LEVEL:-4}" pbuilder build "$DEB_DSC" diff --git a/packaging/rpm_chrootbuild b/packaging/rpm_chrootbuild new file mode 100755 index 0000000..321d22f --- /dev/null +++ b/packaging/rpm_chrootbuild @@ -0,0 +1,40 @@ +#!/bin/bash + +set -uex + +# shellcheck disable=SC2153 +IFS=\| read -r -a distro_base_local_repos <<< "$DISTRO_BASE_LOCAL_REPOS" + +if [ -w /etc/mock/"$CHROOT_NAME".cfg ]; then + echo -e "config_opts['yum.conf'] += \"\"\"\n" >> /etc/mock/"$CHROOT_NAME".cfg + for repo in $DISTRO_BASE_PR_REPOS $PR_REPOS; do + branch="master" + build_number="lastSuccessfulBuild" + if [[ $repo = *@* ]]; then + branch="${repo#*@}" + repo="${repo%@*}" + if [[ $branch = *:* ]]; then + build_number="${branch#*:}" + branch="${branch%:*}" + fi + fi + echo -e "[$repo:$branch:$build_number]\n\ +name=$repo:$branch:$build_number\n\ +baseurl=${JENKINS_URL:-https://build.hpdd.intel.com/}job/daos-stack/job/$repo/job/$branch/$build_number/artifact/artifacts/$DISTRO/\n\ +enabled=1\n\ +gpgcheck=False\n" >> /etc/mock/"$CHROOT_NAME".cfg + done + for repo in $JOB_REPOS "${distro_base_local_repos[@]}"; do + repo_name=${repo##*://} + repo_name=${repo_name//\//_} + echo -e "[${repo_name//@/_}]\n\ +name=${repo_name}\n\ +baseurl=${repo}\n\ +enabled=1\n" >> /etc/mock/"$CHROOT_NAME".cfg + done + echo "\"\"\"" >> /etc/mock/"$CHROOT_NAME".cfg +else + echo "Unable to update /etc/mock/$CHROOT_NAME.cfg." + echo "You need to make sure it has the needed repos in it yourself." +fi +eval mock -r "$CHROOT_NAME" $MOCK_OPTIONS $RPM_BUILD_OPTIONS "$TARGET"