about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--README1
-rwxr-xr-xxclash26
2 files changed, 27 insertions, 0 deletions
diff --git a/README b/README
index 4a26551..2f8d982 100644
--- a/README
+++ b/README
@@ -5,6 +5,7 @@ https://github.com/voidlinux/xbps
 
   xbulk [-n] [-k] [xbps-src flags...] PKGS... - simple XBPS bulk builder
   xbump PKGNAME [git commit options] - git commit a version bump
+  xclash - detect file conflicts between XBPS packages
   xdiff [-u] [DIR] - merge XBPS .new-* files
   xdistdir - figure out XBPS_DISTDIR
   xgensum [-i] TEMPLATE - update SHA256 sums in templates
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