#!/usr/bin/python -t # -*- mode: Python; indent-tabs-mode: nil; -*- # # 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 2 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, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA import errno, os, sys import Utils, Push try: from plague.LockFile import LockFile, LockFileLocked except: from LockFile import LockFile, LockFileLocked def main(cfg,args): assert(len(args)>1) dist = args[0] whitelist = args[1:] Push.cfg = cfg result, repochanged = Push.copy_sign_move(dist,whitelist) if result: sys.exit(result) if __name__ == '__main__': argstable = None if '--stable' in sys.argv: sys.argv.remove('--stable') argstable = True if len(sys.argv) < 2: print 'Usage: %s [--stable]\n' % os.path.basename(sys.argv[0]) sys.exit(errno.EINVAL) cfg = Utils.load_config_module(sys.argv[1]) if hasattr(cfg.opts,'pushtotesting') and cfg.opts.pushtotesting and argstable: del cfg.opts.pushtotesting os.umask(cfg.signersumask) Utils.signer_gid_check(cfg.signersgid) if cfg.opts.signkeycheck: Utils.sign_key_check_all(cfg) if not os.path.exists(cfg.rundir): os.makedirs(cfg.rundir) lockfile = os.path.join(cfg.rundir,'pushscript.lock') lock = LockFile(lockfile) try: lock.lock() except LockFileLocked: print 'Script locked via %s\nIt seems to be in use already.' % lockfile sys.exit(errno.EPERM) main(cfg,sys.argv[2:]) lock.unlock() sys.exit(0)