]> git.ipfire.org Git - people/jschlag/pbs.git/blobdiff - src/buildservice/packages.py
Allow checking if a certain file exists in a package
[people/jschlag/pbs.git] / src / buildservice / packages.py
index af2b4108fbace4136f2365fd4e654e067c25b7fb..266383b1f8d0cc04f1a3d1b3b91c3368c38155cb 100644 (file)
@@ -422,6 +422,13 @@ class Package(base.DataObject):
 
                return ret
 
+       def get_file(self, filename):
+               res = self.db.get("SELECT * FROM filelists \
+                       WHERE pkg_id = %s AND name = %s", self.id, filename)
+
+               if res:
+                       return File(self.backend, res)
+
        def add_file(self, name, size, hash_sha512, type, config, mode, user, group, mtime, capabilities):
                # Convert mtime from seconds since epoch to datetime
                mtime = datetime.datetime.utcfromtimestamp(float(mtime))
@@ -430,7 +437,7 @@ class Package(base.DataObject):
                        \"user\", \"group\", mtime, capabilities) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
                        self.id, name, size, hash_sha512, type, config, mode, user, group, mtime, capabilities)
 
-       def get_file(self):
+       def open(self):
                path = os.path.join(PACKAGES_DIR, self.path)
 
                if os.path.exists(path):