Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ y.tab.h

initial.c
sigmsgs.c
version.h
es
esdump
testrun
9 changes: 6 additions & 3 deletions Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ OFILES = access.o closure.o conv.o dict.o eval.o except.o fd.o gc.o glob.o \
sigmsgs.o signal.o split.o status.o str.o syntax.o term.o token.o \
tree.o util.o var.o vec.o version.o y.tab.o
OTHER = Makefile parse.y mksignal
GEN = esdump y.tab.h y.output sigmsgs.c initial.c
GEN = esdump y.tab.h y.output sigmsgs.c initial.c version.h

SIGFILES = @SIGFILES@

Expand Down Expand Up @@ -107,6 +107,9 @@ token.h : parse.y

y.tab.c : token.h

version.h : mkversion
(cd $(srcdir) && sh mkversion) > version.h

initial.c : esdump $(srcdir)/initial.es
./esdump < $(srcdir)/initial.es > initial.c

Expand Down Expand Up @@ -139,7 +142,7 @@ open.o : open.c es.h config.h stdenv.h
opt.o : opt.c es.h config.h stdenv.h
prim.o : prim.c es.h config.h stdenv.h prim.h
prim-ctl.o : prim-ctl.c es.h config.h stdenv.h prim.h
prim-etc.o : prim-etc.c es.h config.h stdenv.h prim.h
prim-etc.o : prim-etc.c es.h config.h stdenv.h prim.h version.h
prim-io.o : prim-io.c es.h config.h stdenv.h gc.h prim.h
prim-sys.o : prim-sys.c es.h config.h stdenv.h prim.h
print.o : print.c es.h config.h stdenv.h print.h
Expand All @@ -155,4 +158,4 @@ tree.o : tree.c es.h config.h stdenv.h gc.h
util.o : util.c es.h config.h stdenv.h
var.o : var.c es.h config.h stdenv.h gc.h var.h term.h
vec.o : vec.c es.h config.h stdenv.h gc.h
version.o : version.c es.h config.h stdenv.h
version.o : version.c es.h config.h stdenv.h version.h
2 changes: 1 addition & 1 deletion es.h
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ extern int opentty(void);

/* version.c */

extern const char * const version;
extern const List * const version;


/* gc.c -- see gc.h for more */
Expand Down
6 changes: 6 additions & 0 deletions mkversion
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/sh

VERSION=0.9.2
RELEASEDATE=2-Mar-2022

echo "#define VERSION \"es version $VERSION $RELEASEDATE\""
3 changes: 2 additions & 1 deletion prim-etc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "es.h"
#include "prim.h"
#include "version.h"

PRIM(result) {
return list;
Expand Down Expand Up @@ -33,7 +34,7 @@ PRIM(setnoexport) {
}

PRIM(version) {
return mklist(mkstr((char *) version), NULL);
return (List *)version;
}

PRIM(exec) {
Expand Down
61 changes: 54 additions & 7 deletions release.es
Original file line number Diff line number Diff line change
@@ -1,15 +1,62 @@
#!/usr/bin/env es

# Create a new tarball
# release.es -- release a new es version. This script does the following:
# - Updates the return value of $&version
# - Creates an "update" commit and tags the commit with the new version
# (if write-to-git = true).
# - Generates a tarball for the new release.
#
# To use it to release a new version (e.g., 0.9.3), do the following:
# 1. Start in an es git repo directory called 'es-0.9.3' with a clean
# working tree
# 2. Edit CHANGES to describe the new release
# 3. Run `./release.es 0.9.3`. It will open an editor for you to write the
# tag message. Presumably you should just copy what you added to CHANGES.
# 4. Assuming everything looks good, run `git push && git push origin v0.9.3`
#
# At this point you'll be able to muck about in Github to create a "Release".

# Whether to actually do the git commit and tag. Mostly for testing purposes.
write-to-git = true

# make sure everything is on the up and up

if {!~ $#* 1} {
echo Must provide a single argument: the release version (e.g. 0.9.1)
exit 1
echo >[1=2] 'Must provide a single argument: the release version (e.g. 0.9.1)'
exit 1
}

version = $1
cwd = `{basename `pwd}

if {!~ $cwd es-$version} {
echo >[1=2] 'Must release from a directory named es-'^$version
exit 1
}

if {! grep -q $1 version.c} {
echo 'Must update version.c to '^$1
echo '(yes, this should be automated)'
let (changes = `` \n {git status -s})
if {$write-to-git && {!~ $#changes 1 || !~ $changes ' M CHANGES'}} {
echo >[1=2] 'Must start with a clean workspace with updated CHANGES file'
exit 1
}

tar chzvf ../es-$1.tar.gz --exclude\=.circleci --exclude\=.gitignore --exclude\=release.es `{git ls-files} config.guess config.sub config.h.in configure install-sh
# update mkversion, commit and then tag

sed -i \
-e 's/VERSION=.*/VERSION='^$version^'/' \
-e 's/RELEASEDATE=.*/RELEASEDATE='^`^{date +%e-%b-%Y}^'/' \
mkversion

if $write-to-git {
git commit -am 'Version '^$version
git tag -a v$version
}

# generate tarball

files = `{git ls-files}
cd ..
tar chzvf es-$version.tar.gz \
--exclude=.circleci --exclude=.gitignore \
--exclude=.gitattributes --exclude=release.es \
$cwd/^($files config.guess config.sub config.h.in configure install-sh)
9 changes: 7 additions & 2 deletions version.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#include "es.h"
static const char id[] = "@(#)es version 0.9.2 2-Mar-2022";
const char * const version = id + (sizeof "@(#)" - 1);
#include "term.h"
#include "version.h"

static const Term
version_term = { VERSION, NULL };
static const List versionstruct = { (Term *) &version_term, NULL };
const List * const version = &versionstruct;