From 4c594105dcef71754de24080952e5fbf8eab32b0 Mon Sep 17 00:00:00 2001 From: Dmitry Zuikov Date: Sun, 17 Mar 2024 07:55:39 +0300 Subject: [PATCH] wip --- docs/papers/Makefile | 15 +++++++++++++-- hbs2/Main.hs | 7 ++++--- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/docs/papers/Makefile b/docs/papers/Makefile index 557f40c7..c8dcb4fe 100644 --- a/docs/papers/Makefile +++ b/docs/papers/Makefile @@ -1,4 +1,9 @@ -OUT:=$(shell git rev-parse --short HEAD) +REV:=$(shell git rev-parse --short HEAD) + +define make_target +$(basename $(1))-$(REV)$(suffix $(1)) +endef + all: hbs2-git-problem hbs2-git-new-repo hbs2-git-doc @@ -7,13 +12,19 @@ all: hbs2-git-problem hbs2-git-new-repo hbs2-git-doc %.pdf: %.tex xelatex $< xelatex $< + cp $@ $(call make_target,$@) hbs2-git-problem: hbs2-git-problem.pdf hbs2-git-new-repo: hbs2-git-new-repo.pdf hbs2-git-doc: hbs2-git-doc-0.24.1.pdf - @cp $< $(basename $<)-$(OUT)$(suffix $<) + +publish-hbs2-git-doc: hbs2-git-doc-0.24.1.pdf + $(eval TARGET := $(call make_target,$<)) + hbs2 metadata create --hash --auto $(TARGET) + +publish: publish-hbs2-git-doc clean: rm -f *.aux *.log *.nav *.out *.snm *.vrb *.toc *.pdf diff --git a/hbs2/Main.hs b/hbs2/Main.hs index a74c9462..416dbc25 100644 --- a/hbs2/Main.hs +++ b/hbs2/Main.hs @@ -579,6 +579,7 @@ main = join . customExecParser (prefs showHelpOnError) $ o <- common how <- MetaDataAuto <$> strOption ( long "auto" <> metavar "FILENAME" <> help "automatic metadata from file name") dry <- flag False True (long "dry" <> short 'n' <> help "don't write to storage") + hOnly <- flag False True (long "hash" <> short 'H' <> help "merely print hash") pure $ flip runContT pure do @@ -600,7 +601,9 @@ main = join . customExecParser (prefs showHelpOnError) $ let s = LBS8.pack $ show $ vcat meta - liftIO $ LBS8.putStr s + unless hOnly do + liftIO $ LBS8.putStrLn s + liftIO $ LBS8.putStrLn "" guard (not dry) @@ -621,8 +624,6 @@ main = join . customExecParser (prefs showHelpOnError) $ hnew <- putBlock sto (serialise mtann) `orDie` "can't write merkle tree" - liftIO $ putStrLn "" - liftIO $ putStrLn "" liftIO $ print $ pretty hnew pGroupKey = pGroupKeySymm