diff options
-rw-r--r-- | debian/changelog | 9 | ||||
-rw-r--r-- | debian/patches/debian-hacks/Don-t-auto-disable-extensions-in-system-directories.patch | 2 | ||||
-rwxr-xr-x | debian/repack.py | 79 | ||||
-rw-r--r-- | debian/upstream.mk | 11 |
4 files changed, 89 insertions, 12 deletions
diff --git a/debian/changelog b/debian/changelog index 333ad02935..8276cb7825 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +firefox (127.0.2-1) unstable; urgency=medium + + * New upstream release. + + * debian/repack.py, debian/upstream.mk: Handle the upstream l10n migration + to github. + + -- Mike Hommey <glandium@debian.org> Wed, 26 Jun 2024 05:19:57 +0900 + firefox (127.0.1-1~progress7.99u1) graograman-backports; urgency=medium * Uploading to graograman-backports, remaining changes: diff --git a/debian/patches/debian-hacks/Don-t-auto-disable-extensions-in-system-directories.patch b/debian/patches/debian-hacks/Don-t-auto-disable-extensions-in-system-directories.patch index 19982a7ff3..fe1a16a22b 100644 --- a/debian/patches/debian-hacks/Don-t-auto-disable-extensions-in-system-directories.patch +++ b/debian/patches/debian-hacks/Don-t-auto-disable-extensions-in-system-directories.patch @@ -7,7 +7,7 @@ Subject: Don't auto-disable extensions in system directories 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js -index 27c2d13..f569582 100644 +index 21bbb6c..8ba8920 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -56,7 +56,7 @@ pref("extensions.systemAddon.update.enabled", true); diff --git a/debian/repack.py b/debian/repack.py index 84d6ca6ae3..9d23054ce8 100755 --- a/debian/repack.py +++ b/debian/repack.py @@ -147,7 +147,7 @@ class ZipAsTar(object): yield tar_info -def filter_archive(orig, new, filt, topdir = None): +def filter_archive(orig, new, filt, topdir=None, strip=0, split_off=None): filt = TarFilterList(filt) is_url = urlparse(orig).scheme if orig.endswith(".zip"): @@ -166,13 +166,38 @@ def filter_archive(orig, new, filt, topdir = None): tar = tarfile.open(orig, "r:" + file_extension(orig), fileobj) format = tar.format - new_tar = tarfile.open(new + ".new", "w:" + file_extension(new), format=format) + new_tars = {} + + def apply_filter(info, namefilt): + info.name = namefilt(info.name) + if "path" in info.pax_headers: + info.pax_headers["path"] = namefilt(info.pax_headers["path"]) + + this_new = new + this_topdir = topdir + for info in tar: - if topdir: - namefilt = lambda n: "/".join([topdir] + n.split("/")[1:]) - info.name = namefilt(info.name) - if "path" in info.pax_headers: - info.pax_headers["path"] = namefilt(info.pax_headers["path"]) + if strip: + apply_filter(info, lambda n: "/".join(n.split("/")[strip:])) + + if split_off: + first = info.name.partition("/")[0] + if first not in split_off: + continue + this_new = new.replace("%", first) + if topdir: + this_topdir = topdir.replace("%", first) + + new_tar = new_tars.get(this_new) + if not new_tar: + if split_off: + print(this_new) + new_tar = new_tars[this_new] = tarfile.open( + this_new + ".new", "w:" + file_extension(this_new), format=format + ) + + if this_topdir: + apply_filter(info, lambda n: "/".join([this_topdir] + n.split("/")[1:])) do_filt = filt.match(info.name) if do_filt == None: @@ -205,8 +230,18 @@ def filter_archive(orig, new, filt, topdir = None): new_tar.addfile(info) tar.close() - new_tar.close() - os.rename(new_tar.name, new) + if split_off: + expected_new = set(new.replace("%", s) for s in split_off) + got_new = set(new_tars) + missing = expected_new - got_new + for m in sorted(missing): + print(f"Missing {m}") + if missing: + sys.exit(1) + + for new, new_tar in new_tars.items(): + new_tar.close() + os.rename(new_tar.name, new) unused = filt.unused() if unused: print('Unused filters:') @@ -225,6 +260,10 @@ def main(): help="use the given filter list", metavar="FILE") parser.add_option("-p", "--package", dest="package", help="use the given package name", metavar="NAME") + parser.add_option("--strip", dest="strip", type=int, default=0, + help="Strip n first elements of the path") + parser.add_option("--split-off", dest="split_off", + help="Comma-separated list of top-level directories to split in different output tarballs") parser.add_option("-o", "--output", dest="new_file", help="save the filtered tarball as the given file name", metavar="FILE") parser.add_option("-t", "--topdir", dest="topdir", @@ -249,6 +288,17 @@ def main(): if options.new_file: new_file = options.new_file + elif options.split_off: + parser.error("When using --split-off, --output must be given") + + if options.split_off: + split_off = options.split_off.split(",") + if options.topdir and "%" not in options.topdir: + parser.error("When using --split-off, --topdir must contain a % character") + if "%" not in options.new_file: + parser.error("When using --split-off, --output must contain a % character") + else: + split_off = None if os.path.islink(args[0]): orig = os.path.realpath(args[0]) @@ -260,8 +310,17 @@ def main(): if not new_file: new_file = options.package + "_" + options.upstream_version + ".orig.tar." + compression new_file = os.path.realpath(os.path.join(dirname(orig), new_file)) + print(orig, new_file) - filter_archive(orig, new_file, options.filter, options.topdir) + filter_archive( + orig, + new_file, + options.filter, + topdir=options.topdir, + strip=options.strip, + split_off=split_off, + ) + if __name__ == '__main__': main() diff --git a/debian/upstream.mk b/debian/upstream.mk index 0b5c66a2e3..c8c2dffb43 100644 --- a/debian/upstream.mk +++ b/debian/upstream.mk @@ -148,9 +148,12 @@ endif L10N_REV = $(subst $1:,,$(filter $1:%,$(L10N_CHANGESETS))) L10N_LANGS = $(foreach lang,$(L10N_CHANGESETS),$(firstword $(subst :, ,$(lang)))) +L10N_REVS = $(sort $(foreach lang,$(L10N_LANGS),$(call L10N_REV,$(lang)))) +THE_L10N_REV = $(if $(filter 1,$(words $(L10N_REVS))),$(L10N_REVS),$(error multiple l10n revisions)) ifneq (,$(filter dump dump-% import download,$(MAKECMDGOALS))) -L10N_TARBALLS = $(foreach lang,$(L10N_LANGS),$(SOURCE_TARBALL_LOCATION)/$(SOURCE_TARBALL:%.orig.tar.$(SOURCE_TARBALL_EXT)=%.orig-l10n-$(lang).tar.bz2)) +L10N_TARBALL = $(SOURCE_TARBALL_LOCATION)/$(SOURCE_TARBALL:%.orig.tar.$(SOURCE_TARBALL_EXT)=%.orig-l10n-$1.tar.bz2) +L10N_TARBALLS = $(foreach lang,$(L10N_LANGS),$(call L10N_TARBALL,$(lang))) ALL_TARBALLS = $(SOURCE_TARBALL_LOCATION)/$(SOURCE_TARBALL) $(L10N_TARBALLS) @@ -163,7 +166,13 @@ $(SOURCE_TARBALL_LOCATION)/$(SOURCE_TARBALL): debian/source.filter $(if $(filter-out $(VERSION),$(SOURCE_BUILD_VERSION)),$(error Downloaded version ($(SOURCE_BUILD_VERSION)) does not match requested version ($(VERSION)))) debian/repack.py -o $@ $(SOURCE_URL) +ifneq (1,$(words $(L10N_REVS))) $(L10N_TARBALLS): $(SOURCE_TARBALL_LOCATION)/$(SOURCE_TARBALL:%.orig.tar.$(SOURCE_TARBALL_EXT)=%.orig-l10n-%.tar.bz2): debian/l10n.filter debian/repack.py -o $@ -t $* -f debian/l10n.filter $(L10N_REPO)/$*/archive/$(call L10N_REV,$*).zip +else +COMMA=, +$(subst -l10n-,%,$(L10N_TARBALLS)): debian/l10n.filter + debian/repack.py -o $(call L10N_TARBALL,%) --strip 1 --split-off $(subst $(NULL) $(NULL),$(COMMA),$(L10N_LANGS)) -t l10n-% -f debian/l10n.filter https://github.com/mozilla-l10n/firefox-l10n/archive/$(THE_L10N_REV).tar.gz +endif endif .PHONY: download |