File: mktarball

package info (click to toggle)
libhugetlbfs 2.24-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,272 kB
  • sloc: ansic: 10,830; python: 810; makefile: 670; sh: 660; asm: 170
file content (32 lines) | stat: -rwxr-xr-x 784 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/sh
#
#
P='mktarball'

if [ "$#" -ne 1 ]; then
	echo 1>&2 "Usage: $P <commitish>"
	exit 1
fi
commit="$1"

if [ ! .git ]; then
	echo 1>&2 "$P: not in the source tree"
	exit 1
fi

# Get the official name for this commit.
name=`git describe --tags "$commit"`

# Build a version file to add to the tarball, we know it is not
# modified as we just took a commit which is unmodified by definition.
tmp="/tmp/tarball-$$"
mkdir -p "$tmp/libhugetlbfs-$name"
echo "$name" >"$tmp/libhugetlbfs-$name/version"

git archive --format=tar --prefix="libhugetlbfs-$name/" "$commit" \
						>"libhugetlbfs-$name.tar"
tar -C "$tmp" -rf "libhugetlbfs-$name.tar" "libhugetlbfs-$name/version"
gzip -9 "libhugetlbfs-$name.tar"

# Clean up the version.
[ -d "$tmp/libhugetlbfs-$name" ] && rm -rf "$tmp"