diff options
author | Javier Jardón <jjardon@gnome.org> | 2016-10-12 08:24:16 +0000 |
---|---|---|
committer | Javier Jardón <jjardon@gnome.org> | 2016-10-12 08:24:35 +0000 |
commit | 36f7e4923ae5d03dd345d74f7fcade48c99a498d (patch) | |
tree | b4b91a6df40ca846422def1045fe20db464d7312 /extensions/ostree.write | |
parent | e3a0c6c3881728c0c1699ab1500fb1d3d488300c (diff) | |
download | definitions-36f7e4923ae5d03dd345d74f7fcade48c99a498d.tar.gz |
Revert "Add ostree.write deployment extension"
Deployment of the minimal system broke after applying this
This reverts commit 5bca5fc3e8215601d1e2d33ce31f6a41c4bcfcc9.
Change-Id: Ibbc7cd24e10adec207ccb9848985c301974dca6b
Diffstat (limited to 'extensions/ostree.write')
-rw-r--r-- | extensions/ostree.write | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/extensions/ostree.write b/extensions/ostree.write deleted file mode 100644 index b2b5d6e1..00000000 --- a/extensions/ostree.write +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/python -# Copyright (C) 2015 Codethink Limited -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program. If not, see <http://www.gnu.org/licenses/>. - - -'''A Baserock write extension for deploying to OSTree repositories.''' - - -from gi.repository import GLib -from gi.repository import Gio -from gi.repository import OSTree - -import os -import subprocess -import tempfile -import urlparse - -import writeexts - - -def ostree_repo_resolve_rev(repo, branch, allow_noent=True): - '''Return the SHA256 corresponding to 'branch'.''' - return repo.resolve_rev(branch, allow_noent)[1] - - -def ostree_repo_commit_tree(repo, tree_dir, branch, commit_subject, - commit_body=''): - '''Commit the contents of 'tree_dir' to 'branch'.''' - - repo.prepare_transaction(None) - - parent = ostree_repo_resolve_rev(repo, branch) - - ostree_mtree = OSTree.MutableTree() - tree_dir_gfile = Gio.file_new_for_path(tree_dir) - repo.write_directory_to_mtree(tree_dir_gfile, ostree_mtree, None, None) - - root = repo.write_mtree(ostree_mtree, None)[1] - checksum = repo.write_commit( - parent, commit_subject, commit_body, None, root, None)[1] - - repo.transaction_set_ref(None, branch, checksum) - - stats = repo.commit_transaction(None) - return stats - - -class OSTreeWriteExtension(writeexts.WriteExtension): - '''See ostree.write.help for documentation.''' - - def process_args(self, args): - if len(args) != 2: - raise writeexts.ExtensionError( - 'Wrong number of command line args') - - temp_root, location = args - - repo = OSTree.Repo.new(Gio.File.new_for_path(location)) - repo.open() - - branch = os.environ.get('OSTREE_BRANCH') - commit_subject = os.environ.get('OSTREE_COMMIT_SUBJECT') - commit_body = os.environ.get('OSTREE_COMMIT_BODY') - - try: - ostree_repo_commit_tree(repo, temp_root, branch, commit_subject, commit_body) - except GLib.GError as e: - raise writeexts.ExtensionError( - '%s. Failed to commit system to repo %s.' % - (e.message, location)) - - self.status( - msg='Created commit on branch %s in OSTree repo at %s' % ( - branch, location)) - - -OSTreeWriteExtension().run() |