Skip to content

Commit

Permalink
rpm: Fix make rpm failure in Fedora
Browse files Browse the repository at this point in the history
Previously, without fix on SONAME[1], when installing rpm generated by
`make rpm`, Fedora will complains:

    error: Failed dependencies:
            libnmstate.so()(64bit) is needed by nmstate-devel

To fix the issue, we updated the nmstate.spec.in to hold:
    * Both Fedora and RHEL specific lines
    * Both official release and snapshot build(snapshot will use
      internet for crates.io access)

Tested on CentOS stream 9, Fedora 38 and Fedora Rawhide(40).

Also removed copr build for RHEL/CentOS 8 due to no usage.

Resolves: RHEL-5002

[1]: rust-lang/cargo#5045

Signed-off-by: Gris Ge <[email protected]>
  • Loading branch information
cathay4t committed Oct 20, 2023
1 parent 29840f9 commit 845c321
Show file tree
Hide file tree
Showing 7 changed files with 194 additions and 51 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_rpm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ CONTAINER_C9S_IMG="quay.io/nmstate/c9s-nmstate-build"
if [ $1 == "el8" ];then
podman run -v $PROJECT_PATH:$CONTAINER_WORKSPACE:rw \
$CONTAINER_C8S_IMG /bin/bash -c \
"cd $CONTAINER_WORKSPACE && SKIP_VENDOR_CREATION=1 make rpm"
"cd $CONTAINER_WORKSPACE && make rpm"

mkdir -p $OUTPUT_DIR/el8 || true
mv -v *.rpm $OUTPUT_DIR/el8/
else
podman run -v $PROJECT_PATH:$CONTAINER_WORKSPACE:rw \
$CONTAINER_C9S_IMG /bin/bash -c \
"cd $CONTAINER_WORKSPACE && SKIP_VENDOR_CREATION=1 make rpm"
"cd $CONTAINER_WORKSPACE && make rpm"

mkdir -p $OUTPUT_DIR/el9 || true
mv -v *.rpm $OUTPUT_DIR/el9/
Expand Down
9 changes: 6 additions & 3 deletions .packit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ srpm_build_deps:
actions:
post-upstream-clone:
- "make packaging/nmstate.spec"
- "sed -i -e '/^Source1/d' packaging/nmstate.spec"
- "sed -i -e '/^Source2/d' packaging/nmstate.spec"
- "sed -i -e '/^Source3/d' packaging/nmstate.spec"
- "mv packaging/nmstate.spec ./"
# packit will try to download all SOURCES even those are not ignored by
# rpm condiction check, so we remove it extra sources for copr build
create-archive:
- "env SKIP_VENDOR_CREATION=1 make dist"
- "make dist"
get-current-version:
- "cat VERSION"
jobs:
- job: copr_build
trigger: pull_request
metadata:
targets:
- centos-stream-8-x86_64
- centos-stream-9-x86_64
- epel-8-x86_64
- epel-9-x86_64
29 changes: 14 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@ VERSION_MINOR=$(shell echo $(VERSION) | cut -f2 -d.)
VERSION_MICRO=$(shell echo $(VERSION) | cut -f3 -d.)
GIT_COMMIT=$(shell git rev-parse --short HEAD)
TIMESTAMP=$(shell date +%Y%m%d)
TARBALL=nmstate-$(VERSION)-alpha.$(TIMESTAMP).$(GIT_COMMIT).tar.gz
VENDOR_TARBALL=nmstate-vendor-$(VERSION).$(TIMESTAMP).$(GIT_COMMIT).tar.xz
ifeq ($(RELEASE), 1)
TARBALL=nmstate-$(VERSION).tar.gz
VENDOR_TARBALL=nmstate-vendor-$(VERSION).tar.xz
else
TARBALL=nmstate-$(VERSION)-alpha.$(TIMESTAMP).$(GIT_COMMIT).tar.gz
VENDOR_TARBALL=nmstate-vendor-$(VERSION).$(TIMESTAMP).$(GIT_COMMIT).tar.xz
endif
CLIB_SO_DEV=libnmstate.so
CLIB_A_DEV=libnmstate.a
CLIB_SO_MAN=$(CLIB_SO_DEV).$(VERSION_MAJOR)
Expand Down Expand Up @@ -58,7 +63,6 @@ PKG_CONFIG_LIBDIR ?= $(LIBDIR)/pkgconfig
MAN_DIR ?= $(PREFIX)/share/man

