- sourcearchive'de de cleanDir kullanılabilsin.
- non-interactive çalışabilsin.
This commit is contained in:
@@ -29,19 +29,20 @@ class SourceArchive:
|
|||||||
self.url = PUrl(self.ctx.spec.source.archiveUri)
|
self.url = PUrl(self.ctx.spec.source.archiveUri)
|
||||||
self.dest = join(config.archives_dir(), self.url.filename())
|
self.dest = join(config.archives_dir(), self.url.filename())
|
||||||
|
|
||||||
def fetch(self):
|
def fetch(self, interactive=True):
|
||||||
if not self.isCached():
|
if not self.isCached(interactive):
|
||||||
fetchUrl(self.url, config.archives_dir(), displayProgress)
|
fetchUrl(self.url, config.archives_dir(), displayProgress)
|
||||||
|
|
||||||
def isCached(self):
|
def isCached(self, interactive=True):
|
||||||
if not access(self.dest, R_OK):
|
if not access(self.dest, R_OK):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# check hash
|
# check hash
|
||||||
if util.sha1_file(self.dest) == self.ctx.spec.source.archiveSHA1:
|
if util.sha1_file(self.dest) == self.ctx.spec.source.archiveSHA1:
|
||||||
ui.info('%s [cached]\n' % self.ctx.spec.source.archiveName)
|
if interactive:
|
||||||
|
ui.info('%s [cached]\n' % self.ctx.spec.source.archiveName)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def unpack(self):
|
def unpack(self, cleanDir=False):
|
||||||
archive = Archive(self.dest, self.ctx.spec.source.archiveType)
|
archive = Archive(self.dest, self.ctx.spec.source.archiveType)
|
||||||
archive.unpack(self.ctx.pkg_work_dir())
|
archive.unpack(self.ctx.pkg_work_dir(), cleanDir)
|
||||||
|
|||||||
Reference in New Issue
Block a user