Skip to content

Instantly share code, notes, and snippets.

@zman0900
Created November 8, 2018 05:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zman0900/6ccf53911ce472a2ff705e51ca6342b0 to your computer and use it in GitHub Desktop.
Save zman0900/6ccf53911ce472a2ff705e51ca6342b0 to your computer and use it in GitHub Desktop.
Simple groovy script to show changes in Arch Linux kernel config
#!/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