xenocara/distrib/sets/lists/Makefile

72 lines
1.9 KiB
Makefile
Raw Normal View History

2014-07-23 14:47:37 -06:00
# $OpenBSD: Makefile,v 1.5 2014/07/23 20:47:37 todd Exp $
2006-11-27 04:25:45 -07:00
# 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
2008-04-07 14:59:41 -06:00
# sanity: sanity check sets for wrong filecounts across archs
2006-11-27 04:25:45 -07:00
all: sort
sort:
@for f in */m*; do echo "===> sorting $$f"; \
2014-07-23 14:47:37 -06:00
sed 's/[ ]*$$//' $$f | sort -u | awk '/^$$/{next}{print}' > \
$$f.tmp; \
2006-11-27 04:25:45 -07:00
diff -u $$f $$f.tmp || true; \
cat $$f.tmp > $$f && rm $$f.tmp; \
done
2006-11-27 04:25:45 -07:00
basefiles!= cd xbase;echo md.*
2008-04-07 14:59:41 -06:00
archs = ${basefiles:S/^md.//}
2006-11-27 04:25:45 -07:00
mdtomi:
@echo "Checking for common md file lines for migration to mi files:"
2008-04-07 14:59:41 -06:00
@for xdir in x*; do \
2008-04-08 15:53:47 -06:00
[ "$$xdir" = "xfont" ] && continue; \
2008-04-07 14:59:41 -06:00
dir=$$(mktemp -d /tmp/mdtomi.XXXXXXXXXX); \
2006-11-27 04:25:45 -07:00
i1=first; \
for a in ${archs}; do \
2008-04-07 14:59:41 -06:00
sort $$xdir/md.$$a >> $$dir/$$a; \
if [ "X$$i1" = "Xfirst" ]; then \
2006-11-27 04:25:45 -07:00
i1=$$dir/$$a; \
2008-04-07 14:59:41 -06:00
else \
2006-11-27 04:25:45 -07:00
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; \
2008-04-07 14:59:41 -06:00
fi; \
2006-11-27 04:25:45 -07:00
done; \
echo "If any common md files were found, migrating to mi files:"; \
cat $$dir/mi | while read line; do \
echo "==> $$line"; \
2008-04-08 15:53:47 -06:00
for line2 in $$(grep "^$${line}$$" $$xdir/m*); do \
2006-11-27 04:25:45 -07:00
f=$${line2%:*}; \
2008-04-08 15:53:47 -06:00
grep -v "^$${line}$$" $$f > $$f.tmp && mv $$f.tmp $$f; \
2006-11-27 04:25:45 -07:00
echo "===> -$$line2"; \
done; \
2008-04-08 15:53:47 -06:00
echo "===> +$$xdir/mi"; \
2008-04-07 14:59:41 -06:00
echo $$line >> $$xdir/mi; \
done; rm -rf $$dir; \
done
2006-11-27 04:25:45 -07:00
dupes:
2008-04-07 14:59:41 -06:00
@for d in x*; do \
for arch in ${archs}; do \
[ -f $$d/md.$$arch ] || continue; \
echo "===> $$d/$$arch"; \
cat $$d/md.$$arch $$d/mi | sort | uniq -d; \
done; \
2006-11-27 04:25:45 -07:00
done
2008-04-07 14:59:41 -06:00
sanity:
@for d in x*; do \
[ "$$d" = "xfont" ] && continue; \
echo "==> $$d"; \
(cd $$d; cat md* | sort | uniq -c | sort -n ); \
done