Skip to content

Commit 508efac

Browse files
committed
spell
1 parent 7cc7d17 commit 508efac

File tree

3 files changed

+74
-66
lines changed

3 files changed

+74
-66
lines changed

llvm_ir_dataset_utils/tools/portage_analyze_failures.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def parse_depgraph(content):
6969

7070
def analyse_neither():
7171
failed = []
72-
successed = []
72+
succeeded = []
7373
# neither.json is a log analyzing the results of a package whose installation result type is neither.
7474
# 'Y' means it has been built successfully.
7575
# 'N' means its build failed.
@@ -79,9 +79,9 @@ def analyse_neither():
7979
if neither_pkgs[pkg] == 'N':
8080
failed.append(pkg)
8181
if neither_pkgs[pkg] == 'Y':
82-
successed.append(pkg)
82+
succeeded.append(pkg)
8383

84-
return failed, successed
84+
return failed, succeeded
8585

8686

8787
def preprocessed_notinstalled_pkgs():
@@ -93,13 +93,13 @@ def preprocessed_notinstalled_pkgs():
9393

9494

9595
def main():
96-
failed_pkgs, successed_pkgs = analyse_neither()
96+
failed_pkgs, succeeded_pkgs = analyse_neither()
9797

9898
notinstalled_pkgs = preprocessed_notinstalled_pkgs()
9999
installed_pkgs = preprocessed_notinstalled_pkgs()
100100

101101
failed_pkgs.extend(notinstalled_pkgs)
102-
successed_pkgs.extend(installed_pkgs)
102+
succeeded_pkgs.extend(installed_pkgs)
103103

104104
error_dict = {}
105105
error_list = []
@@ -119,7 +119,7 @@ def main():
119119
else:
120120
parsed_data = parse_depgraph(content)
121121
for i in parsed_data:
122-
if i.replace('/', '_') not in successed_pkgs:
122+
if i.replace('/', '_') not in succeeded_pkgs:
123123
if i in error_dict:
124124
error_dict[i] += 1
125125
else:

llvm_ir_dataset_utils/tools/portage_extract_packages.py

+67-59
Original file line numberDiff line numberDiff line change
@@ -2,71 +2,79 @@
22

33
packages = []
44

5+
56
def get_packages(parent_directory):
6-
valid_dirs_count = 0
7-
for first_level_subdir in os.listdir(parent_directory):
8-
first_level_path = os.path.join(parent_directory, first_level_subdir)
9-
if os.path.isdir(first_level_path):
10-
for second_level_subdir in os.listdir(first_level_path):
11-
second_level_path = os.path.join(first_level_path, second_level_subdir)
12-
if os.path.isdir(second_level_path):
13-
files = os.listdir(second_level_path)
14-
if any(file.endswith('.ebuild') for file in files):
15-
valid_dirs_count += 1
16-
packages.append(second_level_path[2:])
7+
valid_dirs_count = 0
8+
for first_level_subdir in os.listdir(parent_directory):
9+
first_level_path = os.path.join(parent_directory, first_level_subdir)
10+
if os.path.isdir(first_level_path):
11+
for second_level_subdir in os.listdir(first_level_path):
12+
second_level_path = os.path.join(first_level_path, second_level_subdir)
13+
if os.path.isdir(second_level_path):
14+
files = os.listdir(second_level_path)
15+
if any(file.endswith('.ebuild') for file in files):
16+
valid_dirs_count += 1
17+
packages.append(second_level_path[2:])
18+
1719

1820
def processEbuild_cpp(file):
19-
with open(file, 'r', encoding='utf-8') as f:
20-
for line in f:
21-
if "toolchain-funcs" in line and "inherit" in line:
22-
return True
23-
elif "cmake" in line:
24-
return True
25-
elif "emake" in line:
26-
return True
27-
elif "CFLAGS" in line:
28-
return True
29-
elif "CXXFLAGS" in line:
30-
return True
31-
elif "toolchain" in line:
32-
return True
33-
elif "meson" in line:
34-
return True
35-
return False
21+
with open(file, 'r', encoding='utf-8') as f:
22+
for line in f:
23+
if "toolchain-funcs" in line and "inherit" in line:
24+
return True
25+
elif "cmake" in line:
26+
return True
27+
elif "emake" in line:
28+
return True
29+
elif "CFLAGS" in line:
30+
return True
31+
elif "CXXFLAGS" in line:
32+
return True
33+
elif "toolchain" in line:
34+
return True
35+
elif "meson" in line:
36+
return True
37+
return False
38+
3639

3740
def processEbuild_trunk(file):
38-
with open(file, 'r', encoding='utf-8') as f:
39-
for line in f:
40-
if "KEYWORDS" in line and "amd64 " in line and "~amd64 " not in line:
41-
return True
42-
return False
41+
with open(file, 'r', encoding='utf-8') as f:
42+
for line in f:
43+
if "KEYWORDS" in line and "amd64 " in line and "~amd64 " not in line:
44+
return True
45+
return False
46+
4347

4448
def readpackage(package):
45-
files = os.listdir(package)
46-
for file in files:
47-
if file.endswith('.ebuild'):
48-
with open(os.path.join(package,file), 'r', encoding='utf-8') as f:
49-
for line in f:
50-
print(line[:-1])
51-
return
52-
49+
files = os.listdir(package)
50+
for file in files:
51+
if file.endswith('.ebuild'):
52+
with open(os.path.join(package, file), 'r', encoding='utf-8') as f:
53+
for line in f:
54+
print(line[:-1])
55+
return
56+
57+
5358
def main():
54-
ebuild_directory = "./"
55-
get_packages(ebuild_directory)
56-
cpp_pkgs = []
57-
for pkg in packages:
58-
files = os.listdir(pkg)
59-
for file in files:
60-
if file.endswith('.ebuild'):
61-
if processEbuild_trunk(os.path.join(pkg,file)):
62-
if processEbuild_cpp(os.path.join(pkg,file)):
63-
cpp_pkgs.append(pkg)
64-
continue
65-
66-
cpp_pkgs = list(set(cpp_pkgs))
67-
with open("../../corpus_descriptions_test/portage_pkg.list", 'w', encoding='utf-8') as f:
68-
for i in cpp_pkgs:
69-
f.write(i+"\n")
70-
59+
ebuild_directory = "./"
60+
get_packages(ebuild_directory)
61+
cpp_pkgs = []
62+
for pkg in packages:
63+
files = os.listdir(pkg)
64+
for file in files:
65+
if file.endswith('.ebuild'):
66+
if processEbuild_trunk(os.path.join(pkg, file)):
67+
if processEbuild_cpp(os.path.join(pkg, file)):
68+
cpp_pkgs.append(pkg)
69+
continue
70+
71+
cpp_pkgs = list(set(cpp_pkgs))
72+
with open(
73+
"../../corpus_descriptions_test/portage_pkg.list", 'w',
74+
encoding='utf-8') as f:
75+
for i in cpp_pkgs:
76+
f.write(i + "\n")
77+
78+
7179
if __name__ == "__main__":
72-
main()
80+
main()

llvm_ir_dataset_utils/tools/portage_list_build.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def build(target_package):
142142
try:
143143
subprocess.run(renew_command, check=True)
144144
except subprocess.CalledProcessError:
145-
print("Error to build depedency.")
145+
print("Error to build dependency.")
146146
continue
147147
json_filename = create_json_file(package)
148148
run_corpus_command(json_filename)

0 commit comments

Comments
 (0)