* implement util function to check output dirs
This commit is contained in:
@@ -11,6 +11,7 @@ from sys import stderr
|
|||||||
|
|
||||||
# pisi modules
|
# pisi modules
|
||||||
import pisiconfig
|
import pisiconfig
|
||||||
|
import util
|
||||||
|
|
||||||
class FetchError (Exception):
|
class FetchError (Exception):
|
||||||
pass
|
pass
|
||||||
@@ -20,6 +21,7 @@ class Fetcher:
|
|||||||
def __init__(self, uri):
|
def __init__(self, uri):
|
||||||
self.uri = uri
|
self.uri = uri
|
||||||
self.filedest = pisiconfig.archives_dir
|
self.filedest = pisiconfig.archives_dir
|
||||||
|
util.check_dir(self.filedest)
|
||||||
self.scheme = "file"
|
self.scheme = "file"
|
||||||
self.netloc = ""
|
self.netloc = ""
|
||||||
self.filepath = ""
|
self.filepath = ""
|
||||||
|
|||||||
+3
-3
@@ -47,9 +47,9 @@ def main():
|
|||||||
|
|
||||||
# doing the real job... vs. vs...
|
# doing the real job... vs. vs...
|
||||||
pb = PisiBuild(pspec)
|
pb = PisiBuild(pspec)
|
||||||
util.information("Building PISI package for: %s" % pb.packageName)
|
util.information("Building PISI package for: %s" % pb.spec.sourceName)
|
||||||
util.information("Fetching source from: %s (be patient)" % pb.archiveUri)
|
util.information("Fetching source from: %s (be patient)" % pb.spec.archiveUri)
|
||||||
print pb.archiveType, pb.archiveHash
|
print pb.spec.archiveType, pb.spec.archiveHash
|
||||||
pb.fetchArchive()
|
pb.fetchArchive()
|
||||||
util.information("Source archive is stored: %s/%s" %(pisiconfig.archives_dir, pb.archiveName))
|
util.information("Source archive is stored: %s/%s" %(pisiconfig.archives_dir, pb.archiveName))
|
||||||
# pb.unpackArchive()
|
# pb.unpackArchive()
|
||||||
|
|||||||
+7
-12
@@ -17,20 +17,15 @@ class PisiBuild:
|
|||||||
"""PisiBuild class, provides the package build and creation rutines"""
|
"""PisiBuild class, provides the package build and creation rutines"""
|
||||||
def __init__(self, pspecfile):
|
def __init__(self, pspecfile):
|
||||||
self.pspecfile = pspecfile
|
self.pspecfile = pspecfile
|
||||||
pspec = SpecFile()
|
spec = SpecFile()
|
||||||
pspec.read(pspecfile)
|
spec.read(pspecfile)
|
||||||
pspec.verify() # check pspec integrity
|
spec.verify() # check pspec integrity
|
||||||
|
|
||||||
self.packageName = pspec.sourceName
|
# additional processing on spec file
|
||||||
|
self.archiveName = basename(spec.archiveUri)
|
||||||
self.archiveUri = pspec.archiveUri
|
self.spec = spec
|
||||||
self.archiveName = basename(self.archiveUri)
|
|
||||||
self.archiveType = pspec.archiveType
|
|
||||||
self.archiveHash = pspec.archiveHash
|
|
||||||
|
|
||||||
self.pspec = pspec
|
|
||||||
|
|
||||||
def fetchArchive(self):
|
def fetchArchive(self):
|
||||||
fetch = Fetcher(self.archiveUri)
|
fetch = Fetcher(self.spec.archiveUri)
|
||||||
fetch.fetch()
|
fetch.fetch()
|
||||||
|
|
||||||
|
|||||||
+13
@@ -5,6 +5,19 @@ import string
|
|||||||
def information(message):
|
def information(message):
|
||||||
print 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
|
# run a command non-interactively
|
||||||
def run_batch(cmd):
|
def run_batch(cmd):
|
||||||
print 'running ', cmd
|
print 'running ', cmd
|
||||||
|
|||||||
Reference in New Issue
Block a user