2011-12-15 12:01:16 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Author: Thomas Renninger <trenn@suse.de>
|
|
|
|
# This code is covered and distributed under
|
|
|
|
# the General Public Licence v2
|
|
|
|
|
|
|
|
function usage(){
|
2014-01-31 18:08:18 +01:00
|
|
|
echo "$(basename $0) [ git_tag [ tag_to_use ] ]"
|
2011-12-15 12:01:16 +01:00
|
|
|
echo
|
2014-01-31 18:08:18 +01:00
|
|
|
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 "tag_to_use obs does not like -rcX as a version tag. Pass a verion"
|
|
|
|
echo " tag you like to use (e.g. 3.13 instead of 3.13-rc7"
|
2011-12-15 12:01:16 +01:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
|
2014-01-31 18:08:18 +01:00
|
|
|
if [ $# -gt 0 ];then
|
2011-12-15 12:01:16 +01:00
|
|
|
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 -
|
2014-01-31 18:08:18 +01:00
|
|
|
if [ $# -eq 1 ];then
|
|
|
|
VERSION="${GIT_TAG/-/.}"
|
|
|
|
# remove leading v
|
|
|
|
VERSION="-${VERSION#v}"
|
|
|
|
elif [ $# -eq 2 ];then
|
|
|
|
VERSION="${2/-/.}"
|
|
|
|
# remove leading v
|
|
|
|
VERSION="-${VERSION#v}"
|
|
|
|
elif [ $# -gt 2 ];then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
2011-12-15 12:01:16 +01:00
|
|
|
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
|
2014-01-31 18:08:18 +01:00
|
|
|
TDIR=`mktemp -d`
|
|
|
|
pushd "$TDIR"
|
|
|
|
set -x
|
|
|
|
git archive --format=tar $GIT_TAG tools/power/x86/turbostat |tar -x
|
|
|
|
mv tools/power/x86/turbostat turbostat${VERSION}
|
|
|
|
mkdir turbostat${VERSION}/asm
|
2014-03-28 20:37:44 +01:00
|
|
|
cp "${GIT_DIR}"/../../../../../arch/x86/include/uapi/asm/msr-index.h turbostat${VERSION}/asm
|
2014-01-31 18:08:18 +01:00
|
|
|
tar -cvjf turbostat${VERSION}.tar.bz2 turbostat${VERSION}
|
|
|
|
popd
|
2011-12-15 12:01:16 +01:00
|
|
|
mv "$DIR/cpupower${VERSION}".tar.bz2 .
|
|
|
|
rm -rf "$DIR"
|
2014-01-31 18:08:18 +01:00
|
|
|
mv "$TDIR/turbostat${VERSION}".tar.bz2 .
|
|
|
|
rm -rf "$TDIR"
|
2011-12-15 12:01:16 +01:00
|
|
|
# set +x
|
2014-01-31 18:08:18 +01:00
|
|
|
echo cpupower${VERSION}.tar.bz2
|
|
|
|
echo turbostat${VERSION}.tar.bz2
|