{"action":"created","comment":{"url":"https://api.github.com/repos/cfengine/masterfiles/pulls/comments/31033153","id":31033153,"diff_hunk":"@@ -0,0 +1,542 @@\n+#!/usr/bin/python\n+\n+from __future__ import print_function\n+\n+import pprint\n+import sys\n+\n+TEST_COUNT = 0\n+PLATFORM_ARCH_32 = False\n+\n+states = {","path":"tests/acceptance/17_packages/10_new/unsafe/the_great_package_test_generator.py","position":11,"original_position":11,"commit_id":"2317311b2db91ec67100467a809a34ce2d684d3c","original_commit_id":"c2916f6f184f0f83a0e8ea06d79c372569242d30","user":{"login":"ediosyncratic","id":2255042,"avatar_url":"https://avatars.githubusercontent.com/u/2255042?v=3","gravatar_id":"","url":"https://api.github.com/users/ediosyncratic","html_url":"https://github.com/ediosyncratic","followers_url":"https://api.github.com/users/ediosyncratic/followers","following_url":"https://api.github.com/users/ediosyncratic/following{/other_user}","gists_url":"https://api.github.com/users/ediosyncratic/gists{/gist_id}","starred_url":"https://api.github.com/users/ediosyncratic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ediosyncratic/subscriptions","organizations_url":"https://api.github.com/users/ediosyncratic/orgs","repos_url":"https://api.github.com/users/ediosyncratic/repos","events_url":"https://api.github.com/users/ediosyncratic/events{/privacy}","received_events_url":"https://api.github.com/users/ediosyncratic/received_events","type":"User","site_admin":false},"body":"I'd be inclined to generate this programmatically:\r\n```\r\ndef states(top=2, archs=(\"64_bit\", \"32_bit\")):\r\n    \"\"\"Iterate the possible states.\r\n\r\n    Here, state 0 means absent, which won't be included in the state description.\r\n    The other two states are different versions (1 and 2) of a package.\r\n    Each arch can be absent or at either version.\r\n    If both are present, they are constrained to have the same version.\r\n    We iterate pairs of a state-name and a state-description dictionary.\r\n    The dictionary's keys are (arch, version) pairs, mapped to True if\r\n    the given arch is present at the specified version.\r\n    \"\"\"\r\n    # Empty state - pair each arch with each version (not 0) and map the pair to False:\r\n    blank = dict(((arch, str(ver)), False) for arch in archs for ver in range(1, top + 1))\r\n    # Each conceivable state is expressed as a value for this list:\r\n    vers = [top for v in archs] # as many top as entries in archs\r\n    while True:\r\n        if len(filter(None, set(vers))) < 2: # we have at most one non-zero version\r\n            pairs = [(arch, str(ver)) for arch, ver in zip(archs, vers) if ver]\r\n            yield ('_'.join('_'.joiin(p) for p in pairs) or 'absent',\r\n                   dict((pair, pair in pairs) for pair in blank.items()))\r\n\r\n        # Now step vers to the next conceivable (not necessarily valid) candidate:\r\n        ind = len(vers)\r\n        while ind > 0:\r\n            ind -= 1\r\n            if vers[ind] > 0:\r\n                vers[ind] -= 1\r\n                break\r\n            else:\r\n                vers[ind] = top\r\n        else: break # we fell off the bottom, ind < 0 so we have finished.\r\n\r\n# Now collect those up in a dictionary mapping state name to its details:\r\nstates = dict(states())\r\n```\r\n(Note that the `else` block of a `while` or `for` loop is run precisely if we don't `break` out of the loop.\r\nThe function zip() is a transposition: zip(('a', 'b', 'c'), (1, 2, 3)) is (('a', 1), ('b', 2), ('c', 3)) and similar)\r\nUnfortunately, I don't think that's very clear to the reader !\r\n","created_at":"2015-05-26T13:38:42Z","updated_at":"2015-05-26T13:38:42Z","html_url":"https://github.com/cfengine/masterfiles/pull/465#discussion_r31033153","pull_request_url":"https://api.github.com/repos/cfengine/masterfiles/pulls/465","_links":{"self":{"href":"https://api.github.com/repos/cfengine/masterfiles/pulls/comments/31033153"},"html":{"href":"https://github.com/cfengine/masterfiles/pull/465#discussion_r31033153"},"pull_request":{"href":"https://api.github.com/repos/cfengine/masterfiles/pulls/465"}}},"pull_request":{"url":"https://api.github.com/repos/cfengine/masterfiles/pulls/465","id":35907663,"html_url":"https://github.com/cfengine/masterfiles/pull/465","diff_url":"https://github.com/cfengine/masterfiles/pull/465.diff","patch_url":"https://github.com/cfengine/masterfiles/pull/465.patch","issue_url":"https://api.github.com/repos/cfengine/masterfiles/issues/465","number":465,"state":"open","locked":false,"title":"New package promise","user":{"login":"kacfengine","id":4037094,"avatar_url":"https://avatars.githubusercontent.com/u/4037094?v=3","gravatar_id":"","url":"https://api.github.com/users/kacfengine","html_url":"https://github.com/kacfengine","followers_url":"https://api.github.com/users/kacfengine/followers","following_url":"https://api.github.com/users/kacfengine/following{/other_user}","gists_url":"https://api.github.com/users/kacfengine/gists{/gist_id}","starred_url":"https://api.github.com/users/kacfengine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kacfengine/subscriptions","organizations_url":"https://api.github.com/users/kacfengine/orgs","repos_url":"https://api.github.com/users/kacfengine/repos","events_url":"https://api.github.com/users/kacfengine/events{/privacy}","received_events_url":"https://api.github.com/users/kacfengine/received_events","type":"User","site_admin":false},"body":"Package modules for apt and yum (see https://github.com/cfengine/core/pull/2215). At the time of writing only apt has been extensively tested, yum is still undergoing testing.\r\n\r\nI will add commits to this branch as I find issues, but in the end we should squash it before merging.","created_at":"2015-05-21T07:47:36Z","updated_at":"2015-05-26T13:38:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"885132f17c44e7e15c1674f57895d0dd4829e32e","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cfengine/masterfiles/pulls/465/commits","review_comments_url":"https://api.github.com/repos/cfengine/masterfiles/pulls/465/comments","review_comment_url":"https://api.github.com/repos/cfengine/masterfiles/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfengine/masterfiles/issues/465/comments","statuses_url":"https://api.github.com/repos/cfengine/masterfiles/statuses/2317311b2db91ec67100467a809a34ce2d684d3c","head":{"label":"kacfengine:new_package_promise","ref":"new_package_promise","sha":"2317311b2db91ec67100467a809a34ce2d684d3c","user":{"login":"kacfengine","id":4037094,"avatar_url":"https://avatars.githubusercontent.com/u/4037094?v=3","gravatar_id":"","url":"https://api.github.com/users/kacfengine","html_url":"https://github.com/kacfengine","followers_url":"https://api.github.com/users/kacfengine/followers","following_url":"https://api.github.com/users/kacfengine/following{/other_user}","gists_url":"https://api.github.com/users/kacfengine/gists{/gist_id}","starred_url":"https://api.github.com/users/kacfengine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kacfengine/subscriptions","organizations_url":"https://api.github.com/users/kacfengine/orgs","repos_url":"https://api.github.com/users/kacfengine/repos","events_url":"https://api.github.com/users/kacfengine/events{/privacy}","received_events_url":"https://api.github.com/users/kacfengine/received_events","type":"User","site_admin":false},"repo":{"id":13318293,"name":"masterfiles","full_name":"kacfengine/masterfiles","owner":{"login":"kacfengine","id":4037094,"avatar_url":"https://avatars.githubusercontent.com/u/4037094?v=3","gravatar_id":"","url":"https://api.github.com/users/kacfengine","html_url":"https://github.com/kacfengine","followers_url":"https://api.github.com/users/kacfengine/followers","following_url":"https://api.github.com/users/kacfengine/following{/other_user}","gists_url":"https://api.github.com/users/kacfengine/gists{/gist_id}","starred_url":"https://api.github.com/users/kacfengine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kacfengine/subscriptions","organizations_url":"https://api.github.com/users/kacfengine/orgs","repos_url":"https://api.github.com/users/kacfengine/repos","events_url":"https://api.github.com/users/kacfengine/events{/privacy}","received_events_url":"https://api.github.com/users/kacfengine/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kacfengine/masterfiles","description":"Policy masterfiles that are shipped with CFEngine packages","fork":true,"url":"https://api.github.com/repos/kacfengine/masterfiles","forks_url":"https://api.github.com/repos/kacfengine/masterfiles/forks","keys_url":"https://api.github.com/repos/kacfengine/masterfiles/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kacfengine/masterfiles/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kacfengine/masterfiles/teams","hooks_url":"https://api.github.com/repos/kacfengine/masterfiles/hooks","issue_events_url":"https://api.github.com/repos/kacfengine/masterfiles/issues/events{/number}","events_url":"https://api.github.com/repos/kacfengine/masterfiles/events","assignees_url":"https://api.github.com/repos/kacfengine/masterfiles/assignees{/user}","branches_url":"https://api.github.com/repos/kacfengine/masterfiles/branches{/branch}","tags_url":"https://api.github.com/repos/kacfengine/masterfiles/tags","blobs_url":"https://api.github.com/repos/kacfengine/masterfiles/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kacfengine/masterfiles/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kacfengine/masterfiles/git/refs{/sha}","trees_url":"https://api.github.com/repos/kacfengine/masterfiles/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kacfengine/masterfiles/statuses/{sha}","languages_url":"https://api.github.com/repos/kacfengine/masterfiles/languages","stargazers_url":"https://api.github.com/repos/kacfengine/masterfiles/stargazers","contributors_url":"https://api.github.com/repos/kacfengine/masterfiles/contributors","subscribers_url":"https://api.github.com/repos/kacfengine/masterfiles/subscribers","subscription_url":"https://api.github.com/repos/kacfengine/masterfiles/subscription","commits_url":"https://api.github.com/repos/kacfengine/masterfiles/commits{/sha}","git_commits_url":"https://api.github.com/repos/kacfengine/masterfiles/git/commits{/sha}","comments_url":"https://api.github.com/repos/kacfengine/masterfiles/comments{/number}","issue_comment_url":"https://api.github.com/repos/kacfengine/masterfiles/issues/comments{/number}","contents_url":"https://api.github.com/repos/kacfengine/masterfiles/contents/{+path}","compare_url":"https://api.github.com/repos/kacfengine/masterfiles/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kacfengine/masterfiles/merges","archive_url":"https://api.github.com/repos/kacfengine/masterfiles/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kacfengine/masterfiles/downloads","issues_url":"https://api.github.com/repos/kacfengine/masterfiles/issues{/number}","pulls_url":"https://api.github.com/repos/kacfengine/masterfiles/pulls{/number}","milestones_url":"https://api.github.com/repos/kacfengine/masterfiles/milestones{/number}","notifications_url":"https://api.github.com/repos/kacfengine/masterfiles/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kacfengine/masterfiles/labels{/name}","releases_url":"https://api.github.com/repos/kacfengine/masterfiles/releases{/id}","created_at":"2013-10-04T06:57:26Z","updated_at":"2015-05-19T12:23:58Z","pushed_at":"2015-05-26T11:00:33Z","git_url":"git://github.com/kacfengine/masterfiles.git","ssh_url":"git@github.com:kacfengine/masterfiles.git","clone_url":"https://github.com/kacfengine/masterfiles.git","svn_url":"https://github.com/kacfengine/masterfiles","homepage":null,"size":3776,"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":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"cfengine:master","ref":"master","sha":"c475eff7989089ce4b42145c39a8163e66b5fb41","user":{"login":"cfengine","id":1239823,"avatar_url":"https://avatars.githubusercontent.com/u/1239823?v=3","gravatar_id":"","url":"https://api.github.com/users/cfengine","html_url":"https://github.com/cfengine","followers_url":"https://api.github.com/users/cfengine/followers","following_url":"https://api.github.com/users/cfengine/following{/other_user}","gists_url":"https://api.github.com/users/cfengine/gists{/gist_id}","starred_url":"https://api.github.com/users/cfengine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfengine/subscriptions","organizations_url":"https://api.github.com/users/cfengine/orgs","repos_url":"https://api.github.com/users/cfengine/repos","events_url":"https://api.github.com/users/cfengine/events{/privacy}","received_events_url":"https://api.github.com/users/cfengine/received_events","type":"Organization","site_admin":false},"repo":{"id":11657493,"name":"masterfiles","full_name":"cfengine/masterfiles","owner":{"login":"cfengine","id":1239823,"avatar_url":"https://avatars.githubusercontent.com/u/1239823?v=3","gravatar_id":"","url":"https://api.github.com/users/cfengine","html_url":"https://github.com/cfengine","followers_url":"https://api.github.com/users/cfengine/followers","following_url":"https://api.github.com/users/cfengine/following{/other_user}","gists_url":"https://api.github.com/users/cfengine/gists{/gist_id}","starred_url":"https://api.github.com/users/cfengine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfengine/subscriptions","organizations_url":"https://api.github.com/users/cfengine/orgs","repos_url":"https://api.github.com/users/cfengine/repos","events_url":"https://api.github.com/users/cfengine/events{/privacy}","received_events_url":"https://api.github.com/users/cfengine/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/cfengine/masterfiles","description":"Policy masterfiles that are shipped with CFEngine packages","fork":false,"url":"https://api.github.com/repos/cfengine/masterfiles","forks_url":"https://api.github.com/repos/cfengine/masterfiles/forks","keys_url":"https://api.github.com/repos/cfengine/masterfiles/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfengine/masterfiles/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfengine/masterfiles/teams","hooks_url":"https://api.github.com/repos/cfengine/masterfiles/hooks","issue_events_url":"https://api.github.com/repos/cfengine/masterfiles/issues/events{/number}","events_url":"https://api.github.com/repos/cfengine/masterfiles/events","assignees_url":"https://api.github.com/repos/cfengine/masterfiles/assignees{/user}","branches_url":"https://api.github.com/repos/cfengine/masterfiles/branches{/branch}","tags_url":"https://api.github.com/repos/cfengine/masterfiles/tags","blobs_url":"https://api.github.com/repos/cfengine/masterfiles/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfengine/masterfiles/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfengine/masterfiles/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfengine/masterfiles/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfengine/masterfiles/statuses/{sha}","languages_url":"https://api.github.com/repos/cfengine/masterfiles/languages","stargazers_url":"https://api.github.com/repos/cfengine/masterfiles/stargazers","contributors_url":"https://api.github.com/repos/cfengine/masterfiles/contributors","subscribers_url":"https://api.github.com/repos/cfengine/masterfiles/subscribers","subscription_url":"https://api.github.com/repos/cfengine/masterfiles/subscription","commits_url":"https://api.github.com/repos/cfengine/masterfiles/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfengine/masterfiles/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfengine/masterfiles/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfengine/masterfiles/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfengine/masterfiles/contents/{+path}","compare_url":"https://api.github.com/repos/cfengine/masterfiles/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfengine/masterfiles/merges","archive_url":"https://api.github.com/repos/cfengine/masterfiles/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfengine/masterfiles/downloads","issues_url":"https://api.github.com/repos/cfengine/masterfiles/issues{/number}","pulls_url":"https://api.github.com/repos/cfengine/masterfiles/pulls{/number}","milestones_url":"https://api.github.com/repos/cfengine/masterfiles/milestones{/number}","notifications_url":"https://api.github.com/repos/cfengine/masterfiles/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfengine/masterfiles/labels{/name}","releases_url":"https://api.github.com/repos/cfengine/masterfiles/releases{/id}","created_at":"2013-07-25T10:03:46Z","updated_at":"2015-05-07T08:03:07Z","pushed_at":"2015-05-26T11:00:34Z","git_url":"git://github.com/cfengine/masterfiles.git","ssh_url":"git@github.com:cfengine/masterfiles.git","clone_url":"https://github.com/cfengine/masterfiles.git","svn_url":"https://github.com/cfengine/masterfiles","homepage":null,"size":9615,"stargazers_count":17,"watchers_count":17,"language":"Shell","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":64,"mirror_url":null,"open_issues_count":13,"forks":64,"open_issues":13,"watchers":17,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfengine/masterfiles/pulls/465"},"html":{"href":"https://github.com/cfengine/masterfiles/pull/465"},"issue":{"href":"https://api.github.com/repos/cfengine/masterfiles/issues/465"},"comments":{"href":"https://api.github.com/repos/cfengine/masterfiles/issues/465/comments"},"review_comments":{"href":"https://api.github.com/repos/cfengine/masterfiles/pulls/465/comments"},"review_comment":{"href":"https://api.github.com/repos/cfengine/masterfiles/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfengine/masterfiles/pulls/465/commits"},"statuses":{"href":"https://api.github.com/repos/cfengine/masterfiles/statuses/2317311b2db91ec67100467a809a34ce2d684d3c"}}}}