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
<<: *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/*
<<: *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/*
<<: *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/*
<<: *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/*
$(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
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."
[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])
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
# 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.
+++ /dev/null
-[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
* upstream package
- -- Jakub Ružička <jakub.ruzicka@nic.cz> {{ now }}
+ -- Maria Matějka <maria.matejka@nic.cz> {{ now }}
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
Name: bird
Version: {{ version }}
-Release: cznic.{{ release }}%{?dist}
+Release: cznic.1%{?dist}
Summary: BIRD Internet Routing Daemon
Group: System Environment/Daemons
%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
%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
+++ /dev/null
-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
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
## 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
RUN yum -y install \
git \
rpm-build \
+ faketime \
+ redhat-lsb-core \
python3 \
python3-pip \
python3-setuptools \
RUN yum -y install \
git \
rpm-build \
+ redhat-lsb-core \
systemd-rpm-macros \
python3 \
python3-pip \
git \
dpkg-dev \
debhelper \
+ lsb-release \
quilt \
python3 \
python3-pip \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
# 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
pandoc \
ncurses-dev \
libreadline-dev \
- libssh-gcrypt-dev \
+ libssh-dev \
linuxdoc-tools-latex \
texlive-latex-extra \
groff \
RUN apt-get -y --no-install-recommends install \
dpkg-dev \
debhelper \
+ distro-info-data \
apt-utils \
quilt \
python3 \
readline-devel
RUN dnf -y install \
git \
+ redhat-lsb-core \
rpm-build \
+ faketime \
systemd-rpm-macros \
python3 \
python3-pip \
readline-devel
RUN dnf -y install \
git \
+ redhat-lsb-core \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ redhat-lsb-core \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ redhat-lsb-core \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ redhat-lsb-core \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN dnf -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN zypper -n install \
git \
+ lsb-release \
rpm-build \
+ libfaketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN zypper -n install \
git \
+ lsb-release \
rpm-build \
+ libfaketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN zypper -n install \
git \
+ lsb-release \
rpm-build \
+ libfaketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN zypper -n install \
git \
+ lsb-release \
rpm-build \
+ libfaketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN zypper -n install \
git \
+ lsb-release \
rpm-build \
+ libfaketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN zypper -n install \
git \
+ lsb-release \
rpm-build \
+ libfaketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN zypper -n install \
git \
+ lsb-release \
rpm-build \
+ libfaketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN yum -y install \
git \
+ redhat-lsb-core \
rpm-build \
systemd-rpm-macros \
python3 \
# 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 \
readline-devel
RUN yum -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
# 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 \
readline-devel
RUN yum -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
readline-devel
RUN yum -y install \
git \
+ redhat-lsb-core \
rpm-build \
systemd-rpm-macros \
python3 \
# 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 \
readline-devel
RUN yum -y install \
git \
+ lsb-release \
rpm-build \
+ faketime \
systemd \
systemd-rpm-macros \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
git \
dpkg-dev \
debhelper \
+ lsb-release \
apt-utils \
quilt \
python3 \
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
<<: *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/*
<<: *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/*
<<: *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/*
<<: *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/*
--- /dev/null
+#!/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
+++ /dev/null
-#!/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"
--- /dev/null
+#!/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
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