From c3481c703fbb84666f0617631a3d5b5da597008b Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 9 Oct 2016 15:09:37 +0300 Subject: Remove obsolete scripts --- scripts/pbuilder-create | 104 ------------------------------------------------ 1 file changed, 104 deletions(-) delete mode 100755 scripts/pbuilder-create (limited to 'scripts/pbuilder-create') diff --git a/scripts/pbuilder-create b/scripts/pbuilder-create deleted file mode 100755 index 1afa2c6..0000000 --- a/scripts/pbuilder-create +++ /dev/null @@ -1,104 +0,0 @@ -#!/usr/bin/python -# Copyright 2011 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 . - - -import cliapp -import logging -import os -import subprocess -import time - - -class PbuilderCreate(cliapp.Application): - - def add_settings(self): - self.settings.string(['mirror', 'm'], - 'use URL for mirror (%default)', - metavar='URL', - default='http://cdn.debian.net/debian') - self.settings.string_list(['release', 'r'], - 'build tgz for RELEASE (%default)', - metavar='RELEASE', - default=['unstable']) - arch = self.runcmd(['dpkg', '--print-architecture']).strip() - self.settings.string_list(['arch', 'a'], - 'build tgz for ARCH (%default)', - metavar='ARCH', default=[arch]) - self.settings.string_list(['othermirror', 'o'], - 'also build tgz with pbuilder ' - '--othermirror, set to empty to avoid ' - 'this (%default)') - self.settings.integer(['max-age'], - 'trigger tgz update if older than N days ' - '(%default)', - metavar='N', default=1) - self.settings.boolean(['no-act', 'dry-run'], 'just pretend') - self.settings.boolean(['verbose'], 'print commands before executing') - self.settings.string(['directory', 'd'], - 'where to put tgz files (%default)', - default='/var/cache/pbuilder') - - def process_args(self, args): - for release in self.settings['release']: - for arch in self.settings['arch']: - self.pbuilder(release, arch, 'pristine', None) - if self.settings['othermirror']: - self.pbuilder(release, arch, 'custom', - self.settings['othermirror']) - - argv = ['pbuilder', '--clean'] - if self.settings['verbose']: - print ' '.join(argv) - self.runcmd(argv) - - def pbuilder(self, release, arch, suffix, othermirror): - tgz = self.tgz(release, arch, suffix) - if os.path.exists(tgz): - if not self.need_to_update_tgz(tgz): - return - argv = ['pbuilder', - '--update', - '--basetgz', tgz, - '--logfile', tgz + '.log'] - else: - argv = ['pbuilder', - '--create', - '--mirror', self.settings['mirror'], - '--architecture', arch, - '--distribution', release, - '--basetgz', tgz, - '--logfile', tgz + '.log'] - for x in othermirror or []: - argv += ['--othermirror', x] - if self.settings['verbose']: - print ' '.join(argv) - if self.settings['no-act']: - return - self.runcmd(argv) - - def need_to_update_tgz(self, tgz): - mtime = os.path.getmtime(tgz) - now = time.time() - max_age_secs = self.settings['max-age'] * 24 * 60 * 40 - return mtime <= now - max_age_secs - - def tgz(self, release, arch, suffix): - basename = '%s-%s-%s.tgz' % (release, arch, suffix) - return os.path.join(self.settings['directory'], basename) - - -if __name__ == '__main__': - PbuilderCreate().run() -- cgit v1.2.1