wok rev 20667

cookutils: patch to avoid parallel execution of pkgdb
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat Jan 19 14:18:09 2019 +0200 (2019-01-19)
parents 35f179a3bcbc
children bdd5dd52ad52
files cookutils/receipt cookutils/stuff/pkgdb-no-parallel.patch
line diff
     1.1 --- a/cookutils/receipt	Sat Jan 19 13:41:36 2019 +0200
     1.2 +++ b/cookutils/receipt	Sat Jan 19 14:18:09 2019 +0200
     1.3 @@ -21,6 +21,7 @@
     1.4  {
     1.5  	sed -i 's|\. receipt|. ./receipt|' cook
     1.6  	patch -p1 -i $stuff/pkgdb-absolute.patch
     1.7 +	patch -p1 -i $stuff/pkgdb-no-parallel.patch
     1.8  	mkdir -p $DESTDIR/usr/bin $DESTDIR/etc/slitaz
     1.9  	make DESTDIR=$DESTDIR install
    1.10  }
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/cookutils/stuff/pkgdb-no-parallel.patch	Sat Jan 19 14:18:09 2019 +0200
     2.3 @@ -0,0 +1,64 @@
     2.4 +Parallel execution of pkgdb detected on cooking host.
     2.5 +It is necessary to avoid this, as it leads to incorrect databases.
     2.6 +
     2.7 +--- a/modules/pkgdb
     2.8 ++++ b/modules/pkgdb
     2.9 +@@ -22,7 +22,15 @@
    2.10 + 
    2.11 + 
    2.12 + 
    2.13 ++# Avoid parallel execution
    2.14 + 
    2.15 ++BLOCK=$PKGS/pkgdb.block
    2.16 ++if [ -e "$BLOCK" ]; then
    2.17 ++	echo "pkgdb already executed - exiting now" | dblog
    2.18 ++	exit 1
    2.19 ++fi
    2.20 ++touch $BLOCK
    2.21 ++
    2.22 + # Create suitable packages list for TazPkg and only for built packages
    2.23 + # as well as flavors files for TazLiTo. We don't need logs since we do it
    2.24 + # manually to ensure everything is fine before syncing the mirror.
    2.25 +@@ -35,6 +43,7 @@
    2.26 + 		[ -n "$1" ] && PKGS="$1"
    2.27 + 		if [ ! -d "$PKGS" ]; then
    2.28 + 			{ newline; _ "Packages directory \"%s\" doesn't exist" "$PKGS"; newline; } | dblog
    2.29 ++			rm $BLOCK
    2.30 + 			exit 1
    2.31 + 		fi ;;
    2.32 + esac
    2.33 +@@ -212,10 +221,14 @@
    2.34 + # Create all flavors files at once. Do we really need code to monitor
    2.35 + # flavors changes? Let's just build them with packages lists before
    2.36 + # syncing the mirror.
    2.37 +-[ "$1" != '--flavors' ] && exit 1
    2.38 ++if [ "$1" != '--flavors' ]; then
    2.39 ++	rm $BLOCK
    2.40 ++	exit 1
    2.41 ++fi
    2.42 + 
    2.43 + if [ ! -d "$flavors" ]; then
    2.44 + 	{ _ 'Missing flavors folder "%s"' "$flavors"; newline; } | dblog
    2.45 ++	rm $BLOCK
    2.46 + 	exit 1
    2.47 + fi
    2.48 + 
    2.49 +@@ -246,7 +259,10 @@
    2.50 + for i in $flavors/*; do
    2.51 + 	fl=$(basename $i)
    2.52 + 	_ 'Packing flavor "%s"' "$fl" | dblog
    2.53 +-	tazlito pack-flavor $fl >/dev/null || exit 1
    2.54 ++	if ! tazlito pack-flavor $fl >/dev/null; then
    2.55 ++		rm $BLOCK
    2.56 ++		exit 1
    2.57 ++	fi
    2.58 + 	tazlito show-flavor $fl --brief --noheader 2>/dev/null >> flavors.list
    2.59 + done
    2.60 + cp -f $live/*.flavor $live/flavors.list $PKGS
    2.61 +@@ -257,5 +273,5 @@
    2.62 + 
    2.63 + > $command
    2.64 + 
    2.65 +-
    2.66 ++rm $BLOCK
    2.67 + exit 0