]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
CI: No more APKG in packaging
authorMaria Matejka <mq@ucw.cz>
Sat, 6 Dec 2025 21:43:54 +0000 (22:43 +0100)
committerMaria Matejka <mq@ucw.cz>
Wed, 24 Dec 2025 22:19:08 +0000 (23:19 +0100)
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.

57 files changed:
.gitlab-ci.yml
Makefile.in
configure.ac
distro/README.md
distro/config/apkg.toml [deleted file]
distro/pkg/deb/changelog
distro/pkg/deb/control
distro/pkg/rpm/bird.spec
misc/bird.spec [deleted file]
misc/docker/README.md
misc/docker/centos-7-amd64/Dockerfile
misc/docker/centos-8-amd64/Dockerfile
misc/docker/debian-10-amd64/Dockerfile
misc/docker/debian-10-i386/Dockerfile
misc/docker/debian-11-amd64/Dockerfile
misc/docker/debian-11-i386/Dockerfile
misc/docker/debian-12-amd64/Dockerfile
misc/docker/debian-12-i386/Dockerfile
misc/docker/debian-13-amd64/Dockerfile
misc/docker/debian-13-i386/Dockerfile
misc/docker/debian-testing-amd64/Dockerfile
misc/docker/debian-testing-i386/Dockerfile
misc/docker/docbuilder/Dockerfile
misc/docker/fedora-32-amd64/Dockerfile
misc/docker/fedora-33-amd64/Dockerfile
misc/docker/fedora-34-amd64/Dockerfile
misc/docker/fedora-35-amd64/Dockerfile
misc/docker/fedora-36-amd64/Dockerfile
misc/docker/fedora-37-amd64/Dockerfile
misc/docker/fedora-38-amd64/Dockerfile
misc/docker/fedora-39-amd64/Dockerfile
misc/docker/fedora-40-amd64/Dockerfile
misc/docker/fedora-41-amd64/Dockerfile
misc/docker/fedora-42-amd64/Dockerfile
misc/docker/fedora-43-amd64/Dockerfile
misc/docker/opensuse-15.0-amd64/Dockerfile
misc/docker/opensuse-15.1-amd64/Dockerfile
misc/docker/opensuse-15.2-amd64/Dockerfile
misc/docker/opensuse-15.3-amd64/Dockerfile
misc/docker/opensuse-15.4-amd64/Dockerfile
misc/docker/opensuse-15.5-amd64/Dockerfile
misc/docker/opensuse-16.0-amd64/Dockerfile
misc/docker/oracle-08-amd64/Dockerfile
misc/docker/oracle-09-amd64/Dockerfile
misc/docker/oracle-10-amd64/Dockerfile
misc/docker/rocky-08-amd64/Dockerfile
misc/docker/rocky-09-amd64/Dockerfile
misc/docker/ubuntu-18.04-amd64/Dockerfile
misc/docker/ubuntu-20.04-amd64/Dockerfile
misc/docker/ubuntu-22.04-amd64/Dockerfile
misc/docker/ubuntu-24.04-amd64/Dockerfile
misc/docker/ubuntu-25.10-amd64/Dockerfile
misc/gitlab/template.yml.j2
tools/make-deb [new file with mode: 0755]
tools/make-obs [deleted file]
tools/make-rpm [new file with mode: 0755]
tools/release-commit

