1#!/usr/local/bin/python 2# 3# checkcats.py - verify that master categories in all ports are correct and 4# report any problems. 5# 6# ---------------------------------------------------------------------------- 7# "THE BEER-WARE LICENSE" (Revision 42, (c) Poul-Henning Kamp): 8# Maxim Sobolev <sobomax@FreeBSD.org> wrote this file. As long as you retain 9# this notice you can do whatever you want with this stuff. If we meet some 10# day, and you think this stuff is worth it, you can buy me a beer in return. 11# 12# Maxim Sobolev 13# ---------------------------------------------------------------------------- 14# 15# 16# MAINTAINER= ports@MidnightBSD.org 17# 18 19import glob, os.path 20import patchtool 21from patchtool import True, False 22 23PORTSDIR = '/usr/mports' 24 25if __name__ == '__main__': 26 portdirs = glob.glob(os.path.join(PORTSDIR, '*/*')) 27 for dirname in portdirs: 28 if not os.path.isfile(os.path.join(dirname, 'Makefile')): 29 continue 30 categories = patchtool.querymakevar('CATEGORIES', dirname) 31 try: 32 mastercat = categories.split()[0] 33 except IndexError: 34 print '%s: categories list is empty' % dirname 35 continue 36 mastercat_real = os.path.basename(os.path.dirname(dirname)) 37 if mastercat != mastercat_real: 38 print '%s: specified master category `%s\' doesn\'t match real one `%s\'' \ 39 % (dirname, mastercat, mastercat_real) 40 41