{"action":"created","comment":{"url":"https://api.github.com/repos/cfengine/core/pulls/comments/30954883","id":30954883,"diff_hunk":"@@ -0,0 +1,1611 @@\n+/*\n+   Copyright (C) CFEngine AS\n+\n+   This file is part of CFEngine 3 - written and maintained by CFEngine AS.\n+\n+   This program is free software; you can redistribute it and/or modify it\n+   under the terms of the GNU General Public License as published by the\n+   Free Software Foundation; version 3.\n+\n+   This program is distributed in the hope that it will be useful,\n+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+   GNU General Public License for more details.\n+\n+  You should have received a copy of the GNU General Public License\n+  along with this program; if not, write to the Free Software\n+  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA\n+\n+  To the extent this program is licensed as part of the Enterprise\n+  versions of CFEngine, the applicable Commercial Open Source License\n+  (COSL) may apply to this file if you as a licensee so wish it. See\n+  included file COSL.txt.\n+*/\n+\n+#include <package_module.h>\n+#include <pipes.h>\n+#include <signals.h>\n+#include <buffer.h>\n+#include <string_lib.h>\n+#include <actuator.h>\n+#include <file_lib.h>\n+#include <known_dirs.h>\n+#include <locks.h>\n+#include <rlist.h>\n+#include <policy.h>\n+#include <eval_context.h>\n+\n+#define INVENTORY_LIST_BUFFER_SIZE 100 * 80 /* 100 entries with 80 characters \n+                                             * per line */\n+\n+static bool UpdateSinglePackageModuleCache(EvalContext *ctx,\n+                                    const PackageModuleWrapper *module_wrapper,\n+                                    UpdateType type, bool force_update);\n+static char *GetPackageModuleRealPath(const char *package_manager_name);\n+static int NegotiateSupportedAPIVersion(PackageModuleWrapper *wrapper);\n+\n+\n+void DeletePackageModuleWrapper(PackageModuleWrapper *wrapper)\n+{\n+    free(wrapper->path);\n+    free(wrapper->name);\n+    free(wrapper);\n+}\n+\n+PackageModuleWrapper *NewPackageModuleWrapper(PackageModuleBody *package_module)\n+{\n+    assert(package_module && package_module->name);\n+\n+    PackageModuleWrapper *wrapper = xmalloc(sizeof(PackageModuleWrapper));\n+    \n+    wrapper->path = GetPackageModuleRealPath(package_module->name);\n+    wrapper->name = SafeStringDuplicate(package_module->name);\n+    wrapper->package_module = package_module;\n+    \n+    /* Check if file exists */\n+    struct stat sb;\n+    if (!wrapper->path || (stat(wrapper->path, &sb) != 0))","path":"cf-agent/package_module.c","position":67,"original_position":67,"commit_id":"885974c0b4a2ee6f06a126dfec63e5aa0a8ad785","original_commit_id":"885974c0b4a2ee6f06a126dfec63e5aa0a8ad785","user":{"login":"pasinskim","id":6329055,"avatar_url":"https://avatars.githubusercontent.com/u/6329055?v=3","gravatar_id":"","url":"https://api.github.com/users/pasinskim","html_url":"https://github.com/pasinskim","followers_url":"https://api.github.com/users/pasinskim/followers","following_url":"https://api.github.com/users/pasinskim/following{/other_user}","gists_url":"https://api.github.com/users/pasinskim/gists{/gist_id}","starred_url":"https://api.github.com/users/pasinskim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pasinskim/subscriptions","organizations_url":"https://api.github.com/users/pasinskim/orgs","repos_url":"https://api.github.com/users/pasinskim/repos","events_url":"https://api.github.com/users/pasinskim/events{/privacy}","received_events_url":"https://api.github.com/users/pasinskim/received_events","type":"User","site_admin":false},"body":"Makes sense and looks much simpler.","created_at":"2015-05-24T19:13:18Z","updated_at":"2015-05-24T19:13:18Z","html_url":"https://github.com/cfengine/core/pull/2215#discussion_r30954883","pull_request_url":"https://api.github.com/repos/cfengine/core/pulls/2215","_links":{"self":{"href":"https://api.github.com/repos/cfengine/core/pulls/comments/30954883"},"html":{"href":"https://github.com/cfengine/core/pull/2215#discussion_r30954883"},"pull_request":{"href":"https://api.github.com/repos/cfengine/core/pulls/2215"}}},"pull_request":{"url":"https://api.github.com/repos/cfengine/core/pulls/2215","id":35834193,"html_url":"https://github.com/cfengine/core/pull/2215","diff_url":"https://github.com/cfengine/core/pull/2215.diff","patch_url":"https://github.com/cfengine/core/pull/2215.patch","issue_url":"https://api.github.com/repos/cfengine/core/issues/2215","number":2215,"state":"open","locked":false,"title":"New packages promise","user":{"login":"pasinskim","id":6329055,"avatar_url":"https://avatars.githubusercontent.com/u/6329055?v=3","gravatar_id":"","url":"https://api.github.com/users/pasinskim","html_url":"https://github.com/pasinskim","followers_url":"https://api.github.com/users/pasinskim/followers","following_url":"https://api.github.com/users/pasinskim/following{/other_user}","gists_url":"https://api.github.com/users/pasinskim/gists{/gist_id}","starred_url":"https://api.github.com/users/pasinskim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pasinskim/subscriptions","organizations_url":"https://api.github.com/users/pasinskim/orgs","repos_url":"https://api.github.com/users/pasinskim/repos","events_url":"https://api.github.com/users/pasinskim/events{/privacy}","received_events_url":"https://api.github.com/users/pasinskim/received_events","type":"User","site_admin":false},"body":"Complete implementation of new package promise feature.","created_at":"2015-05-20T13:57:20Z","updated_at":"2015-05-24T19:13:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b062882610ffcb76cdcc00c944ebb34f19aa6ea9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/cfengine/core/pulls/2215/commits","review_comments_url":"https://api.github.com/repos/cfengine/core/pulls/2215/comments","review_comment_url":"https://api.github.com/repos/cfengine/core/pulls/comments{/number}","comments_url":"https://api.github.com/repos/cfengine/core/issues/2215/comments","statuses_url":"https://api.github.com/repos/cfengine/core/statuses/885974c0b4a2ee6f06a126dfec63e5aa0a8ad785","head":{"label":"pasinskim:new_packages_promise","ref":"new_packages_promise","sha":"885974c0b4a2ee6f06a126dfec63e5aa0a8ad785","user":{"login":"pasinskim","id":6329055,"avatar_url":"https://avatars.githubusercontent.com/u/6329055?v=3","gravatar_id":"","url":"https://api.github.com/users/pasinskim","html_url":"https://github.com/pasinskim","followers_url":"https://api.github.com/users/pasinskim/followers","following_url":"https://api.github.com/users/pasinskim/following{/other_user}","gists_url":"https://api.github.com/users/pasinskim/gists{/gist_id}","starred_url":"https://api.github.com/users/pasinskim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pasinskim/subscriptions","organizations_url":"https://api.github.com/users/pasinskim/orgs","repos_url":"https://api.github.com/users/pasinskim/repos","events_url":"https://api.github.com/users/pasinskim/events{/privacy}","received_events_url":"https://api.github.com/users/pasinskim/received_events","type":"User","site_admin":false},"repo":{"id":15708117,"name":"core","full_name":"pasinskim/core","owner":{"login":"pasinskim","id":6329055,"avatar_url":"https://avatars.githubusercontent.com/u/6329055?v=3","gravatar_id":"","url":"https://api.github.com/users/pasinskim","html_url":"https://github.com/pasinskim","followers_url":"https://api.github.com/users/pasinskim/followers","following_url":"https://api.github.com/users/pasinskim/following{/other_user}","gists_url":"https://api.github.com/users/pasinskim/gists{/gist_id}","starred_url":"https://api.github.com/users/pasinskim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pasinskim/subscriptions","organizations_url":"https://api.github.com/users/pasinskim/orgs","repos_url":"https://api.github.com/users/pasinskim/repos","events_url":"https://api.github.com/users/pasinskim/events{/privacy}","received_events_url":"https://api.github.com/users/pasinskim/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/pasinskim/core","description":"CFEngine Community","fork":true,"url":"https://api.github.com/repos/pasinskim/core","forks_url":"https://api.github.com/repos/pasinskim/core/forks","keys_url":"https://api.github.com/repos/pasinskim/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/pasinskim/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/pasinskim/core/teams","hooks_url":"https://api.github.com/repos/pasinskim/core/hooks","issue_events_url":"https://api.github.com/repos/pasinskim/core/issues/events{/number}","events_url":"https://api.github.com/repos/pasinskim/core/events","assignees_url":"https://api.github.com/repos/pasinskim/core/assignees{/user}","branches_url":"https://api.github.com/repos/pasinskim/core/branches{/branch}","tags_url":"https://api.github.com/repos/pasinskim/core/tags","blobs_url":"https://api.github.com/repos/pasinskim/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/pasinskim/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/pasinskim/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/pasinskim/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/pasinskim/core/statuses/{sha}","languages_url":"https://api.github.com/repos/pasinskim/core/languages","stargazers_url":"https://api.github.com/repos/pasinskim/core/stargazers","contributors_url":"https://api.github.com/repos/pasinskim/core/contributors","subscribers_url":"https://api.github.com/repos/pasinskim/core/subscribers","subscription_url":"https://api.github.com/repos/pasinskim/core/subscription","commits_url":"https://api.github.com/repos/pasinskim/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/pasinskim/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/pasinskim/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/pasinskim/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/pasinskim/core/contents/{+path}","compare_url":"https://api.github.com/repos/pasinskim/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/pasinskim/core/merges","archive_url":"https://api.github.com/repos/pasinskim/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/pasinskim/core/downloads","issues_url":"https://api.github.com/repos/pasinskim/core/issues{/number}","pulls_url":"https://api.github.com/repos/pasinskim/core/pulls{/number}","milestones_url":"https://api.github.com/repos/pasinskim/core/milestones{/number}","notifications_url":"https://api.github.com/repos/pasinskim/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/pasinskim/core/labels{/name}","releases_url":"https://api.github.com/repos/pasinskim/core/releases{/id}","created_at":"2014-01-07T15:24:45Z","updated_at":"2015-03-11T16:49:34Z","pushed_at":"2015-05-21T13:10:12Z","git_url":"git://github.com/pasinskim/core.git","ssh_url":"git@github.com:pasinskim/core.git","clone_url":"https://github.com/pasinskim/core.git","svn_url":"https://github.com/pasinskim/core","homepage":"https://cfengine.com/community/","size":52599,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"cfengine:master","ref":"master","sha":"0b34201ab6705590fed804ae9ac2f52fa4fef904","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":3543548,"name":"core","full_name":"cfengine/core","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/core","description":"CFEngine Community","fork":false,"url":"https://api.github.com/repos/cfengine/core","forks_url":"https://api.github.com/repos/cfengine/core/forks","keys_url":"https://api.github.com/repos/cfengine/core/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfengine/core/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfengine/core/teams","hooks_url":"https://api.github.com/repos/cfengine/core/hooks","issue_events_url":"https://api.github.com/repos/cfengine/core/issues/events{/number}","events_url":"https://api.github.com/repos/cfengine/core/events","assignees_url":"https://api.github.com/repos/cfengine/core/assignees{/user}","branches_url":"https://api.github.com/repos/cfengine/core/branches{/branch}","tags_url":"https://api.github.com/repos/cfengine/core/tags","blobs_url":"https://api.github.com/repos/cfengine/core/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfengine/core/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfengine/core/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfengine/core/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfengine/core/statuses/{sha}","languages_url":"https://api.github.com/repos/cfengine/core/languages","stargazers_url":"https://api.github.com/repos/cfengine/core/stargazers","contributors_url":"https://api.github.com/repos/cfengine/core/contributors","subscribers_url":"https://api.github.com/repos/cfengine/core/subscribers","subscription_url":"https://api.github.com/repos/cfengine/core/subscription","commits_url":"https://api.github.com/repos/cfengine/core/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfengine/core/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfengine/core/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfengine/core/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfengine/core/contents/{+path}","compare_url":"https://api.github.com/repos/cfengine/core/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfengine/core/merges","archive_url":"https://api.github.com/repos/cfengine/core/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfengine/core/downloads","issues_url":"https://api.github.com/repos/cfengine/core/issues{/number}","pulls_url":"https://api.github.com/repos/cfengine/core/pulls{/number}","milestones_url":"https://api.github.com/repos/cfengine/core/milestones{/number}","notifications_url":"https://api.github.com/repos/cfengine/core/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfengine/core/labels{/name}","releases_url":"https://api.github.com/repos/cfengine/core/releases{/id}","created_at":"2012-02-25T09:19:05Z","updated_at":"2015-05-14T19:15:35Z","pushed_at":"2015-05-22T19:00:23Z","git_url":"git://github.com/cfengine/core.git","ssh_url":"git@github.com:cfengine/core.git","clone_url":"https://github.com/cfengine/core.git","svn_url":"https://github.com/cfengine/core","homepage":"https://cfengine.com/community/","size":95838,"stargazers_count":217,"watchers_count":217,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":135,"mirror_url":null,"open_issues_count":11,"forks":135,"open_issues":11,"watchers":217,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/cfengine/core/pulls/2215"},"html":{"href":"https://github.com/cfengine/core/pull/2215"},"issue":{"href":"https://api.github.com/repos/cfengine/core/issues/2215"},"comments":{"href":"https://api.github.com/repos/cfengine/core/issues/2215/comments"},"review_comments":{"href":"https://api.github.com/repos/cfengine/core/pulls/2215/comments"},"review_comment":{"href":"https://api.github.com/repos/cfengine/core/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/cfengine/core/pulls/2215/commits"},"statuses":{"href":"https://api.github.com/repos/cfengine/core/statuses/885974c0b4a2ee6f06a126dfec63e5aa0a8ad785"}}}}