Description: GBS remotebuild API
This package contains gbs remotebuild APIs, which can be used by
external software.
+
+Package: gbs-jenkins-jobs
+Architecture: all
+Depends: ${misc:Depends},
+ jenkins
+Description: GBS local full build jenkins jobs configurations.
+ These jenkins jobs are used to build tizen source from scratch or only a part of packages, and create images finally.
+
+Package: gbs-jenkins-scripts
+Architecture: all
+Depends: ${misc:Depends},
+ gbs,
+ mic
+Description: Jenkins scripts used by gbs-jenkins-job
+ These scripts are used by GBS local full build jenkins jobs. These scripts should be installed on Jenkins slave nodes.
--- /dev/null
+var/lib/jenkins/jobs/*
--- /dev/null
+chown -R jenkins. /var/lib/jenkins/jobs
--- /dev/null
+var/lib/jenkins/jenkins-scripts/common_functions
+var/lib/jenkins/jenkins-scripts/job_local_full_build
+var/lib/jenkins/jenkins-scripts/job_build_packagelist
--- /dev/null
+chown -R jenkins. /var/lib/jenkins/jenkins-scripts
make man
mkdir -p debian/tmp/usr/share/man/man1
install -m644 docs/gbs.1 debian/tmp/usr/share/man/man1
+ for job_name in $(shell ls jenkins-jobs/configs); do \
+ mkdir -p debian/tmp/var/lib/jenkins/jobs/$$job_name; \
+ install -m644 jenkins-jobs/configs/$$job_name/config.xml debian/tmp/var/lib/jenkins/jobs/$$job_name; \
+ done
+ mkdir -p debian/tmp/var/lib/jenkins/jenkins-scripts
+ install -m755 jenkins-jobs/scripts/* debian/tmp/var/lib/jenkins/jenkins-scripts
override_dh_auto_test:
@echo 'Skipping autotests'
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>
+<project>
+ <actions/>
+ <description>This jenkins job is used to build Tizen sources.
+This job is based on <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> and <a class="reference external" href="https://source.tizen.org/documentation/reference/git-build-system">GBS</a>. Developers can reconfigure
+this job to run periodically, of course can be triggered at anytime needed.</p>
+<p>Using this job, developers can specify a list of packages, which just have
+been updated in remote repos, and check if the final image can work well
+with these changes of packages. To use this job, one remote repo must be
+specified, which can be used to get ks file and required by <cite>gbs build</cite>.
+An example of remote repo is shown below:</p>
+<pre class="literal-block">
+http://download.tizen.org/releases/daily/tizen/ivi/ivi/tizen_20140212.7/
+</pre>
+<p>With <strong>PUBLISH</strong> enabled, build artifacts, including build reports, repos and
+images, will be synchronized to respective download servers.</p>
+<p><strong>Note:</strong> To get a better understanding of this job, it is highly recommended
+that the following document, which provides instructions of the corresponding
+manual operations, is read and well understood:
+<a class="reference external" href="https://source.tizen.org/documentation/developer-guide/creating-tizen-image-scratch">Creating a Tizen Image from Scratch</a></p>
+<p>The following options are supported by this jenkins job:</p>
+<dl class="docutils">
+<dt><tt class="docutils literal">MANIFEST_URL</tt></dt>
+<dd><p class="first">The manifest url, which should be recognized by <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> command,
+for example: <cite>review.tizen.org:scm/manifest</cite>, where <cite>review.tizen.org</cite>
+is the alias name set in ~/.ssh, like:</p>
+<pre class="literal-block">
+Host review.tizen.org
+Hostname review.tizen.org
+Port 29418
+User &lt;username&gt;
+#ProxyCommand connect -S &lt;proxy&gt;:&lt;port&gt; %h %p
+</pre>
+<p class="last">and, <cite>scm/manifest</cite> is the manifest path in remote tizen.org gerrit.</p>
+</dd>
+<dt><tt class="docutils literal">MANIFEST_BRANCHES</tt></dt>
+<dd>This option specifies the manifest branch used for syncing code, this
+value will be passed to <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> command directly.</dd>
+<dt><tt class="docutils literal">PROFILE</tt></dt>
+<dd>This option specifies the target profile, valid values: <cite>IVI</cite>, <cite>Mobile</cite>.</dd>
+<dt><tt class="docutils literal">ARCH</tt></dt>
+<dd>This option specifies the arch to be built, valid values: <cite>i586</cite> and
+<cite>armv7l</cite>.</dd>
+<dt><tt class="docutils literal">REMOTE_REPOS</tt></dt>
+<dd>The remote repos for doing local full build using gbs, and get ks file for
+image creation.</dd>
+<dt><tt class="docutils literal">KS</tt></dt>
+<dd>Specify the ks file name used to create images. The avaliable names
+should be in <strong>REMOTE_REPO</strong> specified above, multiple ks can be
+specified seperate by space.</dd>
+<dt><tt class="docutils literal">PACKAGE_LIST</tt></dt>
+<dd>This option specifies the package list, in which the full path of each
+package is listed line by line.</dd>
+<dt><tt class="docutils literal">BUILD_RDEPS</tt></dt>
+<dd>This option enables the building with dependency,that is, packages that
+depend on packages in <cite>PACKAGE_LIST</cite> will be built in correct dependency
+order.</dd>
+<dt><tt class="docutils literal">PARALEL_THREADS</tt></dt>
+<dd>This option determines how many builder gbs should run in parallel</dd>
+<dt><tt class="docutils literal">EXCLUDE_PACKAGES</tt></dt>
+<dd>This option specifies the packages that does not participate in building.
+And also can be used to break dependency cycles.</dd>
+<dt><tt class="docutils literal">BUILD_ARGS</tt></dt>
+<dd>Specify more gbs build options. For more gbs build options and usage
+refer to <a class="reference external" href="https://source.tizen.org/documentation/reference/git-build-system/usage/gbs-build">gbs build usage</a>. Default value: empty.</dd>
+<dt><tt class="docutils literal">PUBLISH</tt></dt>
+<dd>This option enables the publishing of build artifacts to respective
+download servers. Build artifacts include report, images and repos.</dd>
+<dt><tt class="docutils literal">PUBLISH_URL</tt></dt>
+<dd>Specify the URL address to publish build artifacts. The format of
+<cite>PUBLISH_URL</cite> should be the same as rsync format which can be a local
+path or remote url like: <cite>user&#64;hostname:/path/to/publish_dir</cite>.
+This option only take effect if PUBLISH is enabled.</dd>
+</dl></description>
+ <keepDependencies>false</keepDependencies>
+ <properties>
+ <hudson.model.ParametersDefinitionProperty>
+ <parameterDefinitions>
+ <hudson.model.StringParameterDefinition>
+ <name>MANIFEST_URL</name>
+ <description><p class="first">The manifest url, which should be recognized by <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> command,
+for example: <cite>review.tizen.org:scm/manifest</cite>, where <cite>review.tizen.org</cite>
+is the alias name set in ~/.ssh, like:</p>
+<pre class="literal-block">
+Host review.tizen.org
+Hostname review.tizen.org
+Port 29418
+User &lt;username&gt;
+#ProxyCommand connect -S &lt;proxy&gt;:&lt;port&gt; %h %p
+</pre>
+<p class="last">and, <cite>scm/manifest</cite> is the manifest path in remote tizen.org gerrit.</p>
+</description>
+ <defaultValue>review.tizen.org:scm/manifest</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>MANIFEST_BRANCH</name>
+ <description>This option specifies the manifest branch used for syncing code, this
+value will be passed to <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> command directly.</description>
+ <defaultValue>tizen</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.ChoiceParameterDefinition>
+ <name>PROFILE</name>
+ <description>This option specifies the target profile, valid values: <cite>IVI</cite>, <cite>Mobile</cite>.</description>
+ <choices class="java.util.Arrays$ArrayList">
+ <a class="string-array">
+ <string>ivi</string>
+ <string>mobile</string>
+ </a>
+ </choices>
+ </hudson.model.ChoiceParameterDefinition>
+ <hudson.model.TextParameterDefinition>
+ <name>REMOTE_REPOS</name>
+ <description>The remote repos for doing local full build using gbs, and get ks file for
+image creation. Example:
+http://download.tizen.org/releases/daily/tizen/ivi/ivi/tizen_20140212.7/</description>
+ <defaultValue>https://download.tizen.org/releases/daily/tizen/ivi/ivi/tizen_20140214.10</defaultValue>
+ </hudson.model.TextParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>KS</name>
+ <description>ks file name.
+Example:
+ mobile.ks
+
+For multiple ks file use spaces to separate them:
+ mobile.ks mobile-ref.ks</description>
+ <defaultValue>ivi-mbr-i586.ks</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.BooleanParameterDefinition>
+ <name>BUILD_RDEPS</name>
+ <description>Check this box, all packages depend on specified packages will be built in correct dependency order.</description>
+ <defaultValue>true</defaultValue>
+ </hudson.model.BooleanParameterDefinition>
+ <hudson.model.TextParameterDefinition>
+ <name>PACKAGE_LIST</name>
+ <description>Specify the packages list to be built, and one line for per package. The format should be the detail path in remote gerrit.</description>
+ <defaultValue>apps/core/preloaded/menu-screen
+apps/core/preloaded/settings
+</defaultValue>
+ </hudson.model.TextParameterDefinition>
+ <hudson.model.ChoiceParameterDefinition>
+ <name>ARCH</name>
+ <description>This option specifies the arch to be built, valid values: <cite>i586</cite></description>
+ <choices class="java.util.Arrays$ArrayList">
+ <a class="string-array">
+ <string>ia32</string>
+ <string>armv7l</string>
+ </a>
+ </choices>
+ </hudson.model.ChoiceParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>PARALEL_THREADS</name>
+ <description>This option determines how many builder gbs should run in parallel.</description>
+ <defaultValue>4</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>EXCLUDE_PACKAGES</name>
+ <description>This option specifies the packages that does not participate in building.
+And also can be used to break dependency cycles.</description>
+ <defaultValue>texinfo,aul,gettext</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>BUILD_ARGS</name>
+ <description>Specify more gbs build options. For more gbs build options and usage
+refer to <a class="reference external" href="https://source.tizen.org/documentation/reference/git-build-system/usage/gbs-build">gbs build usage</a>. Default value: empty.</description>
+ <defaultValue></defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.BooleanParameterDefinition>
+ <name>PUBLISH</name>
+ <description>This option enables the publishing of build artifacts to respective download servers. Build artifacts include report, images and repos..</description>
+ <defaultValue>true</defaultValue>
+ </hudson.model.BooleanParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>PUBLISH_URL</name>
+ <description>Specify the URL address to publish build artifacts. The format of
+<cite>PUBLISH_URL</cite> should be the same as rsync format which can be a local
+path or remote url like: <cite>user&#64;hostname:/path/to/publish_dir</cite>.
+This option only take effect if PUBLISH is enabled.</description>
+ <defaultValue></defaultValue>
+ </hudson.model.StringParameterDefinition>
+ </parameterDefinitions>
+ </hudson.model.ParametersDefinitionProperty>
+ </properties>
+ <scm class="hudson.scm.NullSCM"/>
+ <canRoam>true</canRoam>
+ <disabled>false</disabled>
+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+ <triggers/>
+ <concurrentBuild>false</concurrentBuild>
+ <builders>
+ <hudson.tasks.Shell>
+ <command>${JENKINS_HOME}/jenkins-scripts/job_build_packagelist</command>
+ </hudson.tasks.Shell>
+ </builders>
+ <publishers/>
+ <buildWrappers/>
+</project>
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>
+<project>
+ <actions/>
+ <description>This jenkins job is used to build Tizen sources.
+This job is based on <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> and <a class="reference external" href="https://source.tizen.org/documentation/reference/git-build-system">GBS</a>. Developers can reconfigure
+this job to run periodically, of course can be triggered at anytime needed.</p>
+<p>With <strong>PUBLISH</strong> enabled, build artifacts, including build reports, repos and
+images, will be synchronized to respective download servers.</p>
+<p><strong>Note:</strong> To get a better understanding of this job, it is highly recommended
+that the following document, which provides instructions of the corresponding
+manual operations, is read and well understood:
+<a class="reference external" href="https://source.tizen.org/documentation/developer-guide/creating-tizen-image-scratch">Creating a Tizen Image from Scratch</a></p>
+<p>The following options are supported by this jenkins job:</p>
+<dl class="docutils">
+<dt><tt class="docutils literal">MANIFEST_URL</tt></dt>
+<dd><p class="first">The manifest url, which should be recognized by <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> command,
+for example: <cite>review.tizen.org:scm/manifest</cite>, where <cite>review.tizen.org</cite>
+is the alias name set in ~/.ssh, like:</p>
+<pre class="literal-block">
+Host review.tizen.org
+Hostname review.tizen.org
+Port 29418
+User &lt;username&gt;
+#ProxyCommand connect -S &lt;proxy&gt;:&lt;port&gt; %h %p
+</pre>
+<p class="last">and, <cite>scm/manifest</cite> is the manifest path in remote tizen.org gerrit.</p>
+</dd>
+<dt><tt class="docutils literal">MANIFEST_BRANCHES</tt></dt>
+<dd>This option specifies the manifest branch used for syncing code, this
+value will be passed to <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> command directly.</dd>
+<dt><tt class="docutils literal">PROFILE</tt></dt>
+<dd>This option specifies the target profile, valid values: <cite>IVI</cite>, <cite>Mobile</cite>.</dd>
+<dt><tt class="docutils literal">ARCH</tt></dt>
+<dd>This option specifies the arch to be built, valid values: <cite>i586</cite> and
+<cite>armv7l</cite>.</dd>
+<dt><tt class="docutils literal">REMOTE_REPOS</tt></dt>
+<dd>The remote repos for doing local full build using gbs, and get ks file for
+image creation.</dd>
+<dt><tt class="docutils literal">PARALEL_THREADS</tt></dt>
+<dd>This option determines how many builder gbs should run in parallel</dd>
+<dt><tt class="docutils literal">EXCLUDE_PACKAGES</tt></dt>
+<dd>This option specifies the packages that does not participate in building.
+And also can be used to break dependency cycles.</dd>
+<dt><tt class="docutils literal">BUILD_ARGS</tt></dt>
+<dd>Specify more gbs build options. For more gbs build options and usage
+refer to <a class="reference external" href="https://source.tizen.org/documentation/reference/git-build-system/usage/gbs-build">gbs build usage</a>. Default value: empty.</dd>
+<dt><tt class="docutils literal">PUBLISH</tt></dt>
+<dd>This option enables the publishing of build artifacts to respective
+download servers. Build artifacts include report, images and repos.</dd>
+<dt><tt class="docutils literal">PUBLISH_URL</tt></dt>
+<dd>Specify the URL address to publish build artifacts. The format of
+<cite>PUBLISH_URL</cite> should be the same as rsync format which can be a local
+path or remote url like: <cite>user&#64;hostname:/path/to/publish_dir</cite>.
+This option only take effect if PUBLISH is enabled.</dd>
+</dl></description>
+ <keepDependencies>false</keepDependencies>
+ <properties>
+ <hudson.model.ParametersDefinitionProperty>
+ <parameterDefinitions>
+ <hudson.model.StringParameterDefinition>
+ <name>MANIFEST_URL</name>
+ <description><p class="first">The manifest url, which should be recognized by <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> command,
+for example: <cite>review.tizen.org:scm/manifest</cite>, where <cite>review.tizen.org</cite>
+is the alias name set in ~/.ssh, like:</p>
+<pre class="literal-block">
+Host review.tizen.org
+Hostname review.tizen.org
+Port 29418
+User &lt;username&gt;
+#ProxyCommand connect -S &lt;proxy&gt;:&lt;port&gt; %h %p
+</pre>
+<p class="last">and, <cite>scm/manifest</cite> is the manifest path in remote tizen.org gerrit.</p>
+</description>
+ <defaultValue>review.tizen.org:scm/manifest</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>MANIFEST_BRANCH</name>
+ <description>This option specifies the manifest branch used for syncing code, this
+value will be passed to <a class="reference external" href="http://en.wikipedia.org/wiki/Repo_%28script%29">repo</a> command directly.</description>
+ <defaultValue>tizen</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.ChoiceParameterDefinition>
+ <name>PROFILE</name>
+ <description>This option specifies the target profile, valid values: <cite>IVI</cite>, <cite>Mobile</cite>.</description>
+ <choices class="java.util.Arrays$ArrayList">
+ <a class="string-array">
+ <string>ivi</string>
+ <string>mobile</string>
+ </a>
+ </choices>
+ </hudson.model.ChoiceParameterDefinition>
+ <hudson.model.TextParameterDefinition>
+ <name>REMOTE_REPOS</name>
+ <description>The remote repos for doing local full build using gbs, and get ks file for
+image creation. Example:
+http://download.tizen.org/releases/daily/tizen/ivi/ivi/tizen_20140212.7/</description>
+ <defaultValue>https://download.tizen.org/releases/daily/tizen/ivi/ivi/tizen_20140214.10</defaultValue>
+ </hudson.model.TextParameterDefinition>
+ <hudson.model.ChoiceParameterDefinition>
+ <name>ARCH</name>
+ <description>This option specifies the arch to be built, valid values: <cite>i586</cite></description>
+ <choices class="java.util.Arrays$ArrayList">
+ <a class="string-array">
+ <string>i586</string>
+ <string>armv7l</string>
+ </a>
+ </choices>
+ </hudson.model.ChoiceParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>PARALEL_THREADS</name>
+ <description>This option determines how many builder gbs should run in parallel.</description>
+ <defaultValue>4</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>EXCLUDE_PACKAGES</name>
+ <description>This option specifies the packages that does not participate in building.
+And also can be used to break dependency cycles.</description>
+ <defaultValue>texinfo,aul,gettext</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>BUILD_ARGS</name>
+ <description>Specify more gbs build options. For more gbs build options and usage
+refer to <a class="reference external" href="https://source.tizen.org/documentation/reference/git-build-system/usage/gbs-build">gbs build usage</a>. Default value: empty.</description>
+ <defaultValue>platform/upstream/image-configurations</defaultValue>
+ </hudson.model.StringParameterDefinition>
+ <hudson.model.BooleanParameterDefinition>
+ <name>PUBLISH</name>
+ <description>This option enables the publishing of build artifacts to respective download servers. Build artifacts include report, images and repos..</description>
+ <defaultValue>true</defaultValue>
+ </hudson.model.BooleanParameterDefinition>
+ <hudson.model.StringParameterDefinition>
+ <name>PUBLISH_URL</name>
+ <description>Specify the URL address to publish build artifacts. The format of
+<cite>PUBLISH_URL</cite> should be the same as rsync format which can be a local
+path or remote url like: <cite>user&#64;hostname:/path/to/publish_dir</cite>.
+This option only take effect if PUBLISH is enabled.</description>
+ <defaultValue></defaultValue>
+ </hudson.model.StringParameterDefinition>
+ </parameterDefinitions>
+ </hudson.model.ParametersDefinitionProperty>
+ </properties>
+ <scm class="hudson.scm.NullSCM"/>
+ <canRoam>true</canRoam>
+ <disabled>false</disabled>
+ <blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
+ <blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
+ <triggers/>
+ <concurrentBuild>false</concurrentBuild>
+ <builders>
+ <hudson.tasks.Shell>
+ <command>${JENKINS_HOME}/jenkins-scripts/job_local_full_build</command>
+ </hudson.tasks.Shell>
+ </builders>
+ <publishers/>
+ <buildWrappers/>
+</project>
--- /dev/null
+#!/bin/bash -xe
+#
+# Copyright (c) 2014 Intel, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; version 2 of the License
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+
+# COMMON ENVIRONMENT VARIABLES
+# $WORKSPACE is the jenkins workspace, the default is /var/lib/jenkins/workspace/%{jenkins_job_name}
+TMP_DIR="$WORKSPACE/.tmp"
+TIZEN_SOURCE="$WORKSPACE/tizen"
+GBS_BUILD_ROOT="$WORKSPACE/GBS-ROOT"
+BUILD_ID=
+LOCAL_REPO_DIR=
+KS_FILES=
+OUTPUT_DIR="$WORKSPACE/$JOB_NAME/tizen_$(date +%Y%m%d)#${BUILD_NUMBER}"
+GBS_BUILD_ARGS="--clean-once" # default enabled args
+
+# Prepare build env
+function prepare_build_env()
+{
+ test -e $TIZEN_SOURCE || mkdir -p $TIZEN_SOURCE
+ sudo rm -rf "$JOB_NAME"
+ mkdir -p $OUTPUT_DIR/repos
+ mkdir -p $OUTPUT_DIR/builddata
+ mkdir -p $OUTPUT_DIR/images
+ mkdir -p $OUTPUT_DIR/builddata/image-configs
+ BUILD_ID=$(basename $(echo $REMOTE_REPOS|awk '{print $1}'))
+
+ test -e $TMP_DIR || mkdir $TMP_DIR
+}
+
+function cleanup_and_exit ()
+{
+ sudo rm $OUTPUT_DIR -rf
+ rm -rf $TMP_DIR
+ exit $1
+}
+
+# Build gbs args using jenkins job options
+function gen_gbs_build_args()
+{
+ GBS_BUILD_ARGS="-B $GBS_BUILD_ROOT $GBS_BUILD_ARGS $BUILD_ARGS "
+ [ -n "$EXCLUDE_PACKAGES" ] && GBS_BUILD_ARGS="$GBS_BUILD_ARGS --exclude=$EXCLUDE_PACKAGES"
+ [ -z "$PARALEL_THREADS" ] && $PARALEL_THREADS="4"
+ GBS_BUILD_ARGS="$GBS_BUILD_ARGS --threads=$PARALEL_THREADS"
+ for repo in $REMOTE_REPOS
+ do
+ GBS_BUILD_ARGS="$GBS_BUILD_ARGS -R $repo"
+ done
+}
+
+# Update ks files with new repos
+function update_ks_file(){
+ # KS files
+ sed -i 's#^\(repo.*\)http.*@BUILD_ID@\(.*\)$#\1'"${REMOTE_REPOS}"'\2#' $KS_FILES
+ sed -i 's/^repo .*/& --priority=99 --ssl_verify=no/' $KS_FILES
+ sed -i "/^repo/ a\repo --name=local --baseurl=file://$LOCAL_REPO_DIR --priority=1" $KS_FILES
+}
+
+
+#Create images
+function create_images()
+{
+ update_ks_file
+
+ for ks in $KS_FILES
+ do
+ ks_file=$(basename $ks)
+ sudo mic cr auto $ks --release=$BUILD_ID \
+ --logfile=${BUILD_ID}_${ks_file%.*} \
+ -o $OUTPUT_DIR/images || true
+ done
+
+ if [ -e "$OUTPUT_DIR/images/${BUILD_ID}/images" ]; then
+ sudo mv $OUTPUT_DIR/images/${BUILD_ID}/images/* $OUTPUT_DIR/images/
+ sudo rm $OUTPUT_DIR/images/${BUILD_ID} -rf
+ fi
+}
+
+# publish build artifacts
+function publish_artifacts()
+{
+ cd $OUTPUT_DIR
+ if [ -e "$LOCAL_REPO_DIR/repodata" -a \
+ -e "$LOCAL_REPO_DIR/RPMS" -a \
+ -e "$LOCAL_REPO_DIR/logs" -a \
+ -e "$LOCAL_REPO_DIR/index.html" ]; then
+ ln -s "$LOCAL_REPO_DIR/repodata" "$LOCAL_REPO_DIR/RPMS" repos/
+ cp $LOCAL_REPO_DIR/index.html builddata/
+ ln -s $LOCAL_REPO_DIR/logs builddata/
+ rsync -avzk "$WORKSPACE/$JOB_NAME" $PUBLISH_URL || cleanup_and_exit 1
+ else
+ echo "No build report generated"
+ fi
+}
+
+
+
--- /dev/null
+#!/bin/bash -xe
+#
+# Copyright (c) 2014 Intel, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; version 2 of the License
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+jenkins_script_dir=$(dirname $0)
+source $jenkins_script_dir/common_functions
+
+function update_manifest()
+{
+ # Manifest in-consistant issues
+ echo fix error in $MANIFEST_FILE
+ sed -i 's|system\(/smart\)|connectivity\1|g' $TMP_DIR/$MANIFEST_FILE
+ sed -i '/<remote fetch=/,+1 d' $TMP_DIR/$MANIFEST_FILE
+}
+
+# Clone & sync source code
+function prepare_tizen_src()
+{
+ pushd $TIZEN_SOURCE
+ rm .repo/manifests -rf
+ rm .repo/local_manifests -rf
+ repo init -u $MANIFEST_URL -b $MANIFEST_BRANCH -m ${PROFILE}.xml
+ popd
+
+ #Update original manifest by removing duplicated packags
+ #with specified package list to be built
+ HEADER="<?xml version=\"1.0\" encoding=\"UTF-8\"?>
+ <manifest>
+ "
+ for pkg in $PACKAGE_LIST
+ do
+ sed -i "\,\"$pkg\",d" $TMP_DIR/$MANIFEST_FILE
+ HEADER="$HEADER <project name=\"$pkg\" path=\"$pkg\" />
+"
+ done
+
+ HEADER="$HEADER</manifest>"
+
+ if [ ! -d $LOCAL_MANIFEST_DIR ]; then
+ mkdir $LOCAL_MANIFEST_DIR
+ fi
+
+ echo "create user customized local manifest: ${LOCAL_MANIFEST_DIR}/local.xml"
+
+ cat >"${LOCAL_MANIFEST_DIR}/local.xml" <<EOF
+$HEADER
+EOF
+
+ echo replace .repo/manifests/mobile/projects.xml with $MANIFEST_FILE
+ cp $TMP_DIR/$MANIFEST_FILE "${TIZEN_SOURCE}/.repo/manifests/$PROFILE/projects.xml"
+
+ pushd $TIZEN_SOURCE
+ #repo sync
+ popd
+}
+
+#MAIN START
+
+prepare_build_env
+
+MANIFEST_FILE="${BUILD_ID}_${ARCH}.xml"
+MANIFEST_FILE_URL="$REMOTE_REPOS/builddata/manifest/${MANIFEST_FILE}"
+LOCAL_MANIFEST_DIR="$TIZEN_SOURCE/.repo/local_manifests"
+[ $ARCH = ia32 ] && ARCH=i586
+
+#Download ks files
+for ks in $KS
+do
+ wget -q "$REMOTE_REPOS/builddata/image-configs/$ks" -O $TMP_DIR/$ks
+ KS_FILES="$KS_FILES $TMP_DIR/$ks"
+done
+
+#Download manifest file released in specified $REMOTE_REPOS
+wget -q $MANIFEST_FILE_URL -O "$TMP_DIR/$MANIFEST_FILE"
+update_manifest
+# prepare manifest and sync tizen src
+prepare_tizen_src
+
+profile_name=$(sed -n 's/profile.*=.*profile\.\(.*\)/\1/p' $TIZEN_SOURCE/.gbs.conf)
+LOCAL_REPO_DIR="$GBS_BUILD_ROOT/local/repos/$profile_name/$ARCH"
+
+#Building tizen source packages using gbs build
+cd $TIZEN_SOURCE
+gen_gbs_build_args
+[ "x$BUILD_RDEPS" == "xtrue" ] && GBS_BUILD_ARGS="$GBS_BUILD_ARGS --rdeps"
+PKG_LIST=$(echo $PACKAGE_LIST|sed 's/ /,/g')
+gbs build --arch $ARCH $GBS_BUILD_ARGS --package-list=$PKG_LIST || true
+
+# Building Images
+create_images
+
+#Publish repos, images and build reports
+if [ $PUBLISH = true -a -n "$PUBLISH_URL" ]; then
+ publish_artifacts
+fi
+
+cleanup_and_exit 0
--- /dev/null
+#!/bin/bash -xe
+#
+# Copyright (c) 2014 Intel, Inc.
+#
+# This program is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by the Free
+# Software Foundation; version 2 of the License
+#
+# This program is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc., 59
+# Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+jenkins_script_dir=$(dirname $0)
+source $jenkins_script_dir/common_functions
+
+# Clone & sync source code
+function prepare_tizen_src()
+{
+ pushd $TIZEN_SOURCE
+ repo init -u $MANIFEST_URL -b $MANIFEST_BRANCH -m ${PROFILE}.xml
+ repo sync
+ popd
+}
+
+# Get ks files via unpack image-configurations.rpm
+function get_ks_files
+{
+ image_configurations_rpm=`find $LOCAL_REPO_DIR -name "image-configurations*.noarch.rpm"`
+ if [ -z $image_configurations_rpm ]; then
+ echo "No image-configuation rpm generated, so can't get ks files"
+ return 1
+ fi
+
+ rpm -K $image_configurations_rpm || cleanup_and_exit 1;
+
+ for ks_file in $(rpm2cpio $image_configurations_rpm |cpio -t)
+ do
+ echo $ks_file|grep "ks$" || continue
+ ks_base_name=$(basename $ks_file)
+ rpm2cpio $image_configurations_rpm |cpio -i --quiet --to-stdout $ks_file >"$OUTPUT_DIR/builddata/image-configs/$ks_base_name"
+ KS_FILES="$KS_FILES $OUTPUT_DIR/builddata/image-configs/$ks_base_name"
+ done
+
+}
+
+
+#MAIN START
+
+prepare_build_env
+
+prepare_tizen_src
+
+profile_name=$(sed -n 's/profile.*=.*profile\.\(.*\)/\1/p' $TIZEN_SOURCE/.gbs.conf)
+LOCAL_REPO_DIR="$GBS_BUILD_ROOT/local/repos/$profile_name/$ARCH"
+
+#Building tizen source packages using gbs build
+cd $TIZEN_SOURCE
+gen_gbs_build_args
+gbs build --arch $ARCH $GBS_BUILD_ARGS || true
+
+# Building Images
+get_ks_files && create_images
+
+#Publish repos, images and build reports
+if [ $PUBLISH = true -a -n "$PUBLISH_URL" ]; then
+ publish_artifacts
+fi
+
+cleanup_and_exit 0
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_version: %define python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")}
+%define jobs_dir /var/lib/jenkins/jobs
+%define scripts_dir /var/lib/jenkins/jenkins-scripts
+
Name: gbs
Summary: The command line tools for Tizen package developers
Version: 0.20
This package contains gbs remotebuild APIs, which can be used by
external software.
+%package jenkins-jobs
+Summary: GBS local full build jenkins jobs configurations.
+
+%description jenkins-jobs
+These jenkins jobs are used to build tizen source from scratch or
+only a part of packages, and create images finally.
+
+%package jenkins-scripts
+Summary: Jenkins scripts used by gbs-jenkins-job
+Requires: gbs
+Requires: mic
+
+%description jenkins-scripts
+These scripts are used by GBS local full build jenkins jobs. These
+scripts should be installed on Jenkins slave nodes.
%prep
%setup -q -n %{name}-%{version}
mkdir -p %{buildroot}/%{_prefix}/share/man/man1
install -m644 docs/gbs.1 %{buildroot}/%{_prefix}/share/man/man1
+# Install Jenkins Jobs
+for job_name in $(ls jenkins-jobs/configs)
+do
+ mkdir -p %{buildroot}/%{jobs_dir}/${job_name}
+ install -m644 jenkins-jobs/configs/${job_name}/config.xml %{buildroot}/%{jobs_dir}/${job_name}
+done
+
+#Install Jenkins Scripts
+mkdir -p %{buildroot}/%{scripts_dir}
+install -m755 jenkins-jobs/scripts/* %{buildroot}/%{scripts_dir}
+
%clean
rm -rf %{buildroot}
%files remotebuild
%defattr(-,root,root,-)
%{python_sitelib}/gitbuildsys/cmd_remotebuild.py*
+
+%files jenkins-jobs
+%defattr(-,jenkins,jenkins,-)
+%dir /var/lib/jenkins
+%dir %{jobs_dir}
+%dir %{jobs_dir}/GBS-local-full-build
+%dir %{jobs_dir}/GBS-local-build-with-package-list
+%{jobs_dir}/GBS-local-full-build/config.xml
+%{jobs_dir}/GBS-local-build-with-package-list/config.xml
+
+%files jenkins-scripts
+%defattr(-,jenkins,jenkins,-)
+%dir /var/lib/jenkins
+%dir %{scripts_dir}
+%{scripts_dir}/job_local_full_build
+%{scripts_dir}/job_build_packagelist
+%{scripts_dir}/common_functions