Skip to content
Snippets Groups Projects
Commit c232934b authored by Guido Gunther's avatar Guido Gunther :zzz:
Browse files

Add blessed builds for byzantium

This is similar to what we did for the CI builds working
towards less delta.

We drop
- lintian checks (since they ran *past* the upload and
  we can do those in gitlab-ci)
- Support for sloppy builds since those aren't allowed for byzantium
  anyway.
parent 72139ccd
No related branches found
No related tags found
No related merge requests found
......@@ -14,56 +14,58 @@
@Grab('org.yaml:snakeyaml:1.17')
import org.yaml.snakeyaml.Yaml
// The Operating system we build for. This is the first part
// of the git branch: ${os}/${dist}
def os = 'debian'
// Default distribution to build for
def default_dists = ['amber-phone-staging']
// Default architectures to build for
def default_archs = ['aarch64']
// Our repo
def default_url_prefix = 'https://source.puri.sm/Librem5/'
// Options to pass to git-buildpackage
def default_build_args = '--git-no-pristine-tar --git-pbuilder --git-ignore-new --git-ignore-branch --jobs=auto -nc --build=full -sa'
// the same but for sloppy builds
def sloppy_build_args = '--git-force-create --git-upstream-tree=SLOPPY'
def default_repo = "scratch"
def default_build_args = '--git-no-create-orig --git-pbuilder --git-ignore-new --git-ignore-branch -nc --build=full -sa'
// All jobs will be generated in this folder
def folder = 'debs'
def folder = 'debs-byzantium'
// Artifacts
def artifacts = '*.deb,*.changes,*.dsc,*.xz,*.gz'
def artifacts = '*.deb,*.changes,*.dsc,*.xz,*.gz,*.buildinfo'
// Signature (keyid) for signing the packages before upload
def pkg_gpg_keyid = '1CBB2345A7F02749' //jenkins@arm02.puri.sm
// Who get's mail notifications
def email_to = 'librem5-builds@lists.community.puri.sm'
def email_from = 'arno.bauernoppel@puri.sm'
def email_from = 'guido.gunther@puri.sm'
def uploads = '*.deb *.tar.* *.diff.* *.dsc *.changes *.buildinfo'
// Load jobs from YAML file
Yaml yaml = new Yaml()
def jobsfile = (new File(__FILE__)).parent + '/jobs.yml'
def dist = 'byzantium'
def jobsfile = (new File(__FILE__)).parent + '/' + dist + '.yml'
def defaults_file = (new File(__FILE__)).parent + '/dists.yml'
println("Using defaults from : ${defaults_file}")
println("Using jobsfile : ${jobsfile}")
println("Using jobsfile : ${jobsfile}")
def pkgs = yaml.load(new File(jobsfile).text)
def uploads = '*.deb *.tar.* *.diff.* *.dsc *.changes *.buildinfo'
def defaults = yaml.load(new File(defaults_file).text)
def dist_defaults = defaults.get(dist)
def default_repo = dist_defaults.get('repo')
def default_archs = dist_defaults.get('archs')
def default_branch = dist_defaults.get('branch')
def os = dist_defaults.get('os')
def build_dist = dist_defaults.get('build_dist', dist)
pkgs.each { pkg ->
params = pkg.value
deb_build_opts = params.get('deb_build_options', '')
deb_build_profiles = params.get('deb_build_profiles', '')
default_archs.each { arch ->
default_dists.each { dist ->
params = pkg.value
url = params.get('url', default_url_prefix + pkg.key + '.git')
deb_build_opts = params.get('deb_build_options', '')
deb_build_profiles = params.get('deb_build_profiles', '')
default_archs.each { arch ->
name = folder + '/' + 'deb-' + pkg.key + '-' + dist + '-' + arch
branch = params.get('branch', os + '/' + dist)
aptly_repo = params.get('repo', default_repo)
branch = params.get('branch', default_branch)
submodule_update = params.get('submodule_update', true)
dist_arg = '--git-dist=' + dist
build_dist_arg = '--git-dist=' + build_dist
if (submodule_update) {
submodule_update_cmd = 'git submodule update --init --recursive'
......@@ -74,34 +76,16 @@ pkgs.each { pkg ->
//Currently builds are only for aarch64
dpkg_args = ''
// Sloppy builds always build a new upstream tarball to save us from patch
// maintenance:
// https://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.special.sloppytarball.html
if (params.get('sloppy', false)) {
// Not much todo here, we just want to make sure we create a fresh tarball
// since for sloppy builds upstrem tarballs change on each commit:
// creates a new tarball anyway:
origtgz_cmd = ''
build_args = "${default_build_args} ${sloppy_build_args} --git-debian-branch=\${head_tag}"
} else { // regular blessed build
build_args = "${default_build_args}"
origtgz_cmd = """
git fetch origin pristine-tar || true
gbp export-orig --pristine-tar || gbp export-orig --no-pristine-tar
"""
}
build_args = "${default_build_args}"
origtgz_cmd = """
if ! grep -qs '(native)' debian/source/format; then
git fetch origin pristine-tar
gbp export-orig --pristine-tar
fi
"""
scm_tag_cmd = """commit="\$(git for-each-ref --sort=taggerdate --format '%(objectname)' refs/tags | tail -n 1)"; head_tag="\$(git describe --exact-match --tags \${commit})" 2> /dev/null || exit 128""".stripIndent()
scm_verify_tag_cmd = "/bin/false" // save default
dev_mail = params.get('gpg-allowed-dev','')
if(! dev_mail.equals('')) {
dev_mail = "'" + dev_mail + "'"
//verify dev tag in output
scm_verify_tag_cmd = """git tag -v "\${head_tag}" 2>&1 | grep -F @ | perl -e "\\\\\$ret=0; while(<>){ \\\\\$_=~/Good signature/ and \\\\\$ret++; index(\\\\\$_, ${dev_mail}) != -1 and \\\\\$ret++; }; exit \\\\\$ret - 2;" || exit 64""".stripIndent()
} else {
scm_verify_tag_cmd = """git tag -v "\${head_tag}" || exit 64""".stripIndent()
}
scm_verify_tag_cmd = """git tag -v "\${head_tag}" || exit 64""".stripIndent()
scm_checkout_cmd = """cd build
${submodule_update_cmd}
......@@ -115,11 +99,9 @@ pkgs.each { pkg ->
${scm_checkout_cmd}
${scm_verify_tag_cmd}
#If changelog does not contain the distribution amber-phone, amber-phone-staging or purple mark as not built
# changelog distribution needs to be byzantium or landing
echo "Changelog: \$(dpkg-parsechangelog -S Distribution)"
dpkg-parsechangelog -S Distribution | grep -qsE '^(amber-phone(-staging)?|purple)\$' || exit 32
#If it is purple change to amber-phone (temporary)
sed -i '1 s/ purple;/ amber-phone;/' debian/changelog
dpkg-parsechangelog -S Distribution | grep -qsE '^(byzantium|landing)\$' || exit 32
# get the upstream tarball if necessary
${origtgz_cmd}
......@@ -128,7 +110,7 @@ pkgs.each { pkg ->
export DEB_BUILD_PROFILES='${deb_build_profiles.join(' ')}'
export GIT_PBUILDER_OPTIONS='--source-only-changes'
echo "Building ${pkg.key} tag: \${head_tag}"
gbp buildpackage ${[dist_arg, build_args, dpkg_args].join(' ')}
gbp buildpackage ${[build_dist_arg, build_args, dpkg_args].join(' ')}
""".stripIndent()
upload_cmd = """
......@@ -141,8 +123,6 @@ pkgs.each { pkg ->
sudo /usr/bin/debsign -k "${pkg_gpg_keyid}" "\${changes_file}" || exit 16
# finally upload the package
dput -c /etc/dput.cf pureos-ftp "\${changes_file}" || exit 32;
#Check with lintian for errors
lintian --suppress-tags bad-distribution-in-changes-file -c "\${changes_file}" || exit 64
""".stripIndent()
node_label = "${os}-${arch}"
......@@ -166,7 +146,6 @@ pkgs.each { pkg ->
]
try {
def lintian_result = ""
def head_tag = ""
stage('Build Debian Package') {
......@@ -174,7 +153,7 @@ pkgs.each { pkg ->
checkout([
changelog: true,
poll: true,
userRemoteConfigs: [[url: '${params.url}', refspec: '+refs/tags/*:refs/remotes/origin/tags/*']],
userRemoteConfigs: [[url: '${url}', refspec: '+refs/tags/*:refs/remotes/origin/tags/*']],
\$class: 'GitSCM',
branches: [[name: '**']],
extensions: [[\$class: 'RelativeTargetDirectory',
......@@ -192,11 +171,7 @@ pkgs.each { pkg ->
throw "not built"
} else if (result == 64) {
currentBuild.result = 'NOT_BUILT'
if(params.get('gpg-allowed-dev', false)) {
print "Tag verification with key of " + params.get('gpg-allowed-dev', false) + " failed!"
} else {
print "Tag verification failed!"
}
print "Tag verification failed!"
throw "not built"
} else if (result == 32) {
currentBuild.result = 'NOT_BUILT'
......@@ -224,10 +199,7 @@ pkgs.each { pkg ->
def result = sh returnStatus: true, script: '''${upload_cmd}'''
if(result != 0) {
if (result == 64) {
lintian_result = 'lintian failed'
print "Lintian check of package failed."
} else if (result == 32) {
if (result == 32) {
currentBuild.result = 'FAILURE'
print "Upload of package failed."
} else if (result == 16) {
......@@ -304,6 +276,5 @@ pkgs.each { pkg ->
}
}
}
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment