Blob Blame History Raw
%{?scl:%scl_package rubygem-%{gem_name}}
%{!?scl:%global pkg_name %{name}}

%global	gem_name	byebug

Name:		%{?scl_prefix}rubygem-%{gem_name}
Version:	9.0.6
Release:	3%{?dist}

Summary:	Ruby 2.0 fast debugger - base + CLI
License:	BSD

URL:		http://github.com/deivid-rodriguez/byebug
Source0:	https://rubygems.org/gems/%{gem_name}-%{version}.gem
# %%{SOURCE2} %%{pkg_name} %%{version}
Source1:	rubygem-%{gem_name}-%{version}-full.tar.gz
Source2:	byebug-create-full-tarball.sh
Source10:	gcd.rb
# https://github.com/deivid-rodriguez/byebug/commit/cecae97def2026cba3291d03937d520856c5346c.patch
Patch0:	rubygem-byebug-9.0.6-test-fix-ruby24-thread.patch

Requires:      %{?scl_prefix_ruby}ruby(release)
Requires:      %{?scl_prefix_ruby}ruby(rubygems)
BuildRequires: %{?scl_prefix_ruby}ruby(release)
BuildRequires: %{?scl_prefix_ruby}ruby(rubygems)
BuildRequires: %{?scl_prefix_ruby}rubygems-devel
BuildRequires: %{?scl_prefix_ruby}ruby-devel
BuildRequires: %{?scl_prefix_ruby}rubygem(minitest) >= 5
Provides:      %{?scl_prefix}rubygem(%{gem_name}) = %{version}

# Explicitly require runtime subpackage, as long as older scl-utils do not generate it
%{?scl:Requires: %{?scl_prefix}runtime}

%description
Byebug is a Ruby 2 debugger. It's implemented using the
Ruby 2 TracePoint C API for execution control and the Debug Inspector C API
for call stack navigation.  The core component provides support that
front-ends can build on. It provides breakpoint handling and bindings for
stack frames among other things and it comes with an easy to use command
line interface.

%package	doc
Summary:	Documentation for %{pkg_name}
Requires:	%{?scl_prefix}%{pkg_name} = %{version}-%{release}
BuildArch:	noarch

%description doc
Documentation for %{pkg_name}.

%prep
%{?scl:scl enable %{scl} - << \EOF}
set -e
%setup -q -T -n %{gem_name}-%{version} -b 1
gem spec %{SOURCE0} -l --ruby > %{gem_name}.gemspec

%patch0 -p1
%{?scl:EOF}

%build
%{?scl:scl enable %{scl} - << \EOF}
set -e
gem build %{gem_name}.gemspec
%gem_install
%{?scl:EOF}

%install
mkdir -p %{buildroot}%{gem_dir}
cp -a .%{gem_dir}/* \
	%{buildroot}%{gem_dir}/

mkdir -p %{buildroot}%{gem_extdir_mri}
cp -a .%{gem_extdir_mri}/{gem.build_complete,%{gem_name}/} %{buildroot}%{gem_extdir_mri}/
rm -rf %{buildroot}%{gem_instdir}/ext/

mkdir -p %{buildroot}%{_bindir}
cp -pa .%{_bindir}/* \
	%{buildroot}%{_bindir}/

find %{buildroot}%{gem_instdir}/bin -type f | xargs chmod a+x

%check
%{?scl:scl enable %{scl} - << \EOF}
set -e
export GEM_PATH=%{buildroot}/%{gem_dir}:%{gem_dir}:$GEM_PATH
export PATH=%{buildroot}%{_bindir}:$PATH

remove_fail_test() {
	filename=$1
	shift
	num=$#
	while [ $num -gt 0 ]
	do
		if [ ! -f ${filename}.orig ] ; then
			cp -p $filename ${filename}.orig
		fi
		sed -i $filename -e "\@def.*$1@s|^\(.*\)$|\1; skip \"Skip this\"|"
		shift
		num=$((num - 1))
	done
}

yes "puts a, b ; s" | ruby -I.:lib:%{buildroot}%{gem_extdir_mri} -S byebug ruby %{SOURCE10} 120 84

remove_fail_test test/commands/frame_test.rb \
	test_frame_minus_one_sets_frame_to_the_last_one
remove_fail_test test/commands/next_test.rb \
	test_next_does_not_stop_at_byebug_internal_frames
remove_fail_test test/commands/finish_test.rb \
	test_finish_does_not_stop_in_byebug_internal_frames

# Do not ship simplecov on SCL.
export NOCOV=true

# Do not ship pry, because the upstream likes usersto install it
# if they want to use pry command.
# https://github.com/deivid-rodriguez/byebug/pull/301
mv test/commands/pry_test.rb{,disabled}

ruby -I.:lib:%{buildroot}%{gem_extdir_mri} script/minitest_runner.rb
%{?scl:EOF}

%files
# There is no %%license macro on RHEL6.
# https://bugzilla.redhat.com/show_bug.cgi?id=1386246
%{!?_licensedir:%global license %%doc}

%dir	%{gem_instdir}
%license %{gem_instdir}/LICENSE
%doc	%{gem_instdir}/CHANGELOG.md
%doc	%{gem_instdir}/CONTRIBUTING.md
%doc	%{gem_instdir}/GUIDE.md
%doc	%{gem_instdir}/README.md

%{_bindir}/byebug
%{gem_instdir}/bin

%{gem_libdir}/
%{gem_extdir_mri}/

%exclude	%{gem_cache}
%{gem_spec}

%files doc
%doc	%{gem_instdir}/CONTRIBUTING.md
%doc	%{gem_docdir}

%changelog
* Tue Feb 21 2017 Jun Aruga <jaruga@redhat.com> - 9.0.6-3
- Always use full tar.gz for installed files and
  keep using gem file for gem spec (ref: bug 1425220)

* Tue Feb 14 2017 Jun Aruga <jaruga@redhat.com> - 9.0.6-2
- Add "set -e".

* Wed Jan 18 2017 Jun Aruga <jaruga@redhat.com> - 9.0.6-1
- 9.0.6
- Apply upstream patch for test with ruby24

* Wed Apr 06 2016 Pavel Valena <pvalena@redhat.com> - 8.2.2-3
- Enable tests

* Wed Mar 02 2016 Pavel Valena <pvalena@redhat.com> - 8.2.2-2
- Add scl macros

* Wed Feb  3 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 8.2.2-1
- 8.2.2

* Mon Jan 11 2016 Mamoru TASAKA <mtasaka@fedoraproject.org> - 8.2.1-2
- F-24: rebuild against ruby23

* Tue Dec 29 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 8.2.1-1
- 8.2.1

* Sun Sep 13 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 6.0.2-1
- 6.0.2

* Thu Jun 18 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 5.0.0-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue May 19 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 5.0.0-1
- 5.0.0

* Fri Apr  3 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 4.0.5-1
- 4.0.5

* Sat Mar 28 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 4.0.4-1
- 4.0.4

* Fri Mar 20 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 4.0.3-1
- 4.0.3

* Tue Mar 17 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 4.0.2-1
- 4.0.2

* Sat Feb 07 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.5.1-4
- Remove simplecov

* Tue Feb 03 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.5.1-3
- A bit modification for %%check

* Tue Feb 03 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.5.1-2
- Make test suite exit with status

* Tue Feb 03 2015 Mamoru TASAKA <mtasaka@fedoraproject.org> - 3.5.1-1
- Initial package