/[smeserver]/rpms/anaconda/sme10/9800-rpmostreepayload-Rework-remote-add-handling.patch
ViewVC logotype

Annotation of /rpms/anaconda/sme10/9800-rpmostreepayload-Rework-remote-add-handling.patch

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Wed Jun 10 03:58:45 2020 UTC (4 years, 4 months ago) by jpp
Branch: MAIN
CVS Tags: anaconda-21_48_22_159-1_el7_centos, anaconda-21_48_22_158-1_el7_centos, HEAD
*** empty log message ***

1 jpp 1.1 diff -uNrp anaconda-21.48.22.121.orig/pyanaconda/packaging/rpmostreepayload.py anaconda-21.48.22.121/pyanaconda/packaging/rpmostreepayload.py
2     --- anaconda-21.48.22.121.orig/pyanaconda/packaging/rpmostreepayload.py 2017-06-21 12:44:34.000000000 +0000
3     +++ anaconda-21.48.22.121/pyanaconda/packaging/rpmostreepayload.py 2017-08-23 02:28:23.121006339 +0000
4     @@ -142,24 +142,25 @@ class RPMOSTreePayload(ArchivePayload):
5     ["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
6     "init-fs", iutil.getTargetPhysicalRoot()])
7    
8     - repo_arg = "--repo=" + iutil.getTargetPhysicalRoot() + '/ostree/repo'
9     + self._sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot())
10     + sysroot = OSTree.Sysroot.new(self._sysroot_path)
11     + sysroot.load(cancellable)
12     + repo = sysroot.get_repo(None)[1]
13     + # We don't support resuming from interrupted installs
14     + repo.set_disable_fsync(True)
15     +
16     + self._remoteOptions = {}
17    
18     - # Store this for use in postInstall too, where we need to
19     - # undo/redo this step.
20     - self._base_remote_args = ["remote", "add"]
21     + # Handle variations in pykickstart
22     if ((hasattr(ostreesetup, 'noGpg') and ostreesetup.noGpg) or
23     (hasattr(ostreesetup, 'nogpg') and ostreesetup.nogpg)):
24     - self._base_remote_args.append("--set=gpg-verify=false")
25     - self._base_remote_args.extend([ostreesetup.remote,
26     - ostreesetup.url])
27     - self._safeExecWithRedirect("ostree", [repo_arg] + self._base_remote_args)
28     + self._remoteOptions['gpg-verify'] = GLib.Variant('b', False)
29    
30     - self._sysroot_path = sysroot_path = Gio.File.new_for_path(iutil.getTargetPhysicalRoot())
31     - sysroot = OSTree.Sysroot.new(sysroot_path)
32     - sysroot.load(cancellable)
33     + repo.remote_change(None, OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS,
34     + ostreesetup.remote, ostreesetup.url,
35     + GLib.Variant('a{sv}', self._remoteOptions),
36     + cancellable)
37    
38     - repo = sysroot.get_repo(None)[1]
39     - repo.set_disable_fsync(True)
40     progressQ.send_message(_("Starting pull of %(branchName)s from %(source)s") % \
41     {"branchName": ostreesetup.ref, "source": ostreesetup.remote})
42    
43     @@ -192,6 +193,14 @@ class RPMOSTreePayload(ArchivePayload):
44     log.info("ostree pull: " + (progress.get_status() or ""))
45     progressQ.send_message(_("Preparing deployment of %s") % (ostreesetup.ref, ))
46    
47     + # Now that we have the data pulled, delete the remote for now.
48     + # This will allow a remote configuration defined in the tree
49     + # (if any) to override what's in the kickstart. Otherwise,
50     + # we'll re-add it in post. Ideally, ostree would support a
51     + # pull without adding a remote, but that would get quite
52     + # complex.
53     + repo.remote_delete(self.data.ostreesetup.remote, None)
54     +
55     self._safeExecWithRedirect("ostree",
56     ["admin", "--sysroot=" + iutil.getTargetPhysicalRoot(),
57     "os-init", ostreesetup.osname])
58     @@ -348,20 +357,30 @@ class RPMOSTreePayload(ArchivePayload):
59     from gi.repository import OSTree
60     cancellable = None
61    
62     - # Reload this data - we couldn't keep it open across
63     - # the remounts happening.
64     sysroot = OSTree.Sysroot.new(self._sysroot_path)
65     sysroot.load(cancellable)
66     repo = sysroot.get_repo(None)[1]
67    
68     - # This is an ugly hack - we didn't have /etc/ostree/remotes.d,
69     - # so the remote went into /ostree/repo/config. But we want it
70     - # in /etc, so delete that remote, then re-add it to
71     - # /etc/ostree/remotes.d, executing ostree inside the sysroot
72     - # so that it understands it's a "system repository" and should
73     - # modify /etc.
74     - repo.remote_delete(self.data.ostreesetup.remote, None)
75     - self._safeExecWithRedirect("ostree", self._base_remote_args, root=iutil.getSysroot())
76     + # CentOS specific patch (for now) - pull the remote config from usr/etc if it exists.
77     + # The OSTree handling here was buggy in that it wasn't looking in the sysroot
78     + # for existing remotes.
79     + default_remote_path = iutil.getSysroot() + '/usr/etc/ostree/remotes.d/' + self.data.ostreesetup.osname + '.conf'
80     + if os.path.isfile(default_remote_path):
81     + destpath = iutil.getSysroot() + '/etc/ostree/remotes.d/' + os.path.basename(default_remote_path)
82     + self._safeExecWithRedirect('cp', ['-r', '-p', default_remote_path, destpath])
83     + else:
84     + # Following up on the "remote delete" above, we removed the
85     + # remote from /ostree/repo/config. But we want it in /etc, so
86     + # re-add it to /etc/ostree/remotes.d, using the sysroot path.
87     + #
88     + # However, we ignore the case where the remote already exists,
89     + # which occurs when the content itself provides the remote
90     + # config file.
91     + repo.remote_change(Gio.File.new_for_path(iutil.getSysroot()),
92     + OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS,
93     + self.data.ostreesetup.remote, self.data.ostreesetup.url,
94     + GLib.Variant('a{sv}', self._remoteOptions),
95     + cancellable)
96    
97     boot = iutil.getSysroot() + '/boot'
98    

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed