AzaToth has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/68485


Change subject: Copying and modifying operations/debs/gerrit into gerrit
......................................................................

Copying and modifying operations/debs/gerrit into gerrit

This commit enables building of gerrit using buck

Change-Id: I9527dbcc29f1c7259128635478c622ddf3a4eb81
---
A debian/changelog
A debian/compat
A debian/control
A debian/copyright
A debian/dirs
A debian/gbp.conf
A debian/gerrit.default
A debian/gerrit.init
A debian/gerrit.postinst
A debian/gerrit.postrm
A debian/install
A debian/rules
A debian/source/format
A debian/source/options
14 files changed, 788 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/gerrit refs/changes/85/68485/1

diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 0000000..8facd0c
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,69 @@
+gerrit (2.7-rc1-424-gef469ac-1) unstable; urgency=low
+
+  * Updating for v2.7-rc1-424-gef469ac
+  * incorporate the debian stuff into the main gerrit repo
+   - branch wmf-debian follows the wmf branch
+  * Fix the maintainence scripts
+  * update control
+
+ -- Carl Fürstenberg <[email protected]>  Thu, 13 Jun 2013 20:58:48 +0200
+
+gerrit (2.6-rc0-322-geeed497-1) precise-wikimedia; urgency=low
+
+  * Updating for 2.6-rc0-322-geeed497
+
+ -- Chad Horohoe <[email protected]>  Fri, 12 Apr 2013 14:24:16 +0000
+
+gerrit (2.6-rc0-144-gb1dadd2-1) precise-wikimedia; urgency=low
+
+  * Updating for 2.6-rc0-144-gb1dadd2
+
+ -- Chad Horohoe <[email protected]>  Thu, 04 Apr 2013 14:15:32 +0000
+
+gerrit (2.6-rc0-76-g52fb5ae-1) precise-wikimedia; urgency=low
+
+  * Updating for 2.6-rc0-76-g52fb5ae
+
+ -- Chad Horohoe <[email protected]>  Thu, 28 Mar 2013 19:15:01 +0000
+
+gerrit (2.5.2-1636-g353e384-1) precise-wikimedia; urgency=low
+
+  * Updating for 2.5.2-1636-g353e384
+
+ -- Chad Horohoe <[email protected]>  Mon, 11 Mar 2013 19:01:24 +0000
+
+gerrit (2.5.2-1506-g278aa9a-1) precise-wikimedia; urgency=low
+
+  * Updating for 2.5.2-1506-g278aa9a
+
+ -- Chad Horohoe <[email protected]>  Thu, 28 Feb 2013 17:32:58 +0000
+
+gerrit (2.5.2-1277-gca0bdda-1) precise-wikimedia; urgency=low
+
+  * Updating for 2.5.2-1277-gca0bdda
+
+ -- Chad Horohoe <[email protected]>  Mon, 12 Jan 2013 18:39:25 +0000
+
+gerrit (2.5.1-1266-gcc231e1-1) precise-wikimedia; urgency=low
+
+  * Updating for 2.5.1-1266-gcc231e1
+
+ -- Chad Horohoe <[email protected]>  Mon, 12 Jan 2013 01:57:38 +0000
+
+gerrit (2.5.1-1264-ged8535a-1) precise-wikimedia; urgency=low
+
+  * Updating for 2.5.1-1264-ged8535a
+
+ -- Chad Horohoe <[email protected]>  Thu, 8 Jan 2012 20:39:20 +0000
+
+gerrit (2.4.2-1) lucid-wikimedia; urgency=low
+
+  * Updating for 2.4.2
+
+ -- Ryan Lane <[email protected]>  Thu, 5 Jul 2012 22:21:21 +0000
+
+gerrit (2.3-1) lucid-wikimedia; urgency=low
+
+  * Initial package
+
+ -- Ryan Lane <[email protected]>  Tue, 1 May 2012 19:07:30 +0000
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 0000000..ec63514
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+9
diff --git a/debian/control b/debian/control
new file mode 100644
index 0000000..92afd0c
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,11 @@
+Source: gerrit
+Section: net
+Priority: extra
+Maintainer: Ryan Lane <[email protected]>
+Build-Depends: debhelper (>= 9.0), javahelper, default-jdk, buck
+Standards-Version: 3.9.3
+
+Package: gerrit
+Depends: ${java:Depends}, ${misc:Depends}, openjdk-6-jre
+Architecture: all
+Description: Gerrit code review system
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 0000000..551a795
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,23 @@
+This package was debianized by Ryan Lane <[email protected]> on
+Tue, 1 May 2012 19:07:30 +0000.
+
+It was downloaded from 
http://code.google.com/p/gerrit/downloads/detail?name=gerrit-2.3.war&can=2&q=
+
+Upstream Author(s):
+
+
+
+Copyright:
+
+    Copyright (C) 2012
+
+License:
+
+    Apache License v2
+
+The Debian packaging is:
+
+    Copyright (C) 2012 Ryan Lane <[email protected]>
+
+and is licensed under the GPL version 2,
+see `/usr/share/common-licenses/GPL-2'.
diff --git a/debian/dirs b/debian/dirs
new file mode 100644
index 0000000..2639f4f
--- /dev/null
+++ b/debian/dirs
@@ -0,0 +1 @@
+var/lib/gerrit2
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..29bb01c
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,4 @@
+[DEFAULT]
+pristine-tar = False
+debian-branch=wmf-debian
+upstream-branch=wmf
diff --git a/debian/gerrit.default b/debian/gerrit.default
new file mode 100644
index 0000000..f16385b
--- /dev/null
+++ b/debian/gerrit.default
@@ -0,0 +1,2 @@
+GERRIT_SITE="/var/lib/gerrit2/review_site"
+GERRIT_WAR="/var/lib/gerrit2/review_site/bin/gerrit.war"
diff --git a/debian/gerrit.init b/debian/gerrit.init
new file mode 100755
index 0000000..5a781d7
--- /dev/null
+++ b/debian/gerrit.init
@@ -0,0 +1,544 @@
+#!/bin/sh
+#
+# Launch Gerrit Code Review as a daemon process.
+
+# To get the service to restart correctly on reboot, uncomment below (3 lines):
+# ========================
+# chkconfig: 3 99 99
+# description: Gerrit Code Review
+# processname: gerrit
+# ========================
+
+### BEGIN INIT INFO
+# Provides:          gerrit
+# Required-Start:    $named $remote_fs $syslog
+# Required-Stop:     $named $remote_fs $syslog
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start/stop Gerrit Code Review
+# Description:       Gerrit is a web based code review system, facilitating 
online code reviews
+#                    for projects using the Git version control system.
+### END INIT INFO
+
+# Configuration files:
+#
+# /etc/default/gerritcodereview
+#   If it exists, sourced at the start of this script. It may perform any
+#   sequence of shell commands, like setting relevant environment variables.
+#
+# The files will be checked for existence before being sourced.
+
+# Configuration variables.  These may be set in /etc/default/gerritcodereview.
+#
+# GERRIT_SITE
+#   Path of the Gerrit site to run.  $GERRIT_SITE/etc/gerrit.config
+#   will be used to configure the process.
+#
+# GERRIT_WAR
+#   Location of the gerrit.war download that we will execute.  Defaults to
+#   container.war property in $GERRIT_SITE/etc/gerrit.config.
+#
+# NO_START
+#   If set to "1" disables Gerrit from starting.
+#
+# START_STOP_DAEMON
+#   If set to "0" disables using start-stop-daemon.  This may need to
+#   be set on SuSE systems.
+
+usage() {
+    me=`basename "$0"`
+    echo >&2 "Usage: $me {start|stop|restart|check|status|run|supervise} [-d 
site]"
+    exit 1
+}
+
+test $# -gt 0 || usage
+
+##################################################
+# Some utility functions
+##################################################
+running() {
+  test -f $1 || return 1
+  PID=`cat $1`
+  ps -p $PID >/dev/null 2>/dev/null || return 1
+  return 0
+}
+
+get_config() {
+  if test -f "$GERRIT_CONFIG" ; then
+    if test "x$1" = x--int ; then
+      # Git might not be able to expand "8g" properly.  If it gives
+      # us 0 back retry for the raw string and expand ourselves.
+      #
+      n=`git config --file "$GERRIT_CONFIG" --int "$2"`
+      if test x0 = "x$n" ; then
+        n=`git config --file "$GERRIT_CONFIG" --get "$2"`
+        case "$n" in
+        *g) n=`expr ${n%%g} \* 1024`m ;;
+        *k) n=`expr ${n%%k} \* 1024` ;;
+        *)  : ;;
+        esac
+      fi
+      echo "$n"
+    else
+      git config --file "$GERRIT_CONFIG" $1 "$2"
+    fi
+  fi
+}
+
+##################################################
+# Get the action and options
+##################################################
+
+ACTION=$1
+shift
+
+while test $# -gt 0 ; do
+  case "$1" in
+  -d|--site-path)
+    shift
+    GERRIT_SITE=$1
+    shift
+    ;;
+  -d=*)
+    GERRIT_SITE=${1##-d=}
+    shift
+    ;;
+  --site-path=*)
+    GERRIT_SITE=${1##--site-path=}
+    shift
+    ;;
+
+  *)
+    usage
+  esac
+done
+
+test -z "$NO_START" && NO_START=0
+test -z "$START_STOP_DAEMON" && START_STOP_DAEMON=1
+
+##################################################
+# See if there's a default configuration file
+##################################################
+if test -f /etc/default/gerritcodereview ; then
+  . /etc/default/gerritcodereview
+fi
+
+##################################################
+# Set tmp if not already set.
+##################################################
+if test -z "$TMP" ; then
+  TMP=/tmp
+fi
+TMPJ=$TMP/j$$
+
+##################################################
+# Reasonable guess marker for a Gerrit site path.
+##################################################
+GERRIT_INSTALL_TRACE_FILE=etc/gerrit.config
+
+##################################################
+# No git in PATH? Needed for gerrit.config parsing
+##################################################
+if type git >/dev/null 2>&1 ; then
+  : OK
+else
+  echo >&2 "** ERROR: Cannot find git in PATH"
+  exit 1
+fi
+
+##################################################
+# Try to determine GERRIT_SITE if not set
+##################################################
+if test -z "$GERRIT_SITE" ; then
+  GERRIT_SITE_1=`dirname "$0"`
+
+  ##################################################
+  # As last resort assume we started the script from
+  # the bin directory of the Gerrit installation
+  ##################################################
+  if [ "$GERRIT_SITE_1" = "." ]; then
+      GERRIT_SITE_1=`pwd`
+  fi
+
+  GERRIT_SITE_1=`dirname "$GERRIT_SITE_1"`
+
+  if test -f "${GERRIT_SITE_1}/${GERRIT_INSTALL_TRACE_FILE}" ; then
+    GERRIT_SITE=${GERRIT_SITE_1}
+  fi
+fi
+
+##################################################
+# No GERRIT_SITE yet? We're out of luck!
+##################################################
+if test -z "$GERRIT_SITE" ; then
+    echo >&2 "** ERROR: GERRIT_SITE not set"
+    exit 1
+fi
+
+if cd "$GERRIT_SITE" ; then
+  GERRIT_SITE=`pwd`
+else
+  echo >&2 "** ERROR: Gerrit site $GERRIT_SITE not found"
+  exit 1
+fi
+
+#####################################################
+# Check that Gerrit is where we think it is
+#####################################################
+GERRIT_CONFIG="$GERRIT_SITE/$GERRIT_INSTALL_TRACE_FILE"
+test -f "$GERRIT_CONFIG" || {
+   echo "** ERROR: Gerrit is not initialized in $GERRIT_SITE"
+   exit 1
+}
+test -r "$GERRIT_CONFIG" || {
+   echo "** ERROR: $GERRIT_CONFIG is not readable!"
+   exit 1
+}
+
+GERRIT_PID="$GERRIT_SITE/logs/gerrit.pid"
+GERRIT_RUN="$GERRIT_SITE/logs/gerrit.run"
+GERRIT_TMP="$GERRIT_SITE/tmp"
+export GERRIT_TMP
+
+##################################################
+# Check for JAVA_HOME
+##################################################
+JAVA_HOME_OLD="$JAVA_HOME"
+JAVA_HOME=`get_config --get container.javaHome`
+if test -z "$JAVA_HOME" ; then
+  JAVA_HOME="$JAVA_HOME_OLD"
+fi
+if test -z "$JAVA_HOME" ; then
+    # If a java runtime is not defined, search the following
+    # directories for a JVM and sort by version. Use the highest
+    # version number.
+
+    JAVA_LOCATIONS="\
+        /usr/java \
+        /usr/bin \
+        /usr/local/bin \
+        /usr/local/java \
+        /usr/local/jdk \
+        /usr/local/jre \
+        /usr/lib/jvm \
+        /opt/java \
+        /opt/jdk \
+        /opt/jre \
+    "
+    for N in java jdk jre ; do
+      for L in $JAVA_LOCATIONS ; do
+        test -d "$L" || continue
+        find $L -name "$N" ! -type d | grep -v threads | while read J ; do
+          test -x "$J" || continue
+          VERSION=`eval "$J" -version 2>&1`
+          test $? = 0 || continue
+          VERSION=`expr "$VERSION" : '.*"\(1.[0-9\.]*\)["_]'`
+          test -z "$VERSION" && continue
+          expr "$VERSION" \< 1.2 >/dev/null && continue
+          echo "$VERSION:$J"
+        done
+      done
+    done | sort | tail -1 >"$TMPJ"
+    JAVA=`cat "$TMPJ" | cut -d: -f2`
+    JVERSION=`cat "$TMPJ" | cut -d: -f1`
+    rm -f "$TMPJ"
+
+    JAVA_HOME=`dirname "$JAVA"`
+    while test -n "$JAVA_HOME" \
+               -a "$JAVA_HOME" != "/" \
+               -a ! -f "$JAVA_HOME/lib/tools.jar" ; do
+      JAVA_HOME=`dirname "$JAVA_HOME"`
+    done
+    test -z "$JAVA_HOME" && JAVA_HOME=
+
+    echo "** INFO: Using $JAVA"
+fi
+
+if test -z "$JAVA" \
+     -a -n "$JAVA_HOME" \
+     -a -x "$JAVA_HOME/bin/java" \
+     -a ! -d "$JAVA_HOME/bin/java" ; then
+  JAVA="$JAVA_HOME/bin/java"
+fi
+
+if test -z "$JAVA" ; then
+  echo >&2 "Cannot find a JRE or JDK. Please set JAVA_HOME or"
+  echo >&2 "container.javaHome in $GERRIT_SITE/etc/gerrit.config"
+  echo >&2 "to a >=1.6 JRE"
+  exit 1
+fi
+
+#####################################################
+# Add Gerrit properties to Java VM options.
+#####################################################
+
+GERRIT_OPTIONS=`get_config --get-all container.javaOptions`
+if test -n "$GERRIT_OPTIONS" ; then
+  JAVA_OPTIONS="$JAVA_OPTIONS $GERRIT_OPTIONS"
+fi
+
+GERRIT_MEMORY=`get_config --get container.heapLimit`
+if test -n "$GERRIT_MEMORY" ; then
+  JAVA_OPTIONS="$JAVA_OPTIONS -Xmx$GERRIT_MEMORY"
+fi
+
+GERRIT_FDS=`get_config --int core.packedGitOpenFiles`
+test -z "$GERRIT_FDS" && GERRIT_FDS=128
+GERRIT_FDS=`expr $GERRIT_FDS + $GERRIT_FDS`
+test $GERRIT_FDS -lt 1024 && GERRIT_FDS=1024
+
+GERRIT_USER=`get_config --get container.user`
+
+#####################################################
+# Configure sane ulimits for a daemon of our size.
+#####################################################
+
+ulimit -c 0            ; # core file size
+ulimit -d unlimited    ; # data seg size
+ulimit -f unlimited    ; # file size
+ulimit -m >/dev/null 2>&1 && ulimit -m unlimited  ; # max memory size
+ulimit -n $GERRIT_FDS  ; # open files
+ulimit -t unlimited    ; # cpu time
+ulimit -v unlimited    ; # virtual memory
+
+ulimit -x >/dev/null 2>&1 && ulimit -x unlimited  ; # file locks
+
+#####################################################
+# This is how the Gerrit server will be started
+#####################################################
+
+if test -z "$GERRIT_WAR" ; then
+  GERRIT_WAR=`get_config --get container.war`
+fi
+if test -z "$GERRIT_WAR" ; then
+  GERRIT_WAR="$GERRIT_SITE/bin/gerrit.war"
+  test -f "$GERRIT_WAR" || GERRIT_WAR=
+fi
+if test -z "$GERRIT_WAR" -a -n "$GERRIT_USER" ; then
+  for homedirs in /home /Users ; do
+    if test -d "$homedirs/$GERRIT_USER" ; then
+      GERRIT_WAR="$homedirs/$GERRIT_USER/gerrit.war"
+      if test -f "$GERRIT_WAR" ; then
+        break
+      else
+        GERRIT_WAR=
+      fi
+    fi
+  done
+fi
+if test -z "$GERRIT_WAR" ; then
+  echo >&2 "** ERROR: Cannot find gerrit.war (try setting \$GERRIT_WAR)"
+  exit 1
+fi
+
+test -z "$GERRIT_USER" && GERRIT_USER=`whoami`
+RUN_ARGS="-jar $GERRIT_WAR daemon -d $GERRIT_SITE"
+if test "`get_config --bool container.slave`" = "true" ; then
+  RUN_ARGS="$RUN_ARGS --slave"
+fi
+if test -n "$JAVA_OPTIONS" ; then
+  RUN_ARGS="$JAVA_OPTIONS $RUN_ARGS"
+fi
+
+if test -x /usr/bin/perl ; then
+  # If possible, use Perl to mask the name of the process so its
+  # something specific to us rather than the generic 'java' name.
+  #
+  export JAVA
+  RUN_EXEC=/usr/bin/perl
+  RUN_Arg1=-e
+  RUN_Arg2='$x=$ENV{JAVA};exec $x @ARGV;die $!'
+  RUN_Arg3='-- GerritCodeReview'
+else
+  RUN_EXEC=$JAVA
+  RUN_Arg1=
+  RUN_Arg2='-DGerritCodeReview=1'
+  RUN_Arg3=
+fi
+
+##################################################
+# Do the action
+##################################################
+case "$ACTION" in
+  start)
+    printf '%s' "Starting Gerrit Code Review: "
+
+    if test 1 = "$NO_START" ; then
+      echo "Not starting gerrit - NO_START=1 in /etc/default/gerritcodereview"
+      exit 0
+    fi
+
+    test -z "$UID" && UID=`id | sed -e 's/^[^=]*=\([0-9]*\).*/\1/'`
+
+    RUN_ID=`date +%s`.$$
+    RUN_ARGS="$RUN_ARGS --run-id=$RUN_ID"
+
+    if test 1 = "$START_STOP_DAEMON" && type start-stop-daemon >/dev/null 2>&1
+    then
+      test $UID = 0 && CH_USER="-c $GERRIT_USER"
+      if start-stop-daemon -S -b $CH_USER \
+         -p "$GERRIT_PID" -m \
+         -d "$GERRIT_SITE" \
+         -a "$RUN_EXEC" -- $RUN_Arg1 "$RUN_Arg2" $RUN_Arg3 $RUN_ARGS
+      then
+        : OK
+      else
+        rc=$?
+        if test $rc = 127; then
+          echo >&2 "fatal: start-stop-daemon failed"
+          rc=1
+        fi
+        exit $rc
+      fi
+    else
+      if test -f "$GERRIT_PID" ; then
+        if running "$GERRIT_PID" ; then
+          echo "Already Running!!"
+          exit 0
+        else
+          rm -f "$GERRIT_PID" "$GERRIT_RUN"
+        fi
+      fi
+
+      if test $UID = 0 -a -n "$GERRIT_USER" ; then
+        touch "$GERRIT_PID"
+        chown $GERRIT_USER "$GERRIT_PID"
+        su - $GERRIT_USER -s /bin/sh -c "
+          JAVA='$JAVA' ; export JAVA ;
+          $RUN_EXEC $RUN_Arg1 '$RUN_Arg2' $RUN_Arg3 $RUN_ARGS </dev/null 
>/dev/null 2>&1 &
+          PID=\$! ;
+          disown ;
+          echo \$PID >\"$GERRIT_PID\""
+      else
+        $RUN_EXEC $RUN_Arg1 "$RUN_Arg2" $RUN_Arg3 $RUN_ARGS </dev/null 
>/dev/null 2>&1 &
+        PID=$!
+        type disown >/dev/null 2>&1 && disown
+        echo $PID >"$GERRIT_PID"
+      fi
+    fi
+
+    if test $UID = 0; then
+        PID=`cat "$GERRIT_PID"`
+        if test -f "/proc/${PID}/oom_score_adj" ; then
+            echo -1000 > "/proc/${PID}/oom_score_adj"
+        else
+            if test -f "/proc/${PID}/oom_adj" ; then
+                echo -16 > "/proc/${PID}/oom_adj"
+            fi
+        fi
+    fi
+
+    TIMEOUT=90  # seconds
+    sleep 1
+    while running "$GERRIT_PID" && test $TIMEOUT -gt 0 ; do
+      if test "x$RUN_ID" = "x`cat $GERRIT_RUN 2>/dev/null`" ; then
+        echo OK
+        exit 0
+      fi
+
+      sleep 2
+      TIMEOUT=`expr $TIMEOUT - 2`
+    done
+
+    echo FAILED
+    exit 1
+  ;;
+
+  stop)
+    printf '%s' "Stopping Gerrit Code Review: "
+
+    if test 1 = "$START_STOP_DAEMON" && type start-stop-daemon >/dev/null 2>&1
+    then
+      start-stop-daemon -K -p "$GERRIT_PID" -s HUP
+      sleep 1
+      if running "$GERRIT_PID" ; then
+        sleep 3
+        if running "$GERRIT_PID" ; then
+          sleep 30
+          if running "$GERRIT_PID" ; then
+            start-stop-daemon -K -p "$GERRIT_PID" -s KILL
+          fi
+        fi
+      fi
+      rm -f "$GERRIT_PID" "$GERRIT_RUN"
+      echo OK
+    else
+      PID=`cat "$GERRIT_PID" 2>/dev/null`
+      TIMEOUT=30
+      while running "$GERRIT_PID" && test $TIMEOUT -gt 0 ; do
+        kill $PID 2>/dev/null
+        sleep 1
+        TIMEOUT=`expr $TIMEOUT - 1`
+      done
+      test $TIMEOUT -gt 0 || kill -9 $PID 2>/dev/null
+      rm -f "$GERRIT_PID" "$GERRIT_RUN"
+      echo OK
+    fi
+  ;;
+
+  restart)
+    GERRIT_SH=$0
+    if test -f "$GERRIT_SH" ; then
+      : OK
+    else
+      echo >&2 "** ERROR: Cannot locate gerrit.sh"
+      exit 1
+    fi
+    $GERRIT_SH stop $*
+    sleep 5
+    $GERRIT_SH start $*
+  ;;
+
+  supervise)
+    #
+    # Under control of daemontools supervise monitor which
+    # handles restarts and shutdowns via the svc program.
+    #
+    exec "$RUN_EXEC" $RUN_Arg1 "$RUN_Arg2" $RUN_Arg3 $RUN_ARGS
+    ;;
+
+  run|daemon)
+    echo "Running Gerrit Code Review:"
+
+    if test -f "$GERRIT_PID" ; then
+        if running "$GERRIT_PID" ; then
+          echo "Already Running!!"
+          exit 0
+        else
+          rm -f "$GERRIT_PID"
+        fi
+    fi
+
+    exec "$RUN_EXEC" $RUN_Arg1 "$RUN_Arg2" $RUN_Arg3 $RUN_ARGS --console-log
+  ;;
+
+  check|status)
+    echo "Checking arguments to Gerrit Code Review:"
+    echo "  GERRIT_SITE     =  $GERRIT_SITE"
+    echo "  GERRIT_CONFIG   =  $GERRIT_CONFIG"
+    echo "  GERRIT_PID      =  $GERRIT_PID"
+    echo "  GERRIT_TMP      =  $GERRIT_TMP"
+    echo "  GERRIT_WAR      =  $GERRIT_WAR"
+    echo "  GERRIT_FDS      =  $GERRIT_FDS"
+    echo "  GERRIT_USER     =  $GERRIT_USER"
+    echo "  JAVA            =  $JAVA"
+    echo "  JAVA_OPTIONS    =  $JAVA_OPTIONS"
+    echo "  RUN_EXEC        =  $RUN_EXEC $RUN_Arg1 '$RUN_Arg2' $RUN_Arg3"
+    echo "  RUN_ARGS        =  $RUN_ARGS"
+    echo
+
+    if test -f "$GERRIT_PID" ; then
+        if running "$GERRIT_PID" ; then
+            echo "Gerrit running pid="`cat "$GERRIT_PID"`
+            exit 0
+        fi
+    fi
+    exit 3
+  ;;
+
+  *)
+    usage
+  ;;
+esac
+
+exit 0
diff --git a/debian/gerrit.postinst b/debian/gerrit.postinst
new file mode 100644
index 0000000..0a35244
--- /dev/null
+++ b/debian/gerrit.postinst
@@ -0,0 +1,59 @@
+#!/bin/sh
+# postinst script for gerrit
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postinst> `configure' <most-recently-configured-version>
+#        * <old-postinst> `abort-upgrade' <new version>
+#        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
+#          <new-version>
+#        * <postinst> `abort-remove'
+#        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
+#          <failed-install-package> <version> `removing'
+#          <conflicting-package> <version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+  configure)
+    if ! getent group gerrit2 >/dev/null
+    then
+      echo Adding group: gerrit2
+      addgroup --system gerrit2
+    fi
+
+    if ! getent passwd gerrit2 >/dev/null
+    then
+      echo Adding system user: gerrit2
+      adduser --system --ingroup gerrit2 --home /var/lib/gerrit2 --shell 
/bin/false --no-create-home gerrit2
+      usermod -c "Gerrit code review system" gerrit2
+    fi
+
+    if [ -d /var/lib/gerrit2 ]
+    then
+      chown -R gerrit2:gerrit2 /var/lib/gerrit2
+      chmod 755 /var/lib/gerrit2
+    fi
+      
+    ;;
+
+    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/gerrit.postrm b/debian/gerrit.postrm
new file mode 100644
index 0000000..30c1394
--- /dev/null
+++ b/debian/gerrit.postrm
@@ -0,0 +1,50 @@
+#!/bin/sh
+# postrm script for gerrit
+#
+# see: dh_installdeb(1)
+
+set -e
+
+# summary of how this script can be called:
+#        * <postrm> `remove'
+#        * <postrm> `purge'
+#        * <old-postrm> `upgrade' <new-version>
+#        * <new-postrm> `failed-upgrade' <old-version>
+#        * <new-postrm> `abort-install'
+#        * <new-postrm> `abort-install' <old-version>
+#        * <new-postrm> `abort-upgrade' <old-version>
+#        * <disappearer's-postrm> `disappear' <overwriter>
+#          <overwriter-version>
+# for details, see http://www.debian.org/doc/debian-policy/ or
+# the debian-policy package
+
+
+case "$1" in
+  purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+    if getent passwd gerrit2 >/dev/null
+    then
+      echo "Removing user: gerrit2"
+      deluser gerrit2
+    fi
+
+    if getent group gerrit2 >/dev/null
+    then
+      echo "Removing group: gerrit2"
+      delgroup gerrit2
+    fi
+
+    ;;
+
+    *)
+        echo "postrm 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/install b/debian/install
new file mode 100644
index 0000000..84259c0
--- /dev/null
+++ b/debian/install
@@ -0,0 +1 @@
+buck-out/gen/gerrit.war /var/lib/gerrit2
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 0000000..73a7aac
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,21 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+export JAVA_HOME=/usr/lib/jvm/default-java
+
+%:
+       dh $@ --with javahelper
+
+override_dh_auto_build:
+       buck build gerrit -v 2
+
+override_dh_auto_clean:
+       buck clean -v 2
diff --git a/debian/source/format b/debian/source/format
new file mode 100644
index 0000000..163aaf8
--- /dev/null
+++ b/debian/source/format
@@ -0,0 +1 @@
+3.0 (quilt)
diff --git a/debian/source/options b/debian/source/options
new file mode 100644
index 0000000..2df3e3f
--- /dev/null
+++ b/debian/source/options
@@ -0,0 +1 @@
+extend-diff-ignore = '^\.gitreview$'

-- 
To view, visit https://gerrit.wikimedia.org/r/68485
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9527dbcc29f1c7259128635478c622ddf3a4eb81
Gerrit-PatchSet: 1
Gerrit-Project: gerrit
Gerrit-Branch: wmf-debian
Gerrit-Owner: AzaToth <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to