ostbuild: Pull patches from specified patches git repository
We need to be more formal about where we get patches from, and more specifically what version. Let's assume they're also stored in a git repository that we fetch, instead of copying them from "wherever the manifest is". This meshes nicely with splitting between manifest.json and snapshot.json.
This commit is contained in:
parent
6890444f28
commit
d8eebaa2d1
|
|
@ -23,7 +23,8 @@
|
|||
"netfilter": "git:git://git.netfilter.org/",
|
||||
"cgwalters": "git:git://github.com/cgwalters/"},
|
||||
|
||||
"patches": {"src": "gnome:ostree"},
|
||||
"patches": {"src": "gnome:ostree",
|
||||
"prefix": "gnomeos/3.4"},
|
||||
|
||||
"components": [
|
||||
{"src": "cgwalters:ginitscripts"},
|
||||
|
|
|
|||
|
|
@ -140,8 +140,20 @@ class OstbuildBuild(builtins.Builtin):
|
|||
|
||||
patches = meta.get('patches')
|
||||
if patches is not None:
|
||||
patches_meta = self.manifest['patches']
|
||||
(patches_keytype, patches_uri) = buildutil.parse_src_key(patches_meta['src'])
|
||||
patches_mirror = buildutil.get_mirrordir(self.mirrordir, patches_keytype, patches_uri)
|
||||
vcs.get_vcs_checkout(self.mirrordir, patches_keytype, patches_uri,
|
||||
self.patchdir, patches_meta['branch'],
|
||||
overwrite=True)
|
||||
|
||||
patch_prefix = patches_meta.get('prefix', None)
|
||||
if patch_prefix is not None:
|
||||
patchdir = os.path.join(self.patchdir, patch_prefix)
|
||||
else:
|
||||
patchdir = self.patchdir
|
||||
for patch in patches:
|
||||
patch_path = os.path.join(self.patchdir, patch)
|
||||
patch_path = os.path.join(patchdir, patch)
|
||||
run_sync(['git', 'am', '--ignore-date', '-3', patch_path], cwd=component_src)
|
||||
|
||||
logdir = os.path.join(self.workdir, 'logs', 'compile', name)
|
||||
|
|
|
|||
|
|
@ -210,23 +210,10 @@ class OstbuildResolve(builtins.Builtin):
|
|||
self.manifest['components'] = self.resolved_components
|
||||
|
||||
out_snapshot = os.path.join(self.workdir, 'snapshot.json')
|
||||
patchdir = os.path.join(self.workdir, 'patches')
|
||||
if not os.path.isdir(patchdir):
|
||||
os.mkdir(patchdir)
|
||||
all_patches = {}
|
||||
for component in self.resolved_components:
|
||||
patches = component.get('patches', [])
|
||||
for patch in patches:
|
||||
all_patches[patch] = True
|
||||
for patch in all_patches:
|
||||
src = os.path.join(os.path.dirname(manifest_path),
|
||||
patch)
|
||||
dest = os.path.join(patchdir, patch)
|
||||
shutil.copy(src, dest)
|
||||
|
||||
f = open(out_snapshot, 'w')
|
||||
json.dump(self.manifest, f, indent=4, sort_keys=True)
|
||||
f.close()
|
||||
print "Created: %s, %d patches" % (out_snapshot, len(all_patches.keys()))
|
||||
print "Created: %s" % (out_snapshot, )
|
||||
|
||||
builtins.register(OstbuildResolve)
|
||||
|
|
|
|||
Loading…
Reference in New Issue