@@ -526,98 +526,65 @@ def fetch_mingw_w64_versions() -> list[dict]:
526526
527527
528528def fetch_runtimes ():
529+ """Fetch libc versions using merge strategy — never overwrite with empty data."""
529530 print ("Fetching libc versions..." )
530- libc_impls = []
531-
532- # glibc (GitHub mirror tags)
533- print (" glibc..." )
534- glibc_releases = fetch_glibc_versions ()
535- libc_impls .append ({
536- "name" : "glibc" ,
537- "full_name" : "GNU C Library" ,
538- "vendor" : "GNU Project" ,
539- "url" : "https://www.gnu.org/software/libc/" ,
540- "platforms" : ["linux" ],
541- "description" : "The standard C library for GNU/Linux systems" ,
542- "releases" : glibc_releases ,
543- })
544-
545- # musl (website + fallback to GitHub)
546- print (" musl..." )
547- musl_releases = fetch_musl_versions ()
548- libc_impls .append ({
549- "name" : "musl" ,
550- "full_name" : "musl libc" ,
551- "vendor" : "musl project" ,
552- "url" : "https://musl.libc.org/" ,
553- "platforms" : ["linux" ],
554- "description" : "Lightweight, standards-conforming C library for Linux" ,
555- "releases" : musl_releases ,
556- })
557-
558- # newlib (GitHub mirror tags)
559- print (" newlib..." )
560- newlib_releases = fetch_newlib_versions ()
561- libc_impls .append ({
562- "name" : "newlib" ,
563- "full_name" : "Newlib" ,
564- "vendor" : "Red Hat / open source" ,
565- "url" : "https://sourceware.org/newlib/" ,
566- "platforms" : ["none" , "rtems" , "elf" ],
567- "description" : "C library for embedded systems and bare-metal targets" ,
568- "releases" : newlib_releases ,
569- })
570-
571- # uClibc-ng (GitHub releases)
572- print (" uClibc-ng..." )
573- uclibc_releases = fetch_uclibc_ng_versions ()
574- for r in uclibc_releases :
575- r .pop ("assets" , None )
576- libc_impls .append ({
577- "name" : "uclibc-ng" ,
578- "full_name" : "uClibc-ng" ,
579- "vendor" : "uClibc-ng project" ,
580- "url" : "https://uclibc-ng.org/" ,
581- "platforms" : ["linux" ],
582- "description" : "Small C library for embedded Linux systems, actively maintained fork of uClibc" ,
583- "releases" : uclibc_releases ,
584- })
585-
586- # mingw-w64 (GitHub releases, provides msvcrt/ucrt interface on Windows)
587- print (" mingw-w64..." )
588- mingw_releases = fetch_mingw_w64_versions ()
589- libc_impls .append ({
590- "name" : "mingw-w64" ,
591- "full_name" : "mingw-w64" ,
592- "vendor" : "mingw-w64 project" ,
593- "url" : "https://www.mingw-w64.org/" ,
594- "platforms" : ["windows" ],
595- "description" : "Windows C runtime headers and import libraries for GCC, targeting msvcrt or ucrt" ,
596- "releases" : mingw_releases ,
597- })
598-
599- # picolibc (GitHub releases)
600- print (" picolibc..." )
601- picolibc_releases = gh_releases ("picolibc/picolibc" )
602- for r in picolibc_releases :
603- r .pop ("assets" , None )
604- static_pico = next (s for s in STATIC_LIBC if s ["name" ] == "picolibc" )
605- libc_impls .append ({** static_pico , "releases" : picolibc_releases })
606-
607- # wasi-libc (GitHub tags)
608- print (" wasi-libc..." )
609- wasi_releases = gh_releases ("WebAssembly/wasi-libc" )
610- for r in wasi_releases :
611- r .pop ("assets" , None )
612- static_wasi = next (s for s in STATIC_LIBC if s ["name" ] == "wasi-libc" )
613- libc_impls .append ({** static_wasi , "releases" : wasi_releases })
614-
615- # Static entries (no API available)
616- for entry in STATIC_LIBC :
617- if entry ["name" ] not in ("picolibc" , "wasi-libc" ):
618- libc_impls .append (entry )
531+ libc_path = DATA_DIR / "runtimes" / "libc.toml"
532+
533+ FETCHABLE_LIBC = [
534+ ("glibc" , fetch_glibc_versions , {
535+ "full_name" : "GNU C Library" , "vendor" : "GNU Project" ,
536+ "url" : "https://www.gnu.org/software/libc/" , "platforms" : ["linux" ],
537+ "description" : "The standard C library for GNU/Linux systems" ,
538+ }),
539+ ("musl" , fetch_musl_versions , {
540+ "full_name" : "musl libc" , "vendor" : "musl project" ,
541+ "url" : "https://musl.libc.org/" , "platforms" : ["linux" ],
542+ "description" : "Lightweight, standards-conforming C library for Linux" ,
543+ }),
544+ ("newlib" , fetch_newlib_versions , {
545+ "full_name" : "Newlib" , "vendor" : "Red Hat / open source" ,
546+ "url" : "https://sourceware.org/newlib/" , "platforms" : ["none" , "rtems" , "elf" ],
547+ "description" : "C library for embedded systems and bare-metal targets" ,
548+ }),
549+ ]
550+
551+ fetched = []
552+ for name , fetcher , meta in FETCHABLE_LIBC :
553+ print (f" { name } ..." )
554+ releases = fetcher ()
555+ if not releases :
556+ print (f" Skipping { name } (no data fetched, preserving existing)" )
557+ continue
558+ fetched .append ({"name" : name , ** meta , "releases" : releases })
559+
560+ # GitHub-released libc implementations
561+ for name , repo , meta_entry in [
562+ ("uclibc-ng" , "wbx-github/uclibc-ng" , {
563+ "full_name" : "uClibc-ng" , "vendor" : "uClibc-ng project" ,
564+ "url" : "https://uclibc-ng.org/" , "platforms" : ["linux" ],
565+ "description" : "Small C library for embedded Linux systems, actively maintained fork of uClibc" ,
566+ }),
567+ ("mingw-w64" , "mingw-w64/mingw-w64" , {
568+ "full_name" : "mingw-w64" , "vendor" : "mingw-w64 project" ,
569+ "url" : "https://www.mingw-w64.org/" , "platforms" : ["windows" ],
570+ "description" : "Windows C runtime headers and import libraries for GCC, targeting msvcrt or ucrt" ,
571+ }),
572+ ("picolibc" , "picolibc/picolibc" ,
573+ next (s for s in STATIC_LIBC if s ["name" ] == "picolibc" )),
574+ ("wasi-libc" , "WebAssembly/wasi-libc" ,
575+ next (s for s in STATIC_LIBC if s ["name" ] == "wasi-libc" )),
576+ ]:
577+ print (f" { name } ..." )
578+ releases = gh_releases (repo )
579+ if not releases :
580+ print (f" Skipping { name } (no data fetched, preserving existing)" )
581+ continue
582+ for r in releases :
583+ r .pop ("assets" , None )
584+ fetched .append ({"name" : name , ** meta_entry , "releases" : releases })
619585
620- write_toml (DATA_DIR / "runtimes" / "libc.toml" , {"implementations" : libc_impls })
586+ # Merge: update releases for fetched items, preserve everything else
587+ merge_toml_list (libc_path , "implementations" , fetched )
621588
622589
623590# ---------------------------------------------------------------------------
0 commit comments