On Mon, Sep 19, 2005 at 06:09:45PM -0500, Peter Samuelson wrote:
> 
> [Bas Wijnen]
> > So I wrote a script to build a Debian package from an upstream source
> > directory, generating the orig.tar.gz on the fly.  It doesn't touch
> > the current tree, so it can be used without fear of losing files on
> > new "clean" rules, for example.
> 
> > name="$(basename "$(pwd)")"
> > debversion="$(head -n 1 debian/changelog | cut -f2 -d\( | cut -f1 -d\) )"
> > version=${debversion%-*}
> 
> You should use dpkg-parsechangelog.  It's longer but more correct:
> 
>   chglog=$(dpkg-parsechangelog)
>   pkg=$(echo "$chglog" | awk '/^Source: /{print $2}')
>   debversion=$(echo "$chglog" | awk '/^Version: /{print $2}')
>   version=${debversion%-*}
>   name=$pkg-$version

You need to add another line before the final name= line:
version=$(echo $version | sed -e 's/^[0-9]\+://')

> > mkdir "$temp/$name-$version.orig"
> > tar -czf - . | tar -C "$temp/$name-$version.orig" -xzf -
> 
> I would use 'cp -la' instead, as it is faster and cheaper.  This is
> Debian, after all, so you can assume GNU coreutils.

Nice.

   Julian


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to