From: Maria Matejka Date: Sat, 6 Dec 2025 21:43:54 +0000 (+0100) Subject: CI: No more APKG in packaging X-Git-Tag: v2.18~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4292e28066a34c099504ec282d0ff3b57ff51acd;p=thirdparty%2Fbird.git CI: No more APKG in packaging We have had minor and subtle but repeating problems with the APKG dependency chain and its overall usability. It has become apparent that we actually don't need that kind of abstraction layer because all our problems are actually solvable by just a bunch of short scripts. With that, we are now using the (standard) dpkg-buildpackage and rpmbuild tools directly from bash script. From now on, with just several exceptions, all our distribution builds should be fully reproducible. --- diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 85e3a7c77..9cb86fef1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -17,7 +17,6 @@ variables: IMG_BASE: registry.nic.cz/labs/bird TOOLS_DIR: /home/gitlab-runner/bird-tools STAYRTR_BINARY: /usr/local/bin/stayrtr - APKG_VERSION: 0.5.1 stages: - consistency @@ -712,10 +711,8 @@ build-release: <<: *test-job stage: pkg script: - # create venv only if it's installed - - if python3 -m venv venv; then . venv/bin/activate; fi - - pip3 install apkg==$APKG_VERSION - - apkg build -a bird-$(cat VERSION)*.tar.gz + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi + - tools/make-deb artifacts: paths: - pkg/pkgs/* @@ -725,15 +722,8 @@ build-release: <<: *test-job stage: pkg script: - # create venv only if it's installed - - if python3 -m venv venv; then . venv/bin/activate; fi - # install older version of bs4 that does not use python version >= 3.6 - # apkg depends on bs4, and unless we want to backport python 3.6 - # to ancient distros, we need to do this workaround - - pip3 install beautifulsoup4==4.11.2 - - pip3 install markupsafe==2.0.1 - - pip3 install apkg==$APKG_VERSION - - apkg build -a bird-$(cat VERSION)*.tar.gz + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi + - tools/make-deb artifacts: paths: - pkg/pkgs/* @@ -743,8 +733,8 @@ build-release: <<: *test-job stage: pkg script: - - pip3 install apkg==$APKG_VERSION - - apkg build -a bird-$(cat VERSION)*.tar.gz + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi + - STABLE_BUILDDIR=true tools/make-rpm artifacts: paths: - pkg/pkgs/* @@ -754,11 +744,9 @@ build-release: <<: *test-job stage: pkg script: + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi - sed -i "s/runstatedir/with-runtimedir/" distro/pkg/rpm/bird.spec - # install older version of bs4 that does not use python version >= 3.6 - - pip3 install beautifulsoup4==4.11.2 - - pip3 install apkg==$APKG_VERSION - - apkg build -a bird-$(cat VERSION)*.tar.gz + - STABLE_BUILDDIR=true tools/make-rpm artifacts: paths: - pkg/pkgs/* diff --git a/Makefile.in b/Makefile.in index 4429ee9fd..100723f11 100644 --- a/Makefile.in +++ b/Makefile.in @@ -238,6 +238,16 @@ install-docs: $(INSTALL) -d $(DESTDIR)/$(docdir) $(INSTALL_DATA) $(objdir)/doc/{bird,prog}{,-*}.html $(DESTDIR)/$(docdir)/ +# Packaging +archive: + tools/make-archive + +deb: + tools/make-deb + +rpm: + tools/make-rpm + # Cleanup clean:: rm -f $(objdir)/sysdep/paths.h $(objdir)/nest/proto-build.c @@ -256,3 +266,42 @@ distclean: clean rm -rf * .dir-stamp rm -f config.log config.status configure Makefile endif + +# Help dump +help: + @echo "============================= BIRD make system =============================" + @echo + @echo "To build BIRD directly from sources, run './configure'. For more information" + @echo "about that process, run './configure --help'." + @echo "To build BIRD from Git repo, run 'autoreconf' before './configure'." + @echo + @echo "Source build options:" + @echo " make all Build BIRD binaries." + @echo " make test Build and run unit tests." + @echo " make docs Build documentation." + @echo + @echo "Partial build options:" + @echo " make obj/path/to/foo.o Build an object file, don't link." + @echo " make obj/path/to/foo.E Run only the C preprocessor." + @echo " make obj/path/to/foo.S Generate an assembler dump." + @echo + @echo "Development tools:" + @echo " make static-scan Run CLang static analyzer." + @echo " make tags Generate ETags cache." + @echo " make cscope Generate CScope cache." + @echo + @echo "Auxiliary commands:" + @echo " make help Show this help." + @echo " make clean Cleanup the build directory. Useful after" + @echo " major changes or branch switch." + @echo " make distclean Cleanup everything so that you will have to" + @echo " run './configure' again." + @echo " make gitlab-local Re-generate .gitlab-ci.yml without venv" + @echo " make gitlab-venv Re-generate .gitlab-ci.yml inside a tmp venv" + @echo + @echo "Distribution commands:" + @echo " make install Install binaries into the system." + @echo " make archive Create a release archive (TGZ). + @echo " This must exist for 'make deb' and 'make rpm'." + @echo " make deb Create a DEB package for the current system." + @echo " make rpm Create an RPM package for the current system." diff --git a/configure.ac b/configure.ac index fc7f76e20..c27573cf2 100644 --- a/configure.ac +++ b/configure.ac @@ -80,6 +80,11 @@ AC_ARG_WITH([iproutedir], [given_iproutedir="yes"] ) +AC_ARG_WITH([debugsrcdir], + [AS_HELP_STRING([--with-debugsrcdir=PATH], [path to installed source files for package build])], + [debugsrcdir="$with_debugsrcdir"] +) + AC_ARG_VAR([FLEX], [location of the Flex program]) AC_ARG_VAR([BISON], [location of the Bison program]) AC_ARG_VAR([M4], [location of the M4 program]) @@ -423,6 +428,11 @@ if test "$enable_debug" = yes ; then fi fi +if test -n "$debugsrcdir" ; then + CFLAGS="$CFLAGS -ffile-prefix-map=$srcdir=$debugsrcdir -ffile-prefix-map=`readlink -f $srcdir`=$debugsrcdir" + LDFLAGS="$LDFLAGS -ffile-prefix-map=$srcdir=$debugsrcdir -ffile-prefix-map=`readlink -f $srcdir`=$debugsrcdir" +fi + if test "$enable_compact_tries" = yes ; then AC_DEFINE([ENABLE_COMPACT_TRIES], [1], [Define to 1 if you want 4-way tries instead of 16-way ones.]) fi diff --git a/distro/README.md b/distro/README.md index 52d22b16d..27561bc8d 100644 --- a/distro/README.md +++ b/distro/README.md @@ -1,69 +1,12 @@ # BIRD upstream packaging sources This distro/ directory contains packaging sources initially copied from Debian -and Fedora downstream repos. - -Files in this directory follow [apkg] conventions and apkg can be used to -create BIRD packages for various distros directly from upstream sources as -well as from upstream archives. - -[apkg]: https://apkg.rtfd.io - +and Fedora downstream repos. The team then updated these files for internal +integration testing and upstream repository builds. ## Create (source) package from current repo commit -Following command should build source package for current distro directly -from current repo state - run at top bird directory: - - apkg srcpkg - -or build native packages directly: - - apkg build - -or in case of disposable VM/container you can use faster direct host build - - apkg build -Hi - -tools/make-archive script is in charge of creating archive from source. - - -## Create (source) package from upstream release - -Following commands can be used to clone upstream repo, download current upstream -archive (tarball), and build Debian, Ubuntu, Fedora, CentOS, or OpenSUSE -source package (depending on host system) using files in bird/distro: - - git clone https://gitlab.nic.cz/labs/bird - cd bird - apkg get-archive - apkg srcpkg -a pkg/archives/upstream/bird-2.0.8.tar.gz - -To create native packages instead use `build`: - - apkg build -a pkg/archives/upstream/bird-2.0.8.tar.gz - -Or to build packages directly in case of a disposable VM/container (faster, modifies system): - - apkg build -Hi -a pkg/archives/upstream/bird-2.0.8.tar.gz - - -## Build packages in openSUSE Build Service (OBS) - -tools/make-obs script can be used on Debian-based system to create OBS -source package in pkg/obs directory ready to be uploaded: - - cd bird - apkg get-archive - ./tools/make-obs - # result in pkg/obs - -You can also supply (upstream) archive to build from: - - # or to use specified archive - ./tools/make-obs pkg/archives/upstream/bird-2.0.8.tar.gz - - -## More Info +Run `tools/make-archive` or `make archive` to create TGZ. -Please see [apkg docs][apkg]. +Run `tools/make-deb` or `tools/make-rpm` or `make deb` or `make rpm` to create +DEBs and/or RPMs for the current system. diff --git a/distro/config/apkg.toml b/distro/config/apkg.toml deleted file mode 100644 index cec7756ce..000000000 --- a/distro/config/apkg.toml +++ /dev/null @@ -1,12 +0,0 @@ -[project] -name = "bird" -# needed for make-archive -make_archive_script = "tools/make-archive" - -[upstream] -# needed for get-archive -archive_url = "https://bird.nic.cz/download/bird-{{ version }}.tar.gz" - -[apkg] -# apkg compat level -compat = 3 diff --git a/distro/pkg/deb/changelog b/distro/pkg/deb/changelog index cdfe3d954..842995cea 100644 --- a/distro/pkg/deb/changelog +++ b/distro/pkg/deb/changelog @@ -2,4 +2,4 @@ bird2 ({{ version }}-cznic.{{ release }}) unstable; urgency=medium * upstream package - -- Jakub Ružička {{ now }} + -- Maria Matějka {{ now }} diff --git a/distro/pkg/deb/control b/distro/pkg/deb/control index ff62248b9..57e3e3a74 100644 --- a/distro/pkg/deb/control +++ b/distro/pkg/deb/control @@ -17,9 +17,7 @@ Build-Depends-Indep: linuxdoc-tools-latex, opensp, texlive-latex-extra, -Maintainer: Jakub Ružička -Uploaders: - Ondřej Surý , +Maintainer: Maria Matejka Standards-Version: 4.7.0 Vcs-Browser: https://salsa.debian.org/debian/bird2 Vcs-Git: https://salsa.debian.org/debian/bird2.git diff --git a/distro/pkg/rpm/bird.spec b/distro/pkg/rpm/bird.spec index 6a5d46856..55eba3cce 100644 --- a/distro/pkg/rpm/bird.spec +++ b/distro/pkg/rpm/bird.spec @@ -9,7 +9,7 @@ Name: bird Version: {{ version }} -Release: cznic.{{ release }}%{?dist} +Release: cznic.1%{?dist} Summary: BIRD Internet Routing Daemon Group: System Environment/Daemons @@ -88,12 +88,11 @@ powerful language for route filtering. %install %make_install -{% raw %} -install -d %{buildroot}{%{_localstatedir}/lib/bird,%{_rundir}/bird} +install -d %{buildroot}%{_localstatedir}/lib/bird +install -d %{buildroot}%{_rundir}/bird install -D -p -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/bird.service install -D -p -m 0644 %{SOURCE2} %{buildroot}%{_tmpfilesdir}/bird.conf install -D -p -m 0644 %{SOURCE3} %{buildroot}%{_sysusersdir}/system-user-bird.conf -{% endraw %} %check %if 0%{?rhel} && 0%{?rhel} < 8 @@ -150,5 +149,5 @@ getent passwd %{bird_user} >/dev/null || useradd -r -g %{bird_group} -d /var/lib %endif %changelog -* Wed Apr 07 2021 Jakub Ružička - {{ version }}-cznic.1 +* {{ now }} Maria Matejka - {{ version }}-cznic.1 - upstream package diff --git a/misc/bird.spec b/misc/bird.spec deleted file mode 100644 index a0a1aaa52..000000000 --- a/misc/bird.spec +++ /dev/null @@ -1,55 +0,0 @@ -Summary: BIRD Internet Routing Daemon -Name: bird -Version: 2.17.1 -Release: 1 -Copyright: GPL -Group: Networking/Daemons -Source: ftp://bird.nic.cz/pub/bird/bird-%{version}.tar.gz -Source1: bird.init -Source2: birdc6 -Buildroot: /var/tmp/bird-root -Url: http://bird.nic.cz -Prereq: /sbin/chkconfig -BuildRequires: flex bison readline-devel ncurses-devel - -%description -BIRD is dynamic routing daemon supporting IPv4 and IPv6 versions of routing -protocols BGP, RIP and OSPF. - -%prep -%setup -n bird-%{version} - -%build -./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-ipv6 -make -mv bird bird6 -make clean -./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var -make - - -%install -rm -rf $RPM_BUILD_ROOT/* -make install prefix=$RPM_BUILD_ROOT/usr sysconfdir=$RPM_BUILD_ROOT/etc localstatedir=$RPM_BUILD_ROOT/var -install bird6 $RPM_BUILD_ROOT/usr/sbin - -cd $RPM_BUILD_ROOT -install -d etc/rc.d/init.d -install $RPM_SOURCE_DIR/bird.init etc/rc.d/init.d/bird -install $RPM_SOURCE_DIR/birdc6 usr/sbin/birdc6 - -%post -/sbin/ldconfig -/sbin/chkconfig --add bird - -%preun -if [ $1 = 0 ] ; then - /sbin/chkconfig --del bird -fi - -%files -%attr(755,root,root) /usr/sbin/bird -%attr(755,root,root) /usr/sbin/bird6 -%attr(755,root,root) /usr/sbin/birdc -%attr(755,root,root) /usr/sbin/birdc6 -%attr(755,root,root) /etc/rc.d/init.d/bird diff --git a/misc/docker/README.md b/misc/docker/README.md index 5efb0c35e..e25436fbe 100644 --- a/misc/docker/README.md +++ b/misc/docker/README.md @@ -4,18 +4,14 @@ do not supply official BIRD images and do not prepare any Docker files ourselves.** We build for the major Linux distributions, FreeBSD and OpenBSD. If you feel -that your favourite Linux distribution is missing, feel free to send a patch. +that your favourite Linux distribution is missing, please send a patch. Where to add your favourite Linux distribution: - add an appropriate dockerfile here -- add `docker-*` job in `.gitlab-ci.yml` -- add `build-*` job in `.gitlab-ci.yml` -- add `pkg-*` job in `.gitlab-ci.yml` - -Our build machinery needs at least Python 3.6 because of `beautifulsoup4`. -There is a hack for older distributions, installing an older version of -that dependency which works also with an older Python. +- possibly add `pkg-*` and `install-*` template job in `misc/gitlab/template.yml.j2` +- add your distribution into the `distros` list in `misc/gitlab/data.yml.j2` +- run `make gitlab-local` or `make gitlab-venv` to rebuild `.gitlab-ci.yml` ## Debian-based distributions @@ -27,20 +23,19 @@ have resources to build against. ## RedHat-based distributions -We support OpenSUSE, Fedora and CentOS. If you are missing your favourite new -release, poke us. We are discontinuing the old releases as they stop working. +We support OpenSUSE, Fedora, CentOS 7+8, Rocky Linux and Oracle Linux. If you are +missing your favourite new release, poke us. We are discontinuing the old +releases as they stop working. The current support for CentOS 7 and 8 has been paid for and we may drop it without further notice at the exact moment the customer stops using it. -## Any other based distributions +We failed to find a reliable Docker image for Rocky Linux 10. -We currently don't package for Arch or Gentoo. Contributions are open, please -refer to `CONTRIBUTING.md` for further information. +## Any other based distributions -You may also need to send a patch to [APKG](https://gitlab.nic.cz/packaging/apkg) -to facilitate the package building. Yet, if you wish to just test and check -builds without packaging, feel free to send the patch anyway. +We currently don't package for e.g. Alpine, Arch, Gentoo, Mint or Slackware. +Contributions are open, please refer to `CONTRIBUTING.md` for further information. ## FreeBSD and OpenBSD diff --git a/misc/docker/centos-7-amd64/Dockerfile b/misc/docker/centos-7-amd64/Dockerfile index 0efed4167..5e08944d3 100644 --- a/misc/docker/centos-7-amd64/Dockerfile +++ b/misc/docker/centos-7-amd64/Dockerfile @@ -37,6 +37,8 @@ RUN yum -y install \ RUN yum -y install \ git \ rpm-build \ + faketime \ + redhat-lsb-core \ python3 \ python3-pip \ python3-setuptools \ diff --git a/misc/docker/centos-8-amd64/Dockerfile b/misc/docker/centos-8-amd64/Dockerfile index 667d99e59..b20386d7e 100644 --- a/misc/docker/centos-8-amd64/Dockerfile +++ b/misc/docker/centos-8-amd64/Dockerfile @@ -19,6 +19,7 @@ RUN yum -y install \ RUN yum -y install \ git \ rpm-build \ + redhat-lsb-core \ systemd-rpm-macros \ python3 \ python3-pip \ diff --git a/misc/docker/debian-10-amd64/Dockerfile b/misc/docker/debian-10-amd64/Dockerfile index 1e281a0d1..9e11c53af 100644 --- a/misc/docker/debian-10-amd64/Dockerfile +++ b/misc/docker/debian-10-amd64/Dockerfile @@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ quilt \ python3 \ python3-pip \ diff --git a/misc/docker/debian-10-i386/Dockerfile b/misc/docker/debian-10-i386/Dockerfile index e3c164e8c..638df920d 100644 --- a/misc/docker/debian-10-i386/Dockerfile +++ b/misc/docker/debian-10-i386/Dockerfile @@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/debian-11-amd64/Dockerfile b/misc/docker/debian-11-amd64/Dockerfile index 94f2a54de..2a5fa3a80 100644 --- a/misc/docker/debian-11-amd64/Dockerfile +++ b/misc/docker/debian-11-amd64/Dockerfile @@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/debian-11-i386/Dockerfile b/misc/docker/debian-11-i386/Dockerfile index 1fcbc37d7..0878eb7d8 100644 --- a/misc/docker/debian-11-i386/Dockerfile +++ b/misc/docker/debian-11-i386/Dockerfile @@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/debian-12-amd64/Dockerfile b/misc/docker/debian-12-amd64/Dockerfile index cdee03f99..34f2c40d8 100644 --- a/misc/docker/debian-12-amd64/Dockerfile +++ b/misc/docker/debian-12-amd64/Dockerfile @@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/debian-12-i386/Dockerfile b/misc/docker/debian-12-i386/Dockerfile index 906f9fa5c..5f6b56d60 100644 --- a/misc/docker/debian-12-i386/Dockerfile +++ b/misc/docker/debian-12-i386/Dockerfile @@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/debian-13-amd64/Dockerfile b/misc/docker/debian-13-amd64/Dockerfile index d90883fcb..9b6db59ae 100644 --- a/misc/docker/debian-13-amd64/Dockerfile +++ b/misc/docker/debian-13-amd64/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/debian-13-i386/Dockerfile b/misc/docker/debian-13-i386/Dockerfile index 52ee361d4..d1c54b08f 100644 --- a/misc/docker/debian-13-i386/Dockerfile +++ b/misc/docker/debian-13-i386/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/debian-testing-amd64/Dockerfile b/misc/docker/debian-testing-amd64/Dockerfile index 61ebd0d7c..625f4774a 100644 --- a/misc/docker/debian-testing-amd64/Dockerfile +++ b/misc/docker/debian-testing-amd64/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/debian-testing-i386/Dockerfile b/misc/docker/debian-testing-i386/Dockerfile index 4c66aa340..fa8c0deae 100644 --- a/misc/docker/debian-testing-i386/Dockerfile +++ b/misc/docker/debian-testing-i386/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/docbuilder/Dockerfile b/misc/docker/docbuilder/Dockerfile index 464ec3030..ff758808e 100644 --- a/misc/docker/docbuilder/Dockerfile +++ b/misc/docker/docbuilder/Dockerfile @@ -1,5 +1,5 @@ # bump this to recreate the image: 2 -FROM debian:bookworm-slim +FROM debian:trixie-slim ENV DEBIAN_FRONTEND=noninteractive RUN apt-get -y update RUN apt-get -y upgrade @@ -12,7 +12,7 @@ RUN apt-get -y --no-install-recommends install \ pandoc \ ncurses-dev \ libreadline-dev \ - libssh-gcrypt-dev \ + libssh-dev \ linuxdoc-tools-latex \ texlive-latex-extra \ groff \ @@ -22,6 +22,7 @@ RUN apt-get -y --no-install-recommends install \ RUN apt-get -y --no-install-recommends install \ dpkg-dev \ debhelper \ + distro-info-data \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/fedora-32-amd64/Dockerfile b/misc/docker/fedora-32-amd64/Dockerfile index bd2759300..4e50d654d 100644 --- a/misc/docker/fedora-32-amd64/Dockerfile +++ b/misc/docker/fedora-32-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + redhat-lsb-core \ rpm-build \ + faketime \ systemd-rpm-macros \ python3 \ python3-pip \ diff --git a/misc/docker/fedora-33-amd64/Dockerfile b/misc/docker/fedora-33-amd64/Dockerfile index 4b3c4ba4f..749b53ee2 100644 --- a/misc/docker/fedora-33-amd64/Dockerfile +++ b/misc/docker/fedora-33-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + redhat-lsb-core \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-34-amd64/Dockerfile b/misc/docker/fedora-34-amd64/Dockerfile index afd27ccc8..d3f9ad2c5 100644 --- a/misc/docker/fedora-34-amd64/Dockerfile +++ b/misc/docker/fedora-34-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + redhat-lsb-core \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-35-amd64/Dockerfile b/misc/docker/fedora-35-amd64/Dockerfile index 93c363e2a..32e3aed72 100644 --- a/misc/docker/fedora-35-amd64/Dockerfile +++ b/misc/docker/fedora-35-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + redhat-lsb-core \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-36-amd64/Dockerfile b/misc/docker/fedora-36-amd64/Dockerfile index 965edcff2..22f5bd462 100644 --- a/misc/docker/fedora-36-amd64/Dockerfile +++ b/misc/docker/fedora-36-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + redhat-lsb-core \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-37-amd64/Dockerfile b/misc/docker/fedora-37-amd64/Dockerfile index 949a5217c..a43627a00 100644 --- a/misc/docker/fedora-37-amd64/Dockerfile +++ b/misc/docker/fedora-37-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-38-amd64/Dockerfile b/misc/docker/fedora-38-amd64/Dockerfile index 9c51de0db..2614b8db9 100644 --- a/misc/docker/fedora-38-amd64/Dockerfile +++ b/misc/docker/fedora-38-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-39-amd64/Dockerfile b/misc/docker/fedora-39-amd64/Dockerfile index 7544a956c..2551bb3c3 100644 --- a/misc/docker/fedora-39-amd64/Dockerfile +++ b/misc/docker/fedora-39-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-40-amd64/Dockerfile b/misc/docker/fedora-40-amd64/Dockerfile index 18e6cc107..e95795fd7 100644 --- a/misc/docker/fedora-40-amd64/Dockerfile +++ b/misc/docker/fedora-40-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-41-amd64/Dockerfile b/misc/docker/fedora-41-amd64/Dockerfile index c7f50852f..bf58f100d 100644 --- a/misc/docker/fedora-41-amd64/Dockerfile +++ b/misc/docker/fedora-41-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-42-amd64/Dockerfile b/misc/docker/fedora-42-amd64/Dockerfile index f01bbe5df..782f8474a 100644 --- a/misc/docker/fedora-42-amd64/Dockerfile +++ b/misc/docker/fedora-42-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/fedora-43-amd64/Dockerfile b/misc/docker/fedora-43-amd64/Dockerfile index c5e95075e..9f7f38221 100644 --- a/misc/docker/fedora-43-amd64/Dockerfile +++ b/misc/docker/fedora-43-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN dnf -y install \ readline-devel RUN dnf -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/opensuse-15.0-amd64/Dockerfile b/misc/docker/opensuse-15.0-amd64/Dockerfile index 7573f48c8..daf9f315b 100644 --- a/misc/docker/opensuse-15.0-amd64/Dockerfile +++ b/misc/docker/opensuse-15.0-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN zypper -n install \ readline-devel RUN zypper -n install \ git \ + lsb-release \ rpm-build \ + libfaketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/opensuse-15.1-amd64/Dockerfile b/misc/docker/opensuse-15.1-amd64/Dockerfile index c370395e9..a4c28e087 100644 --- a/misc/docker/opensuse-15.1-amd64/Dockerfile +++ b/misc/docker/opensuse-15.1-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN zypper -n install \ readline-devel RUN zypper -n install \ git \ + lsb-release \ rpm-build \ + libfaketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/opensuse-15.2-amd64/Dockerfile b/misc/docker/opensuse-15.2-amd64/Dockerfile index afc5273b5..b380d0d3a 100644 --- a/misc/docker/opensuse-15.2-amd64/Dockerfile +++ b/misc/docker/opensuse-15.2-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN zypper -n install \ readline-devel RUN zypper -n install \ git \ + lsb-release \ rpm-build \ + libfaketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/opensuse-15.3-amd64/Dockerfile b/misc/docker/opensuse-15.3-amd64/Dockerfile index 504e6ccc2..c0d6858df 100644 --- a/misc/docker/opensuse-15.3-amd64/Dockerfile +++ b/misc/docker/opensuse-15.3-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN zypper -n install \ readline-devel RUN zypper -n install \ git \ + lsb-release \ rpm-build \ + libfaketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/opensuse-15.4-amd64/Dockerfile b/misc/docker/opensuse-15.4-amd64/Dockerfile index 72bae7e88..1edd0012c 100644 --- a/misc/docker/opensuse-15.4-amd64/Dockerfile +++ b/misc/docker/opensuse-15.4-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN zypper -n install \ readline-devel RUN zypper -n install \ git \ + lsb-release \ rpm-build \ + libfaketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/opensuse-15.5-amd64/Dockerfile b/misc/docker/opensuse-15.5-amd64/Dockerfile index 63030eeb1..ec5340572 100644 --- a/misc/docker/opensuse-15.5-amd64/Dockerfile +++ b/misc/docker/opensuse-15.5-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN zypper -n install \ readline-devel RUN zypper -n install \ git \ + lsb-release \ rpm-build \ + libfaketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/opensuse-16.0-amd64/Dockerfile b/misc/docker/opensuse-16.0-amd64/Dockerfile index d03454e48..08edcb3c4 100644 --- a/misc/docker/opensuse-16.0-amd64/Dockerfile +++ b/misc/docker/opensuse-16.0-amd64/Dockerfile @@ -13,7 +13,9 @@ RUN zypper -n install \ readline-devel RUN zypper -n install \ git \ + lsb-release \ rpm-build \ + libfaketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/oracle-08-amd64/Dockerfile b/misc/docker/oracle-08-amd64/Dockerfile index 3f877687c..6bbd32e12 100644 --- a/misc/docker/oracle-08-amd64/Dockerfile +++ b/misc/docker/oracle-08-amd64/Dockerfile @@ -14,6 +14,7 @@ RUN yum -y install \ readline-devel RUN yum -y install \ git \ + redhat-lsb-core \ rpm-build \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/oracle-09-amd64/Dockerfile b/misc/docker/oracle-09-amd64/Dockerfile index 0514af85e..5df514c09 100644 --- a/misc/docker/oracle-09-amd64/Dockerfile +++ b/misc/docker/oracle-09-amd64/Dockerfile @@ -2,6 +2,8 @@ # check latest supported version at https://wiki.rockylinux.org/rocky/version/#__tabbed_1_2 FROM oraclelinux:9 +RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + RUN yum -y upgrade RUN yum -y install \ gcc \ @@ -14,7 +16,9 @@ RUN yum -y install \ readline-devel RUN yum -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/oracle-10-amd64/Dockerfile b/misc/docker/oracle-10-amd64/Dockerfile index 082736105..3141b364c 100644 --- a/misc/docker/oracle-10-amd64/Dockerfile +++ b/misc/docker/oracle-10-amd64/Dockerfile @@ -2,6 +2,8 @@ # check latest supported version at https://wiki.rockylinux.org/rocky/version/#__tabbed_1_2 FROM oraclelinux:10 +RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-10.noarch.rpm + RUN yum -y upgrade RUN yum -y install \ gcc \ @@ -14,7 +16,9 @@ RUN yum -y install \ readline-devel RUN yum -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/rocky-08-amd64/Dockerfile b/misc/docker/rocky-08-amd64/Dockerfile index d0910adba..d1e314641 100644 --- a/misc/docker/rocky-08-amd64/Dockerfile +++ b/misc/docker/rocky-08-amd64/Dockerfile @@ -14,6 +14,7 @@ RUN yum -y install \ readline-devel RUN yum -y install \ git \ + redhat-lsb-core \ rpm-build \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/rocky-09-amd64/Dockerfile b/misc/docker/rocky-09-amd64/Dockerfile index 7c11f2a2b..6d1d71fc9 100644 --- a/misc/docker/rocky-09-amd64/Dockerfile +++ b/misc/docker/rocky-09-amd64/Dockerfile @@ -2,6 +2,8 @@ # check latest supported version at https://wiki.rockylinux.org/rocky/version/#__tabbed_1_2 FROM rockylinux/rockylinux:9.5 +RUN dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm + RUN yum -y upgrade RUN yum -y install \ gcc \ @@ -14,7 +16,9 @@ RUN yum -y install \ readline-devel RUN yum -y install \ git \ + lsb-release \ rpm-build \ + faketime \ systemd \ systemd-rpm-macros \ python3 \ diff --git a/misc/docker/ubuntu-18.04-amd64/Dockerfile b/misc/docker/ubuntu-18.04-amd64/Dockerfile index 92a804378..9a60f5279 100644 --- a/misc/docker/ubuntu-18.04-amd64/Dockerfile +++ b/misc/docker/ubuntu-18.04-amd64/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/ubuntu-20.04-amd64/Dockerfile b/misc/docker/ubuntu-20.04-amd64/Dockerfile index 13e411c22..2870603b7 100644 --- a/misc/docker/ubuntu-20.04-amd64/Dockerfile +++ b/misc/docker/ubuntu-20.04-amd64/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/ubuntu-22.04-amd64/Dockerfile b/misc/docker/ubuntu-22.04-amd64/Dockerfile index 03db8c949..fcee7e7b1 100644 --- a/misc/docker/ubuntu-22.04-amd64/Dockerfile +++ b/misc/docker/ubuntu-22.04-amd64/Dockerfile @@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/ubuntu-24.04-amd64/Dockerfile b/misc/docker/ubuntu-24.04-amd64/Dockerfile index ee317196b..ed1707393 100644 --- a/misc/docker/ubuntu-24.04-amd64/Dockerfile +++ b/misc/docker/ubuntu-24.04-amd64/Dockerfile @@ -22,6 +22,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/docker/ubuntu-25.10-amd64/Dockerfile b/misc/docker/ubuntu-25.10-amd64/Dockerfile index 1310b96e2..3754834f0 100644 --- a/misc/docker/ubuntu-25.10-amd64/Dockerfile +++ b/misc/docker/ubuntu-25.10-amd64/Dockerfile @@ -22,6 +22,7 @@ RUN apt-get -y --no-install-recommends install \ git \ dpkg-dev \ debhelper \ + lsb-release \ apt-utils \ quilt \ python3 \ diff --git a/misc/gitlab/template.yml.j2 b/misc/gitlab/template.yml.j2 index a35358891..a638d387a 100644 --- a/misc/gitlab/template.yml.j2 +++ b/misc/gitlab/template.yml.j2 @@ -17,7 +17,6 @@ variables: IMG_BASE: registry.nic.cz/labs/bird TOOLS_DIR: /home/gitlab-runner/bird-tools STAYRTR_BINARY: /usr/local/bin/stayrtr - APKG_VERSION: 0.5.1 stages: - consistency @@ -240,10 +239,8 @@ build-release: <<: *test-job stage: pkg script: - # create venv only if it's installed - - if python3 -m venv venv; then . venv/bin/activate; fi - - pip3 install apkg==$APKG_VERSION - - apkg build -a bird-$(cat VERSION)*.tar.gz + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi + - tools/make-deb artifacts: paths: - pkg/pkgs/* @@ -253,15 +250,8 @@ build-release: <<: *test-job stage: pkg script: - # create venv only if it's installed - - if python3 -m venv venv; then . venv/bin/activate; fi - # install older version of bs4 that does not use python version >= 3.6 - # apkg depends on bs4, and unless we want to backport python 3.6 - # to ancient distros, we need to do this workaround - - pip3 install beautifulsoup4==4.11.2 - - pip3 install markupsafe==2.0.1 - - pip3 install apkg==$APKG_VERSION - - apkg build -a bird-$(cat VERSION)*.tar.gz + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi + - tools/make-deb artifacts: paths: - pkg/pkgs/* @@ -271,8 +261,8 @@ build-release: <<: *test-job stage: pkg script: - - pip3 install apkg==$APKG_VERSION - - apkg build -a bird-$(cat VERSION)*.tar.gz + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi + - STABLE_BUILDDIR=true tools/make-rpm artifacts: paths: - pkg/pkgs/* @@ -282,11 +272,9 @@ build-release: <<: *test-job stage: pkg script: + - if [ "$CI_PIPELINE_SOURCE" == "merge_request_event" ]; then export BRANCH=mergerequest-$CI_MERGE_REQUEST_IID; else export BRANCH=$CI_COMMIT_BRANCH; fi - sed -i "s/runstatedir/with-runtimedir/" distro/pkg/rpm/bird.spec - # install older version of bs4 that does not use python version >= 3.6 - - pip3 install beautifulsoup4==4.11.2 - - pip3 install apkg==$APKG_VERSION - - apkg build -a bird-$(cat VERSION)*.tar.gz + - STABLE_BUILDDIR=true tools/make-rpm artifacts: paths: - pkg/pkgs/* diff --git a/tools/make-deb b/tools/make-deb new file mode 100755 index 000000000..7c8f3d531 --- /dev/null +++ b/tools/make-deb @@ -0,0 +1,65 @@ +#!/bin/bash + +# Run this script after tools/make-archive + +set -e + +if [ -n "$STABLE_BUILDDIR" ] && $STABLE_BUILDDIR; then + TMPDIR=/tmp/dpkg-buildpackage/bird + if [ -d $TMPDIR ]; then + echo "Another build is running in $TMPDIR, bad!" + exit 1 + fi + mkdir -p $TMPDIR + pushd $TMPDIR + rm -rf * + popd +else + TMPDIR=$(readlink -f $(mktemp -dp .)) +fi + +PKGVERSION=$(tools/version) +DEBPKGSTEM=bird${PKGVERSION:0:1}_$PKGVERSION +DEBIAN_RELEASE=$(lsb_release -cs) +ORIG=$(pwd) +DIRTARGET=$(lsb_release -is)-$(lsb_release -rs | tr '/' '-') +DIRTARGET=${DIRTARGET,,} +SRCTARGET=${ORIG}/pkg/srcpkgs/$DIRTARGET/$DEBPKGSTEM-cznic.1/ +BINTARGET=${ORIG}/pkg/pkgs/$DIRTARGET/$DEBPKGSTEM-cznic.1/ + +echo "Packaging BIRD $PKGVERSION for $(lsb_release -is) $(lsb_release -rs) $(lsb_release -cs) in $TMPDIR" + +lsb_release -a + +mkdir -p $SRCTARGET $BINTARGET + +pushd $TMPDIR + cp ${ORIG}/bird-$PKGVERSION.tar.gz $DEBPKGSTEM.orig.tar.gz + tar xf $DEBPKGSTEM.orig.tar.gz + pushd bird-$PKGVERSION + # Fix time + COMMIT_DATE=@$(stat -c '%Y' ChangeLog) + + # Local-fix version + cp -r ${ORIG}/distro/pkg/deb debian + sed -i "s#{{ version }}#$PKGVERSION#;s#{{ release }}#1~$DEBIAN_RELEASE#;s#{{ now }}#$(date -d "$COMMIT_DATE" -R)#;" debian/changelog + touch -d "$COMMIT_DATE" debian debian/* + + # Create source package + dpkg-buildpackage -S -sa -d -us -uc + cp ../bird?_*-cznic* ${SRCTARGET}/ + cp ../bird?_*.orig.tar.gz ${SRCTARGET}/ + popd + + rm -rf bird-$PKGVERSION + dpkg-source -x *.dsc + + pushd bird${PKGVERSION:0:1}-$PKGVERSION + # Build locally + dpkg-buildpackage -B -sa -d -us -uc + mv ../bird?{,-dbgsym}_*-cznic* ${BINTARGET}/ + cp ../bird?_*.orig.tar.gz ${BINTARGET}/ + popd +popd + +rm -rf $TMPDIR diff --git a/tools/make-obs b/tools/make-obs deleted file mode 100755 index aeec70ada..000000000 --- a/tools/make-obs +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash -# create OpenSUSE Build System (OBS) source package -# -# this needs to be run on a (Debian-based) system with: -# -# * apkg -# * dpkg-buildpackage -# -# run from project root containing distro/ dir: -# -# ./tools/make-obs [path/to/archive.tar.gz] -# -# supply archives as optional arguments to build from, -# otherwise archive will be built from sources by apkg -# -# output at ./pkg/obs/ (removed on each run) -set -o errexit -o nounset - -OUTDIR="pkg/obs" -APKG_OPTS="-O $OUTDIR" - -if [ -z $@ ]; then - echo "building OBS srcpkg from project files" -else - AR=$1 - echo "building OBS srcpkg from specified archive(s)" - APKG_OPTS="-a $AR $APKG_OPTS" -fi - -if [ -n "$RELEASE" ]; then - echo "custom release: $RELEASE" - APKG_OPTS="-r $RELEASE $APKG_OPTS" -fi - -set -o xtrace -: removing existing output files at output dir: $OUTDIR -rm -rf "$OUTDIR" -: making debian source package from archive -apkg srcpkg $APKG_OPTS -d debian -: removing extra debian source package files -rm -f $OUTDIR/*_source.* -: rendering RPM template -apkg srcpkg $APKG_OPTS -d fedora --render-template -: fixing RPM .spec to use debian source archive -sed -i 's/^\(Source0:\s\+\).*/\1bird2_%{version}.orig.tar.gz/' $OUTDIR/*.spec -echo "OBS srcpkg ready at: $OUTDIR" diff --git a/tools/make-rpm b/tools/make-rpm new file mode 100755 index 000000000..baf1a0813 --- /dev/null +++ b/tools/make-rpm @@ -0,0 +1,83 @@ +#!/bin/bash + +# Run this script after tools/make-archive + +set -e + +if lsb-release >/dev/null 2>/dev/null; then + LSB_RELEASE=lsb-release +elif lsb_release >/dev/null 2>/dev/null; then + LSB_RELEASE=lsb_release +fi + +if faketime >/dev/null 2>/dev/null; then + FAKETIME=faketime +else + faketime() { + shift + shift + "$@" + } + echo "WARNING: For fully reproducible builds, faketime is required to reset the time to the release time." +fi + +if [ -n "$STABLE_BUILDDIR" ] && $STABLE_BUILDDIR; then + TMPDIR=/tmp/rpmbuild/bird + if [ -d $TMPDIR ]; then + echo "Another build is running in $TMPDIR, bad!" + exit 1 + fi + mkdir -p $TMPDIR + pushd $TMPDIR + rm -rf * + popd +else + TMPDIR=$(readlink -f $(mktemp -dp .)) +fi + +PKGVERSION=$(tools/version) +RPMPKGSTEM=bird-$PKGVERSION +ORIG=$(pwd) +DIRTARGET=$($LSB_RELEASE -is)-$($LSB_RELEASE -rs | tr '/' '-') +DIRTARGET=${DIRTARGET,,} +SRCTARGET=${ORIG}/pkg/srcpkgs/$DIRTARGET/$RPMPKGSTEM-cznic.1/ +BINTARGET=${ORIG}/pkg/pkgs/$DIRTARGET/$RPMPKGSTEM-cznic.1/ + +echo "Packaging BIRD $PKGVERSION for $($LSB_RELEASE -is) $($LSB_RELEASE -rs) in $TMPDIR" + +# CentOS 7 has an old version of rpmbuild +RPM_REBUILD_OPTION=-rb +if [ "$($LSB_RELEASE -is)" = "CentOS" ]; then + R=$($LSB_RELEASE -rs) + if [ "${R:0:2}" = "7." ]; then + RPM_REBUILD_OPTION=--rebuild + fi +fi + +$LSB_RELEASE -a + +mkdir -p $SRCTARGET $BINTARGET +mkdir -p $TMPDIR/SOURCES $TMPDIR/BUILD/$RPMPKGSTEM-build + +cp distro/pkg/rpm/* $TMPDIR/SOURCES/ +sed -i "s#{{ version }}#$PKGVERSION#;s#{{ now }}#$(date +'%a %b %d %Y')#;" $TMPDIR/SOURCES/bird.spec + +cp bird-$PKGVERSION.tar.gz $TMPDIR/SOURCES/$RPMPKGSTEM.tar.gz +pushd $TMPDIR/SOURCES + tar -xf bird-$PKGVERSION.tar.gz bird-$PKGVERSION/ChangeLog + FAKEDATE="$(date -d @$(stat -c '%Y' bird-$PKGVERSION/ChangeLog) +'%Y-%m-%d %H:%M:%S')" + rm -rf bird-$PKGVERSION +popd + +faketime -f "$FAKEDATE" rpmbuild -D "_topdir $TMPDIR" -bs $TMPDIR/SOURCES/bird.spec +faketime -f "$FAKEDATE" rpmbuild -D "_topdir $TMPDIR" $RPM_REBUILD_OPTION $TMPDIR/SRPMS/*.rpm + +for f in $(find $TMPDIR/RPMS -name '*.rpm'); do + cp $f $BINTARGET/ +done + +for f in $(find $TMPDIR/SRPMS -name '*.rpm'); do + cp $f $SRCTARGET/ +done + +rm -rf $TMPDIR diff --git a/tools/release-commit b/tools/release-commit index 49667c2c6..0c409ca83 100755 --- a/tools/release-commit +++ b/tools/release-commit @@ -71,14 +71,12 @@ if [ "$badlines" != 0 ]; then exit 1 fi -# Do the changes in the repository: NEWS, bird.spec and VERSION +# Do the changes in the repository: NEWS and VERSION echo >> $news cat NEWS >> $news mv $news NEWS -sed -i "s/^Version: $current_version\$/Version: $new_version/" misc/bird.spec - echo $new_version > VERSION # Commit! -git commit -m "NEWS and version update" -- NEWS VERSION misc/bird.spec +git commit -m "NEWS and version update" -- NEWS VERSION