diff --git a/debian/patches/020201202~db642e1.patch b/debian/patches/020201202~db642e1.patch new file mode 100644 index 0000000..74a8915 --- /dev/null +++ b/debian/patches/020201202~db642e1.patch @@ -0,0 +1,121 @@ +Description: bundlebuilder: install: add destdir support + Add support for DESTDIR using a --destdir option, + https://www.gnu.org/prep/standards/html_node/DESTDIR.html +Author: James Cameron +Origin: Upstream, https://github.com/sugarlabs/sugar-toolkit-gtk3/commit/db642e1 +Bug: https://github.com/sugarlabs/sugar-toolkit-gtk3/issues/453 +Last-Update: 2021-01-28 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/src/sugar3/activity/bundlebuilder.py ++++ b/src/sugar3/activity/bundlebuilder.py +@@ -280,7 +280,8 @@ + Packager.__init__(self, builder.config) + self.builder = builder + +- def install(self, prefix, install_mime=True, install_desktop_file=True): ++ def install(self, destdir, prefix, ++ install_mime=True, install_desktop_file=True): + self.builder.build() + + activity_path = os.path.join(prefix, 'share', 'sugar', 'activities', +@@ -290,16 +291,21 @@ + + for f in self.get_files_in_git(): + source_path = os.path.join(self.config.source_dir, f) +- dest_path = os.path.join(activity_path, f) ++ dest_path = os.path.join(destdir, ++ os.path.relpath(activity_path, '/'), f) + source_to_dest[source_path] = dest_path + + for f in self.builder.get_locale_files(): + source_path = os.path.join(self.builder.locale_dir, f) + + if source_path.endswith(".mo"): +- dest_path = os.path.join(prefix, 'share', 'locale', f) ++ dest_path = os.path.join(destdir, ++ os.path.relpath(prefix, '/'), ++ 'share', 'locale', f) + else: +- dest_path = os.path.join(activity_path, 'locale', f) ++ dest_path = os.path.join(destdir, ++ os.path.relpath(activity_path, '/'), ++ 'locale', f) + + source_to_dest[source_path] = dest_path + +@@ -316,10 +322,10 @@ + self.config.bundle.install_mime_type(self.config.source_dir) + + if install_desktop_file: +- self._install_desktop_file(prefix, activity_path) +- self._generate_appdata(prefix, activity_path) ++ self._install_desktop_file(destdir, prefix, activity_path) ++ self._generate_appdata(destdir, prefix, activity_path) + +- def _install_desktop_file(self, prefix, activity_path): ++ def _install_desktop_file(self, destdir, prefix, activity_path): + cp = ConfigParser() + section = 'Desktop Entry' + cp.add_section(section) +@@ -327,7 +333,9 @@ + + # Get it from the activity.info for the non-translated version + info = ConfigParser() +- info.read(os.path.join(activity_path, 'activity', 'activity.info')) ++ info_path = os.path.join(destdir, os.path.relpath(activity_path, '/'), ++ 'activity', 'activity.info') ++ info.read(info_path) + cp.set(section, 'Name', info.get('Activity', 'name')) + if info.has_option('Activity', 'summary'): + cp.set(section, 'Comment', info.get('Activity', 'summary')) +@@ -353,15 +361,18 @@ + cp.set(section, 'Path', activity_path) # Path == CWD for running + + name = '{}.activity.desktop'.format(self.config.bundle_id) +- path = os.path.join(prefix, 'share', 'applications', name) ++ path = os.path.join(destdir, os.path.relpath(prefix, '/'), ++ 'share', 'applications', name) + if not os.path.isdir(os.path.dirname(path)): + os.makedirs(os.path.dirname(path)) + with open(path, 'w') as f: + cp.write(f) + +- def _generate_appdata(self, prefix, activity_path): ++ def _generate_appdata(self, destdir, prefix, activity_path): + info = ConfigParser() +- info.read(os.path.join(activity_path, 'activity', 'activity.info')) ++ info_path = os.path.join(destdir, os.path.relpath(activity_path, '/'), ++ 'activity', 'activity.info') ++ info.read(info_path) + + required_fields = ['metadata_license', 'license', 'name', 'icon', + 'description'] +@@ -408,7 +419,8 @@ + ET.SubElement(root, 'url', type='bugtracker').text = \ + info.get('Activity', 'repository') + +- path = os.path.join(prefix, 'share', 'metainfo', ++ path = os.path.join(destdir, os.path.relpath(prefix, '/'), ++ 'share', 'metainfo', + self.config.bundle_id + '.appdata.xml') + if not os.path.isdir(os.path.dirname(path)): + os.makedirs(os.path.dirname(path)) +@@ -505,6 +517,7 @@ + + installer = Installer(Builder(config)) + installer.install( ++ options.destdir, + options.prefix, + options.install_mime, + options.install_desktop_file) +@@ -593,6 +606,9 @@ + "--prefix", dest="prefix", default=sys.prefix, + help="Path for installing") + install_parser.add_argument( ++ "--destdir", dest="destdir", default="/", ++ help="Path for staged install") ++ install_parser.add_argument( + "--skip-install-mime", dest="install_mime", + action="store_false", default=True, + help="Skip the installation of custom mime types in the system") diff --git a/debian/patches/series b/debian/patches/series index 06fac34..6b8ee02 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -1,3 +1,4 @@ +020201202~db642e1.patch 1001_espeak-ng.patch 2002_ignore_debian_and_quilt-patches.patch #2003_bundlebuilder_exit_nonzero_on_error.patch