debian-mirror-gitlab/app/models/packages/rpm/repository_file.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1,020 B
Ruby
Raw Normal View History

2022-11-25 23:54:43 +05:30
# frozen_string_literal: true
module Packages
module Rpm
class RepositoryFile < ApplicationRecord
include EachBatch
include UpdateProjectStatistics
include FileStoreMounter
include Packages::Installable
INSTALLABLE_STATUSES = [:default].freeze
2023-03-04 22:38:38 +05:30
FILELISTS_FILENAME = 'filelists.xml'
FILELISTS_SIZE_LIMITATION = 20.megabytes
2022-11-25 23:54:43 +05:30
enum status: { default: 0, pending_destruction: 1, processing: 2, error: 3 }
2023-05-27 22:25:52 +05:30
belongs_to :project, inverse_of: :rpm_repository_files
2022-11-25 23:54:43 +05:30
validates :project, presence: true
validates :file, presence: true
validates :file_name, presence: true
mount_file_store_uploader Packages::Rpm::RepositoryFileUploader
update_project_statistics project_statistics_name: :packages_size
2023-03-04 22:38:38 +05:30
def self.has_oversized_filelists?(project_id:)
where(
project_id: project_id,
file_name: FILELISTS_FILENAME,
size: [FILELISTS_SIZE_LIMITATION..]
).exists?
end
2022-11-25 23:54:43 +05:30
end
end
end