Problem with ruby package with binary content...
Mamoru Tasaka
mtasaka at ioa.s.u-tokyo.ac.jp
Tue Jul 14 16:44:59 UTC 2009
Darryl L. Pierce wrote, at 07/15/2009 12:23 AM +9:00:
> This question is related to:
> https://bugzilla.redhat.com/show_bug.cgi?id=505589
>
> When I remove the strip line, then the build process fails with the
> complaint:
>
> Found
> '/home/mcpierce/Packaging/rpms/BUILDROOT/rubygem-RedCloth-4.1.9-5.fc12.x86_=
> 64'
> in installed files; aborting
>
> I'm not sure what's wrong here. The %install portion of my spec file is
> as follows:
>
> ---8<[snip]---
> rm -rf %{buildroot}
>
> install -d -m0755 %{buildroot}%{gemdir}
> install -d -m0755 %{buildroot}%{ruby_sitelib}
> install -d -m0755 %{buildroot}%{ruby_sitearch}
> install -d -m0755 %{buildroot}%{_bindir}
>
> gem install --local --install-dir %{buildroot}%{gemdir} \
> --force -V --rdoc %{SOURCE0}
>
> cp -a %{buildroot}%{gemdir}/bin/* %{buildroot}%{_bindir}
> mv %{extensionddir}%{gemlibname}
> %{buildroot}%{ruby_sitearch}/%{gemlibname}
> rm -rf %{extensionddir}
> # strip %{buildroot}%{ruby_sitearch}/%{gemlibname}
> rm %{installroot}/lib/%{gemlibname}
> cp %{installroot}/lib/redcloth.rb
> %{buildroot}%{ruby_sitelib}/redcloth.rb
> rm -rf %{buildroot}%{gemdir}/bin
> find %{buildroot}%{geminstdir}/bin -type f | xargs chmod a+x
> find %{buildroot}%{geminstdir} -name "*.rb" | xargs chmod a+x
>
> find %{buildroot}%{geminstdir} -type f -name \*.rb | xargs chmod 0644
>
> find %{buildroot}%{geminstdir} -type f -name \*.rb | \
> xargs grep -l "^#!%{_bindir}/env" $file | xargs chmod 0755
>
> rm %{installroot}/.require_paths
> ---8<[snip]---
>
> Any ideas?
This is because with your spec file gem is directly installed under
%buildroot. So some C codes in the gem (usually under ext/ directory)
are compiled under %buildroot and the string "%buildroot"
is embedded in the built binary (with "gcc -g"). This will make
/usr/lib/rpm/check-buildroot complain.
The correct way is to expand (install) gem file once under %_builddir
(at %prep or %build) and and copy all (under %_builddir) under
%buildroot at %install like:
-------------------------------------------------------------------
%prep
%setup -q -c -T
mkdir -p ./%{gemdir}
export CONFIGURE_ARGS="--with-cflags='%{optflags}'"
gem install --local --install-dir .%{gemdir} \
--force -V --rdoc %{SOURCE0}
%build
%install
rm -rf %{buildroot}
mkdir -p %{buildroot}%{gemdir}
cp -a .%{gemdir}/* %{buildroot}%{gemdir}
....
....
-------------------------------------------------------------------
With this debuginfo rpm will also be created correctly.
Regards,
Mamoru
More information about the fedora-devel-list
mailing list