Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mpsd/deb packages #246

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,11 @@
# Editor files
*~
*.swp

# Debian packages
packages/*.deb
packages/*.debian.tar.xz
packages/*.dsc
packages/*.orig.tar.gz
packages/*.changes
packages/*.buildinfo
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,12 @@ clean:
$(MAKE) clean
cd src/gdrdrv && \
$(MAKE) clean
rm -f packages/*.deb
rm -f packages/*.debian.tar.xz
rm -f packages/*.dsc
rm -f packages/*.orig.tar.gz
rm -f packages/*.changes
rm -f packages/*.buildinfo

.PHONY: driver clean all lib exes lib_install drv_install exes_install install

36 changes: 28 additions & 8 deletions packages/build-deb-packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
# Restart this number at 1 if MAJOR_VERSION or MINOR_VERSION changes
# See https://www.debian.org/doc/debian-policy/ch-controlfields.html#version
DEBIAN_VERSION=1
DEBIAN_RELEASE=unstable

SCRIPT_DIR_PATH="$(cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")" && pwd)"
TOP_DIR_PATH="${SCRIPT_DIR_PATH}/.."
Expand All @@ -32,6 +33,9 @@ CWD=$(pwd)
skip_dep_check=0
build_test_package=1
build_driver_package=1
keep_deb_filenames=0

git_commit_date=""

ex()
{
Expand All @@ -48,19 +52,22 @@ ex()

function show_help
{
echo "Usage: [CUDA=<path>] $0 [-d] [-t] [-k] [-h]"
echo "Usage: [CUDA=<path>] $0 [-d] [-t] [-k] [-O] [-g] [-R <release>] [-h]"
echo ""
echo " CUDA=<path> Set your installed CUDA path (ex. /usr/local/cuda)."
echo " -d Don't check build dependencies. Use my environment variables such as C_INCLUDE_PATH instead."
echo " -t Skip building gdrcopy-tests package."
echo " -k Skip building gdrdrv-dkms package."
echo " -O Keep original package filenames."
echo " -g Include date of latest git commit in version number."
echo " -R <release> Set debian release in changelog, dsc and changes files. (Default: unstable)"
echo " -h Show this help text."
echo ""
}

OPTIND=1 # Reset in case getopts has been used previously in the shell.

while getopts "hdtk" opt; do
while getopts "hdtkOgR:" opt; do
case "${opt}" in
h)
show_help
Expand All @@ -72,6 +79,12 @@ while getopts "hdtk" opt; do
;;
k) build_driver_package=0
;;
O) keep_deb_filenames=1
;;
g) git_commit_date=$(git show -s --format='%cd' --date='format:%Y%m%d%H%M%S' 2>/dev/null)
;;
R) DEBIAN_RELEASE=$OPTARG
;;
esac
done

Expand All @@ -96,7 +109,7 @@ MODULE_SUBDIR=$(awk '/MODULE_SUBDIR \?=/ { print $3 }' ${TOP_DIR_PATH}/src/gdrdr

MAJOR_VERSION=$(awk '/#define GDR_API_MAJOR_VERSION/ { print $3 }' ${TOP_DIR_PATH}/include/gdrapi.h | tr -d '\n')
MINOR_VERSION=$(awk '/#define GDR_API_MINOR_VERSION/ { print $3 }' ${TOP_DIR_PATH}/include/gdrapi.h | tr -d '\n')
VERSION="${MAJOR_VERSION}.${MINOR_VERSION}"
VERSION="${MAJOR_VERSION}.${MINOR_VERSION}${git_commit_date:++git$git_commit_date}"
if [ "X$VERSION" == "X" ]; then
echo "Failed to get version numbers!" >&2
exit 1
Expand Down Expand Up @@ -128,6 +141,7 @@ ex cp README.md ${tmpdir}/gdrcopy/debian-tests/README.source
ex cd ${tmpdir}/gdrcopy
ex find . -type f -exec sed -i "s/@FULL_VERSION@/${FULL_VERSION}/g" {} +
ex find . -type f -exec sed -i "s/@VERSION@/${VERSION}/g" {} +
ex find . -type f -exec sed -i "s/@DEBIAN_RELEASE@/${DEBIAN_RELEASE}/g" {} +

ex rm -f ${tmpdir}/libgdrapi_${VERSION}.orig.tar.gz
ex rm -f ${tmpdir}/gdrcopy-tests_${VERSION}.orig.tar.gz
Expand Down Expand Up @@ -189,6 +203,7 @@ if [[ ${build_driver_package} == 1 ]]; then
ex find . -type f -exec sed -i "s/@FULL_VERSION@/${FULL_VERSION}/g" {} +
ex find . -type f -exec sed -i "s/@VERSION@/${VERSION}/g" {} +
ex find . -type f -exec sed -i "s/@MODULE_LOCATION@/${MODULE_SUBDIR//\//\\/}/g" {} +
ex find . -type f -exec sed -i "s/@DEBIAN_RELEASE@/${DEBIAN_RELEASE}/g" {} +

ex cd ${tmpdir}
ex tar czvf gdrdrv-dkms_${VERSION}.orig.tar.gz gdrdrv-dkms-${VERSION}
Expand All @@ -209,6 +224,7 @@ ex cd ${metadir}
ex find . -type f -exec sed -i "s/@FULL_VERSION@/${FULL_VERSION}/g" {} +
ex find . -type f -exec sed -i "s/@VERSION@/${VERSION}/g" {} +
ex find . -type f -exec sed -i "s/@MODULE_LOCATION@/${MODULE_SUBDIR//\//\\/}/g" {} +
ex find . -type f -exec sed -i "s/@DEBIAN_RELEASE@/${DEBIAN_RELEASE}/g" {} +
ex cd ${tmpdir}
ex tar czvf gdrcopy_${VERSION}.orig.tar.gz gdrcopy-${VERSION}
cd ${metadir}
Expand All @@ -228,16 +244,20 @@ ex cd ${CWD}

for item in `ls ${tmpdir}/*.deb`; do
item_name=`basename $item`
item_name=`echo $item_name | sed -e "s/\.deb//g"`
if echo "$item_name" | grep -q "tests"; then
item_name="${item_name}${release}+cuda${CUDA_MAJOR}.${CUDA_MINOR}.deb"
else
item_name="${item_name}${release}.deb"
if [ $keep_deb_filenames = 0 ] ; then
item_name=`echo $item_name | sed -e "s/\.deb//g"`
if echo "$item_name" | grep -q "tests"; then
item_name="${item_name}${release}+cuda${CUDA_MAJOR}.${CUDA_MINOR}.deb"
else
item_name="${item_name}${release}.deb"
fi
fi
ex cp $item ./${item_name}
done
ex cp ${tmpdir}/*.tar.* .
ex cp ${tmpdir}/*.dsc .
ex cp ${tmpdir}/*.changes .
ex cp ${tmpdir}/*.buildinfo .

echo
echo "Cleaning up ..."
Expand Down
2 changes: 1 addition & 1 deletion packages/debian-lib/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
libgdrapi (@FULL_VERSION@) stable; urgency=low
libgdrapi (@FULL_VERSION@) @DEBIAN_RELEASE@; urgency=low

* Initial version of libgdrapi package -- was a part of gdrcopy package.

Expand Down
2 changes: 1 addition & 1 deletion packages/debian-meta/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gdrcopy (@FULL_VERSION@) stable; urgency=low
gdrcopy (@FULL_VERSION@) @DEBIAN_RELEASE@; urgency=low

* Convert to meta package.
* Declare dependency with gdrdrv-dkms, libgdrapi, and gdrcopy-tests.
Expand Down
2 changes: 1 addition & 1 deletion packages/debian-tests/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gdrcopy-tests (@FULL_VERSION@) stable; urgency=low
gdrcopy-tests (@FULL_VERSION@) @DEBIAN_RELEASE@; urgency=low

* Initial version of gdrcopy-tests package -- was a part of gdrcopy package.
* Add apiperf test.
Expand Down
2 changes: 1 addition & 1 deletion packages/dkms/debian/changelog
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gdrdrv-dkms (@FULL_VERSION@) unstable; urgency=low
gdrdrv-dkms (@FULL_VERSION@) @DEBIAN_RELEASE@; urgency=low

* Change the package maintainer to GPUDirect Team.
* Add Davide Rossetti and Pak Makthub as Uploaders.
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ lib: $(LIB)
$(LIBOBJS): CFLAGS+=-fPIC
$(LIB): $(LIBOBJS)
$(CC) -shared -Wl,-soname,$(LIB_SONAME) -o $@ $^
ldconfig -n $(PWD)
# ldconfig -n $(PWD)
ln -sf $(LIB_DYNAMIC) $(LIB_SONAME)
ln -sf $(LIB_SONAME) $(LIB_BASENAME)

Expand Down