Module: Backend::Api::Sources::Package

Extended by:
ConnectionHelper
Defined in:
api/sources/package.rb

Overview

Class that connect to endpoints related to source packages

Class Method Summary collapse

Class Method Details

.attributes(project, package, revision) ⇒ String

Returns the attributes content

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • revision (String)

    Revision hash/number.

Returns:

  • (String)

    The XML with the attributes content



13
14
15
16
17
# File 'api/sources/package.rb', line 13

def self.attributes(project, package, revision)
  params = { meta: 1 }
  params[:rev] = revision if revision
  get(["/source/:project/:package/_attribute", project, package || '_project'], params: params)
end

.copy(target_project, target_package, source_project, source_package, user, options = {}) ⇒ String

Copy a package into another project

Parameters:

  • target_project (String)

    Name of the target project.

  • target_package (String)

    Name of the target package.

  • source_project (String)

    Name of the source project.

  • source_package (String)

    Name of the source package.

  • user (String)

    Login of the user.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :keeplink (String)

    Stay on revision after copying.

  • :comment (String)

    Comment to attach to this operation.

  • :expand (String)

    Expand sources.

Returns:

  • (String)


116
117
118
119
120
# File 'api/sources/package.rb', line 116

def self.copy(target_project, target_package, source_project, source_package, user, options = {})
  post(["/source/:project/:package", target_project, target_package],
       defaults: { cmd: :copy, oproject: source_project, opackage: source_package, user: user },
       params: options, accepted: [:keeplink, :expand, :comment])
end

.file(project, package, filename) ⇒ String

Returns the content of the source file

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • filename (String)

    Name of the file.

Returns:

  • (String)

    The content of the file



163
164
165
# File 'api/sources/package.rb', line 163

def self.file(project, package, filename)
  get(["/source/:project/:package/:filename", project, package, filename])
end

.files(project, package, options = {}) ⇒ String

Returns a file list of the sources for a package

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • options (Hash) (defaults to: {})

    Parameters to pass to the backend.

Returns:

  • (String)

    The XML with the list of files



38
39
40
# File 'api/sources/package.rb', line 38

def self.files(project, package, options = {})
  get(["/source/:project/:package", project, package], params: options)
end

.merge_service(project, package, user) ⇒ String

Runs the command mergeservice for that project/package

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • user (String)

    Login of the user.

Returns:

  • (String)


93
94
95
# File 'api/sources/package.rb', line 93

def self.merge_service(project, package, user)
  post(["/source/:project/:package", project, package], params: { cmd: :mergeservice, user: user })
end

.meta(project, package) ⇒ String

Returns the meta file from a package

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

Returns:

  • (String)

    The content of the meta file



54
55
56
# File 'api/sources/package.rb', line 54

def self.meta(project, package)
  get(["/source/:project/:package/_meta", project, package])
end

.rebuild(project, package, options = {}) ⇒ String

Runs the command rebuild for that package

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :repository (String)

    Build only for that repository.

  • :arch (String)

    Build only for that architecture.

Returns:

  • (String)


154
155
156
# File 'api/sources/package.rb', line 154

def self.rebuild(project, package, options = {})
  post(["/build/:project", project], defaults: { cmd: :rebuild, package: package }, params: options, accepted: [:repository, :arch])
end

.revisions(project, package) ⇒ String

Returns the revisions (mrev) list for a package

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

Returns:

  • (String)

    The XML with the revisions list



46
47
48
# File 'api/sources/package.rb', line 46

def self.revisions(project, package)
  get(["/source/:project/:package/_history", project, package], params: { meta: 1, deleted: 1 })
end

.run_service(project, package, user) ⇒ String

Runs the command runservice for that project/package

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • user (String)

    Login of the user.

Returns:

  • (String)


102
103
104
# File 'api/sources/package.rb', line 102

def self.run_service(project, package, user)
  post(["/source/:project/:package", project, package], params: { cmd: :runservice, user: user })
end

.source_diff(project, package, options = {}) ⇒ String

Returns the source diff

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :rev (String)

    Revision Hash/Number.

  • :orev (String)

    Origin revision Hash/Number.

  • :opackage (String)

    Origin package name.

  • :oproject (String)

    Origin project name.

  • :linkrev (String)

    Use the revision of the linked package.

  • :olinkrev (String)

    Use the origin revision of the linked package.

  • :expand (String)

    Expand sources.

Returns:

  • (String)


143
144
145
146
# File 'api/sources/package.rb', line 143

def self.source_diff(project, package, options = {})
  post(["/source/:project/:package", project, package], defaults: { cmd: :diff, view: :xml, withissues: 1 },
       params: options, accepted: [:rev, :orev, :opackage, :oproject, :linkrev, :olinkrev, :expand])
end

.trigger_services(project, package, user) ⇒ String

It triggers all the services of a package

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • user (String)

    Login of the user.

Returns:

  • (String)


63
64
65
# File 'api/sources/package.rb', line 63

def self.trigger_services(project, package, user)
  post(["/source/:project/:package", project, package], params: { cmd: :runservice, user: user })
end

.wait_service(project, package) ⇒ String

Runs the command waitservice for that project/package

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

Returns:

  • (String)


84
85
86
# File 'api/sources/package.rb', line 84

def self.wait_service(project, package)
  post(["/source/:project/:package", project, package], params: { cmd: :waitservice })
end

.write_attributes(project, package, user, content, comment) ⇒ String

Writes the content in xml for attributes

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • user (String)

    Login of the user.

  • content (String)

    XML with the content to write.

  • comment (String)

    Comment to attach to this operation.

Returns:

  • (String)


26
27
28
29
30
31
# File 'api/sources/package.rb', line 26

def self.write_attributes(project, package, user, content, comment)
  params = { meta: 1, user: user }
  params[:comment] = comment if comment
  put(["/source/:project/:package/_attribute", project, package || '_project'],
      data: content, params: params)
end

.write_file(project, package, filename, content = '') ⇒ String

Writes the content of the source file

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • filename (String)

    Name of the file.

  • content (String) (defaults to: '')

    XML with the content to write.

Returns:

  • (String)


173
174
175
# File 'api/sources/package.rb', line 173

def self.write_file(project, package, filename, content = '')
  put(["/source/:project/:package/:filename", project, package, filename], data: content)
end

Writes the link information of a package

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • user (String)

    Login of the user.

  • content (String)

    XML with the content to write.

Returns:

  • (String)


128
129
130
# File 'api/sources/package.rb', line 128

def self.write_link(project, package, user, content)
  put(["/source/:project/:package/_link", project, package], data: content, params: { user: user })
end

.write_patchinfo(project, package, user, content, comment = nil) ⇒ String

Writes the patchinfo

Parameters:

  • project (String)

    Name of the project.

  • package (String)

    Name of the package.

  • user (String)

    Login of the user.

  • content (String)

    XML with the content to write.

  • comment (String) (defaults to: nil)

    Optional comment to attach to this operation.

Returns:

  • (String)


74
75
76
77
78
# File 'api/sources/package.rb', line 74

def self.write_patchinfo(project, package, user, content, comment = nil)
  params = { user: user }
  params[:comment] = comment if comment
  put(["/source/:project/:package/_patchinfo", project, package], data: content, params: params)
end