ns = root.getroot().tag
ns = ns[0:ns.rindex("}")+1]
for elm in root.getiterator("%spackage" % ns):
- if elm.find("%sname" % ns).text == pkg:
- if elm.find("%sarch" % ns).text in arches:
- if repo["priority"] != None:
- tmpprior = int(repo["priority"])
- if tmpprior < priority:
- priority = tmpprior
- location = elm.find("%slocation" % ns)
- pkgpath = "%s" % location.attrib['href']
- target_repo = repo
- break
- elif tmpprior > priority:
- break
- version = elm.find("%sversion" % ns)
- tmpver = "%s-%s" % (version.attrib['ver'], version.attrib['rel'])
- if tmpver > ver:
- ver = tmpver
+ if elm.find("%sname" % ns).text == pkg and elm.find("%sarch" % ns).text in arches:
+ if repo["priority"] != None:
+ tmpprior = int(repo["priority"])
+ if tmpprior < priority:
+ priority = tmpprior
location = elm.find("%slocation" % ns)
pkgpath = "%s" % location.attrib['href']
target_repo = repo
- break
+ break
+ elif tmpprior > priority:
+ break
+ version = elm.find("%sversion" % ns)
+ tmpver = "%s-%s" % (version.attrib['ver'], version.attrib['rel'])
+ if tmpver > ver:
+ ver = tmpver
+ location = elm.find("%slocation" % ns)
+ pkgpath = "%s" % location.attrib['href']
+ target_repo = repo
+ break
if repo["primary"].endswith(".sqlite"):
con = sqlite.connect(repo["primary"])
if arch:
def is_statically_linked(binary):
return ", statically linked, " in runner.outs(['file', binary])
-def setup_qemu_emulator(rootdir, arch):
- qemu_emulators = []
- # mount binfmt_misc if it doesn't exist
- if not os.path.exists("/proc/sys/fs/binfmt_misc"):
- modprobecmd = find_binary_path("modprobe")
- runner.show([modprobecmd, "binfmt_misc"])
- if not os.path.exists("/proc/sys/fs/binfmt_misc/register"):
- mountcmd = find_binary_path("mount")
- runner.show([mountcmd, "-t", "binfmt_misc", "none", "/proc/sys/fs/binfmt_misc"])
-
- # qemu_emulator is a special case, we can't use find_binary_path
- # qemu emulator should be a statically-linked executable file
+def get_qemu_arm_binary(arch):
if arch == "aarch64":
node = "/proc/sys/fs/binfmt_misc/aarch64"
if os.path.exists("/usr/bin/qemu-arm64") and is_statically_linked("/usr/bin/qemu-arm64"):
if not os.path.exists("/usr/bin/%s" % arm_binary):
raise CreatorError("Please install a statically-linked %s" % arm_binary)
+ return (arm_binary, node)
+
+def setup_qemu_emulator(rootdir, arch):
+ qemu_emulators = []
+ # mount binfmt_misc if it doesn't exist
+ if not os.path.exists("/proc/sys/fs/binfmt_misc"):
+ modprobecmd = find_binary_path("modprobe")
+ runner.show([modprobecmd, "binfmt_misc"])
+ if not os.path.exists("/proc/sys/fs/binfmt_misc/register"):
+ mountcmd = find_binary_path("mount")
+ runner.show([mountcmd, "-t", "binfmt_misc", "none", "/proc/sys/fs/binfmt_misc"])
+
+ # qemu_emulator is a special case, we can't use find_binary_path
+ # qemu emulator should be a statically-linked executable file
+ arm_binary, node = get_qemu_arm_binary(arch)
qemu_emulator = "/usr/bin/%s" % arm_binary
if not os.path.exists(rootdir + "/usr/bin"):
for e in errors:
msger.warning(e[0])
raise RepoError('Could not run transaction.')
+ def show_unresolved_dependencies_msg(self, unresolved_dependencies):
+ for pkg, need, needflags, sense, key in unresolved_dependencies:
+
+ package = '-'.join(pkg)
+
+ if needflags == rpm.RPMSENSE_LESS:
+ deppkg = ' < '.join(need)
+ elif needflags == rpm.RPMSENSE_EQUAL:
+ deppkg = ' = '.join(need)
+ elif needflags == rpm.RPMSENSE_GREATER:
+ deppkg = ' > '.join(need)
+ else:
+ deppkg = '-'.join(need)
+
+ if sense == rpm.RPMDEP_SENSE_REQUIRES:
+ msger.warning("[%s] Requires [%s], which is not provided" \
+ % (package, deppkg))
+
+ elif sense == rpm.RPMDEP_SENSE_CONFLICTS:
+ msger.warning("[%s] Conflicts with [%s]" % (package, deppkg))
def installPkgs(self, package_objects):
if not self.ts:
raise RepoError('Could not run transaction.')
else:
- for pkg, need, needflags, sense, key in unresolved_dependencies:
- package = '-'.join(pkg)
-
- if needflags == rpm.RPMSENSE_LESS:
- deppkg = ' < '.join(need)
- elif needflags == rpm.RPMSENSE_EQUAL:
- deppkg = ' = '.join(need)
- elif needflags == rpm.RPMSENSE_GREATER:
- deppkg = ' > '.join(need)
- else:
- deppkg = '-'.join(need)
-
- if sense == rpm.RPMDEP_SENSE_REQUIRES:
- msger.warning("[%s] Requires [%s], which is not provided" \
- % (package, deppkg))
-
- elif sense == rpm.RPMDEP_SENSE_CONFLICTS:
- msger.warning("[%s] Conflicts with [%s]" % (package, deppkg))
-
+ self.show_unresolved_dependencies_msg(unresolved_dependencies)
raise RepoError("Unresolved dependencies, transaction failed.")
def __initialize_transaction(self):