"equo source", new option --savehere
user can choose to download sources into CWD instead of entropy tmp directory
This commit is contained in:
@@ -137,6 +137,7 @@ myopts = [
|
||||
(1,'source',2,_('download atoms source code')),
|
||||
(2,'--ask',2,_('ask before making any changes')),
|
||||
(2,'--pretend',1,_('just show what would be done')),
|
||||
(2,'--savehere',1,_('save sources in current working directory')),
|
||||
None,
|
||||
(1,'remove',2,_('remove one or more packages')),
|
||||
(2,'--ask',2,_('ask before making any changes')),
|
||||
|
||||
+13
-3
@@ -50,6 +50,7 @@ def package(options):
|
||||
equoRequestListfiles = False
|
||||
equoRequestChecksum = True
|
||||
equoRequestSortSize = False
|
||||
equoRequestSaveHere = False
|
||||
equoRequestMultifetch = 1
|
||||
rc = 0
|
||||
_myopts = []
|
||||
@@ -78,6 +79,8 @@ def package(options):
|
||||
equoRequestResume = True
|
||||
elif (opt == "--sortbysize"):
|
||||
equoRequestSortSize = True
|
||||
elif (opt == "--savehere"):
|
||||
equoRequestSaveHere = True
|
||||
elif (opt == "--multifetch"):
|
||||
equoRequestMultifetch = 3
|
||||
elif (opt.startswith("--multifetch=")):
|
||||
@@ -124,7 +127,8 @@ def package(options):
|
||||
|
||||
if myopts or mytbz2paths:
|
||||
status, rc = downloadSources(myopts, deps = equoRequestDeps,
|
||||
deepdeps = equoRequestDeep, tbz2 = mytbz2paths)
|
||||
deepdeps = equoRequestDeep, tbz2 = mytbz2paths,
|
||||
savecwd = equoRequestSaveHere)
|
||||
else:
|
||||
print_error(red(" %s." % (_("Nothing to do"),) ))
|
||||
rc = 127
|
||||
@@ -575,7 +579,8 @@ def _generateRunQueue(foundAtoms, deps, emptydeps, deepdeps):
|
||||
|
||||
return False, runQueue
|
||||
|
||||
def downloadSources(packages = [], deps = True, deepdeps = False, tbz2 = []):
|
||||
def downloadSources(packages = [], deps = True, deepdeps = False, tbz2 = [],
|
||||
savecwd = False):
|
||||
|
||||
foundAtoms = _scanPackages(packages, tbz2)
|
||||
# are there packages in foundAtoms?
|
||||
@@ -594,11 +599,16 @@ def downloadSources(packages = [], deps = True, deepdeps = False, tbz2 = []):
|
||||
|
||||
totalqueue = str(len(runQueue))
|
||||
fetchqueue = 0
|
||||
metaopts = {}
|
||||
if savecwd:
|
||||
metaopts['fetch_path'] = os.getcwd()
|
||||
|
||||
for packageInfo in runQueue:
|
||||
fetchqueue += 1
|
||||
|
||||
Package = Equo.Package()
|
||||
Package.prepare(packageInfo,"source")
|
||||
|
||||
Package.prepare(packageInfo,"source", metaopts)
|
||||
|
||||
xterm_header = "Equo ("+_("sources fetch")+") :: "+str(fetchqueue)+" of "+totalqueue+" ::"
|
||||
print_info(red(" :: ")+bold("(")+blue(str(fetchqueue))+"/"+red(totalqueue)+bold(") ")+">>> "+darkgreen(Package.infoDict['atom']))
|
||||
|
||||
@@ -1368,7 +1368,12 @@ class Package:
|
||||
# first fine wins
|
||||
for url in down_data[key]:
|
||||
file_name = os.path.basename(url)
|
||||
dest_file = os.path.join(self.infoDict['unpackdir'],file_name)
|
||||
if self.infoDict.get('fetch_path'):
|
||||
dest_file = os.path.join(self.infoDict['fetch_path'],
|
||||
file_name)
|
||||
else:
|
||||
dest_file = os.path.join(self.infoDict['unpackdir'],
|
||||
file_name)
|
||||
rc = self._fetch_source(url, dest_file)
|
||||
if rc == 0:
|
||||
d_cache.add(key_name)
|
||||
@@ -2199,6 +2204,14 @@ class Package:
|
||||
|
||||
if self.metaopts.has_key('dochecksum'):
|
||||
dochecksum = self.metaopts.get('dochecksum')
|
||||
|
||||
# fetch_path is the path where data should be downloaded
|
||||
# at the moment is implemented only for sources = True
|
||||
if self.metaopts.has_key('fetch_path'):
|
||||
fetch_path = self.metaopts.get('fetch_path')
|
||||
if self.entropyTools.is_valid_path(fetch_path):
|
||||
self.infoDict['fetch_path'] = fetch_path
|
||||
|
||||
self.infoDict['repository'] = repository
|
||||
self.infoDict['idpackage'] = idpackage
|
||||
dbconn = self.Entropy.open_repository(repository)
|
||||
|
||||
Reference in New Issue
Block a user