Skip to content

Commit

Permalink
[HOTFIX] Python Interpreter
Browse files Browse the repository at this point in the history
- added native RPi docker image instruction to CompileHowto.md
- version channel is received from JsonAPI instead of reading from the configuration file

Signed-off-by: Paulchen-Panther <[email protected]>
  • Loading branch information
Paulchen-Panther committed Jul 8, 2019
1 parent e0e0a84 commit e6c2e7e
Show file tree
Hide file tree
Showing 9 changed files with 49 additions and 41 deletions.
39 changes: 24 additions & 15 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,45 +7,53 @@ set(CMAKE_AUTOMOC ON)
# auto prepare .qrc files
set(CMAKE_AUTORCC ON)

IF ( POLICY CMP0026 )
if ( POLICY CMP0026 )
CMAKE_POLICY( SET CMP0026 OLD )
ENDIF()
endif()

# Configure CCache if available
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
if ( CCACHE_FOUND )
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ccache)
endif(CCACHE_FOUND)

find_package( PythonInterp 3.5 REQUIRED )

# Read version from version.json
EXECUTE_PROCESS (
COMMAND python test/jsonchecks/version.py ${PROJECT_SOURCE_DIR}/version.json
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/version.py version.json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
OUTPUT_VARIABLE RETURN_VERSION
)

