Proper way to obtain source code for packages

Hi all! I am a recently converted Ubuntu user ( well almost, still have Ubuntu on my workstation ). I was attempting to figure where Gnome’s NetworkManager Applet was loading the panel icon images from which led me to attempt to figure out how to obtain the source for the binary package. I have had no luck so far. Here is what I have done up to this point.

  1. Enabled the OpenSUSE 11.3 Source Repository in YaST.
  2. Refreshed the Software Manager.
  3. Don’t know what to do next :stuck_out_tongue:

What is the proper way to obtain source for installed packages ( or any package for that matter )?

BTW, I did get the NM applet to pick up my custom icons through trial and error but I am interested expanding from my Java background by leaning to program for SUSE. So I’d really like to obtain the source code for the packages installed on my system.

Thanks!

You can browse the repos here
Index of /distribution/11.3/repo

That’s a step in the right direction, thanks. I was able to browse and find the source packages. However, even though I have the 11.3 source repository enabled, it does not show up in the list of repositories in the Software Manager program. I even gave the source repository a higher priority ( set priority to 98, all other repositories are 99 ) to see if that would help.

Is this something that I will have to learn the YaST command line for?

What exactly are you trying to do because it’s not a normal line questioning.

Yeah, I could be confusing the actual question just because I am a newb :). Let me ask a different question which may be easier to answer.

Assume that I download this package: http://download.opensuse.org/source/distribution/11.3/repo/oss/suse/src/NetworkManager-gnome-0.8-5.1.src.rpm
What is the next step I should take in order to actually browse the source code? Should I install the RPM and then extract the source code?

mjwalfredo wrote:

>
> Is this something that I will have to learn the YaST command line for?
>
>

Whenever I install a source package I use zypper for this. The zypper option
is si (source-install)
For example


sudo zypper si <package-name>

Of course you have to replace <package-name> with the real name of the
package.
I hope I did not completely missunderstand what you want.
For proper package builds you should make yourself familiar with rpmbuild.


openSUSE 11.3 64 bit | Intel Core2 Quad Q8300@2.50GHz | KDE 4.5 | GeForce
9600 GT | 4GB Ram
openSUSE 11.3 64 bit | Intel Core2 Duo T9300@2.50GHz | KDE 4.5 | Quadro FX
3600M | 4GB Ram

Okay, so I just install the source RPM?

Now will installing as you outlined actually build the binary or does it just extract the source ( or are there different options to pass to zypper to control that? )

Thanks!

Do you know about:
https://build.opensuse.org/

Consider asking at IRC #opensuse-buildservice

zypper only installs the source it does not compile anything (the same as on debian/ubuntu if you install the source packages with apt-get/aptitude or synaptic).

You will find the code in /usr/src/packages

That’s what I needed to know. Thanks!

As a addon (this link is quite old but gives you the principles) here is alink which explains you the structure of /usr/src/packages (34.2 The RPM build tree )
Chapter 34: Compiling SuSE Source Packages

I think nobody answered your question. When you just want to look at the code of a package, then

  1. Download somepackage.src.rpm into a directory.

  2. Unpack it like this:

unrpm somepackage.src.rpm
  1. You will find a couple of files (somepackage.spec and a couple of patch files probably) and an archive of the original source code ending in *.tar.bz2. Unpack it:
tar xvlf somepackage.tar.bz2

Then you have everything you want to look at.

Thanks Voodoo, I think that is the answer to the original question I had. However, I learned a lot from the other posts so my round about question did some good.

On a slightly related note, we have a forum guide here on Software on openSUSE: openSUSE software installation hints

That guide likely still needs further updating, but what you may find of interest is the command “rpmbuild”.

I used that yesterday, when I went to install kde4-kdenlive (packaged by packman packagers) on one of my openSUSE-11.4 Milestone5 test PCs, and found that the dependency requirement to install it could not be met, because the application ‘dvdauthor’ was missing for 11.4 M5. So I downloaded the .src file for dvdauthor for openSUSE-11.3](http://packman.links2linux.de/package/dvdauthor) and then from a terminal rebuilt that package for openSUSE-11.4 M5 by typing as a regular user:

rpmbuild --rebuild dvdauthor-0.7.0-1.pm.2.1.src.rpm

the 1st time I typed that, I was advised of a number of “devel” dependencies I was missing in order to rebuild ‘dvdauthor’. So I simply installed those missing dependencies (which fortunately were present) and then again tried:

rpmbuild --rebuild dvdauthor-0.7.0-1.pm.2.1.src.rpm

and the rpm dvdauthor-0.7.0-1.pm.2.1.i586.rpm was rebuilt for openSUSE-11.4 M5 and (in this case) placed under /usr/src/packages/RPMS/i586. I then installed that newly created rpm for ‘dvdauthor’ with zypper and again tried to install ‘kde4-kdenlive’. This time, kde4-kdenlive installed.