source: trunk/debathena/scripts/daorig @ 22786

Revision 22786, 1.3 KB checked in by ghudson, 17 years ago (diff)
Factor out the creation of the orig tarball into a separate script. * debathena/scripts/daorig: New script to create orig tarball. * debathena/scripts/dasource: Use daorig.
  • Property svn:executable set to *
Line 
1#!/bin/sh
2
3# Usage: daorig
4
5# Fake up an "original" source tarball for a Debathena package.  Run
6# this from the top level of a checkout or copy of the sources for a
7# Debathena package; the orig tarball will be created in the parent
8# directory if necessary.
9
10# If the package has no Debian version component, this script will do
11# nothing.  If an orig file already exists, this script will also do
12# nothing.
13
14set -e
15
16: ${DEBATHENA_APT=/mit/debathena/apt}
17
18# Extract the changelog version and strip off the epoch and Debian component.
19pkgname=$(dpkg-parsechangelog | sed -n 's/Source: //p')
20changever=$(dpkg-parsechangelog | sed -n 's/Version: //p')
21sver=$(echo "$changever" | sed -re 's/^[0-9]+://p')
22upver=$(echo "$sver" | sed -re 's/-[^-]*$//')
23
24# If the version has no Debian component, do nothing.
25if [ "x$sver" = "x$upver" ]; then exit; fi
26
27# If an orig file already exists, do nothing.
28tarfile=${pkgname}_$upver.orig.tar.gz
29if [ -e "../$tarfile" ]; then exit; fi
30
31aptorig=$(find ${DEBATHENA_APT}*/pool -name $tarfile | head -1)
32if [ -n "$aptorig" ]; then
33  echo "Copying existing $aptorig to original source"
34  cp "$aptorig" "../$tarfile"
35else
36  echo "Creating original source archive"
37  dirname=$(basename $(pwd))
38  (cd .. && tar --exclude=.svn --exclude=debian -czf "$tarfile" "$dirname")
39fi
Note: See TracBrowser for help on using the repository browser.