-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Both .deb and .rpm are copied to target/packages.
- Loading branch information
Showing
4 changed files
with
67 additions
and
31 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
# | ||
# Load fields from the `[package]` section of the `Cargo.toml` file. | ||
# | ||
# For every field, exports a `PACKAGE_<NAME>` variable. | ||
|
||
METADATA_TABLE='' | ||
|
||
cat "$(git rev-parse --show-toplevel)/Cargo.toml" | | ||
while read -r LINE | ||
do | ||
if [[ $LINE =~ ^\[(.*)\] ]] | ||
then | ||
METADATA_TABLE="${BASH_REMATCH[1]}" | ||
elif [ "$METADATA_TABLE" = package ] && | ||
[[ $LINE =~ ^([^[:space:]]*)[[:space:]]*=[[:space:]]*\"(.*)\" ]] | ||
then | ||
METADATA_VARNAME="PACKAGE_${BASH_REMATCH[1]^^}" | ||
printf 'export %s=%q\n' "$METADATA_VARNAME" "${BASH_REMATCH[2]}" | ||
fi | ||
done |
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,21 @@ | ||
#!/bin/bash | ||
# | ||
# This script generates a RPM package with the .so file built from | ||
# cargo build --release. | ||
|
||
set -euo pipefail | ||
|
||
cd "$(dirname "$0")" | ||
|
||
# shellcheck source=/dev/null | ||
source <(../common/metadata) | ||
|
||
DEST=$(mktemp -d) | ||
|
||
envsubst < timehistory.spec > "$DEST/timehistory.spec" | ||
|
||
cd "$(git rev-parse --show-toplevel)" | ||
HOME="$DEST" rpmbuild --build-in-place -bb "$DEST/timehistory.spec" | ||
|
||
mkdir -p target/packages | ||
find "$DEST/rpmbuild/RPMS" -type f -name '*.rpm' -exec cp -t target/packages {} + |
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,18 @@ | ||
Name: $PACKAGE_NAME | ||
Release: 1%{?dist} | ||
Version: $PACKAGE_VERSION | ||
Summary: $PACKAGE_DESCRIPTION | ||
License: $PACKAGE_LICENSE | ||
|
||
%description | ||
A loadable builtin that records the resources used by every executed program, | ||
and report them in a custom format string (like GNU time) or in JSON. | ||
|
||
%build | ||
cargo build --release | ||
|
||
%install | ||
install -t %{buildroot}/usr/lib/bash -s -D -o root -g root target/release/libtimehistory_bash.so | ||
|
||
%files | ||
/usr/lib/bash/libtimehistory_bash.so |