Skip to content

Commit a2d7a40

Browse files
authored
Merge pull request #10 from sy-c/master
improved script, with command line parameter to set variables. v2.1.5
2 parents 8a12237 + 1d8418b commit a2d7a40

File tree

1 file changed

+37
-5
lines changed

1 file changed

+37
-5
lines changed

patches/linux_uio/make-pda-kadapter-dkms-rpm.sh

Lines changed: 37 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
GIT_REPO=https://github.com/cbm-fles/pda
1010
GIT_TAG=11.9.7
1111
# This is the branch name to take from, if not using the tag. Leave blank to use tag.
12-
GIT_BRANCH=bug_sched_atomic
12+
GIT_BRANCH=master
1313

1414
# This is the base name and version for this dkms package
1515
PKG_NAME=pda-kadapter-dkms
16-
PKG_VERSION=2.1.4
16+
PKG_VERSION=2.1.5
1717

1818
# local build directory
1919
TMPDIR=/tmp/rpm
@@ -25,6 +25,33 @@ CURDIR=`pwd`
2525
# (eg to test a local version not available in upstream repo)
2626
USE_LOCAL_SOURCES=0
2727

28+
PKG_DESCRIPTION=""
29+
PKG_RELEASE=0
30+
31+
32+
while getopts 'lr:n:h' opt; do
33+
case "$opt" in
34+
l)
35+
USE_LOCAL_SOURCES=1
36+
PKG_DESCRIPTION="${PKG_DESCRIPTION}Using locally patched sources. "
37+
;;
38+
r)
39+
PKG_RELEASE="$OPTARG"
40+
;;
41+
n)
42+
PKG_DESCRIPTION="${PKG_DESCRIPTION}${OPTARG} "
43+
;;
44+
?|h)
45+
echo "Usage: $(basename $0) [-r release_number] [-n release_notes] [-l]"
46+
echo " -r : sets the RPM release numner."
47+
echo " -n : sets the RPM release notes (in the RPM description field)."
48+
echo " -l : uses locally patches sources instead of upstream branch/tag."
49+
exit 1
50+
;;
51+
esac
52+
done
53+
shift "$(($OPTIND -1))"
54+
2855
# Prerequisites:
2956
# yum install -y git rpm-build
3057

@@ -55,8 +82,10 @@ cd pda
5582
git fetch
5683
if [ "$GIT_BRANCH" != "" ]; then
5784
git checkout -b ${GIT_BRANCH} origin/${GIT_BRANCH}
85+
PKG_DESCRIPTION = "${PKG_DESCRIPTION} Using ${GIT_REPO} branch ${GIT_BRANCH}."
5886
else
5987
git checkout tags/${GIT_TAG}
88+
PKG_DESCRIPTION = "${PKG_DESCRIPTION} Using ${GIT_REPO} tag ${GIT_TAG}."
6089
fi
6190
cd patches/linux_uio
6291

@@ -97,12 +126,12 @@ rm -f ${TMPDIR}/SPECS/${SPECFILE}
97126
echo "%define version ${VERSION}" >> ${TMPDIR}/SPECS/${SPECFILE}
98127
echo "%define module ${PKG_NAME}" >> ${TMPDIR}/SPECS/${SPECFILE}
99128
echo "URL: ${GIT_REPO}" >> ${TMPDIR}/SPECS/${SPECFILE}
129+
echo "Release: ${PKG_RELEASE}" >> ${TMPDIR}/SPECS/${SPECFILE}
100130

101131
echo '
102132
Summary: PDA kernel adapter DKMS package
103133
Name: %{module}
104134
Version: %{version}
105-
Release: 0
106135
License: BSD
107136
Packager: Sylvain Chapeland <[email protected]>
108137
Group: System Environment/Kernel
@@ -117,11 +146,14 @@ This package contains the PDA kernel adapter wrapped for the DKMS framework.'\
117146
>> ${TMPDIR}/SPECS/${SPECFILE}
118147

119148
if [ "$GIT_BRANCH" != "" ]; then
120-
echo "Built from repository ${GIT_REPO} branch ${GIT_BRANCH}" >> ${TMPDIR}/SPECS/${SPECFILE}
149+
echo "Built from repository ${GIT_REPO} branch ${GIT_BRANCH}." >> ${TMPDIR}/SPECS/${SPECFILE}
121150
else
122-
echo "Built from repository ${GIT_REPO} tag ${GIT_TAG}" >> ${TMPDIR}/SPECS/${SPECFILE}
151+
echo "Built from repository ${GIT_REPO} tag ${GIT_TAG}." >> ${TMPDIR}/SPECS/${SPECFILE}
123152
fi
124153

154+
echo "${PKG_DESCRIPTION}" >> ${TMPDIR}/SPECS/${SPECFILE}
155+
156+
125157
echo '
126158
%prep
127159
%setup

0 commit comments

Comments
 (0)