#list = [] #for arg in sys.argv[1:]: # if os.path.isfile(arg): # list += open(arg, 'r').readlines() # elif os.path.isdir(arg): # list += glob.glob(os.path.join(arg, '*/*.rpm')) # #if not list: # list += glob.glob(os.path.join(packagedir, '*/*.rpm')) for builder in ('dag', 'dries'): try: list = open( '/dar/pub/rpmforge/persona/' + builder + '/packagelist-' + builder + '.txt', 'r').readlines() except: import urllib2 req = urllib2.Request('http://apt.sw.be/rpmforge/persona/' + builder + '/packagelist-' + builder + '.txt') list = urllib2.urlopen(req).readlines() for file in list: try: pkgrec = readfile(file, builder) except: print file, 'FAILED' continue darlib.insertrec(cur, 'pkg', pkgrec) con.commit()
darlib.createtb(cur, "pkg") # pkgcon.autocommit = 1 # list = [] # for arg in sys.argv[1:]: # if os.path.isfile(arg): # list += open(arg, 'r').readlines() # elif os.path.isdir(arg): # list += glob.glob(os.path.join(arg, '*/*.rpm')) # # if not list: # list += glob.glob(os.path.join(packagedir, '*/*.rpm')) for builder in ("dag", "dries"): try: list = open("/dar/pub/rpmforge/persona/" + builder + "/packagelist-" + builder + ".txt", "r").readlines() except: import urllib2 req = urllib2.Request("http://apt.sw.be/rpmforge/persona/" + builder + "/packagelist-" + builder + ".txt") list = urllib2.urlopen(req).readlines() for file in list: try: pkgrec = readfile(file, builder) except: print file, "FAILED" continue darlib.insertrec(cur, "pkg", pkgrec) con.commit()
if not rec['upstream']: rec['upstream'] = '*****@*****.**' # rec['release'] = rec['release'] rec['specname'] = os.path.basename(file).replace('.spec', '') rec['parent'] = os.path.basename(os.path.dirname(file)) return rec sys.stdout = os.fdopen(1, 'w', 0) con, cur = darlib.opendb() darlib.createtb(cur, 'spec') #createsta = 'create table info ( name varchar(10) unique primary key, ' #for key in spechdr[1:]: createsta += '%s varchar(10), ' % key #createsta = createsta.rstrip(', ') + ' )' for file in glob.glob(os.path.join(specdir, '*/*.spec')): try: specrec = readspec(file) except Exception, e: # print file, 'FAILED' # print e continue # pass try: darlib.insertrec(cur, 'spec', specrec) except Exception, e: print 'ERROR', e, specrec['specname'], file con.commit()
raise if not rec['upstream']: rec['upstream'] = '*****@*****.**' # rec['release'] = rec['release'] rec['specname'] = os.path.basename(file).replace('.spec','') rec['parent'] = os.path.basename(os.path.dirname(file)) return rec sys.stdout = os.fdopen(1, 'w', 0) con, cur = darlib.opendb() darlib.createtb(cur, 'spec') #createsta = 'create table info ( name varchar(10) unique primary key, ' #for key in spechdr[1:]: createsta += '%s varchar(10), ' % key #createsta = createsta.rstrip(', ') + ' )' for file in glob.glob(os.path.join(specdir, '*/*.spec')): try: specrec = readspec(file) except Exception, e: # print file, 'FAILED' # print e continue # pass try: darlib.insertrec(cur, 'spec', specrec) except Exception, e: print 'ERROR', e, specrec['specname'], file con.commit()