changeset 437:1319ff44979e

wi
author Louis Opter <kalessin@kalessin.fr>
date Sun, 17 Apr 2016 15:14:48 -0700
parents 481c9363b4e6
children 31cc952fc26d
files add_make_release.patch
diffstat 1 files changed, 47 insertions(+), 23 deletions(-) [+]
line wrap: on
line diff
--- a/add_make_release.patch	Sat Apr 16 20:10:51 2016 -0700
+++ b/add_make_release.patch	Sun Apr 17 15:14:48 2016 -0700
@@ -1,30 +1,28 @@
 # HG changeset patch
-# Parent  650d624e451642845f8771c8d69e8386d367a01d
+# Parent  b477e34b34545051d5e8b71dfb28a531739ab953
 Add a release command that can be used from buildbot
 
 diff --git a/CMakeLists.txt b/CMakeLists.txt
 --- a/CMakeLists.txt
 +++ b/CMakeLists.txt
-@@ -24,7 +24,14 @@
- # TODO: we need at least 2.0.19-stable because of the logging defines
- FIND_PACKAGE(Event2 REQUIRED COMPONENTS core)
+@@ -26,6 +26,16 @@
  FIND_PACKAGE(Endian REQUIRED)
-+FIND_PACKAGE(Gzip)
-+FIND_PACKAGE(Hg)
-+SET(Python_ADDITIONAL_VERSIONS 3)
-+FIND_PACKAGE(PythonInterp)
  FIND_PACKAGE(Sphinx)
-+FIND_PACKAGE(BsdTar)
-+FIND_PACKAGE(Virtualenv)
-+FIND_PACKAGE(Xz)
  
++IF (CMAKE_BUILD_TYPE MATCHES RELEASE)
++  FIND_PACKAGE(Gzip)
++  FIND_PACKAGE(Hg)
++  SET(Python_ADDITIONAL_VERSIONS 3)
++  FIND_PACKAGE(PythonInterp)
++  FIND_PACKAGE(BsdTar)
++  FIND_PACKAGE(Virtualenv)
++  FIND_PACKAGE(Xz)
++ENDIF ()
++
  INCLUDE(CheckFunctionExists)
  INCLUDE(CheckVariableExists)
-@@ -89,12 +96,11 @@
- ADD_SUBDIRECTORY(compat)
- ADD_SUBDIRECTORY(core)
- ADD_SUBDIRECTORY(lifx)
-+ADD_SUBDIRECTORY(dist)
+ INCLUDE(TestBigEndian)
+@@ -92,9 +102,7 @@
  
  # 2.8.11 is the first version with TARGET_INCLUDE_DIRECTORIES:
  IF (CMAKE_VERSION VERSION_GREATER 2.8.10)
@@ -35,7 +33,7 @@
      ADD_SUBDIRECTORY(tests)
  ELSE ()
      MESSAGE(
-@@ -105,7 +111,10 @@
+@@ -105,7 +113,14 @@
  ENDIF ()
  
  IF (SPHINX_FOUND)
@@ -43,6 +41,10 @@
      ADD_SUBDIRECTORY(docs)
 +ELSE ()
 +    MESSAGE(STATUS "Shpinx wasn't found, docs generation disabled")
++ENDIF ()
++
++IF (CMAKE_BUILD_TYPE MATCHES RELEASE)
++  ADD_SUBDIRECTORY(dist)
  ENDIF ()
  
  INSTALL(
@@ -103,6 +105,16 @@
 +)
 +
 +FIND_PACKAGE_HANDLE_STANDARD_ARGS(Xz DEFAULT_MSG XZ_EXECUTABLE)
+diff --git a/CMakeScripts/LightsdVersion.cmake b/CMakeScripts/LightsdVersion.cmake
+new file mode 100644
+--- /dev/null
++++ b/CMakeScripts/LightsdVersion.cmake
+@@ -0,0 +1,5 @@
++# NOTE: auto-generated by the release target
++SET(CPACK_PACKAGE_VERSION_MAJOR "1")
++SET(CPACK_PACKAGE_VERSION_MINOR "2")
++SET(CPACK_PACKAGE_VERSION_PATCH "0")
++SET(LIGHTSD_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
 diff --git a/dist/CMakeLists.txt b/dist/CMakeLists.txt
 new file mode 100644
 --- /dev/null
@@ -1018,7 +1030,7 @@
 new file mode 100644
 --- /dev/null
 +++ b/dist/release.py.in
-@@ -0,0 +1,171 @@
+@@ -0,0 +1,183 @@
 +#!/usr/bin/env python3
 +
 +import click
@@ -1028,9 +1040,9 @@
 +import semver
 +import subprocess
 +
++LIGHTSD_VERSION = "@LIGHTSD_VERSION@"
 +# where the lightsd sources are:
 +LIGHTSD_SOURCE_DIR = "@LIGHTSD_SOURCE_DIR@"
-+
 +# where all the downstream repositories are:
 +LIGHTSD_PKGS_DIR = "@LIGHTSD_RELEASE_PACKAGES_DIR@"
 +
@@ -1140,11 +1152,24 @@
 +@click.group(invoke_without_command=True)
 +@click.pass_context
 +def release(ctx):
-+    if ctx.invoked_subcommand is None:
-+        # TODO: developer "make release" flow
-+        click.echo("Not implemented yet :(")
++    if ctx.invoked_subcommand is not None:
 +        return
 +
++    # TODO: developer "make release" flow
++    click.echo("Not implemented yet :(")
++
++    lightsd_version_file = os.path.join(
++        LIGHTSD_SOURCE_DIR, "CMakeScripts", "LightsdVersion.cmake"
++    )
++    with open(lightsd_version_file, "wb") as fp:
++        fp.write("""# NOTE: auto-generated by the release target
++SET(CPACK_PACKAGE_VERSION_MAJOR "{}")
++SET(CPACK_PACKAGE_VERSION_MINOR "{}")
++SET(CPACK_PACKAGE_VERSION_PATCH "{}")
++SET(LIGHTSD_VERSION "${{CPACK_PACKAGE_VERSION_MAJOR}}.${{CPACK_PACKAGE_VERSION_MINOR}}.${{CPACK_PACKAGE_VERSION_PATCH}}")
++""".format()
++    return
++
 +
 +@click.command()
 +# hg log -R … -r "max(tag('re:\d+.\d+.\d+'))" -T "{tags}"
@@ -1176,7 +1201,6 @@
 +    )
 +    for pkg in PACKAGES:
 +        pkg.render(pkg_ctx)
-+        # TODO prendre le message de commit aussi et update la documentation:
 +        pkg.commit("New upstream release {}".format(version))
 +
 +