summaryrefslogtreecommitdiffstats
path: root/meta/lib
diff options
context:
space:
mode:
authorJoshua Lock <joshua.g.lock@intel.com>2016-03-11 14:07:31 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-20 23:12:30 +0000
commitd915965117e9ca1007183268b46be6bb6fca80cf (patch)
treeca4fcb950c42394938d5e1fb31b00a2f806363fc /meta/lib
parent03fce7358deed578f4be13f54ddf87eeee35b909 (diff)
downloadpoky-d915965117e9ca1007183268b46be6bb6fca80cf.tar.gz
lib/package_manager: remove RPM4 support code
Simplify the RPM code by removing support for RPM 4 now that we've dropped the RPM 4 recipe. (From OE-Core rev: 7db6f0a402948ce489bafadf2e389802f764f122) Signed-off-by: Joshua Lock <joshua.g.lock@intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/lib')
-rw-r--r--meta/lib/oe/package_manager.py94
1 files changed, 38 insertions, 56 deletions
diff --git a/meta/lib/oe/package_manager.py b/meta/lib/oe/package_manager.py
index 919104f107..0d23d8bc89 100644
--- a/meta/lib/oe/package_manager.py
+++ b/meta/lib/oe/package_manager.py
@@ -361,7 +361,6 @@ class RpmPkgsList(PkgsList):
361 except subprocess.CalledProcessError as e: 361 except subprocess.CalledProcessError as e:
362 bb.fatal("Getting rpm version failed. Command '%s' " 362 bb.fatal("Getting rpm version failed. Command '%s' "
363 "returned %d:\n%s" % (cmd, e.returncode, e.output)) 363 "returned %d:\n%s" % (cmd, e.returncode, e.output))
364 self.rpm_version = int(output.split()[-1].split('.')[0])
365 364
366 ''' 365 '''
367 Translate the RPM/Smart format names to the OE multilib format names 366 Translate the RPM/Smart format names to the OE multilib format names
@@ -412,10 +411,7 @@ class RpmPkgsList(PkgsList):
412 def list_pkgs(self): 411 def list_pkgs(self):
413 cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir 412 cmd = self.rpm_cmd + ' --root ' + self.rootfs_dir
414 cmd += ' -D "_dbpath /var/lib/rpm" -qa' 413 cmd += ' -D "_dbpath /var/lib/rpm" -qa'
415 if self.rpm_version == 4: 414 cmd += " --qf '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]'"
416 cmd += " --qf '[%{NAME} %{ARCH} %{VERSION}\n]'"
417 else:
418 cmd += " --qf '[%{NAME} %{ARCH} %{VERSION} %{PACKAGEORIGIN}\n]'"
419 415
420 try: 416 try:
421 # bb.note(cmd) 417 # bb.note(cmd)
@@ -426,11 +422,7 @@ class RpmPkgsList(PkgsList):
426 422
427 output = dict() 423 output = dict()
428 deps = dict() 424 deps = dict()
429 if self.rpm_version == 4: 425 dependencies = self._list_pkg_deps()
430 bb.warn("Dependency listings are not supported with rpm 4 since rpmresolve does not work")
431 dependencies = ""
432 else:
433 dependencies = self._list_pkg_deps()
434 426
435 # Populate deps dictionary for better manipulation 427 # Populate deps dictionary for better manipulation
436 for line in dependencies.splitlines(): 428 for line in dependencies.splitlines():
@@ -455,10 +447,8 @@ class RpmPkgsList(PkgsList):
455 # Skip GPG keys 447 # Skip GPG keys
456 if pkg == 'gpg-pubkey': 448 if pkg == 'gpg-pubkey':
457 continue 449 continue
458 if self.rpm_version == 4: 450
459 pkgorigin = "unknown" 451 pkgorigin = line.split()[3]
460 else:
461 pkgorigin = line.split()[3]
462 new_pkg, new_arch = self._pkg_translate_smart_to_oe(pkg, arch) 452 new_pkg, new_arch = self._pkg_translate_smart_to_oe(pkg, arch)
463 453
464 output[new_pkg] = {"arch":new_arch, "ver":ver, 454 output[new_pkg] = {"arch":new_arch, "ver":ver,
@@ -691,7 +681,6 @@ class RpmPM(PackageManager):
691 681
692 self.indexer = RpmIndexer(self.d, self.deploy_dir) 682 self.indexer = RpmIndexer(self.d, self.deploy_dir)
693 self.pkgs_list = RpmPkgsList(self.d, self.target_rootfs, arch_var, os_var) 683 self.pkgs_list = RpmPkgsList(self.d, self.target_rootfs, arch_var, os_var)
694 self.rpm_version = self.pkgs_list.rpm_version
695 684
696 self.ml_prefix_list, self.ml_os_list = self.indexer.get_ml_prefix_and_os_list(arch_var, os_var) 685 self.ml_prefix_list, self.ml_os_list = self.indexer.get_ml_prefix_and_os_list(arch_var, os_var)
697 686
@@ -913,44 +902,41 @@ class RpmPM(PackageManager):
913 # After change the __db.* cache size, log file will not be 902 # After change the __db.* cache size, log file will not be
914 # generated automatically, that will raise some warnings, 903 # generated automatically, that will raise some warnings,
915 # so touch a bare log for rpm write into it. 904 # so touch a bare log for rpm write into it.
916 if self.rpm_version == 5: 905 rpmlib_log = os.path.join(self.image_rpmlib, 'log', 'log.0000000001')
917 rpmlib_log = os.path.join(self.image_rpmlib, 'log', 'log.0000000001') 906 if not os.path.exists(rpmlib_log):
918 if not os.path.exists(rpmlib_log): 907 bb.utils.mkdirhier(os.path.join(self.image_rpmlib, 'log'))
919 bb.utils.mkdirhier(os.path.join(self.image_rpmlib, 'log')) 908 open(rpmlib_log, 'w+').close()
920 open(rpmlib_log, 'w+').close() 909
921 910 DB_CONFIG_CONTENT = "# ================ Environment\n" \
922 DB_CONFIG_CONTENT = "# ================ Environment\n" \ 911 "set_data_dir .\n" \
923 "set_data_dir .\n" \ 912 "set_create_dir .\n" \
924 "set_create_dir .\n" \ 913 "set_lg_dir ./log\n" \
925 "set_lg_dir ./log\n" \ 914 "set_tmp_dir ./tmp\n" \
926 "set_tmp_dir ./tmp\n" \ 915 "set_flags db_log_autoremove on\n" \
927 "set_flags db_log_autoremove on\n" \ 916 "\n" \
928 "\n" \ 917 "# -- thread_count must be >= 8\n" \
929 "# -- thread_count must be >= 8\n" \ 918 "set_thread_count 64\n" \
930 "set_thread_count 64\n" \ 919 "\n" \
931 "\n" \ 920 "# ================ Logging\n" \
932 "# ================ Logging\n" \ 921 "\n" \
933 "\n" \ 922 "# ================ Memory Pool\n" \
934 "# ================ Memory Pool\n" \ 923 "set_cachesize 0 1048576 0\n" \
935 "set_cachesize 0 1048576 0\n" \ 924 "set_mp_mmapsize 268435456\n" \
936 "set_mp_mmapsize 268435456\n" \ 925 "\n" \
937 "\n" \ 926 "# ================ Locking\n" \
938 "# ================ Locking\n" \ 927 "set_lk_max_locks 16384\n" \
939 "set_lk_max_locks 16384\n" \ 928 "set_lk_max_lockers 16384\n" \
940 "set_lk_max_lockers 16384\n" \ 929 "set_lk_max_objects 16384\n" \
941 "set_lk_max_objects 16384\n" \ 930 "mutex_set_max 163840\n" \
942 "mutex_set_max 163840\n" \ 931 "\n" \
943 "\n" \ 932 "# ================ Replication\n"
944 "# ================ Replication\n" 933
945 934 db_config_dir = os.path.join(self.image_rpmlib, 'DB_CONFIG')
946 db_config_dir = os.path.join(self.image_rpmlib, 'DB_CONFIG') 935 if not os.path.exists(db_config_dir):
947 if not os.path.exists(db_config_dir): 936 open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT)
948 open(db_config_dir, 'w+').write(DB_CONFIG_CONTENT)
949 937
950 # Create database so that smart doesn't complain (lazy init) 938 # Create database so that smart doesn't complain (lazy init)
951 opt = "-qa" 939 opt = "-qa"
952 if self.rpm_version == 4:
953 opt = "--initdb"
954 cmd = "%s --root %s --dbpath /var/lib/rpm %s > /dev/null" % ( 940 cmd = "%s --root %s --dbpath /var/lib/rpm %s > /dev/null" % (
955 self.rpm_cmd, self.target_rootfs, opt) 941 self.rpm_cmd, self.target_rootfs, opt)
956 try: 942 try:
@@ -1037,12 +1023,8 @@ class RpmPM(PackageManager):
1037 # If we ever run into needing more the 899 scripts, we'll have to. 1023 # If we ever run into needing more the 899 scripts, we'll have to.
1038 # change num to start with 1000. 1024 # change num to start with 1000.
1039 # 1025 #
1040 if self.rpm_version == 4: 1026 scriptletcmd = "$2 $1/$3 $4\n"
1041 scriptletcmd = "$2 $3 $4\n" 1027 scriptpath = "$1/$3"
1042 scriptpath = "$3"
1043 else:
1044 scriptletcmd = "$2 $1/$3 $4\n"
1045 scriptpath = "$1/$3"
1046 1028
1047 # When self.debug_level >= 3, also dump the content of the 1029 # When self.debug_level >= 3, also dump the content of the
1048 # executed scriptlets and how they get invoked. We have to 1030 # executed scriptlets and how they get invoked. We have to