summaryrefslogtreecommitdiffstats
path: root/debian/salsa-ci.yml
blob: 4083bd01a2b8186c9748f7cbbd8db88476f8cb4a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
include:
  - https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/salsa-ci.yml

variables:
  RELEASE: 'unstable'
  # We only build arch:all packages
  SALSA_CI_DISABLE_BLHC: 'true'
  SALSA_CI_DISABLE_BUILD_PACKAGE_I386: 'true'
  SALSA_CI_DISABLE_BUILD_PACKAGE_ANY: 'true'
  SALSA_CI_DISABLE_CROSSBUILD_ARM64: 'true'
  # We have to bump the version in source preparation, not later
  SALSA_CI_DISABLE_VERSION_BUMP: 'true'

# The common Salsa CI pipeline relies on keeping the unpacked source
# as an artifact, but in our case this is far too large for the
# current limits on Salsa (salsa-ci-team/pipeline#195).  So we
# redefine the source extraction and build steps to use packed source.

# Our modified extract-source and build jobs

extract-source:
  stage: provisioning
  image: $SALSA_CI_IMAGES_BASE
  cache:
    key: "orig-${RELEASE}"
    paths:
      - orig
  extends:
    - .artifacts-default-expire
  except:
    variables:
      - $CI_COMMIT_TAG != null
  script:
    # Move orig tarball cache
    - |
      if [ -d orig ]; then
          mv orig/* ..
          rmdir orig
      fi

    # Install dependencies of gencontrol.py and debian/rules orig
    # plus origtargz
    - apt-get update
    - eatmydata apt-get install --no-install-recommends -y make
    - |
      eatmydata apt-get install --no-install-recommends -y \
        debhelper \
        devscripts \
        git \
        python3 \
        python3-jinja2 \
        quilt \
        rsync \
        $(debian/rules linux-support-name)

    - version=$(dpkg-parsechangelog -SVersion)
    - upstream_version=$(echo $version | sed 's/-[^-]*$//')

    # Merge upstream source
    - origtargz -dt
    - debian/rules orig

    # Fudge source version and suite *before* gencontrol.py
    - sed -i -e '1 s/) [^;]*/+salsaci) UNRELEASED/' debian/changelog
    - version=${version}+salsaci

    # Run gencontrol.py
    # - create temporary log
    - log="$(mktemp)"
    # - invoke debian/control-real rule and log output
    - |
      rc=0; debian/rules debian/control-real >"$log" 2>&1 || rc=$?
    - cat "$log"
    # - check for success message and error code
    - test $rc = 2
    - grep -q 'been generated SUCCESSFULLY' "$log"

    # Put packed source in artifacts
    - dpkg-buildpackage -uc -us -S -sa -d
    - mkdir -p ${WORKING_DIR}
    - cp ../firmware-nonfree_${upstream_version}.orig.tar.xz ${WORKING_DIR}
    - mv ../firmware-nonfree_${version}.dsc ../firmware-nonfree_${version}.debian.tar.xz ../firmware-nonfree_${version}_source.buildinfo ../firmware-nonfree_${version}_source.changes ${WORKING_DIR}

    # Move orig tarballs back to where GitLab wants them
    - mkdir orig
    - mv ../*.orig.tar.* orig

build:
  stage: build
  image: $SALSA_CI_IMAGES_BASE
  cache:
    key: "build-${BUILD_ARCH}_${HOST_ARCH}"
    paths:
      - .ccache
  extends:
    - .artifacts-default-expire
  except:
    variables:
      - $CI_COMMIT_TAG != null
  variables:
    CCACHE_TMP_DIR: ${CI_PROJECT_DIR}/../.ccache
    CCACHE_WORK_DIR: ${CI_PROJECT_DIR}/.ccache
    DB_BUILD_PARAM: ${SALSA_CI_DPKG_BUILDPACKAGE_ARGS}
    DB_BUILD_TYPE: all
  artifacts:
    exclude:
      - ${WORKING_DIR}/${SOURCE_DIR}/**/*
  script:
    # Unpack the source
    - |
      apt-get update && eatmydata apt-get install --no-install-recommends -y \
        dpkg-dev
    - dpkg-source -x ${WORKING_DIR}/*.dsc ${WORKING_DIR}/${SOURCE_DIR}

    # Do the same as the common .build-definition script
    - !reference [.build-before-script]
    - !reference [.build-script]
    - mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}
    # Do not artifact the source package again, we're keeping the one from extract-source
    - rm -f ${WORKING_DIR}/*.orig.tar.* ${WORKING_DIR}/*.dsc ${WORKING_DIR}/*.debian.tar.* ${WORKING_DIR}/*_source.changes
  dependencies:
    - extract-source

# The folllowing jobs are the standard tests, excluding:
# - any that require building again
# - blhc, since we don't compile anything

lintian:
    extends: .test-lintian
    needs:
    - !reference [.test-lintian,needs]
    - job: extract-source
      artifacts: true

piuparts:
    extends: .test-piuparts
    variables:
      # Skip the EULA questions in these two packages
      FIRMWARE_IPW2X00_LICENSE_READ_AND_ACCEPTED: 'yes'
      FIRMWARE_IVTV_LICENSE_READ_AND_ACCEPTED: 'yes'

missing-breaks:
    extends: .test-missing-breaks

rc-bugs:
    extends: .test-rc-bugs