Created
November 8, 2018 05:03
-
-
Save zman0900/6ccf53911ce472a2ff705e51ca6342b0 to your computer and use it in GitHub Desktop.
Simple groovy script to show changes in Arch Linux kernel config
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
#!/usr/bin/env groovy | |
if (!args) { | |
throw new IllegalArgumentException('Expected commit as only arg') | |
} | |
def commit = args[0] | |
println "Getting changes for commit: $commit" | |
def url = "https://git.archlinux.org/svntogit/packages.git/patch/trunk/config?id=$commit".toURL() | |
def adds = [] as Set | |
def removes = [] as Set | |
url.eachLine { | |
if (it.contains('CONFIG')) { | |
def first = it[0] | |
def line = it.drop(1) | |
if (line[0..1] == '# ') { | |
line = line.drop(2) | |
} | |
if (first == '+') { | |
adds << line | |
} else if (first == '-') { | |
removes << line | |
} | |
} | |
} | |
println("Adds: ${adds.size()} Removes: ${removes.size()}") | |
def realAdds = adds - removes | |
def realRemoves = removes - adds | |
println("Real Adds: ${realAdds.size()} Real Removes: ${realRemoves.size()}") | |
def all = [] | |
all += realAdds.collect { "+$it" } | |
all += realRemoves.collect { "-$it" } | |
all.sort { it.drop(1) }.each { println it } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment