---
- project:
    name: Osmocom-depcheck
    jobs:
      - Osmocom-depcheck

- job-template:
    name: 'Osmocom-depcheck'
    project-type: freestyle
    defaults: global
    description: |
        Verifies that Osmocom programs really build with the dependency
        versions they claim to support in configure.ac.
        (Generated by job-builder)
    properties:
      - build-discarder:
          days-to-keep: 30
          num-to-keep: 30
    node: osmocom-master
    parameters:
      - string:
          name: PROJECTS
          description: |
              Which Osmocom projects and revisions to build, leave
              empty to default to all projects (!),
              default revision is "master".
              Examples: "osmo-hlr", "osmo-hlr:0.2.1 osmo-bts:0.8.1"
          default: 'osmo-hlr:0.2.1'
      - string:
          name: GIT_URL_PREFIX
          description: |
                Where to clone the sources from
          default: 'https://gerrit.osmocom.org/'
      - bool:
          name: BUILD
          description: |
                Attempt to build the project with the minimum dependency
                versions found in the configure.ac files. If this is unchecked,
                this job will only clone the git repositories and parse the
                configure.ac files.
          default: true
      - bool:
          name: PRINT_OLD_DEPENDS
          description: |
                Report dependencies on old releases (printed after the other
                parsing output, before the build starts)
          default: false
      - string:
          name: BRANCH
          description: |
                Branch where the osmo-depcheck.py script gets pulled from.
                Only modify this if you are hacking on osmo-depcheck.py.
          default: '*/master'
    builders:
      - shell: |
          # Build the arguments
          args="$PROJECTS"
          args="$args -j 5"
          args="$args -w $PWD/DEPCHECK_WORKDIR"
          args="$args -u $GIT_URL_PREFIX"
          [ "$BUILD" = "true" ] && args="$args -b"
          [ "$PRINT_OLD_DEPENDS" = "true" ] && args="$args -o"

          # Run osmo-depcheck
          mkdir DEPCHECK_WORKDIR
          export PYTHONUNBUFFERED=1
          scripts/osmo-depcheck/osmo-depcheck.py $args
    scm:
      - git:
          branches:
            - '$BRANCH'
          url: https://gerrit.osmocom.org/osmo-ci
          git-config-name: 'Jenkins Builder'
          git-config-email: 'jenkins@osmocom.org'

    publishers:
      - email:
          notify-every-unstable-build: true
          recipients: 'jenkins-notifications@lists.osmocom.org'

# vim: expandtab tabstop=2 shiftwidth=2
