{"action":"created","comment":{"url":"https://api.github.com/repos/clearlinux/autospec/pulls/comments/349334359","pull_request_review_id":321209809,"id":349334359,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDM0OTMzNDM1OQ==","diff_hunk":"@@ -103,33 +104,27 @@ def check_or_get_file(upstream_url, tarfile, mode=\"w\"):\n \n def build_untar(tarball_path):\n     \"\"\"Determine extract command and tarball prefix from tar -tf output.\"\"\"\n-    tar_prefix = \"\"\n-    try:\n-        tarball_contents = subprocess.check_output(\n-            [\"tar\", \"-tf\", tarball_path], universal_newlines=True).split(\"\\n\")\n-    except subprocess.CalledProcessError as cpe:\n-        file_type = subprocess.check_output([\"file\", tarball_path]).decode(\"utf-8\").strip()\n-        print_fatal(\"tarball inspection failed, unable to determine tarball contents:\\n\"\n-                    \"{}\\n{}\\n\".format(file_type, cpe))\n+    prefix = None\n+    if tarfile.is_tarfile(tarball_path):\n+        with tarfile.open(tarball_path, 'r') as content:\n+            lines = content.getnames()\n+            # When tarball is not empty\n+            if len(lines) > 0:\n+                prefix = os.path.commonpath(lines)","path":"autospec/tarball.py","position":26,"original_position":26,"commit_id":"7011f73ca31d7274c80ce40c1146f02a279b7842","original_commit_id":"7011f73ca31d7274c80ce40c1146f02a279b7842","user":{"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},"body":"So it is a little odd to do but you can definitely make tar create an archive with:\r\n\r\n```\r\n./\r\n./file1\r\n./file2\r\n```\r\n\r\nAs the contents. In this case it would be nice to get the zipfile handling behavior of subdir and that then also handles the case where the archive only contains files without a prefix (like a single file). We'd need to update specfile.py to handle that extraction similarly to zipfile though. Perhaps that's a change that can wait for another PR that tries to consolidate archive file processing (and figures out how to get rid of the subdir variable workaround for zipfile handling).","created_at":"2019-11-21T21:47:45Z","updated_at":"2019-11-21T21:47:45Z","html_url":"https://github.com/clearlinux/autospec/pull/531#discussion_r349334359","pull_request_url":"https://api.github.com/repos/clearlinux/autospec/pulls/531","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/clearlinux/autospec/pulls/comments/349334359"},"html":{"href":"https://github.com/clearlinux/autospec/pull/531#discussion_r349334359"},"pull_request":{"href":"https://api.github.com/repos/clearlinux/autospec/pulls/531"}},"in_reply_to_id":349284577},"pull_request":{"url":"https://api.github.com/repos/clearlinux/autospec/pulls/531","id":343765009,"node_id":"MDExOlB1bGxSZXF1ZXN0MzQzNzY1MDA5","html_url":"https://github.com/clearlinux/autospec/pull/531","diff_url":"https://github.com/clearlinux/autospec/pull/531.diff","patch_url":"https://github.com/clearlinux/autospec/pull/531.patch","issue_url":"https://api.github.com/repos/clearlinux/autospec/issues/531","number":531,"state":"open","locked":false,"title":"Refactoring tarball.build_untar()","user":{"login":"AthenasJimenez","id":32247145,"node_id":"MDQ6VXNlcjMyMjQ3MTQ1","avatar_url":"https://avatars3.githubusercontent.com/u/32247145?v=4","gravatar_id":"","url":"https://api.github.com/users/AthenasJimenez","html_url":"https://github.com/AthenasJimenez","followers_url":"https://api.github.com/users/AthenasJimenez/followers","following_url":"https://api.github.com/users/AthenasJimenez/following{/other_user}","gists_url":"https://api.github.com/users/AthenasJimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/AthenasJimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AthenasJimenez/subscriptions","organizations_url":"https://api.github.com/users/AthenasJimenez/orgs","repos_url":"https://api.github.com/users/AthenasJimenez/repos","events_url":"https://api.github.com/users/AthenasJimenez/events{/privacy}","received_events_url":"https://api.github.com/users/AthenasJimenez/received_events","type":"User","site_admin":false},"body":"- Make use of tarfile library\r\n- Update test for this function adding multipl test cases.\r\n\r\nSigned-off-by: Athenas Jimenez <athenas.jimenez.gonzalez@intel.com>","created_at":"2019-11-20T23:05:20Z","updated_at":"2019-11-21T21:47:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ac87e316a8b649c8435c8f3290f1ac591db6df7a","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/clearlinux/autospec/pulls/531/commits","review_comments_url":"https://api.github.com/repos/clearlinux/autospec/pulls/531/comments","review_comment_url":"https://api.github.com/repos/clearlinux/autospec/pulls/comments{/number}","comments_url":"https://api.github.com/repos/clearlinux/autospec/issues/531/comments","statuses_url":"https://api.github.com/repos/clearlinux/autospec/statuses/7011f73ca31d7274c80ce40c1146f02a279b7842","head":{"label":"AthenasJimenez:refactoring","ref":"refactoring","sha":"7011f73ca31d7274c80ce40c1146f02a279b7842","user":{"login":"AthenasJimenez","id":32247145,"node_id":"MDQ6VXNlcjMyMjQ3MTQ1","avatar_url":"https://avatars3.githubusercontent.com/u/32247145?v=4","gravatar_id":"","url":"https://api.github.com/users/AthenasJimenez","html_url":"https://github.com/AthenasJimenez","followers_url":"https://api.github.com/users/AthenasJimenez/followers","following_url":"https://api.github.com/users/AthenasJimenez/following{/other_user}","gists_url":"https://api.github.com/users/AthenasJimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/AthenasJimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AthenasJimenez/subscriptions","organizations_url":"https://api.github.com/users/AthenasJimenez/orgs","repos_url":"https://api.github.com/users/AthenasJimenez/repos","events_url":"https://api.github.com/users/AthenasJimenez/events{/privacy}","received_events_url":"https://api.github.com/users/AthenasJimenez/received_events","type":"User","site_admin":false},"repo":{"id":190759404,"node_id":"MDEwOlJlcG9zaXRvcnkxOTA3NTk0MDQ=","name":"autospec","full_name":"AthenasJimenez/autospec","private":false,"owner":{"login":"AthenasJimenez","id":32247145,"node_id":"MDQ6VXNlcjMyMjQ3MTQ1","avatar_url":"https://avatars3.githubusercontent.com/u/32247145?v=4","gravatar_id":"","url":"https://api.github.com/users/AthenasJimenez","html_url":"https://github.com/AthenasJimenez","followers_url":"https://api.github.com/users/AthenasJimenez/followers","following_url":"https://api.github.com/users/AthenasJimenez/following{/other_user}","gists_url":"https://api.github.com/users/AthenasJimenez/gists{/gist_id}","starred_url":"https://api.github.com/users/AthenasJimenez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AthenasJimenez/subscriptions","organizations_url":"https://api.github.com/users/AthenasJimenez/orgs","repos_url":"https://api.github.com/users/AthenasJimenez/repos","events_url":"https://api.github.com/users/AthenasJimenez/events{/privacy}","received_events_url":"https://api.github.com/users/AthenasJimenez/received_events","type":"User","site_admin":false},"html_url":"https://github.com/AthenasJimenez/autospec","description":"RPM packaging automation tool","fork":true,"url":"https://api.github.com/repos/AthenasJimenez/autospec","forks_url":"https://api.github.com/repos/AthenasJimenez/autospec/forks","keys_url":"https://api.github.com/repos/AthenasJimenez/autospec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AthenasJimenez/autospec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AthenasJimenez/autospec/teams","hooks_url":"https://api.github.com/repos/AthenasJimenez/autospec/hooks","issue_events_url":"https://api.github.com/repos/AthenasJimenez/autospec/issues/events{/number}","events_url":"https://api.github.com/repos/AthenasJimenez/autospec/events","assignees_url":"https://api.github.com/repos/AthenasJimenez/autospec/assignees{/user}","branches_url":"https://api.github.com/repos/AthenasJimenez/autospec/branches{/branch}","tags_url":"https://api.github.com/repos/AthenasJimenez/autospec/tags","blobs_url":"https://api.github.com/repos/AthenasJimenez/autospec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AthenasJimenez/autospec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AthenasJimenez/autospec/git/refs{/sha}","trees_url":"https://api.github.com/repos/AthenasJimenez/autospec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AthenasJimenez/autospec/statuses/{sha}","languages_url":"https://api.github.com/repos/AthenasJimenez/autospec/languages","stargazers_url":"https://api.github.com/repos/AthenasJimenez/autospec/stargazers","contributors_url":"https://api.github.com/repos/AthenasJimenez/autospec/contributors","subscribers_url":"https://api.github.com/repos/AthenasJimenez/autospec/subscribers","subscription_url":"https://api.github.com/repos/AthenasJimenez/autospec/subscription","commits_url":"https://api.github.com/repos/AthenasJimenez/autospec/commits{/sha}","git_commits_url":"https://api.github.com/repos/AthenasJimenez/autospec/git/commits{/sha}","comments_url":"https://api.github.com/repos/AthenasJimenez/autospec/comments{/number}","issue_comment_url":"https://api.github.com/repos/AthenasJimenez/autospec/issues/comments{/number}","contents_url":"https://api.github.com/repos/AthenasJimenez/autospec/contents/{+path}","compare_url":"https://api.github.com/repos/AthenasJimenez/autospec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AthenasJimenez/autospec/merges","archive_url":"https://api.github.com/repos/AthenasJimenez/autospec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AthenasJimenez/autospec/downloads","issues_url":"https://api.github.com/repos/AthenasJimenez/autospec/issues{/number}","pulls_url":"https://api.github.com/repos/AthenasJimenez/autospec/pulls{/number}","milestones_url":"https://api.github.com/repos/AthenasJimenez/autospec/milestones{/number}","notifications_url":"https://api.github.com/repos/AthenasJimenez/autospec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AthenasJimenez/autospec/labels{/name}","releases_url":"https://api.github.com/repos/AthenasJimenez/autospec/releases{/id}","deployments_url":"https://api.github.com/repos/AthenasJimenez/autospec/deployments","created_at":"2019-06-07T14:41:49Z","updated_at":"2019-06-24T16:01:16Z","pushed_at":"2019-11-20T23:04:30Z","git_url":"git://github.com/AthenasJimenez/autospec.git","ssh_url":"git@github.com:AthenasJimenez/autospec.git","clone_url":"https://github.com/AthenasJimenez/autospec.git","svn_url":"https://github.com/AthenasJimenez/autospec","homepage":"","size":19020,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"clearlinux:master","ref":"master","sha":"e12a7149e84a715a312c1c886d44e637361bdff4","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":45694952,"node_id":"MDEwOlJlcG9zaXRvcnk0NTY5NDk1Mg==","name":"autospec","full_name":"clearlinux/autospec","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/autospec","description":"RPM packaging automation tool","fork":false,"url":"https://api.github.com/repos/clearlinux/autospec","forks_url":"https://api.github.com/repos/clearlinux/autospec/forks","keys_url":"https://api.github.com/repos/clearlinux/autospec/keys{/key_id}","collaborators_url":"https://api.github.com/repos/clearlinux/autospec/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/clearlinux/autospec/teams","hooks_url":"https://api.github.com/repos/clearlinux/autospec/hooks","issue_events_url":"https://api.github.com/repos/clearlinux/autospec/issues/events{/number}","events_url":"https://api.github.com/repos/clearlinux/autospec/events","assignees_url":"https://api.github.com/repos/clearlinux/autospec/assignees{/user}","branches_url":"https://api.github.com/repos/clearlinux/autospec/branches{/branch}","tags_url":"https://api.github.com/repos/clearlinux/autospec/tags","blobs_url":"https://api.github.com/repos/clearlinux/autospec/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/clearlinux/autospec/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/clearlinux/autospec/git/refs{/sha}","trees_url":"https://api.github.com/repos/clearlinux/autospec/git/trees{/sha}","statuses_url":"https://api.github.com/repos/clearlinux/autospec/statuses/{sha}","languages_url":"https://api.github.com/repos/clearlinux/autospec/languages","stargazers_url":"https://api.github.com/repos/clearlinux/autospec/stargazers","contributors_url":"https://api.github.com/repos/clearlinux/autospec/contributors","subscribers_url":"https://api.github.com/repos/clearlinux/autospec/subscribers","subscription_url":"https://api.github.com/repos/clearlinux/autospec/subscription","commits_url":"https://api.github.com/repos/clearlinux/autospec/commits{/sha}","git_commits_url":"https://api.github.com/repos/clearlinux/autospec/git/commits{/sha}","comments_url":"https://api.github.com/repos/clearlinux/autospec/comments{/number}","issue_comment_url":"https://api.github.com/repos/clearlinux/autospec/issues/comments{/number}","contents_url":"https://api.github.com/repos/clearlinux/autospec/contents/{+path}","compare_url":"https://api.github.com/repos/clearlinux/autospec/compare/{base}...{head}","merges_url":"https://api.github.com/repos/clearlinux/autospec/merges","archive_url":"https://api.github.com/repos/clearlinux/autospec/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/clearlinux/autospec/downloads","issues_url":"https://api.github.com/repos/clearlinux/autospec/issues{/number}","pulls_url":"https://api.github.com/repos/clearlinux/autospec/pulls{/number}","milestones_url":"https://api.github.com/repos/clearlinux/autospec/milestones{/number}","notifications_url":"https://api.github.com/repos/clearlinux/autospec/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/clearlinux/autospec/labels{/name}","releases_url":"https://api.github.com/repos/clearlinux/autospec/releases{/id}","deployments_url":"https://api.github.com/repos/clearlinux/autospec/deployments","created_at":"2015-11-06T16:58:26Z","updated_at":"2019-11-20T19:21:33Z","pushed_at":"2019-11-20T23:05:20Z","git_url":"git://github.com/clearlinux/autospec.git","ssh_url":"git@github.com:clearlinux/autospec.git","clone_url":"https://github.com/clearlinux/autospec.git","svn_url":"https://github.com/clearlinux/autospec","homepage":"","size":19018,"stargazers_count":65,"watchers_count":65,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":46,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":48,"license":{"key":"gpl-3.0","name":"GNU General Public License v3.0","spdx_id":"GPL-3.0","url":"https://api.github.com/licenses/gpl-3.0","node_id":"MDc6TGljZW5zZTk="},"forks":46,"open_issues":48,"watchers":65,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/clearlinux/autospec/pulls/531"},"html":{"href":"https://github.com/clearlinux/autospec/pull/531"},"issue":{"href":"https://api.github.com/repos/clearlinux/autospec/issues/531"},"comments":{"href":"https://api.github.com/repos/clearlinux/autospec/issues/531/comments"},"review_comments":{"href":"https://api.github.com/repos/clearlinux/autospec/pulls/531/comments"},"review_comment":{"href":"https://api.github.com/repos/clearlinux/autospec/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/clearlinux/autospec/pulls/531/commits"},"statuses":{"href":"https://api.github.com/repos/clearlinux/autospec/statuses/7011f73ca31d7274c80ce40c1146f02a279b7842"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"bryteise"}}