def check_available_components(self): from panel.utils import get_page page = get_page(self.get_mvn_metadata_url(), self.configuration.id) soup = BeautifulSoup(page) versions = soup.findAll('version') for version in versions: new_comp, created = Component.objects.get_or_create(name=self.name, artifactId=self.artifactId, version=version.string, groupId=self.groupId, configuration=self.configuration) new_comp.tagbase=self.tagbase new_comp.save() return ''
def package_available_versions_inner(request, project_id=1): """ Checks available project versions """ project = Project.objects.get(id=int(project_id)) page = get_page(project.get_mvn_metadata_url(), project.configuration.id) soup = BeautifulSoup(page) versions = soup.findAll('version') artifactId = soup.find('artifactid') groupId = soup.find('groupid') if not project.artifactId or not project.groupId: project.artifactId = artifactId.string if artifactId else '' project.groupId = groupId.string if groupId else '' project.save() for version in versions: package, created = Package.objects.get_or_create(version=version.string, project=project) package.get_tag_base()
def check_package_inner(request, project_id=1, package_id=1): """ Check package dependencies """ project_id = int(project_id) package_id = int(package_id) project = Project.objects.get(id=project_id) package = Package.objects.get(id=package_id) configuration = project.configuration filtr = project.configuration.filter url = package.get_mvn_pom_url() local("rm -rf tempdir") local("mkdir tempdir") page = get_page(package.get_mvn_pom_url(), project.configuration.id) f = open('tempdir/pom.xml','w') f.write(page) f.close() out = local("cd tempdir && mvn help:effective-pom") soup = BeautifulSoup(out) dep = soup.findAll('dependency') for d in dep: if filtr in d.find('groupid').string: groupid = str(d.find('groupid').string) artifactid = str(d.find('artifactid').string) version = str(d.find('version').string) component, created = Component.objects.get_or_create(name=artifactid, artifactId=artifactid, configuration=configuration, groupId=groupid, version=version) component.get_tag_base() component.package.add(package) component.save() t = threading.Thread(target=component.get_release_note) t.setDaemon(True) t.start() #t1 = threading.Thread(target=component.check_available_components) #t1.setDaemon(True) #t1.start() #ToDo: wyniesc to do ajaxa component.check_available_components() return