Kaydet (Commit) 28d989e0 authored tarafından S.Çağlar Onur's avatar S.Çağlar Onur

remove unneeded and move repo script into repo script dir

üst 30405527
#! /usr/bin/python
# a simple tool to list stuff in source repository
# author: exa
import sys
import os
import pisi
import pisi.api
import pisi.config
import pisi.specfile as specfile
import pisi.context as ctx
import pisi.util
options = pisi.config.Options()
if len(sys.argv) > 2:
options.destdir=sys.argv[2]
else:
options.destdir = '/'
pisi.api.init(database=False, options=options)
repo_uri = sys.argv[1]
for root, dirs, files in os.walk(repo_uri):
for fn in files:
if fn == 'pspec.xml':
#ctx.ui.info(_('Adding %s to package index') % fn)
sf = specfile.SpecFile()
sf.read(pisi.util.join_path(root, fn))
sf.check()
print '%s: %s' % (sf.source.name, sf.source.version)
pisi.api.finalize()
#!/usr/bin/python
#
# Copyright (C) 2005, TUBITAK/UEKAE
#
# 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.
#
# Please read the COPYING file.
import os
import sys
sys.path.append('.')
import pisi.api
import pisi.uri
import pisi.context as ctx
import pisi.specfile
import pisi.util as util
from pisi.fetcher import fetch_url
def scanPSPEC(folder):
packages = []
for root, dirs, files in os.walk(folder):
if "pspec.xml" in files:
packages.append(root)
# dont walk into the versioned stuff
if ".svn" in dirs:
dirs.remove(".svn")
return packages
def isCached(file, sha1sum):
try:
return util.check_file_hash(os.path.join(ctx.config.archives_dir(), file), sha1sum)
except:
pass
if __name__ == "__main__":
pisi.api.init(database=False, options='')
try:
packages = scanPSPEC(sys.argv[1])
except:
print "Usage: fetchAll.py path2repo"
sys.exit(1)
for package in packages:
spec = pisi.specfile.SpecFile()
spec.read(os.path.join(package, "pspec.xml"))
URI = pisi.uri.URI(spec.source.archive.uri)
if not isCached(URI.filename(), spec.source.archive.sha1sum):
print URI, " -> " , os.path.join(ctx.config.archives_dir(), URI.filename())
try:
fetch_url(URI, ctx.config.archives_dir())
except pisi.fetcher.FetchError, e:
print e
pass
else:
print URI, "already downloaded..."
pisi.api.finalize()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment