Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/rpms/sugar-toolkit/remove-incomplete-MANIFEST-support.patch
blob: c36224c3d2a9b3fa9c8f69743f31d36d8db7aff3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
From 07b6cc041fe9a0ecd798ec67e8d27728d33001e3 Mon Sep 17 00:00:00 2001
From: Bernie Innocenti <bernie@codewiz.org>
Date: Thu, 20 May 2010 02:19:14 -0400
Subject: [PATCH] Remove incomplete MANIFEST support
Organization: Sugar Labs Foundation
X-Subversion: sucks

This incomplete feature contributes to confuse new activity authors and
slightly complicates our bundle installation logic.

The day someone finds something useful to do with the MANIFEST
specification, we can revert this patch in no time.

Signed-off-by: Bernie Innocenti <bernie@codewiz.org>
Tested-by: Bernie Innocenti <bernie@codewiz.org>
---
 src/sugar/activity/bundlebuilder.py |   48 ++---------------
 src/sugar/bundle/activitybundle.py  |   99 +----------------------------------
 src/sugar/bundle/bundle.py          |    9 ---
 3 files changed, 6 insertions(+), 150 deletions(-)

diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py
index 868ca3d..630a3e4 100644
--- a/src/sugar/activity/bundlebuilder.py
+++ b/src/sugar/activity/bundlebuilder.py
@@ -141,37 +141,9 @@ class Builder(object):
             f.close()
 
     def get_files(self):
-        files = self.config.bundle.get_files()
-
-        if not files:
-            logging.error('No files found, fixing the MANIFEST.')
-            self.fix_manifest()
-            files = self.config.bundle.get_files()
-
-        return files
-
-    def check_manifest(self):
-        missing_files = []
-
         allfiles = list_files(self.config.source_dir,
                               IGNORE_DIRS, IGNORE_FILES)
-        for path in allfiles:
-            if path not in self.config.bundle.manifest:
-                missing_files.append(path)
-
-        return missing_files
-
-    def fix_manifest(self):
-        self.build()
-
-        manifest = self.config.bundle.manifest
-
-        for path in self.check_manifest():
-            manifest.append(path)
-
-        f = open(os.path.join(self.config.source_dir, "MANIFEST"), "wb")
-        for line in manifest:
-            f.write(line + "\n")
+        return allfiles
 
 
 class Packager(object):
@@ -197,13 +169,6 @@ class XOPackager(Packager):
         bundle_zip = zipfile.ZipFile(self.package_path, 'w',
                                      zipfile.ZIP_DEFLATED)
 
-        missing_files = self.builder.check_manifest()
-        if missing_files:
-            logging.warn('These files are not included in the manifest ' \
-                         'and will not be present in the bundle:\n\n' +
-                         '\n'.join(missing_files) +
-                         '\n\nUse fix_manifest if you want to add them.')
-
         for f in self.builder.get_files():
             bundle_zip.write(os.path.join(self.config.source_dir, f),
                              os.path.join(self.config.bundle_root_dir, f))
@@ -307,14 +272,11 @@ def cmd_dist_xo(config, args):
 
 
 def cmd_fix_manifest(config, args):
-    '''Add missing files to the manifest'''
+    '''Add missing files to the manifest (OBSOLETE)'''
 
-    if args:
-        print 'Usage: %prog fix_manifest'
-        return
-
-    builder = Builder(config)
-    builder.fix_manifest()
+    print "WARNING: the fix_manifest command is obsolete"
+    print "the MANIFEST file is no longer used in bundles, please remove it"
+    pass
 
 
 def cmd_dist_source(config, args):
--- sugar-toolkit-0.88.1/src/sugar/bundle/activitybundle.py.orig	2010-06-03 02:56:29.000000000 -0400
+++ sugar-toolkit-0.88.1/src/sugar/bundle/activitybundle.py	2010-06-06 10:36:58.000000000 -0400
@@ -59,7 +59,6 @@ class ActivityBundle(Bundle):
         self._tags = None
         self._activity_version = 0
         self._installation_time = os.stat(path).st_mtime
-        self._manifest = None
 
         info_file = self.get_file('activity/activity.info')
         if info_file is None:
@@ -73,74 +72,6 @@ class ActivityBundle(Bundle):
         if self._local_name == None:
            self._local_name = self._name
 
