I have developed a program in Python (PyQt) which, at the moment, is just a folder with all those source, icon, xml etc. files. I zipped it in a *.tar.gz. Then I created a project in the OBS, uploaded the *.tar.gz in the Sources, selected repositories. And it shows the build status is broken.
Has anyone built an rpm on OBS before? I just want to make an rpm of my program and make it available from my project repository. Please help me build it. What else do I need to do? I’ve read the OBS tutorial and guidelines but they don’t really tell you step by step what you need to do after you add repositories and how to fix the broken build errors.
The only dependencies for my program are Python and Qt.
I’ve also uploaded a spec file:
$ osc mkpac qt-test
$ cd qt-test
$ osc build
$ osc vc
$ osc commit
not sure if it’s correct though.
Thank you.
I don’t know what that spec file was doing but after some more research I came up with this:
Summary: Test Program
Name: qt-test
Version: 1.0.0
Release: 1
Source:
URL:
License: GPL3
Group: Utilities/Engineering
%description
Qt-based program.
%prep
%setup
%build
%install
rm -rf $RPM_BUILD_ROOT
make DESTDIR=$RPM_BUILD_ROOT install
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root)
%doc AUTHORS BUGS ChangeLog COPYING INSTALL NEWS README THANKS TODO
%{_prefix}/bin/qt-test
%{_prefix}/info/qt-test.info
%{_prefix}/lib/charset.alias
%{_prefix}/man/man1/*
%{_prefix}/share/locale/*/LC_MESSAGES/qt-test.mo
%{_prefix}/share/locale/locale.alias
%changelog
- Fri Apr 1 2011 Linuxoidoz
- First draft of the spec file
Is it correct to build an rpm from my Python program?
Thank you.
On Wed, 2011-03-30 at 00:06 +0000, linuxoidoz wrote:
> I have developed a program in Python (PyQt) which, at the moment, is
> just a folder with all those source, icon, xml etc. files. I zipped it
> in a *.tar.gz. Then I created a project in the OBS, uploaded the
> *.tar.gz in the Sources, selected repositories. And it shows the build
> status is broken.
>
> Has anyone built an rpm on OBS before? I just want to make an rpm of my
> program and make it available from my project repository. Please help me
> build it. What else do I need to do? I’ve read the OBS tutorial and
> guidelines but they don’t really tell you step by step what you need to
> do after you add repositories and how to fix the broken build errors.
>
> The only dependencies for my program are Python and Qt.
>
> Thank you.
>
>
Hi
You need to make a spec file as well as add a setup.py to build your
application in your sources, the setup file will place the individual
files into the respective directories of the linux FHS.
What’s your home directory on OBS and I will branch and have a look for
you.
–
Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.32.29-0.3-default
up 9 days 2:03, 2 users, load average: 0.15, 0.18, 0.18
GPU GeForce 8600 GTS Silent - Driver Version: 260.19.26
On 2011-03-30 02:06, linuxoidoz wrote:
Please move this to the build-service subforum.
–
Cheers / Saludos,
Carlos E. R.
(from 11.2 x86_64 “Emerald” at Telcontar)
malcolmlewis, I’ve sent you a PM
Where is the Build sub-forum?
Hi
It’s here; openSUSE Build Service (OBS)
Locking thread until it syncs, then will move and reopen on the build service forum.
Hi linuxoidoz
So it looks like you need to create a setup/build routine so the files get put in the correct place (as in the python site lib) because when you run the application it creates files… I’m no python expert, but I think you need to take a step back and investigate how to compile it? You would also want to look at changing the license file to be called COPYING (which is the norm), add an AUTHOR, ChangeLog etc…
I will help as much as I can, just tell me what you need help with 
Hi
OK, did a test build for you. I also added a setup.py, a start script for /usr/bin. Now the README file has wrong end of line encoding and all the files in the icon directory need the permissions changed to 0644. I did this manually and created a new tarball called 2.0.3.
Have a look here;
https://build.opensuse.org/package/show?package=qt-converter&project=home%3Amalcolmlewis%3Abranches%3Ahome%3Alinuxoidoz
I can SR the files to you if your want?
Thank you very much for your help.
When you have a few spare minutes, could you please tell me what exactly you have done?
All I want is to make my program installable as an rpm. And when it installs, I want it to appear in the KDE menu. Is it what you have done? Do you know of any good howto to do that? I followed the OBS one and obviously it’s useless because it’s very generic.
If I have a folder which has all my files, what do I have to do before I build it? My program runs by just running the main script file. It doesn’t need to be compiled, Python is interpreted. My program only creates config files.
- what is setup.py for?
- what permissions do I have to assign to my files?
- what are COPYING and AUTHOR and ChangeLog for? Are these mandatory?
- how can I download your built rpm and try to install it?
I’ve also noticed, my program requires PyQt, I think it must be part of python-qt or python-qt-devel or something like that.
Thanks again.
I’ve downloaded your archive and spec file, uploaded them into my project and they failed building.
Oh, I’ve just noticed I had a wrong archive extention (tar.gz instead of tar.bz2). Now it succeeded. I’ve got an rpm!
I’ll see if I can install it.
Well, YAST shows it’s installed but it’s not in the KDE menu. Do you know how to make it appear in there?
Also, I found the executable in the /usr/bin but it doesn’t run. What do I need to do there?
Thank you.
Okay, I found a typo in the main executable file, now everything works great! I guess I can take it from here. But I would really appreciate it if you could help me with how to automatically add my program to the Menu. Thank you.
Well, now I’ve learnt I had to make a *.desktop file. So I did. Now, how can I make the rpm to add it to the user desktop and KDE Menu?
I tried these spec file options:
BuildRequires: update-desktop-files
%install
python setup.py install --prefix=%{_prefix} --root=$RPM_BUILD_ROOT --record-rpm=INSTALLED_FILES
cp %{name}.desktop %{buildroot}/usr/share/applications/
%suse_update_desktop_file %name Utilities
%clean
rm -rf %{buildroot}
%files -f INSTALLED_FILES
%defattr(-,root,root)
%doc COPYING README
/usr/share/applications/%{name}.desktop
but the build fails. What are the right options to add the *.desktop file to the desktop and to add the program to the KDE Menu?
He-hey, it’s built! At last!!! … 9 hours later and up to ver -127-…
Hi
Success
If you look at using osc and build locally it’s a lot easier.
For your desktop files you need to look here;
openSUSE:Packaging Conventions RPM Macros - openSUSE
For python building have a look here;
openSUSE:Packaging Python - openSUSE
and this bit setuptools/eggs
You will need to edit the setup.py to include your information as required. The COPYING etc files are just how people normally create the files, so it makes it easier for packagers.
Are you using an IDE for your development as I’m sure they will have tools that will autogenerate the setup.py etc?
Hi
OK, so in your source fix the desktop file to include the categories, rather than append.
Update the setup.py file to install the desktop file, it’s just where in your source -> destination, as in the paths/files.
Then you could remove it from the files list and then just run the desktop macro without the -i and just the name.
%suse_update_desktop_file %{name}
Yes, I’ve just installed osc last night but haven’t tried it yet. The web insterface is soooooooooooooooo sloooooooooooooooooow.
I’ve read about the setup.py and how it works. Before you mentioned it I had no idea Python can make installations. I’m getting there.
I used to use Eclipse with PyDev. When it all worked - everything was great. But as soon as something went wrong in Eclipse it was such a pain in the *** to fix it. Every time I told myself it was the last time I fix Eclipse and if it happened again I’d use something else. But then I fixed it and was happy again for a while. Then I upgraded to openSUSE-11.4 and copied my Eclipse folder over and it didn’t work. I tried to fix it again but succeeded only partially. And I hate it so much that it can’t simply add or remove files to/from the project. So it was the last straw. I dumped it and now use Eric. Or just KWrite for simple editing. Well, to cut the long story short, I couldn’t find anywhere how to auto-generate setup.py files.
Yes, my desktop file now includes Utility DesktopUtility category as I couldn’t figure out how to make a new category, for example Engineering.
Update the setup.py file to install the desktop file, it’s just where in your source -> destination, as in the paths/files.
Then you could remove it from the files list and then just run the desktop macro without the -i and just the name.
Can you please elaborate ob the above? Sorry, didn’t understand what you meant. Remove what from which files list? To remove the desktop file from my archive? And I thought ‘-i’ is for installing. Doesn’t the spec file specifies where the desktop file should be installed?
Thank you.