Skip to content

Commit

Permalink
Merge pull request #126 from ariel-miculas/make-install
Browse files Browse the repository at this point in the history
Support the classic installation steps (via make && make install)
  • Loading branch information
ariel-miculas authored Jun 30, 2024
2 parents 7c766f7 + fe47579 commit 6f6386c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
14 changes: 10 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
SRC=$(shell find . -name \*.rs | grep -v "^./target")

.PHONY: debug
debug:
cargo build
PREFIX?=/usr/local
ROOT_SBINDIR?=$(PREFIX)/sbin
INSTALL=install

.PHONY: release
release:
cargo build --release

.PHONY: debug
debug:
cargo build

.PHONY: check
check:
RUST_BACKTRACE=1 cargo test -- --nocapture
Expand All @@ -24,3 +27,6 @@ fmt:
.PHONY: clean
clean:
-cargo clean

install:
$(INSTALL) -m0755 -D target/release/puzzlefs -t $(ROOT_SBINDIR)
6 changes: 2 additions & 4 deletions puzzlefs-lib/src/format/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,10 +794,8 @@ impl Serialize for Digest {
impl TryFrom<&str> for Digest {
type Error = FromHexError;
fn try_from(s: &str) -> std::result::Result<Self, Self::Error> {
let digest = hex::decode(s)?;
let digest: [u8; SHA256_BLOCK_SIZE] = digest
.try_into()
.map_err(|_| FromHexError::InvalidStringLength)?;
let mut digest: [u8; SHA256_BLOCK_SIZE] = [0; SHA256_BLOCK_SIZE];
hex::decode_to_slice(s, &mut digest)?;
Ok(Digest(digest))
}
}
Expand Down

0 comments on commit 6f6386c

Please sign in to comment.