forked from ros-infrastructure/buildfarm
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding a simple script to count packagse and return if over a threshold
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env python | ||
|
||
import argparse | ||
import buildfarm.repo | ||
import sys | ||
|
||
def parse_options(): | ||
parser = argparse.ArgumentParser(description="List all packages available in the repos for each arch. Filter on substring if provided") | ||
parser.add_argument("rosdistro", | ||
help='The ros distro. electric, fuerte, groovy') | ||
parser.add_argument("distro", | ||
help='Ubuntu distro lucid, precise, etc') | ||
parser.add_argument("arch", | ||
help='The arch amd63 i386') | ||
parser.add_argument('--repo', dest='repo_url', action='store', default='http://50.28.27.175/repos/building', | ||
help='The repo url') | ||
|
||
parser.add_argument('--count', dest='count', action='store', default=100, | ||
help='Min numberof packages') | ||
|
||
args = parser.parse_args() | ||
|
||
|
||
return args | ||
|
||
|
||
if __name__ == "__main__": | ||
args = parse_options() | ||
|
||
|
||
|
||
count = buildfarm.repo.count_packages(args.repo_url, args.rosdistro, args.distro, args.arch) | ||
print "Found %d packages matching: %s" % (count, args) | ||
|
||
if count > args.count: | ||
print "Count greater than argument, return True" | ||
sys.exit(0) | ||
else: | ||
print "Count not greater than argument, return False" | ||
sys.exit(1) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters