Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .site/spi/spk-pkg-metadata.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#!/bin/bash

json_escape() {
echo -n "$1" | sed 's/\\/\\\\/g' | sed 's/"/\\"/g' | sed -z 's/\n/\\n/g' | sed -z 's/\r/\\r/g' | sed 's/\t/\\t/g'
}

declare -A metadata

# Username
metadata["user"]="${GITLAB_USER_LOGIN:-$USER}"

# Date
metadata["date"]=$(date)

# Current work directory
metadata["workdir"]=$(pwd 2>/dev/null || echo "")

# Host name
metadata["hostname"]=$(hostname 2>/dev/null || echo "")

# Git Specifics
if [ -d .git ]; then
metadata["git.repo"]=$(git ls-remote --get-url origin || echo "")
metadata["git.commit"]=$(git rev-parse HEAD 2>/dev/null || echo "")
metadata["git.branch"]=$(git branch --show-current 2>/dev/null || echo "")
fi;

# CI Specifics
if [ -n "${CI_PIPELINE_ID}" ]; then
metadata["ci_pipeline_id"]="$CI_PIPELINE_ID"
metadata["ci_pipeline_url"]="$CI_PIPELINE_URL"
metadata["ci_project_url"]="$CI_PROJECT_URL"
metadata["ci_runner_id"]="$CI_RUNNER_ID"
metadata["ci_runner_tags"]="$CI_RUNNER_TAGS"
fi;

