Skip to content
Snippets Groups Projects
Commit b11e53a4437e authored by Stan Hu's avatar Stan Hu
Browse files

Remove libre2 from build

With the update to re2 gem v2.0 in
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/131273, we no
longer need to build and ship libre2. The gem handles the building and
compiling of all dependencies (libre2 and abseil-cpp), and it also
ships with precompiled gems.

This unblocks upgrades to the `grpc` gem since
https://github.com/grpc/grpc/issues/33615 no longer applies.

Changelog: changed
parent 497c8da40121
3 merge requests!114heptapod#1394: making 1.0 the oldstable,!110heptapod#1352: merged heptapod branch into heptapod-stable,!106Merged upstream 16.4 branching point into heptapod branch
......@@ -103,9 +103,6 @@
krb5:
remote: "git@dev.gitlab.org:omnibus-mirror/krb5.git"
alternative: "https://gitlab.com/gitlab-org/build/omnibus-mirror/krb5.git"
libre2:
remote: "git@dev.gitlab.org:omnibus-mirror/libre2.git"
alternative: "https://gitlab.com/gitlab-org/build/omnibus-mirror/libre2.git"
libpng:
remote: "git@dev.gitlab.org:omnibus-mirror/libpng.git"
alternative: "https://gitlab.com/gitlab-org/build/omnibus-mirror/libpng.git"
......
......@@ -53,7 +53,6 @@
dependency 'krb5'
dependency 'registry'
dependency 'unzip'
dependency 'libre2'
dependency 'gpgme'
dependency 'graphicsmagick'
dependency 'exiftool'
......@@ -114,12 +113,6 @@
bundle "config set --local gemfile #{gitlab_bundle_gemfile}" if gitlab_bundle_gemfile != 'Gemfile'
bundle 'config force_ruby_platform true', env: env if OhaiHelper.ruby_native_gems_unsupported?
# This works around an issue with the grpc gem attempting to include
# /opt/gitlab/include headers instead of the vendored re2 headers:
# https://github.com/grpc/grpc/pull/32580. This can be removed
# after grpc is updated with that pull request.
env['CPPFLAGS'] = "-Ithird_party/re2 #{env['CPPFLAGS']}" if OhaiHelper.arm?
bundle 'config build.gpgme --use-system-libraries', env: env
bundle "config build.nokogiri --use-system-libraries --with-xml2-include=#{install_dir}/embedded/include/libxml2 --with-xslt-include=#{install_dir}/embedded/include/libxslt", env: env
bundle 'config build.grpc --with-ldflags=-Wl,--no-as-needed --with-dldflags=-latomic', env: env if OhaiHelper.raspberry_pi?
......
#
## Copyright:: Copyright (c) 2017 GitLab B.V.
## License:: Apache License, Version 2.0
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
## You may obtain a copy of the License at
##
## http://www.apache.org/licenses/LICENSE-2.0
##
## Unless required by applicable law or agreed to in writing, software
## distributed under the License is distributed on an "AS IS" BASIS,
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
## See the License for the specific language governing permissions and
## limitations under the License.
##
#
name 'libre2'
version = Gitlab::Version.new('libre2', '2023-03-01')
default_version version.print(false)
display_version version.print(false).tr('-', '')
license 'BSD'
license_file 'LICENSE'
skip_transitive_dependency_licensing true
source git: version.remote
build do
env = with_standard_compiler_flags(with_embedded_path)
block 'compile re2 with a custom compiler if necessary' do
if ohai['platform'] == 'centos' && ohai['platform_version'].start_with?('7.')
env['CC'] = "/opt/rh/devtoolset-8/root/usr/bin/gcc"
env['CXX'] = "/opt/rh/devtoolset-8/root/usr/bin/g++"
end
# This is not enabled by default for the g++ on Ubuntu 16.04.
# https://github.com/google/re2/wiki/Install says C++11 is required.
env['CPPFLAGS'] << ' -std=c++11'
make "-j #{workers}", env: env
make "install prefix=#{install_dir}/embedded", env: env
end
end
......@@ -54,12 +54,6 @@
shellout!("#{gem_bin} install --no-document gem-patch -v 0.1.6")
shellout!("#{gem_bin} uninstall --force --all grpc")
# This works around an issue with the grpc gem attempting to include
# /opt/gitlab/include headers instead of the vendored re2 headers:
# https://github.com/grpc/grpc/pull/32580. This can be removed
# after grpc is updated with that pull request.
env['CPPFLAGS'] = "-Ithird_party/re2 #{env['CPPFLAGS']}"
grpc_versions.each do |version|
patch_path = patches[version]
gemfile = "grpc-#{version}.gem"
......
......@@ -4,6 +4,5 @@
<!-- Keep this list sorted alphabetically. -->
- [golang](upgrade-golang-testplan.md)
- [libre2](upgrade-libre2-testplan.md)
- [Mattermost](upgrade-mattermost-testplan.md)
- [redis](upgrade-redis-testplan.md)
# libre2 component upgrade test plan
## Test plan
- [ ] Green pipeline on gitlab.com including `Trigger:ce-package` and `Trigger:ee-package`. These pipelines should have ran their respective `build-package-on-all-os` pipelines.
- [ ] Verified build options for CC and CXX are correct.
-[ ] CentOS 7
-[ ] Modern OS, e.g Ubuntu jammy.
- [ ] Installed package or container. Verified no installation issues.
-[ ] CentOS 7
-[ ] Modern OS
- Ran ldd on re2 gem and verified correct `libre2`` library is used.
-[ ] CentOS 7
-[ ] Modern OS
- [ ] Ran `re2` Spec test to verify correct ruby integration:
```shell
docker run -it registry.gitlab.com/gitlab-org/gitlab-omnibus-builder/debian_10:4.10.0 bash
cd /tmp
git clone -b 2023-03-01 https://github.com/google/re2 google-re2
git clone -b v1.6.0 https://github.com/mudge/re2.git
cd google-re2
make install
cd ..
cd re2
bundle install
bundle exec rake compile
bundle exec rspec
```
- [ ] Ran gitlab-rails console smoke test
- [ ] CentOS 7
- [ ] Modern OS
```ruby
irb(main):005:0> regex = RE2('\(iP.+; CPU .*OS (\d+)[_\d]*.*\) AppleWebKit\/')
=> #<RE2::Regexp /\(iP.+; CPU .*OS (\d+)[_\d]*.*\) AppleWebKit\//>
irb(main):006:0> regex.match?('foo')
=> false
irb(main):017:0> regex.match?("Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1")
=> true
```
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment