obs-bundled-gems/obs-bundled-gems.spec
2020-03-07 19:00:25 +08:00

131 lines
4.7 KiB
RPMSpec

#
# spec file for package obs-bundled-gems
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
%global rake_version 12.3.3
%global rack_version 2.0.8
Name: obs-bundled-gems
Version: 2.10.1
Release: 0
Summary: The Open Build Service -- Bundled Gems
License: GPL-2.0-only OR GPL-3.0-only
URL: http://www.openbuildservice.org
Source0: Gemfile
Source1: Gemfile.lock
BuildRequires: cyrus-sasl-devel mysql-devel nodejs openldap-devel python3-devel
BuildRequires: gcc gcc-c++ glibc-devel libtool libxml2-devel libxslt-devel
BuildRequires: ruby-devel rubygem-bundler ruby-common
%description
This package is useful for the Open Build Service. It will figure out
denpendent gems, and add them to spec file.
%package -n obs-api-deps
Summary: Holding dependencies required to run the OBS frontend
Requires: build >= 20170315
Requires: memcached >= 1.4
Requires: mariadb
Requires: obs-bundled-gems = %{version}
Requires: sphinx >= 2.1.8
Requires: perl(GD)
Requires: rubygem-bundler
Requires: rubygem-rake
%description -n obs-api-deps
To simplify splitting the test suite packages off the main package,
this package is just a meta package used to run and build obs-api
%package -n obs-api-testsuite-deps
Summary: Holding dependencies required to run frontend test suites
Group: Productivity/Networking/Web/Utilities
Requires: inst-source-utils
Requires: nodejs
Requires: obs-api-deps = %{version}
%description -n obs-api-testsuite-deps
To simplify splitting the test suite packages off the main package,
this package is just a meta package used to build obs-api testsuite
%prep
echo "This package contains of requirements"> README
cp %{_sourcedir}/Gemfile %{_sourcedir}/Gemfile.lock .
%build
export QA_SKIP_BUILD_ROOT=1
# copy gem files into cache
mkdir -p vendor/cache
cp %{_sourcedir}/vendor/cache/*.gem vendor/cache
export GEM_HOME=~/.gems
bundle config build.nokogiri --use-system-libraries
%install
export QA_SKIP_BUILD_ROOT=1
bundle --local --path %{buildroot}%_libdir/obs-api/
# test that the rake and rack macros is still matching our Gemfile
test -f %{buildroot}%_libdir/obs-api/ruby/2.5.0/gems/rake-%{rake_version}/rake.gemspec
test -f %{buildroot}%_libdir/obs-api/ruby/2.5.0/gems/rack-%{rack_version}/rack.gemspec
# run gem clean up script
/usr/lib/rpm/gem_build_cleanup.sh %{buildroot}%_libdir/obs-api/ruby/*/
# work around sassc bug - and install libsass
sassc_dir=$(ls -1d %{buildroot}%_libdir/obs-api/ruby/2.5.0/gems/sassc-2*)
install -D -m 755 $sassc_dir/ext/libsass/lib/libsass.so $sassc_dir/lib
sed -i -e 's,/ext/libsass,,' $sassc_dir/lib/sassc/native.rb
# Remove sources of extensions, we don't need them
rm -rf %{buildroot}%_libdir/obs-api/ruby/*/gems/*/ext/
# remove binaries with invalid interpreters
rm -rf %{buildroot}%_libdir/obs-api/ruby/*/gems/diff-lcs-*/bin
# remove spec / test files from gems as they shouldn't be shipped in gems anyway
# and often cause errors / warning in rpmlint
rm -rf %{buildroot}%_libdir/obs-api/ruby/*/gems/*/spec/
rm -rf %{buildroot}%_libdir/obs-api/ruby/*/gems/*/test/
# we do not verify signing of the gem
rm -rf %{buildroot}%_libdir/obs-api/ruby/*/gems/mousetrap-rails-*/gem-public_cert.pem
# remove prebuilt binaries causing broken dependencies
rm -rf %{buildroot}%_libdir/obs-api/ruby/*/gems/selenium-webdriver-*/lib/selenium/webdriver/firefox/native
# remove all gitignore files to fix rpmlint version-control-internal-file
find %{buildroot}%_libdir/obs-api -name .gitignore | xargs rm -rf
# fix interpreter in installed binaries
for bin in %{buildroot}%_libdir/obs-api/ruby/*/bin/*; do
sed -i -e 's,/usr/bin/env ruby.ruby2.5,/usr/bin/ruby.ruby2.5,' $bin
done
# remove exec bit from all other files still containing /usr/bin/env - mostly helper scripts
find %{buildroot} -type f -print0 | xargs -0 grep -l /usr/bin/env | while read file; do
chmod a-x $file
done
%files
%_libdir/obs-api
%files -n obs-api-deps
%doc README
%files -n obs-api-testsuite-deps
%doc README
%changelog
*Sat Mar 7 2020 Shijie Luo <luoshijie1@huawei.com> 2.10.1-0
-Package Init.