tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
maintainers/scripts/kde: fix Rust update logic
K900
9 months ago
2ea454c9
ef13b0b2
+21
-17
1 changed file
expand all
collapse all
unified
split
maintainers
scripts
kde
generate-sources.py
+21
-17
maintainers/scripts/kde/generate-sources.py
···
46
46
47
47
@click.command
48
48
@click.argument(
49
49
-
"set",
49
49
+
"pkgset",
50
50
type=click.Choice(["frameworks", "gear", "plasma"]),
51
51
required=True
52
52
)
···
71
71
type=str,
72
72
default=None,
73
73
)
74
74
-
def main(set: str, version: str, nixpkgs: pathlib.Path, sources_url: str | None):
74
74
+
def main(pkgset: str, version: str, nixpkgs: pathlib.Path, sources_url: str | None):
75
75
root_dir = nixpkgs / "pkgs/kde"
76
76
-
set_dir = root_dir / set
76
76
+
set_dir = root_dir / pkgset
77
77
generated_dir = root_dir / "generated"
78
78
metadata = utils.KDERepoMetadata.from_json(generated_dir)
79
79
···
82
82
"frameworks": f"frameworks/{version}/",
83
83
"gear": f"release-service/{version}/src/",
84
84
"plasma": f"plasma/{version}/",
85
85
-
}[set]
85
85
+
}[pkgset]
86
86
sources_url = f"https://download.kde.org/stable/{set_url}"
87
87
88
88
client = httpx.Client()
···
91
91
bs = bs4.BeautifulSoup(sources.text, features="html.parser")
92
92
93
93
results = {}
94
94
+
projects_to_update_rust = set()
94
95
for item in bs.select("tr")[3:]:
95
96
link = item.select_one("td:nth-child(2) a")
96
97
if not link:
···
101
102
if project_name not in metadata.projects_by_name:
102
103
print(f"Warning: unknown tarball: {project_name}")
103
104
105
105
+
if project_name in PROJECTS_WITH_RUST:
106
106
+
projects_to_update_rust.add(project_name)
107
107
+
104
108
if version_and_ext.endswith(".sig"):
105
109
continue
106
110
···
126
130
pkg_dir = set_dir / project_name
127
131
pkg_file = pkg_dir / "default.nix"
128
132
129
129
-
if project_name in PROJECTS_WITH_RUST:
130
130
-
print(f"Updating cargoDeps hash for {set}/{project_name}...")
131
131
-
subprocess.run([
132
132
-
"nix-update",
133
133
-
f"kdePackages.{project_name}",
134
134
-
"--version",
135
135
-
"skip",
136
136
-
"--override-filename",
137
137
-
pkg_file
138
138
-
])
139
139
-
140
133
if not pkg_file.exists():
141
141
-
print(f"Generated new package: {set}/{project_name}")
134
134
+
print(f"Generated new package: {pkgset}/{project_name}")
142
135
pkg_dir.mkdir(parents=True, exist_ok=True)
143
136
with pkg_file.open("w") as fd:
144
137
fd.write(LEAF_TEMPLATE.render(pname=project_name) + "\n")
···
149
142
150
143
sources_dir = generated_dir / "sources"
151
144
sources_dir.mkdir(parents=True, exist_ok=True)
152
152
-
with (sources_dir / f"{set}.json").open("w") as fd:
145
145
+
with (sources_dir / f"{pkgset}.json").open("w") as fd:
153
146
json.dump(results, fd, indent=2)
147
147
+
148
148
+
for project_name in projects_to_update_rust:
149
149
+
print(f"Updating cargoDeps hash for {pkgset}/{project_name}...")
150
150
+
subprocess.run([
151
151
+
"nix-update",
152
152
+
f"kdePackages.{project_name}",
153
153
+
"--version",
154
154
+
"skip",
155
155
+
"--override-filename",
156
156
+
pkg_file
157
157
+
])
154
158
155
159
156
160
if __name__ == "__main__":