Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-ports
Path: blob/main/Tools/scripts/checkcats.py
18157 views
1
#!/usr/bin/env 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 <[email protected]> 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
# MAINTAINER= [email protected] <- any unapproved commits to this file are
16
# highly discouraged!!!
17
#
18
19
import glob, os.path
20
import patchtool
21
from patchtool import True, False
22
23
PORTSDIR = '/usr/ports'
24
25
if __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
42