User:Rob-fortune

Jump to: navigation, search

About me

I can't imagine why you would want to know about me, so instead I will give you some useful information! I hope someone from the wiki team will integrate this into the wiki proper and make the information more widely available.

Making use of packages by SUSE users

The following does require an understanding of the linux command line and a basic understanding of how RPM package management works. It also requires the osc package, which you should install if you haven't already.

People who place packages on OBS often have other packages they made which are required to build the packages you want to create. They may also not have them set up to build for your version of SUSE. Here is a worked example of how to build such a package, in this case a file integrity protection system called par2 to repair damage to data I have stored on DVD caused by say, scratching one.

You need to be registered with OBS to do any of this.

Now, let's see if anyone somewhere has made my package I need…

$ osc se par2cmdline -s
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
No matches found for 'par2cmdline' in projects
####################################################################
matches for 'par2cmdline' in packages:

# Project               # Package
Ports:DebianBased:Auto  par2cmdline
home:Lazy_Kent          par2cmdline
home:OpenFTD            par2cmdline
home:darix              par2cmdline
home:davjam79:console   libpar2
home:tg1311             par2cmdline

Well, that's a bit of luck, several people seem to have made it and I know darix is an SUSE expert so his package is probably going to be the winner, and will save me having to examine it to see if they inserted trojans, etc which you really must always do when checking things out from OBS.

So, let's get her then:

$ osc co home:darix par2cmdline
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
A    home:darix
A    home:darix/par2cmdline
A    home:darix/par2cmdline/par2cmdline-0.4.tar.gz
A    home:darix/par2cmdline/par2cmdline.spec
A    home:darix/par2cmdline/par2cmdline_0.4-2.diff.gz

Usually at this stage I would examine carefully the spec file to see if it does any patching and check the md5 and/or other checksums match the files original source (I would google for it if I did not know where it originally came from). However, darix is > * so we can skip this stage, but you shouldn't.

$ osc build --alternative-project openSUSE:11.3 standard i586
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
Building par2cmdline.spec for standard/i586
Getting buildinfo from server and store to /home/rob/Documents/Dev/Aliens/osc/home:darix/par2cmdline/.osc/_buildinfo-standard-i586.xml
Getting buildconfig from server and store to /home/rob/Documents/Dev/Aliens/osc/home:darix/par2cmdline/.osc/_buildconfig-standard-i586
buildinfo is broken... it says:
unresolvable: nothing provides libpar2-devel

Whoops. Looks like we need something else that isn't in a standard repo. Better find it…

$ osc se libpar2-devel -s
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
No matches found for 'libpar2-devel' in projects
No matches found for 'libpar2-devel' in packages

That's odd, it doesn't seem to exist. Probably what has happened is someone has made a multi-package that builds not just libpar2 but libpar2-devel as well. So let's have a look for that:

$ osc se libpar2 -s
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
No matches found for 'libpar2' in projects
####################################################################
matches for 'libpar2' in packages:

# Project               # Package
Ports:DebianBased:Auto  libpar2
home:Lazy_Kent          libpar2-0
home:Lazy_Kent:KDE3     libpar2-0
home:OpenFTD            libpar2
home:darix              libpar2
home:davjam79:console   libpar2
home:tg1311             libpar2

A few people have, but since we are using the darix par2cmdline package, it makes a lot of sense to use his libpar2. That and because darix > * I don't have to check for hidden nasties (well I should, but he's trustworthy).

$ pwd
/home/rob/Documents/Dev/Aliens/osc/home:darix/par2cmdline
$ cd ..
$ osc co -c home:darix libpar2
Connecting to deprecated signal QDBusConnectionInterface::serviceOwnerChanged(QString,QString,QString)
A    /home/rob/Documents/Dev/Aliens/osc/home:darix/libpar2
A    /home/rob/Documents/Dev/Aliens/osc/home:darix/libpar2/libpar2-0.2.tar.bz2
A    /home/rob/Documents/Dev/Aliens/osc/home:darix/libpar2/libpar2-0.2_stupidconfigure.patch
A    /home/rob/Documents/Dev/Aliens/osc/home:darix/libpar2/libpar2.changes
A    /home/rob/Documents/Dev/Aliens/osc/home:darix/libpar2/libpar2.spec
$ ls
libpar2  par2cmdline

The -c option tells osc to drop the package we are checking out into the currrent direcotry rather than making a project/package folder for it.

We are going to need some RPMs here. Let's give them a place to go:

$ mkdir RPMS
$ ls
libpar2  par2cmdline  RPMS

And now it's time to build the library we need to make the package we really want. You might have to do this for several libraries. If you do it a lot, you should probably write a Python script to automate it :)

$ cd libpar2
$ osc build --alternative-project openSUSE:11.3 standard i586 --keep-pkgs ../RPMS

You should replace openSUSE:11.3 with your brand and version. You should change i586 if you are on 64-bit too. If you don't know what to put there, look in the file /etc/SuSE-release.

After a while, the build completes hopefully successfully and we can see:

$ ls ../RPMS/
libpar2-0-0.2-0.i586.rpm  libpar2-0-debuginfo-0.2-0.i586.rpm  libpar2-devel-0.2-0.i586.rpm
libpar2-0.2-0.src.rpm     libpar2-debugsource-0.2-0.i586.rpm

We have what's needed to build par2cmdline! So let's get at it.

$ cd ../par2cmdline/
$ osc build --alternative-project openSUSE:11.3 standard i586 --keep-pkgs ../RPMS --prefer-pkgs ../RPMS

You can repeat the procedure above, building up as many packages as necessary from wherever necessary (though sticking within the same project is best if possible) just by using the --keep-pkgs and --prefer-pkgs options.

But we only needed the one extra library for this project and:

$ ls ../RPMS/
libpar2-0-0.2-0.i586.rpm            libpar2-debugsource-0.2-0.i586.rpm  par2cmdline-0.4-0.src.rpm
libpar2-0.2-0.src.rpm               libpar2-devel-0.2-0.i586.rpm        par2cmdline-debuginfo-0.4-0.i586.rpm
libpar2-0-debuginfo-0.2-0.i586.rpm  par2cmdline-0.4-0.i586.rpm          par2cmdline-debugsource-0.4-0.i586.rpm

Shows we have our package ready to go. par2cmdline doesn't require libpar2 to run, only to bui so we don't need to install that. Install par2cmdline-0.4-0.i586.rpm using any of your favorite methods (double-click, RPM, zypper, yast). It doesn't matter. Install her and she's yours to play with.

Now get building!