Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-01-06 21:13:45 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-01-06 21:13:45 +0300
commitc38fb401d2e0348c0dbfd415c9818444dbe4951c (patch)
treeaee27d8fd8758356c73b6654011effa270eb0f3a /app/models/concerns/packages
parentf20be8802a40405885e9421417809438e5772bf5 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/concerns/packages')
-rw-r--r--app/models/concerns/packages/debian/distribution.rb9
-rw-r--r--app/models/concerns/packages/installable.rb16
2 files changed, 25 insertions, 0 deletions
diff --git a/app/models/concerns/packages/debian/distribution.rb b/app/models/concerns/packages/debian/distribution.rb
index ff52769fce8..3334cd69ed3 100644
--- a/app/models/concerns/packages/debian/distribution.rb
+++ b/app/models/concerns/packages/debian/distribution.rb
@@ -96,6 +96,15 @@ module Packages
architectures.pluck(:name).sort
end
+ def package_files
+ if Feature.enabled?(:packages_installable_package_files)
+ ::Packages::PackageFile.installable
+ .for_package_ids(packages.select(:id))
+ else
+ ::Packages::PackageFile.for_package_ids(packages.select(:id))
+ end
+ end
+
private
def unique_codename_and_suite
diff --git a/app/models/concerns/packages/installable.rb b/app/models/concerns/packages/installable.rb
new file mode 100644
index 00000000000..e9303e55412
--- /dev/null
+++ b/app/models/concerns/packages/installable.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+module Packages
+ # This module requires a status column.
+ # It also requires a constant INSTALLABLE_STATUSES. This should be
+ # an array that defines which values of the status column are
+ # considered as installable.
+ module Installable
+ extend ActiveSupport::Concern
+
+ included do
+ scope :with_status, ->(status) { where(status: status) }
+ scope :installable, -> { with_status(const_get(:INSTALLABLE_STATUSES, false)) }
+ end
+ end
+end