unbreak firefox-esr and thunderbird

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

unbreak firefox-esr and thunderbird

Sebastien Marie-3
Hi,

The update of lang/rust unintentionally broke mail/mozilla-thunderbird,
www/firefox-esr and www/tor-browser.

My test script for checking breakable doesn't worked as intented, and I miss the
failures. My bad.

The following patch corrects mail/mozilla-thunderbird and www/firefox-esr, by
backporting cssparser crate diff from upstream.

The change is composed of two parts:
- the patch on third_party/rust/cssparser/src/parser.rs
- a sed trick on post-patch target to "hide" the file change to cargo and let's
  it building without complaining

For www/tor-browser, I will just mark it as BROKEN. The esr version used by
tor-browser is just too old for easily backport the patch, and I would be
reluctant to spend time on it as the www/tor-browser version we have in port is
just too outdated. An update of the port would be preferable.


Please note I only quickly test the patch on firefox-esr. I intent to let's
finish a full build of mail/mozilla-thunderbird and www/firefox-esr before
commiting if ok.

Thanks.
--
Sebastien Marie


Index: mail/mozilla-thunderbird/Makefile
===================================================================
RCS file: /cvs/ports/mail/mozilla-thunderbird/Makefile,v
retrieving revision 1.296
diff -u -p -r1.296 Makefile
--- mail/mozilla-thunderbird/Makefile 22 Sep 2019 17:19:07 -0000 1.296
+++ mail/mozilla-thunderbird/Makefile 30 Sep 2019 11:58:09 -0000
@@ -89,6 +89,10 @@ GUIDS = gdata-provider {a62ef8ec-5fdc-40
 
 EXTDIR = ${PREFIX}/lib/${MOZILLA_PROJECT}/distribution/extensions/
 
+post-patch:
+ sed -i 's/"files":{[^}]*}/"files":{}/' \
+ ${WRKSRC}/third_party/rust/cssparser/.cargo-checksum.json
+
 post-install:
 .for xpi guid in ${GUIDS}
  cp ${WRKBUILD}/dist/xpi-stage/${xpi}*.xpi ${EXTDIR}/${guid}.xpi
Index: mail/mozilla-thunderbird/patches/patch-third_party_rust_cssparser_src_parser_rs
===================================================================
RCS file: mail/mozilla-thunderbird/patches/patch-third_party_rust_cssparser_src_parser_rs
diff -N mail/mozilla-thunderbird/patches/patch-third_party_rust_cssparser_src_parser_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ mail/mozilla-thunderbird/patches/patch-third_party_rust_cssparser_src_parser_rs 30 Sep 2019 11:58:09 -0000
@@ -0,0 +1,65 @@
+$OpenBSD$
+backport https://github.com/servo/rust-cssparser/pull/245/commits/3c98d22c5de3b696bf1fde2b6c90069812312aa6
+to avoid hard failure due to rustc 1.38.0
+
+Index: third_party/rust/cssparser/src/parser.rs
+--- third_party/rust/cssparser/src/parser.rs.orig
++++ third_party/rust/cssparser/src/parser.rs
+@@ -567,30 +567,34 @@ impl<'i: 't, 't> Parser<'i, 't> {
+         }
+
+         let token_start_position = self.input.tokenizer.position();
+-        let token;
+-        match self.input.cached_token {
+-            Some(ref cached_token) if cached_token.start_position == token_start_position => {
+-                self.input.tokenizer.reset(&cached_token.end_state);
+-                match cached_token.token {
+-                    Token::Function(ref name) => self.input.tokenizer.see_function(name),
+-                    _ => {}
+-                }
+-                token = &cached_token.token
++        let using_cached_token = self
++            .input
++            .cached_token
++            .as_ref()
++            .map_or(false, |cached_token| {
++                cached_token.start_position == token_start_position
++            });
++        let token = if using_cached_token {
++            let cached_token = self.input.cached_token.as_ref().unwrap();
++            self.input.tokenizer.reset(&cached_token.end_state);
++            match cached_token.token {
++                Token::Function(ref name) => self.input.tokenizer.see_function(name),
++                _ => {}
+             }
+-            _ => {
+-                let new_token = self
+-                    .input
+-                    .tokenizer
+-                    .next()
+-                    .map_err(|()| self.new_basic_error(BasicParseErrorKind::EndOfInput))?;
+-                self.input.cached_token = Some(CachedToken {
+-                    token: new_token,
+-                    start_position: token_start_position,
+-                    end_state: self.input.tokenizer.state(),
+-                });
+-                token = self.input.cached_token_ref()
+-            }
+-        }
++            &cached_token.token
++        } else {
++            let new_token = self
++                .input
++                .tokenizer
++                .next()
++                .map_err(|()| self.new_basic_error(BasicParseErrorKind::EndOfInput))?;
++            self.input.cached_token = Some(CachedToken {
++                token: new_token,
++                start_position: token_start_position,
++                end_state: self.input.tokenizer.state(),
++            });
++            self.input.cached_token_ref()
++        };
+
+         if let Some(block_type) = BlockType::opening(token) {
+             self.at_start_of = Some(block_type);
Index: www/firefox-esr/Makefile
===================================================================
RCS file: /cvs/ports/www/firefox-esr/Makefile,v
retrieving revision 1.106
diff -u -p -r1.106 Makefile
--- www/firefox-esr/Makefile 22 Sep 2019 17:19:06 -0000 1.106
+++ www/firefox-esr/Makefile 30 Sep 2019 11:58:09 -0000
@@ -66,6 +66,10 @@ CONFIGURE_ARGS += --enable-sandbox --ena
 CONFIGURE_ARGS += --with-libclang-path=${LOCALBASE}/lib
 CONFIGURE_ARGS += --with-clang-path=${LOCALBASE}/bin/clang
 
+post-patch:
+ sed -i 's/"files":{[^}]*}/"files":{}/' \
+ ${WRKSRC}/third_party/rust/cssparser/.cargo-checksum.json
+
 post-install:
  # install prefs
  ${INSTALL_DATA_DIR} ${PREFIX}/lib/${MOZILLA_PROJECT}-esr/browser/defaults/preferences
Index: www/firefox-esr/patches/patch-old-configure
===================================================================
RCS file: /cvs/ports/www/firefox-esr/patches/patch-old-configure,v
retrieving revision 1.1
diff -u -p -r1.1 patch-old-configure
--- www/firefox-esr/patches/patch-old-configure 6 Sep 2019 17:13:22 -0000 1.1
+++ www/firefox-esr/patches/patch-old-configure 30 Sep 2019 11:58:09 -0000
@@ -5,7 +5,7 @@ https://bugzilla.mozilla.org/show_bug.cg
 Index: old-configure
 --- old-configure.orig
 +++ old-configure
-@@ -10113,7 +10113,7 @@ fi
+@@ -10191,7 +10191,7 @@ fi
 
 
  case "$OS_TARGET" in
Index: www/firefox-esr/patches/patch-third_party_rust_cssparser_src_parser_rs
===================================================================
RCS file: www/firefox-esr/patches/patch-third_party_rust_cssparser_src_parser_rs
diff -N www/firefox-esr/patches/patch-third_party_rust_cssparser_src_parser_rs
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ www/firefox-esr/patches/patch-third_party_rust_cssparser_src_parser_rs 30 Sep 2019 11:58:09 -0000
@@ -0,0 +1,65 @@
+$OpenBSD$
+backport https://github.com/servo/rust-cssparser/pull/245/commits/3c98d22c5de3b696bf1fde2b6c90069812312aa6
+to avoid hard failure due to rustc 1.38.0
+
+Index: third_party/rust/cssparser/src/parser.rs
+--- third_party/rust/cssparser/src/parser.rs.orig
++++ third_party/rust/cssparser/src/parser.rs
+@@ -567,30 +567,34 @@ impl<'i: 't, 't> Parser<'i, 't> {
+         }
+
+         let token_start_position = self.input.tokenizer.position();
+-        let token;
+-        match self.input.cached_token {
+-            Some(ref cached_token) if cached_token.start_position == token_start_position => {
+-                self.input.tokenizer.reset(&cached_token.end_state);
+-                match cached_token.token {
+-                    Token::Function(ref name) => self.input.tokenizer.see_function(name),
+-                    _ => {}
+-                }
+-                token = &cached_token.token
++        let using_cached_token = self
++            .input
++            .cached_token
++            .as_ref()
++            .map_or(false, |cached_token| {
++                cached_token.start_position == token_start_position
++            });
++        let token = if using_cached_token {
++            let cached_token = self.input.cached_token.as_ref().unwrap();
++            self.input.tokenizer.reset(&cached_token.end_state);
++            match cached_token.token {
++                Token::Function(ref name) => self.input.tokenizer.see_function(name),
++                _ => {}
+             }
+-            _ => {
+-                let new_token = self
+-                    .input
+-                    .tokenizer
+-                    .next()
+-                    .map_err(|()| self.new_basic_error(BasicParseErrorKind::EndOfInput))?;
+-                self.input.cached_token = Some(CachedToken {
+-                    token: new_token,
+-                    start_position: token_start_position,
+-                    end_state: self.input.tokenizer.state(),
+-                });
+-                token = self.input.cached_token_ref()
+-            }
+-        }
++            &cached_token.token
++        } else {
++            let new_token = self
++                .input
++                .tokenizer
++                .next()
++                .map_err(|()| self.new_basic_error(BasicParseErrorKind::EndOfInput))?;
++            self.input.cached_token = Some(CachedToken {
++                token: new_token,
++                start_position: token_start_position,
++                end_state: self.input.tokenizer.state(),
++            });
++            self.input.cached_token_ref()
++        };
+
+         if let Some(block_type) = BlockType::opening(token) {
+             self.at_start_of = Some(block_type);
Index: www/tor-browser/browser/Makefile
===================================================================
RCS file: /cvs/ports/www/tor-browser/browser/Makefile,v
retrieving revision 1.36
diff -u -p -r1.36 Makefile
--- www/tor-browser/browser/Makefile 22 Sep 2019 17:19:06 -0000 1.36
+++ www/tor-browser/browser/Makefile 30 Sep 2019 11:58:09 -0000
@@ -6,6 +6,8 @@
 COMMENT = modified version of Firefox ESR for browsing over Tor
 ONLY_FOR_ARCHS = amd64 i386
 
+BROKEN = (unintentionally) broken by lang/rust 1.38.0
+
 MOZILLA_VERSION = ${TB_VERSION}
 MOZILLA_PROJECT = ${BROWSER_NAME}
 MOZILLA_CODENAME = browser