From: Michael Tremer Date: Tue, 21 Jan 2025 10:51:16 +0000 (+0000) Subject: images: Split them off into their own module X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09fc2d307ffd27be7ec935b8a4d4ece368e35354;p=pbs.git images: Split them off into their own module Signed-off-by: Michael Tremer --- diff --git a/Makefile.am b/Makefile.am index 6aa4cae5..2de1c021 100644 --- a/Makefile.am +++ b/Makefile.am @@ -95,6 +95,7 @@ buildservice_PYTHON = \ src/buildservice/errors.py \ src/buildservice/events.py \ src/buildservice/httpclient.py \ + src/buildservice/images.py \ src/buildservice/jobs.py \ src/buildservice/keys.py \ src/buildservice/logstreams.py \ diff --git a/src/buildservice/distribution.py b/src/buildservice/distribution.py index 86151aea..63944fbc 100644 --- a/src/buildservice/distribution.py +++ b/src/buildservice/distribution.py @@ -367,26 +367,3 @@ class Distro(database.Base, database.BackendMixin, database.SoftDeleteMixin): # XXX create image jobs return release - - - -class Image(database.Base, database.BackendMixin, database.SoftDeleteMixin): - __tablename__ = "release_images" - - # ID - - id = Column(Integer, primary_key=True) - - # Release ID - - release_id = Column(Integer, ForeignKey("releases.id"), nullable=False) - - # Release - - release = sqlalchemy.orm.relationship( - "Release", foreign_keys=[release_id], lazy="selectin", - ) - - # Arch - - arch = Column(Text, nullable=False) diff --git a/src/buildservice/images.py b/src/buildservice/images.py new file mode 100644 index 00000000..9d8a407f --- /dev/null +++ b/src/buildservice/images.py @@ -0,0 +1,51 @@ +############################################################################### +# # +# Pakfire - The IPFire package management system # +# Copyright (C) 2025 Pakfire development team # +# # +# This program is free software: you can redistribute it and/or modify # +# it under the terms of the GNU General Public License as published by # +# the Free Software Foundation, either version 3 of the License, or # +# (at your option) any later version. # +# # +# This program is distributed in the hope that it will be useful, # +# but WITHOUT ANY WARRANTY; without even the implied warranty of # +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # +# GNU General Public License for more details. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +############################################################################### + +import logging + +import sqlalchemy +from sqlalchemy import Column, ForeignKey +from sqlalchemy import Integer, Text + +from . import database + +# Setup logging +log = logging.getLogger("pbs.images") + +class Image(database.Base, database.BackendMixin, database.SoftDeleteMixin): + __tablename__ = "release_images" + + # ID + + id = Column(Integer, primary_key=True) + + # Release ID + + release_id = Column(Integer, ForeignKey("releases.id"), nullable=False) + + # Release + + release = sqlalchemy.orm.relationship( + "Release", foreign_keys=[release_id], lazy="selectin", + ) + + # Arch + + arch = Column(Text, nullable=False)