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

file_metadatum.rb « debian « packages « factories « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6b6cd9c51f3dbdeb7c2b210bdf2ace2f6f35f5c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# frozen_string_literal: true

FactoryBot.define do
  factory :debian_file_metadatum, class: 'Packages::Debian::FileMetadatum' do
    package_file do
      if file_type == 'unknown'
        association(:debian_package_file, :unknown, without_loaded_metadatum: true)
      else
        association(:debian_package_file, without_loaded_metadatum: true)
      end
    end

    file_type { 'deb' }
    component { 'main' }
    architecture { 'amd64' }
    fields { { 'a' => 'b' } }

    trait(:unknown) do
      file_type { 'unknown' }
      component { nil }
      architecture { nil }
      fields { nil }
    end

    trait(:source) do
      file_type { 'source' }
      component { 'main' }
      architecture { nil }
      fields { nil }
    end

    trait(:dsc) do
      file_type { 'dsc' }
      component { 'main' }
      architecture { nil }
      fields do
        {
          'Format' => '3.0 (native)',
          'Source' => package_file.package.name,
          'Binary' => 'sample-dev, libsample0, sample-udeb, sample-ddeb',
          'Architecture' => 'any',
          'Version' => package_file.package.version,
          'Maintainer' => "#{FFaker::Name.name} <#{FFaker::Internet.email}>",
          'Homepage' => FFaker::Internet.http_url,
          'Standards-Version' => '4.5.0',
          'Build-Depends' => 'debhelper-compat (= 13)',
          'Package-List' => <<~PACKAGELIST.rstrip,
          libsample0 deb libs optional arch=any
          sample-ddeb deb libs optional arch=any
          sample-dev deb libdevel optional arch=any
          sample-udeb udeb libs optional arch=any
          PACKAGELIST
          'Checksums-Sha1' => "\n4a9cb2a7c77a68dc0fe54ba8ecef133a7c949e9d 964 sample_1.2.3~alpha2.tar.xz",
          'Checksums-Sha256' =>
            "\nc9d05185ca158bb804977fa9d7b922e8a0f644a2da41f99d2787dd61b1e2e2c5 964 sample_1.2.3~alpha2.tar.xz",
          'Files' => "\nadc69e57cda38d9bb7c8d59cacfb6869 964 sample_1.2.3~alpha2.tar.xz"
        }
      end
    end

    trait(:deb) do
      file_type { 'deb' }
      component { 'main' }
      architecture { 'amd64' }
      fields do
        {
          'Package' => 'libsample0',
          'Source' => package_file.package.name,
          'Version' => package_file.package.version,
          'Architecture' => 'amd64',
          'Maintainer' => "#{FFaker::NameCN.name} #{FFaker::Name.name} <#{FFaker::Internet.email}>",
          'Installed-Size' => '7',
          'Section' => 'libs',
          'Priority' => 'optional',
          'Multi-Arch' => 'same',
          'Homepage' => FFaker::Internet.http_url,
          'Description' => <<~DESCRIPTION.rstrip
          Some mostly empty lib
          Used in GitLab tests.

          Testing another paragraph.
          DESCRIPTION
        }
      end
    end

    trait(:deb_dev) do
      file_type { 'deb' }
      component { 'main' }
      architecture { 'amd64' }
      fields do
        {
          'Package' => 'sample-dev',
          'Source' => "#{package_file.package.name} (#{package_file.package.version})",
          'Version' => '1.2.3~binary',
          'Architecture' => 'amd64',
          'Maintainer' => "#{FFaker::Name.name} <#{FFaker::Internet.email}>",
          'Installed-Size' => '7',
          'Depends' => 'libsample0 (= 1.2.3~binary)',
          'Section' => 'libdevel',
          'Priority' => 'optional',
          'Multi-Arch' => 'same',
          'Homepage' => FFaker::Internet.http_url,
          'Description' => <<~DESCRIPTION.rstrip
          Some mostly empty development files
          Used in GitLab tests.

          Testing another paragraph.
          DESCRIPTION
        }
      end
    end

    trait(:udeb) do
      file_type { 'udeb' }
      component { 'main' }
      architecture { 'amd64' }
      fields { { 'a' => 'b' } }
    end

    trait(:ddeb) do
      file_type { 'ddeb' }
      component { 'main' }
      architecture { 'amd64' }
      fields { { 'a' => 'b' } }
    end

    trait(:buildinfo) do
      file_type { 'buildinfo' }
      component { 'main' }
      architecture { nil }
      fields { { 'Architecture' => 'amd64 source' } }
    end

    trait(:changes) do
      file_type { 'changes' }
      component { nil }
      architecture { nil }
      fields { { 'Architecture' => 'source amd64' } }
    end
  end
end