Skip to content

Commit

Permalink
Drop unix/VERSION from the repository.
Browse files Browse the repository at this point in the history
  • Loading branch information
c-lipka committed Sep 23, 2017
1 parent 1a2df0e commit 16378dc
Show file tree
Hide file tree
Showing 7 changed files with 132 additions and 25 deletions.
5 changes: 5 additions & 0 deletions changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ Other Noteworthy
- The source code now requires a C++11-compliant compiler.
- Added `--generation` command-line switch to POV-Ray for Unix, which will
cause POV-Ray to print its abbreviated version number to standard output.
- To simplify version number housekeeping, the file `unix/VERSION` is now
created on the fly by the `unix/prebuild.sh` script, and has been dropped
from the repository. To retrieve version information from the source
package, use one of the new `get-source-version.*` scripts provided in
`tools/unix/` and `tools/windows/`, respectively.


Changes between 3.7.1-beta.9 and 3.7.1-rc.1
Expand Down
2 changes: 0 additions & 2 deletions source-doc/versioning.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ What To Change
When updating a version number, the following files _always_ need to be changed accordingly:

- `source/base/version.h`
- `unix/VERSION`

When updating the minor or major version number, a host of other files need to be changed as well.
To identify the files affected, search the _entire_ repository for the regular expression
Expand All @@ -114,7 +113,6 @@ The directory `tools/git/hooks` contains scripts intended to (among other things
Git; to benefit from them, copy them to the `.git/hooks` directory in your local Git workspace. Whenever you perform a
commit, they will automatically take care of the following:

- Verify that `unix/VERSION` and the various version number fields in `source/base/version.h` match.
- Update the `ID` portion of pre-release versions whenever any files in one of the following directory sub-trees have
been staged for commit: `source`, `vfe`, `platform`, `mac`, `unix`, `windows` or `libraries`. The new value of the
`ID` portion will be the number of minutes elapsed since 2000-01-01 00:00 UTC. (If the `ID`
Expand Down
3 changes: 2 additions & 1 deletion tools/doxygen/doxygen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

# PLANTUML_JAR_PATH='/usr/bin'
cd ../..
POV_VER=`cat ./VERSION`
eval `tools/unix/get-source-version.sh source/base/version.h`
POV_VER="$POV_RAY_FULL_VERSION"
doxygen tools/doxygen/source-doc.cfg
cd tools/doxygen/source-doc/latex
make pdf
Expand Down
64 changes: 64 additions & 0 deletions tools/unix/get-source-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Extract POV-Ray version information from `source/base/version.h`
#
# From Unix shell scripts, run as follows:
#
# eval `./tools/unix/get-source-version.sh ./source/base/version.h`
#
# This procedure will cause the following envionment variables to be set:
#
# POV_RAY_COPYRIGHT Copyright string
# POV_RAY_GENERATION First two fields of the version string (`X.Y`)
# POV_RAY_FULL_VERSION Full version string (`X.Y.Z`[`.P`][`-PRE`])
# POV_RAY_PRERELEASE Pre-release tag portion of the version string (`PRE`), or empty if not applicable

ExtractData() {

local version_h="$1"

GetMacro() {
local file="$1"
local macro="$2"
local pattern="$3"
# NB: The following regexp deliberately does not probe until end of line, to allow for CR/LF line endings.
sed -n 's,^ *#define *'"$macro""$pattern"',\1,p' "$file"
}

GetNumericMacro() {
GetMacro "$1" "$2" ' *\([0-9][0-9]*\)'
}

GetStringMacro() {
GetMacro "$1" "$2" ' *"\([^"]*\)"'
}

local copyright=`GetStringMacro "$version_h" POV_RAY_COPYRIGHT`

local major=`GetNumericMacro "$version_h" POV_RAY_MAJOR_VERSION_INT`
local minor=`GetNumericMacro "$version_h" POV_RAY_MINOR_VERSION_INT`
local revision=`GetNumericMacro "$version_h" POV_RAY_REVISION_INT`
local patchlevel=`GetNumericMacro "$version_h" POV_RAY_PATCHLEVEL_INT`

local prerelease=`GetStringMacro "$version_h" POV_RAY_PRERELEASE`

local generation="$major.$minor"
if test "$patchlevel" -eq 0 ; then
local release="$generation.$revision"
else
local release="$generation.$revision.$patchlevel"
fi
if test x"$prerelease" != x"" ; then
local version="$release-$prerelease"
else
local version="$release"
fi

cat << hereEOF
POV_RAY_COPYRIGHT="$copyright"
POV_RAY_GENERATION="$generation"
POV_RAY_FULL_VERSION="$version"
POV_RAY_PRERELEASE="$prerelease"
hereEOF

}

ExtractData "$@"
69 changes: 50 additions & 19 deletions tools/windows/get-source-version.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -13,30 +13,41 @@
#
# Both procedures will cause the following envionment variables to be set:
#
# POV_SOURCE_GENERATION First two fields of the version string (`X.Y`)
# POV_SOURCE_VERSION Full version string (`X.Y.Z`[`.P`][`-PRE`])
# POV_SOURCE_PRERELEASE Pre-release tag portion of the version string (`PRE`), or empty[*] if not applicable
# POV_RAY_COPYRIGHT Copyright string
# POV_RAY_GENERATION First two fields of the version string (`X.Y`)
# POV_RAY_FULL_VERSION Full version string (`X.Y.Z`[`.P`][`-PRE`])
# POV_RAY_PRERELEASE Pre-release tag portion of the version string (`PRE`), or empty if not applicable [*]
#
# For backward compatibility with earlier versions of the script, the following (deprecated)
# environment variables will also be set:
#
# POV_SOURCE_COPYRIGHT same as POV_RAY_COPYRIGHT
# POV_SOURCE_GENERATION same as POV_RAY_GENERATION
# POV_SOURCE_VERSION same as POV_RAY_FULL_VERSION
# POV_SOURCE_PRERELEASE same as POV_RAY_PRERELEASE [*]
#
# [*In the batch version of the procedure, empty environment variables will be left undefined.]

param ([string]$version_h, [string]$bat)

function GetNumericMacro ([string]$file, [string]$macro) {
$regexp = '^\s*#define\s+' + $macro + '\s+[0-9]+\s*$'
function GetMacro ([string]$file, [string]$macro, [string]$pattern1, [string]$pattern2, [string]$pattern3) {
$regexp = '^\s*#define\s+' + $macro + $pattern1 + '\s*$'
$line = ( select-string -Path $file -Pattern $regexp | % { $_.Matches } | % { $_.Value } )
$string = ( select-string -InputObject $line -Pattern '\s+[0-9]+' | % { $_.Matches } | % { $_.Value } )
$value = ( select-string -InputObject $string -Pattern '[0-9]+' | % { $_.Matches } | % { $_.Value } )
$string = ( select-string -InputObject $line -Pattern $pattern2 | % { $_.Matches } | % { $_.Value } )
$value = ( select-string -InputObject $string -Pattern $pattern3 | % { $_.Matches } | % { $_.Value } )
return [string]$value
}

function GetNumericMacro ([string]$file, [string]$macro) {
GetMacro $file $macro '\s+[0-9]+' '\s+[0-9]+' '[0-9]+'
}

function GetStringMacro ([string]$file, [string]$macro) {
$regexp = '^\s*#define\s+' + $macro + '\s*"[^"]+"\s*$'
$line = ( select-string -Path $file -Pattern $regexp | % { $_.Matches } | % { $_.Value } )
$string = ( select-string -InputObject $line -Pattern '"[^"]+"' | % { $_.Matches } | % { $_.Value } )
$value = ( select-string -InputObject $string -Pattern '[^"]+' | % { $_.Matches } | % { $_.Value } )
return [string]$value
GetMacro $file $macro '\s*"[^"]+"' '"[^"]+"' '[^"]+'
}

$copyright = GetStringMacro $version_h 'POV_RAY_COPYRIGHT'

$major = GetNumericMacro $version_h 'POV_RAY_MAJOR_VERSION_INT'
$minor = GetNumericMacro $version_h 'POV_RAY_MINOR_VERSION_INT'
$revision = GetNumericMacro $version_h 'POV_RAY_REVISION_INT'
Expand All @@ -56,13 +67,33 @@ if ($prerelease) {
$version = $release
}

$env:POV_SOURCE_GENERATION = $generation
$env:POV_SOURCE_VERSION = $version
$env:POV_SOURCE_PRERELEASE = $prerelease

if ($bat) {
$text = "set POV_SOURCE_GENERATION=" + $env:POV_SOURCE_GENERATION + "`n"
$text += "set POV_SOURCE_VERSION=" + $env:POV_SOURCE_VERSION + "`n"
$text += "set POV_SOURCE_PRERELEASE=" + $env:POV_SOURCE_PRERELEASE + "`n"

$text = ""

$text += "set POV_RAY_COPYRIGHT=" + $copyright + "`n"
$text += "set POV_RAY_GENERATION=" + $generation + "`n"
$text += "set POV_RAY_FULL_VERSION=" + $version + "`n"
$text += "set POV_RAY_PRERELEASE=" + $prerelease + "`n"

$text += "set POV_SOURCE_COPYRIGHT=" + $copyright + "`n"
$text += "set POV_SOURCE_GENERATION=" + $generation + "`n"
$text += "set POV_SOURCE_VERSION=" + $version + "`n"
$text += "set POV_SOURCE_PRERELEASE=" + $prerelease + "`n"

Out-File -LiteralPath $bat -Encoding ASCII -InputObject $text -NoNewline

} else {

$env:POV_RAY_COPYRIGHT = $copyright
$env:POV_RAY_GENERATION = $generation
$env:POV_RAY_FULL_VERSION = $version
$env:POV_RAY_PRERELEASE = $prerelease

$env:POV_SOURCE_COPYRIGHT = $copyright
$env:POV_SOURCE_GENERATION = $generation
$env:POV_SOURCE_VERSION = $version
$env:POV_SOURCE_PRERELEASE = $prerelease

}

1 change: 0 additions & 1 deletion unix/VERSION

This file was deleted.

13 changes: 11 additions & 2 deletions unix/prebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,12 @@

umask 022

pov_version_base=`cat ./VERSION | sed 's,\([0-9]*.[0-9]*\).*,\1,g'`
# Extract version information from `source/base/version.h`
eval `../tools/unix/get-source-version.sh ../source/base/version.h`
pov_copyright="$POV_RAY_COPYRIGHT"
pov_version_base="$POV_RAY_GENERATION"
pov_version="$POV_RAY_FULL_VERSION"

pov_config_bugreport="POV-Ray issue tracker at https://github.com/POV-Ray/povray/issues"

# documentation
Expand Down Expand Up @@ -350,7 +355,7 @@ echo "make maintainer-clean" 1>&2 && make maintainer-clean 1>&2 ; \
# some shells seem unable to expand properly wildcards in the list entries
# (e.g. ../distribution/in*/).
for file in \
AUTHORS ChangeLog configure.ac COPYING NEWS README VERSION \
AUTHORS ChangeLog configure.ac COPYING NEWS README \
povray.1 povray.conf \
scripts \
../distribution/ini ../distribution/include ../distribution/scenes
Expand All @@ -368,6 +373,10 @@ echo "make maintainer-clean" 1>&2 && make maintainer-clean 1>&2 ; \
$cp_u -f install.txt ../INSTALL || echo "INSTALL not copied !"
chmod -f u+rw ../INSTALL

# VERSION
echo "Create ../VERSION"
echo "$pov_version" > ../VERSION || echo "VERSION not created !"

# icons/
# don't copy the icons/source directory
mkdir -p ../icons
Expand Down

0 comments on commit 16378dc

Please sign in to comment.