From my PATH: package

posted on 2013-06-15

If you release software, you at one point want to create a source package. To create an archive with a projectname-version directory in it, I've created a little script you point to a source directory.

Because the script is very small, let's jump into the source:

HELP='Need arguments: <target> <version>'
...
TARGET=`basename "$1"`
VERSION=$2

DIR=${TARGET}-${VERSION}
PACK=${DIR}.tar.gz
ln -s $1 ${DIR}

We create a symlink which points the directory (basename) to a full version. This is what we will be packaging and which creates the versioned directory in the archive.

tar -czhvv --exclude='.*' --exclude="${DIR}/debian" -f "${PACK}" "${DIR}"
rm ${DIR}
echo Done to: ${PACK}

Package the archive, excluding hidden files and the debian directory (never publish packaging specifics like that in a source release).