cpupower/cpupower_export_tarball_from_git.sh
Thomas Renninger a7c50bbe28 - Update to 3.2-rc5 version (not much changed, includes the
use-manpage-on-help patch -> removed it)
- Change licence from GPL-2.0+ to GPL-2.0 to fit the kernel
  licence where sources are coming from
- Provide a tiny script to quickly export and tar sources from
  the git repo

OBS-URL: https://build.opensuse.org/package/show/hardware/cpupower?expand=0&rev=9
2011-12-15 11:01:16 +00:00

49 lines
1.4 KiB
Bash

#!/bin/bash
# Author: Thomas Renninger <trenn@suse.de>
# This code is covered and distributed under
# the General Public Licence v2
function usage(){
echo "$(basename $0) [ git_tag ]"
echo
echo "git_tag must be a valid kernel git tag, for example v3.1"
echo " if git_tag is not passed HEAD will be used which"
echo " may produce a package incompatible tarball name"
echo " BEST ALWAYS PASS AN EXISTING TAG"
echo " cpupower got introduced in 3.1-rc1"
echo
echo "export GIT_DIR= environment variable if the git repo is not the current directory"
echo "For example: GIT_DIR=/path_to_git_repo/.git"
}
if [ $# -eq 1 ];then
if [ "$1" = "-h" ] || [ "$1" == "--help" ];then
usage
exit 0
fi
GIT_TAG="$1"
echo "Exporting cpupower from kernel version $GIT_TAG"
# convert - to . as package versions do not allow -
VERSION="${GIT_TAG/-/.}"
# remove leading v
VERSION="-${VERSION#v}"
else
GIT_TAG="HEAD"
VERSION=""
fi
# Tried to do this with one git archive command, but
# --remote= param seem not to be configured for kernel.org gits
# set -x
DIR=`mktemp -d`
pushd "$DIR"
git archive --format=tar $GIT_TAG tools/power/cpupower |tar -x
mv tools/power/cpupower cpupower${VERSION}
tar -cvjf cpupower${VERSION}.tar.bz2 cpupower${VERSION}
popd
mv "$DIR/cpupower${VERSION}".tar.bz2 .
rm -rf "$DIR"
# set +x
echo cpupower${VERSION}.tar.bz2