summaryrefslogtreecommitdiff
path: root/distrib/sets/lists/Makefile
diff options
context:
space:
mode:
authorMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-27 11:26:07 +0000
committerMatthieu Herrb <matthieu@cvs.openbsd.org>2006-11-27 11:26:07 +0000
commitabb30277ff0bbd258cfb54ec36f9ad039a7d2b9c (patch)
treec2f4dae1f0663c60f6ad4a231e120d8092c2a414 /distrib/sets/lists/Makefile
parentaef8d05902faf8bb5b00faf643b2fee1306e557e (diff)
Bring over distrib from XF4
Diffstat (limited to 'distrib/sets/lists/Makefile')
-rw-r--r--distrib/sets/lists/Makefile58
1 files changed, 58 insertions, 0 deletions
diff --git a/distrib/sets/lists/Makefile b/distrib/sets/lists/Makefile
new file mode 100644
index 000000000..c7572bf58
--- /dev/null
+++ b/distrib/sets/lists/Makefile
@@ -0,0 +1,58 @@
+# $OpenBSD: Makefile,v 1.1 2006/11/27 11:25:45 matthieu Exp $
+
+# Various list maintenance functions
+
+# sort: verify each md/mi file is sorted and contains uniq lines
+# mdtomi: move common md file lines to mi, if present
+# dupes: detect (nothing more) duplicate entries in each arch's complete file
+# list
+
+
+all: sort
+
+
+sort:
+ @for f in */m*; do echo "===> sorting $$f"; \
+ sort $$f | uniq > $$f.tmp; \
+ diff -u $$f $$f.tmp || true; \
+ cat $$f.tmp > $$f && rm $$f.tmp; \
+ done;
+
+archs = alpha amd64 cats hp300 hppa i386 mac68k macppc \
+ mvme68k mvme88k sparc sparc64 vax
+
+mdtomi:
+ @echo "Checking for common md file lines for migration to mi files:"
+ @dir=$$(mktemp -d /tmp/mdtomi.XXXXXXXXXX); \
+ i1=first; \
+ for a in ${archs}; do \
+ sort */md.$$a >> $$dir/$$a; \
+ [ "X$$i1" = "Xfirst" ] && { \
+ i1=$$dir/$$a; \
+ } || { \
+ cat $$i1 $$dir/$$a | sort | uniq -d >> $$dir/mi.tmp; \
+ echo "===> ($$(echo $$(cat $$dir/mi.tmp|wc -c)))\c"; \
+ echo " $$i1 vs $$dir/$$a"; \
+ mv $$dir/mi.tmp $$dir/mi; \
+ i1=$$dir/mi; \
+ }; \
+ done; \
+ echo "If any common md files were found, migrating to mi files:"; \
+ cat $$dir/mi | while read line; do \
+ echo "==> $$line"; \
+ for line2 in $$(grep $$line */m*); do \
+ f=$${line2%:*}; \
+ grep -v $$line $$f > $$f.tmp && mv $$f.tmp $$f; \
+ d=$${f%/*}; \
+ echo "===> -$$line2"; \
+ done; \
+ echo "===> +$$d/mi"; \
+ echo $$line >> $$d/mi; \
+ done; rm -rf $$dir
+
+dupes:
+ @for arch in ${archs}; do \
+ echo "===> $$arch"; \
+ cat */md.$$arch */mi | sort | uniq -d; \
+ done
+