Last active
July 30, 2022 03:46
-
-
Save Chocimier/de76441493ec7775c201dac0bb03ced5 to your computer and use it in GitHub Desktop.
cycles in xbps-packages templates
This file contains 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
# usage: | |
# cd $XBPS_DISTDIR | |
# ./deps.sh | |
# ./loops.py builddeps $XBPS_DISTDIR/srcpkgs | |
mkdir -p builddeps | |
find srcpkgs -mindepth 1 -maxdepth 1 | cut -d/ -f2 | while read pkg; do echo ' '$pkg; ./xbps-src show-build-deps $pkg > builddeps/$pkg; done |
This file contains 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
#!/usr/bin/env python3 | |
import os | |
import sys | |
import networkx as nx | |
G = nx.DiGraph() | |
for i in os.listdir(sys.argv[1]): | |
ii = os.path.realpath(sys.argv[2] + '/' + i).rpartition('/')[2] | |
with open(sys.argv[1] + '/' + i) as deps: | |
for j in deps: | |
j = j.strip() | |
jj = os.path.realpath(sys.argv[2] + '/' + j).rpartition('/')[2] | |
G.add_edge(ii, jj) | |
for c in nx.strongly_connected_components(G): | |
if len(c) > 1: | |
print(c) | |
print(nx.to_dict_of_lists(G.subgraph(c).copy())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment