[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

> 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.

> mkdir "$dir/$name-$version"
> tar -czf - . | tar -C "$dir/$name-$version" -xzf -

And there.

Attachment: signature.asc
Description: Digital signature

Reply via email to