# Build Json output
json="{"
num_elements=${#metadata[@]}
index=0
for data in "${!metadata[@]}"; do
value=$(json_escape "${metadata[${data}]}")
json+="\"$data\": \"$value\""
if [[ $((index++)) -lt $((num_elements - 1)) ]]; then
json+=", "
fi
done
json+="}"

echo "$json"
89 changes: 89 additions & 0 deletions .site/spi/spk-rl9.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
Name: spk
Version: 0.44.0
Release: 1%{?dist}
Summary: Package manager and a software runtime for studio environments
License: NONE
URL: https://gitlab.spimageworks.com/spi/dev/dev-ops/spk
Source0: https://gitlab.spimageworks.com/spi/dev/dev-ops/spk/-/archive/v%{version}/%{name}-v%{version}.tar.gz

BuildRequires: gcc
BuildRequires: git
BuildRequires: gcc-c++
BuildRequires: libcap-devel
BuildRequires: openssl-devel
BuildRequires: fuse-devel
BuildRequires: m4
BuildRequires: cmake3
BuildRequires: make
BuildRequires: flatbuffers-compiler
BuildRequires: libcurl-devel

# XXX Putting "spdev >= 0.29.16" here is getting parsed as three separate
# args to yum install, e.g., "yum install '>='", and failing. Some different
# behavior out of 'rpmspec -q --buildrequires' on rocky?
BuildRequires: spdev

Requires: bash
Requires: fuse
# kmod provides /sbin/modinfo, which spfs uses to detect supported
# overlayfs mount options. Without it spfs falls back to a conservative
# set and logs a warning on every run.
Requires: kmod
Obsoletes: spfs
Provides: spfs = 0.43.10

%define debug_package %{nil}

%description
Package manager and a software runtime for studio environments

%prep
%setup -q -n %{name}-v%{version}

%build
export SPDEV_CONFIG_FILE=.site/spi/.spdev.yaml
export CARGO_NET_GIT_FETCH_WITH_CLI=true
export CMAKE=$(command -v cmake3 || command -v cmake)
dev toolchain install
source ~/.bashrc
# Install ast-grep
cargo install --locked ast-grep
# Include `--all` to also build spk-launcher
dev env -- cargo build --release --features "server,sentry,spfs/protobuf-src,spfs-vfs/protobuf-src,statsd,fuse-backend-rhel-7-9" --all

%install
mkdir -p %{buildroot}/usr/local/bin
RELEASE_DIR=%{_builddir}/%{name}-v%{version}/target/release
for cmd in "$RELEASE_DIR"/spk-launcher "$RELEASE_DIR"/spfs "$RELEASE_DIR"/spfs-*; do
# skip debug info for commands
if [[ $cmd =~ \.d$ ]]; then continue; fi
install -p -m 755 $cmd %{buildroot}/usr/local/bin/
done
mkdir -p %{buildroot}/opt/spk.dist
cp "$RELEASE_DIR"/spk %{buildroot}/opt/spk.dist/
cp %{_builddir}/%{name}-v%{version}/.site/spi/spk-pkg-metadata.sh %{buildroot}/usr/local/bin

%files
/usr/local/bin/spfs
%caps(cap_dac_override,cap_fowner+ep) /usr/local/bin/spfs-clean
%caps(cap_net_admin+ep) /usr/local/bin/spfs-monitor
%caps(cap_chown,cap_fowner+ep) /usr/local/bin/spfs-render
%caps(cap_sys_chroot,cap_sys_admin+ep) /usr/local/bin/spfs-join
%caps(cap_setuid,cap_chown,cap_mknod,cap_sys_admin,cap_fowner+ep) /usr/local/bin/spfs-enter
%caps(cap_sys_admin+ep) /usr/local/bin/spfs-fuse
/usr/local/bin/spfs-winfsp
/usr/local/bin/spk-launcher
/usr/local/bin/spk-pkg-metadata.sh
/opt/spk.dist/

%post
mkdir -p /spfs
chmod 777 /spfs

%preun
[ -e /usr/local/bin/spk ] && unlink /usr/local/bin/spk

%posttrans
# must run at the absolute end in case we are updating
# and the uninstallation of the old version removes the symlink
ln -sf spk-launcher /usr/local/bin/spk
12 changes: 9 additions & 3 deletions .site/spi/spk.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Name: spk
Version: 0.44.0
Release: 1
Release: 1%{?dist}
Summary: Package manager and a software runtime for studio environments
License: NONE
URL: https://gitlab.spimageworks.com/spi/dev/dev-ops/spk
Expand All @@ -16,8 +16,9 @@ BuildRequires: m4
BuildRequires: cmake3
BuildRequires: make
BuildRequires: devtoolset-9
BuildRequires: libcurl-devel

BuildRequires: spdev >= 0.28.2
BuildRequires: spdev >= 0.29.18

Requires: bash
Requires: fuse
Expand All @@ -38,14 +39,16 @@ Package manager and a software runtime for studio environments

%build
export SPDEV_CONFIG_FILE=.site/spi/.spdev.yaml
export CARGO_NET_GIT_FETCH_WITH_CLI=true
export CMAKE=$(command -v cmake3 || command -v cmake)
dev toolchain install
source ~/.bashrc
# Install ast-grep
echo -e '#! /bin/bash\n\nexec cc -D_BSD_SOURCE "$@"' > cc_wrapper
chmod +x cc_wrapper
scl enable devtoolset-9 -- env CC=`pwd`/cc_wrapper cargo install --locked ast-grep
# Include `--all` to also build spk-launcher
dev env -- cargo build --release --features "sentry,spfs/protobuf-src,statsd,fuse-backend-rhel-7-6" --all
dev env -- cargo build --release --features "server,sentry,spfs/protobuf-src,spfs-vfs/protobuf-src,statsd,fuse-backend-rhel-7-6" --all

%install
mkdir -p %{buildroot}/usr/local/bin
Expand All @@ -57,6 +60,7 @@ for cmd in "$RELEASE_DIR"/spk-launcher "$RELEASE_DIR"/spfs "$RELEASE_DIR"/spfs-*
done
mkdir -p %{buildroot}/opt/spk.dist
cp "$RELEASE_DIR"/spk %{buildroot}/opt/spk.dist/
cp %{_builddir}/%{name}-v%{version}/.site/spi/spk-pkg-metadata.sh %{buildroot}/usr/local/bin

%files
/usr/local/bin/spfs
Expand All @@ -66,7 +70,9 @@ cp "$RELEASE_DIR"/spk %{buildroot}/opt/spk.dist/
%caps(cap_sys_chroot,cap_sys_admin+ep) /usr/local/bin/spfs-join
%caps(cap_dac_override,cap_setuid,cap_chown,cap_mknod,cap_sys_admin,cap_fowner+ep) /usr/local/bin/spfs-enter
%caps(cap_sys_admin+ep) /usr/local/bin/spfs-fuse
/usr/local/bin/spfs-winfsp
/usr/local/bin/spk-launcher
/usr/local/bin/spk-pkg-metadata.sh
/opt/spk.dist/

%post
Expand Down
59 changes: 8 additions & 51 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async-stream = "0.3"
async-trait = "0.1"
bracoxide = "0.1.4"
bytes = "1.11"
cached = "0.48.1"
cached = "0.54.0"
chrono = { version = "0.4.34", features = ["serde"] }
clap = { version = "4.5", features = ["derive", "env"] }
clap_complete = "4.5"
Expand Down
2 changes: 2 additions & 0 deletions crates/spfs-vfs/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
// https://github.com/spkenv/spk

#![allow(unused_assignments)]

use thiserror::Error;

/// Errors specific to fuse operations.
Expand Down
1 change: 0 additions & 1 deletion crates/spfs/src/check.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1030,7 +1030,6 @@ impl CheckBlobResult {
match self {
Self::Duplicate => CheckSummary::default(),
Self::Missing(digest) => CheckSummary {
checked_objects: 1,
missing_objects: Some(*digest).into_iter().collect(),
..Default::default()
},
Expand Down
2 changes: 1 addition & 1 deletion crates/spfs/src/check_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ async fn check_missing_annotation_blob(#[future] tmprepo: TempRepo) {

let summary: CheckSummary = results.iter().map(|r| r.summary()).sum();
tracing::info!("{summary:#?}");
assert_eq!(summary.checked_objects, 2);
assert_eq!(summary.checked_objects, 1);
assert_eq!(summary.checked_payloads, 0);
assert!(
summary.missing_objects.contains(&blob),
Expand Down
2 changes: 2 additions & 0 deletions crates/spfs/src/storage/fs/migrations/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
// https://github.com/spkenv/spk

#![allow(unused_assignments)]

pub type MigrationResult<T> = std::result::Result<T, MigrationError>;

#[derive(Debug, miette::Diagnostic, thiserror::Error)]
Expand Down
1 change: 1 addition & 0 deletions crates/spk-cli/cmd-build/src/cmd_build_test/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,7 @@ build:
.expect("Expected build of consumer to succeed");
}

#[spfstest]
#[rstest]
#[case::cli("cli")]
#[case::checks("checks")]
Expand Down
1 change: 1 addition & 0 deletions crates/spk-cli/common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ nix = { workspace = true }

[dev-dependencies]
rstest = { workspace = true }
serial_test = { workspace = true }

spfstest = { workspace = true }
2 changes: 2 additions & 0 deletions crates/spk-cli/common/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: Apache-2.0
// https://github.com/spkenv/spk

#![allow(unused_assignments)]

use colored::Colorize;
use miette::Diagnostic;
use spk_schema::foundation::format::FormatError;
Expand Down
6 changes: 4 additions & 2 deletions crates/spk-cli/common/src/flags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1321,8 +1321,10 @@ impl Repositories {
}
// The fallback default if there's no configuration for this repo.
None => {
// Enable index use on all repositories, except the 'local' repo.
let default_index_use = name != "local";
// Respect the global solver setting for unconfigured repos.
// Local repos remain non-indexed by default because they are
// usually small and often do not have an index at all.
let default_index_use = config.solver.use_indexes && name != "local";
tracing::debug!(
"Using default use index setting for '{name}' repo, which is: {} ({} index use)",
default_index_use,
Expand Down
Loading
Loading