def convert_packagelisting(pkg1_sess, pkg2_sess): ''' Convert the PackageListing from pkgdb1 to pkgdb2. ''' cnt = 0 failed_pkg = set() failed_pkglist = set() for pkg in pkg1_sess.query(P1Packagelisting).all(): poc = pkg.owner if poc == 'perl-sig': poc = 'group::perl-sig' new_pkglist = model.PackageListing(point_of_contact=poc, status=STATUS[pkg.statuscode], package_id=pkg.packageid, collection_id=pkg.collectionid, critpath=pkg.critpath) new_pkglist.id = pkg.id pkg2_sess.add(new_pkglist) if new_pkglist.point_of_contact != 'orphan': acls = ['watchcommits', 'watchbugzilla', 'commit', 'approveacls'] if new_pkglist.point_of_contact == 'group::perl-sig': acls = ['watchcommits', 'watchbugzilla', 'commit'] for acl in acls: new_pkglistacl = model.PackageListingAcl( fas_name=new_pkglist.point_of_contact, packagelisting_id=new_pkglist.id, acl=acl, status='Approved') pkg2_sess.add(new_pkglistacl) try: pkg2_sess.commit() except Exception, err: pkg2_sess.rollback() failed_pkg.add(str(pkg.packageid)) failed_pkglist.add(str(new_pkglist.id)) cnt += 1
def create_package_critpath(session): """ Create package in critpath. """ package = model.Package( name='kernel', namespace='rpms', summary='The Linux kernel', description='The kernel', status='Approved', review_url='https://bugzilla.redhat.com/123', upstream_url='http://www.kernel.org/', monitor=True, koschei=True, ) session.add(package) f18_collec = model.Collection.by_name(session, 'f18') devel_collec = model.Collection.by_name(session, 'master') # Pkg: geany - Collection: F18 - Approved pkgltg = model.PackageListing( point_of_contact='kernel-maint', status='Approved', package_id=package.id, collection_id=f18_collec.id, critpath=True, ) session.add(pkgltg) # Pkg: geany - Collection: devel - Approved pkgltg = model.PackageListing( point_of_contact='group::kernel-maint', status='Approved', package_id=package.id, collection_id=devel_collec.id, critpath=True, ) session.add(pkgltg) session.commit()
def create_retired_pkgs(session): """ Add some retired packages. """ create_collection(session) create_package(session) guake_pkg = model.Package.by_name(session, 'guake') fedocal_pkg = model.Package.by_name(session, 'fedocal') geany_pkg = model.Package.by_name(session, 'geany') offlineimap_pkg = model.Package.by_name(session, 'offlineimap') f17_collec = model.Collection.by_name(session, 'f17') f18_collec = model.Collection.by_name(session, 'f18') devel_collec = model.Collection.by_name(session, 'master') el4_collec = model.Collection.by_name(session, 'el4') el6_collec = model.Collection.by_name(session, 'el6') # Pkg: guake - Collection: EL4 - Approved pkgltg = model.PackageListing( point_of_contact='pingou', status='Approved', package_id=guake_pkg.id, collection_id=el4_collec.id, ) session.add(pkgltg) # Pkg: guake - Collection: EL6 - Retired pkgltg = model.PackageListing( point_of_contact='pingou', status='Retired', package_id=guake_pkg.id, collection_id=el6_collec.id, ) session.add(pkgltg) # Pkg: guake - Collection: devel - Approved pkgltg = model.PackageListing( point_of_contact='pingou', status='Approved', package_id=guake_pkg.id, collection_id=devel_collec.id, ) session.add(pkgltg) # Pkg: fedocal - Collection: F17 - Retired pkgltg = model.PackageListing( point_of_contact='pingou', status='Retired', package_id=fedocal_pkg.id, collection_id=f17_collec.id, ) session.add(pkgltg) # Pkg: fedocal - Collection: F18 - Retired pkgltg = model.PackageListing( point_of_contact='orphan', status='Retired', package_id=fedocal_pkg.id, collection_id=f18_collec.id, ) session.add(pkgltg) # Pkg: fedocal - Collection: devel - Retired pkgltg = model.PackageListing( point_of_contact='orphan', status='Retired', package_id=fedocal_pkg.id, collection_id=devel_collec.id, ) session.add(pkgltg) session.commit()
def create_package_listing(session): """ Add some package to a some collection. """ create_collection(session) create_package(session) guake_pkg = model.Package.by_name(session, 'guake') fedocal_pkg = model.Package.by_name(session, 'fedocal') geany_pkg = model.Package.by_name(session, 'geany') offlineimap_pkg = model.Package.by_name(session, 'offlineimap') f17_collec = model.Collection.by_name(session, 'f17') f18_collec = model.Collection.by_name(session, 'f18') devel_collec = model.Collection.by_name(session, 'master') el4_collec = model.Collection.by_name(session, 'el4') # Pkg: guake - Collection: F18 - Approved pkgltg = model.PackageListing( point_of_contact='pingou', status='Approved', package_id=guake_pkg.id, collection_id=f18_collec.id, ) session.add(pkgltg) # Pkg: guake - Collection: devel - Approved pkgltg = model.PackageListing( point_of_contact='pingou', status='Approved', package_id=guake_pkg.id, collection_id=devel_collec.id, ) session.add(pkgltg) # Pkg: fedocal - Collection: F17 - Approved pkgltg = model.PackageListing( point_of_contact='pingou', status='Approved', package_id=fedocal_pkg.id, collection_id=f17_collec.id, ) session.add(pkgltg) # Pkg: fedocal - Collection: F18 - Orphaned pkgltg = model.PackageListing( point_of_contact='orphan', status='Orphaned', package_id=fedocal_pkg.id, collection_id=f18_collec.id, ) session.add(pkgltg) # Pkg: fedocal - Collection: devel - Retired pkgltg = model.PackageListing( point_of_contact='orphan', status='Retired', package_id=fedocal_pkg.id, collection_id=devel_collec.id, ) session.add(pkgltg) # Pkg: geany - Collection: F18 - Approved pkgltg = model.PackageListing( point_of_contact='pingou', status='Approved', package_id=geany_pkg.id, collection_id=f18_collec.id, ) session.add(pkgltg) # Pkg: geany - Collection: devel - Approved pkgltg = model.PackageListing( point_of_contact='group::gtk-sig', status='Approved', package_id=geany_pkg.id, collection_id=devel_collec.id, ) session.add(pkgltg) # Pkg: offlineimap - Collection: el4 - Approved pkgltg = model.PackageListing( point_of_contact='dodji', status='Approved', package_id=offlineimap_pkg.id, collection_id=el4_collec.id, ) session.add(pkgltg) # Pkg: offlineimap - Collection: devel - Approved pkgltg = model.PackageListing( point_of_contact='josef', status='Approved', package_id=offlineimap_pkg.id, collection_id=devel_collec.id, ) session.add(pkgltg) session.commit()
def create_docker_packages(session): """ Add packagers to packages. """ # Add packages cockpit_pkg = model.Package( name='cockpit', namespace='docker', summary='Server Management GUI', description='Server Management...', status='Approved', review_url='https://bugzilla.redhat.com/450189', upstream_url='http://cockpit.io', monitor=False, ) session.add(cockpit_pkg) fedocal_pkg = model.Package( name='fedocal', namespace='docker', summary='A web-based calendar for Fedora', description='Web calendar ...', status='Approved', review_url='https://bugzilla.redhat.com/915074', upstream_url='http://fedorahosted.org/fedocal', monitor=False, ) session.add(fedocal_pkg) session.commit() devel_collec = model.Collection.by_name(session, 'master') # Add PackageListing # Pkg: cockpit - Collection: devel - Approved pkgltg = model.PackageListing( point_of_contact='puiterwijk', status='Approved', package_id=cockpit_pkg.id, collection_id=devel_collec.id, ) session.add(pkgltg) # Pkg: guake - Collection: devel - Approved pkgltg = model.PackageListing( point_of_contact='pingou', status='Approved', package_id=fedocal_pkg.id, collection_id=devel_collec.id, ) session.add(pkgltg) session.commit() # Add PackageListingAcl cockpit_devel = model.PackageListing.by_pkgid_collectionid( session, cockpit_pkg.id, devel_collec.id) fedocal_devel = model.PackageListing.by_pkgid_collectionid( session, fedocal_pkg.id, devel_collec.id) packager = model.PackageListingAcl( fas_name='pingou', packagelisting_id=cockpit_devel.id, acl='commit', status='Approved', ) session.add(packager) packager = model.PackageListingAcl( fas_name='pingou', packagelisting_id=cockpit_devel.id, acl='watchbugzilla', status='Approved', ) session.add(packager) packager = model.PackageListingAcl( fas_name='pingou', packagelisting_id=fedocal_devel.id, acl='commit', status='Approved', ) session.add(packager) packager = model.PackageListingAcl( fas_name='pingou', packagelisting_id=fedocal_devel.id, acl='watchcommits', status='Approved', ) session.add(packager) packager = model.PackageListingAcl( fas_name='pingou', packagelisting_id=fedocal_devel.id, acl='watchbugzilla', status='Approved', ) session.add(packager) packager = model.PackageListingAcl( fas_name='toshio', packagelisting_id=fedocal_devel.id, acl='commit', status='Awaiting Review', ) session.add(packager) packager = model.PackageListingAcl( fas_name='spot', packagelisting_id=fedocal_devel.id, acl='watchbugzilla', status='Approved', ) session.add(packager) packager = model.PackageListingAcl( fas_name='group::gtk-sig', packagelisting_id=cockpit_devel.id, acl='commit', status='Approved', ) session.add(packager) packager = model.PackageListingAcl( fas_name='group::gtk-sig', packagelisting_id=cockpit_devel.id, acl='watchbugzilla', status='Approved', ) session.add(packager) session.commit()
def test_orphan_group_package(self, bz_owner): """ Test the is_pkgdb_admin function of pkgdb2. """ bz_owner.return_value = None create_collection(self.session) create_package(self.session) guake_pkg = model.Package.by_name(self.session, 'guake') fedocal_pkg = model.Package.by_name(self.session, 'fedocal') f18_collec = model.Collection.by_name(self.session, 'f18') devel_collec = model.Collection.by_name(self.session, 'master') # Pkg: guake - Collection: master - Approved pkgltg = model.PackageListing( point_of_contact='group::infra-sig', status='Approved', package_id=guake_pkg.id, collection_id=devel_collec.id, ) self.session.add(pkgltg) # Pkg: guake - Collection: f18 - Approved pkgltg = model.PackageListing( point_of_contact='pingou', status='Approved', package_id=guake_pkg.id, collection_id=f18_collec.id, ) self.session.add(pkgltg) # Pkg: fedocal - Collection: master - Approved pkgltg = model.PackageListing( point_of_contact='group::infra-sig', status='Approved', package_id=fedocal_pkg.id, collection_id=devel_collec.id, ) self.session.add(pkgltg) user = FakeFasUser() # Orphan allowed (?) msg = pkgdblib.update_pkg_status( self.session, pkg_name='fedocal', pkg_branch='master', status='Orphaned', user=user, poc='orphan') self.assertEqual( msg, 'user: pingou updated package: fedocal status from: Approved to ' 'Orphaned on branch: master') # Retired blocked msg = pkgdblib.update_pkg_status( self.session, pkg_name='guake', pkg_branch='master', status='Retired', user=user, poc='orphan') self.assertEqual( msg, 'user: pingou updated package: guake status from: Approved to ' 'Retired on branch: master')