Commit e3fd90ae authored by rdubner's avatar rdubner
Browse files

Drive versioning from a single file

The root directory now contains a version.h file.  The #define VERSION x.y line provides a
version code that is used directly in cobst and sfix.  The same version is extracted by
scripts for updating cprint.py, and for creating the tarballs for distributing the source code
parent e84e578b
......@@ -7,11 +7,11 @@ COBCDEXISTS=$(wildcard /usr/local/bin/cobcd)
COBCD=/usr/local/bin/cobcd
CWD=$(shell basename `pwd`)
# Yes, this next thing needs to be done in a better way
VERSION=2.3
.PHONY : all
all:
## Make sure the VERSION text in cprint.py is up-to-date
$(MAKE) -C python
## Then you can make cobst
$(MAKE) -C cobst
$(MAKE) -C sfix
$(MAKE) -C samples
......@@ -51,16 +51,7 @@ endif
# copy cbl-gdb to cblgdb-x.y, tarball the copy, and delete the copy
.PHONY : package
package : clean
cd .. && \
cp -r $(CWD)/ cblgdb-$(VERSION)/ && \
tar --exclude=.git --exclude=.legacy -czf cblgdb-$(VERSION).tar.gz cblgdb-$(VERSION) && \
rm -fr cblgdb-$(VERSION)/
cd .. && \
cp -r $(CWD)/ cblgdb-latest/ && \
tar --exclude=.git --exclude=.legacy -czf cblgdb-latest.tar.gz cblgdb-latest && \
rm -fr cblgdb-latest/
./package.sh
# Dubner likes to work in Windows, using Visual Studio. This can result in
# Windows-style CRLF line endings. He also likes to work with C++ code
......
#!/bin/bash
## Creates a source-code package tarball.
##
## Extract '2.4' from '#define VERSION "2.4"'
input="version.h"
while read -r line
do
IFS=' '; arrIN=($line); unset IFS;
## Find the line in question:
if test X"${arrIN[0]}" == X"#define" && test X"${arrIN[1]}" == X"VERSION" ; then
# Remove the leading and trailing double-quotes:
VERSION=$(sed -e 's/^"//' -e 's/"$//' <<<"${arrIN[2]}")
fi
done < "$input"
## Make a copy of this working folder, but with the VERSION in its name
CWD=$(pwd)
cd ..
cp -r $CWD/ cblgdb-$VERSION/
## Make a tarball out of it
tar --exclude=.git --exclude=.legacy -czf cblgdb-$VERSION.tar.gz cblgdb-$VERSION
## Make a copy of the tarball, with "latest" in place of the version
cp cblgdb-$VERSION.tar.gz cblgdb-latest.tar.gz
## Get rid of the extra directory
rm -fr cblgdb-$VERSION/
......@@ -5,7 +5,8 @@ AUTO_SCRIPTS_FOUND := $(shell grep -s -e "^[ \t]*set auto-load python-scripts on
.PHONY: all
all :
@echo There is actually nothing to do for Python code.
## Make sure the VERSION text in cprint.py is up-to-date
./version
.PHONY: pregit
pregit:
......
......@@ -3145,7 +3145,7 @@ if 'gdb' in sys.modules :
## The text "Version x.x" has to appear in square brackets. #
## Don't mess with it! #
###########################################################################
print('registering CPrint (Usage is "print <COBOL identifier>") [Version 2.3]')
print('registering CPrint (Usage is "print <COBOL identifier>") [Version 2.4]')
self.Worker = CPrintWorker()
self.TabFile = TabFileInformation();
......
#!/bin/bash
## Modifies cprint.py, if necessary, with the VERSION text
## found in ../version.h
## Extract '2.4' from '#define VERSION "2.4"'
input="../version.h"
while read -r line
do
IFS=' '; arrIN=($line); unset IFS;
## Find the line in question:
if test X"${arrIN[0]}" == X"#define" && test X"${arrIN[1]}" == X"VERSION" ; then
# Remove the leading and trailing double-quotes:
VERSION=$(sed -e 's/^"//' -e 's/"$//' <<<"${arrIN[2]}")
fi
done < "$input"
VERSION_STRING='[Version '$VERSION']'
#echo VERSION is $VERSION
#echo VERSION_STRING is $VERSION_STRING
if ! grep -q -F "$VERSION_STRING" cprint.py ; then
## We need to replace the existing out-of-date version string
## with our new one
echo Updating cprint.py version to $VERSION_STRING
sed -i -r "s/[[]Version [0-9]+[.][0-9]+[]]/$VERSION_STRING/g" cprint.py
fi
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment