summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbiao716.wang <biao716.wang@samsung.com>2021-07-14 22:18:20 +0900
committerbiao716.wang <biao716.wang@samsung.com>2021-07-14 22:18:20 +0900
commit9b7337b849b6f36d23495e8563c1c40bee248c84 (patch)
tree86df4d56e1790d76c05bcf4a06c2f8ac98503c9d
parent66a2dc05e3a54b4871f10a826f6c5aed28f50fad (diff)
parent76e43cc0d99cab56e830eb6700a1c8e7d9ebcbc8 (diff)
downloadbuild-9b7337b849b6f36d23495e8563c1c40bee248c84.tar.gz
build-9b7337b849b6f36d23495e8563c1c40bee248c84.tar.bz2
build-9b7337b849b6f36d23495e8563c1c40bee248c84.zip
Change-Id: I708266f00e362c29a664af4211d02a42c9076949
-rw-r--r--[-rwxr-xr-x]build62
-rw-r--r--build-pkg-rpm22
-rw-r--r--debian/changelog9
-rw-r--r--packaging/build.changes8
-rw-r--r--packaging/build.spec4
-rwxr-xr-xqueryconfig5
6 files changed, 98 insertions, 12 deletions
diff --git a/build b/build
index f98e1b7..374ebc9 100755..100644
--- a/build
+++ b/build
@@ -67,6 +67,7 @@ DO_CHECKS=true
SHORT_CIRCUIT=false
NO_TOPDIR_CLEANUP=false
CLEAN_BUILD=
+REMOVE_CCACHE=
KEEP_PACKS=
RECIPEFILES=()
SRCDIR=
@@ -99,6 +100,8 @@ CCACHE=
DLNOSIGNATURE=
CACHE_DIR=/var/cache/build
USEHIGHERDEPS=
+PKG_CCACHE=
+CCACHE_SETUP_START_TIME=
# This is for insserv
export YAST_IS_RUNNING=instsys
@@ -232,6 +235,10 @@ Known Parameters:
--ccache
Use ccache to speed up rebuilds
+ --pkg-ccache /path/to/ccache.tar.gz
+ path to archive of ccache directory content.
+ Its contents will be extracted to /.ccache
+
--icecream N
Use N parallel build jobs with icecream
@@ -425,9 +432,9 @@ toshellscript() {
setupccache() {
if test -n "$CCACHE" ; then
+ CCACHE_SETUP_START_TIME=`date +%s`
if mkdir -p "$BUILD_ROOT"/var/lib/build/ccache/bin; then
- for i in $(ls "$BUILD_ROOT"/usr/bin | grep -E '^(cc|gcc|[cg][+][+])([-]?[234][.]?[0-9])*$'); do
-# ln -sf /usr/bin/ccache $BUILD_ROOT/var/lib/build/ccache/bin/$i
+ for i in $(ls $BUILD_ROOT/usr/bin | grep -E '^(cc|gcc|[cg][+][+]|clang|clang[+][+])([-]?[.0-9])*$'); do
rm -f "$BUILD_ROOT"/var/lib/build/ccache/bin/$i
test -e "$BUILD_ROOT"/usr/bin/$i || continue
echo '#! /bin/sh' > "$BUILD_ROOT"/var/lib/build/ccache/bin/$i
@@ -439,11 +446,33 @@ setupccache() {
done
fi
mkdir -p "$BUILD_ROOT/.ccache"
- chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT/.ccache"
- echo "export CCACHE_DIR=/.ccache" > "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
+ # overwrite /etc/profile.d/build_ccache.sh
+ echo 'export CCACHE_DIR=/.ccache' > "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
echo 'export PATH=/var/lib/build/ccache/bin:$PATH' >> "$BUILD_ROOT"/etc/profile.d/build_ccache.sh
+
+ # Note
+ # Disable compression setting temporary
+ # Until ccache is applied to qemu-accel, it is very slow when using the function, so it will be applied later.
+ #
+ # https://ccache.dev/releasenotes.html#_ccache_4_0
+ # Changed compression algorithm from Deflate (zlib) to Zstandard, enabled by default.
+ enable_compression=false
+
+ local cconf="$BUILD_ROOT"/etc/ccache.conf
+ if test -e $cconf; then
+ grep -q "^compression*" $cconf && sed -i "s:compression.*:compression = $enable_compression:g" $cconf || echo "compression = $enable_compression" >> $cconf
+ grep -q "^cache_dir*" $cconf && sed -i "s:cache_dir.*:cache_dir = /.ccache:g" $cconf || echo "cache_dir = /.ccache" >> $cconf
else
- rm -f "$BUILD_ROOT"/var/lib/build/ccache/bin/{gcc,g++,cc,c++}
+ echo "compression = $enable_compression" >> $cconf
+ echo "cache_dir = /.ccache" >> $cconf
+ fi
+ local ccachetar="$BUILD_ROOT/.build.oldpackages/_ccache.tar"
+ test -e $ccachetar && tar -xf $ccachetar -C "$BUILD_ROOT/.ccache/"
+ rm -f $ccachetar
+ chown -R "$ABUILD_UID:$ABUILD_GID" "$BUILD_ROOT/.ccache"
+ else
+ CCACHE_SETUP_START_TIME=
+ rm -f "$BUILD_ROOT"/var/lib/build/ccache/bin/{gcc,g++,cc,c++,clang,clang++}
fi
}
@@ -765,6 +794,7 @@ while test -n "$1"; do
;;
-clean)
CLEAN_BUILD='--clean'
+ REMOVE_CCACHE="$CLEAN_BUILD"
;;
-kill)
KILL=true
@@ -891,6 +921,12 @@ while test -n "$1"; do
-ccache)
CCACHE=true
;;
+ -pkg-ccache)
+ needarg
+ PKG_CCACHE="$ARG"
+ shift
+ CCACHE=true
+ ;;
-statistics)
DO_STATISTICS=1
;;
@@ -1204,6 +1240,11 @@ for RECIPEFILE in "${RECIPEFILES[@]}" ; do
mount -n -tdevpts -omode=0620,gid=5 none "$BUILD_ROOT"/dev/pts
copy_oldpackages
+ # chroot based builds
+ # rsync as source and dest could be same
+ test -n "$PKG_CCACHE" -a -e "$PKG_CCACHE" && \
+ mkdir -p "$BUILD_ROOT/.build.oldpackages/" && \
+ rsync -v "$PKG_CCACHE" "$BUILD_ROOT/.build.oldpackages/_ccache.tar"
fi
# hack to process preinstallimages early
@@ -1465,6 +1506,17 @@ if test -n "$RPMS" -a "$DO_CHECKS" != false ; then
recipe_run_rpmlint
fi
+if test -n "$CCACHE" ; then
+ if test -n "$REMOVE_CCACHE" ; then
+ echo "... cleaning ccache"
+ test_cmd="ccache -h | grep -c evict-older-than"
+ clean_cmd="ccache --evict-older-than $(($(date +%s) - $CCACHE_SETUP_START_TIME))s"
+ chroot $BUILD_ROOT su -c "$test_cmd && $clean_cmd" - $BUILD_USER
+ fi
+ echo "... saving ccache"
+ tar ${REMOVE_CCACHE:+--remove-files} -cf "$BUILD_ROOT/$TOPDIR/OTHER/_ccache.tar" -C "$BUILD_ROOT/.ccache/" .
+fi
+
if test \( -n "$RPMS" -o -n "$DEBS" \) -a -n "$CREATE_BASELIBS"; then
create_baselibs
fi
diff --git a/build-pkg-rpm b/build-pkg-rpm
index 470a553..f3b79be 100644
--- a/build-pkg-rpm
+++ b/build-pkg-rpm
@@ -78,11 +78,23 @@ rpm_init_cumulate() {
CUMULATED_LIST=()
CUMULATED_PIDS=()
CUMULATED_HMD5=()
- DO_CUMULATE=
- typeset -ri suse_version=$(chroot "$BUILD_ROOT" rpm --eval '%{?suse_version}' 2>/dev/null)
- if ((suse_version > 1220)) ; then
- DO_CUMULATE=true
- fi
+
+# force enable DO_CUMULATE
+#
+# We can't use cumulative install because we don't use %suse_version macro.
+# However, our build system is based on openSUSE Build service and we use
+# always newer suse version than 1220. Thus, we can always enable cumulative
+# install instead of defining the suse_version.
+#
+# ref: https://review.tizen.org/gerrit/#/c/platform/upstream/build/+/25635/
+
+
+# DO_CUMULATE=
+# typeset -ri suse_version=$(chroot "$BUILD_ROOT" rpm --eval '%{?suse_version}' 2>/dev/null)
+# if ((suse_version > 1220)) ; then
+# DO_CUMULATE=true
+# fi
+ DO_CUMULATE=true
}
pkg_verify_installed_rpm() {
diff --git a/debian/changelog b/debian/changelog
index be5d286..a44a07b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,12 @@
+build (20160629-tizen20210713) unstable; urgency=high
+
+ * update tizen version to tizen20210713
+ * Allow BuildFlags: Buildflags: flag:key to pass an arg
+ * Use ccache.tar file with --pkg-ccache option
+ * Force enable DO_CUMULATE
+
+ -- Wang Biao <biao716.wang@samsung.com> Tue, 13 Jul 2021 09:30:00 +0800
+
build (20160629-tizen20210514) unstable; urgency=high
* update tizen version to tizen20210514
diff --git a/packaging/build.changes b/packaging/build.changes
index 4fa2365..8e8b1b5 100644
--- a/packaging/build.changes
+++ b/packaging/build.changes
@@ -1,4 +1,12 @@
--------------------------------------------------------------------
+Tue Jul 13 09:30:00 CST 2021 - biao716.wang@samsung.com
+
+- update tizen version to tizen20210713
+- Allow BuildFlags: Buildflags: flag:key to pass an arg
+- Use ccache.tar file with --pkg-ccache option
+- Force enable DO_CUMULATE
+
+--------------------------------------------------------------------
Fri May 14 09:30:00 CST 2021 - biao716.wang@samsung.com
- update tizen version to tizen20210514
diff --git a/packaging/build.spec b/packaging/build.spec
index 9112cbe..e1b2745 100644
--- a/packaging/build.spec
+++ b/packaging/build.spec
@@ -72,7 +72,7 @@ Requires: build-mkbaselibs
%if 0%{?suse_version} > 1120 || 0%{?mdkversion}
Recommends: build-mkdrpms
%endif
-Provides: tizen-build = 20210514
+Provides: tizen-build = 20210713
%description
This package provides a script for building RPMs for SUSE Linux in a
chroot environment.
@@ -116,7 +116,7 @@ Group: Development/Tools/Building
Requires: build
BuildRequires: gcc
BuildRequires: glibc-devel
-Provides: tizen-build-initvm-%{initvm_arch} = 20210514
+Provides: tizen-build-initvm-%{initvm_arch} = 20210713
Obsoletes: build-initvm
%if 0%{?suse_version}
BuildRequires: glibc-devel-static
diff --git a/queryconfig b/queryconfig
index f130931..f470605 100755
--- a/queryconfig
+++ b/queryconfig
@@ -61,6 +61,11 @@ if ($type eq 'buildflags') {
die("Specify which buildflag to query\n") unless $argument;
my $result = $cf->{"buildflags:$argument"};
print "$result\n" if defined $result;
+} elsif ($type eq 'buildflags+') {
+ die("Specify which buildflag to query\n") unless $argument;
+ for (@{$cf->{'buildflags'} || []}) {
+ print "$1\n" if /\Q$argument\E:(.*)/;
+ }
} elsif ($type eq 'hostarch') {
my $result = $cf->{"hostarch"};
print "$result\n" if defined $result;