{"action":"created","comment":{"url":"https://api.github.com/repos/gentoo/portage/pulls/comments/72882442","id":72882442,"diff_hunk":"@@ -0,0 +1,276 @@\n+\n+from __future__ import unicode_literals\n+\n+import argparse\n+import errno\n+import io\n+import logging\n+import re\n+import stat\n+import subprocess\n+import sys\n+import warnings\n+\n+import portage\n+portage.proxy.lazyimport.lazyimport(globals(),\n+        'portage.checksum:hashfunc_map,perform_multiple_checksums,' + \\\n+                'verify_all,_apply_hash_filter,_filter_unaccelarated_hashes',\n+        'portage.repository.config:_find_invalid_path_char',\n+        'portage.util:write_atomic,writemsg_level',\n+)\n+\n+from gkeys.gkeysinterface import GkeysInterface\n+from gkeys.config import GKeysConfig\n+from pyGPG.gpg import GPG\n+from gkeys.lib import GkeysGPG\n+\n+from portage import manifest\n+from portage import os\n+from portage import _encodings\n+from portage import _unicode_decode\n+from portage import _unicode_encode\n+from portage.manifest import guessManifestFileType\n+from portage.exception import DigestException, FileNotFound, \\\n+        InvalidDataType, MissingParameter, PermissionDenied, \\\n+        PortageException, PortagePackageException\n+from portage.const import (MANIFEST1_HASH_FUNCTIONS, MANIFEST2_HASH_DEFAULTS,\n+        MANIFEST2_HASH_FUNCTIONS, MANIFEST2_IDENTIFIERS, MANIFEST2_REQUIRED_HASH)\n+from portage.localization import _\n+\n+if sys.hexversion >= 0x3000000:\n+\t# pylint: disable=W0622\n+\t_unicode = str\n+\tbasestring = str\n+else:\n+\t_unicode = unicode\n+\n+\n+class MetaManifest(manifest.Manifest):\n+\t'''Subclass of the Manifest class for Manifest files outside the packages'''\n+\n+\tdef sign(self):\n+\t\t'''Signs MetaManifest file with the default PORTAGE_GPG_KEY''' \n+\t\tfilename = self.getFullname()\n+\t\tportage_settings = portage.config(clone=portage.settings)\n+\t\tportage_portdbapi = portage.portdbapi(portage_settings)\n+\t\tgpgcmd = portage_settings.get(\"PORTAGE_GPG_SIGNING_COMMAND\")\n+\t\tif gpgcmd in [None, '']:\n+\t\t\traise portage.exception.MissingParameter(\n+\t\t\t\t\"PORTAGE_GPG_SIGNING_COMMAND is unset! Is make.globals missing?\")\n+\t\tif \"${PORTAGE_GPG_KEY}\" in gpgcmd and \"PORTAGE_GPG_KEY\" not in portage_settings:\n+\t\t\traise portage.exception.MissingParameter(\"PORTAGE_GPG_KEY is unset!\")\n+\t\tif \"${PORTAGE_GPG_DIR}\" in gpgcmd:\n+\t\t\tif \"PORTAGE_GPG_DIR\" not in portage_settings:\n+\t\t\t\tportage_settings[\"PORTAGE_GPG_DIR\"] = os.path.expanduser(\"~/.gnupg\")\n+\t\t\telse:\n+\t\t\t\tportage_settings[\"PORTAGE_GPG_DIR\"] = os.path.expanduser(portage_settings[\"PORTAGE_GPG_DIR\"])\n+\t\t\tif not os.access(portage_settings[\"PORTAGE_GPG_DIR\"], os.X_OK):\n+\t\t\t\traise portage.exception.InvalidLocation(\n+\t\t\t\t\t\"Unable to access directory: PORTAGE_GPG_DIR='%s'\" %\n+\t\t\t\t\tportage_settings[\"PORTAGE_GPG_DIR\"])\n+\t\tgpgvars = {\"FILE\": filename}\n+\t\tfor setting in (\"PORTAGE_GPG_DIR\", \"PORTAGE_GPG_KEY\"):\n+\t\t\tkeyvar = portage_settings.get(setting)\n+\t\t\tif keyvar is not None:\n+\t\t\t\tgpgvars[setting] = keyvar\n+\t\tgpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)\n+\t\tgpgcmd = portage.util.shlex_split(gpgcmd)\n+\t\tgpgcmd = [portage._unicode_encode(arg, encoding=portage._encodings['fs'], errors='strict') for arg in gpgcmd]\n+\t\treturn_code = subprocess.call(gpgcmd)\n+\t\tif return_code == os.EX_OK:\n+\t\t\tos.rename(filename + \".asc\", filename)\n+\t\telse:\n+\t\t\traise portage.exception.PortageException(\"!!! gpg exited with '\" + str(return_code) + \"' status\")\n+\n+\tdef find_reporoot(self):\n+\t\t'''Finds reporoot'''\n+\t\trepodir = self.pkgdir\n+\t\twhile len(set(['metadata', 'eclass', 'profiles']).intersection(os.listdir(repodir))) == 0:","path":"pym/portage/meta-manifest.py","position":88,"original_position":88,"commit_id":"8008dc8865c11066f9ad05286955cd7260118082","original_commit_id":"8008dc8865c11066f9ad05286955cd7260118082","user":{"login":"zmedico","id":3420795,"avatar_url":"https://avatars.githubusercontent.com/u/3420795?v=3","gravatar_id":"","url":"https://api.github.com/users/zmedico","html_url":"https://github.com/zmedico","followers_url":"https://api.github.com/users/zmedico/followers","following_url":"https://api.github.com/users/zmedico/following{/other_user}","gists_url":"https://api.github.com/users/zmedico/gists{/gist_id}","starred_url":"https://api.github.com/users/zmedico/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zmedico/subscriptions","organizations_url":"https://api.github.com/users/zmedico/orgs","repos_url":"https://api.github.com/users/zmedico/repos","events_url":"https://api.github.com/users/zmedico/events{/privacy}","received_events_url":"https://api.github.com/users/zmedico/received_events","type":"User","site_admin":false},"body":"Since os.listdir is more expensive than stat, and intersection is more expensive than any(), this would be better:\r\n```\r\nwhile not any(os.path.exists(os.path.join(repodir, name)) for name in ('metadata', 'eclass', 'profiles'))):\r\n```","created_at":"2016-07-30T05:34:25Z","updated_at":"2016-07-30T05:34:25Z","html_url":"https://github.com/gentoo/portage/pull/38#discussion_r72882442","pull_request_url":"https://api.github.com/repos/gentoo/portage/pulls/38","_links":{"self":{"href":"https://api.github.com/repos/gentoo/portage/pulls/comments/72882442"},"html":{"href":"https://github.com/gentoo/portage/pull/38#discussion_r72882442"},"pull_request":{"href":"https://api.github.com/repos/gentoo/portage/pulls/38"}}},"pull_request":{"url":"https://api.github.com/repos/gentoo/portage/pulls/38","id":79252357,"html_url":"https://github.com/gentoo/portage/pull/38","diff_url":"https://github.com/gentoo/portage/pull/38.diff","patch_url":"https://github.com/gentoo/portage/pull/38.patch","issue_url":"https://api.github.com/repos/gentoo/portage/issues/38","number":38,"state":"open","locked":false,"title":"New changes metamanifest","user":{"login":"aeroniero33","id":5175537,"avatar_url":"https://avatars.githubusercontent.com/u/5175537?v=3","gravatar_id":"","url":"https://api.github.com/users/aeroniero33","html_url":"https://github.com/aeroniero33","followers_url":"https://api.github.com/users/aeroniero33/followers","following_url":"https://api.github.com/users/aeroniero33/following{/other_user}","gists_url":"https://api.github.com/users/aeroniero33/gists{/gist_id}","starred_url":"https://api.github.com/users/aeroniero33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aeroniero33/subscriptions","organizations_url":"https://api.github.com/users/aeroniero33/orgs","repos_url":"https://api.github.com/users/aeroniero33/repos","events_url":"https://api.github.com/users/aeroniero33/events{/privacy}","received_events_url":"https://api.github.com/users/aeroniero33/received_events","type":"User","site_admin":false},"body":"This PR is for a GSoC project based on [GLEP:58](https://wiki.gentoo.org/wiki/GLEP:58)\r\n\r\nAdded more `MANIFEST_IDENTIFIERS` in `pym/portage/const.py` according to [GLEP:60](https://wiki.gentoo.org/wiki/GLEP:60)\r\n\r\nModified `guessManifestType()` for the new `MANIFEST_IDENTIFIERS` and reduced the return statements\r\n\r\nUpdated some variable names in `/pym/portage/manifest.py`\r\n\r\nAdded a new file `/pym/portage/meta-manifest.py` which includes a subclass of Manifest for manifest files outside of the packages (ex. /profiles, categories etc)\r\n\r\nAdded 4 `create_` functions for it, `create_cat()` that creates a metamanifest for categories that includes the manifest files of all packages after verifying them, `create_profile` and `create_eclass` that create a metamanifest for the `/profiles` and `/eclass` directories, and `create_master` that creates a metamanifest file that includes all the metamanifests above and all files in the root directory.\r\n\r\nAdded signature and manifest verification to the metamanifest files which verifies package manifests only if a boolean is passed and ignores missing categories or packages if the whole directory is missing.\r\n\r\nModified the `checkFileHashes()` method in the subclass to ignore `DIST` files because otherwise package manifests wouldn't be verifiable. \r\n\r\nAdded some methods to help me identify things like the repolevel, reporoot and repotype.\r\n\r\nModified the `create()` function to choose which `create_` function to use based on the repotype.\r\n\r\n\r\nInstructions on how to use the script: https://goo.gl/i0LIay\r\nTest cases: https://wiki.gentoo.org/wiki/User:Aeroniero","created_at":"2016-07-28T19:17:46Z","updated_at":"2016-07-30T05:34:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"05549a12a6f0d84b45dc2da2b0a3b20551854c75","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/gentoo/portage/pulls/38/commits","review_comments_url":"https://api.github.com/repos/gentoo/portage/pulls/38/comments","review_comment_url":"https://api.github.com/repos/gentoo/portage/pulls/comments{/number}","comments_url":"https://api.github.com/repos/gentoo/portage/issues/38/comments","statuses_url":"https://api.github.com/repos/gentoo/portage/statuses/8008dc8865c11066f9ad05286955cd7260118082","head":{"label":"aeroniero33:new_changes_metamanifest","ref":"new_changes_metamanifest","sha":"8008dc8865c11066f9ad05286955cd7260118082","user":{"login":"aeroniero33","id":5175537,"avatar_url":"https://avatars.githubusercontent.com/u/5175537?v=3","gravatar_id":"","url":"https://api.github.com/users/aeroniero33","html_url":"https://github.com/aeroniero33","followers_url":"https://api.github.com/users/aeroniero33/followers","following_url":"https://api.github.com/users/aeroniero33/following{/other_user}","gists_url":"https://api.github.com/users/aeroniero33/gists{/gist_id}","starred_url":"https://api.github.com/users/aeroniero33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aeroniero33/subscriptions","organizations_url":"https://api.github.com/users/aeroniero33/orgs","repos_url":"https://api.github.com/users/aeroniero33/repos","events_url":"https://api.github.com/users/aeroniero33/events{/privacy}","received_events_url":"https://api.github.com/users/aeroniero33/received_events","type":"User","site_admin":false},"repo":{"id":62140262,"name":"portage","full_name":"aeroniero33/portage","owner":{"login":"aeroniero33","id":5175537,"avatar_url":"https://avatars.githubusercontent.com/u/5175537?v=3","gravatar_id":"","url":"https://api.github.com/users/aeroniero33","html_url":"https://github.com/aeroniero33","followers_url":"https://api.github.com/users/aeroniero33/followers","following_url":"https://api.github.com/users/aeroniero33/following{/other_user}","gists_url":"https://api.github.com/users/aeroniero33/gists{/gist_id}","starred_url":"https://api.github.com/users/aeroniero33/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aeroniero33/subscriptions","organizations_url":"https://api.github.com/users/aeroniero33/orgs","repos_url":"https://api.github.com/users/aeroniero33/repos","events_url":"https://api.github.com/users/aeroniero33/events{/privacy}","received_events_url":"https://api.github.com/users/aeroniero33/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/aeroniero33/portage","description":"Portage Package Manager - this is just a mirror, send patches to <gentoo-portage-dev@lists.gentoo.org>","fork":true,"url":"https://api.github.com/repos/aeroniero33/portage","forks_url":"https://api.github.com/repos/aeroniero33/portage/forks","keys_url":"https://api.github.com/repos/aeroniero33/portage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/aeroniero33/portage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/aeroniero33/portage/teams","hooks_url":"https://api.github.com/repos/aeroniero33/portage/hooks","issue_events_url":"https://api.github.com/repos/aeroniero33/portage/issues/events{/number}","events_url":"https://api.github.com/repos/aeroniero33/portage/events","assignees_url":"https://api.github.com/repos/aeroniero33/portage/assignees{/user}","branches_url":"https://api.github.com/repos/aeroniero33/portage/branches{/branch}","tags_url":"https://api.github.com/repos/aeroniero33/portage/tags","blobs_url":"https://api.github.com/repos/aeroniero33/portage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/aeroniero33/portage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/aeroniero33/portage/git/refs{/sha}","trees_url":"https://api.github.com/repos/aeroniero33/portage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/aeroniero33/portage/statuses/{sha}","languages_url":"https://api.github.com/repos/aeroniero33/portage/languages","stargazers_url":"https://api.github.com/repos/aeroniero33/portage/stargazers","contributors_url":"https://api.github.com/repos/aeroniero33/portage/contributors","subscribers_url":"https://api.github.com/repos/aeroniero33/portage/subscribers","subscription_url":"https://api.github.com/repos/aeroniero33/portage/subscription","commits_url":"https://api.github.com/repos/aeroniero33/portage/commits{/sha}","git_commits_url":"https://api.github.com/repos/aeroniero33/portage/git/commits{/sha}","comments_url":"https://api.github.com/repos/aeroniero33/portage/comments{/number}","issue_comment_url":"https://api.github.com/repos/aeroniero33/portage/issues/comments{/number}","contents_url":"https://api.github.com/repos/aeroniero33/portage/contents/{+path}","compare_url":"https://api.github.com/repos/aeroniero33/portage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/aeroniero33/portage/merges","archive_url":"https://api.github.com/repos/aeroniero33/portage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/aeroniero33/portage/downloads","issues_url":"https://api.github.com/repos/aeroniero33/portage/issues{/number}","pulls_url":"https://api.github.com/repos/aeroniero33/portage/pulls{/number}","milestones_url":"https://api.github.com/repos/aeroniero33/portage/milestones{/number}","notifications_url":"https://api.github.com/repos/aeroniero33/portage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/aeroniero33/portage/labels{/name}","releases_url":"https://api.github.com/repos/aeroniero33/portage/releases{/id}","deployments_url":"https://api.github.com/repos/aeroniero33/portage/deployments","created_at":"2016-06-28T12:50:13Z","updated_at":"2016-06-28T12:50:16Z","pushed_at":"2016-07-25T12:07:38Z","git_url":"git://github.com/aeroniero33/portage.git","ssh_url":"git@github.com:aeroniero33/portage.git","clone_url":"https://github.com/aeroniero33/portage.git","svn_url":"https://github.com/aeroniero33/portage","homepage":"","size":27341,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"gentoo:master","ref":"master","sha":"5652bc88514bdb36b36b544f7fc7e623cf25caae","user":{"login":"gentoo","id":52242,"avatar_url":"https://avatars.githubusercontent.com/u/52242?v=3","gravatar_id":"","url":"https://api.github.com/users/gentoo","html_url":"https://github.com/gentoo","followers_url":"https://api.github.com/users/gentoo/followers","following_url":"https://api.github.com/users/gentoo/following{/other_user}","gists_url":"https://api.github.com/users/gentoo/gists{/gist_id}","starred_url":"https://api.github.com/users/gentoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gentoo/subscriptions","organizations_url":"https://api.github.com/users/gentoo/orgs","repos_url":"https://api.github.com/users/gentoo/repos","events_url":"https://api.github.com/users/gentoo/events{/privacy}","received_events_url":"https://api.github.com/users/gentoo/received_events","type":"Organization","site_admin":false},"repo":{"id":15839027,"name":"portage","full_name":"gentoo/portage","owner":{"login":"gentoo","id":52242,"avatar_url":"https://avatars.githubusercontent.com/u/52242?v=3","gravatar_id":"","url":"https://api.github.com/users/gentoo","html_url":"https://github.com/gentoo","followers_url":"https://api.github.com/users/gentoo/followers","following_url":"https://api.github.com/users/gentoo/following{/other_user}","gists_url":"https://api.github.com/users/gentoo/gists{/gist_id}","starred_url":"https://api.github.com/users/gentoo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gentoo/subscriptions","organizations_url":"https://api.github.com/users/gentoo/orgs","repos_url":"https://api.github.com/users/gentoo/repos","events_url":"https://api.github.com/users/gentoo/events{/privacy}","received_events_url":"https://api.github.com/users/gentoo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/gentoo/portage","description":"Portage Package Manager - this is just a mirror, send patches to <gentoo-portage-dev@lists.gentoo.org>","fork":false,"url":"https://api.github.com/repos/gentoo/portage","forks_url":"https://api.github.com/repos/gentoo/portage/forks","keys_url":"https://api.github.com/repos/gentoo/portage/keys{/key_id}","collaborators_url":"https://api.github.com/repos/gentoo/portage/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/gentoo/portage/teams","hooks_url":"https://api.github.com/repos/gentoo/portage/hooks","issue_events_url":"https://api.github.com/repos/gentoo/portage/issues/events{/number}","events_url":"https://api.github.com/repos/gentoo/portage/events","assignees_url":"https://api.github.com/repos/gentoo/portage/assignees{/user}","branches_url":"https://api.github.com/repos/gentoo/portage/branches{/branch}","tags_url":"https://api.github.com/repos/gentoo/portage/tags","blobs_url":"https://api.github.com/repos/gentoo/portage/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/gentoo/portage/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/gentoo/portage/git/refs{/sha}","trees_url":"https://api.github.com/repos/gentoo/portage/git/trees{/sha}","statuses_url":"https://api.github.com/repos/gentoo/portage/statuses/{sha}","languages_url":"https://api.github.com/repos/gentoo/portage/languages","stargazers_url":"https://api.github.com/repos/gentoo/portage/stargazers","contributors_url":"https://api.github.com/repos/gentoo/portage/contributors","subscribers_url":"https://api.github.com/repos/gentoo/portage/subscribers","subscription_url":"https://api.github.com/repos/gentoo/portage/subscription","commits_url":"https://api.github.com/repos/gentoo/portage/commits{/sha}","git_commits_url":"https://api.github.com/repos/gentoo/portage/git/commits{/sha}","comments_url":"https://api.github.com/repos/gentoo/portage/comments{/number}","issue_comment_url":"https://api.github.com/repos/gentoo/portage/issues/comments{/number}","contents_url":"https://api.github.com/repos/gentoo/portage/contents/{+path}","compare_url":"https://api.github.com/repos/gentoo/portage/compare/{base}...{head}","merges_url":"https://api.github.com/repos/gentoo/portage/merges","archive_url":"https://api.github.com/repos/gentoo/portage/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/gentoo/portage/downloads","issues_url":"https://api.github.com/repos/gentoo/portage/issues{/number}","pulls_url":"https://api.github.com/repos/gentoo/portage/pulls{/number}","milestones_url":"https://api.github.com/repos/gentoo/portage/milestones{/number}","notifications_url":"https://api.github.com/repos/gentoo/portage/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/gentoo/portage/labels{/name}","releases_url":"https://api.github.com/repos/gentoo/portage/releases{/id}","deployments_url":"https://api.github.com/repos/gentoo/portage/deployments","created_at":"2014-01-12T08:30:47Z","updated_at":"2016-07-28T22:00:20Z","pushed_at":"2016-07-28T19:17:46Z","git_url":"git://github.com/gentoo/portage.git","ssh_url":"git@github.com:gentoo/portage.git","clone_url":"https://github.com/gentoo/portage.git","svn_url":"https://github.com/gentoo/portage","homepage":"","size":37949,"stargazers_count":111,"watchers_count":111,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":45,"mirror_url":null,"open_issues_count":4,"forks":45,"open_issues":4,"watchers":111,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/gentoo/portage/pulls/38"},"html":{"href":"https://github.com/gentoo/portage/pull/38"},"issue":{"href":"https://api.github.com/repos/gentoo/portage/issues/38"},"comments":{"href":"https://api.github.com/repos/gentoo/portage/issues/38/comments"},"review_comments":{"href":"https://api.github.com/repos/gentoo/portage/pulls/38/comments"},"review_comment":{"href":"https://api.github.com/repos/gentoo/portage/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/gentoo/portage/pulls/38/commits"},"statuses":{"href":"https://api.github.com/repos/gentoo/portage/statuses/8008dc8865c11066f9ad05286955cd7260118082"}}}}
{"actor":{"display_login":"zmedico"}}