[SCM] jenkins packaging branch, master, updated. upstream/1.409.3-7-gfd51978
James Page
james.page at canonical.com
Fri Dec 9 13:06:06 UTC 2011
The following commit has been merged in the master branch:
commit d7e0b7a97197f8098e8e42a66e8cfb3d47799749
Author: James Page <james.page at canonical.com>
Date: Fri Dec 9 12:58:18 2011 +0000
Updates for init scripts, control var generation
diff --git a/debian/bin/download-slave.sh b/debian/bin/download-slave.sh
index aac0683..2648130 100755
--- a/debian/bin/download-slave.sh
+++ b/debian/bin/download-slave.sh
@@ -1,5 +1,13 @@
#!/bin/sh
SLAVE_JAR=/var/run/jenkins/slave.jar
+JENKINS_URL=$1
+
+if [ -z "$JENKINS_URL" ]
+then
+ echo URL of jenkins server must be provided
+ exit 1
+fi
+
# Retrieve Slave JAR from Master Server
echo "Downloading slave.jar from ${JENKINS_URL}..."
wget -q -O ${SLAVE_JAR} ${JENKINS_URL}/jnlpJars/slave.jar
diff --git a/debian/changelog b/debian/changelog
index 5b5cc5e..ad58d8b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,11 +3,13 @@ jenkins (1.409.3-1) unstable; urgency=low
* Initial Debian release (Closes: #561963)
* Disabled build of libjenkins-plugin-parent-java as not currently
installable due to broken upstream maven-hpi-plugin.
- * Added tradditional Debian init scripts and default configuration for jenkins
+ * Added Debian init scripts and default configuration for jenkins
and jenkins-slave packages and updated rules to switch in upstart
configuration for Ubuntu builds.
+ * d/bin/dowload-slave.sh: Updated to use parameter rather than
+ environment variable when locating Jenkins master server.
- -- James Page <james.page at ubuntu.com> Fri, 09 Dec 2011 10:11:39 +0000
+ -- James Page <james.page at ubuntu.com> Fri, 09 Dec 2011 12:04:59 +0000
jenkins (1.409.3-0ubuntu1) precise; urgency=low
diff --git a/debian/control b/debian/control
index f633e18..af45cb4 100644
--- a/debian/control
+++ b/debian/control
@@ -171,8 +171,7 @@ Package: jenkins
Architecture: all
Depends:
adduser,
- daemon,
- psmisc,
+ ${jenkins-daemon-deps},
default-jre-headless | java6-runtime-headless,
jenkins-common,
${misc:Depends}
@@ -203,7 +202,7 @@ Package: jenkins-slave
Architecture: all
Depends:
adduser,
- daemon,
+ ${jenkins-daemon-deps},
default-jre-headless | java6-runtime-headless,
${misc:Depends}
Recommends: jenkins-cli, ssh-import-id, ssh-server | openssh-server
diff --git a/debian/debian_control_vars b/debian/debian_control_vars
new file mode 100644
index 0000000..0c8ffb4
--- /dev/null
+++ b/debian/debian_control_vars
@@ -0,0 +1 @@
+jenkins-daemon-deps= daemon, psmisc
diff --git a/debian/jenkins-slave.default b/debian/jenkins-slave.default
index d01bfb8..8a8d5a4 100644
--- a/debian/jenkins-slave.default
+++ b/debian/jenkins-slave.default
@@ -25,11 +25,6 @@ JENKINS_HOME=/var/lib/jenkins
# jenkins /run location
JENKINS_RUN=/var/run/jenkins
-# set this to false if you don't want Hudson to run by itself
-# in this set up, you are expected to provide a servlet container
-# to host jenkins.
-RUN_STANDALONE=true
-
# URL of jenkins server to connect to
# Not specifying this parameter will stop the slave
# job from running.
@@ -40,7 +35,7 @@ RUN_STANDALONE=true
# hostname of the server the slave is running on.
JENKINS_HOSTNAME="$(hostname)"
-# log location. this may be a syslog facility.priority
+# Log file location for use in Debian init script
JENKINS_SLAVE_LOG=/var/log/jenkins/$NAME.log
# OS LIMITS SETUP
diff --git a/debian/jenkins-slave.init b/debian/jenkins-slave.init
index fe1dcf6..4af3fbe 100644
--- a/debian/jenkins-slave.init
+++ b/debian/jenkins-slave.init
@@ -21,20 +21,16 @@ SCRIPTNAME=/etc/init.d/$NAME
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
-# Only run this daemon if JENKINS url is specified.
-# in defaults
-[ -n "$JENKINS_URL" ] || exit 0
-
DAEMON=/usr/bin/daemon
-DAEMON_ARGS="--name=$NAME --inherit --env=JENKINS_HOME=$JENKINS_HOME --output=$JENKINS_SLAVE_LOG --pidfile=$PIDFILE"
+DAEMON_ARGS="--name=$NAME --inherit --output=$JENKINS_SLAVE_LOG --pidfile=$PIDFILE"
SU=/bin/su
# Exit if the package is not installed
[ -x "$DAEMON" ] || exit 0
-# Exit if not supposed to run standalone
-[ "$RUN_STANDALONE" = "false" ] && exit 0
+# Only run this daemon if JENKINS_URL is specified.
+[ -n "$JENKINS_URL" ] || exit 0
# load environments
if [ -r /etc/default/locale ]; then
@@ -81,7 +77,7 @@ do_start()
fi
# Ensure that slave.jar has been downloaded from JENKINS_URL
- $JENKINS_ROOT/bin/download-slave.sh
+ $JENKINS_ROOT/bin/download-slave.sh $JENKINS_URL > /dev/null 2>&1 || return 2
# --user in daemon doesn't prepare environment variables like HOME, USER, LOGNAME or USERNAME,
# so we let su do so for us now
@@ -95,7 +91,7 @@ do_start()
#
get_running()
{
- return `ps -U $JENKINS_USER --no-headers -f | egrep -e '(java|daemon)' | grep -c . `
+ return `ps -U $JENKINS_USER --no-headers -f | egrep -e '(slave)' | grep -c . `
}
force_stop()
diff --git a/debian/jenkins-slave.upstart.in b/debian/jenkins-slave.upstart.in
index 997ac57..fe96dd7 100644
--- a/debian/jenkins-slave.upstart.in
+++ b/debian/jenkins-slave.upstart.in
@@ -1,20 +1,19 @@
-description "jenkins: Jenkins Slave Agent"
+description "Jenkins CI Slave Agent"
author "James Page <james.page at ubuntu.com>"
start on runlevel [2345]
stop on runlevel [!2345]
pre-start script
- [ -r /etc/default/jenkins-slave.default ] && . /etc/default/jenkins-slave
- [ -n "$JENKINS_URL" ] || { stop; exit 0 }
- $JENKINS_ROOT/bin/download-slave.sh
+ [ -r /etc/default/jenkins-slave ] && . /etc/default/jenkins-slave
+ [ -n "$JENKINS_URL" ] || { stop; exit 0; }
+ $JENKINS_ROOT/bin/download-slave.sh $JENKINS_URL
mkdir $JENKINS_RUN > /dev/null 2>&1 || true
chown -R $JENKINS_USER $JENKINS_RUN || true
end script
script
- [ -r /etc/default/jenkins-slave.default ] && . /etc/default/jenkins-slave
+ [ -r /etc/default/jenkins-slave ] && . /etc/default/jenkins-slave
exec su -l $JENKINS_USER --shell=/bin/bash -c \
- "daemon --name=$NAME --inherit --output=$JENKINS_SLAVE_LOG \
- -- $JAVA $JAVA_ARGS -jar $JENKINS_RUN/slave.jar $JENKINS_ARGS"
+ "$JAVA $JAVA_ARGS -jar $JENKINS_RUN/slave.jar $JENKINS_ARGS"
end script
diff --git a/debian/jenkins.upstart.in b/debian/jenkins.upstart.in
index 060fede..01ec80d 100644
--- a/debian/jenkins.upstart.in
+++ b/debian/jenkins.upstart.in
@@ -17,7 +17,5 @@ end script
script
[ -r /etc/default/jenkins ] && . /etc/default/jenkins
exec su -l $JENKINS_USER --shell=/bin/bash -c \
- "daemon --name=$NAME --inherit --output=$JENKINS_LOG \
- --env=JENKINS_HOME=$JENKINS_HOME -- \
- $JAVA $JAVA_ARGS -jar $JENKINS_WAR $JENKINS_ARGS"
+ "JENKINS_HOME=$JENKINS_HOME $JAVA $JAVA_ARGS -jar $JENKINS_WAR $JENKINS_ARGS --logfile=$JENKINS_LOG"
end script
diff --git a/debian/rules b/debian/rules
index 875e4ba..0d91cd7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -8,6 +8,12 @@ DEB_MAVEN_BUILD_TARGET := install
DEB_MAVEN_ARGS := -e -Dbuild.version="$(DEB_UPSTREAM_VERSION)"
DEB_MAVEN_INSTALL_TO_USJ := false
+# Debian package version use daemon to control jenkins processes
+# Ubuntu does not need this - managed by upstart
+ifeq ($(shell dpkg-vendor --derives-from ubuntu || echo debian ),debian)
+DEB_DH_GENCONTROL_ARGS:= -- -Tdebian/debian_control_vars
+endif
+
# Install the POM for plugin-parent manually as not part
# of main build
binary-post-install/libjenkins-plugin-parent-java::
@@ -29,12 +35,13 @@ binary-post-install/jenkins-external-job-monitor::
usr/share/jenkins/external-job-monitor/java/jenkins-core.jar
# Switch in upstart configuration if building on Ubuntu
-binary-post-install/jenkins::
+# and generate control with/without daemon.
+build/jenkins::
if dpkg-vendor --derives-from ubuntu ; then \
cp debian/jenkins.upstart.in debian/jenkins.upstart ; \
fi
-binary-post-install/jenkins-slave::
+build/jenkins-slave::
if dpkg-vendor --derives-from ubuntu ; then \
cp debian/jenkins-slave.upstart.in debian/jenkins-slave.upstart ; \
fi
--
jenkins packaging
More information about the pkg-java-commits
mailing list