earthenterprise
earthenterprise copied to clipboard
Packaging Open GEE for Debian Fails on Branches whose Names Contain Any [$?*`-"'\/] or Space Characters
Steps to Reproduce:
- Work on an Ubuntu 14, or 16 machine.
- Create a development branch with a name that contains, at least, one of the following characters:
[$?*`-"'\/]
or white space. - Check out the new branch, and build Open GEE.
-
cd earth_enterprise/rpms && ./gradlew osPackage
.
Expected Result
Debian opengee-common
, opengee-fusion
, opengee-server
packages build successfully.
Observed Result
Starting a Gradle Daemon (subsequent builds will be faster)
> Configure project :
Open GEE version: 5.2.5.b754.I1137_fix_memory_test_builds_on_red_hat
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':openGeeCommonDeb'.
> Invalid upstream version '5.2.5.b754.I1137_fix_memory_test_builds_on_red_hat
' - a valid version must start with a digit and only contain [A-Za-z0-9.+:~-]
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
* Get more help at https://help.gradle.org
BUILD FAILED in 11s
3 actionable tasks: 1 executed, 2 up-to-date
Notes
Version String Policies
The _sanitizeBranchName
function in earthenterprise_code/earthenterprise/earth_enterprise/src/scons/getversion.py
converts any characters in the branch name that are considered unsafe to _
.
The RPM version field format guide says:
The only restriction placed on the version is that it cannot contain a dash "-".
The upstream_version may contain only alphanumerics [6] and the characters . + - ~ (full stop, plus, hyphen, tilde) and should start with a digit. If there is no debian_revision then hyphens are not allowed.
I.e., underscores are accepted in RPM version strings, but not in Debian ones.
Implementation Comments
Currently:
def _sanitizeBranchName(branchName):
"""sanitize branch names to ensure some characters are not used"""
return re.sub('[$?*`\\-"\'\\\\/\\s]', '_', branchName)
The implementation lists the characters in the branch name to be replaced. It would be safer to list the characters that are allowed, and replace any remaining characters.