index 85e3a7c774751727197d877eb21db29429f99327..9cb86fef1a13705621d683066ed9c87468e83cff 100644 (file)
@@ -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/*
index 4429ee9fd3c9044320306b01e5232818e6e7a9ea..100723f1115303316f08b9ac5582b20fc6156058 100644 (file)
@@ -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."
index fc7f76e208869ef2eb28c04abda60927ede8785b..c27573cf2de9f27f9a22e8b138520aee4af78114 100644 (file)
@@ -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
index 52d22b16d3139583add23e3a1e150e13ef8cc9aa..27561bc8de6eb9972e8a7ed28249514f4236ea85 100644 (file)
@@ -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 (file)
index cec7756..0000000
+++ /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
index cdfe3d9548a0e8753fec10501e9763a2f15d5a16..842995cea4cc8af23f72d5c80e05323f41973dc2 100644 (file)
@@ -2,4 +2,4 @@ bird2 ({{ version }}-cznic.{{ release }}) unstable; urgency=medium
 
   * upstream package
 
- -- Jakub Ružička <jakub.ruzicka@nic.cz>  {{ now }}
+ -- Maria Matějka <maria.matejka@nic.cz>  {{ now }}
index ff62248b9a9330efd274b4353a0fff5feb071ec6..57e3e3a74f95d75eb4756da84228d1632884173d 100644 (file)
@@ -17,9 +17,7 @@ Build-Depends-Indep:
  linuxdoc-tools-latex,
  opensp,
  texlive-latex-extra,
-Maintainer: Jakub Ružička <jakub.ruzicka@nic.cz>
-Uploaders:
- Ondřej Surý <ondrej@debian.org>,
+Maintainer: Maria Matejka <maria.matejka@nic.cz>
 Standards-Version: 4.7.0
 Vcs-Browser: https://salsa.debian.org/debian/bird2
 Vcs-Git: https://salsa.debian.org/debian/bird2.git
index 6a5d4685611af8a1c6f641bf48f81fcd338e6cfa..55eba3cce93c5731f09d702f31b50fefa70ab247 100644 (file)
@@ -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 <jakub.ruzicka@nic.cz> - {{ version }}-cznic.1
+* {{ now }} Maria Matejka <maria.matejka@nic.cz> - {{ version }}-cznic.1
 - upstream package
diff --git a/misc/bird.spec b/misc/bird.spec
deleted file mode 100644 (file)
index a0a1aaa..0000000
+++ /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
index 5efb0c35ecbc2799eb4b4ae9e8c9106fe9fac3b6..e25436fbe154969663a29ff88076059aa19c4ff7 100644 (file)
@@ -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
 
index 0efed416705282e80236a194eae61343dcdd2187..5e08944d35c34aab267be92d866ae5df697bc1f7 100644 (file)
@@ -37,6 +37,8 @@ RUN yum -y install \
 RUN yum -y install \
        git \
        rpm-build \
+       faketime \
+       redhat-lsb-core \
        python3 \
        python3-pip \
        python3-setuptools \
index 667d99e597b363ccb8f7c84e21114345055a7f90..b20386d7e77b7fb7ecbacb1d731ce905cdc82148 100644 (file)
@@ -19,6 +19,7 @@ RUN yum -y install \
 RUN yum -y install \
        git \
        rpm-build \
+       redhat-lsb-core \
        systemd-rpm-macros \
        python3 \
        python3-pip \
index 1e281a0d1c2c6755ac7283e78158e39ff4948f52..9e11c53af72bebc197a551148e852bf18c00b511 100644 (file)
@@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        quilt \
        python3 \
        python3-pip \
index e3c164e8c522da7213196f71b51fdc9b070cbe55..638df920d44711ce1f86f0bcae43f68d3439ce57 100644 (file)
@@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 94f2a54de7842111624302b03440db9159bebd06..2a5fa3a800c52e770d6536e9ff496bcb8bc7cc3f 100644 (file)
@@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 1fcbc37d7f26cffcefaf5bd73f21227c6c3d1545..0878eb7d8d510e41ffb2e9fc0e10344fc8ecb4af 100644 (file)
@@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index cdee03f999b08e6a106149d72aa4ba10e3e1372e..34f2c40d8e604c770208c5f0bb02e73d21f245a8 100644 (file)
@@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 906f9fa5c9d406f3dd16e58547db52049c596a87..5f6b56d601d4d4d56fd41c43347cfbb24a8db69d 100644 (file)
@@ -20,6 +20,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index d90883fcb25a0c58c616b5e2ce148eda3adbc79b..9b6db59aef419beca15d3559e509eb9d54761286 100644 (file)
@@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 52ee361d454706b9f3fbdc714b035d6c1552708a..d1c54b08f53ee1d07b4029fe4f6bb929dfb238f1 100644 (file)
@@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 61ebd0d7cf4a341628666c352f2eb7f13691cbce..625f4774a7fea53992bb6c4b494d135e4599327c 100644 (file)
@@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 4c66aa340d706f25a2c12209d15553814aa9c1d7..fa8c0deaedf9de829fcc865b8737a3f8555c2a90 100644 (file)
@@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 464ec3030fa7a343eb79eaf85e2b987af3b6bbf1..ff758808ea6bc83ca50fa9c06fa6e51de4a301dc 100644 (file)
@@ -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 \
index bd27593001a35fe3492c590e07e793abb893ffc3..4e50d654d347f3d06fc122a470aec69ba5c2704a 100644 (file)
@@ -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 \
index 4b3c4ba4f30d8fe4429bfe43531b9dad68fad4f4..749b53ee2dee7131fc4eb1c3e3c5c32514fe63f9 100644 (file)
@@ -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 \
index afd27ccc806cb909a3d3909b7f07a20425b3c9c4..d3f9ad2c530472dad46f0119a0c7b527d5ef3385 100644 (file)
@@ -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 \
index 93c363e2a6a7e8610ba3b29f45cd3e0bfd369ab3..32e3aed7250ae4e4dbcc9a11df950d9af0ed6989 100644 (file)
@@ -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 \
index 965edcff23bbff80b2dcd05a1e7e26a4ba7e5555..22f5bd4625c4e46ced8cd414af976d6befce7f8a 100644 (file)
@@ -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 \
index 949a5217c6d36d0cb7c678b64dea49b65018f01f..a43627a00023f8461458584b446854744ac22401 100644 (file)
@@ -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 \
index 9c51de0dbcff4cc997220deeaca4f673281b1b9a..2614b8db9607eb228dbb4f7137d559b9c21b3f52 100644 (file)
@@ -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 \
index 7544a956ca3d9332ab80f5d1072b8894b66a98a3..2551bb3c3df98678cc5057c53fd0d2f13ff8524b 100644 (file)
@@ -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 \
index 18e6cc107dc00417e28b554b1215c4c50ef8e307..e95795fd7d434d50912560efea7341a7b3aab640 100644 (file)
@@ -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 \
index c7f50852fee71a6dabb771614c064bb6455b5e39..bf58f100dbe108800e5c7103cb57c7760c0d1028 100644 (file)
@@ -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 \
index f01bbe5dff5ce6be1cd7318e4c83693ee3e92375..782f8474a7ad81247bf3c491ae315c436ddd4179 100644 (file)
@@ -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 \
index c5e95075eb56ee104a3ee6739ac1f5451a1dda67..9f7f38221f220df357b9b2b1d691d8a5e0bd4a08 100644 (file)
@@ -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 \
index 7573f48c8c285484cd91e2d768ea4bf68fec5c78..daf9f315bada5ebfddff0b6ee545c6d601faa590 100644 (file)
@@ -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 \
index c370395e965bc48d9dedad69979fffe90a457370..a4c28e0878f6fcd9ab055af385791cdd0fa6308b 100644 (file)
@@ -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 \
index afc5273b5bc83fd0290ea9c08126c63dadf15322..b380d0d3ae37966244a9a022e8ffd1ca939d6951 100644 (file)
@@ -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 \
index 504e6ccc2aa0f888a616cca5c216ec2f2afe50ad..c0d6858df3e657816e338ac75508f69532ea9661 100644 (file)
@@ -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 \
index 72bae7e883ce719e87edeacdb81fb9a0272b5b45..1edd0012cab422fe79ca8837f9aba6502e6f08e4 100644 (file)
@@ -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 \
index 63030eeb1037012f49c86814338f2294dddc259e..ec5340572320c813c0f083229a29b7c178de3f8f 100644 (file)
@@ -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 \
index d03454e48c4b5d18e48de5423c3dc7e94e01c123..08edcb3c4926221e957c7783df198072b24191e7 100644 (file)
@@ -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 \
index 3f877687cd2c4ad60bbf16ec40deffd93c47554b..6bbd32e1247b255b11c9ee07343ae964c12b3a4f 100644 (file)
@@ -14,6 +14,7 @@ RUN yum -y install \
        readline-devel
 RUN yum -y install \
        git \
+       redhat-lsb-core \
        rpm-build \
        systemd-rpm-macros \
        python3 \
index 0514af85e579e7a37bf999af744847bc4d127bfe..5df514c097e7d089e735ba353fc2b79ba91ef201 100644 (file)
@@ -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 \
index 082736105d280a7310bd17f057b184079e9b8277..3141b364c5f03c0de6d1eff977151a92178e29b6 100644 (file)
@@ -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 \
index d0910adbad06212dbbe5d8d565c28e8d5620d42e..d1e3146410f36e4a09e69b0b2f44624d1997d1c6 100644 (file)
@@ -14,6 +14,7 @@ RUN yum -y install \
        readline-devel
 RUN yum -y install \
        git \
+       redhat-lsb-core \
        rpm-build \
        systemd-rpm-macros \
        python3 \
index 7c11f2a2b94e75ccf181169e6d3fb28c566e9c71..6d1d71fc9544b8d9acd280f76becdad4f3af8dc0 100644 (file)
@@ -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 \
index 92a804378c5f4b930f497d666b21487860eec08f..9a60f527936530acdcb9d4d5b8234dcacd3718e4 100644 (file)
@@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 13e411c225822303b2a19ca0c9dfb5da59d3cfe1..2870603b761bf81cb9dc718f3ad66009e962f2f6 100644 (file)
@@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 03db8c9499790937fa68d7c14d892ae55f597b3d..fcee7e7b1ec198c1dfc477817519a94a6fed3cb5 100644 (file)
@@ -21,6 +21,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index ee317196bd419f1da17a3c30398b2deaad184e44..ed17073931c61ddf533d1804a9068afec79ce541 100644 (file)
@@ -22,6 +22,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index 1310b96e26b947965257968bf788451c81fbc6ad..3754834f0a616a1d5a3e9265116d701fb03a9c7f 100644 (file)
@@ -22,6 +22,7 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       lsb-release \
        apt-utils \
        quilt \
        python3 \
index a353588910aefe2838e115e36ca1b32aa8c0d8e3..a638d387afdd371ec603a5916cf12e82de0936ab 100644 (file)
@@ -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 (executable)
index 0000000..7c8f3d5
--- /dev/null
@@ -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 (executable)
index aeec70a..0000000
+++ /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 (executable)
index 0000000..baf1a08
--- /dev/null
@@ -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
index 49667c2c61d3ce095a82e36f840fcd0b7c8b8143..0c409ca83c2dd556670faaca6eaf3c50a218a9f8 100755 (executable)
@@ -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