#!/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 def main(cfg,dist): Utils.make_std_repodirs(cfg,dist) if hasattr(cfg,'repobuild_linkdict'): # get rid of symlinks that are in the way (of createrepo) for link in cfg.repobuild_linkdict.get(dist) or []: flink = os.path.join( Utils.get_reporoot(cfg,dist), link) if os.path.islink(flink): os.unlink(flink) srpmspath = Utils.srpm_repodir(cfg,dist) Utils.create_repository(cfg,dist,srpmspath,nodeltas=True) # source rpms for arch in cfg.archdict[dist]: Utils.create_repository(cfg, dist, Utils.rpm_repodir(cfg,dist,arch), arch=arch) # binary rpms Utils.create_repository(cfg, dist, Utils.debug_repodir(cfg,dist,arch), debuginfo=True,nodeltas=True) # debuginfo rpms if hasattr(cfg,'repobuild_linkdict'): # recreate symlinks for link in cfg.repobuild_linkdict.get(dist) or []: flink = os.path.join( Utils.get_reporoot(cfg,dist), link) if not os.path.exists(flink): os.symlink(cfg.repobuild_linkdict[dist][link], flink) def SignRepoMD(cfg,dist): if not hasattr(cfg,'repomdsigncmds'): return True if dist in cfg.repomdsigncmds.keys(): signcmd = cfg.repomdsigncmds[dist] else: # dist repo not configured to be signed return True print "Signing repomd.xml files:" paths = [Utils.srpm_repodir(cfg,dist)] for arch in cfg.archdict[dist]: paths.append(Utils.rpm_repodir(cfg,dist,arch)) # binary rpms paths.append(Utils.debug_repodir(cfg,dist,arch)) for path in paths: repomdfile = os.path.join(path,'repodata','repomd.xml') signedfile = repomdfile+'.asc' if os.path.exists(signedfile): continue while (True): print repomdfile result = os.system( '%s %s' % (signcmd,repomdfile) ) if not result: break while (True): print 'Retry? (y/n)', a = raw_input().lower() if a=='n': return False if a=='y': break return True if __name__ == '__main__': if len(sys.argv) < 3: print 'Usage: %s [release]...\n' % os.path.basename(sys.argv[0]) sys.exit(errno.EINVAL) cfg = Utils.load_config_module(sys.argv[1]) me = os.getcwd() Utils.signer_gid_check(cfg.signersgid) os.umask(cfg.signersumask) for dist in sys.argv[2:]: if not cfg.archdict.has_key(dist): print "No distribution release named '%s' found" % dist continue main(cfg,dist) os.chdir(me)