Class: GitMaintain::RDMACoreRepo

Inherits:
Repo
  • Object
show all
Defined in:
lib/addons/RDMACore.rb

Constant Summary collapse

AZURE_MIN_VERSION =
18
ACTION_LIST =
Repo::ACTION_LIST + [ :create_stable ]
ACTION_HELP =
{
    :create_stable => "Create a stable branch from a release tag"
}.merge(Repo::ACTION_HELP)

Instance Attribute Summary

Attributes inherited from Repo

#name, #path, #remote_stable, #remote_valid, #stable_repo, #valid_repo

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Repo

#api, #createRelease, execAction, #findStableBase, #find_alts, #genReleaseNotif, #getBranchList, #getCommitHeadline, #getCommitSubj, #getGitConfig, #getStableBranchList, #getSuffixList, #getUnreleasedTags, #get_new_token, #initialize, #list_branches, #list_suffixes, load, #log, #run, #runBash, #runGit, #runGitImap, #runGitInteractive, #runSystem, #stableUpdate, #submit_release, #summary, #token, #versionToLocalBranch, #versionToStableBranch

Constructor Details

This class inherits a constructor from GitMaintain::Repo

Class Method Details

.check_opts(opts) ⇒ Object



156
157
158
159
160
161
162
163
164
165
166
# File 'lib/addons/RDMACore.rb', line 156

def self.check_opts(opts)
    case opts[:action]
        when :create_stable
        if opts[:version].to_s() == "" then
            raise "Action #{opts[:action]} requires a branch number to be specified"
        end
         if opts[:br_suff] != "master" then
            raise "Action #{opts[:action]} can only be done on 'master' suffixed branches"
        end
   end
end

.set_opts(action, optsParser, opts) ⇒ Object



145
146
147
148
149
150
151
152
153
154
155
# File 'lib/addons/RDMACore.rb', line 145

def self.set_opts(action, optsParser, opts)
    case action
    when :create_stable then
        optsParser.on("-V", "--version [NUM]", Integer,
                      "Specify which version to use to create the stable branch.") {
        |val| opts[:version] = val}
        optsParser.on("-S", "--skip",
                      "Skip docker image generation") {
        |val| opts[:skip_docker] = true}
    end
end

Instance Method Details

#create_stable(opts) ⇒ Object



167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# File 'lib/addons/RDMACore.rb', line 167

def create_stable(opts)
    ver = opts[:version].to_s()
    suff = opts[:br_suff]
    if getBranchList(suff).index(ver) != nil then
        raise("Local branch already exists for version #{ver}")
    end
    br = versionToLocalBranch(ver, suff)
    full_ver = ver.gsub(/([0-9]+)/, @stable_base_format)
    runGit("checkout -B #{br} #{full_ver}")
    cmdList = `awk '/\`\`\`/{p=!p; next};p' Documentation/stable.md`.chomp().split("\n")
    if opts[:skip_docker] == true then
        cmdList = cmdList.map(){|x| x if x !~ /build-images/}.compact()
    end
    cmdList = cmdList.map(){|x| (x !~ /pkg azp/) ? x : (x + " || true") }.compact()
    cmdList << "./buildlib/cbuild pkg azp"

    toDo=cmdList.join("&&")
    runSystem(toDo)
    raise("Fail to run stable creation code") if $? != 0
end

#submitReleases(opts, new_tags) ⇒ Object



136
137
138
139
140
141
142
143
# File 'lib/addons/RDMACore.rb', line 136

def submitReleases(opts, new_tags)
    new_tags.each(){|tag|
        next if tag !~ /v([0-9]*)\.[0-9]*/
        major=$1.to_i
        # Starting from v27, do not create the github release ourself as this is done by Azure
        createRelease(opts, tag, major < AZURE_MIN_VERSION)
    }
end