[dundee] sed

James Le Cuirot chewi at aura-online.co.uk
Wed Sep 19 22:36:34 BST 2007


Hi Nistur,

This is a common problem on Gentoo. In general, we try to get the
problem fixed upstream since it is actually standard practise to support
DESTDIR in the following manner.

make install DESTDIR=/var/tmp/portage/sys-lib/gcc-4.2.0/image

Fixing this for yourself isn't too hard though. I don't think inserting
a line is necessary but I'll tell you how to do it anyway. sed can
insert lines but it needs to have a condition for doing so, otherwise
it'll add a line before every existing line. You can't tell it to only
insert on the first line or to only insert before the first match of
something as far as I know. Here's another way to do it. There may be a
simpler way but I haven't worked it out yet!

echo 'pkgprefix=`pwd`'"\n`cat Makefile`" > Makefile

The separate '' and "" quotes are needed because you don't want the
first `` to be evaluated now but you do want the second `` to be
evaluated now. Now for sed. As I said above, I don't think you need to
insert a line because it sounds like pacman calls make while specifying
a DESTDIR anyway. So what you would do is something like this.

sed -i 's:$(PYTHONCODEDIR):$(DESTDIR)$(PYTHONCODEDIR):' Makefile

You might need to make it more specific depending on how PYTHONCODEDIR
is used elsewhere. It may just be easier to somehow override the value
of PYTHONCODEDIR instead. For more complicated situations, patches are
usually needed.

James


On Wed, 19 Sep 2007 21:48:30 +0100
Nistur <nistur at googlemail.com> wrote:

> I'm sure everyone has at some point heard me herald the beauties of
> Arch Linux and the coolest package manager in the world, pacman,
> especially when combined with ABS. Anyway, I was looking for an RSS
> ticker and the only (first maybe?) one that showed up was GNUsTicker,
> I later found it only had a 0.1 release and then died in 2005. I
> thought great, if it works (screencaps seem to say it does) then I
> can even start giving back to the community and create a PKGBUILD
> file for the Archlinux User Repository and not have to worry too much
> about maintaining it. However, the build system runs in ways that I
> didn't realise, it makes a fake install, well, instead of make
> install, it basically installs to /var/abs/local/$(pkgname)/pkg as
> the root, rather than / the Makefile for GNUsTicker however chmods a
> file in /usr/libexec/GNUsTicker Now, the bit I need help with, how on
> earth do I get it to chmod the correct file? I am assuming using sed
> (hence subject) but sed, to me at least looks like someone got angry
> with a keyboard. I (think I) want a sed script to stick a variable at
> a sensible point in a makefile and change a line lower down.
> eg.
> 
> ...
> prefix = /usr
> ...
>     chmod a+x $(PYTHONCODEDIR)/gnusapplet.py
> ...
> 
> would hopefully be changed to:
> 
> ...
> prefix = /usr
> pkgprefix=`pwd`
> ...
>     chmod a+x $(pkgprefix)$(PYTHONCODEDIR)/gnusapplet.py
> ...
> 
> Thank you to anyone who can help



More information about the dundee mailing list