And also make it newline-separated with space separated key-value.
To be compatible with newest meta4ra utilities and BASS project.
Exported txtar contains trailing ".csum" pseudo file with one or
multiple hashes of the digested data.
Exported txtar contains trailing ".csum" pseudo file with one or
multiple hashes of the digested data.
-DSC_HASHES environment variables specified what hashes must be included
-and invoked. For example "blake2b-512:b2sum,skein-512:skein512" value
-means, that BLAKE2b-512 is calculated by calling "b2sum" utility, and
-Skein-512 by "skein512".
+DSC_HASHERS environment variables specified what hashers must be
+included and invoked. For example "blake2b-512 b2sum\nskein-512 skein512"
+value means, that BLAKE2b-512 is calculated by calling "b2sum" utility,
+and Skein-512 by "skein512".
"dsc csum" command can be used to calculate hashes over the arbitrary
data. "dsc import-check" can be used to verify piped in configuration
"dsc csum" command can be used to calculate hashes over the arbitrary
data. "dsc import-check" can be used to verify piped in configuration
$DSC_SCHEMA -- path to the schema definition
$DSC_STASH -- path to stashed/unsaved state
$DSC_SAVED -- path to committed/saved state
$DSC_SCHEMA -- path to the schema definition
$DSC_STASH -- path to stashed/unsaved state
$DSC_SAVED -- path to committed/saved state
- $DSC_HASHES -- sha2-512:sha512 by default
- Comma-separated list of hash-name:cmd pairs
+ $DSC_HASHERS -- "sha2-512 sha512" by default.
+ Newline-separated list of "hash-name cmd" pairs
There are two kinds of options:
* array/list ones, which are identified with /*/ in "list"'s
There are two kinds of options:
* array/list ones, which are identified with /*/ in "list"'s
if {[info exists env(DSC_SCHEMA)]} {set Schema $env(DSC_SCHEMA)} {set Schema schema}
if {[info exists env(DSC_STASH)]} {set Stash $env(DSC_STASH)} {set Stash stash}
if {[info exists env(DSC_SAVED)]} {set Saved $env(DSC_SAVED)} {set Saved saved}
if {[info exists env(DSC_SCHEMA)]} {set Schema $env(DSC_SCHEMA)} {set Schema schema}
if {[info exists env(DSC_STASH)]} {set Stash $env(DSC_STASH)} {set Stash stash}
if {[info exists env(DSC_SAVED)]} {set Saved $env(DSC_SAVED)} {set Saved saved}
-if {[info exists env(DSC_HASHES)]} {
- set Hashes [list]
- foreach pair [split $env(DSC_HASHES) ,] {
- set cols [split $pair :]
- if {[llength $cols] != 2} {
- error "bad DSC_HASHES"
- }
- lappend Hashes [lindex $cols 0] [lindex $cols 1]
+if {[info exists env(DSC_HASHERS)]} {
+ set Hashers [list]
+ foreach pair [split $env(DSC_HASHERS) "\n"] {
+ set idx [string first " " $pair]
+ if {$idx <= 0} {
+ continue
+ }
+ lappend Hashers \
+ [string range $pair 0 [expr {$idx-1}]] \
+ [string range $pair [expr {$idx+1}] end]
- set Hashes [list sha2-512 sha512]
+ set Hashers [list sha2-512 sha512]
}
proc readents {root typ} {
}
proc readents {root typ} {
- foreach {name cmd} $Hashes {
+ foreach {name cmd} $Hashers {
lassign [pipe] r w
set fh [open [list |$cmd >@$w] w]
fconfigure $fh -translation binary
lassign [pipe] r w
set fh [open [list |$cmd >@$w] w]
fconfigure $fh -translation binary
echo "whatever hash" >>expected
test_expect_success "wrong csum" "! dsc import-check <out"
echo "whatever hash" >>expected
test_expect_success "wrong csum" "! dsc import-check <out"
-DSC_HASHES="sha2-512:sha512"
+DSC_HASHERS="sha2-512 sha512"
test_expect_success "export sha512" "dsc export >out"
cat >expected <<EOF
-- .dirs --
test_expect_success "export sha512" "dsc export >out"
cat >expected <<EOF
-- .dirs --
cat hsh >>expected
test_expect_success "cmp" "test_cmp out expected"
cat hsh >>expected
test_expect_success "cmp" "test_cmp out expected"
test_expect_success "empty hashes" "dsc export >out"
cat >expected <<EOF
-- .dirs --
test_expect_success "empty hashes" "dsc export >out"
cat >expected <<EOF
-- .dirs --
export JIMLIB="$SHARNESS_TEST_DIRECTORY/../jimlib:$JIMLIB"
PATH="$SHARNESS_TEST_DIRECTORY/..:$PATH"
mkdir saved
export JIMLIB="$SHARNESS_TEST_DIRECTORY/../jimlib:$JIMLIB"
PATH="$SHARNESS_TEST_DIRECTORY/..:$PATH"
mkdir saved
-export DSC_HASHES="sha2-512:sha512"
+export DSC_HASHERS="sha2-512 sha512"
if command -v skein512 2>/dev/null >/dev/null ; then
if command -v skein512 2>/dev/null >/dev/null ; then
- DSC_HASHES="skein-512:skein512,$DSC_HASHES"
+ DSC_HASHERS="skein-512 skein512
+$DSC_HASHERS"
fi
if command -v b2sum 2>/dev/null >/dev/null ; then
fi
if command -v b2sum 2>/dev/null >/dev/null ; then
- DSC_HASHES="blake2b-512:b2sum,$DSC_HASHES"
+ DSC_HASHERS="blake2b-512 b2sum
+$DSC_HASHERS"