Skip to content

Commit efb8a51

Browse files
committed
overhaul
1 parent f3cb4d0 commit efb8a51

77 files changed

Lines changed: 337 additions & 733 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/packages.yml

Lines changed: 19 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,36 +15,24 @@ jobs:
1515
matrix:
1616
arch:
1717
- ""
18-
- "-arm"
18+
# - "-arm"
1919
target:
2020
- debian-bullseye-deb
21-
- debian-bookworm-deb
22-
- debian-trixie-deb
23-
- ubuntu-jammy-deb
24-
- ubuntu-noble-deb
25-
- ubuntu-plucky-deb
26-
- almalinux-8-rpm
21+
# - debian-bookworm-deb
22+
# - debian-trixie-deb
23+
# - ubuntu-jammy-deb
24+
# - ubuntu-noble-deb
25+
# - ubuntu-plucky-deb
26+
# - almalinux-8-rpm
2727
- almalinux-9-rpm
28-
- almalinux-10-rpm
29-
- amazonlinux-2023-rpm
28+
# - almalinux-10-rpm
29+
# - amazonlinux-2023-rpm
3030
steps:
3131
- name: Checkout Code
3232
uses: actions/checkout@v5
33-
with:
34-
submodules: true
35-
36-
- name: Download Varnish
37-
run: |
38-
source pkg.env
39-
curl -LO https://varnish-cache.org/downloads/varnish-${varnish_version}.tgz
4033

4134
- name: Build Varnish packages
4235
run: |
43-
( cd varnish-cache/; tar cvzf ../debian.tar.gz debian --dereference ; )
44-
( cd varnish-cache/; tar cvzf ../redhat.tar.gz redhat --dereference ; )
45-
46-
mkdir -p packages
47-
4836
if [ -z "${{ matrix.arch }}" ]; then
4937
PARAM_ARCH=x86_64
5038
else
@@ -54,15 +42,18 @@ jobs:
5442
PARAM_RELEASE=`echo ${{ matrix.target }} | cut -d- -f 2`
5543
EXT=`echo ${{ matrix.target }} | cut -d- -f 3`
5644
45+
cp pkg.env varnish/
46+
5747
docker run \
5848
--rm \
5949
--security-opt seccomp=unconfined \
60-
-e PDIR=packages/$PARAM_DIST/$PARAM_RELEASE/$PARAM_ARCH \
61-
-v $(pwd):/varnish-cache \
50+
--workdir /workdir/varnish \
51+
-v$(pwd):/workdir \
52+
-e PDIR=/workdir/packages/ \
6253
$PARAM_DIST:$PARAM_RELEASE \
63-
/varnish-cache/build_scripts/make-$EXT-packages.sh
54+
/workdir/build_scripts/make-$EXT-packages.sh
6455
65-
ls packages/*/*/
56+
tree packages
6657
6758
- name: Upload artifacts
6859
uses: actions/upload-artifact@v4
@@ -136,18 +127,16 @@ jobs:
136127
137128
cp pkg.env $PACKAGE/
138129
139-
PDIR=new_packages/$PARAM_DIST/$PARAM_RELEASE/$PARAM_ARCH
140-
mkdir -p $PDIR
141-
142130
docker run \
143131
--rm \
144-
-e PDIR=/$PDIR \
132+
-e PDIR=new_packages/ \
145133
--workdir /workdir/$PACKAGE \
146134
-v$(pwd):/workdir \
147135
-v$(pwd)/packages:/deps \
148136
-v$(pwd)/new_packages:/new_packages \
149137
$PARAM_DIST:$PARAM_RELEASE \
150-
/workdir/build_scripts/make-$EXT-packages-vmod.sh
138+
/workdir/build_scripts/make-$EXT-packages.sh
139+
151140
tree new_packages
152141
153142
- name: Upload artifacts

build_scripts/make-deb-packages-vmod.sh

Lines changed: 0 additions & 48 deletions
This file was deleted.

build_scripts/make-deb-packages.sh

Lines changed: 57 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,50 +2,77 @@
22

33
set -eux
44

5+
source /etc/os-release
6+
source ./pkg.env
7+
58
export DEBIAN_FRONTEND=noninteractive
69
export DEBCONF_NONINTERACTIVE_SEEN=true
7-
apt-get update
8-
apt-get install -y dpkg-dev debhelper devscripts equivs pkg-config apt-utils fakeroot
910

