From d50bfe66b513e84738707a66fdd1c5288c738cc9 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 26 Aug 2014 20:11:34 +0300 Subject: [PATCH] fix install noarch SBo pkgs --- slpkg/sbo/check.py | 13 +++++++++++-- slpkg/sbo/slackbuild.py | 10 +++++++++- slpkg/sbo/views.py | 13 +++++++++++-- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/slpkg/sbo/check.py b/slpkg/sbo/check.py index b436621e..5fcacfa6 100755 --- a/slpkg/sbo/check.py +++ b/slpkg/sbo/check.py @@ -25,6 +25,7 @@ import os import sys import subprocess +from pkg.find import find_package from pkg.build import build_package from pkg.manager import pkg_upgrade @@ -100,7 +101,7 @@ def sbo_check(): os.mkdir(build_path) os.chdir(build_path) for name, version in zip(pkg_name, sbo_ver): - pkg_for_install = ("{0}-{1}".format(name, version)) + prgnam = ("{0}-{1}".format(name, version)) sbo_url = sbo_search_pkg(name) sbo_dwn = sbo_slackbuild_dwn(sbo_url, name) src_dwn = sbo_source_dwn(name).split() @@ -112,8 +113,16 @@ def sbo_check(): subprocess.call("wget -N {0}".format(src), shell=True) sources.append(get_file(src, "/")) build_package(script, sources, build_path) + ''' + Before installing new binary package look if arch is noarch. + This is because some maintainers changes arch manualy. + ''' + if "-noarch-" in "".join(find_package(prgnam, tmp)): + sbo_arch = "-noarch-" + else: + from __metadata__ import sbo_arch binary = ("{0}{1}{2}{3}{4}{5}".format( - tmp, pkg_for_install, sbo_arch, build, sbo_tag, sbo_filetype).split()) + tmp, prgnam, sbo_arch, build, sbo_tag, sbo_filetype).split()) print("{0}[ Upgrading ] --> {1}{2}".format( colors.GREEN, colors.ENDC, name)) pkg_upgrade(binary) diff --git a/slpkg/sbo/slackbuild.py b/slpkg/sbo/slackbuild.py index 85415ab8..91d1d3e4 100755 --- a/slpkg/sbo/slackbuild.py +++ b/slpkg/sbo/slackbuild.py @@ -28,7 +28,7 @@ import subprocess from colors import colors from functions import get_file from messages import pkg_not_found, pkg_found, template -from __metadata__ import sbo_arch, build, sbo_tag, sbo_filetype +from __metadata__ import build, sbo_tag, sbo_filetype from __metadata__ import tmp, pkg_path, build_path, log_path, sp from pkg.find import find_package @@ -135,6 +135,14 @@ def sbo_build(name): subprocess.call("wget -N {0}".format(src), shell=True) sources.append(get_file(src, "/")) build_package(script, sources, build_path) + ''' + Before installing new binary package look if arch is noarch. + This is because some maintainers changes arch manualy. + ''' + if "-noarch-" in "".join(find_package(prgnam, tmp)): + sbo_arch = "-noarch-" + else: + from __metadata__ import sbo_arch binary = ("{0}{1}{2}{3}{4}{5}".format( tmp, prgnam, sbo_arch, build, sbo_tag, sbo_filetype).split()) print("{0}[ Installing ] --> {1}{2}".format( diff --git a/slpkg/sbo/views.py b/slpkg/sbo/views.py index 0aa0075e..54f8806a 100755 --- a/slpkg/sbo/views.py +++ b/slpkg/sbo/views.py @@ -109,7 +109,7 @@ def sbo_network(name): if find_package(name + sp, pkg_path) == []: sources = [] os.chdir(build_path) - pkg_for_install = ("{0}-{1}".format(name, sbo_version)) + prgnam = ("{0}-{1}".format(name, sbo_version)) print("\n{0}Start -->{1} {2}\n".format(colors.GREEN, colors.ENDC, name)) subprocess.call("wget -N {0}".format(sbo_dwn), shell=True) script = get_file(sbo_dwn, "/") @@ -117,8 +117,17 @@ def sbo_network(name): subprocess.call("wget -N {0}".format(src), shell=True) sources.append(get_file(src, "/")) build_package(script, sources, build_path) + ''' + Before installing new binary package look if arch is noarch. + This is because some maintainers changes arch manualy. + + ''' + if "-noarch-" in "".join(find_package(prgnam, tmp)): + sbo_arch = "-noarch-" + else: + from __metadata__ import sbo_arch binary = ("{0}{1}{2}{3}{4}{5}".format( - tmp, pkg_for_install, sbo_arch, build, sbo_tag, sbo_filetype).split()) + tmp, prgnam, sbo_arch, build, sbo_tag, sbo_filetype).split()) print("{0}[ Installing ] --> {1}{2}".format( colors.GREEN, colors.ENDC, name)) pkg_upgrade(binary)