def critpath(self, collctn_list=None): '''Retrieve the list of packages that are critpath Critical path packages are subject to more testing or stringency of criteria for updating when a release occurs. :kwarg collctn_list: List of collection shortnames for which to retrieve the packages from. The default is all non-EOL collections. :returns: dict keyed by collection shortname. The values are the list of critpath packages for each collection ''' # Check for validation errors requesting this form errors = jsonify_validation_errors() if errors: return errors pkg_names = select((BranchTable.c.branchname, PackageTable.c.name))\ .where(and_(PackageTable.c.id==PackageListingTable.c.packageid, PackageListingTable.c.collectionid==CollectionTable.c.id, CollectionTable.c.id==BranchTable.c.collectionid, PackageListingTable.c.critpath==True)) if collctn_list: pkg_names = pkg_names.where( BranchTable.c.branchname.in_(collctn_list)) else: pkg_names = pkg_names.where( CollectionTable.c.statuscode != STATUS['EOL']) pkgs = {} for pkg in pkg_names.execute(): try: pkgs[pkg[0]].add(pkg[1]) except KeyError: pkgs[pkg[0]] = set() pkgs[pkg[0]].add(pkg[1]) return dict(pkgs=pkgs)
def critpath(self, collctn_list=None): '''Retrieve the list of packages that are critpath Critical path packages are subject to more testing or stringency of criteria for updating when a release occurs. :kwarg collctn_list: List of collection shortnames for which to retrieve the packages from. The default is all non-EOL collections. :returns: dict keyed by collection shortname. The values are the list of critpath packages for each collection ''' # Check for validation errors requesting this form errors = jsonify_validation_errors() if errors: return errors pkg_names = select((BranchTable.c.branchname, PackageTable.c.name))\ .where(and_(PackageTable.c.id==PackageListingTable.c.packageid, PackageListingTable.c.collectionid==CollectionTable.c.id, CollectionTable.c.id==BranchTable.c.collectionid, PackageListingTable.c.critpath==True)) if collctn_list: pkg_names = pkg_names.where(BranchTable.c.branchname.in_(collctn_list)) else: pkg_names = pkg_names.where(CollectionTable.c.statuscode!= STATUS['EOL']) pkgs = {} for pkg in pkg_names.execute(): try: pkgs[pkg[0]].add(pkg[1]) except KeyError: pkgs[pkg[0]] = set() pkgs[pkg[0]].add(pkg[1]) return dict(pkgs=pkgs)
def notify(self, name=None, version=None, eol=False): '''List of usernames that should be notified of changes to a package. For the collections specified we want to retrieve all of the owners, watchbugzilla, and watchcommits accounts. :kwarg name: Set to a collection name to filter the results for that :kwarg version: Set to a collection version to further filter results for a single version :kwarg eol: Set to True if you want to include end of life distributions ''' # Check for validation errors requesting this form errors = jsonify_validation_errors() if errors: return errors # Retrieve Packages, owners, and people on watch* acls #pylint:disable-msg=E1101 owner_query = select((Package.name, PackageListing.owner), from_obj=(PackageTable.join(PackageListingTable).join( CollectionTable))).where(and_( Package.statuscode == STATUS['Approved'], PackageListing.statuscode == STATUS['Approved']) ).distinct().order_by('name') watcher_query = select((Package.name, PersonPackageListing.username), from_obj=(PackageTable.join(PackageListingTable).join( CollectionTable).join(PersonPackageListingTable).join( PersonPackageListingAclTable))).where(and_( Package.statuscode == STATUS['Approved'], PackageListing.statuscode == STATUS['Approved'], PersonPackageListingAcl.acl.in_( ('watchbugzilla', 'watchcommits')), PersonPackageListingAcl.statuscode == STATUS['Approved'] )).distinct().order_by('name') #pylint:enable-msg=E1101 if not eol: # Filter out eol distributions #pylint:disable-msg=E1101 owner_query = owner_query.where(CollectionTable.c.statuscode.in_( (STATUS['Active'], STATUS['Under Development']))) watcher_query = watcher_query.where(CollectionTable.c.statuscode.\ in_((STATUS['Active'], STATUS['Under Development']))) #pylint:enable-msg=E1101 # Only grab from certain collections if name: #pylint:disable-msg=E1101 owner_query = owner_query.where(CollectionTable.c.name==name) watcher_query = watcher_query.where(CollectionTable.c.name==name) #pylint:enable-msg=E1101 if version: # Limit the versions of those collections #pylint:disable-msg=E1101 owner_query = owner_query.where(CollectionTable.c.version==\ version) watcher_query = watcher_query.where(CollectionTable.c.version\ ==version) #pylint:enable-msg=E1101 pkgs = {} # turn the query into a python object for pkg in itertools.chain(owner_query.execute(), watcher_query.execute()): additions = [] additions.append(pkg[1]) pkgs.setdefault(pkg[0], set()).update((pkg[1],)) # Retrieve list of collection information for generating the # collection form #pylint:disable-msg=E1101 collection_list = Collection.query.order_by('name').order_by('version') #pylint:enable-msg=E1101 collections = {} for collection in collection_list: try: collections[collection.name].append(collection.version) except KeyError: collections[collection.name] = [collection.version] # Return the data return dict(title=_('%(app)s -- Notification List') % { 'app': self.app_title}, packages=pkgs, collections=collections, name=name, version=version, eol=eol)
def notify(self, name=None, version=None, eol=False): '''List of usernames that should be notified of changes to a package. For the collections specified we want to retrieve all of the owners, watchbugzilla, and watchcommits accounts. :kwarg name: Set to a collection name to filter the results for that :kwarg version: Set to a collection version to further filter results for a single version :kwarg eol: Set to True if you want to include end of life distributions ''' # Check for validation errors requesting this form errors = jsonify_validation_errors() if errors: return errors # Retrieve Packages, owners, and people on watch* acls #pylint:disable-msg=E1101 owner_query = select( (Package.name, PackageListing.owner), from_obj=(PackageTable.join(PackageListingTable).join( CollectionTable))).where( and_(Package.statuscode == STATUS['Approved'], PackageListing.statuscode == STATUS['Approved'])).distinct().order_by('name') watcher_query = select( (Package.name, PersonPackageListing.username), from_obj=(PackageTable.join(PackageListingTable).join( CollectionTable).join(PersonPackageListingTable).join( PersonPackageListingAclTable))).where( and_( Package.statuscode == STATUS['Approved'], PackageListing.statuscode == STATUS['Approved'], PersonPackageListingAcl.acl.in_( ('watchbugzilla', 'watchcommits')), PersonPackageListingAcl.statuscode == STATUS['Approved'])).distinct().order_by('name') #pylint:enable-msg=E1101 if not eol: # Filter out eol distributions #pylint:disable-msg=E1101 owner_query = owner_query.where( CollectionTable.c.statuscode.in_( (STATUS['Active'], STATUS['Under Development']))) watcher_query = watcher_query.where(CollectionTable.c.statuscode.\ in_((STATUS['Active'], STATUS['Under Development']))) #pylint:enable-msg=E1101 # Only grab from certain collections if name: #pylint:disable-msg=E1101 owner_query = owner_query.where(CollectionTable.c.name == name) watcher_query = watcher_query.where(CollectionTable.c.name == name) #pylint:enable-msg=E1101 if version: # Limit the versions of those collections #pylint:disable-msg=E1101 owner_query = owner_query.where(CollectionTable.c.version==\ version) watcher_query = watcher_query.where(CollectionTable.c.version\ ==version) #pylint:enable-msg=E1101 pkgs = {} # turn the query into a python object for pkg in itertools.chain(owner_query.execute(), watcher_query.execute()): additions = [] additions.append(pkg[1]) pkgs.setdefault(pkg[0], set()).update((pkg[1], )) # Retrieve list of collection information for generating the # collection form #pylint:disable-msg=E1101 collection_list = Collection.query.order_by('name').order_by('version') #pylint:enable-msg=E1101 collections = {} for collection in collection_list: try: collections[collection.name].append(collection.version) except KeyError: collections[collection.name] = [collection.version] # Return the data return dict(title=_('%(app)s -- Notification List') % {'app': self.app_title}, packages=pkgs, collections=collections, name=name, version=version, eol=eol)