| 1 | #!/bin/sh |
| 2 | # |
| 3 | # |
| 4 | P='mktarball' |
| 5 | |
| 6 | if [ "$#" -ne 1 ]; then |
| 7 | echo 1>&2 "Usage: $P <commitish>" |
| 8 | exit 1 |
| 9 | fi |
| 10 | commit="$1" |
| 11 | |
| 12 | if [ ! .git ]; then |
| 13 | echo 1>&2 "$P: not in the source tree" |
| 14 | exit 1 |
| 15 | fi |
| 16 | |
| 17 | # Get the official name for this commit. |
| 18 | name=`git describe --tags "$commit"` |
| 19 | |
| 20 | # Build a version file to add to the tarball, we know it is not |
| 21 | # modified as we just took a commit which is unmodified by definition. |
| 22 | tmp="/tmp/tarball-$$" |
| 23 | mkdir -p "$tmp/libhugetlbfs-$name" |
| 24 | echo "$name" >"$tmp/libhugetlbfs-$name/version" |
| 25 | |
| 26 | git archive --format=tar --prefix="libhugetlbfs-$name/" "$commit" \ |
| 27 | >"libhugetlbfs-$name.tar" |
| 28 | tar -C "$tmp" -rf "libhugetlbfs-$name.tar" "libhugetlbfs-$name/version" |
| 29 | gzip -9 "libhugetlbfs-$name.tar" |
| 30 | |
| 31 | # Clean up the version. |
| 32 | [ -d "$tmp/libhugetlbfs-$name" ] && rm -rf "$tmp" |