Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAleksey Lim <alsroot@sugarlabs.org>2013-09-01 13:41:32 (GMT)
committer Aleksey Lim <alsroot@sugarlabs.org>2013-09-01 13:41:32 (GMT)
commit3f0c42ed41529c8d25c217ebc9dc837db39981bf (patch)
tree7656b9df5e59a03076cc5ed86159a52b6cb647c4
parent81d8f05afa42a7462e1b95561ccc6420dfc947c6 (diff)
Get rid of keeping bundle prefix directory name in db
-rw-r--r--sugar_network/client/implementations.py3
-rw-r--r--sugar_network/client/solver.py6
-rw-r--r--sugar_network/model/routes.py2
-rw-r--r--sugar_network/node/routes.py2
-rw-r--r--sugar_network/toolkit/bundle.py10
-rwxr-xr-xtests/units/client/implementations.py1
-rwxr-xr-xtests/units/client/offline_routes.py1
-rwxr-xr-xtests/units/client/online_routes.py10
8 files changed, 8 insertions, 27 deletions
diff --git a/sugar_network/client/implementations.py b/sugar_network/client/implementations.py
index 2681592..4a7ba3e 100644
--- a/sugar_network/client/implementations.py
+++ b/sugar_network/client/implementations.py
@@ -281,8 +281,7 @@ class Routes(object):
shutil.copyfileobj(blob, tmp_file)
tmp_file.seek(0)
with Bundle(tmp_file, 'application/zip') as bundle:
- bundle.extractall(data_path,
- extract=data.get('extract'))
+ bundle.extractall(data_path, prefix=bundle.rootdir)
for exec_dir in ('bin', 'activity'):
bin_path = join(data_path, exec_dir)
if not exists(bin_path):
diff --git a/sugar_network/client/solver.py b/sugar_network/client/solver.py
index 13bc7a4..9f1b6e7 100644
--- a/sugar_network/client/solver.py
+++ b/sugar_network/client/solver.py
@@ -174,10 +174,6 @@ def _impl_new(config, iface, sel):
impl['path'] = sel.local_path
if sel.impl.to_install:
impl['install'] = sel.impl.to_install
- if sel.impl.download_sources:
- extract = sel.impl.download_sources[0].extract
- if extract:
- impl['extract'] = extract
commands = sel.get_commands()
if commands:
impl['command'] = commands.values()[0].path.split()
@@ -275,7 +271,7 @@ class _Feed(model.ZeroInstallFeed):
if isabs(impl_id):
impl.local_path = impl_id
else:
- impl.add_download_source(impl_id, 0, release.get('extract'))
+ impl.add_download_source(impl_id, 0, None)
for name, command in release['commands'].items():
impl.commands[name] = _Command(name, command)
diff --git a/sugar_network/model/routes.py b/sugar_network/model/routes.py
index d31bc5f..628a057 100644
--- a/sugar_network/model/routes.py
+++ b/sugar_network/model/routes.py
@@ -49,7 +49,7 @@ class VolumeRoutes(db.Routes):
requires.setdefault(i, {})
blob = implementations.get(impl.guid).meta('data')
if blob:
- for key in ('blob_size', 'unpack_size', 'extract'):
+ for key in ('blob_size', 'unpack_size'):
if key in blob:
spec[key] = blob[key]
versions.append(spec)
diff --git a/sugar_network/node/routes.py b/sugar_network/node/routes.py
index e34c0ed..705d7c2 100644
--- a/sugar_network/node/routes.py
+++ b/sugar_network/node/routes.py
@@ -398,7 +398,6 @@ def load_bundle(volume, request, bundle_path):
for arcname in bundle.get_names():
unpack_size += bundle.getmember(arcname).size
spec = bundle.get_spec()
- extract = bundle.rootdir
context = _load_context_metadata(bundle, spec)
if 'requires' in impl:
spec.requires.update(parse_requires(impl.pop('requires')))
@@ -413,7 +412,6 @@ def load_bundle(volume, request, bundle_path):
}}
data['unpack_size'] = unpack_size
data['mime_type'] = 'application/vnd.olpc-sugar'
- data['extract'] = extract
if initial and not contexts.exists(impl['context']):
context['guid'] = impl['context']
diff --git a/sugar_network/toolkit/bundle.py b/sugar_network/toolkit/bundle.py
index 0e7a548..067bb5e 100644
--- a/sugar_network/toolkit/bundle.py
+++ b/sugar_network/toolkit/bundle.py
@@ -68,16 +68,16 @@ class Bundle(object):
def extractfile(self, name):
return self._do_extractfile(name)
- def extractall(self, dst_root, members=None, extract=None):
- if not extract:
+ def extractall(self, dst_root, members=None, prefix=None):
+ if not prefix:
self._bundle.extractall(path=dst_root, members=members)
return
try:
- extract = extract.strip(os.sep) + os.sep
+ prefix = prefix.strip(os.sep) + os.sep
for arcname in self.get_names():
dst_path = arcname.strip(os.sep)
- if dst_path.startswith(extract):
- dst_path = dst_path[len(extract):]
+ if dst_path.startswith(prefix):
+ dst_path = dst_path[len(prefix):]
dst_path = join(dst_root, dst_path)
if not exists(dirname(dst_path)):
os.makedirs(dirname(dst_path))
diff --git a/tests/units/client/implementations.py b/tests/units/client/implementations.py
index 12f4e98..dc05d36 100755
--- a/tests/units/client/implementations.py
+++ b/tests/units/client/implementations.py
@@ -152,7 +152,6 @@ class Implementations(tests.Test):
'command': ['true'],
'context': 'bundle_id',
'path': tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl),
- 'extract': 'TestActivity',
'guid': impl,
}]]
cached_path = 'cache/solutions/bu/bundle_id'
diff --git a/tests/units/client/offline_routes.py b/tests/units/client/offline_routes.py
index 4eae0ce..19b8e31 100755
--- a/tests/units/client/offline_routes.py
+++ b/tests/units/client/offline_routes.py
@@ -285,7 +285,6 @@ class OfflineRoutes(tests.Test):
solution = [{
'guid': impl,
'context': 'bundle_id',
- 'extract': 'TestActivity',
'license': ['Public Domain'],
'stability': 'stable',
'version': '1',
diff --git a/tests/units/client/online_routes.py b/tests/units/client/online_routes.py
index b06a824..4d1d4db 100755
--- a/tests/units/client/online_routes.py
+++ b/tests/units/client/online_routes.py
@@ -404,7 +404,6 @@ Can't find all required implementations:
'notes': '',
})
self.node_volume['implementation'].update(impl, {'data': {
- 'extract': 'topdir',
'spec': {
'*-*': {
'commands': {
@@ -428,7 +427,6 @@ Can't find all required implementations:
'context': context,
'guid': impl,
'license': ['GPLv3+'],
- 'extract': 'topdir',
'stability': 'stable',
'version': '1',
'path': tests.tmpdir + '/client/implementation/%s/%s/data.blob' % (impl[:2], impl),
@@ -597,7 +595,6 @@ Can't find all required implementations:
solution = [{
'guid': impl,
'context': 'bundle_id',
- 'extract': 'TestActivity',
'license': ['Public Domain'],
'stability': 'stable',
'version': '1',
@@ -648,7 +645,6 @@ Can't find all required implementations:
'blob_size': len(blob),
'blob': blob_path,
'mtime': int(os.stat(blob_path[:-5]).st_mtime),
- 'extract': 'TestActivity',
'mime_type': 'application/vnd.olpc-sugar',
'spec': {
'*-*': {
@@ -692,7 +688,6 @@ Can't find all required implementations:
'blob_size': len(blob),
'blob': blob_path,
'mtime': int(os.stat(blob_path[:-5]).st_mtime),
- 'extract': 'TestActivity',
'mime_type': 'application/vnd.olpc-sugar',
'spec': {
'*-*': {
@@ -808,7 +803,6 @@ Can't find all required implementations:
'context': 'bundle_id',
'data': {
'blob_size': len(blob),
- 'extract': 'TestActivity',
'mime_type': 'application/vnd.olpc-sugar',
'mtime': int(os.stat(blob_path[:-5]).st_mtime),
'seqno': 3,
@@ -832,7 +826,6 @@ Can't find all required implementations:
'data': {
'blob': blob_path,
'blob_size': len(blob),
- 'extract': 'TestActivity',
'mime_type': 'application/vnd.olpc-sugar',
'mtime': int(os.stat(blob_path[:-5]).st_mtime),
'seqno': 5,
@@ -861,7 +854,6 @@ Can't find all required implementations:
solution = [{
'guid': impl,
'context': 'bundle_id',
- 'extract': 'TestActivity',
'license': ['Public Domain'],
'stability': 'stable',
'version': '1',
@@ -897,7 +889,6 @@ Can't find all required implementations:
solution = [{
'guid': impl,
'context': 'bundle_id',
- 'extract': 'TestActivity',
'license': ['Public Domain'],
'stability': 'stable',
'version': '2',
@@ -990,7 +981,6 @@ Can't find all required implementations:
solution = [{
'guid': impl,
'context': 'bundle_id',
- 'extract': 'TestActivity',
'license': ['Public Domain'],
'stability': 'stable',
'version': '1',