]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Backported release tooling updates from 3.1 and 2.17
authorMaria Matejka <mq@ucw.cz>
Thu, 8 May 2025 20:26:17 +0000 (22:26 +0200)
committerMaria Matejka <mq@ucw.cz>
Sat, 10 May 2025 14:56:27 +0000 (16:56 +0200)
66 files changed:
.gitlab-ci.yml
Makefile.in
VERSION [new file with mode: 0644]
distro/README.md
distro/config/apkg.toml
doc/Makefile
doc/bird.sgml
misc/docker/README.md [new file with mode: 0644]
misc/docker/centos-6-amd64/Dockerfile [deleted file]
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 [moved from misc/docker/debian-9-amd64/Dockerfile with 72% similarity]
misc/docker/debian-12-i386/Dockerfile [moved from misc/docker/debian-9-i386/Dockerfile with 71% similarity]
misc/docker/debian-7-amd64/Dockerfile [deleted file]
misc/docker/debian-7-i386/Dockerfile [deleted file]
misc/docker/debian-8-amd64/Dockerfile [deleted file]
misc/docker/debian-8-i386/Dockerfile [deleted file]
misc/docker/debian-testing-amd64/Dockerfile
misc/docker/debian-testing-i386/Dockerfile
misc/docker/docbuilder/Dockerfile [new file with mode: 0644]
misc/docker/fedora-25-amd64/Dockerfile [deleted file]
misc/docker/fedora-26-amd64/Dockerfile [deleted file]
misc/docker/fedora-27-amd64/Dockerfile [deleted file]
misc/docker/fedora-28-amd64/Dockerfile [deleted file]
misc/docker/fedora-29-amd64/Dockerfile [deleted file]
misc/docker/fedora-32-amd64/Dockerfile
misc/docker/fedora-33-amd64/Dockerfile
misc/docker/fedora-34-amd64/Dockerfile
misc/docker/fedora-35-amd64/Dockerfile [moved from misc/docker/fedora-30-amd64/Dockerfile with 73% similarity]
misc/docker/fedora-36-amd64/Dockerfile [moved from misc/docker/fedora-31-amd64/Dockerfile with 73% similarity]
misc/docker/fedora-37-amd64/Dockerfile [new file with mode: 0644]
misc/docker/fedora-38-amd64/Dockerfile [new file with mode: 0644]
misc/docker/fedora-39-amd64/Dockerfile [new file with mode: 0644]
misc/docker/fedora-40-amd64/Dockerfile [new file with mode: 0644]
misc/docker/fedora-41-amd64/Dockerfile [new file with mode: 0644]
misc/docker/fedora-42-amd64/Dockerfile [new file with mode: 0644]
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 [new file with mode: 0644]
misc/docker/opensuse-15.5-amd64/Dockerfile [new file with mode: 0644]
misc/docker/ubuntu-14.04-amd64/Dockerfile [deleted file]
misc/docker/ubuntu-16.04-amd64/Dockerfile [deleted file]
misc/docker/ubuntu-18.04-amd64/Dockerfile
misc/docker/ubuntu-20.04-amd64/Dockerfile
misc/docker/ubuntu-22.04-amd64/Dockerfile [moved from misc/docker/ubuntu-21.10-amd64/Dockerfile with 74% similarity]
misc/docker/ubuntu-24.04-amd64/Dockerfile [moved from misc/docker/ubuntu-21.04-amd64/Dockerfile with 63% similarity]
misc/docker/ubuntu-24.10-amd64/Dockerfile [new file with mode: 0644]
misc/gitlab/data.yml.j2 [new file with mode: 0644]
misc/gitlab/pipeline.py [new file with mode: 0755]
misc/gitlab/template.yml.j2 [new file with mode: 0644]
sysdep/config.h
tools/gendist
tools/git-check-commits [new file with mode: 0755]
tools/git-check-tag-ci [new file with mode: 0755]
tools/git-check-tag-local [new file with mode: 0755]
tools/git-is-stable-branch [new file with mode: 0755]
tools/make-archive [new file with mode: 0755]
tools/make-dev-archive
tools/release-commit [new file with mode: 0755]
tools/version [new file with mode: 0755]

index 2e71b881eea1bcd82dc49b364c827a555fadbc7c..7df1b6557598f3acd6f68cb10cb0f4b20f079977 100644 (file)
@@ -1,3 +1,14 @@
+###########################################################
+#####                                                 #####
+#####       DO  NOT  EDIT  THIS  FILE  BY  HAND       #####
+#####                                                 #####
+###########################################################
+#####                                                 #####
+##### This file is autogenerated from misc/gitlab/.   #####
+##### Edit those files and run `make gitlab` instead. #####
+#####                                                 #####
+###########################################################
+
 variables:
   DEBIAN_FRONTEND: noninteractive
   LC_ALL: C.UTF-8
@@ -8,16 +19,80 @@ variables:
   STAYRTR_BINARY: /usr/bin/stayrtr
 
 stages:
-#  - image
+  - consistency
+  - image
   - build
   - pkg
   - test
 
