Mercurial > louis > mq > lightsd
changeset 481:20f25ba1dd1e
wip, release command for makepkg and setup linting
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Sat, 02 Jul 2016 15:42:16 -0700 |
parents | ad196be66ad1 |
children | 32421208e75f |
files | add_release_makepkg.patch series |
diffstat | 2 files changed, 133 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/add_release_makepkg.patch Sat Jul 02 15:42:16 2016 -0700 @@ -0,0 +1,132 @@ +# HG changeset patch +# Parent 59de5ad1300a5a00b68f9a5933789ba6b1d5893f +Add the release_makepkg command and setup linting + +This is easier/cleaner to do this here than on Buildbot right now. + +diff --git a/dist/CMakeLists.txt b/dist/CMakeLists.txt +--- a/dist/CMakeLists.txt ++++ b/dist/CMakeLists.txt +@@ -22,6 +22,7 @@ + package_release + release_new_tag + release_debuild ++ release_makepkg + ) + IF (SPHINX_FOUND) + LIST(APPEND RELEASE_COMMANDS release_docs) +@@ -42,6 +43,7 @@ + SET( + EXTRA_OUTPUT + "${CMAKE_CURRENT_BINARY_DIR}/debuild" # release_debuild ++ "${CMAKE_CURRENT_BINARY_DIR}/makepkg" # release_makepkg + "${CMAKE_CURRENT_BINARY_DIR}/lightsd-${LIGHTSD_VERSION}.tar" # release_new_tag + "${VENV_DIRECTORY}" + "${VENV_STAMP}" +diff --git a/dist/release.py.in b/dist/release.py.in +--- a/dist/release.py.in ++++ b/dist/release.py.in +@@ -27,8 +27,8 @@ + # where to put the generated archives served at + # https://downloads.lightsd.io/releases/: + LIGHTSD_ARCHIVES_DIR = "@LIGHTSD_RELEASE_ARCHIVES_DIR@" +-# where to put generated debian packages +-LIGHTSD_DEBS_DIR = "@LIGHTSD_RELEASE_DEBS_DIR@" ++# where to put generated packages ++LIGHTSD_PKGS_OUT_DIR = "@LIGHTSD_RELEASE_PACKAGES_OUT_DIR@" + # where to manage the documentation served at https://docs.lighsd.io/: + LIGHTSD_DOCS_DIR = "@LIGHTSD_RELEASE_DOCS_DIR@" + +@@ -523,10 +523,11 @@ + + @cli.command() + def release_debuild(): +- if not all([LIGHTSD_DEBS_DIR, LIGHTSD_ARCHIVES_DIR]): ++ if not all([LIGHTSD_PKGS_OUT_DIR, LIGHTSD_ARCHIVES_DIR]): + error_echo( +- "Please configure the project with LIGHTSD_RELEASE_DEBS_DIR " +- "and LIGHTSD_RELEASE_ARCHIVES_DIR to use this command." ++ "Please configure the project with " ++ "LIGHTSD_RELEASE_PACKAGES_OUT_DIR and " ++ "LIGHTSD_RELEASE_ARCHIVES_DIR to use this command." + ) + sys.exit(1) + +@@ -537,6 +538,7 @@ + prereq_echo("Cleaning-up previous build in {}".format(debuild_dir)) + shutil.rmtree(debuild_dir) + os.makedirs(debuild_dir, exist_ok=True) ++ os.makedirs(LIGHTSD_PKGS_OUT_DIR, exist_ok=True) + version = latest_released_version() + build_number = extract_build_number(version) + version = semver.format_version(**version) +@@ -572,15 +574,66 @@ + ) + action_echo("Building {}".format(deb_pkg_name)) + subprocess.check_call(["debuild", "-us", "-uc"], cwd=src_dir) ++ action_echo("Linting {}".format(deb_pkg_name)) ++ deb_pkg_path = os.path.join(debuild_dir, deb_pkg_name) ++ subprocess.check_call(["lintian", deb_pkg_path]) + shutil.copyfile( +- os.path.join(debuild_dir, deb_pkg_name), +- os.path.join(LIGHTSD_DEBS_DIR, deb_pkg_name), ++ deb_pkg_path, os.path.join(LIGHTSD_PKGS_OUT_DIR, deb_pkg_name), + ) + click.echo("[+] Copied {} under {}".format( +- deb_pkg_name, LIGHTSD_DEBS_DIR ++ deb_pkg_name, LIGHTSD_PKGS_OUT_DIR + )) + result_echo("New Debian package {}".format(deb_pkg_name)) + + ++@cli.command() ++def release_makepkg(): ++ if not all([LIGHTSD_PKGS_OUT_DIR, LIGHTSD_ARCHIVES_DIR]): ++ error_echo( ++ "Please configure the project with " ++ "LIGHTSD_RELEASE_PACKAGES_OUT_DIR and " ++ "LIGHTSD_RELEASE_ARCHIVES_DIR to use this command." ++ ) ++ sys.exit(1) ++ ++ # This is just too painful to do from buildbot atm (we need to parametrize ++ # the build with the version): ++ makepkg_dir = os.path.join(LIGHTSD_BINARY_DIR, "dist", "makepkg") ++ if os.path.exists(makepkg_dir): ++ prereq_echo("Cleaning-up previous build in {}".format(makepkg_dir)) ++ shutil.rmtree(makepkg_dir) ++ os.makedirs(makepkg_dir, exist_ok=True) ++ os.makedirs(LIGHTSD_PKGS_OUT_DIR, exist_ok=True) ++ version = latest_released_version() ++ build_number = extract_build_number(version) ++ version = semver.format_version(**version) ++ pkgbuild_src_dir = os.path.join(LIGHTSD_PKGS_DIR, "pkgbuild-lightsd") ++ for src in ("PKGBUILD", "lightsd.install"): ++ shutil.copy(os.path.join(pkgbuild_src_dir, src), makepkg_dir) ++ click.echo("[+] pkgbuild sources copied to {}".format(makepkg_dir)) ++ pkg_arch = subprocess.check_output(["pacman", "-Qi", "pacman"]) ++ pkg_arch = pkg_arch.decode(USER_ENCODING) ++ pkg_arch, = [ ++ line for line in pkg_arch.split("\n") if line.startswith("Architecture") ++ ] ++ _, pkg_arch = pkg_arch.split(":") ++ pkg_arch = pkg_arch.strip() ++ pkg_name = "lightsd-1:{version}-{build_number}-{arch}.pkg.tar.xz".format( ++ version=version.replace("-rc", "~rc"), ++ build_number=build_number, ++ arch=pkg_arch, ++ ) ++ action_echo("Building {}".format(pkg_name)) ++ subprocess.check_call( ++ ["makepkg", "--ignorearch", "--force", "--clean", "--cleanbuild"], ++ cwd=makepkg_dir, ++ ) ++ pkg_path = os.path.join(makepkg_dir, pkg_name) ++ action_echo("Linting {}".format(pkg_name)) ++ subprocess.check_call(["namcap", pkg_path]) ++ shutil.copyfile(pkg_path, os.path.join(LIGHTSD_PKGS_OUT_DIR, pkg_name)) ++ click.echo("[+] Copied {} under {}".format(pkg_name, LIGHTSD_PKGS_OUT_DIR)) ++ result_echo("New Arch Linux package {}".format(pkg_name)) ++ + if __name__ == "__main__": + cli()
--- a/series Sun Jun 26 18:16:37 2016 -0700 +++ b/series Sat Jul 02 15:42:16 2016 -0700 @@ -1,6 +1,7 @@ homebrew_fixes.patch fix_openwrt_docs_examples_installation.patch docker_images.patch +add_release_makepkg.patch add_power_transition.patch open_gateway_on_any_bulb_response.patch #+future make_gateway_write_callbacks_low_priority.patch #+future