2 from io
import StringIO
5 sl7_only_packages=(
'caendigitizer',
'pqxx',
'epics',
'jsoncpp',
'redis',
'zmq')
12 def read(self, header,trailer, usecols=None):
15 for line
in input_data:
16 if line.strip().startswith(header):
20 for line
in input_data:
21 if line.strip().startswith(trailer):
27 return pd.read_csv(lines, delimiter=
r"\s+",usecols=usecols)
31 return self.
read(
'qualifier',
'end_qualifier_list')
35 return self.
read(
'product',
'end_product_list',range(3))
48 qualifiers=self.qualifiers.split(
':')
49 rqual=list(
filter(re.compile(
r'(e[0-9]{2}|c[0-9]{1})').search , qualifiers))
50 bqual=list(
filter(re.compile(
r'(debug|prof)').search , qualifiers))
51 aqual=list(
filter(re.compile(
r'(noarch|slf7-x86_64)').search , qualifiers))
53 arch=
'slf7-x86_64' if not aqual
else aqual[0]
55 if name
in sl7_only_packages
and arch.startswith(
'slf'):
56 arch=arch.replace(
'slf',
'sl')
58 tarball=
'{0:s}-{1:s}-{2:s}'.
format(name,version.replace(
'_',
'.').replace(
'v',
'') ,arch)
61 tarball +=
'-{0:s}'.
format(rqual[0])
63 tarball +=
'-{0:s}'.
format(bqual[0])
66 entry =
'{0:20s} {1:10s} {2:70s}'.
format(name,version,tarball)
67 entry +=
' -f {0:20s}'.
format(
'Linux64bit+3.10-2.17' if arch ==
'slf7-x86_64' else 'NULL')
88 for index, row
in self.df_qualifiers.iterrows():
92 candidate=row[0].
split(
':')
93 reference=self.qualifiers.split(
':')
94 if len(candidate) != len(reference):
97 if set(candidate) == set(reference):
105 for index,product
in self.df_products.iterrows():
106 qualifiers=
'noarch' if product[0]
not in product_qualifiers
else product_qualifiers[product[0]]
107 product=
Product(product,qualifiers)
108 manifest.write(product.manifest_entry())
116 product_deps_file =
'product_deps' 117 manifest_file =
'manifest.txt' 121 opts, args = getopt.getopt(argv,
"hp:m:q:",[
"product_deps=",
"manifest=",
"qualifiers="])
122 except getopt.GetoptError:
123 print(
'generate-manifest.py -p <product_deps> -p <manifest> -q <qualifiers>')
126 for opt, arg
in opts:
128 print(
'generate-manifest.py -p <product_deps> -m <manifest> -q <qualifiers>')
130 elif opt
in (
"-p",
"--product_deps"):
131 product_deps_file = arg
132 elif opt
in (
"-m",
"--manifest"):
134 elif opt
in (
"-q",
"--qualifiers"):
138 manifest = builder.build_manifest()
140 with
open(manifest_file, mode=
'w')
as f:
141 print(manifest.getvalue().strip(), file=f)
143 if __name__ ==
"__main__":
def __init__(self, product, qualifiers)
def __init__(self, name, qualifiers)
int open(const char *, int)
Opens a file descriptor.
static bool format(QChar::Decomposition tag, QString &str, int index, int len)
def read(self, header, trailer, usecols=None)
def read_qualifiers(self)
def match_product_qualifiers(self)
void split(std::string const &s, char c, OutIter dest)