-.docker: &docker_build
+## Common rules
+# Ignore WIP commits
+.never-wip: &never-wip
+  if: $CI_COMMIT_MESSAGE =~ /^(fixup! )*WIP/
+  when: never
+# Run for stable branches
+.if-stable: &if-stable
+  if: $CI_COMMIT_BRANCH =~ /^(stable-.*|thread-next|master)$/
+  when: always
+# Do run for tags
+.if-tag: &if-tag
+  if: $CI_COMMIT_TAG
+  when: always
+# Never run for tags
+.never-tag: &never-tag
+  if: $CI_COMMIT_TAG
+  when: never
+
+## Consistency checks for stable branches
+commit-messages:
+  stage: consistency
+  image: registry.nic.cz/labs/bird:docbuilder
+  script:
+  - tools/git-check-commits
+  rules:
+  - *if-stable
+  - when: never
+
+## Tag check
+tag-collect:
+  stage: consistency
+  image: registry.nic.cz/labs/bird:docbuilder
+  script:
+  - python3 -m venv venv
+  - . venv/bin/activate
+  - pip3 install requests
+  - tools/git-check-tag-local $CI_COMMIT_TAG
+  - tools/git-check-tag-ci $CI_COMMIT_SHA
+  artifacts:
+    paths:
+      - obj/doc/bird-singlepage.html
+      - bird-*.tar.gz
+      - pkg/pkgs/*
+      - pkg/srcpkgs/*
+  rules:
+  - *if-tag
+  - when: never
+
+## Default test job rules
+.test-job: &test-job
+  rules:
+  - *never-wip
+  - *never-tag
+  - when: always
+
+############################
+## Docker builder rebuild ##
+############################
+# We are running all the build / packaging tests in Dockers (unless otherwise)
+# and these are rules to build these docker images. These are expensive to run
+# and should run only if needed.
+#
+# Modify the appropriate dockerfile to rebuild these images
+
+.docker: &docker-build
   stage: image
-  allow_failure: true
   script:
-  - $DOCKER_CMD login -u gitlab-ci-token -p $CI_BUILD_TOKEN registry.nic.cz
+  - $DOCKER_CMD login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.nic.cz
   # Make sure we refresh the base image if it updates (eg. security updates, etc)
   # If we do just the build, cache is always reused and the freshness of the
   # base image is never checked. However, pull always asks and updates the
@@ -32,300 +107,985 @@ stages:
   tags:
   # That's Docker in Docker
   - dind
+  rules:
+    # Never rebuild for WIP commits
+  - *never-wip
 
-# Docker build example
-#docker_debian-11-amd64:
-#  variables:
-#    IMG_NAME: "debian-11-amd64"
-#  <<: *docker_build
+    # Never rebuild for tags
+  - if: '$CI_COMMIT_TAG'
+    when: never
 
+    # Never rebuild for new branches
+  - if: $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
+    when: never
 
-.build: &build-base
-  stage: build
-  script:
-  - autoreconf
-  - ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS"
-  # Detect which make is available
-  - MAKE=make
-  - which gmake 2>/dev/null >/dev/null && MAKE=gmake
-  - $MAKE
-  - $MAKE check
-  # Build docs when tools are available
-  - if which linuxdoc pdflatex >/dev/null ; then $MAKE docs ; fi
-
-.build-linux: &build-linux
-  <<: *build-base
-  tags:
-    - docker
-    - linux
-    - amd64
+    # Do any change in Dockerfile (e.g. change a comment) to rebuild the image
+    # FIXME: This probably belongs to bird-tools instead, we may end up with
+    # screwed up docker repository in case of colliding image updates
+  - changes:
+    - misc/docker/$IMG_NAME/Dockerfile
+    when: always
 
-build-debian-9-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-9-amd64
+  - when: never
 
-build-debian-9-i386:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-9-i386
 
-build-debian-10-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-10-amd64
+docker-docbuilder:
+  variables:
+    IMG_NAME: "docbuilder"
+  <<: *docker-build
 
-build-debian-10-i386:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-10-i386
+docker-centos-7-amd64:
+  variables:
+    IMG_NAME: "centos-7-amd64"
+  <<: *docker-build
 
-build-debian-11-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-11-amd64
+docker-centos-8-amd64:
+  variables:
+    IMG_NAME: "centos-8-amd64"
+  <<: *docker-build
 
-build-debian-12-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-12-amd64
+docker-fedora-32-amd64:
+  variables:
+    IMG_NAME: "fedora-32-amd64"
+  <<: *docker-build
 
-#build-debian-11-i386:
-#  <<: *build-linux
-#  image: registry.nic.cz/labs/bird:debian-11-i386
+docker-fedora-33-amd64:
+  variables:
+    IMG_NAME: "fedora-33-amd64"
+  <<: *docker-build
 
-build-debian-testing-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:debian-testing-amd64
+docker-opensuse-15.0-amd64:
+  variables:
+    IMG_NAME: "opensuse-15.0-amd64"
+  <<: *docker-build
 
-#build-debian-testing-i386:
-#  <<: *build-linux
-#  image: registry.nic.cz/labs/bird:debian-testing-i386
+docker-opensuse-15.1-amd64:
+  variables:
+    IMG_NAME: "opensuse-15.1-amd64"
+  <<: *docker-build
 
-build-fedora-25-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-25-amd64
+docker-opensuse-15.2-amd64:
+  variables:
+    IMG_NAME: "opensuse-15.2-amd64"
+  <<: *docker-build
 
-build-fedora-26-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-26-amd64
+docker-opensuse-15.3-amd64:
+  variables:
+    IMG_NAME: "opensuse-15.3-amd64"
+  <<: *docker-build
 
-build-fedora-27-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-27-amd64
+docker-opensuse-15.4-amd64:
+  variables:
+    IMG_NAME: "opensuse-15.4-amd64"
+  <<: *docker-build
 
-build-fedora-28-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-28-amd64
+docker-opensuse-15.5-amd64:
+  variables:
+    IMG_NAME: "opensuse-15.5-amd64"
+  <<: *docker-build
 
-build-fedora-29-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-29-amd64
+docker-fedora-34-amd64:
+  variables:
+    IMG_NAME: "fedora-34-amd64"
+  <<: *docker-build
 
-build-fedora-30-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-30-amd64
+docker-fedora-35-amd64:
+  variables:
+    IMG_NAME: "fedora-35-amd64"
+  <<: *docker-build
 
-build-fedora-31-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-31-amd64
+docker-fedora-36-amd64:
+  variables:
+    IMG_NAME: "fedora-36-amd64"
+  <<: *docker-build
 
-build-fedora-32-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-32-amd64
+docker-fedora-37-amd64:
+  variables:
+    IMG_NAME: "fedora-37-amd64"
+  <<: *docker-build
 
-build-fedora-33-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-33-amd64
+docker-fedora-38-amd64:
+  variables:
+    IMG_NAME: "fedora-38-amd64"
+  <<: *docker-build
 
-build-fedora-34-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:fedora-33-amd64
+docker-fedora-39-amd64:
+  variables:
+    IMG_NAME: "fedora-39-amd64"
+  <<: *docker-build
 
-build-centos-8-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:centos-8-amd64
+docker-fedora-40-amd64:
+  variables:
+    IMG_NAME: "fedora-40-amd64"
+  <<: *docker-build
 
-build-ubuntu-16_04-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:ubuntu-16.04-amd64
+docker-fedora-41-amd64:
+  variables:
+    IMG_NAME: "fedora-41-amd64"
+  <<: *docker-build
 
-build-ubuntu-18_04-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:ubuntu-18.04-amd64
+docker-fedora-42-amd64:
+  variables:
+    IMG_NAME: "fedora-42-amd64"
+  <<: *docker-build
 
-build-ubuntu-20_04-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:ubuntu-20.04-amd64
+docker-ubuntu-18.04-amd64:
+  variables:
+    IMG_NAME: "ubuntu-18.04-amd64"
+  <<: *docker-build
+
+docker-debian-10-amd64:
+  variables:
+    IMG_NAME: "debian-10-amd64"
+  <<: *docker-build
+
+docker-debian-10-i386:
+  variables:
+    IMG_NAME: "debian-10-i386"
+  <<: *docker-build
+
+docker-debian-11-amd64:
+  variables:
+    IMG_NAME: "debian-11-amd64"
+  <<: *docker-build
+
+docker-debian-11-i386:
+  variables:
+    IMG_NAME: "debian-11-i386"
+  <<: *docker-build
+
+docker-debian-12-amd64:
+  variables:
+    IMG_NAME: "debian-12-amd64"
+  <<: *docker-build
+
+docker-debian-12-i386:
+  variables:
+    IMG_NAME: "debian-12-i386"
+  <<: *docker-build
+
+docker-debian-testing-amd64:
+  variables:
+    IMG_NAME: "debian-testing-amd64"
+  <<: *docker-build
+
+docker-debian-testing-i386:
+  variables:
+    IMG_NAME: "debian-testing-i386"
+  <<: *docker-build
+
+docker-ubuntu-20.04-amd64:
+  variables:
+    IMG_NAME: "ubuntu-20.04-amd64"
+  <<: *docker-build
+
+docker-ubuntu-22.04-amd64:
+  variables:
+    IMG_NAME: "ubuntu-22.04-amd64"
+  <<: *docker-build
+
+docker-ubuntu-24.04-amd64:
+  variables:
+    IMG_NAME: "ubuntu-24.04-amd64"
+  <<: *docker-build
+
+docker-ubuntu-24.10-amd64:
+  variables:
+    IMG_NAME: "ubuntu-24.10-amd64"
+  <<: *docker-build
+
+
+#####################################################
+## Linux distro build tests inside Docker builders ##
+#####################################################
+
+## Build stage
+#
+# Now we compile and run unit tests ... in every single distribution.
+# Every task needs its docker, see above.
+
+.build: &build-base
+  <<: *test-job
+  stage: build
+  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
+    - tools/version && ( echo -n "BIRD version "; tools/version ) > version-expected
+    - |
+      STABLE_VERSION="`cat VERSION`"
+      if [ "$CI_COMMIT_MESSAGE" == "NEWS and version update
+      " ]; then
+        if [ "${STABLE_VERSION}" == "`tools/version`" ]; then
+          echo "Stable version precheck OK"
+        else
+          echo "Stable version discrepancy: $STABLE_VERSION vs. $(tools/version)"
+          exit 1
+        fi
+      else
+        if grep -qF "BIRD version ${STABLE_VERSION}+branch" version-expected; then
+          true
+        else
+          echo -n "Commit $CI_COMMIT_SHA message $CI_COMMIT_MESSAGE expects version "
+          cat version-expected
+          exit 1
+        fi
+      fi
+    - autoreconf
+    - ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" $CONFIGURE_OPTIONS
+    # Detect which make is available
+    - MAKE=make
+    - which gmake 2>/dev/null >/dev/null && MAKE=gmake
+    - $MAKE
+    - $MAKE check
+    # Build docs when tools are available
+    - if which linuxdoc pdflatex sgmlsasp >/dev/null ; then $MAKE docs ; fi
+    # Check that the reported version is the right one
+    - ./bird --version |& tee obj/version-built
+    - diff obj/version-built version-expected
+
+.build-docker-linux-amd64: &build-docker-linux-amd64
+  <<: *build-base
+  tags:
+    - docker
+    - linux
+    - amd64
+
+
+build-centos-7-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-centos-7-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:centos-7-amd64
+  variables:
+    CC: /opt/rh/devtoolset-8/root/usr/bin/gcc
+    LC_ALL: en_US.UTF-8
 
-build-ubuntu-21_10-amd64:
-  <<: *build-linux
-  image: registry.nic.cz/labs/bird:ubuntu-21.10-amd64
+build-centos-8-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-centos-8-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:centos-8-amd64
 
-#build-ubuntu-21_04-amd64:
-#  <<: *build-linux
-#  image: registry.nic.cz/labs/bird:ubuntu-21.04-amd64
+build-fedora-32-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-32-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-32-amd64
+
+build-fedora-33-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-33-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-33-amd64
 
 build-opensuse-15.0-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.0-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:opensuse-15.0-amd64
 
 build-opensuse-15.1-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.1-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:opensuse-15.1-amd64
 
 build-opensuse-15.2-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.2-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:opensuse-15.2-amd64
 
 build-opensuse-15.3-amd64:
-  <<: *build-linux
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.3-amd64
+      optional: true
   image: registry.nic.cz/labs/bird:opensuse-15.3-amd64
 
-#build-freebsd-11-amd64:
-#  <<: *build-base
-#  tags:
-#    - freebsd
-#    - amd64
+build-opensuse-15.4-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.4-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:opensuse-15.4-amd64
+
+build-opensuse-15.5-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-opensuse-15.5-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:opensuse-15.5-amd64
+
+build-fedora-34-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-34-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-34-amd64
+
+build-fedora-35-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-35-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-35-amd64
+
+build-fedora-36-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-36-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-36-amd64
+
+build-fedora-37-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-37-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-37-amd64
+
+build-fedora-38-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-38-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-38-amd64
+
+build-fedora-39-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-39-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-39-amd64
+
+build-fedora-40-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-40-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-40-amd64
+
+build-fedora-41-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-41-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-41-amd64
+
+build-fedora-42-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-fedora-42-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:fedora-42-amd64
+
+build-ubuntu-18.04-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-18.04-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:ubuntu-18.04-amd64
+
+build-debian-10-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-10-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-10-amd64
+
+build-debian-10-i386:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-10-i386
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-10-i386
+
+build-debian-11-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-11-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-11-amd64
+
+build-debian-11-i386:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-11-i386
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-11-i386
 
-#build-freebsd-11-i386:
-#  <<: *build-base
-#  tags:
-#    - freebsd
-#    - i386
+build-debian-12-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-12-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-12-amd64
+
+build-debian-12-i386:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-12-i386
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-12-i386
+
+build-debian-testing-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-testing-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-testing-amd64
 
+build-debian-testing-i386:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-debian-testing-i386
+      optional: true
+  image: registry.nic.cz/labs/bird:debian-testing-i386
+
+build-ubuntu-20.04-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-20.04-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:ubuntu-20.04-amd64
+
+build-ubuntu-22.04-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-22.04-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:ubuntu-22.04-amd64
+
+build-ubuntu-24.04-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-24.04-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:ubuntu-24.04-amd64
+
+build-ubuntu-24.10-amd64:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-ubuntu-24.10-amd64
+      optional: true
+  image: registry.nic.cz/labs/bird:ubuntu-24.10-amd64
+
+
+#######################################################
+## A special task for preparing the release archives ##
+#######################################################
+build-release:
+  <<: *test-job
+  image: registry.nic.cz/labs/bird:docbuilder
+  needs: 
+    - job: docker-docbuilder
+      optional: true
+  stage: build
+  tags:
+    - docker
+    - linux
+  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
+    - autoreconf
+    - ./configure --with-protocols= --disable-client
+    - make obj/doc/bird-singlepage.html
+    - tools/make-archive
+  artifacts:
+    paths:
+      - obj/doc/bird-singlepage.html
+      - bird-*.tar.gz
+    expire_in: 1 day
+
+# Packaging rules
+# As we support some ancient versions of different distributions,
+# we need to keep several different machineries. It's not so bad
+# but it's bad nevertheless.
+#
+# We do NOT build separate documentation packages in these rules.
 
 .pkg-deb: &pkg-deb
+  <<: *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 build
+    - apkg build -a bird-$(cat VERSION)*.tar.gz
     #- apkg install -y pkg/pkgs/*/*/*.deb
   artifacts:
     paths:
       - pkg/pkgs/*
+      - pkg/srcpkgs/*
 
 .pkg-deb-legacy: &pkg-deb-legacy
+  <<: *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
-    - pip3 install beautifulsoup4==4.11.2 
+    # 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 apkg
-    - BRANCH=$CI_COMMIT_BRANCH ARCHIVE_DOCS=false apkg build
+    - apkg build -a bird-$(cat VERSION)*.tar.gz
     #- apkg install -y pkg/pkgs/*/*/*.deb
   artifacts:
     paths:
       - pkg/pkgs/*
+      - pkg/srcpkgs/*
 
 .pkg-rpm: &pkg-rpm
+  <<: *test-job
   stage: pkg
   script:
     - pip3 install apkg
-    - apkg build
+    - apkg build -a bird-$(cat VERSION)*.tar.gz
     #- apkg install -y pkg/pkgs/*/*/*.rpm
   artifacts:
     paths:
       - pkg/pkgs/*
+      - pkg/srcpkgs/*
 
 .pkg-rpm-wa: &pkg-rpm-wa
+  <<: *test-job
   stage: pkg
   script:
     - 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 build
+    - apkg build -a bird-$(cat VERSION)*.tar.gz
     #- apkg install -y pkg/pkgs/*/*/*.rpm
   artifacts:
     paths:
       - pkg/pkgs/*
+      - pkg/srcpkgs/*
 
-pkg-debian-10-amd64:
-  <<: *pkg-deb
-  needs: [build-debian-10-amd64]
-  image: registry.nic.cz/labs/bird:debian-10-amd64
-
-pkg-debian-10-i386:
-  <<: *pkg-deb
-  needs: [build-debian-10-i386]
-  image: registry.nic.cz/labs/bird:debian-10-i386
 
-pkg-debian-11-amd64:
-  <<: *pkg-deb
-  needs: [build-debian-11-amd64]
-  image: registry.nic.cz/labs/bird:debian-11-amd64
 
-pkg-debian-12-amd64:
-  <<: *pkg-deb
-  needs: [build-debian-12-amd64]
-  image: registry.nic.cz/labs/bird:debian-12-amd64
-
-pkg-fedora-30-amd64:
+pkg-centos-7-amd64:
   <<: *pkg-rpm-wa
-  needs: [build-fedora-30-amd64]
-  image: registry.nic.cz/labs/bird:fedora-30-amd64
+  needs:
+    - job: build-centos-7-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:centos-7-amd64
+  variables:
+    CC: /opt/rh/devtoolset-8/root/usr/bin/gcc
+    LC_ALL: en_US.UTF-8
 
-pkg-fedora-31-amd64:
+pkg-centos-8-amd64:
   <<: *pkg-rpm-wa
-  needs: [build-fedora-31-amd64]
-  image: registry.nic.cz/labs/bird:fedora-31-amd64
+  needs:
+    - job: build-centos-8-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:centos-8-amd64
 
 pkg-fedora-32-amd64:
   <<: *pkg-rpm-wa
-  needs: [build-fedora-32-amd64]
+  needs:
+    - job: build-fedora-32-amd64
+      artifacts: false
+    - job: build-release
   image: registry.nic.cz/labs/bird:fedora-32-amd64
 
 pkg-fedora-33-amd64:
   <<: *pkg-rpm-wa
-  needs: [build-fedora-33-amd64]
+  needs:
+    - job: build-fedora-33-amd64
+      artifacts: false
+    - job: build-release
   image: registry.nic.cz/labs/bird:fedora-33-amd64
 
+pkg-opensuse-15.0-amd64:
+  <<: *pkg-rpm-wa
+  needs:
+    - job: build-opensuse-15.0-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:opensuse-15.0-amd64
+
+pkg-opensuse-15.1-amd64:
+  <<: *pkg-rpm-wa
+  needs:
+    - job: build-opensuse-15.1-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:opensuse-15.1-amd64
+
+pkg-opensuse-15.2-amd64:
+  <<: *pkg-rpm-wa
+  needs:
+    - job: build-opensuse-15.2-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:opensuse-15.2-amd64
+
+pkg-opensuse-15.3-amd64:
+  <<: *pkg-rpm-wa
+  needs:
+    - job: build-opensuse-15.3-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:opensuse-15.3-amd64
+
+pkg-opensuse-15.4-amd64:
+  <<: *pkg-rpm-wa
+  needs:
+    - job: build-opensuse-15.4-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:opensuse-15.4-amd64
+
+pkg-opensuse-15.5-amd64:
+  <<: *pkg-rpm-wa
+  needs:
+    - job: build-opensuse-15.5-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:opensuse-15.5-amd64
+
 pkg-fedora-34-amd64:
   <<: *pkg-rpm
-  needs: [build-fedora-34-amd64]
+  needs:
+    - job: build-fedora-34-amd64
+      artifacts: false
+    - job: build-release
   image: registry.nic.cz/labs/bird:fedora-34-amd64
 
-pkg-centos-8-amd64:
-  <<: *pkg-rpm-wa
-  needs: [build-centos-8-amd64]
-  image: registry.nic.cz/labs/bird:centos-8-amd64
+pkg-fedora-35-amd64:
+  <<: *pkg-rpm
+  needs:
+    - job: build-fedora-35-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:fedora-35-amd64
+
+pkg-fedora-36-amd64:
+  <<: *pkg-rpm
+  needs:
+    - job: build-fedora-36-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:fedora-36-amd64
+
+pkg-fedora-37-amd64:
+  <<: *pkg-rpm
+  needs:
+    - job: build-fedora-37-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:fedora-37-amd64
+
+pkg-fedora-38-amd64:
+  <<: *pkg-rpm
+  needs:
+    - job: build-fedora-38-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:fedora-38-amd64
+
+pkg-fedora-39-amd64:
+  <<: *pkg-rpm
+  needs:
+    - job: build-fedora-39-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:fedora-39-amd64
+
+pkg-fedora-40-amd64:
+  <<: *pkg-rpm
+  needs:
+    - job: build-fedora-40-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:fedora-40-amd64
+
+pkg-fedora-41-amd64:
+  <<: *pkg-rpm
+  needs:
+    - job: build-fedora-41-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:fedora-41-amd64
+
+pkg-fedora-42-amd64:
+  <<: *pkg-rpm
+  needs:
+    - job: build-fedora-42-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:fedora-42-amd64
 
 pkg-ubuntu-18.04-amd64:
   <<: *pkg-deb-legacy
-  needs: [build-ubuntu-18_04-amd64]
+  needs:
+    - job: build-ubuntu-18.04-amd64
+      artifacts: false
+    - job: build-release
   image: registry.nic.cz/labs/bird:ubuntu-18.04-amd64
 
+pkg-debian-10-amd64:
+  <<: *pkg-deb
+  needs:
+    - job: build-debian-10-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:debian-10-amd64
+
+pkg-debian-10-i386:
+  <<: *pkg-deb
+  needs:
+    - job: build-debian-10-i386
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:debian-10-i386
+
+pkg-debian-11-amd64:
+  <<: *pkg-deb
+  needs:
+    - job: build-debian-11-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:debian-11-amd64
+
+pkg-debian-11-i386:
+  <<: *pkg-deb
+  needs:
+    - job: build-debian-11-i386
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:debian-11-i386
+
+pkg-debian-12-amd64:
+  <<: *pkg-deb
+  needs:
+    - job: build-debian-12-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:debian-12-amd64
+
+pkg-debian-12-i386:
+  <<: *pkg-deb
+  needs:
+    - job: build-debian-12-i386
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:debian-12-i386
+
+pkg-debian-testing-amd64:
+  <<: *pkg-deb
+  needs:
+    - job: build-debian-testing-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:debian-testing-amd64
+
+pkg-debian-testing-i386:
+  <<: *pkg-deb
+  needs:
+    - job: build-debian-testing-i386
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:debian-testing-i386
+
 pkg-ubuntu-20.04-amd64:
   <<: *pkg-deb
-  needs: [build-ubuntu-20_04-amd64]
+  needs:
+    - job: build-ubuntu-20.04-amd64
+      artifacts: false
+    - job: build-release
   image: registry.nic.cz/labs/bird:ubuntu-20.04-amd64
 
+pkg-ubuntu-22.04-amd64:
+  <<: *pkg-deb
+  needs:
+    - job: build-ubuntu-22.04-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:ubuntu-22.04-amd64
 
-pkg-ubuntu-21.10-amd64:
+pkg-ubuntu-24.04-amd64:
   <<: *pkg-deb
-  needs: [build-ubuntu-21_10-amd64]
-  image: registry.nic.cz/labs/bird:ubuntu-21.10-amd64
+  needs:
+    - job: build-ubuntu-24.04-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:ubuntu-24.04-amd64
 
-#pkg-ubuntu-21.04-amd64:
-#  <<: *pkg-deb
-#  needs: [build-ubuntu-21_04-amd64]
-#  image: registry.nic.cz/labs/bird:ubuntu-21.04-amd64
+pkg-ubuntu-24.10-amd64:
+  <<: *pkg-deb
+  needs:
+    - job: build-ubuntu-24.10-amd64
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:ubuntu-24.10-amd64
 
-pkg-opensuse-15.1-amd64:
-  <<: *pkg-rpm-wa
-  needs: [build-opensuse-15.1-amd64]
-  image: registry.nic.cz/labs/bird:opensuse-15.1-amd64
 
-pkg-opensuse-15.2-amd64:
-  <<: *pkg-rpm-wa
-  needs: [build-opensuse-15.2-amd64]
-  image: registry.nic.cz/labs/bird:opensuse-15.2-amd64
+###################################
+## Non-linux build tests in QEMU ##
+###################################
+.build-birdlab-base: &build-birdlab-base
+  <<: *build-base
+  stage: build
+#  script:
+#    - export BRANCH=$CI_COMMIT_BRANCH
+#    - autoreconf
+#    - ./configure $CONFIGURE_OPTIONS
+#    - gmake
+#    - gmake check
 
-pkg-opensuse-15.3-amd64:
-  <<: *pkg-rpm-wa
-  needs: [build-opensuse-15.3-amd64]
-  image: registry.nic.cz/labs/bird:opensuse-15.3-amd64
 
+build-birdlab-openbsd-75:
+  <<: *build-birdlab-base
+  variables:
+    AUTOCONF_VERSION: '2.71'
+  tags:
+    - birdlab-openbsd-75
+    - amd64
+
+build-birdlab-openbsd-76:
+  <<: *build-birdlab-base
+  variables:
+    AUTOCONF_VERSION: '2.72'
+  tags:
+    - birdlab-openbsd-76
+    - amd64
+
+build-birdlab-netbsd-09:
+  <<: *build-birdlab-base
+  tags:
+    - birdlab-netbsd-09
+    - amd64
+
+build-birdlab-netbsd-10:
+  <<: *build-birdlab-base
+  tags:
+    - birdlab-netbsd-10
+    - amd64
+
+build-birdlab-freebsd-13:
+  <<: *build-birdlab-base
+  tags:
+    - birdlab-freebsd-13
+    - amd64
+
+build-birdlab-freebsd-13-netlink:
+  <<: *build-birdlab-base
+  variables:
+    CONFIGURE_OPTIONS: --with-sysconfig=bsd-netlink --disable-client
+  tags:
+    - birdlab-freebsd-13
+    - amd64
+
+build-birdlab-freebsd-14:
+  <<: *build-birdlab-base
+  tags:
+    - birdlab-freebsd-14
+    - amd64
+
+build-birdlab-freebsd-14-netlink:
+  <<: *build-birdlab-base
+  variables:
+    CONFIGURE_OPTIONS: --with-sysconfig=bsd-netlink --disable-client
+  tags:
+    - birdlab-freebsd-14
+    - amd64
+
+
+#########################
+## Partial build tests ##
+#########################
+
+.build-only: &build-only
+  <<: *build-docker-linux-amd64
+  image: registry.nic.cz/labs/bird:debian-12-amd64
+  needs:
+    - job: docker-debian-12-amd64
+      optional: true
+
+
+partial-build-linux-aggregator:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=aggregator
+
+partial-build-linux-babel:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=babel
+
+partial-build-linux-bfd:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=bfd
+
+partial-build-linux-bgp:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=bgp
+
+partial-build-linux-bgp,bmp:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=bgp,bmp
+
+partial-build-linux-l3vpn:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=l3vpn
+
+partial-build-linux-mrt:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=mrt
+
+partial-build-linux-ospf:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=ospf
+
+partial-build-linux-pipe:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=pipe
+
+partial-build-linux-radv:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=radv
+
+partial-build-linux-rip:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=rip
+
+partial-build-linux-rpki:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=rpki
+
+partial-build-linux-static:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols=static
+
+
+################################
+## Netlab functionality tests ##
+################################
 
 build-netlab:
+  <<: *test-job
   stage: build
   variables:
     BDIR: build-netlab
@@ -337,14 +1097,15 @@ build-netlab:
     - mkdir $BDIR
     - cd $BDIR
     - ../configure
-    - make
+    - BRANCH=$CI_COMMIT_BRANCH make
   artifacts:
     paths:
       - $BDIR/bird
       - $BDIR/birdc
     expire_in: 2 hours
 
-.test: &test-base
+.netlab-test: &test-base
+  <<: *test-job
   stage: test
   needs: [build-netlab]
   tags:
@@ -355,12 +1116,23 @@ build-netlab:
     - cd $TOOLS_DIR
     - sudo git clean -fx
     - git pull --ff-only
-    - mv $DIR/build-netlab/* netlab/common/
+    - "mv $DIR/build-netlab/* netlab/common/"
     - ln -s $STAYRTR_BINARY netlab/common/stayrtr
     - cd netlab
     - sudo ./stop
     - sudo ./runtest -s v3 -m check $TEST_NAME
 
+
+test-babel-base:
+  <<: *test-base
+  variables:
+    TEST_NAME: cf-babel-base
+
+test-babel-auth:
+  <<: *test-base
+  variables:
+    TEST_NAME: cf-babel-auth
+
 test-ospf-base:
   <<: *test-base
   variables:
@@ -441,6 +1213,16 @@ test-bgp-rs-multitab:
   variables:
     TEST_NAME: cf-bgp-rs-multitab
 
+test-bgp-rs-singletab:
+  <<: *test-base
+  variables:
+    TEST_NAME: cf-bgp-rs-singletab
+
+test-ebgp-graceful:
+  <<: *test-base
+  variables:
+    TEST_NAME: cf-ebgp-graceful
+
 test-ebgp-loop:
   <<: *test-base
   variables:
@@ -456,11 +1238,6 @@ test-ebgp-role:
   variables:
     TEST_NAME: cf-ebgp-role
 
-test-ebgp-graceful:
-  <<: *test-base
-  variables:
-    TEST_NAME: cf-ebgp-graceful
-
 test-ebgp-import-limit:
   <<: *test-base
   variables:
@@ -471,25 +1248,15 @@ test-ibgp-loop:
   variables:
     TEST_NAME: cf-ibgp-loop
 
-#test-ibgp-loop-big:
-#  <<: *test-base
-#  variables:
-#    TEST_NAME: cf-ibgp-loop-big
-#
-test-ibgp-flat:
+test-ibgp-loop-big:
   <<: *test-base
   variables:
-    TEST_NAME: cf-ibgp-flat
+    TEST_NAME: cf-ibgp-loop-big
 
-test-babel-base:
-  <<: *test-base
-  variables:
-    TEST_NAME: cf-babel-base
-
-test-babel-auth:
+test-ibgp-flat:
   <<: *test-base
   variables:
-    TEST_NAME: cf-babel-auth
+    TEST_NAME: cf-ibgp-flat
 
 test-rip-base:
   <<: *test-base
@@ -511,43 +1278,3 @@ test-mpls-bgp-l3vpn:
   variables:
     TEST_NAME: cf-mpls-bgp-l3vpn
 
-
-.build-birdlab-base: &build-birdlab-base
-  stage: build
-  script:
-    - autoreconf
-    - ./configure
-    - gmake
-    - gmake check
-
-build-birdlab-debian-11:
-  <<: *build-birdlab-base
-  tags:
-    - birdlab-debian-11
-    - amd64
-
-build-birdlab-centos-08:
-  <<: *build-birdlab-base
-  tags:
-    - birdlab-centos-08
-    - amd64
-
-build-birdlab-fedora-37:
-  <<: *build-birdlab-base
-  tags:
-    - birdlab-fedora-37
-    - amd64
-
-build-birdlab-freebsd-13:
-  <<: *build-birdlab-base
-  tags:
-    - birdlab-freebsd-13
-    - amd64
-
-build-birdlab-openbsd-71:
-  <<: *build-birdlab-base
-  variables:
-     AUTOCONF_VERSION: "2.71"
-  tags:
-    - birdlab-openbsd-71
-    - amd64
index 29e627e1f439c70f81edf160c4bf640b3641dc51..616f80608a2fbe39f9d0bacad013a8ebda383d2b 100644 (file)
@@ -1,6 +1,6 @@
 # Makefile for the BIRD Internet Routing Daemon
 # (c) 1999--2000 Martin Mares <mj@ucw.cz>
-# (c) 2016       Jan Moskyto Matejka <mq@ucw.cz>
+# (c) 2016--2025 Maria Matejka <mq@ucw.cz>
 
 # Disable build-in rules
 MAKEFLAGS += -r
@@ -42,10 +42,11 @@ srcdir := @srcdir@
 objdir := @objdir@
 exedir := @exedir@
 
-git-label:=$(strip $(shell cd $(srcdir) && [ "$$(git rev-parse --show-toplevel)" = "$$(readlink -f .)" ] && git describe --always --dirty=-x 2>/dev/null))
-ifneq ($(git-label),)
-        CFLAGS += -DGIT_LABEL="$(git-label)"
-endif
+# Find out which version we are actually building
+# This is rewritten by the release tools by hardcoded version
+VERSION := $(strip $(shell $(srcdir)/tools/version))
+
+CFLAGS += -DBIRD_VERSION='"$(VERSION)"'
 
 ifeq ($(objdir),.)
   objdir := $(realpath .)
@@ -67,7 +68,7 @@ endif
 docgoals := docs userdocs progdocs
 testgoals := check test tests tests_run
 cleangoals := clean distclean testsclean
-.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags cscope prepare
+.PHONY: all daemon cli $(docgoals) $(testgoals) $(cleangoals) tags cscope prepare gitlab
 
 all: daemon cli
 
@@ -159,7 +160,7 @@ $(objdir)/.dir-stamp: Makefile
 
 $(client) $(daemon):
        $(E)echo LD $(LDFLAGS) -o $@ $^ $(LIBS)
-       $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+       +$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 
 $(objdir)/sysdep/paths.h: Makefile
        $(E)echo GEN $@
@@ -174,7 +175,7 @@ tests_targets_ok = $(addsuffix .ok,$(tests_targets))
 
 $(tests_targets): %: %.o $(tests_objs) | prepare
        $(E)echo LD $(LDFLAGS) -o $@ $< "..." $(LIBS)
-       $(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+       +$(Q)$(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
 
 # Hack to avoid problems with tests linking everything
 $(tests_targets): LIBS += $(DAEMON_LIBS)
@@ -202,6 +203,18 @@ tags:
 cscope:
        cd $(srcdir) ; find $(dirs) -name '*.[chY]' > cscope.files ; cscope -b
 
+# Gitlab CI tests
+gitlab: .gitlab-ci.yml
+.gitlab-ci.yml: $(addprefix misc/gitlab/,pipeline.py data.yml.j2 template.yml.j2)
+       ( \
+               VENV=$$(mktemp -d); \
+               python3 -m venv $$VENV; \
+               . $$VENV/bin/activate; \
+               pip3 install jinja2 pyaml; \
+               python3 misc/gitlab/pipeline.py > $@ \
+               rm -rf $$VENV \
+               )
+
 # Install
 
 install: all
diff --git a/VERSION b/VERSION
new file mode 100644 (file)
index 0000000..b502146
--- /dev/null
+++ b/VERSION
@@ -0,0 +1 @@
+3.0.2
index ac1a75b0a106ecd887645fe327c67c46fbb09f8a..52d22b16d3139583add23e3a1e150e13ef8cc9aa 100644 (file)
@@ -25,7 +25,7 @@ or in case of disposable VM/container you can use faster direct host build
 
     apkg build -Hi
 
-tools/make-dev-archive script is in charge of creating archive from source.
+tools/make-archive script is in charge of creating archive from source.
 
 
 ## Create (source) package from upstream release
index 73a79a3be262a01247adb2499c560d9587f537d6..8766f3641cde8cc72eecbe42a81d2f629327d55b 100644 (file)
@@ -1,7 +1,7 @@
 [project]
 name = "bird"
 # needed for make-archive
-make_archive_script = "tools/make-dev-archive"
+make_archive_script = "tools/make-archive"
 
 [upstream]
 # needed for get-archive
index 588b8634fe048072aec239761df3c494980e11c7..12471f84463830a72bdb0e73ff418f114d0fa056 100644 (file)
@@ -20,7 +20,7 @@ $(o)prog.sgml: $(srcdir)/tools/progdoc $(objdir)/.dir-stamp
        $(srcdir)/tools/progdoc $(srcdir) $@
 
 $(o)%.sgml: $(s)%.sgml $(objdir)/.dir-stamp
-       cp $< $@
+       sed 's#{{ VERSION }}#$(VERSION)#' <$< >$@
 
 $(o)%.html: $(o)%.sgml
        cd $(dir $@) && $(toolsdir)/linuxdoc -B html $(notdir $<)
@@ -36,7 +36,7 @@ $(o)%.md: $(o)%.sgml $(LINUXDOC_PANDOC_PARSER) $(objdir)/.dir-stamp
        $(PANDOC) -f $(LINUXDOC_PANDOC_PARSER) -s -t markdown -o $@ $<
 
 $(o)%-singlepage.html: $(o)%.sgml $(SINGLEPAGE_HTML_TEMPLATE) $(LINUXDOC_PANDOC_PARSER) $(objdir)/.dir-stamp
-       $(PANDOC) -f $(LINUXDOC_PANDOC_PARSER) -t html5 --shift-heading-level-by=1 --section-divs --table-of-contents --toc-depth=3 -M bird_version="3.0.2" --template=$(SINGLEPAGE_HTML_TEMPLATE) -o $@ $<
+       $(PANDOC) -f $(LINUXDOC_PANDOC_PARSER) -t html5 --shift-heading-level-by=1 --section-divs --table-of-contents --toc-depth=3 -M bird_version="$(VERSION)" --template=$(SINGLEPAGE_HTML_TEMPLATE) -o $@ $<
 
 endif
 
index 180ec2852ee6295af6744d3902f636b9eb7b3bda..c86c6291982df2e82da3ed6cb6aa08c7d272cc69 100644 (file)
@@ -1,7 +1,7 @@
 <!doctype birddoc system>
 
 <!--
-       BIRD 3.0 documentation
+       BIRD documentation
 
 This documentation can have 4 forms: sgml (this is master copy), html, ASCII
 text and dvi/postscript (generated from sgml using sgmltools). You should always
@@ -20,7 +20,7 @@ configuration - something in config which is not keyword.
 
 <book>
 
-<title>BIRD 3.0 User's Guide
+<title>BIRD {{ VERSION }} User's Guide
 <author>
 Ondrej Filip <it/&lt;feela@network.cz&gt;/,
 Martin Mares <it/&lt;mj@ucw.cz&gt;/,
diff --git a/misc/docker/README.md b/misc/docker/README.md
new file mode 100644 (file)
index 0000000..5efb0c3
--- /dev/null
@@ -0,0 +1,48 @@
+# Docker files for our test machinery
+
+**These files are not distribution files for running BIRD. We currently
+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.
+
+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.
+
+## Debian-based distributions
+
+We support Debian between oldoldstable and testing. If not, poke us.
+
+We support Ubuntu LTS at least 5 years old and non-LTS before EOL. After EOL,
+the non-LTS package repositories tend to disappear quite quickly so we don't
+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.
+
+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 currently don't package for Arch or Gentoo. Contributions are open, please
+refer to `CONTRIBUTING.md` for further information.
+
+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.
+
+## FreeBSD and OpenBSD
+
+These are not built in Docker but in proper virtuals in QEMU, refer to
+<https://gitlab.nic.cz/labs/bird-tools/-/tree/master/birdlab-tmp>
diff --git a/misc/docker/centos-6-amd64/Dockerfile b/misc/docker/centos-6-amd64/Dockerfile
deleted file mode 100644 (file)
index d92f64f..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM centos:6
-RUN yum -y upgrade
-RUN yum -y install \
-       autoconf \
-       flex \
-       bison \
-       pkgconfig \
-       'readline-devel' \
-       'pkgconfig(ncurses)' \
-       gcc \
-       make
index bef04b00ae8d9707894a247d737f9c6a6286ee36..0efed416705282e80236a194eae61343dcdd2187 100644 (file)
@@ -1,5 +1,28 @@
+# bump number for image rebuild: 0
 FROM centos:7
+
+# Has to be done for yum to work properly. CentOS 7 is EOL.
+RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/CentOS-*.repo
+RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/CentOS-*.repo
+RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/CentOS-*.repo
+
+# Add new repos for devtoolset-8-gcc.
+# We need to use devtoolset, because BIRD cannot be correctly compiled with CentOS 7 version of gcc.
+RUN echo -e \
+       "\n[centos-sclo-rh]\nname=CentOS-7.8.2003 - SCLo rh\nbaseurl=https://vault.centos.org/7.8.2003/sclo/\$basearch/rh/\ngpgcheck=0\nenabled=1" \
+       >> /etc/yum.repos.d/CentOS-Base.repo
+RUN echo -e \
+       "\n[centos-sclo-sclo]\nname=CentOS-7.8.2003 - SCLo sclo\nbaseurl=https://vault.centos.org/7.8.2003/sclo/\$basearch/sclo/\ngpgcheck=0\nenabled=1" \
+       >> /etc/yum.repos.d/CentOS-Base.repo
+
 RUN yum -y upgrade
+
+# Change kernel-headers
+RUN yum -y remove \
+       kernel-headers
+RUN yum -y install \
+       https://dl.lamp.sh/kernel/el7/kernel-ml-headers-6.6.41-1.el7.x86_64.rpm
+
 RUN yum -y install \
        gcc \
        make \
@@ -8,11 +31,17 @@ RUN yum -y install \
        autoconf \
        libssh-devel \
        ncurses-devel \
-       readline-devel
+       readline-devel \
+       centos-release-scl
+
 RUN yum -y install \
        git \
        rpm-build \
-       systemd \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       devtoolset-8-toolchain
+
+# Backported newer RPM macros, hoping that it stays there for some while until we drop CentOS 7 support
+RUN yum -y install \
+       ftp://ftp.icm.edu.pl/packages/linux-pbone/ftp5.gwdg.de/pub/opensuse/repositories/systemsmanagement:/Ardana:/8:/CentOS/CentOS_7.3/noarch/systemd-rpm-macros-3-5.2.noarch.rpm
index 3bc5acc393a05f282ce74b02bd15c58528bb678d..667d99e597b363ccb8f7c84e21114345055a7f90 100644 (file)
@@ -1,4 +1,11 @@
+# bump number for image rebuild: 0
 FROM centos:8
+
+# Has to be done for yum to work properly. CentOS 8 is EOL.
+RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/CentOS-*.repo
+RUN sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/CentOS-*.repo
+RUN sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/CentOS-*.repo
+
 RUN yum -y upgrade
 RUN yum -y install \
        gcc \
index a241bb238db2897faad33edab749ec349369f5f6..1e281a0d1c2c6755ac7283e78158e39ff4948f52 100644 (file)
@@ -1,6 +1,6 @@
+# bump number for image rebuild: 0
 FROM debian:buster-slim
-ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
+ENV DEBIAN_FRONTEND=noninteractive
 RUN apt-get -y update
 RUN apt-get -y upgrade
 RUN apt-get -y --no-install-recommends install \
@@ -23,4 +23,5 @@ RUN apt-get -y --no-install-recommends install \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
index 6b28a20a25fee009a27e919a1f7e476fbf22bb2f..e3c164e8c522da7213196f71b51fdc9b070cbe55 100644 (file)
@@ -1,6 +1,6 @@
+# bump number for image rebuild: 0
 FROM i386/debian:buster-slim
-ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
+ENV DEBIAN_FRONTEND=noninteractive
 RUN apt-get -y update
 RUN apt-get -y upgrade
 RUN apt-get -y --no-install-recommends install \
@@ -20,7 +20,9 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       apt-utils \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
index a9aee7e9dd8d0182c77cc5c721c5f6b63df3c076..94f2a54de7842111624302b03440db9159bebd06 100644 (file)
@@ -1,6 +1,6 @@
+# bump number for image rebuild: 0
 FROM amd64/debian:bullseye-slim
 ENV DEBIAN_FRONTEND=noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
 RUN apt-get -y update
 RUN apt-get -y upgrade
 RUN apt-get -y --no-install-recommends install \
@@ -20,7 +20,9 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       apt-utils \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
index 5b5ad5a369131e450dd52c13a335890284aa6372..1fcbc37d7f26cffcefaf5bd73f21227c6c3d1545 100644 (file)
@@ -1,7 +1,8 @@
+# bump number for image rebuild: 1
 FROM i386/debian:bullseye-slim
 ENV DEBIAN_FRONTEND=noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
-RUN apt-get -y update && apt-get -y upgrade
+RUN apt-get -y update
+RUN apt-get -y upgrade
 RUN apt-get -y --no-install-recommends install \
        build-essential \
        flex \
@@ -19,7 +20,9 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       apt-utils \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
similarity index 72%
rename from misc/docker/debian-9-amd64/Dockerfile
rename to misc/docker/debian-12-amd64/Dockerfile
index 4e8603f09020b6bea15e705dfed8d77c9168dbe5..cdee03f999b08e6a106149d72aa4ba10e3e1372e 100644 (file)
@@ -1,6 +1,6 @@
-FROM debian:stretch-slim
-ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
+# bump number for image rebuild: 2
+FROM amd64/debian:bookworm-slim
+ENV DEBIAN_FRONTEND=noninteractive
 RUN apt-get -y update
 RUN apt-get -y upgrade
 RUN apt-get -y --no-install-recommends install \
@@ -20,7 +20,9 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       apt-utils \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
similarity index 71%
rename from misc/docker/debian-9-i386/Dockerfile
rename to misc/docker/debian-12-i386/Dockerfile
index d37a742da0be1613e72d1c72523280bf505ba3f8..906f9fa5c9d406f3dd16e58547db52049c596a87 100644 (file)
@@ -1,6 +1,6 @@
-FROM i386/debian:stretch-slim
-ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
+# bump number for image rebuild: 1
+FROM i386/debian:bookworm-slim
+ENV DEBIAN_FRONTEND=noninteractive
 RUN apt-get -y update
 RUN apt-get -y upgrade
 RUN apt-get -y --no-install-recommends install \
@@ -20,7 +20,9 @@ RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
+       apt-utils \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
diff --git a/misc/docker/debian-7-amd64/Dockerfile b/misc/docker/debian-7-amd64/Dockerfile
deleted file mode 100644 (file)
index 9510e9c..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM debian:wheezy-slim
-ENV DEBIAN_FRONTEND noninteractive
-RUN echo 'deb http://archive.debian.org/debian/ wheezy main' > /etc/apt/sources.list
-RUN echo 'deb http://archive.debian.org/debian-security/ wheezy/updates main' >> /etc/apt/sources.list
-RUN apt-get -y update -o Acquire::Check-Valid-Until=false
-RUN apt-get -y upgrade
-RUN apt-get -y install \
-       build-essential \
-       flex \
-       bison \
-       autoconf \
-       ncurses-dev \
-       libreadline-dev
diff --git a/misc/docker/debian-7-i386/Dockerfile b/misc/docker/debian-7-i386/Dockerfile
deleted file mode 100644 (file)
index d47d8e0..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-FROM i386/debian:wheezy-slim
-ENV DEBIAN_FRONTEND noninteractive
-RUN echo 'deb http://archive.debian.org/debian/ wheezy main' > /etc/apt/sources.list
-RUN echo 'deb http://archive.debian.org/debian-security/ wheezy/updates main' >> /etc/apt/sources.list
-RUN apt-get -y update -o Acquire::Check-Valid-Until=false
-RUN apt-get -y upgrade
-RUN apt-get -y install \
-       build-essential \
-       flex \
-       bison \
-       autoconf \
-       ncurses-dev \
-       libreadline-dev
diff --git a/misc/docker/debian-8-amd64/Dockerfile b/misc/docker/debian-8-amd64/Dockerfile
deleted file mode 100644 (file)
index d952013..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-FROM debian:jessie-slim
-ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
-RUN apt-get -y update
-RUN apt-get -y upgrade
-RUN apt-get -y install \
-       build-essential \
-       flex \
-       bison \
-       autoconf \
-       ncurses-dev \
-       libreadline-dev
diff --git a/misc/docker/debian-8-i386/Dockerfile b/misc/docker/debian-8-i386/Dockerfile
deleted file mode 100644 (file)
index 349fcee..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-FROM i386/debian:jessie-slim
-ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
-RUN apt-get -y update
-RUN apt-get -y upgrade
-RUN apt-get -y install \
-       build-essential \
-       flex \
-       bison \
-       autoconf \
-       ncurses-dev \
-       libreadline-dev
index 6d7bbbeba395f757db7c983c76b2ac64bbca3f24..f40e8c4fe3fe743ab895cd6772bd4d98984263ef 100644 (file)
@@ -1,12 +1,28 @@
+# bump number for image rebuild: 0
 FROM debian:testing-slim
 ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
 RUN apt-get -y update
 RUN apt-get -y upgrade
-RUN apt-get -y install \
+RUN apt-get -y --no-install-recommends install \
        build-essential \
        flex \
        bison \
        autoconf \
        ncurses-dev \
-       libreadline-dev
+       libreadline-dev \
+       libssh-dev \
+       linuxdoc-tools-latex \
+       texlive-latex-extra \
+       opensp \
+       docbook-xsl \
+       xsltproc
+RUN apt-get -y --no-install-recommends install \
+       git \
+       dpkg-dev \
+       debhelper \
+       apt-utils \
+       quilt \
+       python3 \
+       python3-pip \
+       python3-setuptools \
+       python3-venv
index 3d6a969cc977006f34ddd2256e958894a043c7d5..866738d61fc9ffe9c228a8e468ac1acb7f264909 100644 (file)
@@ -1,12 +1,28 @@
+# bump number for image rebuild: 0
 FROM i386/debian:testing-slim
 ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
 RUN apt-get -y update
 RUN apt-get -y upgrade
-RUN apt-get -y install \
+RUN apt-get -y --no-install-recommends install \
        build-essential \
        flex \
        bison \
        autoconf \
        ncurses-dev \
-       libreadline-dev
+       libreadline-dev \
+       libssh-dev \
+       linuxdoc-tools-latex \
+       texlive-latex-extra \
+       opensp \
+       docbook-xsl \
+       xsltproc
+RUN apt-get -y --no-install-recommends install \
+       git \
+       dpkg-dev \
+       debhelper \
+       apt-utils \
+       quilt \
+       python3 \
+       python3-pip \
+       python3-setuptools \
+       python3-venv
diff --git a/misc/docker/docbuilder/Dockerfile b/misc/docker/docbuilder/Dockerfile
new file mode 100644 (file)
index 0000000..464ec30
--- /dev/null
@@ -0,0 +1,30 @@
+# bump this to recreate the image: 2
+FROM debian:bookworm-slim
+ENV DEBIAN_FRONTEND=noninteractive
+RUN apt-get -y update
+RUN apt-get -y upgrade
+RUN apt-get -y --no-install-recommends install \
+       build-essential \
+       flex \
+       bison \
+       autoconf \
+       git \
+       pandoc \
+       ncurses-dev \
+       libreadline-dev \
+       libssh-gcrypt-dev \
+       linuxdoc-tools-latex \
+       texlive-latex-extra \
+       groff \
+       opensp \
+       docbook-xsl \
+       xsltproc
+RUN apt-get -y --no-install-recommends install \
+       dpkg-dev \
+       debhelper \
+       apt-utils \
+       quilt \
+       python3 \
+       python3-pip \
+       python3-setuptools \
+       python3-venv
diff --git a/misc/docker/fedora-25-amd64/Dockerfile b/misc/docker/fedora-25-amd64/Dockerfile
deleted file mode 100644 (file)
index d0dd8f6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM fedora:25
-RUN dnf -y upgrade
-RUN dnf -y install \
-       make \
-       autoconf \
-       flex \
-       bison \
-       pkgconfig \
-       'readline-devel' \
-       'pkgconfig(ncurses)' \
-       gcc
diff --git a/misc/docker/fedora-26-amd64/Dockerfile b/misc/docker/fedora-26-amd64/Dockerfile
deleted file mode 100644 (file)
index f15ba40..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM fedora:26
-RUN dnf -y upgrade
-RUN dnf -y install \
-       make \
-       autoconf \
-       flex \
-       bison \
-       pkgconfig \
-       'readline-devel' \
-       'pkgconfig(ncurses)' \
-       gcc
diff --git a/misc/docker/fedora-27-amd64/Dockerfile b/misc/docker/fedora-27-amd64/Dockerfile
deleted file mode 100644 (file)
index e317459..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM fedora:27
-RUN dnf -y upgrade
-RUN dnf -y install \
-       make \
-       autoconf \
-       flex \
-       bison \
-       pkgconfig \
-       'readline-devel' \
-       'pkgconfig(ncurses)' \
-       gcc
diff --git a/misc/docker/fedora-28-amd64/Dockerfile b/misc/docker/fedora-28-amd64/Dockerfile
deleted file mode 100644 (file)
index 0aa2f74..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM fedora:28
-RUN dnf -y upgrade
-RUN dnf -y install \
-       make \
-       autoconf \
-       flex \
-       bison \
-       pkgconfig \
-       'readline-devel' \
-       'pkgconfig(ncurses)' \
-       gcc
diff --git a/misc/docker/fedora-29-amd64/Dockerfile b/misc/docker/fedora-29-amd64/Dockerfile
deleted file mode 100644 (file)
index afc1f0c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-FROM fedora:29
-RUN dnf -y upgrade
-RUN dnf -y install \
-       make \
-       autoconf \
-       flex \
-       bison \
-       pkgconfig \
-       'readline-devel' \
-       'pkgconfig(ncurses)' \
-       gcc
index 609dbf33e9fea908965189bddd16501ccd3e7246..bd27593001a35fe3492c590e07e793abb893ffc3 100644 (file)
@@ -1,11 +1,13 @@
+# bump number for image rebuild: 0
 FROM fedora:32
-RUN dnf -y update
+RUN dnf -y upgrade
 RUN dnf -y install \
        gcc \
        make \
        flex \
        bison \
        autoconf \
+       pkgconfig \
        libssh-devel \
        ncurses-devel \
        readline-devel
index 7e7070687323dcbc8d926655606952719bf7a601..08efe2f8c15623f1eb4342c4c6c12bb05afc9422 100644 (file)
@@ -1,3 +1,4 @@
+# bump number for image rebuild: 0
 FROM fedora:33
 RUN dnf -y upgrade
 RUN dnf -y install \
@@ -6,6 +7,7 @@ RUN dnf -y install \
        flex \
        bison \
        autoconf \
+       pkgconfig \
        libssh-devel \
        ncurses-devel \
        readline-devel
index 6bd775296db8c3877f143a5df3fdb69a64d0c908..f39087b7e2f09a6955bf593f140cd10063dd02dd 100644 (file)
@@ -1,3 +1,4 @@
+# bump number for image rebuild: 0
 FROM fedora:34
 RUN dnf -y upgrade
 RUN dnf -y install \
@@ -6,6 +7,7 @@ RUN dnf -y install \
        flex \
        bison \
        autoconf \
+       pkgconfig \
        libssh-devel \
        ncurses-devel \
        readline-devel
similarity index 73%
rename from misc/docker/fedora-30-amd64/Dockerfile
rename to misc/docker/fedora-35-amd64/Dockerfile
index d9aaa62a2699254cb0ee79056d3bfdf9028dfd25..ff728bd1a8824232c7559674be14639f22bab2d9 100644 (file)
@@ -1,11 +1,13 @@
-FROM fedora:30
-RUN dnf -y update
+# bump number for image rebuild: 0
+FROM fedora:35
+RUN dnf -y upgrade
 RUN dnf -y install \
        gcc \
        make \
        flex \
        bison \
        autoconf \
+       pkgconfig \
        libssh-devel \
        ncurses-devel \
        readline-devel
similarity index 73%
rename from misc/docker/fedora-31-amd64/Dockerfile
rename to misc/docker/fedora-36-amd64/Dockerfile
index 9f7ad0cd717444cc6b772803c767116a576e947d..eb98def6f73d1fe4e1be69fe7147177096cf1ce9 100644 (file)
@@ -1,11 +1,13 @@
-FROM fedora:31
-RUN dnf -y update
+# bump number for image rebuild: 0
+FROM fedora:36
+RUN dnf -y upgrade
 RUN dnf -y install \
        gcc \
        make \
        flex \
        bison \
        autoconf \
+       pkgconfig \
        libssh-devel \
        ncurses-devel \
        readline-devel
diff --git a/misc/docker/fedora-37-amd64/Dockerfile b/misc/docker/fedora-37-amd64/Dockerfile
new file mode 100644 (file)
index 0000000..a8003d2
--- /dev/null
@@ -0,0 +1,20 @@
+# bump number for image rebuild: 0
+FROM fedora:37
+RUN dnf -y upgrade
+RUN dnf -y install \
+       gcc \
+       make \
+       flex \
+       bison \
+       autoconf \
+       pkgconfig \
+       libssh-devel \
+       ncurses-devel \
+       readline-devel
+RUN dnf -y install \
+       git \
+       rpm-build \
+       systemd-rpm-macros \
+       python3 \
+       python3-pip \
+       python3-setuptools
diff --git a/misc/docker/fedora-38-amd64/Dockerfile b/misc/docker/fedora-38-amd64/Dockerfile
new file mode 100644 (file)
index 0000000..1ef81e7
--- /dev/null
@@ -0,0 +1,20 @@
+# bump number for image rebuild: 0
+FROM fedora:38
+RUN dnf -y upgrade
+RUN dnf -y install \
+       gcc \
+       make \
+       flex \
+       bison \
+       autoconf \
+       pkgconfig \
+       libssh-devel \
+       ncurses-devel \
+       readline-devel
+RUN dnf -y install \
+       git \
+       rpm-build \
+       systemd-rpm-macros \
+       python3 \
+       python3-pip \
+       python3-setuptools
diff --git a/misc/docker/fedora-39-amd64/Dockerfile b/misc/docker/fedora-39-amd64/Dockerfile
new file mode 100644 (file)
index 0000000..e986bf2
--- /dev/null
@@ -0,0 +1,20 @@
+# bump number for image rebuild: 0
+FROM fedora:39
+RUN dnf -y upgrade
+RUN dnf -y install \
+       gcc \
+       make \
+       flex \
+       bison \
+       autoconf \
+       pkgconfig \
+       libssh-devel \
+       ncurses-devel \
+       readline-devel
+RUN dnf -y install \
+       git \
+       rpm-build \
+       systemd-rpm-macros \
+       python3 \
+       python3-pip \
+       python3-setuptools
diff --git a/misc/docker/fedora-40-amd64/Dockerfile b/misc/docker/fedora-40-amd64/Dockerfile
new file mode 100644 (file)
index 0000000..ab2c532
--- /dev/null
@@ -0,0 +1,20 @@
+# bump number for image rebuild: 0
+FROM fedora:40
+RUN dnf -y upgrade
+RUN dnf -y install \
+       gcc \
+       make \
+       flex \
+       bison \
+       autoconf \
+       pkgconfig \
+       libssh-devel \
+       ncurses-devel \
+       readline-devel
+RUN dnf -y install \
+       git \
+       rpm-build \
+       systemd-rpm-macros \
+       python3 \
+       python3-pip \
+       python3-setuptools
diff --git a/misc/docker/fedora-41-amd64/Dockerfile b/misc/docker/fedora-41-amd64/Dockerfile
new file mode 100644 (file)
index 0000000..6d9b80d
--- /dev/null
@@ -0,0 +1,20 @@
+# bump number for image rebuild: 0
+FROM fedora:41
+RUN dnf -y upgrade
+RUN dnf -y install \
+       gcc \
+       make \
+       flex \
+       bison \
+       autoconf \
+       pkgconfig \
+       libssh-devel \
+       ncurses-devel \
+       readline-devel
+RUN dnf -y install \
+       git \
+       rpm-build \
+       systemd-rpm-macros \
+       python3 \
+       python3-pip \
+       python3-setuptools
diff --git a/misc/docker/fedora-42-amd64/Dockerfile b/misc/docker/fedora-42-amd64/Dockerfile
new file mode 100644 (file)
index 0000000..bc8ac5c
--- /dev/null
@@ -0,0 +1,20 @@
+# bump number for image rebuild: 0
+FROM fedora:42
+RUN dnf -y upgrade
+RUN dnf -y install \
+       gcc \
+       make \
+       flex \
+       bison \
+       autoconf \
+       pkgconfig \
+       libssh-devel \
+       ncurses-devel \
+       readline-devel
+RUN dnf -y install \
+       git \
+       rpm-build \
+       systemd-rpm-macros \
+       python3 \
+       python3-pip \
+       python3-setuptools
index b1faff40921f06603e3bfb586036e2c92e421e05..b0653b37f02f74da97123f6ba8eca46a19f4e186 100644 (file)
@@ -1,11 +1,21 @@
+# bump number for image rebuild: 0
 FROM opensuse/leap:15.0
 RUN zypper -n up
 RUN zypper -n install \
-       autoconf \
+       gcc \
+       make \
        flex \
        bison \
+       autoconf \
        pkgconfig \
-       readline-devel \
+       libssh-devel \
        ncurses-devel \
-       gcc \
-       gmake
+       readline-devel
+RUN zypper -n install \
+       git \
+       rpm-build \
+       systemd \
+       systemd-rpm-macros \
+       python3 \
+       python3-pip \
+       python3-setuptools
index 77a0455d20395a23ff9767f6da31b6c7f566ce8e..a467059ea3aaae8b5cdf75462cef02f560bd31f5 100644 (file)
@@ -1,3 +1,4 @@
+# bump number for image rebuild: 0
 FROM opensuse/leap:15.1
 RUN zypper -n up
 RUN zypper -n install \
@@ -6,6 +7,7 @@ RUN zypper -n install \
        flex \
        bison \
        autoconf \
+       pkgconfig \
        libssh-devel \
        ncurses-devel \
        readline-devel
index 44a146db079697a2765c7a0efaf5227f1eb0b3f4..daf48d39fa36d30872ed8146bc297f3883e50d53 100644 (file)
@@ -1,3 +1,4 @@
+# bump number for image rebuild: 0
 FROM opensuse/leap:15.2
 RUN zypper -n up
 RUN zypper -n install \
@@ -6,6 +7,7 @@ RUN zypper -n install \
        flex \
        bison \
        autoconf \
+       pkgconfig \
        libssh-devel \
        ncurses-devel \
        readline-devel
index 9fe8f4c2a2db0cb74e57a20e56f1a9932f937f8c..3ba55208057c3b9c8e18bb8f2740bb25eca77792 100644 (file)
@@ -1,3 +1,4 @@
+# bump number for image rebuild: 0
 FROM opensuse/leap:15.3
 RUN zypper -n up
 RUN zypper -n install \
@@ -6,6 +7,7 @@ RUN zypper -n install \
        flex \
        bison \
        autoconf \
+       pkgconfig \
        libssh-devel \
        ncurses-devel \
        readline-devel
diff --git a/misc/docker/opensuse-15.4-amd64/Dockerfile b/misc/docker/opensuse-15.4-amd64/Dockerfile
new file mode 100644 (file)
index 0000000..3af34e4
--- /dev/null
@@ -0,0 +1,21 @@
+# bump number for image rebuild: 1
+FROM opensuse/leap:15.4
+RUN zypper -n up
+RUN zypper -n install \
+       gcc \
+       make \
+       flex \
+       bison \
+       autoconf \
+       pkgconfig \
+       libssh-devel \
+       ncurses-devel \
+       readline-devel
+RUN zypper -n install \
+       git \
+       rpm-build \
+       systemd \
+       systemd-rpm-macros \
+       python3 \
+       python3-pip \
+       python3-setuptools
diff --git a/misc/docker/opensuse-15.5-amd64/Dockerfile b/misc/docker/opensuse-15.5-amd64/Dockerfile
new file mode 100644 (file)
index 0000000..a3aad6c
--- /dev/null
@@ -0,0 +1,21 @@
+# bump number for image rebuild: 0
+FROM opensuse/leap:15.5
+RUN zypper -n up
+RUN zypper -n install \
+       gcc \
+       make \
+       flex \
+       bison \
+       autoconf \
+       pkgconfig \
+       libssh-devel \
+       ncurses-devel \
+       readline-devel
+RUN zypper -n install \
+       git \
+       rpm-build \
+       systemd \
+       systemd-rpm-macros \
+       python3 \
+       python3-pip \
+       python3-setuptools
diff --git a/misc/docker/ubuntu-14.04-amd64/Dockerfile b/misc/docker/ubuntu-14.04-amd64/Dockerfile
deleted file mode 100644 (file)
index 3532507..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-FROM ubuntu:14.04
-ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
-RUN apt-get -y update
-RUN apt-get -y upgrade
-RUN apt-get -y install \
-       build-essential \
-       flex \
-       bison \
-       autoconf \
-       ncurses-dev \
-       libreadline-dev
diff --git a/misc/docker/ubuntu-16.04-amd64/Dockerfile b/misc/docker/ubuntu-16.04-amd64/Dockerfile
deleted file mode 100644 (file)
index c27aef1..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-FROM ubuntu:16.04
-ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
-RUN apt-get -y update
-RUN apt-get -y upgrade
-RUN apt-get -y install \
-       build-essential \
-       flex \
-       bison \
-       autoconf \
-       ncurses-dev \
-       libreadline-dev
index a1d95317503c9e6f16d553e061ce1cc44b891c1f..92a804378c5f4b930f497d666b21487860eec08f 100644 (file)
@@ -1,9 +1,10 @@
+# bump number for image rebuild: 0
 FROM ubuntu:18.04
 ENV DEBIAN_FRONTEND noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
 RUN apt-get -y update
 RUN apt-get -y upgrade
-RUN apt-get -y install \
+RUN apt-get -y --no-install-recommends install \
+       tzdata \
        build-essential \
        flex \
        bison \
@@ -16,7 +17,7 @@ RUN apt-get -y install \
        opensp \
        docbook-xsl \
        xsltproc
-RUN apt-get -y install \
+RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
@@ -24,4 +25,5 @@ RUN apt-get -y install \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
index fac1b3338ca58cd9d690d2d67962f66100ad1b5a..13e411c225822303b2a19ca0c9dfb5da59d3cfe1 100644 (file)
@@ -1,9 +1,10 @@
+# bump number for image rebuild: 0
 FROM ubuntu:20.04
 ENV DEBIAN_FRONTEND=noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
 RUN apt-get -y update
 RUN apt-get -y upgrade
-RUN apt-get -y install \
+RUN apt-get -y --no-install-recommends install \
+       tzdata \
        build-essential \
        flex \
        bison \
@@ -16,7 +17,7 @@ RUN apt-get -y install \
        opensp \
        docbook-xsl \
        xsltproc
-RUN apt-get -y install \
+RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
@@ -24,4 +25,5 @@ RUN apt-get -y install \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
similarity index 74%
rename from misc/docker/ubuntu-21.10-amd64/Dockerfile
rename to misc/docker/ubuntu-22.04-amd64/Dockerfile
index aa0987b64a7bdf9d1dd95ce3802944fca52a27df..03db8c9499790937fa68d7c14d892ae55f597b3d 100644 (file)
@@ -1,6 +1,6 @@
-FROM ubuntu:21.10
+# bump this to refresh the image: 1
+FROM ubuntu:22.04
 ENV DEBIAN_FRONTEND=noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
 RUN apt-get -y update
 RUN apt-get -y upgrade
 RUN apt-get -y --no-install-recommends install \
@@ -17,7 +17,7 @@ RUN apt-get -y --no-install-recommends install \
        opensp \
        docbook-xsl \
        xsltproc
-RUN apt-get -y install \
+RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
@@ -25,4 +25,5 @@ RUN apt-get -y install \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
similarity index 63%
rename from misc/docker/ubuntu-21.04-amd64/Dockerfile
rename to misc/docker/ubuntu-24.04-amd64/Dockerfile
index 1c32727b1e969ac17462308eca9c9c76c1960ae9..c894bb4622411872eda6e5d1ba8632ef4775198b 100644 (file)
@@ -1,9 +1,10 @@
-FROM ubuntu:21.04
+# bump this to refresh the image: 1
+FROM ubuntu:24.04
 ENV DEBIAN_FRONTEND=noninteractive
-RUN sed -i 's/deb.debian.org/ftp.cz.debian.org/' /etc/apt/sources.list
 RUN apt-get -y update
 RUN apt-get -y upgrade
-RUN apt-get -y install \
+RUN apt-get -y --no-install-recommends install \
+       tzdata \
        build-essential \
        flex \
        bison \
@@ -16,7 +17,7 @@ RUN apt-get -y install \
        opensp \
        docbook-xsl \
        xsltproc
-RUN apt-get -y install \
+RUN apt-get -y --no-install-recommends install \
        git \
        dpkg-dev \
        debhelper \
@@ -24,4 +25,5 @@ RUN apt-get -y install \
        quilt \
        python3 \
        python3-pip \
-       python3-setuptools
+       python3-setuptools \
+       python3-venv
diff --git a/misc/docker/ubuntu-24.10-amd64/Dockerfile b/misc/docker/ubuntu-24.10-amd64/Dockerfile
new file mode 100644 (file)
index 0000000..2a01aa9
--- /dev/null
@@ -0,0 +1,29 @@
+# bump this to refresh the image: 1
+FROM ubuntu:24.10
+ENV DEBIAN_FRONTEND=noninteractive
+RUN apt-get -y update
+RUN apt-get -y upgrade
+RUN apt-get -y --no-install-recommends install \
+       tzdata \
+       build-essential \
+       flex \
+       bison \
+       autoconf \
+       ncurses-dev \
+       libreadline-dev \
+       libssh-gcrypt-dev \
+       linuxdoc-tools-latex \
+       texlive-latex-extra \
+       opensp \
+       docbook-xsl \
+       xsltproc
+RUN apt-get -y --no-install-recommends install \
+       git \
+       dpkg-dev \
+       debhelper \
+       apt-utils \
+       quilt \
+       python3 \
+       python3-pip \
+       python3-setuptools \
+       python3-venv
diff --git a/misc/gitlab/data.yml.j2 b/misc/gitlab/data.yml.j2
new file mode 100644 (file)
index 0000000..36ab468
--- /dev/null
@@ -0,0 +1,119 @@
+distros:
+  # CentOS 7 with quite some hacks
+  - name: centos-7-amd64
+    variables:
+      LC_ALL: en_US.UTF-8
+      CC: /opt/rh/devtoolset-8/root/usr/bin/gcc
+    type: pkg-rpm-wa
+
+  {% for name in (
+    'centos-8',
+    'fedora-32',
+    'fedora-33',
+  ) -%}
+  - name: {{ name }}-amd64
+    type: pkg-rpm-wa
+  {% endfor %}
+
+  # For some unknown reason we also require older Python packages
+  # for OpenSUSE even with the recent versions.
+  {% for num in (0,1,2,3,4,5) -%}
+  - name: opensuse-15.{{ num }}-amd64
+    type: pkg-rpm-wa
+  {% endfor %}
+
+  # Fedora regular builds
+  {% for num in (34, 35, 36, 37, 38, 39, 40, 41, 42) -%}
+  - name: fedora-{{ num }}-amd64
+    type: pkg-rpm
+  {% endfor %}
+
+  # Ubuntu legacy build
+  - name: ubuntu-18.04-amd64
+    type: pkg-deb-legacy
+
+  # Debian regular builds
+  {% for num in (10, 11, 12, 'testing') -%}
+  {% for arch in ('amd64', 'i386') -%}
+  - name: debian-{{num}}-{{arch}}
+    type: pkg-deb
+  {% endfor %}
+  {% endfor %}
+
+  # Ubuntu regular builds
+  {% for num in ('20.04', '22.04', '24.04', '24.10') -%}
+  - name: ubuntu-{{ num }}-amd64
+    type: pkg-deb
+  {% endfor %}
+
+birdlab:
+  - name: openbsd-75
+    variables:
+      AUTOCONF_VERSION: "2.71"
+
+  - name: openbsd-76
+    variables:
+      AUTOCONF_VERSION: "2.72"
+
+  {% for num in ("09", "10") -%}
+  - name: netbsd-{{ num }}
+  {% endfor %}
+
+  {% for num in (13, 14) -%}
+  - name: freebsd-{{ num }}
+  - name: freebsd-{{ num }}-netlink
+    dist: freebsd-{{ num }}
+    variables:
+      CONFIGURE_OPTIONS: --with-sysconfig=bsd-netlink --disable-client
+  {% endfor %}
+
+partial_build_image:
+  name: debian-12-amd64
+
+partial_build:
+  - protocols: aggregator
+  - protocols: babel
+  - protocols: bfd
+  - protocols: bgp
+  - protocols: bgp,bmp
+  - protocols: l3vpn
+  - protocols: mrt
+  - protocols: ospf
+  - protocols: pipe
+  - protocols: radv
+  - protocols: rip
+  - protocols: rpki
+  - protocols: static
+
+netlab:
+  - name: babel-base
+  - name: babel-auth
+  - name: ospf-base
+  - name: ospf-default
+  - name: ospf-priority
+  - name: ospf-nbma
+  - name: ospf-ptmp
+  - name: ospf-authentication
+  - name: ospf-bfd
+  - name: ospf-custom
+  - name: ospf-area
+  - name: ospf-vrf
+  - name: bgp-base
+  - name: bgp-auth
+  - name: bgp-int
+  - name: bgp-merged
+  - name: bgp-flowspec
+  - name: bgp-rs-multitab
+  - name: bgp-rs-singletab
+  - name: ebgp-graceful
+  - name: ebgp-loop
+  - name: ebgp-star
+  - name: ebgp-role
+  - name: ebgp-import-limit
+  - name: ibgp-loop
+  - name: ibgp-loop-big
+  - name: ibgp-flat
+  - name: rip-base
+  - name: kernel-learn
+  - name: mpls-bgp
+  - name: mpls-bgp-l3vpn
diff --git a/misc/gitlab/pipeline.py b/misc/gitlab/pipeline.py
new file mode 100755 (executable)
index 0000000..1ac7678
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/env python3
+
+import importlib
+import jinja2
+import pathlib
+import subprocess
+import sys
+import yaml
+
+# Find where we are
+localdir = pathlib.Path(__file__).parent
+
+# Prepare Jinja2 environment
+env = jinja2.Environment(loader=jinja2.FileSystemLoader(str(localdir)))
+env.filters.update({ "to_yaml": lambda x: "" if type(x) is jinja2.runtime.Undefined else yaml.dump(x).rstrip() })
+
+# Load and process input data
+try:
+    data = yaml.safe_load(rendered := env.get_template(f'data.yml.j2').render({}))
+except yaml.parser.ParserError as e:
+    print("Failed to render input data, generated output here:")
+    print(rendered)
+    raise e
+
+# Load the actual template
+template = env.get_template(f'template.yml.j2')
+
+# Render the template
+final = template.render({ **data })
+
+# YAML is picky about tabs, forbid them
+assert('\t' not in final)
+
+# Produce output
+print(final)
diff --git a/misc/gitlab/template.yml.j2 b/misc/gitlab/template.yml.j2
new file mode 100644 (file)
index 0000000..c9a5508
--- /dev/null
@@ -0,0 +1,400 @@
+###########################################################
+#####                                                 #####
+#####       DO  NOT  EDIT  THIS  FILE  BY  HAND       #####
+#####                                                 #####
+###########################################################
+#####                                                 #####
+##### This file is autogenerated from misc/gitlab/.   #####
+##### Edit those files and run `make gitlab` instead. #####
+#####                                                 #####
+###########################################################
+
+variables:
+  DEBIAN_FRONTEND: noninteractive
+  LC_ALL: C.UTF-8
+  GIT_STRATEGY: fetch
+  DOCKER_CMD: docker --config="$HOME/.docker/$CI_JOB_ID/"
+  IMG_BASE: registry.nic.cz/labs/bird
+  TOOLS_DIR: /home/gitlab-runner/bird-tools
+  STAYRTR_BINARY: /usr/bin/stayrtr
+
+stages:
+  - consistency
+  - image
+  - build
+  - pkg
+  - test
+
+## Common rules
+# Ignore WIP commits
+.never-wip: &never-wip
+  if: $CI_COMMIT_MESSAGE =~ /^(fixup! )*WIP/
+  when: never
+# Run for stable branches
+.if-stable: &if-stable
+  if: $CI_COMMIT_BRANCH =~ /^(stable-.*|thread-next|master)$/
+  when: always
+# Do run for tags
+.if-tag: &if-tag
+  if: $CI_COMMIT_TAG
+  when: always
+# Never run for tags
+.never-tag: &never-tag
+  if: $CI_COMMIT_TAG
+  when: never
+
+## Consistency checks for stable branches
+commit-messages:
+  stage: consistency
+  image: registry.nic.cz/labs/bird:docbuilder
+  script:
+  - tools/git-check-commits
+  rules:
+  - *if-stable
+  - when: never
+
+## Tag check
+tag-collect:
+  stage: consistency
+  image: registry.nic.cz/labs/bird:docbuilder
+  script:
+  - python3 -m venv venv
+  - . venv/bin/activate
+  - pip3 install requests
+  - tools/git-check-tag-local $CI_COMMIT_TAG
+  - tools/git-check-tag-ci $CI_COMMIT_SHA
+  artifacts:
+    paths:
+      - obj/doc/bird-singlepage.html
+      - bird-*.tar.gz
+      - pkg/pkgs/*
+      - pkg/srcpkgs/*
+  rules:
+  - *if-tag
+  - when: never
+
+## Default test job rules
+.test-job: &test-job
+  rules:
+  - *never-wip
+  - *never-tag
+  - when: always
+
+############################
+## Docker builder rebuild ##
+############################
+# We are running all the build / packaging tests in Dockers (unless otherwise)
+# and these are rules to build these docker images. These are expensive to run
+# and should run only if needed.
+#
+# Modify the appropriate dockerfile to rebuild these images
+
+.docker: &docker-build
+  stage: image
+  script:
+  - $DOCKER_CMD login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.nic.cz
+  # Make sure we refresh the base image if it updates (eg. security updates, etc)
+  # If we do just the build, cache is always reused and the freshness of the
+  # base image is never checked. However, pull always asks and updates the
+  # image only if it changed â€’ therefore, the cache is used unless there's a
+  # change.
+  - $DOCKER_CMD pull `sed -ne 's/^FROM //p' "misc/docker/$IMG_NAME/Dockerfile"`
+  - $DOCKER_CMD build -t "bird:$IMG_NAME" "misc/docker/$IMG_NAME"
+  - $DOCKER_CMD tag "bird:$IMG_NAME" "$IMG_BASE:$IMG_NAME"
+  - $DOCKER_CMD push "$IMG_BASE:$IMG_NAME"
+  after_script:
+  - rm -f "$HOME/.docker/$CI_JOB_ID/" # cleanup the credentials
+  tags:
+  # That's Docker in Docker
+  - dind
+  rules:
+    # Never rebuild for WIP commits
+  - *never-wip
+
+    # Never rebuild for tags
+  - if: '$CI_COMMIT_TAG'
+    when: never
+
+    # Never rebuild for new branches
+  - if: $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
+    when: never
+
+    # Do any change in Dockerfile (e.g. change a comment) to rebuild the image
+    # FIXME: This probably belongs to bird-tools instead, we may end up with
+    # screwed up docker repository in case of colliding image updates
+  - changes:
+    - misc/docker/$IMG_NAME/Dockerfile
+    when: always
+
+  - when: never
+
+{% for docker in [ { "name": "docbuilder" } ] + distros %}
+docker-{{ docker["name"] }}:
+  variables:
+    IMG_NAME: "{{ docker["name"] }}"
+  <<: *docker-build
+{% endfor %}
+
+#####################################################
+## Linux distro build tests inside Docker builders ##
+#####################################################
+
+## Build stage
+#
+# Now we compile and run unit tests ... in every single distribution.
+# Every task needs its docker, see above.
+
+.build: &build-base
+  <<: *test-job
+  stage: build
+  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
+    - tools/version && ( echo -n "BIRD version "; tools/version ) > version-expected
+    - |
+      STABLE_VERSION="`cat VERSION`"
+      if [ "$CI_COMMIT_MESSAGE" == "NEWS and version update
+      " ]; then
+        if [ "${STABLE_VERSION}" == "`tools/version`" ]; then
+          echo "Stable version precheck OK"
+        else
+          echo "Stable version discrepancy: $STABLE_VERSION vs. $(tools/version)"
+          exit 1
+        fi
+      else
+        if grep -qF "BIRD version ${STABLE_VERSION}+branch" version-expected; then
+          true
+        else
+          echo -n "Commit $CI_COMMIT_SHA message $CI_COMMIT_MESSAGE expects version "
+          cat version-expected
+          exit 1
+        fi
+      fi
+    - autoreconf
+    - ./configure CPPFLAGS="$CPPFLAGS" LDFLAGS="$LDFLAGS" $CONFIGURE_OPTIONS
+    # Detect which make is available
+    - MAKE=make
+    - which gmake 2>/dev/null >/dev/null && MAKE=gmake
+    - $MAKE
+    - $MAKE check
+    # Build docs when tools are available
+    - if which linuxdoc pdflatex sgmlsasp >/dev/null ; then $MAKE docs ; fi
+    # Check that the reported version is the right one
+    - ./bird --version |& tee obj/version-built
+    - diff obj/version-built version-expected
+
+.build-docker-linux-amd64: &build-docker-linux-amd64
+  <<: *build-base
+  tags:
+    - docker
+    - linux
+    - amd64
+
+{% for dist in distros %}
+build-{{dist["name"]}}:
+  <<: *build-docker-linux-amd64
+  needs:
+    - job: docker-{{ dist["name"] }}
+      optional: true
+  image: registry.nic.cz/labs/bird:{{ dist["name"] }}
+{%- if 'variables' in dist %}
+  variables:
+{{ dist["variables"] | to_yaml | indent(4, true) }}
+{%- endif %}
+{% endfor %}
+
+#######################################################
+## A special task for preparing the release archives ##
+#######################################################
+build-release:
+  <<: *test-job
+  image: registry.nic.cz/labs/bird:docbuilder
+  needs: 
+    - job: docker-docbuilder
+      optional: true
+  stage: build
+  tags:
+    - docker
+    - linux
+  script:
+    - export BRANCH=$CI_COMMIT_BRANCH
+    - autoreconf
+    - ./configure --with-protocols= --disable-client
+    - make obj/doc/bird-singlepage.html
+    - tools/make-archive
+  artifacts:
+    paths:
+      - obj/doc/bird-singlepage.html
+      - bird-*.tar.gz
+    expire_in: 1 day
+
+# Packaging rules
+# As we support some ancient versions of different distributions,
+# we need to keep several different machineries. It's not so bad
+# but it's bad nevertheless.
+#
+# We do NOT build separate documentation packages in these rules.
+
+.pkg-deb: &pkg-deb
+  <<: *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 build -a bird-$(cat VERSION)*.tar.gz
+    #- apkg install -y pkg/pkgs/*/*/*.deb
+  artifacts:
+    paths:
+      - pkg/pkgs/*
+      - pkg/srcpkgs/*
+
+.pkg-deb-legacy: &pkg-deb-legacy
+  <<: *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 apkg
+    - apkg build -a bird-$(cat VERSION)*.tar.gz
+    #- apkg install -y pkg/pkgs/*/*/*.deb
+  artifacts:
+    paths:
+      - pkg/pkgs/*
+      - pkg/srcpkgs/*
+
+.pkg-rpm: &pkg-rpm
+  <<: *test-job
+  stage: pkg
+  script:
+    - pip3 install apkg
+    - apkg build -a bird-$(cat VERSION)*.tar.gz
+    #- apkg install -y pkg/pkgs/*/*/*.rpm
+  artifacts:
+    paths:
+      - pkg/pkgs/*
+      - pkg/srcpkgs/*
+
+.pkg-rpm-wa: &pkg-rpm-wa
+  <<: *test-job
+  stage: pkg
+  script:
+    - 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 build -a bird-$(cat VERSION)*.tar.gz
+    #- apkg install -y pkg/pkgs/*/*/*.rpm
+  artifacts:
+    paths:
+      - pkg/pkgs/*
+      - pkg/srcpkgs/*
+
+
+{% for dist in distros %}
+pkg-{{ dist["name"] }}:
+  <<: *{{ dist["type"] }}
+  needs:
+    - job: build-{{ dist["name"] }}
+      artifacts: false
+    - job: build-release
+  image: registry.nic.cz/labs/bird:{{ dist["name"] }}
+{%- if 'variables' in dist %}
+  variables:
+{{ dist["variables"] | to_yaml | indent(4, true) }}
+{%- endif %}
+{% endfor %}
+
+###################################
+## Non-linux build tests in QEMU ##
+###################################
+.build-birdlab-base: &build-birdlab-base
+  <<: *build-base
+  stage: build
+#  script:
+#    - export BRANCH=$CI_COMMIT_BRANCH
+#    - autoreconf
+#    - ./configure $CONFIGURE_OPTIONS
+#    - gmake
+#    - gmake check
+
+{% for test in birdlab %}
+build-birdlab-{{ test['name'] }}:
+  <<: *build-birdlab-base
+{%- if 'variables' in test %}
+  variables:
+{{ test['variables'] | to_yaml | indent(4, true) }}{%- endif %}
+  tags:
+    - birdlab-{{ test['dist'] if 'dist' in test else test['name'] }}
+    - amd64
+{% endfor %}
+
+#########################
+## Partial build tests ##
+#########################
+
+.build-only: &build-only
+  <<: *build-docker-linux-amd64
+  image: registry.nic.cz/labs/bird:{{ partial_build_image["name"] }}
+  needs:
+    - job: docker-{{ partial_build_image["name"] }}
+      optional: true
+
+{% for test in partial_build %}
+partial-build-linux-{{ test["protocols"] }}:
+  <<: *build-only
+  variables:
+    CONFIGURE_OPTIONS: --with-protocols={{ test["protocols"] }}
+{% endfor %}
+
+################################
+## Netlab functionality tests ##
+################################
+
+build-netlab:
+  <<: *test-job
+  stage: build
+  variables:
+    BDIR: build-netlab
+  tags:
+    - netlab
+    - amd64
+  script:
+    - autoreconf
+    - mkdir $BDIR
+    - cd $BDIR
+    - ../configure
+    - BRANCH=$CI_COMMIT_BRANCH make
+  artifacts:
+    paths:
+      - $BDIR/bird
+      - $BDIR/birdc
+    expire_in: 2 hours
+
+.netlab-test: &test-base
+  <<: *test-job
+  stage: test
+  needs: [build-netlab]
+  tags:
+    - netlab
+    - amd64
+  script:
+    - DIR=$(pwd)
+    - cd $TOOLS_DIR
+    - sudo git clean -fx
+    - git pull --ff-only
+    - "mv $DIR/build-netlab/* netlab/common/"
+    - ln -s $STAYRTR_BINARY netlab/common/stayrtr
+    - cd netlab
+    - sudo ./stop
+    - sudo ./runtest -s v3 -m check $TEST_NAME
+
+{% for test in netlab %}
+test-{{ test["name"] }}:
+  <<: *test-base
+  variables:
+    TEST_NAME: cf-{{ test["name"] }}
+{% endfor %}
index 1ee0e07eb770958fd304880ee15df585d750012e..7782f9d157d9605632f48486f0ce5787223289d6 100644 (file)
@@ -6,16 +6,15 @@
 #ifndef _BIRD_CONFIG_H_
 #define _BIRD_CONFIG_H_
 
-#define XSTR2(X) #X
-#define XSTR1(X) XSTR2(X)
-
 /* BIRD version */
