Having a hard time packaging a Qt application

I’ve been trying to compile a program I wrote. I’ve been able to fix each error message except for this one.

error: Bad file: /home/abuild/rpmbuild/SOURCES/bir.desktopopensuse build service: No such file or directory

I don’t know why its looking for a file with .desktopopensuse as the extension. I am calling %suse_update_desktop_file I’m not sure if the .desktop file should be on the root or TARed up with the rest of the sources. Please, if you could take a look at how I’m structuring things and tell me if I’m doing it wrong I would appreciate it.

My tar.gz file contains a single folder with the name of the app and the version number. I did this based on the errors it was giving me. Here is my spec file:


Name:        bir
BuildRequires:    libqt4-devel update-desktop-files gcc-c++ 
Requires:       libqt4
Version:        1.1
Release:        0
Summary:        Batch image resizer and manipulator.
License:        GPL-3.0+
Group:          Graphics/RasterGraphics
Url:            https://github.com/agronick/BIR
Source0:    %{name}-%{version}.tar.gz
Distribution:   %{distr}
Packager:    Kdde Aasddick agrasdsck@gmail.com  
BuildRoot:      %{_tmppath}/%{name}-%{version}-build 
Source1:        %name.desktopopensuse build service

%define qmake /usr/bin/qmake

%description
Batch image resizer and manipulator. Written in Qt. Able to resize, crop, and rotate directories of images and preserve file structure.
 

%prep
%setup -q

%build 
qmake
make 
%install
make install INSTALL_ROOT="%buildroot";
%suse_update_desktop_file -i %name 
%clean
rm -rf $RPM_BUILD_ROOT

%files
/usr/share/applications/%name.desktop
%defattr(-,root,root)
%doc README.md
%{_bindir}/%{name}
%changelog

If anyone can help me I’d really appreciate it.

On Thu 28 Aug 2014 08:56:02 PM CDT, agronick wrote:

My tar.gz file contains a single folder with the name of the app and the
version number. I did this based on the errors it was giving me. Here is
my spec file:

Source1: %name.desktopopensuse build service

If anyone can help me I’d really appreciate it.

Hi
Your desktop file name is wrong it should be name.desktop


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.1 Kernel 3.11.10-21-desktop
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Wow Thanks. I don’t know how I could have missed that. Must have pasted it in by accident.

I’m getting another error now which is what I was getting before. I’ve read a lot about the build service and watched youtube videos on packaging RPMs but I’m still having trouble understanding where it gets the binaries. Is there a certain directory it uses? The error I’m getting now is:

File not found: /home/abuild/rpmbuild/BUILDROOT/bir-1.1-51.1.x86_64/usr/bin/bir

I used the make install code on the openSUSE:Build system recipes page under Qt. Here is what the spec file looks like now:

Name:        bir
BuildRequires:    libqt4-devel update-desktop-files gcc-c++ 
Requires:       libqt4
Version:        1.1
Release:        0
Summary:        Batch image resizer and manipulator.
License:        GPL-3.0+
Group:          Graphics/RasterGraphics
Url:            https://github.com/agronick/BIR
Source0:    %{name}-%{version}.tar.gz
Distribution:   %{distr}
Packager:    Kyle Agronick agronick@gmail.com  
BuildRoot:      %{_tmppath}/%{name}-%{version}-build 
Source1:        %name.desktop

%define qmake /usr/bin/qmake

%description
Batch image resizer and manipulator. Written in Qt. Able to resize, crop, and rotate directories of images and preserve file structure.
 

%prep
%setup -n %{name}-%{version} 

%build 
qmake-qt4 || qmake
qmake -makefile %{name}.pro
qmake

make %{?_smp_mflags}

%install
make install DESTDIR=%{buildroot} INSTALL_ROOT=%{buildroot};
%suse_update_desktop_file -i bir
%clean
rm -rf $RPM_BUILD_ROOT

%files
/usr/share/applications/%name.desktop 
%defattr(-,root,root)
%doc README.md
%{_bindir}/%{name}
%changelog

Hi
Can you post a link to the package on OBS, will branch it and take a look this evening.

Thanks I really appreciate it: https://build.opensuse.org/package/show/home:agronick/BIR

I wanted to add that the program compiles easily enough with just qmake followed by make. It even installs fine just by running make install. I had the desktop file installation as part of the qt project but I took it out so the build process could do it. Whatever recipe works for a program this simple should work for this.

Hi
Can you please hold off making changes every two minutes so I can help you, every time you make a change it affects my branch.

Hi
Since you seem to have resolved the issue, I will remove my branch.

Just a note in the future, if you ask for help, I’m happy to help, but not if you keep changing things, it’s very frustrating when files keep changing.

You need to fix your desktop file, plus there are macros to run for updating the desktop files in openSUSE, you also are building without the rpm opt flags set;


  118s] I: File is compiled without RPM_OPT_FLAGS
  118s] W: bir no-rpm-opt-flags <cmdline>:main.cpp, bir.cpp, selectitem.cpp, moc_bir.cpp, qrc_icon.cpp

On Fri 29 Aug 2014 02:06:01 AM CDT, malcolmlewis wrote:

Hi
Since you seem to have resolved the issue, I will remove my branch.

Just a note in the future, if you ask for help, I’m happy to help, but
not if you keep changing things, it’s very frustrating when files keep
changing.

You need to fix your desktop file, plus there are macros to run for
updating the desktop files in openSUSE, you also are building without
the rpm opt flags set;

Code:

118s] I: File is compiled without RPM_OPT_FLAGS
118s] W: bir no-rpm-opt-flags <cmdline>:main.cpp, bir.cpp,
selectitem.cpp, moc_bir.cpp, qrc_icon.cpp
Code:

Here you go, add the patch to your sources on github and update the
version tag…

I added some Fedora bits, but don’t use or build that distro.


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
openSUSE 13.1 (Bottle) (x86_64) GNOME 3.10.1 Kernel 3.11.10-21-desktop
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

Thanks for your help. I created another project in lowercase since that was another thing the RPM lint was saying to change. I added all your specfile changes and I’ll see what I need to do with the desktop file. The problem seemed to be in the .pro file. I needed to set some paths and it all worked. It took over 70 tries to get it working but it looks like its pretty much all there now.

If I were to package it for Ubuntu would I need to create all these files and it would completely ignore the spec file?

  1. packageName.dsc
  2. debian.changelog
  3. debian.control
  4. debian.rules

Do you know if there are any distros I can build for (I’m guessing Red Hat) without changing much?

Hi
I think you need to create some additional directories in your github project, think it’s data for the debian files, for your dsc file in the obs project and then add the target.

http://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto
and
http://en.opensuse.org/openSUSE:Build_Service_Debian_builds

A good starting point is;
http://en.opensuse.org/Portal:Packaging

I would also look at adding a man page…

Thanks. I’ll try doing that tomorrow.

Does the OpenSuse stuff (which I guess is basically the spec file) get it’s own directory? Or is it just those other distros?

I tried putting in the stuff Fedora needed. Its saying

Failed to validate the created desktop file

even when I have desktop-file-validate in the spec file. I tried it with different parameters and moved it around the file and it still didn’t work.