ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/ozone/mgar/gar/bin/chkdbcat
Revision: 1
Committed: Sat Jun 20 14:58:51 2026 UTC (4 weeks, 3 days ago) by operz
File size: 3496 byte(s)
Log Message:
Initial import of OZSW mgar build tree

File Contents

# Content
1 #!/usr/bin/python2.6
2 # -*- python -*-
3
4 import argparse
5 import logging
6 import itertools
7 from lib.python import chkdbcat
8
9 class MyCheckDBCatalog(chkdbcat.CheckDBCatalog):
10 """Class overriding CheckDBCatalog.notify()"""
11 def __init__(self, catrel, arch, osrel, fn_ts, gencat_bin, chkcat, verbose=False):
12 super(MyCheckDBCatalog,self).__init__(catrel, arch, osrel, fn_ts, gencat_bin, chkcat)
13 self.__verbose = verbose
14
15 def notify_broken(self, date, addr, pkginfo):
16 notifier = chkdbcat.InformMaintainer((self._catrel, self._osrel, self._arch),
17 date, addr, pkginfo)
18 notfier.send_mail_broken()
19
20 def notify_unbroken(self, date, addr):
21 notifier = chkdbcat.InformMaintainer((self._catrel, self._osrel, self._arch),
22 date, addr, pkginfo)
23 notfier.send_mail_unbroken()
24
25
26 def argparser():
27 parser = argparse.ArgumentParser(description='Check Database Catalog.')
28 parser.add_argument('--debug', help='enable debug output', required=False, default=False, action='store_const', const=True)
29 parser.add_argument('--verbose', help='be verbose', required=False, default=False, action='store_const', const=True)
30 parser.add_argument('--arch', required=True,
31 help="i386, sparc",
32 nargs="+")
33 parser.add_argument('--catalog-release', required=True,
34 help="unstable, kiel, etc.",
35 nargs="+")
36 parser.add_argument('--os-release', required=True,
37 help="SunOS5.10, SunOS5.11",
38 nargs="+")
39 parser.add_argument('--timestamp-file',
40 help="timestamp filepath (default: %(default)s)",
41 default='/var/cache/chkdbcat/timestamp.json')
42 parser.add_argument('--chkcat-path',
43 help="path to chkcat binary (default: %(default)s)",
44 default='/opt/csw/bin/chkcat')
45 parser.add_argument('--gen-catalog-path',
46 help="path to gen-catalog-index (default: %(default)s)",
47 default="/home/web/bin/gen-catalog-index")
48 return parser.parse_args()
49
50 def main():
51 args = argparser()
52
53 if args.debug:
54 logging.basicConfig(level=logging.DEBUG)
55
56 had_errors = False
57 for crel_arch_orel in itertools.product(args.catalog_release, args.arch, args.os_release):
58 catalog_release = crel_arch_orel[0]
59 arch = crel_arch_orel[1]
60 os_release = crel_arch_orel[2]
61
62 if args.verbose: print("Checking Database Catalog {0} {2} {1}".format(catalog_release, arch, os_release))
63 with MyCheckDBCatalog(catalog_release, arch,
64 os_release, args.timestamp_file,
65 args.gen_catalog_path,
66 args.chkcat_path, args.verbose) as checker:
67 success = checker.check()
68 if args.verbose:
69 if success:
70 print("Database Catalog {0} {2} {1}: OK".format(catalog_release, arch, os_release))
71 else:
72 print("Database Catalog {0} {2} {1}: FAILED".format(catalog_release, arch, os_release))
73 print("chkcat output")
74 print checker.stderr
75
76 had_errors = had_errors or not success
77
78 exit(0) if had_errors else exit(1)
79
80 if __name__ == '__main__':
81 main()

Properties

Name Value
svn:executable *