... |
... |
@@ -71,7 +71,7 @@ class OSTreeSource(Source): |
71
|
71
|
self.ref = self.node_get_member(node, str, 'ref', None)
|
72
|
72
|
self.tracking = self.node_get_member(node, str, 'track', None)
|
73
|
73
|
self.mirror = os.path.join(self.get_mirror_directory(),
|
74
|
|
- utils.url_directory_name(self.url))
|
|
74
|
+ utils.url_directory_name(self.original_url))
|
75
|
75
|
|
76
|
76
|
# (optional) Not all repos are signed. But if they are, get the gpg key
|
77
|
77
|
self.gpg_key_path = None
|
... |
... |
@@ -104,10 +104,11 @@ class OSTreeSource(Source): |
104
|
104
|
return None
|
105
|
105
|
|
106
|
106
|
self.ensure()
|
|
107
|
+ remote_name = self.ensure_remote(self.url)
|
107
|
108
|
with self.timed_activity("Fetching tracking ref '{}' from origin: {}"
|
108
|
109
|
.format(self.tracking, self.url)):
|
109
|
110
|
try:
|
110
|
|
- _ostree.fetch(self.repo, ref=self.tracking, progress=self.progress)
|
|
111
|
+ _ostree.fetch(self.repo, remote=remote_name, ref=self.tracking, progress=self.progress)
|
111
|
112
|
except OSTreeError as e:
|
112
|
113
|
raise SourceError("{}: Failed to fetch tracking ref '{}' from origin {}\n\n{}"
|
113
|
114
|
.format(self, self.tracking, self.url, e)) from e
|
... |
... |
@@ -116,11 +117,12 @@ class OSTreeSource(Source): |
116
|
117
|
|
117
|
118
|
def fetch(self):
|
118
|
119
|
self.ensure()
|
|
120
|
+ remote_name = self.ensure_remote(self.url)
|
119
|
121
|
if not _ostree.exists(self.repo, self.ref):
|
120
|
122
|
with self.timed_activity("Fetching remote ref: {} from origin: {}"
|
121
|
123
|
.format(self.ref, self.url)):
|
122
|
124
|
try:
|
123
|
|
- _ostree.fetch(self.repo, ref=self.ref, progress=self.progress)
|
|
125
|
+ _ostree.fetch(self.repo, remote=remote_name, ref=self.ref, progress=self.progress)
|
124
|
126
|
except OSTreeError as e:
|
125
|
127
|
raise SourceError("{}: Failed to fetch ref '{}' from origin: {}\n\n{}"
|
126
|
128
|
.format(self, self.ref, self.url, e)) from e
|
... |
... |
@@ -171,14 +173,22 @@ class OSTreeSource(Source): |
171
|
173
|
self.status("Creating local mirror for {}".format(self.url))
|
172
|
174
|
|
173
|
175
|
self.repo = _ostree.ensure(self.mirror, True)
|
174
|
|
- gpg_key = None
|
175
|
|
- if self.gpg_key_path:
|
176
|
|
- gpg_key = 'file://' + self.gpg_key_path
|
177
|
176
|
|
178
|
|
- try:
|
179
|
|
- _ostree.configure_remote(self.repo, "origin", self.url, key_url=gpg_key)
|
180
|
|
- except OSTreeError as e:
|
181
|
|
- raise SourceError("{}: Failed to configure origin {}\n\n{}".format(self, self.url, e)) from e
|
|
177
|
+ def ensure_remote(self, url):
|
|
178
|
+ if self.original_url == self.url:
|
|
179
|
+ remote_name = 'origin'
|
|
180
|
+ else:
|
|
181
|
+ remote_name = utils.url_directory_name(url)
|
|
182
|
+
|
|
183
|
+ gpg_key = None
|
|
184
|
+ if self.gpg_key_path:
|
|
185
|
+ gpg_key = 'file://' + self.gpg_key_path
|
|
186
|
+
|
|
187
|
+ try:
|
|
188
|
+ _ostree.configure_remote(self.repo, remote_name, url, key_url=gpg_key)
|
|
189
|
+ except OSTreeError as e:
|
|
190
|
+ raise SourceError("{}: Failed to configure origin {}\n\n{}".format(self, self.url, e)) from e
|
|
191
|
+ return remote_name
|
182
|
192
|
|
183
|
193
|
def progress(self, percent, message):
|
184
|
194
|
self.status(message)
|