From: Junchun Guan Date: Thu, 27 Feb 2014 08:13:35 +0000 (+0800) Subject: Add jenkins jobs and jenkins scripts for GBS local full build X-Git-Tag: 0.21~18 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=53e10c6c975efb701cf70160c7465c23ff222e85;p=tools%2Fgbs.git Add jenkins jobs and jenkins scripts for GBS local full build Two sub-packages introduced: - gbs-jenkins-jobs: jenkins job configuation files - gbs-jenkins-scripts: scripts used by jenkins jobs gbs-jenkins-jobs should be installed on jenkins master, and jenkisn script should be installed on jenkins slave nodes. Fixes: #1565 Change-Id: I879d238a82739c7cea62a371edf9e8ee7f4fdbb9 Signed-off-by: Junchun Guan Signed-off-by: Zhang Qiang --- diff --git a/debian/control b/debian/control index e44874d..fcd7ee3 100644 --- a/debian/control +++ b/debian/control @@ -58,3 +58,18 @@ Replaces: gbs (<< 0.18.1) 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. diff --git a/debian/gbs-jenkins-jobs.install b/debian/gbs-jenkins-jobs.install new file mode 100644 index 0000000..5b0e00d --- /dev/null +++ b/debian/gbs-jenkins-jobs.install @@ -0,0 +1 @@ +var/lib/jenkins/jobs/* diff --git a/debian/gbs-jenkins-jobs.postinst b/debian/gbs-jenkins-jobs.postinst new file mode 100644 index 0000000..48999c7 --- /dev/null +++ b/debian/gbs-jenkins-jobs.postinst @@ -0,0 +1 @@ +chown -R jenkins. /var/lib/jenkins/jobs diff --git a/debian/gbs-jenkins-scripts.install b/debian/gbs-jenkins-scripts.install new file mode 100644 index 0000000..1779501 --- /dev/null +++ b/debian/gbs-jenkins-scripts.install @@ -0,0 +1,3 @@ +var/lib/jenkins/jenkins-scripts/common_functions +var/lib/jenkins/jenkins-scripts/job_local_full_build +var/lib/jenkins/jenkins-scripts/job_build_packagelist diff --git a/debian/gbs-jenkins-scripts.postinst b/debian/gbs-jenkins-scripts.postinst new file mode 100644 index 0000000..9e40947 --- /dev/null +++ b/debian/gbs-jenkins-scripts.postinst @@ -0,0 +1 @@ +chown -R jenkins. /var/lib/jenkins/jenkins-scripts diff --git a/debian/rules b/debian/rules index fcec0a2..6f59c1c 100644 --- a/debian/rules +++ b/debian/rules @@ -8,6 +8,12 @@ override_dh_auto_install: 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' diff --git a/jenkins-jobs/configs/GBS-local-build-with-package-list/config.xml b/jenkins-jobs/configs/GBS-local-build-with-package-list/config.xml new file mode 100644 index 0000000..df7a4ef --- /dev/null +++ b/jenkins-jobs/configs/GBS-local-build-with-package-list/config.xml @@ -0,0 +1,197 @@ + + + + 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> + false + + + + + MANIFEST_URL + <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> + + review.tizen.org:scm/manifest + + + MANIFEST_BRANCH + 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. + tizen + + + PROFILE + This option specifies the target profile, valid values: <cite>IVI</cite>, <cite>Mobile</cite>. + + + ivi + mobile + + + + + REMOTE_REPOS + 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/ + https://download.tizen.org/releases/daily/tizen/ivi/ivi/tizen_20140214.10 + + + KS + ks file name. +Example: + mobile.ks + +For multiple ks file use spaces to separate them: + mobile.ks mobile-ref.ks + ivi-mbr-i586.ks + + + BUILD_RDEPS + Check this box, all packages depend on specified packages will be built in correct dependency order. + true + + + PACKAGE_LIST + Specify the packages list to be built, and one line for per package. The format should be the detail path in remote gerrit. + apps/core/preloaded/menu-screen +apps/core/preloaded/settings + + + + ARCH + This option specifies the arch to be built, valid values: <cite>i586</cite> + + + ia32 + armv7l + + + + + PARALEL_THREADS + This option determines how many builder gbs should run in parallel. + 4 + + + EXCLUDE_PACKAGES + This option specifies the packages that does not participate in building. +And also can be used to break dependency cycles. + texinfo,aul,gettext + + + BUILD_ARGS + 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. + + + + PUBLISH + This option enables the publishing of build artifacts to respective download servers. Build artifacts include report, images and repos.. + true + + + PUBLISH_URL + 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. + + + + + + + true + false + false + false + + false + + + ${JENKINS_HOME}/jenkins-scripts/job_build_packagelist + + + + + diff --git a/jenkins-jobs/configs/GBS-local-full-build/config.xml b/jenkins-jobs/configs/GBS-local-full-build/config.xml new file mode 100644 index 0000000..e2d63f1 --- /dev/null +++ b/jenkins-jobs/configs/GBS-local-full-build/config.xml @@ -0,0 +1,156 @@ + + + + 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> + false + + + + + MANIFEST_URL + <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> + + review.tizen.org:scm/manifest + + + MANIFEST_BRANCH + 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. + tizen + + + PROFILE + This option specifies the target profile, valid values: <cite>IVI</cite>, <cite>Mobile</cite>. + + + ivi + mobile + + + + + REMOTE_REPOS + 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/ + https://download.tizen.org/releases/daily/tizen/ivi/ivi/tizen_20140214.10 + + + ARCH + This option specifies the arch to be built, valid values: <cite>i586</cite> + + + i586 + armv7l + + + + + PARALEL_THREADS + This option determines how many builder gbs should run in parallel. + 4 + + + EXCLUDE_PACKAGES + This option specifies the packages that does not participate in building. +And also can be used to break dependency cycles. + texinfo,aul,gettext + + + BUILD_ARGS + 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. + platform/upstream/image-configurations + + + PUBLISH + This option enables the publishing of build artifacts to respective download servers. Build artifacts include report, images and repos.. + true + + + PUBLISH_URL + 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. + + + + + + + true + false + false + false + + false + + + ${JENKINS_HOME}/jenkins-scripts/job_local_full_build + + + + + diff --git a/jenkins-jobs/scripts/common_functions b/jenkins-jobs/scripts/common_functions new file mode 100755 index 0000000..a68a721 --- /dev/null +++ b/jenkins-jobs/scripts/common_functions @@ -0,0 +1,110 @@ +#!/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 +} + + + diff --git a/jenkins-jobs/scripts/job_build_packagelist b/jenkins-jobs/scripts/job_build_packagelist new file mode 100755 index 0000000..e822436 --- /dev/null +++ b/jenkins-jobs/scripts/job_build_packagelist @@ -0,0 +1,110 @@ +#!/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 '/ + + " + for pkg in $PACKAGE_LIST + do + sed -i "\,\"$pkg\",d" $TMP_DIR/$MANIFEST_FILE + HEADER="$HEADER +" + done + + HEADER="$HEADER" + + 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" <"$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 diff --git a/packaging/gbs.spec b/packaging/gbs.spec index 45c2c7c..61b73b5 100644 --- a/packaging/gbs.spec +++ b/packaging/gbs.spec @@ -1,5 +1,8 @@ %{!?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 @@ -74,6 +77,21 @@ Requires: git-buildpackage-rpm 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} @@ -89,6 +107,17 @@ make man 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} @@ -128,3 +157,20 @@ 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