summaryrefslogtreecommitdiffstats
path: root/meta/lib/oe/package_manager.py
diff options
context:
space:
mode:
authorHongxu Jia <hongxu.jia@windriver.com>2014-01-27 16:43:48 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2014-02-11 11:53:43 +0000
commit4a6596d95f0483891de4d2529303ddce343bb4f4 (patch)
tree35cd00c320c949478b2d7d7c5262000325f8fce5 /meta/lib/oe/package_manager.py
parentc8f41d7e48e6b299558add73e461d4f49a90e12a (diff)
downloadpoky-4a6596d95f0483891de4d2529303ddce343bb4f4.tar.gz
lib/oe/package_manager.py: moving global SCRIPTLET_FORMAT and DB_CONFIG_CONTENT to RpmPM
The tweak made the code looks better. (From OE-Core rev: 8e06be633222635c549d7f067218e8b833e76bda) Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com> Signed-off-by: Laurentiu Palcu <laurentiu.palcu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib/oe/package_manager.py')
-rw-r--r--meta/lib/oe/package_manager.py103
1 files changed, 51 insertions, 52 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 811ad09e68..139a6211ee 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -7,58 +7,6 @@ import multiprocessing
7import re 7import re
8import bb 8import bb
9 9
10DB_CONFIG_CONTENT = '''# ================ Environment
11set_data_dir .
12set_create_dir .
13set_lg_dir ./log
14set_tmp_dir ./tmp
15set_flags db_log_autoremove on
16
17# -- thread_count must be >= 8
18set_thread_count 64
19
20# ================ Logging
21
22# ================ Memory Pool
23set_cachesize 0 1048576 0
24set_mp_mmapsize 268435456
25
26# ================ Locking
27set_lk_max_locks 16384
28set_lk_max_lockers 16384
29set_lk_max_objects 16384
30mutex_set_max 163840
31
32# ================ Replication
33'''
34
35SCRIPTLET_FORMAT = '''#!/bin/bash
36
37export PATH=%s
38export D=%s
39export OFFLINE_ROOT="$D"
40export IPKG_OFFLINE_ROOT="$D"
41export OPKG_OFFLINE_ROOT="$D"
42export INTERCEPT_DIR=%s
43export NATIVE_ROOT=%s
44
45$2 $1/$3 $4
46if [ $? -ne 0 ]; then
47 if [ $4 -eq 1 ]; then
48 mkdir -p $1/etc/rpm-postinsts
49 num=100
50 while [ -e $1/etc/rpm-postinsts/${num}-* ]; do num=$((num + 1)); done
51 name=`head -1 $1/$3 | cut -d\' \' -f 2`
52 echo "#!$2" > $1/etc/rpm-postinsts/${num}-${name}
53 echo "# Arg: $4" >> $1/etc/rpm-postinsts/${num}-${name}
54 cat $1/$3 >> $1/etc/rpm-postinsts/${num}-${name}
55 chmod +x $1/etc/rpm-postinsts/${num}-${name}
56 else
57 echo "Error: pre/post remove scriptlet failed"
58 fi
59fi
60'''
61
62 10
63# this can be used by all PM backends to create the index files in parallel 11# this can be used by all PM backends to create the index files in parallel
64def create_index(arg): 12def create_index(arg):
@@ -405,6 +353,31 @@ class RpmPM(PackageManager):
405 if not os.path.exists(rpmlib_log): 353 if not os.path.exists(rpmlib_log):
406 bb.utils.mkdirhier(os.path.join(self.image_rpmlib, 'log')) 354 bb.utils.mkdirhier(os.path.join(self.image_rpmlib, 'log'))
407 open(rpmlib_log, 'w+').close() 355 open(rpmlib_log, 'w+').close()
356
357 DB_CONFIG_CONTENT = "# ================ Environment\n" \
358 "set_data_dir .\n" \
359 "set_create_dir .\n" \
360 "set_lg_dir ./log\n" \
361 "set_tmp_dir ./tmp\n" \
362 "set_flags db_log_autoremove on\n" \
363 "\n" \
364 "# -- thread_count must be >= 8\n" \
365 "set_thread_count 64\n" \
366 "\n" \
367 "# ================ Logging\n" \
368 "\n" \
369 "# ================ Memory Pool\n" \
370 "set_cachesize 0 1048576 0\n" \
371 "set_mp_mmapsize 268435456\n" \
372 "\n" \
373 "# ================ Locking\n" \
374 "set_lk_max_locks 16384\n" \
375 "set_lk_max_lockers 16384\n" \
376 "set_lk_max_objects 16384\n" \
377 "mutex_set_max 163840\n" \
378 "\n" \
379 "# ================ Replication\n"
380
408 db_config_dir = os.path.join(self.image_rpmlib, 'DB_CONFIG') 381 db_config_dir = os.path.join(self.image_rpmlib, 'DB_CONFIG')
409 if not os.path.exists(db_config_dir): 382 if not os.path.exists(db_config_dir):
410 open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT) 383 open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT)
@@ -469,6 +442,32 @@ class RpmPM(PackageManager):
469 # If we ever run into needing more the 899 scripts, we'll have to. 442 # If we ever run into needing more the 899 scripts, we'll have to.
470 # change num to start with 1000. 443 # change num to start with 1000.
471 # 444 #
445 SCRIPTLET_FORMAT = "#!/bin/bash\n" \
446 "\n" \
447 "export PATH=%s\n" \
448 "export D=%s\n" \
449 'export OFFLINE_ROOT="$D"\n' \
450 'export IPKG_OFFLINE_ROOT="$D"\n' \
451 'export OPKG_OFFLINE_ROOT="$D"\n' \
452 "export INTERCEPT_DIR=%s\n" \
453 "export NATIVE_ROOT=%s\n" \
454 "\n" \
455 "$2 $1/$3 $4\n" \
456 "if [ $? -ne 0 ]; then\n" \
457 " if [ $4 -eq 1 ]; then\n" \
458 " mkdir -p $1/etc/rpm-postinsts\n" \
459 " num=100\n" \
460 " while [ -e $1/etc/rpm-postinsts/${num}-* ]; do num=$((num + 1)); done\n" \
461 " name=`head -1 $1/$3 | cut -d\' \' -f 2`\n" \
462 ' echo "#!$2" > $1/etc/rpm-postinsts/${num}-${name}\n' \
463 ' echo "# Arg: $4" >> $1/etc/rpm-postinsts/${num}-${name}\n' \
464 " cat $1/$3 >> $1/etc/rpm-postinsts/${num}-${name}\n" \
465 " chmod +x $1/etc/rpm-postinsts/${num}-${name}\n" \
466 " else\n" \
467 ' echo "Error: pre/post remove scriptlet failed"\n' \
468 " fi\n" \
469 "fi\n"
470
472 intercept_dir = self.d.expand('${WORKDIR}/intercept_scripts') 471 intercept_dir = self.d.expand('${WORKDIR}/intercept_scripts')
473 native_root = self.d.getVar('STAGING_DIR_NATIVE', True) 472 native_root = self.d.getVar('STAGING_DIR_NATIVE', True)
474 scriptlet_content = SCRIPTLET_FORMAT % (os.environ['PATH'], 473 scriptlet_content = SCRIPTLET_FORMAT % (os.environ['PATH'],