{"action":"created","comment":{"url":"https://api.github.com/repos/endlessm/eos-updater/pulls/comments/67576662","id":67576662,"diff_hunk":"@@ -22,17 +22,31 @@\n \n #include \"eos-updater-data.h\"\n \n+#include \"eos-util.h\"\n+\n #include <string.h>\n \n-void\n+gboolean\n eos_updater_data_init (EosUpdaterData *data,\n-                       OstreeRepo *repo)\n+                       OstreeRepo *repo,\n+                       GError **error)\n {\n-  g_return_if_fail (data == NULL);\n-  g_return_if_fail (OSTREE_IS_REPO (repo));\n+  if (data == NULL)\n+    return TRUE;\n+\n+  g_return_val_if_fail (OSTREE_IS_REPO (repo), FALSE);\n \n   memset (data, 0, sizeof *data);\n   data->repo = g_object_ref (repo);\n+  data->download_order = g_new (EosUpdaterDownloadSource, 1);\n+  data->download_order[0] = EOS_UPDATER_DOWNLOAD_MAIN;","path":"src/eos-updater-data.c","position":25,"original_position":25,"commit_id":"11801770675d6ec76b594a27f8212aa01541ce61","original_commit_id":"f4b21bb6a60ca544068fc22f7b24cb9321631c3f","user":{"login":"smspillaz","id":775309,"avatar_url":"https://avatars.githubusercontent.com/u/775309?v=3","gravatar_id":"","url":"https://api.github.com/users/smspillaz","html_url":"https://github.com/smspillaz","followers_url":"https://api.github.com/users/smspillaz/followers","following_url":"https://api.github.com/users/smspillaz/following{/other_user}","gists_url":"https://api.github.com/users/smspillaz/gists{/gist_id}","starred_url":"https://api.github.com/users/smspillaz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smspillaz/subscriptions","organizations_url":"https://api.github.com/users/smspillaz/orgs","repos_url":"https://api.github.com/users/smspillaz/repos","events_url":"https://api.github.com/users/smspillaz/events{/privacy}","received_events_url":"https://api.github.com/users/smspillaz/received_events","type":"User","site_admin":false},"body":"Any reason to store this as a pointer? I didn't see it checked for `NULL` anywhere. In addition `n_download_sources` is only ever 1 or 0.","created_at":"2016-06-17T21:15:14Z","updated_at":"2016-06-17T21:15:14Z","html_url":"https://github.com/endlessm/eos-updater/pull/37#discussion_r67576662","pull_request_url":"https://api.github.com/repos/endlessm/eos-updater/pulls/37","_links":{"self":{"href":"https://api.github.com/repos/endlessm/eos-updater/pulls/comments/67576662"},"html":{"href":"https://github.com/endlessm/eos-updater/pull/37#discussion_r67576662"},"pull_request":{"href":"https://api.github.com/repos/endlessm/eos-updater/pulls/37"}}},"pull_request":{"url":"https://api.github.com/repos/endlessm/eos-updater/pulls/37","id":72008936,"html_url":"https://github.com/endlessm/eos-updater/pull/37","diff_url":"https://github.com/endlessm/eos-updater/pull/37.diff","patch_url":"https://github.com/endlessm/eos-updater/pull/37.patch","issue_url":"https://api.github.com/repos/endlessm/eos-updater/issues/37","number":37,"state":"open","locked":false,"title":"LAN client and server, tests","user":{"login":"krnowak","id":96081,"avatar_url":"https://avatars.githubusercontent.com/u/96081?v=3","gravatar_id":"","url":"https://api.github.com/users/krnowak","html_url":"https://github.com/krnowak","followers_url":"https://api.github.com/users/krnowak/followers","following_url":"https://api.github.com/users/krnowak/following{/other_user}","gists_url":"https://api.github.com/users/krnowak/gists{/gist_id}","starred_url":"https://api.github.com/users/krnowak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/krnowak/subscriptions","organizations_url":"https://api.github.com/users/krnowak/orgs","repos_url":"https://api.github.com/users/krnowak/repos","events_url":"https://api.github.com/users/krnowak/events{/privacy}","received_events_url":"https://api.github.com/users/krnowak/received_events","type":"User","site_admin":false},"body":"Sorry about the code-droppy nature of this PR. The commits are basically per file as the work grew a bit. The changes done are:\r\n\r\n- add eos-updater daemon config\r\n  - for now it only has the \"Download\" group with an \"Order\" field being a comma-separated list of download sources in order of preference (currently the only possible values are \"lan\" and \"main\").\r\n- add polling for updates on LAN\r\n  - it starts EosAvahiDiscoverer to get the list of servers\r\n  - there are two versions of txt records possible:\r\n    - version 1 is mostly for servers that do not have signed branch file, so in txt records it contains:\r\n      - sha512sum of the branch file\r\n      - download time of the branch file from the main server\r\n      - ostree path\r\n    - version 2 is for the servers that do have signed branch file, so in txt records it contains:\r\n      - ostree path (should be exposed in a branch file too, so we can verify it, not yet implemented)\r\n      - branch file timestamp (verified against a timestamp in the branch file)\r\n    - version 2 does not expose hashed sum in txt records, \r\n      - signature serves the role of the hash checksum\r\n      - branch file has the new \"UnixUTCTimestamp\" field in the \"main\" group\r\n      - branch file would have the new \"OstreePath\" field in the \"main\" group, not implemented\r\n  - once the services are discovered, it downloads the newest branch file\r\n    - signed branch files are preferred over the unsigned ones, \r\n    - for version 1 of txt records we skip downloading the branch file if the timestamp was older or the sha512sum was the same\r\n    - if there are no signed branch files, we search the newest unsigned one\r\n  - it processes the branch file to learn about OstreeRef for the device\r\n    - if OnHold field is set to true, we stop the update\r\n  - it downloads ref->commit information from every service to learn what commit they have for upgrade\r\n    - this might be a lot of churn, maybe ref->commit information should be exposed in avahi txt records too?\r\n  - it filters the services so it has a list of services that offer the newest commit\r\n  - it prepares the update info and the metrics info\r\n- update polling from the main server\r\n  - now it can download the signature of the branch file\r\n  - it queries the main server about the latest commit from the ref->commit mapping\r\n  - it prepares the update info and the metrics info\r\n- update fetching the update\r\n  - the update info prepared in poll stage contains an optional list of url overrides\r\n  - the url actually used for fetching the updates is selected randomly \r\n- update applying the update\r\n  - store the extra files in ostree repo's extensions directory\r\n    - this is basically /ostree/repo/extensions/eos\r\n    - there we store the branch file with the signature and ref->commit mappings with signatures\r\n  - generate avahi service file\r\n- add LAN update server\r\n  - it serves the files in ostree repository\r\n    - repo config is faked to make ostree pull to believe it is pulling from archive-z2 repository\r\n    - refs/heads/\\<ref\\> are handled specially by serving /refs/remotes/\\<remote\\>/\\<ref\\>\r\n    - requests for /objects/\\<checksum\\>.filez are handled by zipping the objects with requested checksum on the fly\r\n    - rest of the files are served as is\r\n  - the server can listen on local port or on socket given to it by systemd\r\n  - the server shuts itself down after some period of inactivity\r\n- add some tests\r\n  - one is checking if updating from the main server works\r\n  - one is checking if updating from the lan server works","created_at":"2016-05-31T12:45:14Z","updated_at":"2016-06-17T21:15:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5bc567ac10b57e86d9b25da9f89e9d485ba8e99b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/endlessm/eos-updater/pulls/37/commits","review_comments_url":"https://api.github.com/repos/endlessm/eos-updater/pulls/37/comments","review_comment_url":"https://api.github.com/repos/endlessm/eos-updater/pulls/comments{/number}","comments_url":"https://api.github.com/repos/endlessm/eos-updater/issues/37/comments","statuses_url":"https://api.github.com/repos/endlessm/eos-updater/statuses/11801770675d6ec76b594a27f8212aa01541ce61","head":{"label":"kinvolk:krnowak/avahi","ref":"krnowak/avahi","sha":"11801770675d6ec76b594a27f8212aa01541ce61","user":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars.githubusercontent.com/u/14073052?v=3","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"repo":{"id":56606373,"name":"eos-updater","full_name":"kinvolk/eos-updater","owner":{"login":"kinvolk","id":14073052,"avatar_url":"https://avatars.githubusercontent.com/u/14073052?v=3","gravatar_id":"","url":"https://api.github.com/users/kinvolk","html_url":"https://github.com/kinvolk","followers_url":"https://api.github.com/users/kinvolk/followers","following_url":"https://api.github.com/users/kinvolk/following{/other_user}","gists_url":"https://api.github.com/users/kinvolk/gists{/gist_id}","starred_url":"https://api.github.com/users/kinvolk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kinvolk/subscriptions","organizations_url":"https://api.github.com/users/kinvolk/orgs","repos_url":"https://api.github.com/users/kinvolk/repos","events_url":"https://api.github.com/users/kinvolk/events{/privacy}","received_events_url":"https://api.github.com/users/kinvolk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/kinvolk/eos-updater","description":"System components of the OS Tree based updater","fork":true,"url":"https://api.github.com/repos/kinvolk/eos-updater","forks_url":"https://api.github.com/repos/kinvolk/eos-updater/forks","keys_url":"https://api.github.com/repos/kinvolk/eos-updater/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kinvolk/eos-updater/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kinvolk/eos-updater/teams","hooks_url":"https://api.github.com/repos/kinvolk/eos-updater/hooks","issue_events_url":"https://api.github.com/repos/kinvolk/eos-updater/issues/events{/number}","events_url":"https://api.github.com/repos/kinvolk/eos-updater/events","assignees_url":"https://api.github.com/repos/kinvolk/eos-updater/assignees{/user}","branches_url":"https://api.github.com/repos/kinvolk/eos-updater/branches{/branch}","tags_url":"https://api.github.com/repos/kinvolk/eos-updater/tags","blobs_url":"https://api.github.com/repos/kinvolk/eos-updater/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kinvolk/eos-updater/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kinvolk/eos-updater/git/refs{/sha}","trees_url":"https://api.github.com/repos/kinvolk/eos-updater/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kinvolk/eos-updater/statuses/{sha}","languages_url":"https://api.github.com/repos/kinvolk/eos-updater/languages","stargazers_url":"https://api.github.com/repos/kinvolk/eos-updater/stargazers","contributors_url":"https://api.github.com/repos/kinvolk/eos-updater/contributors","subscribers_url":"https://api.github.com/repos/kinvolk/eos-updater/subscribers","subscription_url":"https://api.github.com/repos/kinvolk/eos-updater/subscription","commits_url":"https://api.github.com/repos/kinvolk/eos-updater/commits{/sha}","git_commits_url":"https://api.github.com/repos/kinvolk/eos-updater/git/commits{/sha}","comments_url":"https://api.github.com/repos/kinvolk/eos-updater/comments{/number}","issue_comment_url":"https://api.github.com/repos/kinvolk/eos-updater/issues/comments{/number}","contents_url":"https://api.github.com/repos/kinvolk/eos-updater/contents/{+path}","compare_url":"https://api.github.com/repos/kinvolk/eos-updater/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kinvolk/eos-updater/merges","archive_url":"https://api.github.com/repos/kinvolk/eos-updater/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kinvolk/eos-updater/downloads","issues_url":"https://api.github.com/repos/kinvolk/eos-updater/issues{/number}","pulls_url":"https://api.github.com/repos/kinvolk/eos-updater/pulls{/number}","milestones_url":"https://api.github.com/repos/kinvolk/eos-updater/milestones{/number}","notifications_url":"https://api.github.com/repos/kinvolk/eos-updater/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kinvolk/eos-updater/labels{/name}","releases_url":"https://api.github.com/repos/kinvolk/eos-updater/releases{/id}","deployments_url":"https://api.github.com/repos/kinvolk/eos-updater/deployments","created_at":"2016-04-19T14:57:08Z","updated_at":"2016-04-19T14:57:08Z","pushed_at":"2016-06-14T12:48:36Z","git_url":"git://github.com/kinvolk/eos-updater.git","ssh_url":"git@github.com:kinvolk/eos-updater.git","clone_url":"https://github.com/kinvolk/eos-updater.git","svn_url":"https://github.com/kinvolk/eos-updater","homepage":null,"size":259,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"endlessm:master","ref":"master","sha":"2c569772f36a29189b9c36bff330c3648fb7dc95","user":{"login":"endlessm","id":1930958,"avatar_url":"https://avatars.githubusercontent.com/u/1930958?v=3","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"repo":{"id":13253303,"name":"eos-updater","full_name":"endlessm/eos-updater","owner":{"login":"endlessm","id":1930958,"avatar_url":"https://avatars.githubusercontent.com/u/1930958?v=3","gravatar_id":"","url":"https://api.github.com/users/endlessm","html_url":"https://github.com/endlessm","followers_url":"https://api.github.com/users/endlessm/followers","following_url":"https://api.github.com/users/endlessm/following{/other_user}","gists_url":"https://api.github.com/users/endlessm/gists{/gist_id}","starred_url":"https://api.github.com/users/endlessm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/endlessm/subscriptions","organizations_url":"https://api.github.com/users/endlessm/orgs","repos_url":"https://api.github.com/users/endlessm/repos","events_url":"https://api.github.com/users/endlessm/events{/privacy}","received_events_url":"https://api.github.com/users/endlessm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/endlessm/eos-updater","description":"System components of the OS Tree based updater","fork":false,"url":"https://api.github.com/repos/endlessm/eos-updater","forks_url":"https://api.github.com/repos/endlessm/eos-updater/forks","keys_url":"https://api.github.com/repos/endlessm/eos-updater/keys{/key_id}","collaborators_url":"https://api.github.com/repos/endlessm/eos-updater/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/endlessm/eos-updater/teams","hooks_url":"https://api.github.com/repos/endlessm/eos-updater/hooks","issue_events_url":"https://api.github.com/repos/endlessm/eos-updater/issues/events{/number}","events_url":"https://api.github.com/repos/endlessm/eos-updater/events","assignees_url":"https://api.github.com/repos/endlessm/eos-updater/assignees{/user}","branches_url":"https://api.github.com/repos/endlessm/eos-updater/branches{/branch}","tags_url":"https://api.github.com/repos/endlessm/eos-updater/tags","blobs_url":"https://api.github.com/repos/endlessm/eos-updater/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/endlessm/eos-updater/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/endlessm/eos-updater/git/refs{/sha}","trees_url":"https://api.github.com/repos/endlessm/eos-updater/git/trees{/sha}","statuses_url":"https://api.github.com/repos/endlessm/eos-updater/statuses/{sha}","languages_url":"https://api.github.com/repos/endlessm/eos-updater/languages","stargazers_url":"https://api.github.com/repos/endlessm/eos-updater/stargazers","contributors_url":"https://api.github.com/repos/endlessm/eos-updater/contributors","subscribers_url":"https://api.github.com/repos/endlessm/eos-updater/subscribers","subscription_url":"https://api.github.com/repos/endlessm/eos-updater/subscription","commits_url":"https://api.github.com/repos/endlessm/eos-updater/commits{/sha}","git_commits_url":"https://api.github.com/repos/endlessm/eos-updater/git/commits{/sha}","comments_url":"https://api.github.com/repos/endlessm/eos-updater/comments{/number}","issue_comment_url":"https://api.github.com/repos/endlessm/eos-updater/issues/comments{/number}","contents_url":"https://api.github.com/repos/endlessm/eos-updater/contents/{+path}","compare_url":"https://api.github.com/repos/endlessm/eos-updater/compare/{base}...{head}","merges_url":"https://api.github.com/repos/endlessm/eos-updater/merges","archive_url":"https://api.github.com/repos/endlessm/eos-updater/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/endlessm/eos-updater/downloads","issues_url":"https://api.github.com/repos/endlessm/eos-updater/issues{/number}","pulls_url":"https://api.github.com/repos/endlessm/eos-updater/pulls{/number}","milestones_url":"https://api.github.com/repos/endlessm/eos-updater/milestones{/number}","notifications_url":"https://api.github.com/repos/endlessm/eos-updater/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/endlessm/eos-updater/labels{/name}","releases_url":"https://api.github.com/repos/endlessm/eos-updater/releases{/id}","deployments_url":"https://api.github.com/repos/endlessm/eos-updater/deployments","created_at":"2013-10-01T19:23:58Z","updated_at":"2016-03-02T21:58:39Z","pushed_at":"2016-06-14T12:48:36Z","git_url":"git://github.com/endlessm/eos-updater.git","ssh_url":"git@github.com:endlessm/eos-updater.git","clone_url":"https://github.com/endlessm/eos-updater.git","svn_url":"https://github.com/endlessm/eos-updater","homepage":null,"size":234,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/endlessm/eos-updater/pulls/37"},"html":{"href":"https://github.com/endlessm/eos-updater/pull/37"},"issue":{"href":"https://api.github.com/repos/endlessm/eos-updater/issues/37"},"comments":{"href":"https://api.github.com/repos/endlessm/eos-updater/issues/37/comments"},"review_comments":{"href":"https://api.github.com/repos/endlessm/eos-updater/pulls/37/comments"},"review_comment":{"href":"https://api.github.com/repos/endlessm/eos-updater/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/endlessm/eos-updater/pulls/37/commits"},"statuses":{"href":"https://api.github.com/repos/endlessm/eos-updater/statuses/11801770675d6ec76b594a27f8212aa01541ce61"}}}}
{"actor":{"display_login":"smspillaz"}}