* implement util function to check output dirs
This commit is contained in:
@@ -11,6 +11,7 @@ from sys import stderr
|
||||
|
||||
# pisi modules
|
||||
import pisiconfig
|
||||
import util
|
||||
|
||||
class FetchError (Exception):
|
||||
pass
|
||||
@@ -20,6 +21,7 @@ class Fetcher:
|
||||
def __init__(self, uri):
|
||||
self.uri = uri
|
||||
self.filedest = pisiconfig.archives_dir
|
||||
util.check_dir(self.filedest)
|
||||
self.scheme = "file"
|
||||
self.netloc = ""
|
||||
self.filepath = ""
|
||||
|
||||
+3
-3
@@ -47,9 +47,9 @@ def main():
|
||||
|
||||
# doing the real job... vs. vs...
|
||||
pb = PisiBuild(pspec)
|
||||
util.information("Building PISI package for: %s" % pb.packageName)
|
||||
util.information("Fetching source from: %s (be patient)" % pb.archiveUri)
|
||||
print pb.archiveType, pb.archiveHash
|
||||
util.information("Building PISI package for: %s" % pb.spec.sourceName)
|
||||
util.information("Fetching source from: %s (be patient)" % pb.spec.archiveUri)
|
||||
print pb.spec.archiveType, pb.spec.archiveHash
|
||||
pb.fetchArchive()
|
||||
util.information("Source archive is stored: %s/%s" %(pisiconfig.archives_dir, pb.archiveName))
|
||||
# pb.unpackArchive()
|
||||
|
||||
+7
-12
@@ -17,20 +17,15 @@ class PisiBuild:
|
||||
"""PisiBuild class, provides the package build and creation rutines"""
|
||||
def __init__(self, pspecfile):
|
||||
self.pspecfile = pspecfile
|
||||
pspec = SpecFile()
|
||||
pspec.read(pspecfile)
|
||||
pspec.verify() # check pspec integrity
|
||||
spec = SpecFile()
|
||||
spec.read(pspecfile)
|
||||
spec.verify() # check pspec integrity
|
||||
|
||||
self.packageName = pspec.sourceName
|
||||
|
||||
self.archiveUri = pspec.archiveUri
|
||||
self.archiveName = basename(self.archiveUri)
|
||||
self.archiveType = pspec.archiveType
|
||||
self.archiveHash = pspec.archiveHash
|
||||
|
||||
self.pspec = pspec
|
||||
# additional processing on spec file
|
||||
self.archiveName = basename(spec.archiveUri)
|
||||
self.spec = spec
|
||||
|
||||
def fetchArchive(self):
|
||||
fetch = Fetcher(self.archiveUri)
|
||||
fetch = Fetcher(self.spec.archiveUri)
|
||||
fetch.fetch()
|
||||
|
||||
|
||||
+13
@@ -5,6 +5,19 @@ import string
|
||||
def information(message):
|
||||
print message
|
||||
|
||||
# check if directory exists, and create if it doesn't
|
||||
# works recursively
|
||||
# FIXME: could hav a better name
|
||||
def check_dir(dir):
|
||||
dir = dir.rstrip()
|
||||
dir = dir.rstrip("/")
|
||||
#print 'check dir ', dir
|
||||
if not os.access(dir, os.F_OK):
|
||||
# does the parent exist?
|
||||
(parent_dir, curr_dir) = os.path.split(dir)
|
||||
check_dir(parent_dir)
|
||||
os.mkdir(dir)
|
||||
|
||||
# run a command non-interactively
|
||||
def run_batch(cmd):
|
||||
print 'running ', cmd
|
||||
|
||||
Reference in New Issue
Block a user