-#ifdef GIT_LABEL
-#define BIRD_VERSION XSTR1(GIT_LABEL)
-#else
-#define BIRD_VERSION "3.0.2"
+#ifndef BIRD_VERSION
+#error "BIRD_VERSION not defined"
 #endif
 
+/* ... is a string literal at least of 4 characters */
+_Static_assert(sizeof(BIRD_VERSION) >= 4, BIRD_VERSION);
+_Static_assert(sizeof(BIRD_VERSION "") == sizeof(BIRD_VERSION), BIRD_VERSION);
+
 /* Include parameters determined by configure script */
 #include "sysdep/autoconf.h"
 
index 2dc42ba90208b70fbdd3d0d31c4c9584bef44a77..7cb19e03929be5578a36407d3478634f24705062 100755 (executable)
@@ -5,7 +5,8 @@
 #  (c) 2005--2022 Ondrej Filip <feela@network.cz>
 #
 
-VERSION=`grep 'BIRD_VERSION \"' sysdep/config.h | sed '/BIRD_VERSION/!d;s/^.*"\(.*\)"$/\1/'`
+#VERSION=`grep 'BIRD_VERSION \"' sysdep/config.h | sed '/BIRD_VERSION/!d;s/^.*"\(.*\)"$/\1/'`
+VERSION=`tools/version`
 REL=bird-$VERSION
 DREL=bird-doc-$VERSION
 T=/tmp/bird
