From 75ae3ec8fe927285d2220acb87a2fa087b9d5f47 Mon Sep 17 00:00:00 2001 From: Jon Medhurst Date: Thu, 17 May 2012 11:55:16 +0100 Subject: gator: ubuntu: Add DKMS package Signed-off-by: Jon Medhurst --- tools/gator/debian/changelog | 6 +++ tools/gator/debian/control | 10 +++++ tools/gator/debian/dkms.conf.in | 7 ++++ tools/gator/debian/gator-module-dkms.install.in | 2 + tools/gator/debian/gator-module-dkms.postinst | 49 +++++++++++++++++++++++++ tools/gator/debian/gator-module-dkms.prerm | 29 +++++++++++++++ tools/gator/debian/rules | 2 +- tools/gator/debian/scripts/do-packaging | 24 ++++++++++-- 8 files changed, 124 insertions(+), 5 deletions(-) create mode 100644 tools/gator/debian/dkms.conf.in create mode 100755 tools/gator/debian/gator-module-dkms.install.in create mode 100755 tools/gator/debian/gator-module-dkms.postinst create mode 100755 tools/gator/debian/gator-module-dkms.prerm diff --git a/tools/gator/debian/changelog b/tools/gator/debian/changelog index dd0b63c549f..d37fcf9b698 100644 --- a/tools/gator/debian/changelog +++ b/tools/gator/debian/changelog @@ -1,3 +1,9 @@ +gator (5.10.1) precise; urgency=low + + * Add gator-module-dkms package. + + -- Jon Medhurst (Tixy) Mon, 21 May 2012 15:59:10 +0000 + gator (5.10.0) precise; urgency=low * New release from ARM. diff --git a/tools/gator/debian/control b/tools/gator/debian/control index b6defbc6d02..f20a736e5e7 100644 --- a/tools/gator/debian/control +++ b/tools/gator/debian/control @@ -26,3 +26,13 @@ Depends: ${misc:Depends}, gdbserver (>= 6.8), openssh-server | ssh-server, gator Description: ARM DS-5 target dependencies This meta-package depends on all components required to receive full ARM DS-5 experience. + +Package: gator-module-dkms +Architecture: armhf +Section: kernel +Depends: ${misc:Depends}, dkms (>= 1.95), make +Description: ARM Streamline gator module - dkms version + The target-side kernel module gathering data for ARM Streamline + Performance Analyzer. + . + This package contains the source to be built with dkms. diff --git a/tools/gator/debian/dkms.conf.in b/tools/gator/debian/dkms.conf.in new file mode 100644 index 00000000000..5cb51e58a5e --- /dev/null +++ b/tools/gator/debian/dkms.conf.in @@ -0,0 +1,7 @@ +PACKAGE_NAME="gator-module" +PACKAGE_VERSION="__VERSION__" +MAKE[0]="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build" +CLEAN="make -C ${kernel_source_dir} M=${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build clean" +BUILT_MODULE_NAME[0]="gator" +DEST_MODULE_LOCATION[0]="/extra" +AUTOINSTALL=yes diff --git a/tools/gator/debian/gator-module-dkms.install.in b/tools/gator/debian/gator-module-dkms.install.in new file mode 100755 index 00000000000..4691ff78575 --- /dev/null +++ b/tools/gator/debian/gator-module-dkms.install.in @@ -0,0 +1,2 @@ +module/* /usr/src/gator-module-__VERSION__/ +debian/dkms.conf /usr/src/gator-module-__VERSION__/ \ No newline at end of file diff --git a/tools/gator/debian/gator-module-dkms.postinst b/tools/gator/debian/gator-module-dkms.postinst new file mode 100755 index 00000000000..b3de65e5b06 --- /dev/null +++ b/tools/gator/debian/gator-module-dkms.postinst @@ -0,0 +1,49 @@ +#!/bin/sh +# Copyright (C) 2002-2005 Flavio Stanchina +# Copyright (C) 2005-2006 Aric Cyr +# Copyright (C) 2007 Mario Limonciello +# Copyright (C) 2009 Alberto Milone +# Copyright (C) 2010 Ricardo Salveti de Araujo + +set -e + +NAME=gator-module +PACKAGE_NAME=$NAME-dkms +CVERSION=`dpkg-query -W -f='${Version}' $PACKAGE_NAME | awk -F "-" '{print $1}' | cut -d\: -f2` +ARCH=`dpkg --print-architecture` + +dkms_configure () { + for POSTINST in /usr/lib/dkms/common.postinst "/usr/share/$PACKAGE_NAME/postinst"; do + if [ -f "$POSTINST" ]; then + "$POSTINST" "$NAME" "$CVERSION" "/usr/share/$PACKAGE_NAME" "$ARCH" "$2" + return $? + fi + echo "WARNING: $POSTINST does not exist." >&2 + done + echo "ERROR: DKMS version is too old and $PACKAGE_NAME was not" >&2 + echo "built with legacy DKMS support." >&2 + echo "You must either rebuild $PACKAGE_NAME with legacy postinst" >&2 + echo "support or upgrade DKMS to a more current version." >&2 + return 1 +} + +case "$1" in + configure) + dkms_configure + ;; + + abort-upgrade|abort-remove|abort-deconfigure) + ;; + + *) + echo "postinst called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +# dh_installdeb will replace this with shell code automatically +# generated by other debhelper scripts. + +#DEBHELPER# + +exit 0 diff --git a/tools/gator/debian/gator-module-dkms.prerm b/tools/gator/debian/gator-module-dkms.prerm new file mode 100755 index 00000000000..cf0b5f99da7 --- /dev/null +++ b/tools/gator/debian/gator-module-dkms.prerm @@ -0,0 +1,29 @@ +#!/bin/sh + +NAME=gator-module +PACKAGE_NAME=$NAME-dkms +VERSION=`dpkg-query -W -f='${Version}' $PACKAGE_NAME | awk -F "-" '{print $1}' | cut -d\: -f2` + +set -e + +case "$1" in + remove|upgrade|deconfigure) + if [ "`dkms status -m $NAME`" ]; then + dkms remove -m $NAME -v $VERSION --all + fi + ;; + + failed-upgrade) + ;; + + *) + echo "prerm called with unknown argument \`$1'" >&2 + exit 1 + ;; +esac + +#DEBHELPER# + +exit 0 + + diff --git a/tools/gator/debian/rules b/tools/gator/debian/rules index c747748ff83..4022894f0e5 100755 --- a/tools/gator/debian/rules +++ b/tools/gator/debian/rules @@ -12,4 +12,4 @@ export CROSS_COMPILE export DH_OPTIONS %: - dh $@ + dh $@ --with dkms diff --git a/tools/gator/debian/scripts/do-packaging b/tools/gator/debian/scripts/do-packaging index 9562f2a685b..5eaa338eb97 100755 --- a/tools/gator/debian/scripts/do-packaging +++ b/tools/gator/debian/scripts/do-packaging @@ -16,6 +16,11 @@ do OPT_SIGN=y continue fi + if [ "$OPT" == "--no-git-clean" ] + then + OPT_NO_GIT_CLEAN=y + continue + fi echo $0: Unknown option: "$OPT" 1>&2 exit 1 done @@ -25,9 +30,17 @@ done # Clean working dirctory # -git reset --hard HEAD -git clean -dfx .. +if [ ! $OPT_NO_GIT_CLEAN ] +then + git reset --hard HEAD + git clean -dfx .. +fi +git checkout debian/changelog +if [ ! -d module ] +then + ln -s ../../drivers/gator module +fi # # Update changelog @@ -59,7 +72,10 @@ sed -i -e "s%CHANGE_MSG%$CHANGE_MSG%" debian/changelog echo $CHANGE_MSG -VERSION="$(sed -n '1s/.*(\(.*\)).*/\1/p' debian/changelog)" +FULL_VERSION="$(sed -n '1s/.*(\(.*\)).*/\1/p' debian/changelog)" +VERSION="$(echo $FULL_VERSION | sed 's/\([0-9.]*\).*/\1/')" +sed "s/__VERSION__/$VERSION/g" debian/dkms.conf.in > debian/dkms.conf +sed "s/__VERSION__/$VERSION/g" debian/gator-module-dkms.install.in > debian/gator-module-dkms.install # @@ -69,7 +85,7 @@ VERSION="$(sed -n '1s/.*(\(.*\)).*/\1/p' debian/changelog)" if [ $OPT_COMMIT ] then git add debian/changelog - git commit -s -m "gator-$VERSION: Automated packaging" + git commit -s -m "gator-$FULL_VERSION: Automated packaging" fi -- cgit v1.2.3