Compare commits
2 Commits
51c58c1899
...
962c214664
Author | SHA1 | Date |
---|---|---|
Ryan Fox | 962c214664 | |
Ryan Fox | 8320df3bc5 |
|
@ -3,11 +3,15 @@
|
||||||
|
|
||||||
from sys import argv
|
from sys import argv
|
||||||
from pkgcrap.list_update import main as update
|
from pkgcrap.list_update import main as update
|
||||||
|
from pkgcrap.list_update import maintlist as maintlist
|
||||||
from pkgcrap.outdated_check import main as outdated
|
from pkgcrap.outdated_check import main as outdated
|
||||||
|
from pkgcrap.forge_scan import main as forgescan
|
||||||
|
|
||||||
options = {
|
options = {
|
||||||
'update': update,
|
'update': update,
|
||||||
'outdated': outdated,
|
'outdated': outdated,
|
||||||
|
'maintlist': maintlist,
|
||||||
|
'forgescan': forgescan,
|
||||||
}
|
}
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
|
@ -0,0 +1,45 @@
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from pkgcrap.util import conf_file_path
|
||||||
|
import pkgcrap.parse as parse
|
||||||
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
def main(args):
|
||||||
|
repos = parse.repos()
|
||||||
|
repos.load()
|
||||||
|
checked = 0
|
||||||
|
failed = 0
|
||||||
|
forges = {}
|
||||||
|
for repo in repos.repos.values():
|
||||||
|
repo.load()
|
||||||
|
print('Scanning', repo.name)
|
||||||
|
for cat in repo.categories.values():
|
||||||
|
cat.load()
|
||||||
|
for pkg in cat.packages.values():
|
||||||
|
pkg.load()
|
||||||
|
if len(pkg.ebuilds) == 0 or 'EGIT_REPO_URI' not in pkg.ebuilds[0].vars:
|
||||||
|
failed += 1
|
||||||
|
continue
|
||||||
|
eb = pkg.ebuilds[0]
|
||||||
|
repo = pkg.ebuilds[0].vars['EGIT_REPO_URI'].replace('${PN}', pkg.name)
|
||||||
|
if 'HOMEPAGE' in pkg.ebuilds[0].vars:
|
||||||
|
repo = repo.replace('${HOMEPAGE}', eb.vars['HOMEPAGE'])
|
||||||
|
if 'EGO_PN' in pkg.ebuilds[0].vars:
|
||||||
|
repo = repo.replace('${EGO_PN}', eb.vars['EGO_PN'])
|
||||||
|
if 'MY_REPO_URI' in pkg.ebuilds[0].vars:
|
||||||
|
repo = repo.replace('${MY_REPO_URI}', eb.vars['MY_REPO_URI'])
|
||||||
|
forge = urlparse(repo).netloc
|
||||||
|
if forge == '' or forge.startswith('${'):
|
||||||
|
failed += 1
|
||||||
|
continue
|
||||||
|
if forge not in forges:
|
||||||
|
forges[forge] = 0
|
||||||
|
forges[forge] += 1
|
||||||
|
checked += 1
|
||||||
|
print('Found git URI in '+str(checked)+' packages')
|
||||||
|
print('Failed to find git URI in '+str(failed)+' packages')
|
||||||
|
for forge in dict(reversed(sorted(forges.items(), key=lambda item: item[1]))):
|
||||||
|
c = forges[forge]
|
||||||
|
p = float(c)/checked*100
|
||||||
|
print(forge+': '+str(c)+f' ({p:.2f}%)')
|
|
@ -4,13 +4,14 @@
|
||||||
from pkgcrap.util import conf_file_path
|
from pkgcrap.util import conf_file_path
|
||||||
import pkgcrap.parse as parse
|
import pkgcrap.parse as parse
|
||||||
|
|
||||||
def packages_scan(maintainer):
|
def packages_scan(maintainer, verbose=False):
|
||||||
repos = parse.repos()
|
repos = parse.repos()
|
||||||
repos.load()
|
repos.load()
|
||||||
packages = []
|
packages = []
|
||||||
for repo in repos.repos.values():
|
for repo in repos.repos.values():
|
||||||
repo.load()
|
repo.load()
|
||||||
print('Scanning', repo.name)
|
if verbose:
|
||||||
|
print('Scanning', repo.name)
|
||||||
for cat in repo.categories.values():
|
for cat in repo.categories.values():
|
||||||
cat.load()
|
cat.load()
|
||||||
for pkg in cat.packages.values():
|
for pkg in cat.packages.values():
|
||||||
|
@ -22,11 +23,19 @@ def packages_scan(maintainer):
|
||||||
pass
|
pass
|
||||||
return packages
|
return packages
|
||||||
|
|
||||||
|
def maintlist(args):
|
||||||
|
if len(args) < 1:
|
||||||
|
print('Specify the maintainer\'s email address')
|
||||||
|
return
|
||||||
|
packages = packages_scan(args[0])
|
||||||
|
for pkg in packages:
|
||||||
|
print(pkg.full_name)
|
||||||
|
|
||||||
def main(args):
|
def main(args):
|
||||||
if len(args) < 1:
|
if len(args) < 1:
|
||||||
print('Specify your maintainer email address')
|
print('Specify your maintainer email address')
|
||||||
return
|
return
|
||||||
packages = packages_scan(args[0])
|
packages = packages_scan(args[0], verbose=True)
|
||||||
with open(conf_file_path('maintained.txt'), 'w') as fp:
|
with open(conf_file_path('maintained.txt'), 'w') as fp:
|
||||||
fp.write("\n".join([pkg.full_name for pkg in packages]))
|
fp.write("\n".join([pkg.full_name for pkg in packages]))
|
||||||
print('Updated maintained package list')
|
print('Updated maintained package list')
|
||||||
|
|
Loading…
Reference in New Issue