@@ -46,7 +46,7 @@ def to_sri(hash):
4646
4747@click .command
4848@click .argument (
49- "set " ,
49+ "pkgset " ,
5050 type = click .Choice (["frameworks" , "gear" , "plasma" ]),
5151 required = True
5252)
@@ -71,9 +71,9 @@ def to_sri(hash):
7171 type = str ,
7272 default = None ,
7373)
74- def main (set : str , version : str , nixpkgs : pathlib .Path , sources_url : str | None ):
74+ def main (pkgset : str , version : str , nixpkgs : pathlib .Path , sources_url : str | None ):
7575 root_dir = nixpkgs / "pkgs/kde"
76- set_dir = root_dir / set
76+ set_dir = root_dir / pkgset
7777 generated_dir = root_dir / "generated"
7878 metadata = utils .KDERepoMetadata .from_json (generated_dir )
7979
@@ -82,7 +82,7 @@ def main(set: str, version: str, nixpkgs: pathlib.Path, sources_url: str | None)
8282 "frameworks" : f"frameworks/{ version } /" ,
8383 "gear" : f"release-service/{ version } /src/" ,
8484 "plasma" : f"plasma/{ version } /" ,
85- }[set ]
85+ }[pkgset ]
8686 sources_url = f"https://download.kde.org/stable/{ set_url } "
8787
8888 client = httpx .Client ()
@@ -91,6 +91,7 @@ def main(set: str, version: str, nixpkgs: pathlib.Path, sources_url: str | None)
9191 bs = bs4 .BeautifulSoup (sources .text , features = "html.parser" )
9292
9393 results = {}
94+ projects_to_update_rust = set ()
9495 for item in bs .select ("tr" )[3 :]:
9596 link = item .select_one ("td:nth-child(2) a" )
9697 if not link :
@@ -101,6 +102,9 @@ def main(set: str, version: str, nixpkgs: pathlib.Path, sources_url: str | None)
101102 if project_name not in metadata .projects_by_name :
102103 print (f"Warning: unknown tarball: { project_name } " )
103104
105+ if project_name in PROJECTS_WITH_RUST :
106+ projects_to_update_rust .add (project_name )
107+
104108 if version_and_ext .endswith (".sig" ):
105109 continue
106110
@@ -126,19 +130,8 @@ def main(set: str, version: str, nixpkgs: pathlib.Path, sources_url: str | None)
126130 pkg_dir = set_dir / project_name
127131 pkg_file = pkg_dir / "default.nix"
128132
129- if project_name in PROJECTS_WITH_RUST :
130- print (f"Updating cargoDeps hash for { set } /{ project_name } ..." )
131- subprocess .run ([
132- "nix-update" ,
133- f"kdePackages.{ project_name } " ,
134- "--version" ,
135- "skip" ,
136- "--override-filename" ,
137- pkg_file
138- ])
139-
140133 if not pkg_file .exists ():
141- print (f"Generated new package: { set } /{ project_name } " )
134+ print (f"Generated new package: { pkgset } /{ project_name } " )
142135 pkg_dir .mkdir (parents = True , exist_ok = True )
143136 with pkg_file .open ("w" ) as fd :
144137 fd .write (LEAF_TEMPLATE .render (pname = project_name ) + "\n " )
@@ -149,9 +142,20 @@ def main(set: str, version: str, nixpkgs: pathlib.Path, sources_url: str | None)
149142
150143 sources_dir = generated_dir / "sources"
151144 sources_dir .mkdir (parents = True , exist_ok = True )
152- with (sources_dir / f"{ set } .json" ).open ("w" ) as fd :
145+ with (sources_dir / f"{ pkgset } .json" ).open ("w" ) as fd :
153146 json .dump (results , fd , indent = 2 )
154147
148+ for project_name in projects_to_update_rust :
149+ print (f"Updating cargoDeps hash for { pkgset } /{ project_name } ..." )
150+ subprocess .run ([
151+ "nix-update" ,
152+ f"kdePackages.{ project_name } " ,
153+ "--version" ,
154+ "skip" ,
155+ "--override-filename" ,
156+ pkg_file
157+ ])
158+
155159
156160if __name__ == "__main__" :
157161 main () # type: ignore
0 commit comments