[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [dockerfiles PATCH 3/4] refresh: Look for project with startswith()



Using rfind() makes sense when we're looking for CROSS, since
we don't know exactly where it will be, but when looking for
the project we know it will be at the very beginning of the
string so we should check accordingly.

Signed-off-by: Andrea Bolognani <abologna redhat com>
---
 refresh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/refresh b/refresh
index b26a9f3..f89b836 100755
--- a/refresh
+++ b/refresh
@@ -66,9 +66,9 @@ class Dockerfile:
         project_name = None
 
         for project in Dockerfile.PROJECTS:
-            if stem.rfind(project + "-") >= 0:
+            if stem.startswith(project + "-"):
+                stem = stem[len(project) + 1:]
                 project_name = project
-                stem = stem[len(project_name) + 1:]
                 break
 
         if not project_name:
-- 
2.21.0


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]