-    def _get_manifest(self):
-        if self._manifest is None:
-            self._manifest = self._read_manifest()
-        return self._manifest
-
-    manifest = property(_get_manifest, None, None,
-        "NOTICE: this property is potentially quite slow, so better make sure "
-        "that it's not called at performance-critical points like shell or "
-        "activity startup.")
-
-    def _raw_manifest(self):
-        f = self.get_file("MANIFEST")
-        if not f:
-            logging.warning("Activity directory lacks a MANIFEST file.")
-            return []
-
-        ret = [line.strip() for line in f.readlines()]
-        f.close()
-        return ret
-
-    def _read_manifest(self):
-        """return a list with the lines in MANIFEST, with invalid lines
-        replaced by empty lines.
-
-        Since absolute order carries information on file history, it should
-        be preserved. For instance, when renaming a file, you should leave
-        the new name on the same line as the old one.
-        """
-        logging.debug('STARTUP: Reading manifest')
-        lines = self._raw_manifest()
-
-        # Remove trailing newlines, they do not help keep absolute position.
-        while lines and lines[-1] == "":
-            lines = lines[:-1]
-
-        for num, line in enumerate(lines):
-            if not line:
-                continue
-
-            # Remove duplicates
-            if line in lines[0:num]:
-                lines[num] = ""
-                logging.warning('Bundle %s: duplicate entry in MANIFEST: %s',
-                    self._name, line)
-                continue
-
-            # Remove MANIFEST
-            if line == "MANIFEST":
-                lines[num] = ""
-                logging.warning('Bundle %s: MANIFEST includes itself: %s',
-                    self._name, line)
-
-            # Remove invalid files
-            if not self.is_file(line):
-                lines[num] = ""
-                logging.warning('Bundle %s: invalid entry in MANIFEST: %s',
-                    self._name, line)
-
-        return lines
-
-    def get_files(self, manifest = None):
-        files = [line for line in (manifest or self.manifest) if line]
-
-        if self.is_file('MANIFEST'):
-            files.append('MANIFEST')
-
-        return files
-
     def _parse_info(self, info_file):
         cp = ConfigParser()
         cp.readfp(info_file)
@@ -300,41 +231,13 @@ class ActivityBundle(Bundle):
         """Get whether there should be a visible launcher for the activity"""
         return self._show_launcher
 
-    def install(self, install_dir=None, strict_manifest=False):
+    def install(self, install_dir=None):
         if install_dir is None:
             install_dir = env.get_user_activities_path()
 
         self._unzip(install_dir)
 
         install_path = os.path.join(install_dir, self._zip_root_dir)
-
-        # List installed files
-        manifestfiles = self.get_files(self._raw_manifest())
-        paths = []
-        for root, dirs_, files in os.walk(install_path):
-            rel_path = root[len(install_path) + 1:]
-            for f in files:
-                paths.append(os.path.join(rel_path, f))
-
-        # Check the list against the MANIFEST
-        for path in paths:
-            if path in manifestfiles:
-                manifestfiles.remove(path)
-            elif path != "MANIFEST":
-                logging.warning('Bundle %s: %s not in MANIFEST', self._name,
-                    path)
-                if strict_manifest:
-                    os.remove(os.path.join(install_path, path))
-
-        # Is anything in MANIFEST left over after accounting for all files?
-        if manifestfiles:
-            err = ("Bundle %s: files in MANIFEST not included: %s"%
-                   (self._name, str(manifestfiles)))
-            if strict_manifest:
-                raise MalformedBundleException(err)
-            else:
-                logging.warning(err)
-
         self.install_mime_type(install_path)
 
         return install_path
diff --git a/src/sugar/bundle/bundle.py b/src/sugar/bundle/bundle.py
index a04c873..adba480 100644
--- a/src/sugar/bundle/bundle.py
+++ b/src/sugar/bundle/bundle.py
@@ -80,14 +80,6 @@ class Bundle(object):
                     % (self._path, ziperror))
             self._check_zip_bundle()
 
-        # manifest = self._get_file(self._infodir + '/contents')
-        # if manifest is None:
-        #     raise MalformedBundleException('No manifest file')
-
-        # signature = self._get_file(self._infodir + '/contents.sig')
-        # if signature is None:
-        #     raise MalformedBundleException('No signature file')
-
     def __del__(self):
         if self._zip_file is not None:
             self._zip_file.close()
@@ -176,7 +168,6 @@ class Bundle(object):
         # correctly by hand, but handling all the oddities of
         # Windows/UNIX mappings, extension attributes, deprecated
         # features, etc makes it impractical.
-        # FIXME: use manifest
         if os.spawnlp(os.P_WAIT, 'unzip', 'unzip', '-o', self._path,
                       '-x', 'mimetype', '-d', install_dir):
             # clean up install dir after failure
-- 
1.7.0.1