wok annotate cookutils/stuff/pkgdb-no-parallel.patch @ rev 23821
syslinux: merge init.exe & taziso (again)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Thu May 28 09:34:09 2020 +0000 (2020-05-28) |
parents | |
children | bde99f8d4916 |
rev | line source |
---|---|
al@20667 | 1 Parallel execution of pkgdb detected on cooking host. |
al@20667 | 2 It is necessary to avoid this, as it leads to incorrect databases. |
al@20667 | 3 |
al@20667 | 4 --- a/modules/pkgdb |
al@20667 | 5 +++ b/modules/pkgdb |
al@20667 | 6 @@ -22,7 +22,15 @@ |
al@20667 | 7 |
al@20667 | 8 |
al@20667 | 9 |
al@20667 | 10 +# Avoid parallel execution |
al@20667 | 11 |
al@20667 | 12 +BLOCK=$PKGS/pkgdb.block |
al@20667 | 13 +if [ -e "$BLOCK" ]; then |
al@20667 | 14 + echo "pkgdb already executed - exiting now" | dblog |
al@20667 | 15 + exit 1 |
al@20667 | 16 +fi |
al@20667 | 17 +touch $BLOCK |
al@20667 | 18 + |
al@20667 | 19 # Create suitable packages list for TazPkg and only for built packages |
al@20667 | 20 # as well as flavors files for TazLiTo. We don't need logs since we do it |
al@20667 | 21 # manually to ensure everything is fine before syncing the mirror. |
al@20667 | 22 @@ -35,6 +43,7 @@ |
al@20667 | 23 [ -n "$1" ] && PKGS="$1" |
al@20667 | 24 if [ ! -d "$PKGS" ]; then |
al@20667 | 25 { newline; _ "Packages directory \"%s\" doesn't exist" "$PKGS"; newline; } | dblog |
al@20667 | 26 + rm $BLOCK |
al@20667 | 27 exit 1 |
al@20667 | 28 fi ;; |
al@20667 | 29 esac |
al@20667 | 30 @@ -212,10 +221,14 @@ |
al@20667 | 31 # Create all flavors files at once. Do we really need code to monitor |
al@20667 | 32 # flavors changes? Let's just build them with packages lists before |
al@20667 | 33 # syncing the mirror. |
al@20667 | 34 -[ "$1" != '--flavors' ] && exit 1 |
al@20667 | 35 +if [ "$1" != '--flavors' ]; then |
al@20667 | 36 + rm $BLOCK |
al@20667 | 37 + exit 1 |
al@20667 | 38 +fi |
al@20667 | 39 |
al@20667 | 40 if [ ! -d "$flavors" ]; then |
al@20667 | 41 { _ 'Missing flavors folder "%s"' "$flavors"; newline; } | dblog |
al@20667 | 42 + rm $BLOCK |
al@20667 | 43 exit 1 |
al@20667 | 44 fi |
al@20667 | 45 |
al@20667 | 46 @@ -246,7 +259,10 @@ |
al@20667 | 47 for i in $flavors/*; do |
al@20667 | 48 fl=$(basename $i) |
al@20667 | 49 _ 'Packing flavor "%s"' "$fl" | dblog |
al@20667 | 50 - tazlito pack-flavor $fl >/dev/null || exit 1 |
al@20667 | 51 + if ! tazlito pack-flavor $fl >/dev/null; then |
al@20667 | 52 + rm $BLOCK |
al@20667 | 53 + exit 1 |
al@20667 | 54 + fi |
al@20667 | 55 tazlito show-flavor $fl --brief --noheader 2>/dev/null >> flavors.list |
al@20667 | 56 done |
al@20667 | 57 cp -f $live/*.flavor $live/flavors.list $PKGS |
al@20667 | 58 @@ -257,5 +273,5 @@ |
al@20667 | 59 |
al@20667 | 60 > $command |
al@20667 | 61 |
al@20667 | 62 - |
al@20667 | 63 +rm $BLOCK |
al@20667 | 64 exit 0 |