aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRolf Eike Beer <eike@sf-mail.de>2017-12-16 11:29:19 +0100
committerkensington <kensington@gentoo.org>2017-12-21 20:10:26 +1100
commit4c21b0875ab75c431468b0d2a4cdbe20794191ce (patch)
treede34c4d59bc97ed844a57080ac7aaf86211f7958
parentuse gentoolkit API instead of process call to get list of use flags (diff)
downloadtatt-4c21b0875ab75c431468b0d2a4cdbe20794191ce.tar.gz
tatt-4c21b0875ab75c431468b0d2a4cdbe20794191ce.tar.bz2
tatt-4c21b0875ab75c431468b0d2a4cdbe20794191ce.zip
use portage.dep.dep_getcpv() to strip operators from package name
-rwxr-xr-xscripts/tatt3
-rw-r--r--tatt/gentooPackage.py3
-rw-r--r--tatt/usecombis.py6
3 files changed, 7 insertions, 5 deletions
diff --git a/scripts/tatt b/scripts/tatt
index f526cd3..a1190a0 100755
--- a/scripts/tatt
+++ b/scripts/tatt
@@ -6,6 +6,7 @@ import sys
import re
import os
import portage
+from portage.dep import dep_getcpv
import base64
import requests
@@ -195,7 +196,7 @@ if myJob.packageList is not None and len(myJob.packageList) > 0:
for p in myJob.packageList:
print("Found the following package atom : " + p.packageString())
# check if the package already has the needed keywords
- kw = port.aux_get(p.packageString()[1:], ["KEYWORDS"])
+ kw = port.aux_get(dep_getcpv(p.packageString()), ["KEYWORDS"])
if len(kw) > 0:
kwl = kw[0].split()
try:
diff --git a/tatt/gentooPackage.py b/tatt/gentooPackage.py
index ba5ec54..6df9264 100644
--- a/tatt/gentooPackage.py
+++ b/tatt/gentooPackage.py
@@ -1,6 +1,7 @@
"""Module for easy access to portage's atom syntax """
import re
+from portage.dep import dep_getcpv
class gentooPackage(object):
"""A Gentoo package consists of:
@@ -11,7 +12,7 @@ class gentooPackage(object):
def __init__(self, st):
"""An atom is initialized from an atom string"""
- if st[0] == '=': st = st[1:]
+ st = dep_getcpv(st)
slashparts = st.split("/")
self.category = slashparts[0]
minusparts = slashparts[1].split("-")
diff --git a/tatt/usecombis.py b/tatt/usecombis.py
index 2cfdbe8..b40577c 100644
--- a/tatt/usecombis.py
+++ b/tatt/usecombis.py
@@ -3,7 +3,7 @@
import random
import re
import math
-from portage.dep import check_required_use
+from portage.dep import check_required_use, dep_getcpv
from subprocess import *
from .tool import unique
@@ -18,7 +18,7 @@ def findUseFlagCombis (package, config, port):
Generate combinations of use flags to test
The output will be a list each containing a ready to use USE=... string
"""
- uselist = sorted(reduce_flags(get_flags(package.packageString()[1:])))
+ uselist = sorted(reduce_flags(get_flags(dep_getcpv(package.packageString()))))
# The uselist could have duplicates due to slot-conditional
# output of equery
uselist=unique(uselist)
@@ -43,7 +43,7 @@ def findUseFlagCombis (package, config, port):
swlist = list(range(2**len(uselist)))
usecombis=[]
- ruse = " ".join(port.aux_get(package.packageString()[1:], ["REQUIRED_USE"]))
+ ruse = " ".join(port.aux_get(dep_getcpv(package.packageString()), ["REQUIRED_USE"]))
for sw in swlist:
mod = []
act = [] # check_required_use doesn't like -flag entries