[packagedb-cli] Created tag v1.1.0
by Pierre-YvesChibon
The signed tag 'v1.1.0' was created.
Tagger: Pierre-Yves Chibon py(a)chibon.fr <pingou(a)pingoured.fr>
Date: Thu Jul 28 17:10:35 2011 +0200
Version 1.1.0
Changes since the last tag 'v1.0.0':
Pierre-Yves Chibon (2):
Do not fail if koji tags change.
When updating all acl (to approve or deny them), only change the one which are pending / awaiting review.
Pierre-Yves Chibon py(a)chibon.fr (7):
Update README file
Rename pkgdb into pkgdb-cli
Add method to take ownership of a package
Improve output for orphaned packages/branch
When answer an ACL request, print out the name of the user approved/denied rather than the name of the package owner.
Add motif selection when printing the list of packages of a user
Change back output for package orphaned.
pingou (1):
Use fedora_cert to retrieve fas username if not provided
12 years, 9 months
[packagedb-cli] When updating all acl (to approve or deny them), only change the one which are pending / awaiting re
by Pierre-YvesChibon
commit 2eb663eaeaaee2c4086cd63d45de0dfdca14a733
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Jul 28 16:01:09 2011 +0200
When updating all acl (to approve or deny them), only change the one which are pending / awaiting review.
pkgdb-cli.py | 32 +++++++++++++++++++++++++++++++-
1 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb-cli.py b/pkgdb-cli.py
index 2524bbc..fc19159 100755
--- a/pkgdb-cli.py
+++ b/pkgdb-cli.py
@@ -183,6 +183,35 @@ def _get_active_branches():
return branches.keys()
+def _get_action_pending(packagename, branch, user):
+ """
+ Returns the actions which are pending for approval for a given
+ package, branch and user.
+
+ :arg packagename, the name of the package for which we want to check
+ the ACL
+ :arg branch the branch that we look at
+ :arg user, the FAS account that we look at
+ """
+ log.debug("Query pkgdb for {0} in branch {1}".format(packagename, branch))
+ pkgdbinfo = pkgdbclient.send_request('/acls/name/{0}'.format(packagename),
+ auth=False)
+
+ log.debug("Retrieve pending ACL")
+ aclout = []
+ statusmap = pkgdbinfo['statusMap']
+ if 'packageListings' in pkgdbinfo:
+ for collection in pkgdbinfo['packageListings']:
+ if branch == collection['collection']['branchname']:
+ for people in collection['people']:
+ for acl in ['watchbugzilla', 'watchcommits', 'commit',
+ 'approveacls']:
+ if acl in people['aclOrder'].keys() \
+ and people['aclOrder'][acl] is not None \
+ and people['aclOrder'][acl]['statuscode'] == 8:
+ aclout.append(acl)
+ return aclout
+
def _get_last_build(packagename, tag):
"""
Print information about the last build of a package for a given koji
@@ -689,7 +718,8 @@ def answer_acl_request(packagename, action, user, answer, branch=None,
if action == 'all':
log.debug("Answer all acl for user: {0}".format(
pkgdbclient.username))
- for action in actionlist:
+ # Retrieve only the action which are pending
+ for action in _get_action_pending(packagename, branch, user):
_answer_acl(action, user, packagename, answer, branch)
# else we answer only the given one
else:
12 years, 9 months
[packagedb-cli] Do not fail if koji tags change.
by Pierre-YvesChibon
commit 036756cf2c701c53ccd40192c4272571d512353e
Author: Pierre-Yves Chibon <pingou(a)pingoured.fr>
Date: Thu Jul 28 15:33:49 2011 +0200
Do not fail if koji tags change.
pkgdb-cli.py | 15 ++++++++++++---
1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/pkgdb-cli.py b/pkgdb-cli.py
index 4f5fd38..2524bbc 100755
--- a/pkgdb-cli.py
+++ b/pkgdb-cli.py
@@ -593,11 +593,20 @@ def get_last_build(packagename, tag):
# for updates and updates-testing
if "f" in tag:
tag = tag + "-updates"
- _get_last_build(packagename, tag)
+ try:
+ _get_last_build(packagename, tag)
+ except Exception, er:
+ print er
tag = tag + "-testing"
- _get_last_build(packagename, tag)
+ try:
+ _get_last_build(packagename, tag)
+ except Exception, er:
+ print er
else:
- _get_last_build(packagename, tag)
+ try:
+ _get_last_build(packagename, tag)
+ except Exception, er:
+ print er
def handle_acl(packagename, action, branch='devel', cancel=False,
12 years, 9 months
[packagedb-cli] Change back output for package orphaned.
by Pierre-YvesChibon
commit 9eb29b3d3a3a5299ff9abc0147430b6816301a9d
Author: Pierre-Yves Chibon py(a)chibon.fr <pingou(a)pingoured.fr>
Date: Thu Jul 21 18:29:28 2011 +0200
Change back output for package orphaned.
Revert part of the changes from e2527f33327345cffd1b2b7e87d11174180fb69d
We keep highlighting the owner if the owner is orphan but we do print whether there was co-maintainer and how old the last build is.
pkgdb-cli.py | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
---
diff --git a/pkgdb-cli.py b/pkgdb-cli.py
index dfdd15c..4f5fd38 100755
--- a/pkgdb-cli.py
+++ b/pkgdb-cli.py
@@ -541,8 +541,6 @@ def get_package_info(packagename, branch=None, pending=False,
'branchname'])),
" " * 10,
owner)
- if collection['owner'] == 'orphan':
- continue
# print header of the table
tmp = " " * 24
12 years, 9 months
[packagedb-cli] Add motif selection when printing the list of packages of a user
by Pierre-YvesChibon
commit 21171239f4d06c5d6a15406c4054c44ac910ce3e
Author: Pierre-Yves Chibon py(a)chibon.fr <pingou(a)pingoured.fr>
Date: Thu Jul 21 15:38:40 2011 +0200
Add motif selection when printing the list of packages of a user
- Add "*" at the end of the provided motif, only if there are no "*" already in the motif
- Print the count of packages printed rather than the total count when we only print a part of them.
pkgdb-cli.py | 18 +++++++++++++-----
1 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/pkgdb-cli.py b/pkgdb-cli.py
index 712c1d2..dfdd15c 100755
--- a/pkgdb-cli.py
+++ b/pkgdb-cli.py
@@ -365,7 +365,7 @@ def get_packages(motif=None, name_only=False):
"""
if motif is not None:
log.info("Query packages starting with: {0}".format(motif))
- if not motif.endswith("*"):
+ if "*" not in motif:
motif = motif.strip() + "*"
pkgdbinfo = pkgdbclient.send_request('/acls/list/{0}'.format(motif),
auth=False,
@@ -432,7 +432,7 @@ def get_orphaned_packages(motif=None, eol=False, name_only=False):
log.info(pkgdbinfo.keys())
-def get_packager_info(packager, output=True, name_only=False):
+def get_packager_info(packager, motif="", output=True, name_only=False):
"""
Retrieve the list of all the package for which the given packager
has
@@ -444,6 +444,7 @@ def get_packager_info(packager, output=True, name_only=False):
(default options)
:arg packager name of the packager for who to retrieve info
+ :arg motif a motif search in the package a packager owns
:karg output if False the packager information are not printed to
std.out
:karg name_only if true only the name of the package is returned.
@@ -453,16 +454,23 @@ def get_packager_info(packager, output=True, name_only=False):
packager), auth=False,
req_params={'tg_paginate_limit': 0})
+ if motif is None:
+ motif = ""
+ if "*" not in motif:
+ motif = motif.strip() + "*"
+ motif = motif.replace("*", ".*")
pkgs = []
if pkgdbinfo['eol']:
if output:
print "User EOL'd"
if 'pkgs' in pkgdbinfo:
+ cnt = 0
for pkg in pkgdbinfo['pkgs']:
log.info(pkg.keys())
log.info(name_only)
pkgs.append(pkg['name'])
- if output:
+ if output and re.search("^{0}$".format(motif), pkg['name']):
+ cnt = cnt + 1
out = " " + pkg['name'] + " " * (33 - \
len(pkg['name'])) + \
pkg['summary']
@@ -472,7 +480,7 @@ def get_packager_info(packager, output=True, name_only=False):
print out
#pkgdbinfo['statusMap'][pkg['statuscode']]
if output:
- print "Total: {0} packages".format(len(pkgdbinfo['pkgs']))
+ print "Total: {0} packages".format(cnt)
return pkgs
@@ -964,7 +972,7 @@ def main():
get_orphaned_packages(args.pattern, eol=args.eol,
name_only=args.name_only)
elif (args.username is not None and args.username):
- get_packager_info(args.username, name_only=args.name_only)
+ get_packager_info(args.username, motif=args.pattern, name_only=args.name_only)
elif (args.pattern is not None):
get_packages(args.pattern, name_only=args.name_only)
else:
12 years, 9 months
[packagedb-cli] When answer an ACL request, print out the name of the user approved/denied rather than the name of t
by Pierre-YvesChibon
commit c5092771d0e24d13358e00e1729c6dfc9ba678fb
Author: Pierre-Yves Chibon py(a)chibon.fr <pingou(a)pingoured.fr>
Date: Thu Jul 21 14:10:49 2011 +0200
When answer an ACL request, print out the name of the user approved/denied rather than the name of the package owner.
See #11
pkgdb-cli.py | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb-cli.py b/pkgdb-cli.py
index 22c23fd..712c1d2 100755
--- a/pkgdb-cli.py
+++ b/pkgdb-cli.py
@@ -297,7 +297,7 @@ def _answer_acl(action, user, packagename, answer, branch):
action,
answer,
reset,
- pkgdbclient.username,
+ user,
packagename,
branch)
else:
12 years, 9 months
[packagedb-cli] Improve output for orphaned packages/branch
by Pierre-YvesChibon
commit e2527f33327345cffd1b2b7e87d11174180fb69d
Author: Pierre-Yves Chibon py(a)chibon.fr <pingou(a)pingoured.fr>
Date: Wed Jul 13 13:21:13 2011 +0200
Improve output for orphaned packages/branch
- No need to show old comaintainers when package is orphaned
- Highlight when the package is orphaned
pkgdb-cli.py | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb-cli.py b/pkgdb-cli.py
index 8a7dcef..22c23fd 100755
--- a/pkgdb-cli.py
+++ b/pkgdb-cli.py
@@ -520,6 +520,9 @@ def get_package_info(packagename, branch=None, pending=False,
or branch == "all" \
or branch == collection['collection']['branchname']:
+ owner = collection['owner']
+ if collection['owner'] == 'orphan':
+ owner = red + collection['owner'] + reset
# Retrieve ACL information
print "{0}{1}{2}{3}Owner:{4}{5}".rstrip().format(
red + bold,
@@ -529,7 +532,9 @@ def get_package_info(packagename, branch=None, pending=False,
len(collection['collection'][
'branchname'])),
" " * 10,
- collection['owner'])
+ owner)
+ if collection['owner'] == 'orphan':
+ continue
# print header of the table
tmp = " " * 24
12 years, 10 months
[packagedb-cli] Add method to take ownership of a package
by Pierre-YvesChibon
commit c6664f22e7432e7697e2ccb62e6d9972998d717d
Author: Pierre-Yves Chibon py(a)chibon.fr <pingou(a)pingoured.fr>
Date: Wed Jul 13 09:57:04 2011 +0200
Add method to take ownership of a package
- Run pylint and pep8 to clean the code
- Refactor _orphan_one_package into _update_owner_one_package so that the method can be used both to orphan and unorphan packages
- Prepare version number for next release
pkgdb-cli.py | 96 ++++++++++++++++++++++++++++++++++++++++++++++------------
1 files changed, 76 insertions(+), 20 deletions(-)
---
diff --git a/pkgdb-cli.py b/pkgdb-cli.py
index a5424ea..8a7dcef 100755
--- a/pkgdb-cli.py
+++ b/pkgdb-cli.py
@@ -25,7 +25,7 @@ import sys
import re
import fedora_cert
-version = '0.0.1'
+version = '1.1.0'
kojiclient = koji.ClientSession('http://koji.fedoraproject.org/kojihub',
{})
pkgdbclient = PackageDB('https://admin.fedoraproject.org/pkgdb')
@@ -50,7 +50,7 @@ if '--nocolor' in sys.argv:
bold = ""
reset = ""
-cmdlist = ['acl', 'list', 'request', 'update', 'orphan']
+cmdlist = ['acl', 'list', 'request', 'update', 'orphan', 'unorphan']
actionlist = ['watchbugzilla', 'watchcommits', 'commit', 'approveacls']
@@ -69,7 +69,7 @@ class PackageIDError(Exception):
def _get_client_authentified(username=None, password=None):
""" Returned a BaseClient with authentification
-
+
If the username is None, tries to retrieve it from fedora_cert.
:arg pkgdbclient a PackageDB object to which username and password
@@ -212,8 +212,8 @@ def _get_last_build(packagename, tag):
tag)
-def _orphan_one_package(packagename, branch='devel', username=None,
- password=None):
+def _update_owner_one_package(packagename, branch='devel', action="orphan",
+ username=None, password=None):
"""
Orphan one package from pkgdb.
"""
@@ -221,10 +221,15 @@ def _orphan_one_package(packagename, branch='devel', username=None,
branch = 'devel'
_get_client_authentified(username=username, password=password)
- log.info("Orphaning package {0} on branch {1}".format(packagename, branch))
+ log.info("{0}ing package {1} on branch {2}".format(action.capitalize(),
+ packagename, branch))
+
+ owner = "orphan"
+ if action.lower() != "orphan":
+ owner = pkgdbclient.username
pkgdbinfo = pkgdbclient.send_request(
'/acls/dispatcher/set_owner',
- auth=True, req_params={'owner': 'orphan',
+ auth=True, req_params={'owner': owner,
'pkg_name': packagename,
'collectn_list': branch})
log.debug("output: {0}".format(pkgdbinfo))
@@ -232,9 +237,11 @@ def _orphan_one_package(packagename, branch='devel', username=None,
if "message" in pkgdbinfo.keys():
print "{0}{1}{2}\n".format(bold, pkgdbinfo["message"], reset)
else:
- print "{0}Changed owner of {1} to orphan{2}\n".format(bold,
- packagename,
- reset)
+ print "{0}Changed owner of {1} to {2} in branch {3} {4}\n".format(bold,
+ packagename,
+ owner,
+ branch,
+ reset)
def _retire_one_package(packagename, branch='devel', username=None,
@@ -316,10 +323,10 @@ def _handle_acl_request(packagename, action, branch, cancel=False):
"Process acl '{0}' for user {1} and package {2} on branch {3}".format(
action, pkgdbclient.username, packagename, branch))
statusname = "Awaiting Review"
- params = {'pkgid' : packageid,
- 'person_name' : pkgdbclient.username,
- 'acl_name' : action,
- 'set_acl' : True}
+ params = {'pkgid': packageid,
+ 'person_name': pkgdbclient.username,
+ 'acl_name': action,
+ 'set_acl': True}
if cancel:
params['set_acl'] = False
statusname = "Obsolete"
@@ -633,6 +640,7 @@ def handle_acl(packagename, action, branch='devel', cancel=False,
log.debug(err)
return msg
+
def answer_acl_request(packagename, action, user, answer, branch=None,
username=None, password=None):
"""
@@ -699,9 +707,11 @@ def orphan_package(packagename, branch='devel', allpkgs=False,
log.debug("Orphan in all branches")
branches = _get_active_branches()
for branch in branches:
- _orphan_one_package(pkg, branch, username, password)
+ _update_owner_one_package(pkg, branch, action="orphan",
+ username=username, password=password)
else:
- _orphan_one_package(pkg, branch, username, password)
+ _update_owner_one_package(pkg, branch, action="orphan",
+ username=username, password=password)
elif re.match(packagename, pkg):
log.debug("motif : {0}".format(motif))
log.debug("package : {0}".format(pkg))
@@ -709,14 +719,44 @@ def orphan_package(packagename, branch='devel', allpkgs=False,
log.debug("Orphan in all branches")
branches = _get_active_branches()
for branch in branches:
- _orphan_one_package(pkg, branch, username, password)
+ _update_owner_one_package(pkg, branch, action="orphan",
+ username=username, password=password)
else:
- _orphan_one_package(packagename, branch, username, password)
+ _update_owner_one_package(packagename, branch, action="orphan",
+ username=username, password=password)
else:
print "Could not find {0} in the list of your packages".format(
packagename)
+def unorphan_package(packagename, branch='devel',
+ username=None, password=None):
+ """
+ Unorphan packages from pkgdb.
+
+ :arg packagename the name of the package to orphan
+ :kwarg branch the name of the branch to orphan. By default it is
+ 'devel' but it can also be 'all'.
+ :kwarg username the FAS username
+ :kwarg password the FAS password of the user
+ """
+ if branch is None:
+ branch = 'devel'
+ _get_client_authentified(username=username, password=password)
+
+ log.debug("Packages: {0}".format(packagename))
+
+ if branch == "all":
+ log.debug("Orphan in all branches")
+ branches = _get_active_branches()
+ for branch in branches:
+ _update_owner_one_package(packagename, branch, action="unorphan",
+ username=username, password=password)
+ else:
+ _update_owner_one_package(packagename, branch, action="unorphan",
+ username=username, password=password)
+
+
def retire_package(packagename, branch='devel', allpkgs=False,
username=None, password=None):
"""
@@ -745,7 +785,8 @@ def retire_package(packagename, branch='devel', allpkgs=False,
log.debug("Retire in all branches")
branches = _get_active_branches()
for branch in branches:
- _orphan_one_package(pkg, branch, username, password)
+ _update_owner_one_package(pkg, branch, action="orphan",
+ username=username, password=password)
else:
_retire_one_package(pkg, branch, username, password)
else:
@@ -753,7 +794,8 @@ def retire_package(packagename, branch='devel', allpkgs=False,
log.debug("Retire in all branches")
branches = _get_active_branches()
for branch in branches:
- _orphan_one_package(pkg, branch, username, password)
+ _update_owner_one_package(pkg, branch, action="orphan",
+ username=username, password=password)
else:
_retire_one_package(packagename, branch, username, password)
@@ -817,6 +859,13 @@ def setup_action_parser(action, last_args=None):
parser.add_argument('--all', action="store_true", default=False,
help="Orphan all your packages")
+ elif action == 'unorphan':
+ parser.add_argument('package',
+ help="Name of the package to unorphan")
+ parser.add_argument('branch', default='devel', nargs="?",
+ help="Branch of the package to unorphan " \
+ "(default: 'devel', can be: 'all')")
+
elif action == "request":
parser.add_argument('--cancel', action="store_true", default=False,
help="Obsolete an ACL request")
@@ -930,6 +979,13 @@ def main():
retire_package(args.package, args.branch,
arg.username, arg.password)
+ elif action == "unorphan":
+ log.info("user : {0}".format(arg.username))
+ log.info("package : {0}".format(args.package))
+ log.info("branch : {0}".format(args.branch))
+ unorphan_package(args.package, args.branch,
+ arg.username, arg.password)
+
elif action == "request":
log.info("user : {0}".format(arg.username))
log.info("package : {0}".format(args.package))
12 years, 10 months
[packagedb-cli] Created tag v1.0.0
by Pierre-YvesChibon
The signed tag 'v1.0.0' was created.
Tagger: Pierre-Yves Chibon py(a)chibon.fr <pingou(a)pingoured.fr>
Date: Wed Jun 29 09:18:02 2011 +0200
Release 1.0.0
Changes:
Haikel Guemar (1):
use new-style formatters to ease packagedb-cli i18n
Pierre-Yves Chibon (14):
Import license for the project, GPLv2+
Start README information file
Import first work on pkgdb
Documentation
More documentation
Implement the logic to orphan/retire all branches
Print error if message packageid could not be found for a branch
Rewrite the orphan action to be able to use basic pattern.
No need to query bz if we don't show the output
Reduce code redundancy by creating the _get_last_build function
Rename the parser variable and layout the code
Start implementing methods to approve or deny requested ACL
Fix methods to approve/deny ACL and raise error when the package ID cannot be found
Fix the pkgdb orphan --all usecase and make the output from get_packager_info optionnal.
Pierre-Yves Chibon py(a)chibon.fr (23):
Add function to toggle acl, use the PackageDB class rather than the BaseClient and clean code a little
Typo on watchcommits and allow to toggle all ACLs in one go
Make request and orphan proper actions
Change comments into documentations (make pylint happier)
Add method to retrieve active branches from pkgdb
Layout
Revise the orphan --all procedure to reduce the number of call to pkgdb.
Refactor list and acl
Revert "Revise the orphan --all procedure to reduce the number of call to pkgdb."
Layout of help messages
Fix indentation of group account, Fix#3
Fix style
Add gitignore file
Proposed --nocolor argument.
Fix the --nocolor option
Fix indentation issue in --nocolor
Bug fix in layout
Enables the request of all ACLs on all branches.
Code cleanning
Start fixing the request process
Improve ACL request management
Make use of set_remove_acl_request
No need to catch this error which hides information
Stanislav Ochotnicky (2):
Fix version in last builds
_get_group_info return None if no present ACLs present
12 years, 10 months
[packagedb-cli] Use fedora_cert to retrieve fas username if not provided
by Pierre-YvesChibon
commit 8975bfd5c8007120195093e429f4710cc11f183f
Author: pingou <pingou(a)pingoured.fr>
Date: Wed Jul 13 07:55:28 2011 +0200
Use fedora_cert to retrieve fas username if not provided
pkgdb-cli.py | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/pkgdb-cli.py b/pkgdb-cli.py
index 59fba71..a5424ea 100755
--- a/pkgdb-cli.py
+++ b/pkgdb-cli.py
@@ -23,6 +23,7 @@ import getpass
import koji
import sys
import re
+import fedora_cert
version = '0.0.1'
kojiclient = koji.ClientSession('http://koji.fedoraproject.org/kojihub',
@@ -68,6 +69,8 @@ class PackageIDError(Exception):
def _get_client_authentified(username=None, password=None):
""" Returned a BaseClient with authentification
+
+ If the username is None, tries to retrieve it from fedora_cert.
:arg pkgdbclient a PackageDB object to which username and password
are added
@@ -76,7 +79,11 @@ def _get_client_authentified(username=None, password=None):
"""
if pkgdbclient.password is None:
if username is None:
- username = raw_input('FAS username: ')
+ try:
+ username = fedora_cert.read_user_cert()
+ except:
+ log.debug('Could not read Fedora cert, using login name')
+ username = raw_input('FAS username: ')
if password is None:
password = getpass.getpass()
pkgdbclient.username = username
12 years, 10 months