-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move RPM and DEB targets to separate scripts
- Loading branch information
Showing
3 changed files
with
86 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
if [ -z ${FROM_MAKEFILE+1} ]; then | ||
echo "$0 is not intended to be run manually. Please run 'make RPM' instead." | ||
exit 1 | ||
fi | ||
|
||
BASEDIR=${PWD} | ||
WORKSPACE=${PWD}/.dpkgbuild | ||
DEBIANDIR=${WORKSPACE}/debian | ||
DEBIANBINDIR=${WORKSPACE}/DEBIAN | ||
mkdir --parents --verbose ${WORKSPACE} ${DEBIANBINDIR} | ||
make PREFIX=${WORKSPACE} INSTALLED_PREFIX=${PREFIX} | ||
#mkdir --parents --verbose ${DEBIANDIR} | ||
CONTROLFILE="${BASEDIR}/packaging/deb/likwid.deb.control" | ||
COMMITISH="HEAD" | ||
VERS=$(git describe --tags --abbrev=0 ${COMMITISH}) | ||
VERS=${VERS#v} | ||
VERS=$(echo ${VERS} | sed -e s/-/_/g) | ||
ARCH=$(uname -m) | ||
ARCH=$(echo ${ARCH} | sed -e s/-/_/g) | ||
if [ "${ARCH}" = "x86-64" ]; then | ||
ARCH=amd64 | ||
fi | ||
if [ "${VERS}" = "" ]; then | ||
VERS="$(VERSION).$(RELEASE).$(MINOR)" | ||
fi | ||
PREFIX="${NAME}-${VERSION}_${ARCH}" | ||
SIZE_BYTES=$(du -bcs --exclude=.dpkgbuild "$WORKSPACE"/ | awk '{print $1}' | head -1 | sed -e 's#^0\+##') | ||
SIZE="$(awk -v size="${SIZE_BYTES}" 'BEGIN {print (size/1024)+1}' | awk '{print int($0)}')" | ||
#sed -e s#"{VERSION}"#"$VERS"#g -e s#"{INSTALLED_SIZE}"#"$SIZE"#g -e s#"{ARCH}"#"$ARCH"#g ${CONTROLFILE} > ${DEBIANDIR}/control | ||
sed -e s#"{VERSION}"#"${VERS}"#g -e s#"{INSTALLED_SIZE}"#"${SIZE}"#g -e s#"{ARCH}"#"${ARCH}"#g ${CONTROLFILE} > ${DEBIANBINDIR}/control | ||
sudo make PREFIX=${WORKSPACE} INSTALLED_PREFIX=${PREFIX} install | ||
DEB_FILE="likwid_${VERS}_${ARCH}.deb" | ||
dpkg-deb -b ${WORKSPACE} "${DEB_FILE}" | ||
sudo rm -r "${WORKSPACE}" | ||
if [ "${GITHUB_ACTIONS}" = "true" ]; then | ||
echo "::set-output name=DEB::${DEB_FILE}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/bin/sh | ||
|
||
set -eu | ||
|
||
if [ -z ${FROM_MAKEFILE+1} ]; then | ||
echo "$0 is not intended to be run manually. Please run 'make RPM' instead." | ||
exit 1 | ||
fi | ||
|
||
# pwd matters, so only call from Makefile directory | ||
SPECFILE="packaging/rpm/likwid.spec" | ||
# Setup RPM build tree | ||
eval $(rpm --eval "ARCH='%{_arch}' RPMDIR='%{_rpmdir}' SOURCEDIR='%{_sourcedir}' SPECDIR='%{_specdir}' SRPMDIR='%{_srcrpmdir}' BUILDDIR='%{_builddir}'") | ||
mkdir --parents --verbose "${RPMDIR}" "${SOURCEDIR}" "${SPECDIR}" "${SRPMDIR}" "${BUILDDIR}" | ||
# Create source tarball | ||
COMMITISH="HEAD" | ||
VERS=$(git describe --tags --abbrev=0 ${COMMITISH}) | ||
VERS=${VERS#v} | ||
VERS=$(echo ${VERS} | sed -e s/-/_/g) | ||
if [ "${VERS}" = "" ]; then | ||
VERS="$(VERSION).$(RELEASE).$(MINOR)" | ||
fi | ||
eval $(rpmspec --query --queryformat "NAME='%{name}' VERSION='%{version}' RELEASE='%{release}' NVR='%{NVR}' NVRA='%{NVRA}'" --define="VERS ${VERS}" "${SPECFILE}") | ||
PREFIX="${NAME}-${VERSION}" | ||
FORMAT="tar.gz" | ||
SRCFILE="${SOURCEDIR}/${PREFIX}.${FORMAT}" | ||
git archive --verbose --format "${FORMAT}" --prefix="${PREFIX}/" --output="${SRCFILE}" ${COMMITISH} | ||
# Build RPM and SRPM | ||
rpmbuild -ba --define="VERS ${VERS}" --rmsource --clean "${SPECFILE}" | ||
# Report RPMs and SRPMs when in GitHub Workflow | ||
if [[ "${GITHUB_ACTIONS}" == true ]]; then | ||
RPMFILE="${RPMDIR}/${ARCH}/${NVRA}.rpm" | ||
SRPMFILE="${SRPMDIR}/${NVR}.src.rpm" | ||
echo "RPM: ${RPMFILE}" | ||
echo "SRPM: ${SRPMFILE}" | ||
echo "::set-output name=SRPM::${SRPMFILE}" | ||
echo "::set-output name=RPM::${RPMFILE}" | ||
fi |