Debian Codegraph @

debian/rdeps-ci.yml

raw symbols SCIP
1 .rdep-build-before-script: &rdep-build-before-script |
2 # Reported in https://salsa.debian.org/salsa-ci-team/pipeline/issues/104,
3 # GitLab can only expand variables once. So at the beginning CCACHE_WORK_DIR
4 # was assigned to `${WORKING_DIR}/.ccache`, and it will be expanded as
5 # `$CI_PROJECT_DIR/debian/output/.ccache`, so it creates a folder named
6 # "\$CI_PROJECT_DIR", which is then saved as build cache. To allow smooth
7 # transition, that wrongly named folder has to be removed:
8 rm -rf '$CI_PROJECT_DIR'
9
10 # salsa-ci-team/pipeline#107
11 rm -rf ${CI_PROJECT_DIR}/debian/output/.ccache
12
13 mkdir -p ${WORKING_DIR} ${CCACHE_WORK_DIR}
14
15 # https://salsa.debian.org/salsa-ci-team/pipeline/-/merge_requests/230
16 rm -rf ${CCACHE_TMP_DIR}
17
18 mv ${CCACHE_WORK_DIR} ${CCACHE_TMP_DIR}
19 add_extra_repository.sh -v -e "${SALSA_CI_EXTRA_REPOSITORY}" -k "${SALSA_CI_EXTRA_REPOSITORY_KEY}"
20
21
22 .rdep-build-script: &rdep-build-script |
23 export CCACHE_DIR=${CCACHE_TMP_DIR}
24 # Add deb-src entries
25 sed -i 's/^Types:.*/Types: deb deb-src/' /etc/apt/sources.list.d/debian.sources
26 apt-get update && eatmydata apt-get install --no-install-recommends -y \
27 aptitude \
28 devscripts \
29 ccache \
30 equivs \
31 build-essential \
32 fakeroot \
33 apt-utils
34
35 # install built packages repo
36 (set -e; cd "${WORKING_DIR}"; mkdir -p dists/salsa/main/; cd dists/salsa/main/; ln -s ../../.. binary-amd64)
37 tee "${WORKING_DIR}/apt-salsa-release.conf" <<EOF
38 APT::FTPArchive::Release::Origin "SalsaCI";
39 APT::FTPArchive::Release::Label "SalsaCI internal rdeps";
40 APT::FTPArchive::Release::Codename "salsa";
41 APT::FTPArchive::Release::Architectures "amd64";
42 APT::FTPArchive::Release::Components "main";
43 APT::FTPArchive::Release::Description "Salsa CI internal repo";
44 EOF
45 tee "${WORKING_DIR}/apt-ftparchive.conf" <<EOF
46 Dir {
47 ArchiveDir ".";
48 CacheDir ".";
49 };
50 Default {
51 Packages::Compress ". gzip bzip2";
52 Sources::Compress "gzip bzip2";
53 Contents::Compress "gzip bzip2";
54 };
55 BinDirectory "dists/salsa/main/binary-amd64" {
56 Packages "dists/salsa/main/binary-amd64/Packages";
57 Contents "dists/salsa/Contents-amd64";
58 };
59 Tree "dists/salsa" {
60 Sections "main";
61 Architectures "amd64";
62 };
63 Default {
64 Packages {
65 Extensions ".deb";
66 };
67 };
68 EOF
69 (set -e; cd "${WORKING_DIR}"; apt-ftparchive generate apt-ftparchive.conf)
70 (set -e; cd "${WORKING_DIR}"; apt-ftparchive -c apt-salsa-release.conf release dists/salsa/ >dists/salsa/Release)
71 tee /etc/apt/sources.list.d/build.sources <<EOF
72 Types: deb
73 URIs: file://${WORKING_DIR}
74 Suites: salsa
75 Components: main
76 Trusted: yes
77 EOF
78 apt update
79 # install build dep
80 apt -y build-dep ${REVERSE_DEP}
81 # download source
82 cd ${WORKING_DIR}
83 # Generate ccache links
84 dpkg-reconfigure ccache
85 PATH="/usr/lib/ccache/:${PATH}"
86 # Reset ccache stats
87 ccache -z
88 # Create salsaci user and fix permissions
89 useradd salsaci
90 chown -R salsaci. ${WORKING_DIR} ${CCACHE_DIR}
91 # Define buildlog filename
92 BUILD_LOGFILE="${WORKING_DIR}/${REVERSE_DEP}.build"
93 # Build package as user salsaci
94 su salsaci -c "eatmydata apt source -b ${REVERSE_DEP}" |& OUTPUT_FILENAME=${BUILD_LOGFILE} filter-output
95 # Restore PWD to ${WORKING_DIR}
96 cd ${WORKING_DIR}
97 rm -rf ${WORKING_DIR}/${REVERSE_DEP}*
98 # Print ccache stats on job log
99 ccache -s
100
101 .rdep-build-definition: &rdep-build-definition
102 stage: test
103 image: $SALSA_CI_IMAGES_BASE
104 cache:
105 key: "${REVERSE_DEP}-build"
106 paths:
107 - .ccache
108 except:
109 variables:
110 - $SALSA_CI_ENABLE_REVERSE_DEPENDENCY_BUILD !~ /^(1|yes|true)$/
111 - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/
112 - $CI_MERGE_REQUEST_ID != null
113 variables:
114 CCACHE_TMP_DIR: ${CI_PROJECT_DIR}/../.ccache
115 CCACHE_WORK_DIR: ${CI_PROJECT_DIR}/.ccache
116 script:
117 - *rdep-build-before-script
118 - *rdep-build-script
119 - mv ${CCACHE_TMP_DIR} ${CCACHE_WORK_DIR}
120 needs:
121 - job: build
122 artifacts: true
123
124 build-rdep-node-tap:
125 variables:
126 REVERSE_DEP: node-tap
127 extends: .rdep-build-definition