| 1 | generate-config: |
| 2 | image: $SALSA_CI_IMAGES_BASE |
| 3 | needs: |
| 4 | - job: aptly |
| 5 | artifacts: true |
| 6 | - job: build |
| 7 | artifacts: true |
| 8 | script: | |
| 9 | set -x |
| 10 | cat debian/rdep-build-script.yml > generated-config.yml |
| 11 | apt-get update |
| 12 | apt-get install --no-install-recommends --yes dose-extra devscripts dctrl-tools libdpkg-perl curl |
| 13 | curl https://salsa.debian.org/debian/devscripts/-/raw/68eec00592a891e47c569a9ab1e80f88a193b201/scripts/debftbfs > /usr/bin/debftbfs |
| 14 | chmod +x /usr/bin/debftbfs |
| 15 | sed -i 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/debian.sources |
| 16 | sed -i 's/^Components: main$/Components: main contrib/' /etc/apt/sources.list.d/debian.sources |
| 17 | apt-get update |
| 18 | cat /etc/apt/sources.list.d/debian.sources > /dev/stderr |
| 19 | # sanity check |
| 20 | grep --quiet --line-regexp 'Suites: \(unstable\|sid\)' /etc/apt/sources.list.d/debian.sources |
| 21 | grep --quiet --line-regexp 'URIs: http://deb.debian.org/debian' /etc/apt/sources.list.d/debian.sources |
| 22 | { |
| 23 | for f in "$WORKING_DIR"/*.deb; do |
| 24 | dpkg-deb --field "$f" Package |
| 25 | done; |
| 26 | # We want to find what to rebuild for a transition so we are not only |
| 27 | # interested in the source packages requiring the binary packages we just |
| 28 | # built (the above) but also in the source packages requiring the binary |
| 29 | # packages built by the current version of this source package in |
| 30 | # unstable. |
| 31 | thissrc=$(awk '/^Source: / { print $2; exit; }' debian/control); |
| 32 | echo "acquiring binary packages built by $thissrc" > /dev/stderr; |
| 33 | # apt-cache might return more than one version of this source package but |
| 34 | # that is fine -- we rather overestimate than having false negatives |
| 35 | apt-cache showsrc "$thissrc" | sed -n 's/^Binary: //p' | sed 's/, /\n/g'; |
| 36 | } | sort -u \ |
| 37 | | xargs build-rdeps --exclude-component=non-free --exclude-component=non-free-firmware --distribution unstable --no-ftbfs --quiet \ |
| 38 | | sort -u | while read pkg; do |
| 39 | echo "generating yaml recipe for $pkg" > /dev/stderr |
| 40 | cat << END >> generated-config.yml |
| 41 | |
| 42 | build-rdep-${pkg}: |
| 43 | variables: |
| 44 | REVERSE_DEP: ${pkg} |
| 45 | PARENT_APTLY_REPO: $APTLY_REPO |
| 46 | extends: .rdep-build-definition |
| 47 | artifacts: |
| 48 | paths: |
| 49 | - ${pkg}.build |
| 50 | END |
| 51 | echo "generated generated-config.yml with the following content:" > /dev/stderr |
| 52 | cat generated-config.yml > /dev/stderr |
| 53 | done |
| 54 | artifacts: |
| 55 | paths: |
| 56 | - generated-config.yml |
| 57 | except: |
| 58 | variables: |
| 59 | - $SALSA_CI_ENABLE_REVERSE_DEPENDENCY_BUILD !~ /^(1|yes|true)$/ |
| 60 | - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ |
| 61 | - $CI_MERGE_REQUEST_ID != null |
| 62 | |
| 63 | child-pipeline: |
| 64 | needs: [generate-config] |
| 65 | trigger: |
| 66 | include: |
| 67 | - artifact: generated-config.yml |
| 68 | job: generate-config |
| 69 | variables: |
| 70 | PARENT_PIPELINE_ID: $CI_PIPELINE_ID |
| 71 | except: |
| 72 | variables: |
| 73 | - $SALSA_CI_ENABLE_REVERSE_DEPENDENCY_BUILD !~ /^(1|yes|true)$/ |