Why is %fdupes returning fg: no job control errors?

Hi,

I have this spec file:


# This appears in the download URL
%define _build 17456


# This appears in the download URL
%define _build 17456
%define debug_package %{nil}
Name:           komodo-edit
Version:        10.1.4
Release:        0
License:        MPLv2
Summary:        The Komodo text editor
Url:            http://activestate.com
Group:          Utility/TextEditor
%ifarch x86_64
Source:         http://downloads.activestate.com/Komodo/releases/%{version}/Komodo-Edit-%{version}-%{_build}-linux-x86_64.tar.gz
%else
Source:         http://downloads.activestate.com/Komodo/releases/%{version}/Komodo-Edit-%{version}-%{_build}-linux-x86.tar.gz
%endif
Patch0:         _install.py.patch
Patch1:         activestate.py.patch
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif
BuildRequires:  hicolor-icon-theme
BuildRequires:  patch
Requires:       gtk2
BuildRoot:      %{_tmppath}/%{name}-%{version}-build


%description
Komodo Edit, an open-source text editor developed by ActiveState and built using the Mozilla platform.


%prep
# This section (along with the corresponding patches) was borrowed from the PKGBUILD in the AUR for komodo-edit
%ifarch x86_64
%setup -q -n Komodo-Edit-%{version}-%{_build}-linux-x86_64
%else
%setup -q -n Komodo-Edit-%{version}-%{_build}-linux-x86
%endif
sed -i "s/__VERSION__/%{version}-%{_build}/" %{PATCH0}
sed -i "s/__VERSION__/%{version}-%{_build}/" %{PATCH1}
sed -i "s/__ARCH__/x86_64/" %{PATCH0}
sed -i "s/__ARCH__/x86_64/" %{PATCH1}


patch -p0 -i %{PATCH0} support/_install.py
patch -p0 -i %{PATCH1} INSTALLDIR/lib/python/lib/python*.*/activestate.py


%build
LD_LIBRARY_PATH=$PWD/INSTALLDIR/lib/mozilla:"$LD_LIBRARY_PATH"
INSTALLDIR/lib/python/bin/python -E support/_install.py -I %{_builddir}/%{_libdir}/%{name}


%install
sed -i "/#!/c\#!%{_libdir}/komodo-edit/lib/python/bin/python2.7" %{_builddir}/%{_libdir}/%{name}/lib/python/bin/python-config


install -dm 755 %{buildroot}/%{_libdir}/%{name}
%define kdata %{buildroot}/%{_libdir}/%{name}


# Desktop file
install -dm 755 %{buildroot}%{_datadir}/applications
cat > "%{buildroot}%{_datadir}/applications/%{name}.desktop" << EOF
[Desktop Entry]
Encoding=UTF-8
Name=Komodo Edit
GenericName=Editor
Comment=Free multi-platform editor that makes it easy to write quality code.
Exec="%{name}" %F
Icon=%{name}
Terminal=false
Type=Application
MimeType=application/javascript;application/json;application/postscript;application/x-desktop;application/x-httpd-eruby;application/x-httpd-php;application/x-httpd-php3;application/x-httpd-php4;application/x-httpd-php5;application/x-ruby;application/x-bash;application/x-csh;application/x-sh;application/x-zsh;application/x-shellscript;application/x-sql;application/x-tcl;application/xhtml+xml;application/xml;application/xml-dtd;application/xslt+xml;text/coffeescript;text/css;text/html;text/plain;text/xml;text/xml-dtd;text/x-bash;text/x-c++;text/x-c++hdr;text/x-c++src;text/x-c;text/x-chdr;text/x-csh;text/x-csrc;text/x-dsrc;text/x-diff;text/x-fortran;text/x-go;text/x-java;text/x-java-source;text/x-lua;text/x-makefile;text/x-markdown;text/x-objc;text/x-pascal;text/x-perl;text/x-php;text/x-python;text/x-ruby;text/x-sh;text/x-zsh;text/yaml;inode/directory;
Categories=Utility;TextEditor;
EOF


mv -f %{_builddir}/%{_libdir}/%{name}/lib %{buildroot}/%{_libdir}/%{name}/
mv -f %{_builddir}/%{_libdir}/%{name}/share/icons %{buildroot}/%{_datadir}/
mv %{buildroot}/%{_datadir}/icons %{buildroot}/%{_datadir}/pixmaps
find %{buildroot} -name "cile_LANG.py" -delete
find %{buildroot} -name "cmdln.py" -delete
find %{buildroot} -name "codeintel_LANG.py" -delete
find %{buildroot} -name "koLANG_UDL_Language.py" -delete
find %{buildroot} -name 'XPCOM Component (Python).py' -delete


install -dm 755 %{buildroot}/%{_bindir}
ln -sf %{_libdir}/%{name}/lib/mozilla/komodo %{buildroot}/%{_bindir}/komodo


export NO_BRP_CHECK_RPATH=true


find %{kdata} -name "*.py" -exec sed -i 's|/usr/local/bin/python|/usr/bin/python|g' {} \;


ln -sf %{_datadir}/pixmaps/komodo256.png %{buildroot}%{_datadir}/pixmaps/%{name}.png


%if 0%{?suse_version}
%fdupes -s %{buildroot}/usr
%endif


%files
%{_bindir}/komodo
%{_libdir}/%{name}/
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/komodo*.png
%{_datadir}/pixmaps/komodo*.xpm

oddly the %fdupes line fails on every platform I’ve tried building this spec file on (including openSUSE), giving an error along the lines of:


   26s] + %fdupes -s /home/abuild/rpmbuild/BUILDROOT/komodo-edit-10.1.4-22.1.x86_64/usr
   26s] /var/tmp/rpm-tmp.Z7xvt9: line 66: fg: no job control
   26s] error: Bad exit status from /var/tmp/rpm-tmp.Z7xvt9 (%install)

. Building this spec file on CentOS and Fedora (without the %if 0%{?suse_version} line before the %fdupes line, of course) also returns this error. Any ideas why? I have read this packaging guide but it was of little help as the only fg error troubleshooting it mentioned was related to the %suse_update_desktop_file macro.

The %fdupes line is required as without it the package fails rpmlint tests due to duplicate files.

Thanks for your time,
Brenton

Try to add:

BuildRequires: fdupes

And that is actually mentioned in the link you provided:

To use %fdupes, you must include BuildRequires: fdupes in the spec file.

You will receive a “no job control” error if you do not BuildRequire fdupes. The “%fdupes” macro is then undefined and it is copied into the shell script, and the shell treats ‘%’ for job control, resulting in the error.

Oops, rofl, I had that line there before but I deleted it when I thought I might build without it. Forgot to add it when I realize the SUSE build would fail without it.