Ori.livneh has uploaded a new change for review. https://gerrit.wikimedia.org/r/170443
Change subject: hhvm: make source installation update whenever package is updated ...................................................................... hhvm: make source installation update whenever package is updated Provision a simple helper script, 'install-pkg-src', that installs the source of an installed Debian package into /usr/local/src. Change-Id: Ifd6ac352ce062eb667f1b857e5011e4241585bd6 --- A modules/hhvm/files/install-pkg-src M modules/hhvm/manifests/init.pp D modules/hhvm/templates/install_hhvm_source_files.sh.erb 3 files changed, 47 insertions(+), 10 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/operations/puppet refs/changes/43/170443/1 diff --git a/modules/hhvm/files/install-pkg-src b/modules/hhvm/files/install-pkg-src new file mode 100755 index 0000000..9433e52 --- /dev/null +++ b/modules/hhvm/files/install-pkg-src @@ -0,0 +1,37 @@ +#!/bin/bash +# Shell script to install the source code for an installed Debian +# package into /usr/local/src. +# +# Usage: install-pkg-src [--dry-run] PACKAGE_NAME + +if [ "$1" = "--dry-run" ]; then + dry_run=1 + shift +fi + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 [--dry-run] PACKAGE_NAME" + exit 1 +fi + +pkg="$1" +src_dir="/usr/local/src/${pkg}" +pkg_ver="$(dpkg -s "$pkg" | grep -Po '(?<=Version: ).*')" +src_ver="$(readlink ${src_dir}/.pkg_ver 2>/dev/null)" + +if [ "$pkg_ver" = "$src_ver" ]; then + echo "Already up-to-date." + exit +fi + +echo "Updating source directory to version ${pkg_ver}..." + +if [ ! -n "$dry_run" ]; then + mkdir -p "$src_dir" + tmp_dir="$(/bin/mktemp -qd)" + cd "$tmp_dir" + /usr/bin/apt-get -qq source "$pkg" + /usr/bin/find . -mindepth 1 -maxdepth 1 -type d -exec /usr/bin/rsync -r -a --delete --force {}/ "$src_dir" \; + ln -sf "$pkg_ver" "${src_dir}/.pkg_ver" + /bin/rm -rf "$tmp_dir" +fi diff --git a/modules/hhvm/manifests/init.pp b/modules/hhvm/manifests/init.pp index f307744..ee173cd 100644 --- a/modules/hhvm/manifests/init.pp +++ b/modules/hhvm/manifests/init.pp @@ -200,17 +200,18 @@ before => Service['hhvm'], } - file { '/usr/local/sbin/hhvm-watch-mem': - ensure => absent, - } - # Install HHVM's source files to /usr/local/src/hhvm. - exec { 'install_hhvm_source_files': - command => template('hhvm/install_hhvm_source_files.sh.erb'), - creates => '/usr/local/src/hhvm', - provider => 'shell', - require => Package['dpkg-dev'], + file { '/usr/local/sbin/install-pkg-src': + source => 'puppet:///modules/hhvm/install-pkg-src', + owner => 'root', + group => 'root', + mode => '0555', + } + + exec { '/usr/local/sbin/install-pkg-src hhvm': + unless => '/usr/local/sbin/install-pkg-src --dry-run hhvm | grep -q up-to-date', + require => Package['dpkg-dev', 'hhvm'], } diff --git a/modules/hhvm/templates/install_hhvm_source_files.sh.erb b/modules/hhvm/templates/install_hhvm_source_files.sh.erb deleted file mode 100644 index b74cb6c..0000000 --- a/modules/hhvm/templates/install_hhvm_source_files.sh.erb +++ /dev/null @@ -1 +0,0 @@ -cd `/bin/mktemp -qd` && /usr/bin/apt-get -qq source hhvm && /usr/bin/find . -mindepth 1 -maxdepth 1 -type d -exec /usr/bin/rsync -r -a --delete --force {}/ /usr/local/src/hhvm \; ; /bin/rm -rf `pwd` -- To view, visit https://gerrit.wikimedia.org/r/170443 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifd6ac352ce062eb667f1b857e5011e4241585bd6 Gerrit-PatchSet: 1 Gerrit-Project: operations/puppet Gerrit-Branch: production Gerrit-Owner: Ori.livneh <o...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits