teknoraver / rpms / systemd

Forked from rpms/systemd 2 months ago
Clone

Blame make-git-snapshot.sh

Michal Schmidt 591106
#!/bin/bash
Michal Schmidt 591106
set -e
Michal Schmidt 591106
Michal Schmidt 591106
NAME=systemd
Kay Sievers e074d0
UPSTREAM=git@github.com:systemd/systemd.git
Michal Schmidt 591106
Michal Schmidt 591106
[ -n "$1" ] && HEAD="$1" || HEAD="HEAD"
Michal Schmidt 591106
Michal Schmidt 591106
WORKDIR="$(mktemp -d --tmpdir "$NAME.XXXXXXXXXX")"
Michal Schmidt 591106
trap 'rm -rf $WORKDIR' exit
Michal Schmidt 591106
Kay Sievers e074d0
git clone "$UPSTREAM" "$WORKDIR"
Michal Schmidt 591106
Michal Schmidt 591106
pushd "$WORKDIR" > /dev/null
Michal Schmidt da70c2
git branch to-archive $HEAD
Michal Schmidt da70c2
read COMMIT_SHORTID COMMIT_TITLE <
Michal Schmidt da70c2
$(git log to-archive^..to-archive --pretty='format:%h %s')
Michal Schmidt 591106
EOGIT
Michal Schmidt 591106
popd > /dev/null
Michal Schmidt 591106
Michal Schmidt 591106
echo "Making git snapshot using commit: $COMMIT_SHORTID $COMMIT_TITLE"
Michal Schmidt 591106
Michal Schmidt 591106
DIRNAME="$NAME-git$COMMIT_SHORTID"
Michal Schmidt da70c2
git archive --remote="$WORKDIR" --format=tar --prefix="$DIRNAME/" to-archive | xz -9 > "$DIRNAME.tar.xz"
Michal Schmidt 591106
Michal Schmidt 591106
echo "Written $DIRNAME.tar.xz"