~nytpu/dbc-scheme

dbc-scheme/package.sh -rwxr-xr-x 1.6 KiB
c2dccf9anytpu add license file 7 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
# package.sh --- workaround for snow-chibi's docs generator being broken
#
# Copyright (c) 2021-2022 nytpu <alex [at] nytpu.com>
# SPDX-License-Identifier: MPL-2.0
# Home Page: <https://git.sr.ht/~nytpu/dbc-scheme>
set -eu

## change these
libname="nytpu.contracts"
author="nytpu <alex@nytpu.com>"
libfile="contracts.sld"
license="MPL-2.0"
test_file="contracts-test.scm"
description="Design by Contracts for R7RS"
log_file="_nytpu contracts_.log"

# this first build will NOT have documentation built for some reason!
printf "Building broken package\n"
snow-chibi package --license="${license}" --test="${test_file}" \
  --description="${description}" --authors="${author}" \
  --version-file="VERSION" "${libfile}"
packagename="$(echo "${libname}" | tr '.' '-')-"$(cat VERSION)".tgz"
# once it's installed, then repackaging will properly generate documentation
printf "Installing broken package\n"
snow-chibi install "${packagename}"

# remove the broken package
rm "${packagename}"

# generate proper documenation
docname="$(echo "${libname}" | tr '.' '/').html"
mkdir -p "$(dirname "${docname}")"
chibi-doc -h "${libname}" > "${docname}"

printf "Building proper package\n"
snow-chibi package --license="${license}" --test="${test_file}" \
  --description="${description}" --authors="${author}" --doc="${docname}" \
  --version-file="VERSION" "${libfile}"

# remove generated cruft
rm "${docname}"
rmdir -p "$(dirname "${docname}")"
rm "${log_file}"

# remove broken old package
printf "Removing broken package\n"
snow-chibi remove "${libname}"

printf "Upload package to Snow (y/N)? "
read answer
[ "$answer" != "${answer#[Yy]}" ] && snow-chibi upload "${packagename}"