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>
This commit is contained in:
parent
cdbeb682cb
commit
b582736375
@ -170,12 +170,30 @@ class XOPackager(Packager):
|
|||||||
bundle_zip = zipfile.ZipFile(self.package_path, 'w',
|
bundle_zip = zipfile.ZipFile(self.package_path, 'w',
|
||||||
zipfile.ZIP_DEFLATED)
|
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),
|
bundle_zip.write(os.path.join(self.config.source_dir, f),
|
||||||
os.path.join(self.config.bundle_root_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()
|
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):
|
class SourcePackager(Packager):
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user