summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlav Vitters <olav@vitters.nl>2020-05-06 17:43:52 +0200
committerOlav Vitters <olav@vitters.nl>2020-05-06 17:43:52 +0200
commit3c4d5cbd10dee0796147e00ca0edbc7221cbdf69 (patch)
tree3fd8af1c97fec50d206b5862ef5304a425859210
parent1cd76b321a2b35830dbb68dc8a63174f5e8ef9f7 (diff)
downloadmgagnome-3c4d5cbd10dee0796147e00ca0edbc7221cbdf69.tar
mgagnome-3c4d5cbd10dee0796147e00ca0edbc7221cbdf69.tar.gz
mgagnome-3c4d5cbd10dee0796147e00ca0edbc7221cbdf69.tar.bz2
mgagnome-3c4d5cbd10dee0796147e00ca0edbc7221cbdf69.tar.xz
mgagnome-3c4d5cbd10dee0796147e00ca0edbc7221cbdf69.zip
Package: add a ensure_checkout function and make use of it
-rwxr-xr-xmgagnome24
1 files changed, 14 insertions, 10 deletions
diff --git a/mgagnome b/mgagnome
index f20dccd..effc78b 100755
--- a/mgagnome
+++ b/mgagnome
@@ -1632,6 +1632,17 @@ class Package:
return os.path.join(path, "SPECS", "%s.spec" % self.name)
+ def ensure_checkout(self):
+ """Ensure that the package is checked out"""
+ if not os.path.exists(self.spec_path):
+ try:
+ package.checkout()
+ except subprocess.CalledProcessError:
+ print('WARNING: Cannot checkout package %s. Skipping.' % self.name, file=sys.stderr)
+ return False
+
+ return True
+
@retry(subprocess.CalledProcessError)
def checkout(self, cwd=None, spec_only=False):
"""Check out a package from the repository"""
@@ -1972,13 +1983,8 @@ def _cmd_clean_spec_multi(args):
package = Downstream.package(package_name)
cwd = package.path
- path = os.path.join(cwd, "SPECS", "%s.spec" % package_name)
- if not os.path.exists(path):
- try:
- package.checkout()
- except subprocess.CalledProcessError:
- print('WARNING: Cannot check package %s. Skipping.' % package_name, file=sys.stderr)
- return False
+ if not package.ensure_checkout():
+ return False
spec = package.spec
@@ -2017,11 +2023,9 @@ def _cmd_check_spec_multi(args):
package = Downstream.package(package_name)
cwd = package.path
- path = os.path.join(cwd, "SPECS", "%s.spec" % package_name)
- if not os.path.exists(path):
+ if not os.path.exists(package.spec_path):
return False
-
spec = package.spec
try:
spec.patches