Created
October 30, 2025 17:52
-
-
Save taoky/2c82ca534fa67e1110da1b7eb121aec5 to your computer and use it in GitHub Desktop.
Debugging quick-fedora-mirror
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| from pathlib import Path | |
| import logging | |
| os.makedirs("./fedora", exist_ok=True) | |
| filelist = open("fullfiletimelist-fedora") | |
| os.chdir("./fedora") | |
| process_files = False | |
| for line in filelist: | |
| try: | |
| line = line.strip() | |
| if line == "[Files]": | |
| process_files = True | |
| continue | |
| elif process_files and len(line) == 0: | |
| break | |
| if process_files: | |
| timestamp, type_, size, path = line.split("\t", maxsplit=3) | |
| timestamp = int(timestamp) | |
| if type_ == "d": | |
| os.makedirs(path, exist_ok=True) | |
| else: | |
| p = Path(path) | |
| p.parent.mkdir(exist_ok=True, parents=True) | |
| p.touch() | |
| os.truncate(str(p), int(size)) | |
| os.utime(path, (timestamp, timestamp)) | |
| except: | |
| logging.exception("%s", line) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment