Return-Path: X-Original-To: apmail-incubator-bigtop-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-bigtop-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3125DDA56 for ; Mon, 17 Sep 2012 18:00:40 +0000 (UTC) Received: (qmail 82828 invoked by uid 500); 17 Sep 2012 18:00:40 -0000 Delivered-To: apmail-incubator-bigtop-commits-archive@incubator.apache.org Received: (qmail 82761 invoked by uid 500); 17 Sep 2012 18:00:39 -0000 Mailing-List: contact bigtop-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: bigtop-dev@incubator.apache.org Delivered-To: mailing list bigtop-commits@incubator.apache.org Received: (qmail 82749 invoked by uid 99); 17 Sep 2012 18:00:39 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Sep 2012 18:00:39 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 17 Sep 2012 18:00:37 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 71C38238896F; Mon, 17 Sep 2012 17:59:54 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1386754 - in /incubator/bigtop/trunk/bigtop-packages/src: common/hue/ deb/hue/ rpm/hue/SOURCES/ rpm/hue/SPECS/ Date: Mon, 17 Sep 2012 17:59:53 -0000 To: bigtop-commits@incubator.apache.org From: rvs@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120917175954.71C38238896F@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: rvs Date: Mon Sep 17 17:59:53 2012 New Revision: 1386754 URL: http://svn.apache.org/viewvc?rev=1386754&view=rev Log: BIGTOP-688. improve hue packaging via making virtual env relocatable and moving DB files into /var/lib/hue Modified: incubator/bigtop/trunk/bigtop-packages/src/common/hue/do-component-build incubator/bigtop/trunk/bigtop-packages/src/common/hue/install_hue.sh incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.postinst.tpl incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.prerm.tpl incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.install incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.postinst incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-server.hue.init incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SPECS/hue.spec Modified: incubator/bigtop/trunk/bigtop-packages/src/common/hue/do-component-build URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/common/hue/do-component-build?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/common/hue/do-component-build (original) +++ incubator/bigtop/trunk/bigtop-packages/src/common/hue/do-component-build Mon Sep 17 17:59:53 2012 @@ -19,3 +19,6 @@ set -ex mvn -f maven/pom.xml clean install "$@" make apps + +# Make the entire tree relocatable +bash tools/relocatable.sh Modified: incubator/bigtop/trunk/bigtop-packages/src/common/hue/install_hue.sh URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/common/hue/install_hue.sh?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/common/hue/install_hue.sh (original) +++ incubator/bigtop/trunk/bigtop-packages/src/common/hue/install_hue.sh Mon Sep 17 17:59:53 2012 @@ -92,6 +92,8 @@ BUILD_DIR=`echo $BUILD_DIR | sed -e 's#/ CONF_DIR=${CONF_DIR:-/etc/hue} LIB_DIR=${LIB_DIR:-/usr/lib/hue} +VAR_DIR=${VAR_DIR:-/var/lib/hue} +LOG_DIR=${LOG_DIR:-/var/log/hue} HADOOP_DIR=${HADOOP_DIR:-/usr/lib/hadoop/lib} BUNDLED_BUILD_DIR=$PREFIX/$LIB_DIR/build @@ -99,11 +101,6 @@ BUNDLED_BUILD_DIR=$PREFIX/$LIB_DIR/build # Install all the files (cd $BUILD_DIR ; PREFIX=`dirname $PREFIX/$LIB_DIR` make install) -# Install conf files -install -d -m 0755 $PREFIX/$CONF_DIR -mv -f $PREFIX/$LIB_DIR/desktop/conf $PREFIX/${CONF_DIR}/conf.empty -ln -fs $CONF_DIR/conf $PREFIX/$LIB_DIR/desktop/conf - # Install plugins install -d -m 0755 $PREFIX/$HADOOP_DIR ln -fs $LIB_DIR/desktop/libs/hadoop/java-lib/*plugin*jar $PREFIX/$HADOOP_DIR @@ -112,8 +109,45 @@ ln -fs $LIB_DIR/desktop/libs/hadoop/java install -d -m 0755 $PREFIX/$LIB_DIR/apps/shell/src/shell/build/ cp -f $BUILD_DIR/apps/shell/src/shell/build/setuid $PREFIX/$LIB_DIR/apps/shell/src/shell/build -# Remove Hue database -rm -f $PREFIX/$LIB_DIR/desktop/desktop.db +# Remove Hue database and then recreate it, but with just the "right" apps +rm -f $PREFIX/$LIB_DIR/desktop/desktop.db $PREFIX/$LIB_DIR/app.reg +# FIXME: jobbrowser HUE-10 +APPS="about filebrowser help jobsub proxy useradmin shell" +export DESKTOP_LOG_DIR=$BUILD_DIR +export DESKTOP_LOGLEVEL=WARN +export ROOT=$PREFIX/$LIB_DIR +for app in $APPS ; do + (cd $PREFIX/$LIB_DIR ; ./build/env/bin/python tools/app_reg/app_reg.py --install apps/$app) +done +find $PREFIX/$LIB_DIR -iname \*.py[co] -exec rm -f {} \; + +# Making the resulting tree relocatable +(cd $PREFIX/$LIB_DIR ; bash tools/relocatable.sh) + +# Move desktop.db to a var location +install -d -m 0755 $PREFIX/$VAR_DIR +mv $PREFIX/$LIB_DIR/desktop/desktop.db $PREFIX/$VAR_DIR + +# Install conf files +install -d -m 0755 $PREFIX/$CONF_DIR +mv -f $PREFIX/$LIB_DIR/desktop/conf $PREFIX/${CONF_DIR}/conf.empty +ln -fs $CONF_DIR/conf $PREFIX/$LIB_DIR/desktop/conf +sed -i -e '/\[\[database\]\]/a\ + engine=sqlite3\ + name=/var/lib/hue/desktop.db' $PREFIX/${CONF_DIR}/conf.empty/hue.ini +sed -i -e '/\[\[yarn_clusters\]\]/,+20s@## submit_to=False@submit_to=True@' \ + $PREFIX/${CONF_DIR}/conf.empty/hue.ini +# Fix a redirection, since by default beeswax is not installed +sed -i -e '/meta http-equiv="refresh"/s#/beeswax#/about#' \ + $PREFIX/$LIB_DIR/desktop/core/src/desktop/templates/index.mako + +# Relink logs subdirectory just in case +install -d -m 0755 $PREFIX/$LOG_DIR +rm -rf $PREFIX/$LIB_DIR/desktop/logs +ln -s $LOG_DIR $PREFIX/$LIB_DIR/desktop/logs + +# Make binary scripts executables +chmod 755 $BUNDLED_BUILD_DIR/env/bin/* # Preparing filtering command SED_FILT="-e s|$PREFIX|| -e s|$BUILD_DIR|$LIB_DIR|" @@ -130,9 +164,12 @@ for sm in $BUNDLED_BUILD_DIR/env/lib*; d done # Fix broken python scripts +ALL_PTH_BORKED=`find $PREFIX -iname "*.pth"` +ALL_REG_BORKED=`find $PREFIX -iname "app.reg"` +ALL_PYTHON_BORKED=`find $PREFIX -iname "*.egg-link"` HUE_BIN_SCRIPTS=$BUNDLED_BUILD_DIR/env/bin/* HUE_EGG_SCRIPTS=$BUNDLED_BUILD_DIR/env/lib*/python*/site-packages/*/EGG-INFO/scripts/* -for file in $HUE_BIN_SCRIPTS $HUE_EGG_SCRIPTS; +for file in $HUE_BIN_SCRIPTS $HUE_EGG_SCRIPTS $ALL_PTH_BORKED $ALL_REG_BORKED $ALL_PYTHON_BORKED ; do if [ -f ${file} ] then @@ -140,16 +177,5 @@ do fi done -# Make binary scripts executables -chmod 755 $BUNDLED_BUILD_DIR/env/bin/* - # Remove bogus files rm -fv `find $PREFIX -iname "build_log.txt"` - -ALL_PTH_BORKED=`find $PREFIX -iname "*.pth"` -ALL_REG_BORKED=`find $PREFIX -iname "app.reg"` -ALL_PYTHON_BORKED=`find $PREFIX -iname "*.egg-link"` -for file in $ALL_PTH_BORKED $ALL_REG_BORKED $ALL_PYTHON_BORKED; -do - sed -i $SED_FILT ${file} -done Modified: incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.postinst.tpl URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.postinst.tpl?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.postinst.tpl (original) +++ incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.postinst.tpl Mon Sep 17 17:59:53 2012 @@ -30,8 +30,6 @@ set -e # the debian-policy package APP=@APP@ -USER=hue -DO="su $USER -s /bin/bash -c" export ROOT=/usr/lib/hue APP_DIR=$ROOT/apps/$APP export DESKTOP_LOGLEVEL=WARN @@ -39,9 +37,9 @@ export DESKTOP_LOG_DIR=/var/log/hue case "$1" in configure) - chown -R ${USER}:${USER} $APP_DIR - $DO "cd $ROOT; $ROOT/build/env/bin/python $ROOT/tools/app_reg/app_reg.py --remove $APP" ||: - $DO "cd $ROOT; $ROOT/build/env/bin/python $ROOT/tools/app_reg/app_reg.py --install $APP_DIR" + (cd $ROOT; $ROOT/build/env/bin/python $ROOT/tools/app_reg/app_reg.py --remove $APP) ||: + (cd $ROOT; $ROOT/build/env/bin/python $ROOT/tools/app_reg/app_reg.py --install $APP_DIR) + chown -R hue:hue /var/log/hue /var/lib/hue ;; abort-upgrade|abort-remove|abort-deconfigure) Modified: incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.prerm.tpl URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.prerm.tpl?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.prerm.tpl (original) +++ incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-app.prerm.tpl Mon Sep 17 17:59:53 2012 @@ -29,8 +29,6 @@ set -e # the debian-policy package APP=@APP@ -USER=hue -DO="su $USER -s /bin/bash -c" export ROOT=/usr/lib/hue APP_DIR=$ROOT/apps/$APP export DESKTOP_LOGLEVEL=WARN @@ -41,10 +39,11 @@ app_reg="$ROOT/tools/app_reg/app_reg.py" case "$1" in remove|upgrade|deconfigure) if test -e $app_reg -a -e $env_python ; then - $DO "$env_python $app_reg --remove $APP" ||: + $env_python $app_reg --remove $APP ||: fi find $APP_DIR -name \*.py[co] -exec rm -f {} \; ||: find $APP_DIR -name \*.egg-info -prune -exec rm -Rf {} \; ||: + chown -R hue:hue /var/log/hue /var/lib/hue ;; failed-upgrade) Modified: incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.install URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.install?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.install (original) +++ incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.install Mon Sep 17 17:59:53 2012 @@ -1,4 +1,5 @@ /etc/hue/conf.empty +/usr/lib/hue/app.reg /usr/lib/hue/desktop /usr/lib/hue/ext /usr/lib/hue/LICENSE.txt @@ -24,3 +25,5 @@ /usr/lib/hue/apps/proxy /usr/lib/hue/apps/shell /usr/lib/hue/apps/useradmin +/var/log/hue +/var/lib/hue Modified: incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.postinst URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.postinst?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.postinst (original) +++ incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-common.postinst Mon Sep 17 17:59:53 2012 @@ -33,46 +33,14 @@ set -e # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package -USER=hue -DO="su $USER -s /bin/bash -c" -# FIXME: jobbrowser HUE-10 -APPS="about filebrowser help jobsub proxy useradmin shell" - -# We dont want ugly printouts of status during -# install, etc -export DESKTOP_LOGLEVEL=WARN -export DESKTOP_LOG_DIR=/var/log/hue -export ROOT=/usr/lib/hue - -mkdir -p $DESKTOP_LOG_DIR -touch $DESKTOP_LOG_DIR/access.log -touch $DESKTOP_LOG_DIR/error.log -touch $DESKTOP_LOG_DIR/kt_renewer.log -touch $DESKTOP_LOG_DIR/kt_renewer.out -touch $DESKTOP_LOG_DIR/runcpserver.log -touch $DESKTOP_LOG_DIR/runcpserver.out -touch $DESKTOP_LOG_DIR/shell_input.log -touch $DESKTOP_LOG_DIR/shell_output.log -touch $DESKTOP_LOG_DIR/supervisor.log -touch $DESKTOP_LOG_DIR/supervisor.out -chown -R $USER:$USER $DESKTOP_LOG_DIR - case "$1" in configure) + # tweak permissions + chown -R hue:hue /var/log/hue /var/lib/hue + # Install config alternatives update-alternatives --install /etc/hue/conf hue-conf /etc/hue/conf.empty 30 - chown $USER $ROOT - cd $ROOT - chown $USER * - chown -R $USER apps - chown -R $USER build - chown -R $USER ext - chown -R $USER tools - chown -R $USER desktop - rm -f .installed.cfg build/env/stamp - find . -name \*.pyc -exec rm {} \; - $DO "make desktop" 2>&1 > /dev/null # If we're upgrading, copy their backed up db from the old version # and syncdb. if [ ! -z "$2" ]; then @@ -82,18 +50,11 @@ case "$1" in cp $OLD_DB /usr/share/hue/desktop/desktop.db fi fi - $DO "./build/env/bin/hue syncdb --noinput" - - - for app in $APPS ; do - APP_DIR=$ROOT/apps/$app - chown -R hue:hue $APP_DIR - $DO "cd $ROOT; $ROOT/build/env/bin/python $ROOT/tools/app_reg/app_reg.py --install $APP_DIR" - done # Take care of hue-shell setuid binary - chown root:hue $APP_DIR/src/shell/build/setuid - chmod 4750 $APP_DIR/src/shell/build/setuid + SETUID=/usr/lib/hue/apps/shell/src/shell/build/setuid + chown root:hue $SETUID + chmod 4750 $SETUID ;; abort-upgrade|abort-remove|abort-deconfigure) Modified: incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-server.hue.init URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-server.hue.init?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-server.hue.init (original) +++ incubator/bigtop/trunk/bigtop-packages/src/deb/hue/hue-server.hue.init Mon Sep 17 17:59:53 2012 @@ -121,7 +121,7 @@ start_server() { chown -R $DAEMONUSER $(dirname $PIDFILE) $LOGDIR ${PYTHON_EGG_CACHE} # dont setuid, since supervisor will drop privileges on its # own - start-stop-daemon --start --quiet --pidfile $PIDFILE \ + PATH=/usr/lib/hue/build/env/bin:$PATH start-stop-daemon --start --quiet --pidfile $PIDFILE \ --exec $DAEMON -- $DAEMON_OPTS errcode=$? return $errcode Modified: incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init (original) +++ incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init Mon Sep 17 17:59:53 2012 @@ -69,7 +69,7 @@ hue_start() { return 0 fi # the supervisor itself will setuid down to $USER - env - $DAEMON $DAEMON_OPTS + env - PATH=/usr/lib/hue/build/env/bin:$PATH $DAEMON $DAEMON_OPTS ret=$? base=$(basename $0) if [ $ret -eq 0 ]; then Modified: incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse (original) +++ incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SOURCES/hue.init.suse Mon Sep 17 17:59:53 2012 @@ -66,7 +66,7 @@ hue_start() { chown -R $USER $dir done - start_daemon -u $USER $DAEMON $DAEMON_OPTS + PATH=/usr/lib/hue/build/env/bin:$PATH start_daemon -u $USER $DAEMON $DAEMON_OPTS RETVAL=$? echo [ $RETVAL -eq 0 ] && touch $LOCKFILE Modified: incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SPECS/hue.spec URL: http://svn.apache.org/viewvc/incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SPECS/hue.spec?rev=1386754&r1=1386753&r2=1386754&view=diff ============================================================================== --- incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SPECS/hue.spec (original) +++ incubator/bigtop/trunk/bigtop-packages/src/rpm/hue/SPECS/hue.spec Mon Sep 17 17:59:53 2012 @@ -92,31 +92,29 @@ AutoReqProv: no # Post macro for apps %define app_post_macro() \ %post -n %{name}-%1 \ -DO="su --shell=/bin/bash -l %{username} -c" \ export ROOT=%{hue_dir} \ export DESKTOP_LOGLEVEL=WARN \ export DESKTOP_LOG_DIR=/var/log/hue \ -chown -R %{username}:%{username} %{hue_dir}/apps/%1 \ if [ "$1" != 1 ] ; then \ echo %{hue_dir}/apps/%1 >> %{hue_dir}/.re_register \ fi \ -$DO "%{hue_dir}/build/env/bin/python %{hue_dir}/tools/app_reg/app_reg.py --install %{apps_dir}/%1" +%{hue_dir}/build/env/bin/python %{hue_dir}/tools/app_reg/app_reg.py --install %{apps_dir}/%1 \ +chown -R hue:hue /var/log/hue /var/lib/hue # Preun macro for apps %define app_preun_macro() \ %preun -n %{name}-%1 \ if [ "$1" = 0 ] ; then \ - DO="su --shell=/bin/bash -l %{username} -c" \ - ENV_PYTHON="%{hue_dir}/build/env/bin/python" \ export ROOT=%{hue_dir} \ export DESKTOP_LOGLEVEL=WARN \ export DESKTOP_LOG_DIR=/var/log/hue \ if [ -e $ENV_PYTHON ] ; then \ - $DO "$ENV_PYTHON %{hue_dir}/tools/app_reg/app_reg.py --remove %1" ||: \ + %{hue_dir}/build/env/bin/python %{hue_dir}/tools/app_reg/app_reg.py --remove %1 ||: \ fi \ find %{apps_dir}/%1 -name \*.egg-info -type f -print0 | xargs -0 /bin/rm -fR \ fi \ -find %{apps_dir}/%1 -iname \*.py[co] -type f -print0 | xargs -0 /bin/rm -f +find %{apps_dir}/%1 -iname \*.py[co] -type f -print0 | xargs -0 /bin/rm -f \ +chown -R hue:hue /var/log/hue /var/lib/hue %description Hue is a browser-based desktop interface for interacting with Hadoop. @@ -190,13 +188,6 @@ It supports a file browser, job tracker getent group %{username} 2>/dev/null >/dev/null || /usr/sbin/groupadd -r %{username} getent passwd %{username} 2>&1 > /dev/null || /usr/sbin/useradd -c "Hue" -s /sbin/nologin -g %{username} -r -d %{hue_dir} %{username} 2> /dev/null || : - -# If there is an old DB in place, make a backup. -if [ -e %{hue_dir}/desktop/desktop.db ]; then - echo "Backing up previous version of Hue database..." - cp -a %{hue_dir}/desktop/desktop.db %{hue_dir}/desktop/desktop.db.rpmsave.$(date +'%Y%m%d.%H%M%S') -fi - ######################################## # Postinstall ######################################## @@ -204,44 +195,11 @@ fi %{alternatives_cmd} --install %{etc_hue} hue-conf %{etc_hue}.empty 30 -cd %{hue_dir} -DO="su --shell=/bin/bash -l %{username} -c" -DESKTOP_LOG_DIR=/var/log/hue -# FIXME: jobbrowser HUE-10 -APPS="about filebrowser help jobsub proxy useradmin shell" - -mkdir -p $DESKTOP_LOG_DIR -chown %{username}:%{username} $DESKTOP_LOG_DIR - -# Set permissions -chown %{username}:%{username} %{hue_dir}/* -chown %{username}:%{username} %{hue_dir}/apps -chown -R %{username}:%{username} %{hue_dir}/ext -chown -R %{username}:%{username} %{hue_dir}/tools -chown -R %{username}:%{username} %{hue_dir}/desktop - -# Force regeneration of the virtual-env -rm -f %{hue_dir}/build/env/stamp - -# Delete all pyc files since they contain the wrong path () -find %{hue_dir} -iname \*.py[co] -exec rm -f {} \; - -# Install everything into the virtual environment -export DESKTOP_LOG_DIR=$DESKTOP_LOG_DIR -export DESKTOP_LOGLEVEL=WARN -# TODO: Should this be in /var/log/hue? -$DO "make desktop" >& %{hue_dir}/build_log.txt - -# Upgrading database... -$DO "build/env/bin/hue syncdb --noinput" - -# Register or core apps -for app in $APPS ; do - $DO "build/env/bin/python tools/app_reg/app_reg.py --install apps/$app" -done - -# Delete all pyc files since they contain the wrong path () -find %{hue_dir} -iname \*.py[co] -exec rm -f {} \; +# If there is an old DB in place, make a backup. +if [ -e %{hue_dir}/desktop/desktop.db ]; then + echo "Backing up previous version of Hue database..." + cp -a %{hue_dir}/desktop/desktop.db %{hue_dir}/desktop/desktop.db.rpmsave.$(date +'%Y%m%d.%H%M%S') +fi %preun -n %{name}-common -p /bin/bash if [ "$1" = 0 ]; then @@ -268,7 +226,7 @@ fi %files -n %{name}-common -%defattr(-,%{username},%{username}) +%defattr(-,root,root) %attr(0755,root,root) %config(noreplace) %{etc_hue}.empty %dir %{hue_dir} %{hue_dir}/desktop @@ -282,13 +240,11 @@ fi %{hue_dir}/README %{hue_dir}/tools %{hue_dir}/VERSION -%attr(0755,%{username},%{username}) %{hue_dir}/build/env/bin/* +%{hue_dir}/build/env/bin/* %{hue_dir}/build/env/include/ %{hue_dir}/build/env/lib*/ %{hue_dir}/build/env/stamp -## We exclude app.reg to prevent it getting overwritten, -## postinstall should generate this -%exclude %{hue_dir}/app.reg +%{hue_dir}/app.reg %{hue_dir}/apps/Makefile %dir %{hue_dir}/apps # Hue core apps @@ -302,7 +258,10 @@ fi %{useradmin_app_dir} %{shell_app_dir} %attr(4750,root,hue) %{shell_app_dir}/src/shell/build/setuid +%attr(0755,%{username},%{username}) /var/log/hue +%attr(0755,%{username},%{username}) /var/lib/hue +# beeswax is packaged as a plugin app %exclude %{beeswax_app_dir} # %exclude %{hadoop_lib} @@ -316,7 +275,6 @@ fi Summary: Service Scripts for Hue Requires: %{name}-common = %{version}-%{release} Requires: /sbin/chkconfig -Requires(pre): %{name} = %{version}-%{release} Group: Applications/Engineering %description -n %{name}-server