From 620464bba4a4881b821f3c74a442de5ba248bc2a Mon Sep 17 00:00:00 2001 From: Eclipse Webmaster Date: Tue, 27 Mar 2018 11:32:40 -0400 Subject: [PATCH] Fixes to make the org selection more flexable, and update team names based on the org root Signed-off-by: Eclipse Webmaster --- bin/github_get_issues.php | 6 +++--- bin/github_install_hooks.php | 6 +++--- bin/github_verify_committers.php | 16 +++++++++------- lib/organization/eclipse.php | 10 +++++++++- lib/organization/github.php | 6 +++--- 5 files changed, 27 insertions(+), 17 deletions(-) diff --git a/bin/github_get_issues.php b/bin/github_get_issues.php index 2a71c79..0265f94 100644 --- a/bin/github_get_issues.php +++ b/bin/github_get_issues.php @@ -60,9 +60,9 @@ foreach( $org_github->getOrgs() as $org ) { echo "Working with $org \n"; - #try and limit this to 'eclipse' based projects, remove this to start working with locationtech etc. - if ( preg_match('/eclipse/',$org) !== 1 ){ - echo "Not eclipse, skipping issues processing\n"; + #only work with selected orgs based on the config file + if ( preg_match(GITHUB_ORG_REGEX,$github_organization) !== 1 ){ + echo "Not a selected org, skipping \n"; continue; } diff --git a/bin/github_install_hooks.php b/bin/github_install_hooks.php index e4d11a2..3d265b7 100644 --- a/bin/github_install_hooks.php +++ b/bin/github_install_hooks.php @@ -59,9 +59,9 @@ foreach( $org_github->getOrgs() as $org ) { echo "Working with $org \n"; - #only work with Eclipse orgs. Remove this to work with locationtech etc. - if ( preg_match('/eclipse/',$org) !== 1 ){ - echo "Not an Eclipse org, skipping \n"; + #only work with selected orgs based on the config file + if ( preg_match(GITHUB_ORG_REGEX,$github_organization) !== 1 ){ + echo "Not a selected org, skipping \n"; continue; } diff --git a/bin/github_verify_committers.php b/bin/github_verify_committers.php index 648693c..9662cdd 100644 --- a/bin/github_verify_committers.php +++ b/bin/github_verify_committers.php @@ -83,9 +83,9 @@ #load github org from team $github_organization = $org_forge_team->getOrgName(); echo "GitHub Org: " . $github_organization . "\n"; - #only work with Eclipse orgs, remove this to start handling locationtech etc. - if ( preg_match('/eclipse/',$github_organization) !== 1 ){ - echo "Not an Eclipse org, skipping \n"; + #only work with selected orgs based on the config file. + if ( preg_match(GITHUB_ORG_REGEX,$github_organization) !== 1 ){ + echo "Not a selected org, skipping \n"; continue; } @@ -120,10 +120,12 @@ $githubResult = $org_github_team->getCommitterList(); $eclipseResult = $org_forge_team->getCommitterList(); - //echo "Github members: \n"; - //print_r($githubResult); - //echo "Eclipse members: \n"; - //print_r($eclipseResult); +# if ( preg_match(GITHUB_ORG_REGEX,$github_organization) == 1 ) { +# echo "Github members: \n"; +# print_r($githubResult); +# echo "Eclipse members: \n"; +# print_r($eclipseResult); +# } echo "\n[Info] checking $repoName...\n"; $toBeRemoved = compare($githubResult, $eclipseResult); diff --git a/lib/organization/eclipse.php b/lib/organization/eclipse.php index d2dcce3..b4e09d8 100644 --- a/lib/organization/eclipse.php +++ b/lib/organization/eclipse.php @@ -55,6 +55,14 @@ function __construct($debug) { if ( $teamOrg === '' && $teamRepoOrg[0] !== '' ) { if($this->debug) echo "Setting org name to: $teamOrg($teamRepoOrg[0]) \n"; $team->setOrgName($teamRepoOrg[0]); + #teamnames are important and need to be updated based on the org name in order for follow on processing to find them + #for 'sub' orgs(eclipse-ee4j) they should simply use the 'parent' org name for the first half of the team name + $orgNameParts= explode("-",$teamRepoOrg[0]); + if ( preg_match("/$orgNameParts[0]/",$teamName) !==1 ){ + $teamName =preg_replace('/(.*)-(.*)/',"$orgNameParts[0]-$2",$teamName); + if($this->debug) echo "TeamName<>OrgName mismatch. Setting teamname to: $teamName \n"; + $team->setTeamName($teamName); + } } else if ( strcmp($teamRepoOrg[0],$teamOrg) !== 0 ) { #this repo is in another org, which should be a no-no within a single project. echo "[Error] $teamName has a repo in another org (got: $teamRepoOrg expected: $teamOrg.\n"; @@ -64,7 +72,7 @@ function __construct($debug) { } foreach($repoUserObj->users as $user) { $team->addCommitter($user); - echo "Adding $user to $teamName \n"; + if($this->debug) echo "Adding $user to $teamName \n"; } } else { diff --git a/lib/organization/github.php b/lib/organization/github.php index 34e19bb..df2075b 100644 --- a/lib/organization/github.php +++ b/lib/organization/github.php @@ -55,9 +55,9 @@ function __construct($debug) { array_push($this->GHOrgs,$github_organization); if($this->debug) echo "In Github org loop, adding: $github_organization\n"; - #limit the github org to eclipse. remove these to work with locationtech etc. - if ( preg_match("/eclipse/",$github_organization) !== 1) { - if($this->debug) echo "Not an Eclipse org, bypassing \n"; + #limit the selected orgs to those from the config file. + if ( preg_match(GITHUB_ORG_REGEX,$github_organization) !== 1) { + if($this->debug) echo "Not a selected org, bypassing \n"; continue; } $this->debug = true;