]> git.ipfire.org Git - pbs.git/commitdiff
backend: Add helper function to make paths relative
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 11 Feb 2025 13:30:48 +0000 (13:30 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 11 Feb 2025 13:30:48 +0000 (13:30 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/buildservice/__init__.py

index f878b7a818b80249234a7577438c6ea1234e8677..3bb62632382021856fe005256dcf71022f71bf32 100644 (file)
@@ -160,6 +160,12 @@ class Backend(object):
                """
                return os.path.join(self.basepath, *args)
 
+       def relpath(self, path):
+               """
+                       Does the reverse of path()
+               """
+               return os.path.relpath(path, self.basepath)
+
        def url_to(self, url):
                """
                        Takes a relative URL and makes it absolute
@@ -595,10 +601,7 @@ class Backend(object):
 
                # Add all paths
                for path in paths:
-                       # Make the path relative (again)
-                       path = os.path.relpath(path, self.basepath)
-
-                       commandline.append("--include=%s***" % path)
+                       commandline.append("--include=%s***" % self.relpath(path))
 
                # Exclude everything that hasn't been included
                commandline += ("--include=*/", "--exclude=*")