diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 296da8211b..6439b2aa69 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -57,6 +57,8 @@ jobs: - name: Install Git run: apt-get -y install git - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all tags for generating OLA_BUILD_NAME - name: Install build tools shell: bash run: | diff --git a/.github/workflows/debian.yml b/.github/workflows/debian.yml index 7fff3d801f..91220a2da8 100644 --- a/.github/workflows/debian.yml +++ b/.github/workflows/debian.yml @@ -25,11 +25,36 @@ jobs: # create a .git folder or .git.config. The Problem Matcher looks for # .git/config to find where the root of the repo is, so it must be # present. - - name: Install Git - run: apt-get -y install git + - name: Install Git and lsb-release + run: apt-get -y install git lsb-release - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all tags for generating OLA_BUILD_NAME + - name: Generate build name + shell: bash + run: | + chown root:root . # workaround Git security precaution, see https://github.com/actions/runner-images/issues/6775 + export OLA_BUILD_NAME=$(./scripts/build_name.sh) + # No docker number tag for testing, so must use lsb_release + export OLA_DEBIAN_BUILD_VERSION=$(./scripts/build_name.sh --debian) + + echo "OLA_BUILD_NAME=$OLA_BUILD_NAME" >> $GITHUB_OUTPUT + echo "OLA_BUILD_NAME=$OLA_BUILD_NAME" >> $GITHUB_ENV # Set build name globally so that modifications don't cause -dirty + echo "OLA_DEBIAN_BUILD_VERSION=$OLA_DEBIAN_BUILD_VERSION" >> $GITHUB_OUTPUT + + echo "Build name: $OLA_BUILD_NAME" + echo "Debian Build Version: $OLA_DEBIAN_BUILD_VERSION" + id: generate-build-name - name: Install build tools run: apt-get -y install devscripts adduser fakeroot sudo + - name: Create Debian version for build + shell: bash + run: | + DEBFULLNAME="GitHub Actions" DEBEMAIL=actions@github.com \ + debchange --force-bad-version \ + --newversion ${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }} \ + "GitHub Actions Build \ + ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" - name: Install build dependencies run: mk-build-deps -t "apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends" -i -r - name: Set up build user @@ -38,7 +63,7 @@ jobs: chown -R builduser:builduser . chown builduser:builduser .. - name: Build - run: sudo -u builduser dpkg-buildpackage -b -rfakeroot -j${{ steps.num-cpu-cores.outputs.NUM_CPU_CORES }} + run: sudo -u builduser env "OLA_BUILD_NAME=$OLA_BUILD_NAME" dpkg-buildpackage -v${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }} -b -rfakeroot -j${{ steps.num-cpu-cores.outputs.NUM_CPU_CORES }} - name: Move built files if: always() run: | @@ -56,7 +81,7 @@ jobs: - uses: actions/upload-artifact@v4 if: always() with: - name: ola-built-debian-${{ matrix.image_tag }}-${{ matrix.architecture }} + name: ola-built-debian-${{ matrix.image_tag }}-${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }}_${{ matrix.architecture }} path: ./built debian-test: name: 'Debian Test ${{ matrix.image_tag }} ${{ matrix.architecture }}' @@ -70,11 +95,26 @@ jobs: architecture: [amd64] container: debian:${{ matrix.image_tag }} steps: - - uses: actions/checkout@master + - name: Update package database + run: apt-get update -y + - name: Install Git and lsb-release + run: apt-get -y install git lsb-release + - uses: actions/checkout@v4 + with: + fetch-depth: 0 # Fetch all tags for generating OLA_DEBIAN_BUILD_VERSION + - name: Generate build name # Job step outputs can't be passed between builds for matrix jobs, so we re-generate + shell: bash + run: | + chown root:root . # workaround Git security precaution, see https://github.com/actions/runner-images/issues/6775 + # No docker number tag for testing, so must use lsb_release + export OLA_DEBIAN_BUILD_VERSION=$(./scripts/build_name.sh --debian) + echo "OLA_DEBIAN_BUILD_VERSION=$OLA_DEBIAN_BUILD_VERSION" >> $GITHUB_OUTPUT + echo "Debian Build Version: $OLA_DEBIAN_BUILD_VERSION" + id: generate-build-name - name: Download build artifact uses: actions/download-artifact@v4 with: - name: ola-built-debian-${{ matrix.image_tag }}-${{ matrix.architecture }} + name: ola-built-debian-${{ matrix.image_tag }}-${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }}_${{ matrix.architecture }} path: built - name: Display structure of artifact files run: ls -alR @@ -88,5 +128,5 @@ jobs: - uses: actions/upload-artifact@v4 if: always() # Always upload the test output, even on failed tests with: - name: ola-test-output-debian-${{ matrix.image_tag }}-${{ matrix.architecture }} + name: ola-test-output-debian-${{ matrix.image_tag }}-${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }}_${{ matrix.architecture }} path: test-output diff --git a/common/base/Flags.cpp b/common/base/Flags.cpp index 201a87ce1b..79de198353 100644 --- a/common/base/Flags.cpp +++ b/common/base/Flags.cpp @@ -291,6 +291,7 @@ void FlagRegistry::DisplayUsage() { */ void FlagRegistry::DisplayVersion() { cout << "OLA " << m_argv0 << " version: " << ola::base::Version::GetVersion() + << ", build: " << ola::base::Version::GetBuildName() << endl; } diff --git a/common/base/Version.cpp b/common/base/Version.cpp index fbb79308ce..a523fe0135 100644 --- a/common/base/Version.cpp +++ b/common/base/Version.cpp @@ -40,6 +40,10 @@ unsigned int Version::GetRevision() { return OLA_VERSION_REVISION; } +string Version::GetBuildName() { + return OLA_BUILD_NAME; +} + string Version::GetVersion() { std::ostringstream str; str << GetMajor() << "." << GetMinor() << "." << GetRevision(); diff --git a/configure.ac b/configure.ac index 3e9e809afe..79c3dfd45c 100644 --- a/configure.ac +++ b/configure.ac @@ -23,6 +23,17 @@ AC_SUBST([ola_revision_version]) OLA_REVISION_VERSION=ola_revision_version AC_SUBST(OLA_REVISION_VERSION) +# Build name is separate because AC_CHECK_PROG must come after AC_INIT +# build_name.sh also checks for Git, but this allows that check to show +# up in ./configure for troubleshooting +AC_CHECK_PROG([git],[git],[yes],[no]) +AM_CONDITIONAL([FOUND_GIT], [test "x$git" = xyes]) +AC_SUBST(OLA_BUILD_NAME) +AC_ARG_VAR([OLA_BUILD_NAME], [Override the build name]) +AS_IF([test "x$OLA_BUILD_NAME" = x], [ + OLA_BUILD_NAME="$(./scripts/build_name.sh)" +]) + # Checks for programs. AC_LANG([C++]) AC_PROG_CXX @@ -1025,6 +1036,7 @@ echo \ "------------------------------------------------------- ${PACKAGE_NAME} Version ${PACKAGE_VERSION} +Build Name: ${OLA_BUILD_NAME} Prefix: '${prefix}' Compiler: '${CXX} ${CXXFLAGS} ${CPPFLAGS}' Linker: '${LD} ${AM_LDFLAGS} ${LIBS}' diff --git a/debian/Makefile.mk b/debian/Makefile.mk index 99b5cae78c..1840398e14 100644 --- a/debian/Makefile.mk +++ b/debian/Makefile.mk @@ -1,7 +1,6 @@ # Debian build files EXTRA_DIST += \ debian/changelog \ - debian/compat \ debian/control \ debian/copyright \ debian/libola-dev.dirs \ @@ -10,20 +9,17 @@ EXTRA_DIST += \ debian/ola-python.dirs \ debian/ola-python.install \ debian/ola-rdm-tests.bash-completion \ - debian/ola-rdm-tests.config \ debian/ola-rdm-tests.dirs \ debian/ola-rdm-tests.install \ - debian/ola-rdm-tests.postinst \ debian/ola-rdm-tests.rdm_test_server.init \ - debian/ola-rdm-tests.templates \ + debian/ola-rdm-tests.rdm_test_server.service \ debian/ola.bash-completion \ - debian/ola.config \ debian/ola.dirs \ debian/ola.docs \ debian/ola.install \ debian/ola.olad.init \ + debian/ola.olad.service \ debian/ola.postinst \ - debian/ola.templates \ debian/ola.udev \ debian/org.openlighting.ola.ola.metainfo.xml \ debian/rules \ diff --git a/debian/changelog b/debian/changelog index c205fcd1b3..f80498397d 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +ola (0.11.0-1) UNRELEASED; urgency=medium + * debian/ola.postinst: add --home parameter to adduser invocation + * This change pulled from Debian by Perry Naseck + https://salsa.debian.org/wouter/ola/-/commit/b9a0e2ab290d64f215891e1d543079dd78e7125e + * Remove debconf usage + * This change pulled from Debian by Perry Naseck + https://salsa.debian.org/wouter/ola/-/commit/6d27c071547426536b6f8f0db193dcfd7a4e5991 + * This change pulled from Debian by Perry Naseck + 191514d233d2300674df7e9c3febb35c2890c50c + + -- Perry Naseck Thu, 20 Apr 2023 18:47:03 -0400 + ola (0.10.9-2) UNRELEASED; urgency=medium * Fix ola-rdm-tests Debian package by patching python shebangs to python3 diff --git a/debian/compat b/debian/compat deleted file mode 100644 index ec635144f6..0000000000 --- a/debian/compat +++ /dev/null @@ -1 +0,0 @@ -9 diff --git a/debian/control b/debian/control index 0fed249b90..cae705cf0a 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: ola Priority: optional Maintainer: Wouter Verhelst Uploaders: RenZO -Build-Depends: debhelper (>= 13), autotools-dev, dh-autoreconf, dh-python, bash-completion, libcppunit-dev, bison, flex, pkg-config, uuid-dev, python3, python3-protobuf, libprotobuf-dev, protobuf-compiler, libprotoc-dev, libusb-1.0-0-dev, libftdi1-dev, liblo-dev, libmicrohttpd-dev, libncurses5-dev, libavahi-client-dev, python3-numpy +Build-Depends: debhelper-compat (= 12), autotools-dev, dh-autoreconf, dh-python, bash-completion, libcppunit-dev, bison, flex, pkg-config, uuid-dev, python3, python3-protobuf, libprotobuf-dev, protobuf-compiler, libprotoc-dev, libusb-1.0-0-dev, libftdi1-dev, liblo-dev, libmicrohttpd-dev, libncurses5-dev, libavahi-client-dev, python3-numpy Standards-Version: 3.9.8 Section: libs Vcs-Git: https://github.com/OpenLightingProject/ola.git diff --git a/debian/ola-rdm-tests.config b/debian/ola-rdm-tests.config deleted file mode 100644 index 857ae8014d..0000000000 --- a/debian/ola-rdm-tests.config +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -e -# ola-rdm-tests package configuration script - -conffile="/etc/default/ola-rdm-tests" - -get_config_file() { - config_field=$1 - db_field=$2 - - if [ -f "$conffile" ] ; then - VALUE="$(grep "^[ ]*$config_field" $conffile | sed -e "s/^$config_field *= *\"\(.*\)\"/\1/g")" - if [ -n "$VALUE" ] ; then - db_set $db_field "$VALUE" - fi - fi -} - -# Source debconf library -- we have a Depends line -# to make sure it is there... -. /usr/share/debconf/confmodule -db_version 2.0 - -if [ "$1" = configure -o "$1" = reconfigure ] ; then - get_config_file RUN_DAEMON ola-rdm-tests/daemon - db_input high ola-rdm-tests/daemon || true - db_go - db_get ola-rdm-tests/daemon -fi - -exit 0 diff --git a/debian/ola-rdm-tests.dirs b/debian/ola-rdm-tests.dirs index ee941365ac..e93c0bbb89 100644 --- a/debian/ola-rdm-tests.dirs +++ b/debian/ola-rdm-tests.dirs @@ -1,3 +1,4 @@ +etc/ola usr/bin usr/lib usr/share diff --git a/debian/ola-rdm-tests.postinst b/debian/ola-rdm-tests.postinst deleted file mode 100644 index 31acfe3642..0000000000 --- a/debian/ola-rdm-tests.postinst +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/sh -e -# postinst script for ola-rdm-tests - -conffile="/etc/default/ola-rdm-tests" - -update_config_file() { - db_field=$1 - config_field=$2 - - RET=false - db_get $db_field - if [ -n "$RET" ] ; then - if grep -q "^$config_field" $conffile ; then - # keep any admin changes, while replacing the variable content - sed "s/^[ ]*$config_field=\".*\"/$config_field=\"$RET\"/" < $conffile > $conffile.new && - mv $conffile.new $conffile - else - echo "$config_field=\"$RET\"" >> $conffile - fi - fi -} - -# Source debconf library -- we have a Depends line -# to make sure it is there... -. /usr/share/debconf/confmodule -db_version 2.0 - -case "$1" in - configure) - if [ -f $conffile ] ; then - sed -i -e 's/^[ ]*DAEMON/RUN_DAEMON/g' $conffile - else - cat << EOF > $conffile -# Defaults for ola-rdm-tests initscript (/etc/init.d/ola-rdm-tests) -# This is a POSIX shell fragment - -# [automatically edited by postinst, do not change line format ] - -# ola-rdm-tests daemon switch. If set to true, rdm_test_server.py will run. -RUN_DAEMON="true" -EOF - fi - - update_config_file ola-rdm-tests/daemon RUN_DAEMON - - db_stop - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/ola-rdm-tests.rdm_test_server.init b/debian/ola-rdm-tests.rdm_test_server.init index 942e4dc123..2de22fd769 100644 --- a/debian/ola-rdm-tests.rdm_test_server.init +++ b/debian/ola-rdm-tests.rdm_test_server.init @@ -17,16 +17,11 @@ DAEMON=/usr/bin/$NAME PIDFILE=/var/run/$CMD.pid DESC="OLA RDM Test Server" USER=olad +DAEMON_ARGS="--world-writable" # Reads config file (will override defaults above) [ -r /etc/default/ola-rdm-tests ] && . /etc/default/ola-rdm-tests -if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then - DAEMON_ARGS="--world-writeable" -elif [ "$1" = "start" ] || [ "$1" = "stop" ] ; then - echo "The init script is currently inactive;\nuse \"dpkg-reconfigure ola-rdm-tests\" to change this." >&2 -fi - [ -x "$DAEMON" ] || exit 0 . /lib/lsb/init-functions diff --git a/debian/ola-rdm-tests.rdm_test_server.service b/debian/ola-rdm-tests.rdm_test_server.service new file mode 100644 index 0000000000..08822da83b --- /dev/null +++ b/debian/ola-rdm-tests.rdm_test_server.service @@ -0,0 +1,14 @@ +[Unit] +Description=Open Lighting Architecture RDM Test Server +Documentation=man:olad(1) +After=network.target remote-fs.target olad.service +Wants=olad.service + +[Service] +User=olad +Environment=RDM_TEST_SERVER_OPTS="--world-writable" +EnvironmentFile=-/etc/default/ola-rdm-tests +ExecStart=/usr/bin/rdm_test_server.py $RDM_TEST_SERVER_OPTS + +[Install] +WantedBy=multi-user.target diff --git a/debian/ola-rdm-tests.templates b/debian/ola-rdm-tests.templates deleted file mode 100644 index 861ca0782a..0000000000 --- a/debian/ola-rdm-tests.templates +++ /dev/null @@ -1,10 +0,0 @@ -Template: ola-rdm-tests/daemon -Type: boolean -Default: false -Description: Do you want to start the OLA RDM Test Server at boot time? - The OLA RDM Test Server is needed to run RDM Responder Tests. - . - You have the option of starting the OLA RDM Test Server automatically on - system boot. - . - This setting can be modified later by running 'dpkg-reconfigure ola-rdm-tests'. diff --git a/debian/ola.config b/debian/ola.config deleted file mode 100644 index ab0f9d9b68..0000000000 --- a/debian/ola.config +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -e -# ola package configuration script - -conffile="/etc/default/ola" - -get_config_file() { - config_field=$1 - db_field=$2 - - if [ -f "$conffile" ] ; then - VALUE="$(grep "^[ ]*$config_field" $conffile | sed -e "s/^$config_field *= *\"\(.*\)\"/\1/g")" - if [ -n "$VALUE" ] ; then - db_set $db_field "$VALUE" - fi - fi -} - -# Source debconf library -- we have a Depends line -# to make sure it is there... -. /usr/share/debconf/confmodule -db_version 2.0 - -if [ "$1" = configure -o "$1" = reconfigure ] ; then - get_config_file RUN_DAEMON ola/daemon - db_input high ola/daemon || true - db_go - db_get ola/daemon -fi - -exit 0 diff --git a/debian/ola.dirs b/debian/ola.dirs index 2d4f2c89fe..e18bd51764 100644 --- a/debian/ola.dirs +++ b/debian/ola.dirs @@ -1,3 +1,4 @@ +etc/ola usr/bin usr/lib usr/share/olad/www diff --git a/debian/ola.olad.init b/debian/ola.olad.init index 7865345638..c7c7f27145 100644 --- a/debian/ola.olad.init +++ b/debian/ola.olad.init @@ -17,16 +17,13 @@ PIDFILE=/var/run/$NAME.pid DESC="OLA daemon" USER=olad LOG_LEVEL=3 -CONFIG_DIR="/var/lib/ola/conf" +CONFIG_DIR="/etc/ola" +OLAD_OPTS="" # Reads config file (will override defaults above) [ -r /etc/default/ola ] && . /etc/default/ola -if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then - DAEMON_ARGS="--syslog --log-level $LOG_LEVEL --config-dir $CONFIG_DIR" -elif [ "$1" = "start" ] || [ "$1" = "stop" ] ; then - echo "The init script is currently inactive;\nuse \"dpkg-reconfigure ola\" to change this." >&2 -fi +DAEMON_ARGS="--syslog --log-level $LOG_LEVEL --config-dir $CONFIG_DIR $OLAD_OPTS" [ -x "$DAEMON" ] || exit 0 @@ -43,12 +40,10 @@ case "$1" in ;; stop) # master switch - if [ "$RUN_DAEMON" = "true" ] || [ "$RUN_DAEMON" = "yes" ] ; then - log_daemon_msg "Stopping $DESC" "$NAME" - /sbin/start-stop-daemon --stop --pidfile $PIDFILE --chuid $USER --exec $DAEMON --retry 10 - /bin/rm -f $PIDFILE - log_end_msg $? - fi + log_daemon_msg "Stopping $DESC" "$NAME" + /sbin/start-stop-daemon --stop --pidfile $PIDFILE --chuid $USER --exec $DAEMON --retry 10 + /bin/rm -f $PIDFILE + log_end_msg $? ;; reload|force-reload|restart) $0 stop && $0 start diff --git a/debian/ola.olad.service b/debian/ola.olad.service new file mode 100644 index 0000000000..59ccb0e2e2 --- /dev/null +++ b/debian/ola.olad.service @@ -0,0 +1,16 @@ +[Unit] +Description=Open Lighting Architecture daemon +Documentation=man:olad(1) +After=network.target remote-fs.target network-online.target +Wants=network-online.target + +[Service] +User=olad +Environment=LOG_LEVEL=3 +Environment=CONFIG_DIR=/etc/ola +Environment=OLAD_OPTS= +ExecStart=/usr/bin/olad --log-level $LOG_LEVEL --config-dir $CONFIG_DIR $OLAD_OPTS +Restart=on-failure + +[Install] +WantedBy=multi-user.target diff --git a/debian/ola.postinst b/debian/ola.postinst index 8ca980bce3..fd6976c013 100644 --- a/debian/ola.postinst +++ b/debian/ola.postinst @@ -1,74 +1,15 @@ #!/bin/sh -e # postinst script for ola -conffile="/etc/default/ola" - -update_config_file() { - db_field=$1 - config_field=$2 - - RET=false - db_get $db_field - if [ -n "$RET" ] ; then - if grep -q "^$config_field" $conffile ; then - # keep any admin changes, while replacing the variable content - sed "s/^[ ]*$config_field=\".*\"/$config_field=\"$RET\"/" < $conffile > $conffile.new && - mv $conffile.new $conffile - else - echo "$config_field=\"$RET\"" >> $conffile - fi - fi -} - -# Source debconf library -- we have a Depends line -# to make sure it is there... -. /usr/share/debconf/confmodule -db_version 2.0 - -case "$1" in - configure) - if [ -f $conffile ] ; then - sed -i -e 's/^[ ]*DAEMON/RUN_DAEMON/g' $conffile - else - cat << EOF > $conffile -# Defaults for ola initscript (/etc/init.d/ola) -# This is a POSIX shell fragment - -# [automatically edited by postinst, do not change line format ] - -# ola daemon switch. If set to true, olad will run. -RUN_DAEMON="true" -EOF - fi - - update_config_file ola/daemon RUN_DAEMON - - db_stop - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - #create the olad user, add it to groups -getent passwd olad > /dev/null || adduser --system --no-create-home olad +getent passwd olad > /dev/null || adduser --system --home /usr/lib/olad --no-create-home olad getent group olad > /dev/null || addgroup --system olad groups olad | grep dialout > /dev/null || adduser olad dialout groups olad | grep plugdev > /dev/null || adduser olad plugdev # setup the config dir -CONF_DIR=/var/lib/ola -if [ ! -d ${CONF_DIR} ]; then - mkdir -p ${CONF_DIR}; - chown -R olad:olad ${CONF_DIR}; - chmod g+s ${CONF_DIR}; -fi; - +chown -R olad:olad /etc/ola +chmod g+s /etc/ola # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts. diff --git a/debian/ola.templates b/debian/ola.templates deleted file mode 100644 index 96de6cca88..0000000000 --- a/debian/ola.templates +++ /dev/null @@ -1,10 +0,0 @@ -Template: ola/daemon -Type: boolean -Default: false -Description: Do you want to start the OLA daemon at boot time? - The OLA daemon is needed to use OLA. - . - You have the option of starting the OLA daemon automatically on - system boot. - . - This setting can be modified later by running 'dpkg-reconfigure ola'. diff --git a/debian/rules b/debian/rules index 0089ad1080..b4de45045f 100755 --- a/debian/rules +++ b/debian/rules @@ -11,7 +11,7 @@ export VERBOSE=1 %: - dh $@ --parallel --with autotools_dev,autoreconf,bash_completion,python3 + dh $@ --parallel --with bash_completion,python3 override_dh_auto_configure: dh_auto_configure -- --enable-python-libs --enable-rdm-tests CXXFLAGS='-Wno-error=deprecated-declarations -Wno-error=unused-parameter' pythondir='/usr/lib/python3/dist-packages' @@ -20,6 +20,10 @@ override_dh_installinit: dh_installinit -p ola --name=olad dh_installinit -p ola-rdm-tests --name=rdm_test_server +override_dh_installsystemd: + dh_installsystemd -p ola --name=olad + dh_installsystemd -p ola-rdm-tests --name=rdm_test_server + override_dh_makeshlibs: dh_makeshlibs -V diff --git a/include/ola/base/Version.h.in b/include/ola/base/Version.h.in index 3d2201bc1e..067cb0a8e7 100644 --- a/include/ola/base/Version.h.in +++ b/include/ola/base/Version.h.in @@ -27,9 +27,13 @@ namespace ola { namespace base { +#define PRE_QUOTE(s) #s +#define PRE_STR(s) PRE_QUOTE(s) + #define OLA_VERSION_MAJOR @OLA_MAJOR_VERSION@ #define OLA_VERSION_MINOR @OLA_MINOR_VERSION@ #define OLA_VERSION_REVISION @OLA_REVISION_VERSION@ +#define OLA_BUILD_NAME PRE_STR(@OLA_BUILD_NAME@) /** * @class Version ola/base/Version.h @@ -63,6 +67,12 @@ class Version { */ static std::string GetVersion(); + /** + * @brief the build name as a string. + * @return the build name as a string. + */ + static std::string GetBuildName(); + /** * @brief Check the running version is newer than or equal to a specific * version. diff --git a/javascript/ola/common/server_stats.js b/javascript/ola/common/server_stats.js index cd63dee6bc..0219450967 100644 --- a/javascript/ola/common/server_stats.js +++ b/javascript/ola/common/server_stats.js @@ -76,6 +76,7 @@ ola.common.ServerStats.prototype.updateServerInfo_ = function(e) { goog.dom.$('server_mac').innerHTML = e.server_info['hw_address']; goog.dom.$('server_instance_name').innerHTML = e.server_info['instance_name']; goog.dom.$('server_version').innerHTML = e.server_info['version']; + goog.dom.$('server_build').innerHTML = e.server_info['build']; goog.dom.$('server_uptime').innerHTML = e.server_info['up_since']; if (!e.server_info['quit_enabled']) { diff --git a/olad/Olad.cpp b/olad/Olad.cpp index cf1927a285..a4a16d5ff9 100644 --- a/olad/Olad.cpp +++ b/olad/Olad.cpp @@ -95,7 +95,8 @@ int main(int argc, char *argv[]) { ola::ParseFlags(&argc, argv); ola::InitLoggingFromFlags(); - OLA_INFO << "OLA Daemon version " << ola::base::Version::GetVersion(); + OLA_INFO << "OLA Daemon version " << ola::base::Version::GetVersion() + << " build " << ola::base::Version::GetBuildName(); #ifndef OLAD_SKIP_ROOT_CHECK uid_t uid; diff --git a/olad/OladHTTPServer.cpp b/olad/OladHTTPServer.cpp index 812684ffed..86298cf644 100644 --- a/olad/OladHTTPServer.cpp +++ b/olad/OladHTTPServer.cpp @@ -462,6 +462,7 @@ int OladHTTPServer::JsonServerStats(const HTTPRequest*, json.Add("hw_address", m_interface.hw_address.ToString()); #endif // OLA_SCREENSHOT_MODE json.Add("version", ola::base::Version::GetVersion()); + json.Add("build", ola::base::Version::GetBuildName()); json.Add("up_since", start_time_str); json.Add("quit_enabled", m_enable_quit); diff --git a/olad/www/mobile.html b/olad/www/mobile.html index 2e32fc3d00..54c3fa8ce8 100644 --- a/olad/www/mobile.html +++ b/olad/www/mobile.html @@ -424,6 +424,9 @@ Version
+ + Build
+ Started
diff --git a/olad/www/mobile.js b/olad/www/mobile.js index ffa0a30781..f418a76344 100644 --- a/olad/www/mobile.js +++ b/olad/www/mobile.js @@ -146,7 +146,7 @@ function Sg(a,b){var c=gf(b.target);fe(a.Yb);var d=a.Yb.element;d.innerHTML="";i "Save"),S(h,d),K(h,"action",function(){Tg(this)},!1,a));a.Vd=c.items}} function Tg(a){for(var b=a.Vd,c=b.length,d=P(a.za.id()),h="",g=0;g "+(o-1));return}o=b[g].max;if(o!=k&&n>o){a.Dd("Invalid Value",b[g].description+" must be < "+(o+1));return}h+=j+"="+l+"&"}else if(b[g].type=="string")l=d.elements[j].value,h+=j+"="+l+"&"; else if(b[g].type=="bool")h+=j+"="+(b[g].object.vb()?"1":"0")+"&";else if(b[g].type=="select")l=b[g].object.qb(),l=b[g].value[l].value,h+=j+"="+l+"&"}Df(a.J,a.Aa,a.Ib,a.za.id(),a.za.hint(),h,function(b){b=gf(b.target);b.error?alert(b.error):Rg(a)})};function Ug(){var a=sf.p();K(a,"server_info_change",this.gf,!1,this);xf(a)}Ug.prototype.title=r("Home");Ug.prototype.blur=aa();Ug.prototype.update=function(){xf(sf.p())}; -Ug.prototype.gf=function(a){P("server_hostname").innerHTML=a.Ma.hostname;P("server_ip").innerHTML=a.Ma.ip;P("server_broadcast").innerHTML=a.Ma.broadcast;P("server_mac").innerHTML=a.Ma.hw_address;P("server_instance_name").innerHTML=a.Ma.instance_name;P("server_version").innerHTML=a.Ma.version;P("server_uptime").innerHTML=a.Ma.up_since;if(!a.Ma.quit_enabled&&(a=P("stop_button")))a.style.display="none"};function Vg(a){this.ia=a;this.Bd=[];this.enabled=this.ke=!1;this.ec=k}Vg.prototype.O=function(a,b){this.enabled=a;this.ec=b;if(this.enabled){if(!this.ke){for(var c=0;c<512;++c){var d=Q("div");d.title="Channel "+(c+1);var h=Q("div");h.innerHTML=c+1;var g=Q("span");g.innerHTML=" ";d.appendChild(h);d.appendChild(g);this.ia.appendChild(d);this.Bd.push(g)}this.ke=!0}Wg(this)}};function Wg(a){a.enabled&&Ff(sf.p(),a.ec,function(b){Xg(a,b.dmx)})} +Ug.prototype.gf=function(a){P("server_hostname").innerHTML=a.Ma.hostname;P("server_ip").innerHTML=a.Ma.ip;P("server_broadcast").innerHTML=a.Ma.broadcast;P("server_mac").innerHTML=a.Ma.hw_address;P("server_instance_name").innerHTML=a.Ma.instance_name;P("server_version").innerHTML=a.Ma.version;P("server_build").innerHTML=a.Ma.build;P("server_uptime").innerHTML=a.Ma.up_since;if(!a.Ma.quit_enabled&&(a=P("stop_button")))a.style.display="none"};function Vg(a){this.ia=a;this.Bd=[];this.enabled=this.ke=!1;this.ec=k}Vg.prototype.O=function(a,b){this.enabled=a;this.ec=b;if(this.enabled){if(!this.ke){for(var c=0;c<512;++c){var d=Q("div");d.title="Channel "+(c+1);var h=Q("div");h.innerHTML=c+1;var g=Q("span");g.innerHTML=" ";d.appendChild(h);d.appendChild(g);this.ia.appendChild(d);this.Bd.push(g)}this.ke=!0}Wg(this)}};function Wg(a){a.enabled&&Ff(sf.p(),a.ec,function(b){Xg(a,b.dmx)})} function Xg(a,b){for(var c=Math.min(512,b.length),d=0;d90?"#ffffff":"#000000"}function Zg(a,b){var c=a.Bd[b];if(c!=k)c.innerHTML=" ",c.style.background="#ffffff"};function $g(){this.Zd=new ae("monitor_frame");this.K=new ae("monitor_universe_frame");this.H();this.Zb();this.J=sf.p();K(this.J,"universe_list_change",this.fc,!1,this);this.Yd=new Vg(P("monitor_frame"))}s=$g.prototype;s.title=r("DMX Monitor");s.blur=function(){this.Yd.O(!1,k)};s.Zb=function(){this.aa=k};s.H=function(){ce(this.Zd);ce(this.K)};s.update=function(){this.H();this.Zb();ee(this.K);be(this.K);zf(this.J)}; s.fc=function(a){if(this.aa==k){fe(this.K);var b=new Z;S(b,this.K.element);var c=this;this.aa=new Pd(b,new Mg(function(a){c.Db(a.id(),a.name())}))}for(var b=[],d=0;d512)return!1}d=c[2];if(d!=k&&d!=""&&(d=eh(c[2]),d==k||d==0||d>512))return!1;d=c[3];return d!=k&&d!=""&&(c=eh(c[3]),c==k||c>255)?!1:!0}function eh(a){if(!(a==m||a==k))return a=parseInt(a),isNaN(a)?k:a}function dh(a){a=a.replace(">","THRU");a=a.replace("*","1 THRU 512");a=a.replace("ALL","1 THRU 512");a=a.replace("@ +","@ 255");return a=a.replace("@ FULL","@ 255")};function fh(a,b){this.ec=b;this.ee=new bh;this.Bb=Q("table");var c=Q("caption");c.innerHTML=a;this.Bb.appendChild(c);gh(this);c="7,8,9, THRU ,4,5,6, @ ,1,2,3,FULL,0,ENTER".split(",");for(i=0;i<3;++i){var d=Q("tr");for(x=0;x<4;++x){var h=Q("td"),g=hh(this,c[i*4+x]);S(g,h);d.appendChild(h)}this.Bb.appendChild(d)}Q("tr");d=Q("td");g=hh(this,c[12]);S(g,d);this.Bb.appendChild(d);d=Q("td");g=hh(this,c[13]);S(g,d);d.colSpan="3";this.Bb.appendChild(d)} diff --git a/olad/www/new/views/overview.html b/olad/www/new/views/overview.html index c17021af3c..08d2198528 100644 --- a/olad/www/new/views/overview.html +++ b/olad/www/new/views/overview.html @@ -34,6 +34,10 @@

{{Info.instance_name}}

Version: {{Info.version}} + + Build: + {{Info.build}} + Configuration Directory: {{Info.config_dir}} diff --git a/olad/www/ola.html b/olad/www/ola.html index 7dfc34187a..c9550713c6 100644 --- a/olad/www/ola.html +++ b/olad/www/ola.html @@ -783,6 +783,9 @@ Version
+ + Build
+ Started
diff --git a/olad/www/ola.js b/olad/www/ola.js index 67e12702b5..c6a04ab2e6 100644 --- a/olad/www/ola.js +++ b/olad/www/ola.js @@ -289,7 +289,7 @@ p.qe=function(a,b){var c=this.Fd[a];if(c!=j){c.innerHTML=b;var d=255-b;c.style.b function al(a){ah(W.c(),a.J,function(b){a.$c.setData(b.dmx);a.ee=!1;a.ha()&&a.bh.start()})}$k.prototype.xh=function(){if(!this.ee){this.ee=!0;var a=this.$c.getData(),b=this;bh(W.c(),this.J,a,function(){b.ee=!1})}};function bl(a,b){this.element=N(a);this.Bg=b;this.Ab=j;this.kb=new Yj(N(a+"_tab_pane"));ak(this.kb,new bk(N("tab_page_1"),"Settings"));ak(this.kb,new bk(N("tab_page_2"),"RDM"));ak(this.kb,new bk(N("tab_page_3"),"RDM Patcher"));ak(this.kb,new bk(N("tab_page_4"),"DMX Monitor"));ak(this.kb,new bk(N("tab_page_5"),"DMX Console"));this.Aa=[];this.Aa.push(new Tj("tab_page_1",function(){b.Hd()}));this.kb.xa(1);this.Aa.push(new pk("tab_page_2"));this.kb.xa(0);this.Aa.push(new tj("tab_page_3"));this.Aa.push(new Aj("tab_page_4")); this.Aa.push(new $k("tab_page_5"));F(this.kb,"change",this.Mi,!1,this);var c=W.c();F(c,"universe_list_change",this.Yj,!1,this)}w(bl,Xj);function cl(a){var b=N("ola-splitpane-content"),b=Md(b);a.Aa[a.kb.Ub()].lc(b)}bl.prototype.Pa=function(a,b){if(this.Ab!=a){for(var c=0;c /dev/null; then + OLA_BUILD_NAME=$(git describe --abbrev=7 --dirty --always --tags 2> /dev/null || echo 'unknown-out-of-tree') +else + OLA_BUILD_NAME='unknown' +fi + +if [ "$1" = "--debian" ]; then + OLA_DEBIAN_BUILD_VERSION_SUFFIX_VER=$(lsb_release --short --release) + OLA_DEBIAN_BUILD_VERSION_SUFFIX=$([[ "$OLA_DEBIAN_BUILD_VERSION_SUFFIX_VER" != "n/a" ]] && printf "+deb$OLA_DEBIAN_BUILD_VERSION_SUFFIX_VER") + head -n 1 debian/changelog | sed -E "s/ola \((.+)-([0-9]+)\).*/\1~git-$OLA_BUILD_NAME-\2$OLA_DEBIAN_BUILD_VERSION_SUFFIX/" +else + echo $OLA_BUILD_NAME +fi