10-
# Ubuntu 20.04 aarch64 fails when using fakeroot-sysv with:
11-
# semop(1): encountered an error: Function not implemented
12-
update-alternatives --set fakeroot /usr/bin/fakeroot-tcp
11+
PKG_NAME=$(basename $(pwd))
12+
DEB_ORIG=${VARS[${PKG_NAME}_version]}.orig.tar.gz
13+
if [ "`uname -m`" = "x86_64" ]; then
14+
ARCH="amd64"
15+
else
16+
ARCH="arm64"
17+
fi
18+
PDIR="$PDIR/$ID/${VERSION_ID%.*}/${ARCH}"
1319

14-
cd /varnish-cache
15-
ls -la
20+
apt-get update
21+
apt-get install -y \
22+
apt-utils \
23+
debhelper \
24+
devscripts \
25+
dpkg-dev \
26+
equivs \
27+
fakeroot \
28+
pkg-config \
29+
python*-docutils \
30+
$(test -d /deps && find /deps/ -name '*.deb')
31+
# Create build folder and copy debian folder there
32+
mkdir -p ./pkgbuild
33+
cd pkgbuild
1634

17-
echo "Untar debian..."
18-
tar xavf debian.tar.gz
35+
# Save the tarball source file one level up
36+
curl -L "${VARS[${PKG_NAME}_source]}" -o ../$DEB_ORIG
37+
tar xvfz ../$DEB_ORIG --strip 1
1938

20-
echo "Untar orig..."
21-
tar xavf varnish-*.tgz --strip 1
39+
# remove potential debian/ package included in the tarball
40+
rm -rf debian
41+
cp -Lr ../debian .
2242

23-
echo "Update changelog version..."
24-
if [ -e .is_weekly ]; then
25-
WEEKLY='-weekly'
43+
# Update changelog version
44+
if [ "$PKG_NAME" == "varnish" ]; then
45+
if [ -e .is_weekly ]; then
46+
WEEKLY='-weekly'
47+
else
48+
WEEKLY=
49+
fi
50+
VERSION=$(./configure --version | awk 'NR == 1 {print $NF}')$WEEKLY-${package_release}
51+
./configure --version
2652
else
27-
WEEKLY=
53+
VERSION="$(dpkg -l varnish | awk '$2 == "varnish" {print $3}')"
54+
dpkg -l varnish
2855
fi
29-
source /etc/os-release
30-
source ./pkg.env
31-
VERSION=$(./configure --version | awk 'NR == 1 {print $NF}')$WEEKLY-${package_release}~$VERSION_CODENAME
32-
sed -i -e "s|@VERSION@|$VERSION|" "debian/changelog"
3356

34-
echo "Install Build-Depends packages..."
57+
cat << EOF > debian/changelog
58+
${PKG_NAME} (${VERSION}) unstable; urgency=low
59+
60+
* Changelog not maintained, please see
61+
https://github.com/varnish/all-packager/releases/tag/v${VERSION%~*}
62+
63+
-- Varnish Software <opensource@varnish-software.com>
64+
EOF
65+
66+
cat debian/changelog
67+
# Install Build-Depends packages
3568
yes | mk-build-deps --install debian/control || true
3669

37-
echo "Build the packages..."
70+
# Build the packages
3871
dpkg-buildpackage -us -uc -j16
3972

