git-update: try updating cargo deps
authorGuillaume Desmottes <guillaume.desmottes@collabora.com>
Thu, 21 Nov 2019 10:40:32 +0000 (16:10 +0530)
committerGuillaume Desmottes <guillaume.desmottes@collabora.com>
Tue, 24 Dec 2019 09:38:02 +0000 (15:08 +0530)
May prevent build errors if a newer version gstreamer-rs or
gst-plugins-rs depend on an updated version of a git dependency.

git-update

index e578d74..0138fd9 100755 (executable)
@@ -117,6 +117,23 @@ def update_repo(repo_name, repo_dir, revision, no_interaction, fetch_args=[], re
     return True
 
 
+# Update gst-plugins-rs dependencies
+def update_cargo(build_dir):
+    cargo_toml = os.path.join('subprojects', 'gst-plugins-rs', 'Cargo.toml')
+    if not os.path.exists(cargo_toml):
+        return True
+
+    cmd = ['cargo', 'update', '--manifest-path', cargo_toml]
+
+    try:
+        ret = subprocess.run(cmd)
+    except FileNotFoundError:
+        # silenty ignore if cargo isn't installed
+        return False
+
+    return ret == 0
+
+
 if __name__ == "__main__":
     parser = argparse.ArgumentParser(prog="git-update")
 
@@ -157,6 +174,8 @@ if __name__ == "__main__":
     if not update_subprojects(repos_commits, options.no_interaction):
         exit(1)
 
+    update_cargo(options.builddir)
+
     if options.builddir:
         ninja = accept_command(["ninja", "ninja-build"])
         if not ninja: