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