File: build-rpm

package info (click to toggle)
rshim-user-space 2.2.2%2Bdebian-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 504 kB
  • sloc: ansic: 7,730; sh: 622; perl: 62; makefile: 43
file content (54 lines) | stat: -rwxr-xr-x 1,343 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh -e
#
# Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
#
#
# Build rpm package for rshim driver for x86_64 and aarch64.
# The script generates source rpm, then builds x86_64 or aarch64 rpm depending
# on the CPU platform it's running on.
#
# Must run from the root of the rshim source tree.
#
# Usage:
#   ./script/build-rpm
#

topdir=$(pwd)/rpmbuild
[ -d $topdir ] && rm -rf $topdir
mkdir -p $topdir/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}

# Generate rshim.spec
./bootstrap.sh
./configure
make
cp rshim.spec $topdir/SPECS/

# Generate source tarball
rm -f *.tar.gz
ver_tag=$(grep "^Version:" rshim.spec | cut -d' ' -f2)
tarball="rshim-${ver_tag}.tar.gz"
git archive --prefix="rshim-${ver_tag}/" --format=tar.gz -o "$tarball" HEAD
mv $tarball $topdir/SOURCES/

#
# Generate source RPM
#
rpmbuild --define "_topdir ${topdir}" -bs $topdir/SPECS/rshim.spec
src_rpm=$(echo $topdir/SRPMS/rshim-*.src.rpm)
if [ ! -e "${src_rpm}" ]; then
  echo "${src_rpm} not found"
  exit 1
fi

#
# Build rshim RPM
#
rpmbuild --define "_topdir ${topdir}" --rebuild ${src_rpm}
version="$(./scripts/get-ver)"
arch=$(uname -m)
arch_rpm=$(echo ${topdir}/RPMS/${arch}/rshim*.rpm)
if [ -f "$arch_rpm" ]; then
  rpm_file=rshim-${version}_${arch}.rpm
  mv $arch_rpm ${topdir}/RPMS/${arch}/$rpm_file
  echo "${arch} RPM: $rpm_file"
fi