40-
echo "Prepare the packages for storage..."
41-
mkdir -p $PDIR
42-
mv ../*.deb $PDIR
43-
44-
if [ "`uname -m`" = "x86_64" ]; then
45-
ARCH="amd64"
46-
else
47-
ARCH="arm64"
48-
fi
73+
# Prepare the packages for storage
74+
mkdir -p "$PDIR"
75+
mv ../*.deb "$PDIR"
4976

5077
DSC_FILE=$(ls ../*.dsc)
5178
DSC_FILE_WO_EXT=$(basename ${DSC_FILE%.*})

build_scripts/make-rpm-packages-vmod.sh

Lines changed: 0 additions & 24 deletions
This file was deleted.

build_scripts/make-rpm-packages.sh

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -2,69 +2,61 @@
22

33
set -eux
44

5+
source ./pkg.env
56
source /etc/os-release
7+
PKG_NAME=$(basename $(pwd))
8+
if [ "`uname -m`" = "x86_64" ]; then
9+
ARCH="amd64"
10+
else
11+
ARCH="arm64"
12+
fi
13+
PDIR="$PDIR/$ID/${VERSION_ID%.*}/${ARCH}"
14+
15+
cd redhat
16+
sed -i -e '' *
17+
dnf -y install 'dnf-command(config-manager)'
618
case "$PLATFORM_ID" in
719
platform:el8)
8-
dnf -y install 'dnf-command(config-manager)'
9-
dnf config-manager --set-enabled powertools
10-
dnf -y install epel-release
20+
EXTRA_REPO=powertools
1121
;;
1222
platform:el*)
13-
dnf -y install 'dnf-command(config-manager)'
14-
dnf config-manager --set-enabled crb
15-
dnf -y install epel-release
23+
EXTRA_REPO=crb
1624
;;
1725
esac
18-
19-
dnf -y install rpm-build dnf-utils
20-
21-
export DIST_DIR=build
22-
23-
cd /varnish-cache
24-
source ./pkg.env
25-
rm -rf $DIST_DIR
26-
mkdir $DIST_DIR
27-
28-
29-
echo "Untar redhat..."
30-
tar xavf redhat.tar.gz -C $DIST_DIR
31-
32-
echo "Untar orig..."
33-
tar xavf varnish-*.tgz -C $DIST_DIR --strip 1
34-
35-
echo "Build Packages..."
36-
if [ -e .is_weekly ]; then
37-
WEEKLY='.weekly'
26+
dnf config-manager --set-enabled $EXTRA_REPO
27+
dnf -y install \
28+
dnf-utils \
29+
epel-release \
30+
findutils \
31+
rpm-build \
32+
$(test -d /deps/ && find /deps/ -name '*.rpm')
33+
34+
# Update changelog version
35+
if [ "$PKG_NAME" == "varnish" ]; then
36+
if [ -e .is_weekly ]; then
37+
WEEKLY='.weekly'
38+
else
39+
WEEKLY=
40+
fi
41+
curl -L "${VARS[${PKG_NAME}_source]}" | tar xvfz - --strip 1
42+
VERSION=$(./configure --version | awk 'NR == 1 {print $NF}')$WEEKLY
3843
else
39-
WEEKLY=
44+
VERSION="$(pkg-config --silence-errors --modversion varnishapi)"
4045
fi
41-
VERSION=$("$DIST_DIR"/configure --version | awk 'NR == 1 {print $NF}')$WEEKLY
4246

43-
cp -r -L "$DIST_DIR"/redhat/* "$DIST_DIR"/
44-
tar zcf "$DIST_DIR.tgz" --exclude "$DIST_DIR/redhat" "$DIST_DIR"/
45-
46-
RPMVERSION="$VERSION"
47-
48-
RESULT_DIR="rpms"
49-
CUR_DIR="$(pwd)"
50-
51-
rpmbuild() {
52-
command rpmbuild \
47+
mkdir -p SOURCES/
48+
dnf builddep -y *.spec
49+
rpmbuild -bb \
50+
--undefine=_disable_source_fetch \
51+
--undefine=debug_package \
52+
--undefine=_debugsource_template \
53+
--define "_topdir $(pwd)" \
5354
--define "_smp_mflags -j10" \
54-
--define "_sourcedir $CUR_DIR" \
55-
--define "_srcrpmdir $CUR_DIR/${RESULT_DIR}" \
56-
--define "_rpmdir $CUR_DIR/${RESULT_DIR}" \
57-
--define "versiontag ${RPMVERSION}" \
55+
--define "versiontag ${VERSION}" \
5856
--define "releasetag ${package_release}" \
59-
--define "srcname $DIST_DIR" \
60-
--define "nocheck 1" \
61-
"$@"
62-
}
63-
64-
dnf builddep -y "$DIST_DIR"/redhat/varnish.spec
65-
rpmbuild -bs "$DIST_DIR"/redhat/varnish.spec
66-
rpmbuild --rebuild "$RESULT_DIR"/varnish-*.src.rpm
57+
--define "srcurl ${VARS[${PKG_NAME}_source]}" \
58+
--define "srcversion ${VARS[${PKG_NAME}_version]}" \
59+
*.spec
6760

68-
echo "Prepare the packages for storage..."
69-
mkdir -p $PDIR
70-
mv rpms/*/*.rpm $PDIR
61+
# Prepare the packages for storage
62+
mv RPMS/*/*.rpm $PDIR

pkg.env

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
package_release=3
2-
varnish_version=8.0.0
32

43
declare -A VARS
4+
VARS[varnish_version]=8.0.0
5+
VARS[varnish_source]=https://varnish-cache.org/downloads/varnish-${VARS[varnish_version]}.tgz
56

67
VARS[varnish-modules_version]=0.27.0
78
VARS[varnish-modules_source]=https://github.com/varnish/varnish-modules/releases/download/${VARS[varnish-modules_version]}/varnish-modules-${VARS[varnish-modules_version]}.tar.gz

0 commit comments

Comments
 (0)