about summary refs log tree commit diff
path: root/xclash
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2014-11-11 18:04:15 +0100
committerChristian Neukirchen <chneukirchen@gmail.com>2014-11-11 18:04:15 +0100
commit790c4778a02dbeba8ea70876654127b7045091ac (patch)
tree239f64d5f25d1e0e77534166b0e94f47de6a85ba /xclash
parentcf898757fae79c967855e5a15c9f8fef6e167857 (diff)
downloadxtools-790c4778a02dbeba8ea70876654127b7045091ac.tar.gz
xtools-790c4778a02dbeba8ea70876654127b7045091ac.tar.xz
xtools-790c4778a02dbeba8ea70876654127b7045091ac.zip
add xclash
Diffstat (limited to 'xclash')
-rwxr-xr-xxclash26
1 files changed, 26 insertions, 0 deletions
diff --git a/xclash b/xclash
new file mode 100755
index 0000000..76e9d55
--- /dev/null
+++ b/xclash
@@ -0,0 +1,26 @@
+#!/bin/bash
+# xclash - detect file conflicts between XBPS packages
+
+comm -23 <(xbps-query --regex -Ro '' |
+		sed 's/ *([^)]*)$//; s|-[^-]*: | |; /-dbg /d; /-32bit /d; /chroot-/d' | sort | 
+		awk '{f[$2][length(f[$2])]=$1}
+			END {
+			for(pkg in f)
+			if (length(f[pkg])>1)
+			for (i = 0; i < length(f[pkg]); i++)
+			for (j = i+1; j < length(f[pkg]); j++)
+			if (f[pkg][i] != f[pkg][j])
+			print f[pkg][i], f[pkg][j]
+			}' | sort -u ) \
+	<({
+		xbps-query -R -s '' -p conflicts
+		xbps-query -R -s '' -p replaces
+	 } | sed 's/ *([^)]*)$//; s|-[^-]*: | |; s/[<>].*//; /-dbg /d' |
+		awk '{ if($1<$2) print $1, $2; else print $2, $1 }' |
+	       	sort -u ) |
+while read pkg1 pkg2; do
+	echo "$pkg1 and $pkg2 conflict for"
+	comm -12 <(xbps-query -Rf $pkg1 | sed 's/ ->.*//' | sort -u) \
+		<(xbps-query -Rf $pkg2 | sed 's/ ->.*//' | sort -u)
+	echo
+done