# Copyright 2016 Lars Wirzenius # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # # =*= License: GPL-3+ =*= import icklib class CreateDebianSourcePackagesForCI(icklib.BuildStep): def build(self): if not self.run_state.build_using_debian_ci: return dsc_targets = [] codenames = set() for target in self.targets: if target.debian_codename not in codenames: dsc_targets.append(target) codenames.add(target.debian_codename) for target in dsc_targets: self.run_state.progress['step'] = ( 'Create dsc for {}'.format(target.debian_codename)) self.run_state.logger.important( 'Creating dsc for {codename}', codename=target.debian_codename) with self.run_state.logger: remote_tmp = target.mkdtemp() remote_git_dir = target.sync_to_target( self.run_state.clones[0].dirname, remote_tmp, 'git') remote_artifacts_dir = target.sync_to_target( self.run_state.build_info.create_artifacts_directory(), remote_tmp, 'artifacts') cleanly_path = self.project.copy_cleanly_to_target( target, remote_tmp) self.project.run_cleanly( target, remote_git_dir, cleanly_path, ['--results', remote_artifacts_dir, '--ci', '--buildno', str(self.run_state.build_info.build_number), '--debian-release', target.debian_release, '--debian-codename', target.debian_codename, 'dsc']) target.sync_from_target( remote_artifacts_dir, self.run_state.build_info.create_artifacts_directory()) target.remove_all([remote_tmp]) class CreateDebianSourcePackagesForRelease(icklib.BuildStep): def build(self): if not self.run_state.build_tags_using_debian_release: return dsc_targets = self._get_dsc_targets(self.targets) for tag in self.run_state.build_tags_using_debian_release: for target in dsc_targets: self.run_state.progress['step'] = ( 'Create dsc for {} for tag {}'.format( target.debian_codename, tag)) self.run_state.logger.important( 'Creating dsc for {codename} for tag {tag}', codename=target.debian_codename, tag=tag) with self.run_state.logger: remote_tmp = target.mkdtemp() self.run_state.clones[0].checkout(tag) remote_git_dir = target.sync_to_target( self.run_state.clones[0].dirname, remote_tmp, 'git') remote_artifacts_dir = target.sync_to_target( self.run_state.build_info.create_artifacts_directory(), remote_tmp, 'artifacts') cleanly_path = self.project.copy_cleanly_to_target( target, remote_tmp) self.project.run_cleanly( target, remote_git_dir, cleanly_path, ['--results', remote_artifacts_dir, '--release', '--buildno', str(self.run_state.build_info.build_number), '--debian-release', target.debian_release, '--debian-codename', target.debian_codename, 'dsc']) target.sync_from_target( remote_artifacts_dir, self.run_state.build_info.create_artifacts_directory()) target.remove_all([remote_tmp]) def _get_dsc_targets(self, targets): dsc_targets = [] codenames = set() for target in targets: if target.debian_codename not in codenames: dsc_targets.append(target) codenames.add(target.debian_codename) return dsc_targets