Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Schampijer <simon@schampijer.de>2011-09-09 16:41:53 (GMT)
committer Simon Schampijer <simon@schampijer.de>2011-09-19 16:49:54 (GMT)
commitb582736375218e8944b3ce3daac667c7910a7e73 (patch)
tree13b5eb857a699e6075fe2a9e3e7bd0007f0283b5
parentcdbeb682cbf03a163b397286b01efc2674e45c56 (diff)
XO_Packager: package files that are in git and the locale folder, OLPC #11217
There had been reports about Activities that had unexpected files in the xo bundle (e.g. patches). There have been a recent change that the support for the MANIFEST has been removed from the bundle builder. The MANIFEST 'controlled' which files were bundled. The code did include all the files present in the folder (which includes patches etc). The patch does use git-ls to get a list of files to include (like the tarball packager). Furthermore the locale folder is included which has been generated. Due to the API freeze we made '_get_files_in_git' a private method which adds a bit of duplication to the 'get_files' method in the tarball packager. A patch for master which will implement Builder.get_files_git(), that can be used by XOPackager and SourcePackager. Signed-off-by: Simon Schampijer <simon@laptop.org> Reviewed-By: Daniel Drake <dsd@laptop.org>
-rw-r--r--src/sugar/activity/bundlebuilder.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/sugar/activity/bundlebuilder.py b/src/sugar/activity/bundlebuilder.py
index 5fd92c1..8263239 100644
--- a/src/sugar/activity/bundlebuilder.py
+++ b/src/sugar/activity/bundlebuilder.py
@@ -170,12 +170,30 @@ class XOPackager(Packager):
bundle_zip = zipfile.ZipFile(self.package_path, 'w',
zipfile.ZIP_DEFLATED)
- for f in self.builder.get_files():
+ for f in self._get_files_in_git():
bundle_zip.write(os.path.join(self.config.source_dir, f),
os.path.join(self.config.bundle_root_dir, f))
+ locale_dir = os.path.join(self.config.source_dir, 'locale')
+ locale_files = list_files(locale_dir, IGNORE_DIRS, IGNORE_FILES)
+ for f in locale_files:
+ bundle_zip.write(os.path.join(locale_dir, f),
+ os.path.join(self.config.bundle_root_dir,
+ 'locale', f))
bundle_zip.close()
+ def _get_files_in_git(self):
+ git_ls = subprocess.Popen(['git', 'ls-files'], stdout=subprocess.PIPE,
+ cwd=self.config.source_dir)
+ stdout, _ = git_ls.communicate()
+ if git_ls.returncode:
+ # Fall back to filtered list
+ return list_files(self.config.source_dir,
+ IGNORE_DIRS, IGNORE_FILES)
+
+ # pylint: disable=E1103
+ return [path.strip() for path in stdout.strip('\n').split('\n')]
+
class SourcePackager(Packager):