From 3b6e0279c4afffc8b11cd7d881e0a8b6f43aa431 Mon Sep 17 00:00:00 2001 From: Ralph Amissah Date: Wed, 28 Sep 2022 18:33:09 -0400 Subject: org nix --- makefile | 42 ++++++++++++++++++++++++++++++++++++------ 1 file changed, 36 insertions(+), 6 deletions(-) (limited to 'makefile') diff --git a/makefile b/makefile index 6b76b0a..77894c2 100644 --- a/makefile +++ b/makefile @@ -87,8 +87,6 @@ SpineSearchActionLocal := 'http://localhost/spine_search' SpineSearchActionRemote := 'https://sisudoc.org/spine_search' SpineCGIform := 'spine_search' SpineSQLdb := 'spine.search.db' -PROG_VER_GIT := '''`git describe --long --tags | sed -e "s/^[ a-z_-]\+\([0-9.]\+\)/\1/;s/\([^-]*-g\)/r\1/;s/-/./g"`''' -PROG_VER_DECLARED := '''`cat ./views/version.txt | grep --color=never "enum" | sed 's/.\+(\([0-9]\+\),[ \t]\+\([0-9]\+\),[ \t]\+\([0-9]\+\)[ \t]*).\+/\1.\2.\3/g'`''' hwd := `pwd` gwd := `pwd` + "/src/ext_depends" deps := "`ls -gx './src/ext_depends'`" @@ -467,19 +465,51 @@ changelog: git log --pretty=format:'---%+s %+as %ae%+h%d%+b' --no-merges | sed "/^\\s*$$/d" | sed "s/^---$$//" | sed "s/^\(\*\)\+/-/" | sed "s/ \+$$//" | sed "s/ \+$//" > CHANGELOG_ gitZip: - git archive -v --format=tar --prefix=`echo spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)`/ HEAD | gzip > ../spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz && \ + git archive -v --format=tar --prefix=`echo spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)`/ HEAD | gzip > ./tarballGitHEAD/spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz && \ echo "to unzip: tar -xzf spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz" # git archive project, produce current state .tar.gz gitArchive: - git archive -v --format=tar --prefix=spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)/ HEAD | gzip > ../spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz && \ + git archive -v --format=tar --prefix=spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT)/ HEAD | gzip > ./tarballGitHEAD/spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz && \ echo "to unzip: tar -xzf spine-$(PROG_VER_DECLARED)-tag-$(PROG_VER_GIT).tar.gz" # git archive project, produce current state .tar.gz # gitArchive: -# git archive -v --format=tar --prefix="spine-{{PROG_VER_DECLARED}}-tag-{{PROG_VER_GIT}}/" HEAD | gzip > ../spine-{{PROG_VER_DECLARED}}-tag-{{PROG_VER_GIT}}.tar.gz && \ +# git archive -v --format=tar --prefix="spine-{{PROG_VER_DECLARED}}-tag-{{PROG_VER_GIT}}/" HEAD | gzip > ./tarballGitHEAD/spine-{{PROG_VER_DECLARED}}-tag-{{PROG_VER_GIT}}.tar.gz && \ # echo "to unzip: tar -xzf spine-{{PROG_VER_DECLARED}}-tag-{{PROG_VER_GIT}}.tar.gz" +# remove test tarball dir +nixGitHEADtarballClean: + if [ -d "./tarballGitHEAD" ]; then \ + rm -rv ./tarballGitHEAD; \ + fi; + +# create test tarball +nixGitHEADtarballTar: + if [ ! -d "./tarballGitHEAD" ]; then \ + mkdir ./tarballGitHEAD; \ + fi; \ + git archive -v --format=tar --prefix="spine-${PROG_VER_DECLARED}/" HEAD | \ + gzip > ./tarballGitHEAD/spine-${PROG_VER_DECLARED}-tag-${PROG_VER_GIT}.tar.gz && \ + cp -v ./tarballGitHEAD/spine-${PROG_VER_DECLARED}-tag-${PROG_VER_GIT}.tar.gz ./tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz && \ + echo "to unzip: tar -xzf spine-${PROG_VER_DECLARED}-tag-${PROG_VER_GIT}.tar.gz"; \ + echo "to unzip: tar -xzf spine-${PROG_VER_DECLARED}.tar.gz" + +# check test tarball +nixGitHEADtarballCheck: + nix flake lock file://${hwd}/tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz; \ + nix flake check file://${hwd}/tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz; \ + nix flake show file://${hwd}/tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz; + +# build test tarball +nixGitHEADtarballBuild: + echo "nix build file://${hwd}/tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz#spine --print-build-logs" + nix build file://${hwd}/tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz#spine --print-build-logs + #nix build "./tarballGitHEAD/spine-${PROG_VER_DECLARED}.tar.gz#spine" --print-build-logs + +# clean create check & build test tarball +nixGitHEADtarball: nixGitHEADtarballClean nixGitHEADtarballTar nixGitHEADtarballCheck nixGitHEADtarballBuild + get_depends: hwd=$$(echo `pwd`) && \ gwd="$${hwd}/src/ext_depends" && \ @@ -529,7 +559,7 @@ rm_flakelock: flake_update: git add .; \ - nix flake update && \ + nix flake lock && \ git reset HEAD flake.lock; \ cp flake.lock flake.lock_ -- cgit v1.2.3