File tree Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Expand file tree Collapse file tree 2 files changed +57
-0
lines changed Original file line number Diff line number Diff line change 3636 - name : Generate root index
3737 run : ./bin/root_index.py
3838
39+ - name : Deduplicate with rdfind and some help
40+ run : |
41+ apk add rdfind
42+ rdfind -checksum sha256 -makesymlinks true -maxsize 0 \
43+ -followsymlinks true -makeresultsfile false build/
44+ ./bin/relink.py build/
45+
3946 - name : Upload static files as single artifact
4047 uses : actions/upload-pages-artifact@v3
4148 with :
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ """Script to quickly fix symlinks
4+
5+ SPDX-License-Identifier: MIT
6+ Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com
7+ """
8+
9+ import argparse
10+ from pathlib import Path
11+ import logging
12+
13+ logger = logging .getLogger (__name__ )
14+
15+
16+ def relink (directory ):
17+ """Relink everything in the given directory to be relative
18+
19+ :param directory: Pathlib path to directory that is to be processed
20+ """
21+ directory = directory .absolute ()
22+ for path in directory .glob ("**/*" ):
23+ if path .is_symlink ():
24+ logger .info ("Processing link: %s" , path )
25+
26+ real_target = path .resolve ()
27+ logger .info ("Real target: %s" , real_target )
28+
29+ new_target = real_target .relative_to (path .parent , walk_up = True )
30+ logger .info ("New target: %s" , new_target )
31+
32+ path .unlink ()
33+ path .symlink_to (new_target )
34+
35+
36+ def main ():
37+ """Main processing loop"""
38+ logging .basicConfig (level = logging .INFO )
39+
40+ parser = argparse .ArgumentParser (
41+ prog = "relink.py" , description = "Symlink resolver to help rdfind"
42+ )
43+ parser .add_argument ("directory" , type = Path )
44+ args = parser .parse_args ()
45+
46+ relink (args .directory )
47+
48+
49+ if __name__ == "__main__" :
50+ main ()
You can’t perform that action at this time.
0 commit comments