Building RPMs as a normal user

We often told that building an RPM as root is a bad thing. While this is very true, how do you build it as a normal user?

The trick is to use rpmdev-setuptree. This will create a empty build tree in ~/rpmbuild as well as sort out you .rpmmacro file so rpmbuild knows to use it.

It’s really simple actually, so here goes.

  1. As root, install rpm-build, rpmdevtools and yum-utils.
    yum -y install rpm-build rpmdevtools yum-utils
  2. Now as a user, create a rpmbuild tree:
  3. Now as a user, download your RPM source:
    yumdownloader -source sox
  4. Again as a normal user, install the source rpm
    rpm -ivh <rpm>.src.rpm
  5. Go in to ~/rpmbuild and make whatever changes you need to. The Spec file will be in ~/rpmbuild/SPECS and the source will be gzipped in ~/rpmbuild/SOURCES
  6. Now build it!
    rpmbuild -ba ~/rpmbuild/SPECS/<spec file>
  7. Assuming everything went OK, the RPMs will be in ~/rpmbuild/RPMS/, but you’ll need to install them as root.
  8. If you find your rpmbuild is getting full of crap, you can either delete it and rebuild it, or a slightly more elegant way would be to use

Yet another Fedora 10 cock-up

Oh poor Fedora, don’t worry we still love you, even if you do keep cocking up. It’s been a hard few months for my favourite distro. First we had the security problem with the gpg key for the updates, then we had the evil dbus update which broken F10, and now we’ve got the odd day-of-the-week bug for the UK.

The bug is simple, according to the gnome clock applet our week starts on a Tuesday. Opps, but that shouldn’t be too much of a problem to change. Digging around the net, I found some references to locale files in /usr/share/i18n/locales. Although they looked correct, I tried changing them anyway. To absolutly no effect. The answer? To recompile glibc-common! Oh for fucks sake, the bug for this has been opened since Novemeber, should I really have to recompile what is a massive RPM, just for this? Why aren’t these files read at login, or better still, why can’t I used system-config-date to change my preferences.

Anyway for those of you who are interested, you can track the bug on bugzilla or Sourceware.

I’m also rebuilding the glibc-common RPM now, if it works, then I’ll post an updated version when it’s finished

Testing mail servers

Back in the good ol’ days of POP3 it was really easy to test a mail server manually you just simply telnet to port 110 issue some 3 command and done! Now that all ISPs support IMAP things are a little more complicated. Here’s my little guide to manually testing POP3, IMAP and SMTP

Read more

More mplayer fun!

This week I have been playing with youtube videos to either extract the sound from the video and converting to MP3 or converting the whole video to mpeg.

I’ve used the same kind of process to convert RealAudio streams to MP3. Firstly download the youtube video. I use the DownloadHelper addon for firefox. It’s really easy to use, you just search for your favourite video then click the button in the toolbar.

Once you’ve got your flv, you should be able to play that through totem/mplayer. If not, you’ll need install the correct gstreamer plugins. If you’re using Fedora, I’d suggest taking a look at MyGuide

OK, let’s say we want to rip the sound out of the file.. Really useful if you want a obsecure song that you can only find on youtube. It’s a two stage process, rip it as a wav then encode it to mp3.

mplayer Pork_and_Beans.flv -ao pcm:file=file.wav -vc dummy -vo null
lame -V Pork_and_Beans.mp3 file.wav --tt "Pork and Beans --ta "Weezer"
rm file.wav

That’s all there is to it!

OK next trick is to convert the flv to a Mpeg. This is slightly tricker and I haven’t had great results playing these on Windows (timing are all screwy)

mencoder Pork_and_Beans.flv -oac lavc -ovc lavc -lavcopts vcodec=msmpeg4v2:acodec=libmp3lame:abitrate=64 -o Pork_and_Beans.avi 2>/dev/null

The /dev/null is to drop the millions of warning messages you get about clipping.

WordPress style permalinks

Recently I was writing a database driven website, where all the content was within a database and the only real page was index.php.

This is easy enough to do, but of course, you need to tell index.php which page you want so you end up with URL like or Not the most user or SEO friendly. What I really wanted was URL that looked like this: or

Read more

Return top