mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-28 19:58:18 +01:00
Fix return binary #46
This commit is contained in:
parent
aaa88b2ec8
commit
40f4bbcdd8
1 changed files with 10 additions and 27 deletions
|
@ -22,43 +22,26 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
|
||||||
import os
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
from slpkg.messages import Msg
|
from slpkg.messages import Msg
|
||||||
from slpkg.splitting import split_package
|
|
||||||
from slpkg.__metadata__ import MetaData as _meta_
|
from slpkg.__metadata__ import MetaData as _meta_
|
||||||
|
|
||||||
from slpkg.pkg.find import find_package
|
from slpkg.pkg.find import find_package
|
||||||
|
|
||||||
from slpkg.sbo.build_num import BuildNumber
|
|
||||||
|
|
||||||
|
|
||||||
def slack_package(prgnam):
|
def slack_package(prgnam):
|
||||||
"""Search for binary packages in output directory
|
"""Return maximum binary Slackware package from output directory
|
||||||
"""
|
"""
|
||||||
binary = ""
|
binaries, cache, binary = [], " ", ""
|
||||||
# Get build number from prgnam.SlackBuild script
|
|
||||||
name = "-".join(prgnam.split("-")[:-1])
|
|
||||||
build1 = BuildNumber("", name).get()
|
|
||||||
for pkg in find_package(prgnam, _meta_.output):
|
for pkg in find_package(prgnam, _meta_.output):
|
||||||
name_find = split_package(pkg[:-4])[0]
|
if pkg.startswith(prgnam) and pkg[:-4].endswith("_SBo"):
|
||||||
# Get build number from binary package
|
binaries.append(pkg)
|
||||||
build2 = split_package(pkg[:-4])[3]
|
for bins in binaries:
|
||||||
if (pkg[:-4].endswith("_SBo") and name == name_find and
|
if LooseVersion(bins) > LooseVersion(cache):
|
||||||
build1 == build2):
|
binary = bins
|
||||||
binary = pkg
|
cache = binary
|
||||||
break
|
if not binary:
|
||||||
if binary not in sbo_packages():
|
|
||||||
Msg().build_FAILED(prgnam)
|
Msg().build_FAILED(prgnam)
|
||||||
raise SystemExit()
|
raise SystemExit()
|
||||||
return ["".join(_meta_.output + binary)]
|
return ["".join(_meta_.output + binary)]
|
||||||
|
|
||||||
|
|
||||||
def sbo_packages():
|
|
||||||
"""Return all SBo packages from /tmp directory
|
|
||||||
"""
|
|
||||||
packages = []
|
|
||||||
for pkg in os.listdir(_meta_.output):
|
|
||||||
if pkg.endswith(".tgz") or pkg.endswith(".txz"):
|
|
||||||
packages.append(pkg)
|
|
||||||
return packages
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue