bin/commit: Add --add-metadata that accepts g_variant_print() format

Mostly adding this for use in test cases; it allows us to add e.g.
integers, and we need to deal with byteswapping those.

Someone mind also find it useful to add fully structured metadata, although most
of those users should be using a real language and not shell script.

Closes: #1372
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2017-12-12 19:31:16 +00:00
1 parent f81e3c6f03
commit ac092895b1
2 files changed
+40 -14

No files matched your search

+5 -1
View File
@@ -751,12 +751,16 @@ $OSTREE commit ${COMMIT_ARGS} -s sometest -b test2 checkout-test2
echo "ok commit with directory filename"
cd $test_tmpdir/checkout-test2
$OSTREE commit ${COMMIT_ARGS} -b test2 -s "Metadata string" --add-metadata-string=FOO=BAR --add-metadata-string=KITTENS=CUTE --add-detached-metadata-string=SIGNATURE=HANCOCK --tree=ref=test2
$OSTREE commit ${COMMIT_ARGS} -b test2 -s "Metadata string" --add-metadata-string=FOO=BAR \
--add-metadata-string=KITTENS=CUTE --add-detached-metadata-string=SIGNATURE=HANCOCK \
--add-metadata=SOMENUM='uint64 42' --tree=ref=test2
cd ${test_tmpdir}
$OSTREE show --print-metadata-key=FOO test2 > test2-meta
assert_file_has_content test2-meta "BAR"
$OSTREE show --print-metadata-key=KITTENS test2 > test2-meta
assert_file_has_content test2-meta "CUTE"
$OSTREE show --print-metadata-key=SOMENUM test2 > test2-meta
assert_file_has_content test2-meta "uint64 3026418949592973312"
$OSTREE show --print-detached-metadata-key=SIGNATURE test2 > test2-meta
assert_file_has_content test2-meta "HANCOCK"
echo "ok metadata commit with strings"