SET( VERSION_REGEX "[0-9]+\\.[0-9]+\\.[0-9]+(-[a-zA-Z0-9_]+)?" )
IF( ${RETURN_VERSION} MATCHES ${VERSION_REGEX})
if ( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
STRING(REGEX MATCHALL "[0-9]+|-([A-Za-z0-9_]+)" VERSION_PARTS ${RETURN_VERSION} )
LIST( GET VERSION_PARTS 0 VERSION_MAJOR )
LIST( GET VERSION_PARTS 1 VERSION_MINOR )
LIST( GET VERSION_PARTS 2 VERSION_PATCH )
ELSE( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
message( FATAL_ERROR "Failed to parse version.json string properly. Expect X.Y.Z.")
ENDIF()
else ( ${RETURN_VERSION} MATCHES ${VERSION_REGEX} )
message( FATAL_ERROR "Failed to parse version.json string properly. ${error_code}" )
endif()

SET( HYPERION_VERSION_MAJOR ${VERSION_MAJOR} )
SET( HYPERION_VERSION_MINOR ${VERSION_MINOR} )
SET( HYPERION_VERSION_PATCH ${VERSION_PATCH} )

# Read channel from version.json
EXECUTE_PROCESS (
COMMAND python test/jsonchecks/version.py ${PROJECT_SOURCE_DIR}/version.json "channel"
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/version.py version.json "channel"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE error_code
OUTPUT_VARIABLE RETURN_CHANNEL
)

if ( error_code )
message( FATAL_ERROR "Failed to parse version.json string properly. ${error_code}" )
endif()

SET ( HYPERION_VERSION_CHANNEL ${RETURN_CHANNEL} )

# Set build variables
Expand Down Expand Up @@ -147,10 +155,9 @@ if ( "${PLATFORM}" MATCHES "-dev" )
SET ( DEFAULT_TESTS ON )
endif()

# is this necessary?
# STRING( TOUPPER "-DPLATFORM_${PLATFORM}" PLATFORM_DEFINE)
# STRING( REPLACE "-DEV" "" PLATFORM_DEFINE "${PLATFORM_DEFINE}" )
# ADD_DEFINITIONS( ${PLATFORM_DEFINE} )
STRING( TOUPPER "-DPLATFORM_${PLATFORM}" PLATFORM_DEFINE)
STRING( REPLACE "-DEV" "" PLATFORM_DEFINE "${PLATFORM_DEFINE}" )
ADD_DEFINITIONS( ${PLATFORM_DEFINE} )

# set the build options
option(ENABLE_AMLOGIC "Enable the AMLOGIC video grabber" ${DEFAULT_AMLOGIC} )
Expand Down Expand Up @@ -209,7 +216,7 @@ SET( JSON_FILES
${HYPERION_SCHEMAS}
)
EXECUTE_PROCESS (
COMMAND python test/jsonchecks/checkjson.py ${JSON_FILES}
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkjson.py ${JSON_FILES}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE CHECK_JSON_FAILED
)
Expand All @@ -218,14 +225,15 @@ IF ( ${CHECK_JSON_FAILED} )
ENDIF ()

EXECUTE_PROCESS (
COMMAND python test/jsonchecks/checkeffects.py effects effects/schema
COMMAND ${PYTHON_EXECUTABLE} test/jsonchecks/checkeffects.py effects effects/schema
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
RESULT_VARIABLE CHECK_EFFECTS_FAILED
)
IF ( ${CHECK_EFFECTS_FAILED} )
MESSAGE (FATAL_ERROR "check of json effect files failed" )
ENDIF ()

# for python 3 the checkschema.py file must be rewritten
EXECUTE_PROCESS (
COMMAND python test/jsonchecks/checkschema.py config/hyperion.config.json.default libsrc/hyperion/hyperion.schema.json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
Expand Down Expand Up @@ -367,3 +375,4 @@ add_custom_target(uninstall COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_D

# enable make package - no code after this line !
include (${CMAKE_CURRENT_SOURCE_DIR}/cmake/packages.cmake)

23 changes: 16 additions & 7 deletions CompileHowto.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,33 @@
# With Docker
If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compilation for Raspberry Pi (Debian Stretch)
If you are using [Docker](https://www.docker.com/), you can compile Hyperion inside a docker container. This keeps your system clean and with a simple script it's easy to use. Supported is also cross compiling for Raspberry Pi (Debian Stretch or higher). To compile Hyperion just execute one of the following commands.

To compile Hyperion for Debain Stretch (x64 architecture) or higher just execute the following command
The compiled binaries and packages will be available at the deploy folder next to the script
Note: call the script with `./docker-compile.sh -h` for more options

## Native compiling on Raspberry Pi

```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t rpi-raspbian
```

## Cross compiling on X64_86 for:

**X64:**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh
```
To compile Hyperion for i386 architecture
**i386:**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t i386
```
To compile Hyperion for Raspberry Pi v1 & ZERO
**Raspberry Pi v1 & ZERO**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv6hf
```
To compile Hyperion for Raspberry Pi 2 & 3
**Raspberry Pi 2 & 3**
```
wget -qN https://raw.github.com/hyperion-project/hyperion.ng/master/bin/scripts/docker-compile.sh && chmod +x *.sh && ./docker-compile.sh -t armv7hf
```
The compiled binaries and packages will be available at the deploy folder next to the script
Note: call the script with `./docker-compile.sh -h` for more options

# The usual way

Expand Down
9 changes: 5 additions & 4 deletions HyperionConfig.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
// the hyperion build id string
#define HYPERION_BUILD_ID "${HYPERION_BUILD_ID}"

#define HYPERION_VERSION_MAJOR "${HYPERION_VERSION_MAJOR}"
#define HYPERION_VERSION_MINOR "${HYPERION_VERSION_MINOR}"
#define HYPERION_VERSION_PATCH "${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION "${HYPERION_VERSION_CHANNEL}.${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION_MAJOR "${HYPERION_VERSION_MAJOR}"
#define HYPERION_VERSION_MINOR "${HYPERION_VERSION_MINOR}"
#define HYPERION_VERSION_PATCH "${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION "${HYPERION_VERSION_MAJOR}.${HYPERION_VERSION_MINOR}.${HYPERION_VERSION_PATCH}"
#define HYPERION_VERSION_CHANNEL "${HYPERION_VERSION_CHANNEL}"

#define HYPERION_JSON_VERSION "1.0.0"
2 changes: 1 addition & 1 deletion assets/webconfig/js/content_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ $(document).ready( function() {
$('#dash_currv').html(window.currentVersion);
$('#dash_instance').html(window.serverConfig.general.name);
$('#dash_ports').html(window.serverConfig.flatbufServer.port+' | '+window.serverConfig.protoServer.port);
$('#dash_versionbranch').html(window.serverConfig.general.versionBranch);
$('#dash_versionbranch').html(window.currentChannel);

getReleases(function(callback){
if(callback)
Expand Down
1 change: 1 addition & 0 deletions assets/webconfig/js/content_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ $(document).ready( function() {
window.sysInfo = event.response.info;

window.currentVersion = window.sysInfo.hyperion.version;
window.currentChannel = window.sysInfo.hyperion.channel;
});

$(window.hyperion).one("cmd-config-getschema", function(event) {
Expand Down
1 change: 1 addition & 0 deletions assets/webconfig/js/hyperion.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ window.webPrio = 1;
window.webOrigin = "Web Configuration";
window.showOptHelp = true;
window.gitHubReleaseApiUrl = "https://api.github.com/repos/hyperion-project/hyperion.ng/releases";
window.currentChannel = null;
window.currentVersion = null;
window.latestVersion = null;
window.latestStableVersion = null;
Expand Down
1 change: 0 additions & 1 deletion config/hyperion.config.json.default
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"general" :
{
"name" : "My Hyperion Config",
"versionBranch" : "Stable",
"showOptHelp" : true
},
"logger" :
Expand Down
1 change: 1 addition & 0 deletions libsrc/api/JsonAPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ void JsonAPI::handleSysInfoCommand(const QJsonObject&, const QString& command, c
QJsonObject hyperion;
hyperion["jsonrpc_version" ] = QString(HYPERION_JSON_VERSION);
hyperion["version" ] = QString(HYPERION_VERSION);
hyperion["channel" ] = QString(HYPERION_VERSION_CHANNEL);
hyperion["build" ] = QString(HYPERION_BUILD_ID);
hyperion["time" ] = QString(__DATE__ " " __TIME__);
hyperion["id" ] = _hyperion->getId();
Expand Down
13 changes: 0 additions & 13 deletions libsrc/hyperion/schema/schema-general.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@
"required" : true,
"propertyOrder" : 1
},
"versionBranch" :
{
"type" : "string",
"title" : "edt_conf_gen_versionBranch_title",
"enum" : ["Stable", "Beta"],
"required" : true,
"access" : "expert",
"default" : "Stable",
"options" : {
"enum_titles" : ["Stable", "Beta"]
},
"propertyOrder" : 2
},
"showOptHelp" :
{
"type" : "boolean",
Expand Down

0 comments on commit e6c2e7e

Please sign in to comment.