{"action":"created","comment":{"url":"https://api.github.com/repos/clearlinux/diva/pulls/comments/232005382","pull_request_review_id":173101361,"id":232005382,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMjAwNTM4Mg==","diff_hunk":"@@ -0,0 +1,122 @@\n+// Copyright © 2018 Intel Corporation\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+//     http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package cmd\n+\n+import (\n+\t\"fmt\"\n+\t\"os\"\n+\n+\t\"github.com/clearlinux/diva/diva\"\n+\t\"github.com/clearlinux/diva/internal/config\"\n+\t\"github.com/clearlinux/diva/internal/helpers\"\n+\t\"github.com/clearlinux/diva/pkginfo\"\n+\n+\t\"github.com/spf13/cobra\"\n+)\n+\n+type rpmConflictCmdFlags struct {\n+\tmixName string\n+\tversion string\n+\tlatest  bool\n+}\n+\n+var conflictFlags rpmConflictCmdFlags\n+\n+func init() {\n+\tcheckCmd.AddCommand(rpmFileConflictsCmd)\n+\trpmFileConflictsCmd.Flags().StringVarP(&conflictFlags.mixName, \"name\", \"n\", \"clear\", \"name of data group\")\n+\trpmFileConflictsCmd.Flags().StringVarP(&conflictFlags.version, \"version\", \"v\", \"0\", \"version to check\")\n+\trpmFileConflictsCmd.Flags().BoolVar(&conflictFlags.latest, \"latest\", false, \"get the latest version from upstreamURL\")\n+}\n+\n+var rpmFileConflictsCmd = &cobra.Command{\n+\tUse:   \"conflicts\",\n+\tShort: \"check file conflicts for bundle tag\",\n+\tLong: `check all packages within bundle tag to see if any two rpms have the\n+same filename, yet come from different SRPMs`,\n+\tRun: runCheckFileConflicts,\n+}\n+\n+func runCheckFileConflicts(cmd *cobra.Command, args []string) {\n+\tu := config.UInfo{\n+\t\tMixName: conflictFlags.mixName,\n+\t\tVer:     conflictFlags.version,\n+\t\tLatest:  conflictFlags.latest,\n+\t}\n+\n+\trepo, err := pkginfo.NewRepo(conf, &u)\n+\thelpers.FailIfErr(err)\n+\n+\tbundleInfo, err := pkginfo.NewBundleInfo(conf, &u)\n+\thelpers.FailIfErr(err)\n+\n+\thelpers.PrintBegin(\"Populating Bundle content information\")\n+\terr = pkginfo.PopulateBundles(&bundleInfo, \"\")\n+\thelpers.FailIfErr(err)\n+\thelpers.PrintComplete(\"Bundle content populated successfully\")\n+\n+\tresults, err := CheckFileConflicts(&repo, &bundleInfo)\n+\thelpers.FailIfErr(err)\n+\n+\tif results.Failed > 0 {\n+\t\tos.Exit(1)\n+\t}\n+}\n+\n+// CheckFileConflicts checks that no files conflict between packages\n+func CheckFileConflicts(repo *pkginfo.Repo, bundleInfo *pkginfo.BundleInfo) (*diva.Results, error) {\n+\tr := diva.NewSuite(\"file conflicts\", \"check file conflicts of RPMs\")\n+\n+\tbundleRPMs, err := bundleInfo.BundleDefinitions.GetAllPackages(\"\")\n+\tif err != nil {\n+\t\treturn r, err\n+\t}\n+\n+\tallFiles := make(map[string][]*pkginfo.RPM)\n+\tconflicts := []string{}\n+\tfor pkg := range bundleRPMs {\n+\n+\t\trpm, err := pkginfo.GetRPM(repo, pkg)\n+\t\tif err != nil {\n+\t\t\treturn r, err\n+\t\t}\n+\t\tfor i := range rpm.Files {\n+\t\t\tfname := rpm.Files[i].Name\n+\t\t\t// if the \"file\" doesn't have a hash or a symlink, it is a directory,\n+\t\t\t// so ignore it\n+\t\t\tif rpm.Files[i].Hash == \"\" && rpm.Files[i].SymlinkTarget == \"\" {\n+\t\t\t\tcontinue\n+\t\t\t}\n+\t\t\tif _, ok := allFiles[fname]; ok {","path":"cmd/file_conflicts.go","position":102,"original_position":102,"commit_id":"cf8b3f55d7c979d97bdce34e81994ae6759c9eed","original_commit_id":"cf8b3f55d7c979d97bdce34e81994ae6759c9eed","user":{"login":"matthewrsj","id":12090084,"node_id":"MDQ6VXNlcjEyMDkwMDg0","avatar_url":"https://avatars0.githubusercontent.com/u/12090084?v=4","gravatar_id":"","url":"https://api.github.com/users/matthewrsj","html_url":"https://github.com/matthewrsj","followers_url":"https://api.github.com/users/matthewrsj/followers","following_url":"https://api.github.com/users/matthewrsj/following{/other_user}","gists_url":"https://api.github.com/users/matthewrsj/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewrsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewrsj/subscriptions","organizations_url":"https://api.github.com/users/matthewrsj/orgs","repos_url":"https://api.github.com/users/matthewrsj/repos","events_url":"https://api.github.com/users/matthewrsj/events{/privacy}","received_events_url":"https://api.github.com/users/matthewrsj/received_events","type":"User","site_admin":false},"body":"Hmm, you are right about that. I guess this method is fine, it is just O(nm^2) at this point, where n is number of packages and m is number of files, so pretty inefficient. I'll think about it some more but this method is fine for now.\r\n\r\nHow long does this check take to run against an entire repo?","created_at":"2018-11-08T18:13:22Z","updated_at":"2018-11-08T18:13:22Z","html_url":"https://github.com/clearlinux/diva/pull/112#discussion_r232005382","pull_request_url":"https://api.github.com/repos/clearlinux/diva/pulls/112","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/clearlinux/diva/pulls/comments/232005382"},"html":{"href":"https://github.com/clearlinux/diva/pull/112#discussion_r232005382"},"pull_request":{"href":"https://api.github.com/repos/clearlinux/diva/pulls/112"}},"in_reply_to_id":231755444},"pull_request":{"url":"https://api.github.com/repos/clearlinux/diva/pulls/112","id":229167658,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI5MTY3NjU4","html_url":"https://github.com/clearlinux/diva/pull/112","diff_url":"https://github.com/clearlinux/diva/pull/112.diff","patch_url":"https://github.com/clearlinux/diva/pull/112.patch","issue_url":"https://api.github.com/repos/clearlinux/diva/issues/112","number":112,"state":"open","locked":false,"title":"Add file conflict check","user":{"login":"Gabib32","id":8284020,"node_id":"MDQ6VXNlcjgyODQwMjA=","avatar_url":"https://avatars2.githubusercontent.com/u/8284020?v=4","gravatar_id":"","url":"https://api.github.com/users/Gabib32","html_url":"https://github.com/Gabib32","followers_url":"https://api.github.com/users/Gabib32/followers","following_url":"https://api.github.com/users/Gabib32/following{/other_user}","gists_url":"https://api.github.com/users/Gabib32/gists{/gist_id}","starred_url":"https://api.github.com/users/Gabib32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gabib32/subscriptions","organizations_url":"https://api.github.com/users/Gabib32/orgs","repos_url":"https://api.github.com/users/Gabib32/repos","events_url":"https://api.github.com/users/Gabib32/events{/privacy}","received_events_url":"https://api.github.com/users/Gabib32/received_events","type":"User","site_admin":false},"body":"Add a check that iterates all of the package rpms from a\r\nbundle tag, and checks that no two rpms from different\r\nSRPMs use the same filename.\r\n\r\nSigned-off-by: gabrielle beyer <gabrielle.n.beyer@intel.com>","created_at":"2018-11-07T21:04:08Z","updated_at":"2018-11-08T18:13:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e178078ca341dcd02393e1d5a536d8a235830a1b","assignee":null,"assignees":[],"requested_reviewers":[{"login":"bryteise","id":15709,"node_id":"MDQ6VXNlcjE1NzA5","avatar_url":"https://avatars2.githubusercontent.com/u/15709?v=4","gravatar_id":"","url":"https://api.github.com/users/bryteise","html_url":"https://github.com/bryteise","followers_url":"https://api.github.com/users/bryteise/followers","following_url":"https://api.github.com/users/bryteise/following{/other_user}","gists_url":"https://api.github.com/users/bryteise/gists{/gist_id}","starred_url":"https://api.github.com/users/bryteise/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bryteise/subscriptions","organizations_url":"https://api.github.com/users/bryteise/orgs","repos_url":"https://api.github.com/users/bryteise/repos","events_url":"https://api.github.com/users/bryteise/events{/privacy}","received_events_url":"https://api.github.com/users/bryteise/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/clearlinux/diva/pulls/112/commits","review_comments_url":"https://api.github.com/repos/clearlinux/diva/pulls/112/comments","review_comment_url":"https://api.github.com/repos/clearlinux/diva/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clearlinux/diva/issues/112/comments","statuses_url":"https://api.github.com/repos/clearlinux/diva/statuses/cf8b3f55d7c979d97bdce34e81994ae6759c9eed","head":{"label":"Gabib32:conflicts","ref":"conflicts","sha":"cf8b3f55d7c979d97bdce34e81994ae6759c9eed","user":{"login":"Gabib32","id":8284020,"node_id":"MDQ6VXNlcjgyODQwMjA=","avatar_url":"https://avatars2.githubusercontent.com/u/8284020?v=4","gravatar_id":"","url":"https://api.github.com/users/Gabib32","html_url":"https://github.com/Gabib32","followers_url":"https://api.github.com/users/Gabib32/followers","following_url":"https://api.github.com/users/Gabib32/following{/other_user}","gists_url":"https://api.github.com/users/Gabib32/gists{/gist_id}","starred_url":"https://api.github.com/users/Gabib32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gabib32/subscriptions","organizations_url":"https://api.github.com/users/Gabib32/orgs","repos_url":"https://api.github.com/users/Gabib32/repos","events_url":"https://api.github.com/users/Gabib32/events{/privacy}","received_events_url":"https://api.github.com/users/Gabib32/received_events","type":"User","site_admin":false},"repo":{"id":138335271,"node_id":"MDEwOlJlcG9zaXRvcnkxMzgzMzUyNzE=","name":"diva","full_name":"Gabib32/diva","private":false,"owner":{"login":"Gabib32","id":8284020,"node_id":"MDQ6VXNlcjgyODQwMjA=","avatar_url":"https://avatars2.githubusercontent.com/u/8284020?v=4","gravatar_id":"","url":"https://api.github.com/users/Gabib32","html_url":"https://github.com/Gabib32","followers_url":"https://api.github.com/users/Gabib32/followers","following_url":"https://api.github.com/users/Gabib32/following{/other_user}","gists_url":"https://api.github.com/users/Gabib32/gists{/gist_id}","starred_url":"https://api.github.com/users/Gabib32/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gabib32/subscriptions","organizations_url":"https://api.github.com/users/Gabib32/orgs","repos_url":"https://api.github.com/users/Gabib32/repos","events_url":"https://api.github.com/users/Gabib32/events{/privacy}","received_events_url":"https://api.github.com/users/Gabib32/received_events","type":"User","site_admin":false},"html_url":"https://github.com/Gabib32/diva","description":null,"fork":true,"url":"https://api.github.com/repos/Gabib32/diva","forks_url":"https://api.github.com/repos/Gabib32/diva/forks","keys_url":"https://api.github.com/repos/Gabib32/diva/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Gabib32/diva/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Gabib32/diva/teams","hooks_url":"https://api.github.com/repos/Gabib32/diva/hooks","issue_events_url":"https://api.github.com/repos/Gabib32/diva/issues/events{/number}","events_url":"https://api.github.com/repos/Gabib32/diva/events","assignees_url":"https://api.github.com/repos/Gabib32/diva/assignees{/user}","branches_url":"https://api.github.com/repos/Gabib32/diva/branches{/branch}","tags_url":"https://api.github.com/repos/Gabib32/diva/tags","blobs_url":"https://api.github.com/repos/Gabib32/diva/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Gabib32/diva/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Gabib32/diva/git/refs{/sha}","trees_url":"https://api.github.com/repos/Gabib32/diva/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Gabib32/diva/statuses/{sha}","languages_url":"https://api.github.com/repos/Gabib32/diva/languages","stargazers_url":"https://api.github.com/repos/Gabib32/diva/stargazers","contributors_url":"https://api.github.com/repos/Gabib32/diva/contributors","subscribers_url":"https://api.github.com/repos/Gabib32/diva/subscribers","subscription_url":"https://api.github.com/repos/Gabib32/diva/subscription","commits_url":"https://api.github.com/repos/Gabib32/diva/commits{/sha}","git_commits_url":"https://api.github.com/repos/Gabib32/diva/git/commits{/sha}","comments_url":"https://api.github.com/repos/Gabib32/diva/comments{/number}","issue_comment_url":"https://api.github.com/repos/Gabib32/diva/issues/comments{/number}","contents_url":"https://api.github.com/repos/Gabib32/diva/contents/{+path}","compare_url":"https://api.github.com/repos/Gabib32/diva/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Gabib32/diva/merges","archive_url":"https://api.github.com/repos/Gabib32/diva/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Gabib32/diva/downloads","issues_url":"https://api.github.com/repos/Gabib32/diva/issues{/number}","pulls_url":"https://api.github.com/repos/Gabib32/diva/pulls{/number}","milestones_url":"https://api.github.com/repos/Gabib32/diva/milestones{/number}","notifications_url":"https://api.github.com/repos/Gabib32/diva/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Gabib32/diva/labels{/name}","releases_url":"https://api.github.com/repos/Gabib32/diva/releases{/id}","deployments_url":"https://api.github.com/repos/Gabib32/diva/deployments","created_at":"2018-06-22T18:24:50Z","updated_at":"2018-10-31T17:30:59Z","pushed_at":"2018-11-08T17:24:25Z","git_url":"git://github.com/Gabib32/diva.git","ssh_url":"git@github.com:Gabib32/diva.git","clone_url":"https://github.com/Gabib32/diva.git","svn_url":"https://github.com/Gabib32/diva","homepage":null,"size":259,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"clearlinux:master","ref":"master","sha":"b8daf160356221b894a6c0ab880b38f9adebf81d","user":{"login":"clearlinux","id":12545216,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNTQ1MjE2","avatar_url":"https://avatars2.githubusercontent.com/u/12545216?v=4","gravatar_id":"","url":"https://api.github.com/users/clearlinux","html_url":"https://github.com/clearlinux","followers_url":"https://api.github.com/users/clearlinux/followers","following_url":"https://api.github.com/users/clearlinux/following{/other_user}","gists_url":"https://api.github.com/users/clearlinux/gists{/gist_id}","starred_url":"https://api.github.com/users/clearlinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clearlinux/subscriptions","organizations_url":"https://api.github.com/users/clearlinux/orgs","repos_url":"https://api.github.com/users/clearlinux/repos","events_url":"https://api.github.com/users/clearlinux/events{/privacy}","received_events_url":"https://api.github.com/users/clearlinux/received_events","type":"Organization","site_admin":false},"repo":{"id":133871444,"node_id":"MDEwOlJlcG9zaXRvcnkxMzM4NzE0NDQ=","name":"diva","full_name":"clearlinux/diva","private":false,"owner":{"login":"clearlinux","id":12545216,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyNTQ1MjE2","avatar_url":"https://avatars2.githubusercontent.com/u/12545216?v=4","gravatar_id":"","url":"https://api.github.com/users/clearlinux","html_url":"https://github.com/clearlinux","followers_url":"https://api.github.com/users/clearlinux/followers","following_url":"https://api.github.com/users/clearlinux/following{/other_user}","gists_url":"https://api.github.com/users/clearlinux/gists{/gist_id}","starred_url":"https://api.github.com/users/clearlinux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clearlinux/subscriptions","organizations_url":"https://api.github.com/users/clearlinux/orgs","repos_url":"https://api.github.com/users/clearlinux/repos","events_url":"https://api.github.com/users/clearlinux/events{/privacy}","received_events_url":"https://api.github.com/users/clearlinux/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/clearlinux/diva","description":null,"fork":false,"url":"https://api.github.com/repos/clearlinux/diva","forks_url":"https://api.github.com/repos/clearlinux/diva/forks","keys_url":"https://api.github.com/repos/clearlinux/diva/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clearlinux/diva/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clearlinux/diva/teams","hooks_url":"https://api.github.com/repos/clearlinux/diva/hooks","issue_events_url":"https://api.github.com/repos/clearlinux/diva/issues/events{/number}","events_url":"https://api.github.com/repos/clearlinux/diva/events","assignees_url":"https://api.github.com/repos/clearlinux/diva/assignees{/user}","branches_url":"https://api.github.com/repos/clearlinux/diva/branches{/branch}","tags_url":"https://api.github.com/repos/clearlinux/diva/tags","blobs_url":"https://api.github.com/repos/clearlinux/diva/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clearlinux/diva/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clearlinux/diva/git/refs{/sha}","trees_url":"https://api.github.com/repos/clearlinux/diva/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clearlinux/diva/statuses/{sha}","languages_url":"https://api.github.com/repos/clearlinux/diva/languages","stargazers_url":"https://api.github.com/repos/clearlinux/diva/stargazers","contributors_url":"https://api.github.com/repos/clearlinux/diva/contributors","subscribers_url":"https://api.github.com/repos/clearlinux/diva/subscribers","subscription_url":"https://api.github.com/repos/clearlinux/diva/subscription","commits_url":"https://api.github.com/repos/clearlinux/diva/commits{/sha}","git_commits_url":"https://api.github.com/repos/clearlinux/diva/git/commits{/sha}","comments_url":"https://api.github.com/repos/clearlinux/diva/comments{/number}","issue_comment_url":"https://api.github.com/repos/clearlinux/diva/issues/comments{/number}","contents_url":"https://api.github.com/repos/clearlinux/diva/contents/{+path}","compare_url":"https://api.github.com/repos/clearlinux/diva/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clearlinux/diva/merges","archive_url":"https://api.github.com/repos/clearlinux/diva/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clearlinux/diva/downloads","issues_url":"https://api.github.com/repos/clearlinux/diva/issues{/number}","pulls_url":"https://api.github.com/repos/clearlinux/diva/pulls{/number}","milestones_url":"https://api.github.com/repos/clearlinux/diva/milestones{/number}","notifications_url":"https://api.github.com/repos/clearlinux/diva/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clearlinux/diva/labels{/name}","releases_url":"https://api.github.com/repos/clearlinux/diva/releases{/id}","deployments_url":"https://api.github.com/repos/clearlinux/diva/deployments","created_at":"2018-05-17T21:42:55Z","updated_at":"2018-10-26T19:15:06Z","pushed_at":"2018-11-08T17:24:26Z","git_url":"git://github.com/clearlinux/diva.git","ssh_url":"git@github.com:clearlinux/diva.git","clone_url":"https://github.com/clearlinux/diva.git","svn_url":"https://github.com/clearlinux/diva","homepage":null,"size":196,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":25,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0","node_id":"MDc6TGljZW5zZTI="},"forks":5,"open_issues":25,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clearlinux/diva/pulls/112"},"html":{"href":"https://github.com/clearlinux/diva/pull/112"},"issue":{"href":"https://api.github.com/repos/clearlinux/diva/issues/112"},"comments":{"href":"https://api.github.com/repos/clearlinux/diva/issues/112/comments"},"review_comments":{"href":"https://api.github.com/repos/clearlinux/diva/pulls/112/comments"},"review_comment":{"href":"https://api.github.com/repos/clearlinux/diva/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clearlinux/diva/pulls/112/commits"},"statuses":{"href":"https://api.github.com/repos/clearlinux/diva/statuses/cf8b3f55d7c979d97bdce34e81994ae6759c9eed"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"matthewrsj"}}