extras-buildsys/utils/pushscript WhatsNew.py,NONE,1.1
Michael Schwendt (mschwendt)
fedora-extras-commits at redhat.com
Thu Nov 30 10:53:55 UTC 2006
Author: mschwendt
Update of /cvs/fedora/extras-buildsys/utils/pushscript
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv4954
Added Files:
WhatsNew.py
Log Message:
trying something
--- NEW FILE WhatsNew.py ---
#!/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 fnmatch
import pickle
import rpmUtils.transaction, rpmUtils.miscutils
import Utils
names = {}
def rebuild(dist,srcdir):
ts = rpmUtils.transaction.initReadOnlyTransaction()
# Create map of maps: dist -> src.rpm %name -> True
names.setdefault(dist,{})
for root, dirs, files in os.walk(srcdir):
for f in fnmatch.filter(files,'*.src.rpm'):
srcfile = os.path.join(root,f)
hdr = rpmUtils.miscutils.hdrFromPackage(ts,srcfile)
set(dist,hdr['name'])
def set(dist,name):
names[dist].setdefault(name,True)
def get(dist,name):
return names[dist].has_key(name)
def save(workdir):
f = file(os.path.join(workdir,'pkgnamesdict.pickle'),'w')
pickle.dump(names,f)
f.close()
def load(workdir):
global names
names = {}
try:
f = file(os.path.join(workdir,'pkgnamesdict.pickle'),'r')
except:
return
names = pickle.load(f)
f.close()
def main(cfg):
global names
names = {}
for dist in cfg.alldists:
srcdir = os.path.join(cfg.treedir,dist,'SRPMS')
rebuild(dist,srcdir)
save(cfg.rundir)
if __name__ == '__main__':
if len(sys.argv) < 2:
print 'Usage: %s <project>\n' % os.path.basename(sys.argv[0])
sys.exit(errno.EINVAL)
cfg = Utils.load_config_module(sys.argv[1])
Utils.signer_gid_check(cfg.signersgid)
os.umask(cfg.signersumask)
main(cfg)
sys.exit(0)
More information about the scm-commits
mailing list