@@ -24,6 +25,7 @@ $AC
 rm -rf autom4te*cache
 echo Building $REL
 cp -a . $T/$REL
+sed -i 's/^VERSION := .*/VERSION := '${VERSION}'/' $T/$REL/Makefile.in
 echo Generating ChangeLog
 git log  >$T/$REL/ChangeLog
 rm -f $T/$REL/bird.conf*
diff --git a/tools/git-check-commits b/tools/git-check-commits
new file mode 100755 (executable)
index 0000000..65661e1
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+git log --oneline | awk \
+  '{
+    # Ignore two fixups deeply buried inside the history
+    if (index("a54f75f454b7ed8c8ff2c1787a506528f22cbae7", $1) == 1)
+      next;
+    if (index("bea582cbb53e30dd32a5b6829c7443e0e5558d11", $1) == 1)
+      next;
+
+    # Complain about fixups and WIPs
+    if ((index($2, "fixup!") == 1) || (index($2, "WIP") == 1))
+    {
+      if (!bad) print "Branch contains unfinished work!"
+      bad = 1
+      print
+    }
+  }
+  END { if (bad) exit 1 }'
diff --git a/tools/git-check-tag-ci b/tools/git-check-tag-ci
new file mode 100755 (executable)
index 0000000..0b7a442
--- /dev/null
@@ -0,0 +1,89 @@
+#!/usr/bin/env python3
+
+import io
+import json
+import requests
+import sys
+import zipfile
+
+def load_api_request(name, query):
+    timeout = 5
+    while True:
+        resp = requests.get("https://gitlab.nic.cz/api/v4/projects/labs%2Fbird/" + query)
+        if resp.status_code == 200:
+            return resp.content
+
+        if resp.status_code == 429:
+            print(f"Too many requests for {name}, waiting {timeout} sec")
+            time.sleep(timeout)
+            timeout = int(1.6 * timeout)
+            continue
+
+        raise Exception(f"Failed to load {name} at {query} with code {resp.status_code}: {resp.content}")
+
+def load_paginated(name, query, per_page=100):
+    if query[-1] in "?&":
+        joiner = ""
+    elif "?" in query:
+        joiner = "&"
+    else:
+        joiner = "?"
+
+    output = []
+    pageno = 1
+    while True:
+        p = load_api_request(f"{name} page {pageno}", f"{query}{joiner}per_page={per_page}&page={pageno}")
+        output += (new := json.loads(p))
+        if len(new) < per_page:
+            return output
+
+        pageno += 1
+
+def load_pipelines(sha):
+    return load_paginated("pipelines", f"/pipelines/?sha={sha}")
+
+def load_jobs(pipeline):
+    return load_paginated("jobs", f"/pipelines/{pipeline}/jobs/")
+
+for p in load_pipelines(sys.argv[1]):
+    if p['status'] in ("failed", "cancelled"):
+        print(f"Pipeline {p['id']} {p['status']} at {p['web_url']}")
+        failed = [ job for job in load_jobs(p['id']) if job['status'] == "failed" ]
+        if len(failed) > 0:
+            print(f"\tFailed jobs:")
+            for job in failed:
+                print(f"\t\t{job['name']}")
+        else:
+            print(f"\tNo failed jobs, check gitlab")
+        print()
+        continue
+
+    if p['status'] in ("created", "pending", "running"):
+        print(f"Pipeline {p['id']} has not finished yet: {p['status']}")
+        states = {}
+
+        for job in load_jobs(p['id']):
+            if job['status'] not in states:
+                states[job['status']] = []
+            states[job['status']].append(job)
+
+        for s in states:
+            print(f"\tJobs {s}:")
+            for j in states[s]:
+                print(f"\t\t{j['name']} ({j['id']})")
+
+        continue
+
+    if p['status'] == "success":
+        print(f"Pipeline {p['id']} successful, collecting artifacts")
+        for job in load_jobs(p['id']):
+            if len(job['artifacts']) > 0:
+                print(f"\t{ job['name'] }:")
+            for f in job['artifacts']:
+                if f['file_type'] == 'archive':
+                    with zipfile.ZipFile(io.BytesIO(load_api_request("metadata", f"/jobs/{job['id']}/artifacts/"))) as z:
+                        z.extractall()
+        exit(0)
+
+print("No suitable pipeline found, tag not OK")
+exit(1)
diff --git a/tools/git-check-tag-local b/tools/git-check-tag-local
new file mode 100755 (executable)
index 0000000..5d7790d
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+# Enforce clean repository (it's release time)
+if [ $(git status --porcelain -uno | wc -l) != "0" ]; then
+  echo "Dirty repository, commit or stash!"
+  exit 1
+fi
+
+# Is the current commit a release commit?
+read COMMIT MESSAGE <<< "$(git show -s --oneline --no-decorate --no-abbrev-commit)"
+
+if [ "$MESSAGE" != "NEWS and version update" ]; then
+  echo "This is not a release commit: $COMMIT $MESSAGE"
+  exit 1
+fi
+
+# Are we checking an existing tag?
+if [ -n "$1" ]; then
+  read TAG_COMMIT _ <<< "$(git show -s --oneline --no-abbrev-commit "$1" | grep NEWS)"
+  if [ "$TAG_COMMIT" != "$COMMIT" ]; then
+    echo "Tag $1 not checked out"
+    exit 1
+  fi
+
+  if [ "v$(<VERSION)" != "$1" ]; then
+    echo "Version discrepancy"
+    echo -n "VERSION file: "; cat VERSION
+    echo "Tag: $1"
+    exit 1
+  fi
+fi
+
+# Locally done, report
+echo "Tag locally OK"
diff --git a/tools/git-is-stable-branch b/tools/git-is-stable-branch
new file mode 100755 (executable)
index 0000000..1cef969
--- /dev/null
@@ -0,0 +1,8 @@
+#!/bin/bash
+
+case "$1" in
+  master | thread-next | stable-* )
+    exit 0;
+esac
+
+exit 1
diff --git a/tools/make-archive b/tools/make-archive
new file mode 100755 (executable)
index 0000000..2f07c3c
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/bash
+#
+#      Generate BIRD distribution tgz
+#
+#      (c) 2025 CZ.NIC
+#
+#      Based on an older script by Martin Mares and Ondrej Filip
+#      and another one by Jakub Ruzicka and Ondrej Zajicek
+
+set -e
+
+# Gather all required information
+VERSION="$($(dirname $0)/version | sed 's/^v//')"
+
+SRCPKG="bird-${VERSION}"
+DOCPKG="bird-doc-${VERSION}"
+
+if [ -z "$ARCHIVE_DOCS" ]; then
+  ARCHIVE_DOCS=true
+fi
+
+# Check that we are running on a clean repository
+if ! git diff-index --quiet HEAD || ! git diff-index --cached --quiet HEAD; then
+  echo 'WARNING: git index has uncommitted changes!'
+fi
+
+# Prepare a tempdir
+T=$(mktemp -d)
+function cleanup_tmpdir() {
+  rm -rf $T
+}
+
+trap cleanup_tmpdir EXIT
+
+# Create a preliminary archive
+echo "Building $VERSION"
+git archive --format=tar --prefix="$SRCPKG/" HEAD -o $T/initial.tgz
+
+# Generate changelog
+echo "Generating changelog"
+mkdir $T/$SRCPKG
+git log > $T/$SRCPKG/ChangeLog
+
+# Unpack the archive
+pushd $T
+  tar xf initial.tgz
+  pushd $SRCPKG
+
+    # Omit historical documents
+    rm -rf rfc doc/slides doc/slt2001 doc/old bird.conf
+
+    # Fix the version string
+    sed -i 's/^VERSION := .*/VERSION := '${VERSION}'/' Makefile.in
+
+    # Run autoconf
+    echo "Running autoreconf"
+    autoreconf -i
+    rm -rf autom4te*cache
+
+  popd
+
+  # Pack sources
+  echo "Packing source package"
+  tar czf $SRCPKG.tar.gz $SRCPKG
+
+  if $ARCHIVE_DOCS; then
+    # Generate documentation
+    pushd $SRCPKG
+      echo "Creating documentation"
+      (./configure --with-protocols= --disable-client && make docs) > build.log 2>build.err || (
+       echo "======== Build log ========"
+       cat build.log
+       echo "======== Error log ========"
+       cat build.err
+       echo "If you wish to not build documentation, set env ARCHIVE_DOCS=false"
+       false
+      )
+    popd
+
+    mkdir ${DOCPKG}{,/doc}
+    cp $SRCPKG/obj/doc/*.{html,pdf} ${DOCPKG}/doc
+
+    # Pack sources
+    echo "Packing docs package"
+    tar czf $DOCPKG.tar.gz $DOCPKG
+  else
+    echo "Skipping documentation build"
+  fi
+
+popd
+
+if $ARCHIVE_DOCS; then
+  mv $T/$DOCPKG.tar.gz .
+fi
+
+mv $T/$SRCPKG.tar.gz .
+echo $SRCPKG.tar.gz
index caaee121c1728dbb875933783b1c688de07e717c..38c254b6c58a6e78ce743f4b30aa2a04327435d7 100755 (executable)
@@ -3,7 +3,7 @@
 # This a modified version of gendist script which generates development
 # archive (tarball) without docs from current sources.
 
-BIRD_VERSION=`grep 'BIRD_VERSION \"' sysdep/config.h | sed '/BIRD_VERSION/!d;s/^.*"\(.*\)"$/\1/'`
+BIRD_VERSION=$(bash tools/version)
 # differentiate dev tarballs from upstream ones
 GIT_HASH=$(git rev-parse --short HEAD )
 TIMESTAMP=$(date -u +'%s' 2>/dev/null)
diff --git a/tools/release-commit b/tools/release-commit
new file mode 100755 (executable)
index 0000000..49667c2
--- /dev/null
@@ -0,0 +1,84 @@
+#!/bin/bash
+
+set -e
+
+toplevel=$(readlink -f $(dirname $0)/..)
+current_version=$(<$toplevel/VERSION)
+
+pushd $toplevel > /dev/null
+
+# Enforce clean repository (we are going to commit!)
+if [ $(git status --porcelain -uno | wc -l) != "0" ]; then
+  echo "Dirty repository, commit or stash!"
+  exit 1
+fi
+
+# Enforce no fixups and no WIPs
+tools/git-check-commits
+
+# Compute the new version
+case $1 in
+  patch)
+    new_version=$(awk -F. 'OFS="." { $3+=1; print; }' <<<"$current_version")
+    ;;
+  minor)
+    new_version=$(awk -F. 'OFS="." { $2+=1; if ($1 < 3) print $1,$2; else print $1,$2,0; }' <<<"$current_version")
+    ;;
+  *)
+    echo "Usage: $0 (minor|patch)"
+    echo "Commits the version update commit"
+    exit 2
+esac
+
+file=$(mktemp)
+news=$(mktemp)
+function cleanup() {
+  rm -f $file $news
+}
+trap cleanup EXIT ERR
+
+# Prepare the NEWS file
+echo "## Releasing version $new_version ##" >> $file
+echo -n "########################" >> $file
+sed 's/./#/g' <<<"$new_version" >> $file
+echo >> $file
+news_headline="Version $new_version ($(date +%F))"
+echo $news_headline >> $file
+git log --oneline v$current_version..HEAD | sed -r 's/^([^ ]+) (.*)/# commit \1\n  o \2/' >> $file
+echo >> $file
+echo "# Empty the file to cancel the commit." >> $file
+echo "# Do not change the Version header." >> $file
+
+# Edit the NEWS file
+$(git var GIT_EDITOR) $file
+
+# Collect the result
+if ! egrep -v '^(#.*)?$' $file > $news; then
+  echo "Release canceled"
+  exit 1
+fi
+
+# Check whether the result is correct
+if [ "$news_headline" != "$(head -n1 $news)" ]; then
+  echo "Garbled headline, got $(head -n1 $news)"
+  exit 1
+fi
+
+badlines=$(tail -n+2 $news | grep -v '^  [o ] ' | wc -l)
+if [ "$badlines" != 0 ]; then
+  echo "Garbled news file, offending lines:"
+  tail -n+2 $news | grep -v '^  [o ] '
+  exit 1
+fi
+
+# Do the changes in the repository: NEWS, bird.spec 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
diff --git a/tools/version b/tools/version
new file mode 100755 (executable)
index 0000000..0ef4f13
--- /dev/null
@@ -0,0 +1,61 @@
+#!/bin/sh
+
+set -e
+
+# Get the release version
+toplevel="$(readlink -f $(dirname $0)/../)"
+RELEASE_VERSION=$(cat "$toplevel/VERSION")
+
+# Not in a git repo, or no git installed.
+if ! git status --porcelain > /dev/null; then
+  echo $RELEASE_VERSION
+  exit 0
+fi
+
+# Check VERSION file updates in uncommitted changes
+if git status --porcelain | grep -q '^...VERSION$'; then
+  echo "WARNING: Version file changed and not committed" >&2
+  echo $RELEASE_VERSION
+  exit 0
+fi
+
+# If clean, check VERSION file updates in the current commit
+if [ $(git status --porcelain -uno | wc -l) = "0" ] && [ $(git show -- VERSION | wc -l) != "0" ]; then
+  echo $RELEASE_VERSION
+  exit 0
+fi
+
+# We'll create a development version number, get the hash
+HASH=$(git rev-parse --short=12 HEAD)
+
+# Find the release
+case "$(git tag -l | grep "^v$RELEASE_VERSION\$" | wc -l | sed -r 's/^ *//;s/ +-//')" in
+  "1") # Already tagged
+    RELEASE_COMMIT=v$RELEASE_VERSION
+    ;;
+  "0") # Not yet tagged
+    RELEASE_COMMIT=$(git log --oneline -- VERSION | sed 's/ .*//')
+    ;;
+  *)
+    echo "ERROR: There are too many matching tags in the repository"
+    git tag -l | grep "^v$RELEASE_VERSION\$"
+    git tag -l | grep "^v$RELEASE_VERSION\$" | wc -l
+    exit 1
+    ;;
+esac
+
+# Add branch info if not passed via command line
+if [ -z "${BRANCH}" ]; then
+  # There is also --show-current but it's too new to be portable.
+  BRANCH=$(git branch | sed -n 's/^[*] //p' | grep -v 'HEAD detached' || true)
+fi
+
+# Found a branch
+if [ -n "$BRANCH" ]; then
+  LENGTH=$(git log --oneline $RELEASE_COMMIT..HEAD | wc -l)
+  echo $RELEASE_VERSION+branch.$(echo $BRANCH | sed 's/[^a-zA-Z0-9]/./g').${HASH}
+  exit 0
+fi
+
+echo $RELEASE_VERSION+detached.${HASH}
+exit 0