SKIP_PYTHON_INSTALL ?=0
SKIP_VENDOR_CREATION ?=0
RELEASE ?=0

PYTHON3_SITE_DIR ?=$(shell \
Expand Down Expand Up @@ -100,7 +104,9 @@ $(SPEC_FILE): $(SPEC_FILE).in
sed -i -e "s/@VERSION@/$(VERSION)/" $(SPEC_FILE)
if [ $(RELEASE) == 1 ];then \
sed -i -e "s/@RELEASE@/1/" $(SPEC_FILE); \
sed -i -e "s/@IS_SNAPSHOT@/0/" $(SPEC_FILE); \
else \
sed -i -e "s/@IS_SNAPSHOT@/1/" $(SPEC_FILE); \
sed -i -e "s/@RELEASE@/0.alpha.$(TIMESTAMP).$(GIT_COMMIT)/" \
$(SPEC_FILE);\
sed -i -e "s|^Source0:.\+|Source0: $(TARBALL)|" $(SPEC_FILE); \
Expand Down Expand Up @@ -140,7 +146,7 @@ dist: manpage $(SPEC_FILE) $(CLIB_HEADER)
cp $(SYSTEMD_SERVICE_FILE) $(TMPDIR)/nmstate-$(VERSION)/
cd $(TMPDIR) && tar cfz $(TARBALL) nmstate-$(VERSION)/
mv $(TMPDIR)/$(TARBALL) ./
if [ $(SKIP_VENDOR_CREATION) == 0 ];then \
if [ $(RELEASE) == 1 ];then \
cd rust; \
cargo vendor-filterer \
--platform x86_64-unknown-linux-gnu \
Expand All @@ -149,20 +155,13 @@ dist: manpage $(SPEC_FILE) $(CLIB_HEADER)
tar cfJ $(ROOT_DIR)/$(VENDOR_TARBALL) vendor ; \
fi
rm -rf $(TMPDIR)
echo $(TARBALL)

release: dist
$(eval NEW_TARBALL=nmstate-$(VERSION).tar.gz)
if [ $(RELEASE) == 1 ];then \
mv $(TARBALL) $(NEW_TARBALL); \
if [ $(SKIP_VENDOR_CREATION) == 0 ];then \
mv $(VENDOR_TARBALL) \
$(ROOT_DIR)/nmstate-vendor-$(VERSION).tar.xz; \
fi; \
gpg2 --armor --detach-sign $(NEW_TARBALL); \
else \
gpg2 --armor --detach-sign $(TARBALL); \
fi
echo $(TARBALL)

release: dist
gpg2 --armor --detach-sign $(TARBALL);

upstream_release:
$(ROOT_DIR)/automation/upstream_release.sh
Expand Down
2 changes: 1 addition & 1 deletion automation/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ function install_nmstate {
if [ -n "$COMPILED_RPMS_DIR" ];then
exec_cmd "rpm -ivh ${COMPILED_RPMS_DIR}/*.rpm || exit 1"
else
exec_cmd "SKIP_VENDOR_CREATION=1 make rpm"
exec_cmd "make rpm"
exec_cmd "rpm -ivh *.rpm"
fi
fi
Expand Down
2 changes: 1 addition & 1 deletion packaging/Dockerfile.fed-nmstate-dev:latest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ RUN dnf update -y && \
python3-devel python3-pyyaml python3-setuptools dnsmasq git \
iproute rpm-build python3-pytest python3-virtualenv python3-tox \
tcpreplay wpa_supplicant hostapd libndp procps-ng dpdk nispor \
python3-gobject-base && dnf clean all
patchelf rust-packaging python3-gobject-base && dnf clean all

COPY network_manager_enable_trace.conf \
/etc/NetworkManager/conf.d/97-trace-logging.conf
Expand Down
2 changes: 1 addition & 1 deletion packaging/Dockerfile.fed-nmstate-dev:rawhide
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ RUN dnf -y install --setopt=install_weak_deps=False \
python3-devel python3-pyyaml python3-setuptools dnsmasq git \
iproute rpm-build python3-pytest python3-virtualenv python3-tox \
tcpreplay wpa_supplicant hostapd libndp procps-ng dpdk nispor \
python3-gobject-base && dnf clean all
patchelf rust-packaging python3-gobject-base && dnf clean all

COPY network_manager_enable_trace.conf \
/etc/NetworkManager/conf.d/97-trace-logging.conf
Expand Down
Loading

0 comments on commit 845c321

Please sign in to comment.