Skip to content

Commit 7547b65

Browse files
authored
Backport ci: extract setup rpmrebuild and fix rebuild (fluent#828)
Backport fluent#827 RpmUnpack implementation was changed from rpm2cpio to rpm2archive, but it can't rebuild RPM because it handles outcome of rpm2archive wrongly. It will be fixed in rpmrebuild 2.21. See rpmrebuild 2.20: rpm2archive called with incorrect arguments https://sourceforge.net/p/rpmrebuild/bugs/18/ Signed-off-by: Kentaro Hayashi <[email protected]>
1 parent 4bc8c81 commit 7547b65

File tree

3 files changed

+32
-27
lines changed

3 files changed

+32
-27
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
case $distribution in
2+
amazon)
3+
case $version in
4+
2023)
5+
curl -L -o rpmrebuild.noarch.rpm https://sourceforge.net/projects/rpmrebuild/files/latest/download
6+
sudo $DNF install -y ./rpmrebuild.noarch.rpm
7+
;;
8+
2)
9+
sudo amazon-linux-extras install -y epel
10+
sudo $DNF install -y rpmrebuild
11+
;;
12+
esac
13+
;;
14+
*)
15+
sudo $DNF install -y epel-release
16+
sudo $DNF install -y rpmrebuild
17+
# hotfix for rpmrebuild 2.20 bug
18+
# See https://sourceforge.net/p/rpmrebuild/bugs/18/
19+
pkg_version=$(rpm -q rpmrebuild)
20+
case $pkg_version in
21+
rpmrebuild-2.20*)
22+
curl -LO https://sourceforge.net/p/rpmrebuild/bugs/18/attachment/rpmrebuild-2.20-rpm2archive-bug.patch
23+
hotfix=$(realpath rpmrebuild-2.20-rpm2archive-bug.patch)
24+
(cd /usr/lib/rpmrebuild && sudo patch -p2 < $hotfix)
25+
;;
26+
esac
27+
;;
28+
esac

fluent-package/yum/systemd-test/update-to-next-version-with-backward-compat-for-v4.sh

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,8 @@ sudo systemctl enable fluentd # Enable the unit name alias
5454
systemctl status --no-pager td-agent
5555

5656
# Make a dummy pacakge for the next version
57-
case $distribution in
58-
amazon)
59-
sudo amazon-linux-extras install -y epel
60-
;;
61-
*)
62-
sudo $DNF install -y epel-release
63-
;;
64-
esac
65-
sudo $DNF install -y rpmrebuild
57+
. $(dirname $0)/setup-rpmrebuild.sh
58+
6659
# Example: "1.el9"
6760
release=$(rpmquery --queryformat="%{Release}" -p $package)
6861
# Example: "1"

fluent-package/yum/systemd-test/update-to-next-version.sh

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,8 @@ sudo systemctl enable --now fluentd
1111
systemctl status --no-pager fluentd
1212

1313
# Make a dummy pacakge for the next version
14-
case $distribution in
15-
amazon)
16-
case $version in
17-
2023)
18-
curl -L -o rpmrebuild.noarch.rpm https://sourceforge.net/projects/rpmrebuild/files/latest/download
19-
sudo $DNF install -y ./rpmrebuild.noarch.rpm
20-
;;
21-
2)
22-
sudo amazon-linux-extras install -y epel
23-
sudo $DNF install -y rpmrebuild
24-
;;
25-
esac
26-
;;
27-
*)
28-
sudo $DNF install -y epel-release
29-
sudo $DNF install -y rpmrebuild
30-
;;
31-
esac
14+
. $(dirname $0)/setup-rpmrebuild.sh
15+
3216
# Example: "1.el9"
3317
release=$(rpmquery --queryformat="%{Release}" -p $package)
3418
# Example: "1"

0 commit comments

Comments
 (0)