postuninstall script of my package failed

Hi everyone,

I have some trouble building a package for OpenSUSE using OBS.
In fact, everything is fine until the very end of the package’s tests :

Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/abuild/rpmbuild/BUILDROOT/gdevelop-3.6.76-27.1.x86_64
 2767s] Wrote: /home/abuild/rpmbuild/SRPMS/gdevelop-3.6.76-27.1.src.rpm
 2875s] Wrote: /home/abuild/rpmbuild/RPMS/x86_64/gdevelop-3.6.76-27.1.x86_64.rpm
 2875s] Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.eE8dyv
 2875s] + umask 022
 2875s] + cd /home/abuild/rpmbuild/BUILD
 2875s] + cd gdevelop-3.6.76
 2875s] + rm -rf /home/abuild/rpmbuild/BUILDROOT/gdevelop-3.6.76-27.1.x86_64
 2877s] + exit 0
 2878s] ... checking for files with abuild user/group
 2879s] ... running 00-check-install-rpms
 2879s] ... installing all built rpms
 2879s] Preparing packages...
 2880s] gdevelop-3.6.76-27.1.x86_64
 2891s] ... running 01-check-debuginfo
 2891s] ... testing for empty debuginfo packages
 2891s] ... running 02-check-gcc-output
 2891s] ... testing for serious compiler warnings
 2891s]     (using /usr/lib/build/checks-data/check_gcc_output)
 2891s]     (using //.build.log)
 2892s] ... running 03-check-binary-kernel-log
 2892s] ... running 04-check-filelist
 2892s] ... checking filelist
 2892s] ... running 05-check-invalid-requires
 2892s] ... running 06-check-installtest
 2892s] ... testing for pre/postinstall scripts that are not idempotent
 2895s] /.build_patchrpmcheck_scr: line 11: fg: no job control
 2895s] postuninstall script of gdevelop-3.6.76-27.1.x86_64.rpm failed
 2895s] ### WATCHDOG MARKER START ###
 2898s]  2843.107437] SysRq : Power Off
 2898s]  2843.113901] reboot: Power down
 2900s] ### WATCHDOG MARKER END ###

It says that the uninstall post script is invalid but I can’t find the error.
Here is my package : https://build.opensuse.org/package/show/home:victorlevasseur/gdevelop (where you can see the SPEC file)

I’m using the %desktop_database_* macros and I’ve included desktop-file-utils as a BuildRequire so I don’t know what is wrong.
Can you help me please ?

Thanks.

You can the SPEC here (as I’ve changed it on my repo) :

Name:           gdevelop
Version:        3.6.76
Release:    0.1%{?dist}
Summary:        GDevelop game creator

Group:          extra
License:        GPL LGPL MIT
URL:            http://www.compilgames.net

Source0:        gdevelop_%{version}.orig.tar.gz
Source1:    gdevelop.desktop
Source2:    gdevelop.xml
Source100:    gdevelop-rpmlintrc

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

BuildRequires:  git rsync curl gcc-c++ cmake p7zip glew-devel xorg-x11-devel libsndfile-devel openal-soft-devel desktop-file-utils
%if 0%{?fedora}
BuildRequires:    systemd-devel libjpeg-turbo-devel gtk2-devel wxGTK3-devel
%else
BuildRequires:  update-desktop-files libudev-devel libjpeg8-devel wxWidgets-3_0-devel 
%endif
Requires:       gcc-c++ p7zip desktop-file-utils

%description 
GDevelop is a full featured, open source game development software, 
allowing to create HTML5 and native games without needing any knowledge 
in a specific programming language. All the game logic is made thanks 
to an intuitive and powerful event based system.

%prep
%setup -q -n gdevelop-%{version}

%build
#Configuration
rm Binaries/Packaging/debian-source-package/extra-files/gdevelop.desktop
cd Binaries
rm -rf .build
mkdir .build
cd .build
cmake ../..

#Build the whole project
make %{?_smp_mflags}

%install
rm -rf $RPM_BUILD_ROOT

#Create installation folder and copy all file inside it
mkdir -p "$RPM_BUILD_ROOT"/opt/gdevelop
mkdir -p "$RPM_BUILD_ROOT"/usr/share/applications
mkdir -p "$RPM_BUILD_ROOT"/usr/share/mime/packages
mkdir -p "$RPM_BUILD_ROOT"/usr/bin
mkdir -p "$RPM_BUILD_ROOT"/usr/share/pixmaps
cp -R Binaries/Output/Release_Linux/* "$RPM_BUILD_ROOT"/opt/gdevelop

#Copy other files
cp Binaries/Packaging/debian-source-package/extra-files/gdevelop "$RPM_BUILD_ROOT"/usr/bin/

#Update the icon
cp -T Binaries/Output/Release_Linux/res/icon48linux.png "$RPM_BUILD_ROOT"/usr/share/pixmaps/GDevelop.png
%if 0%{?fedora}
desktop-file-install --vendor="" --dir=%{buildroot}%{_datadir}/applications/ %{_sourcedir}/gdevelop.desktop
%else
%suse_update_desktop_file -i gdevelop
%endif

#Add MIME type
cp %{S:2} "$RPM_BUILD_ROOT"/usr/share/mime/packages

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root,-)

/opt/gdevelop
/usr/bin/gdevelop
/usr/share/applications/gdevelop.desktop
/usr/share/pixmaps/GDevelop.png
/usr/share/mime/packages/gdevelop.xml

%if 0%{?fedora}
%post
update-mime-database /usr/share/mime
update-desktop-database
%else
%post
%desktop_database_post
%endif

%if 0%{?fedora}
%postun
update-mime-database /usr/share/mime
update-desktop-database
%else
%postun
%desktop_database_postun
%endif

%doc


%changelog

Well, my first guess would be this %doc:


%if 0%{?fedora}
%post
update-mime-database /usr/share/mime
update-desktop-database
%else
%post
%desktop_database_post
%endif

%if 0%{?fedora}
%postun
update-mime-database /usr/share/mime
update-desktop-database
%else
%postun
%desktop_database_postun
%endif

%doc


%changelog

I’m not aware of any %doc macro that would make sense at this place, so try to remove it.

Also, I would rather write your %post and %postun sections like this:

%post
%if 0%{?fedora}
update-mime-database /usr/share/mime
update-desktop-database
%else
%desktop_database_post
%endif

%postun
%if 0%{?fedora}
update-mime-database /usr/share/mime
update-desktop-database
%else
%desktop_database_postun
%endif

Thanks for your help, everything is working now. :slight_smile: