]>
git.proxmox.com Git - ceph.git/blob - ceph/src/arrow/dev/release/test-helper.rb
1 # Licensed to the Apache Software Foundation (ASF) under one
2 # or more contributor license agreements. See the NOTICE file
3 # distributed with this work for additional information
4 # regarding copyright ownership. The ASF licenses this file
5 # to you under the Apache License, Version 2.0 (the
6 # "License"); you may not use this file except in compliance
7 # with the License. You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing,
12 # software distributed under the License is distributed on an
13 # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 # KIND, either express or implied. See the License for the
15 # specific language governing permissions and limitations
24 require "rexml/document"
28 module CommandRunnable
29 class Error
< StandardError
32 def sh(*command_line
, check_result
: true)
33 if command_line
[0].is_a
?(Hash
)
34 env = command_line
.shift
38 stdout = Tempfile
.new("command-stdout.log")
39 stderr = Tempfile
.new("command-stderr.log")
40 success
= system(env, *command_line
, out
: stdout.path
, err
: stderr.path
)
43 message
= "Failed to run: #{command_line.join(" ")}\n"
44 message
<< "stdout:\n #{stdout.read}\n"
45 message
<< "stderr:\n #{stderr.read}"
54 include CommandRunnable
57 if args
[0].is_a
?(Hash
)
65 def git_current_commit
66 git("rev-parse", "HEAD").chomp
70 git("tags").lines(chomp
: true)
74 module VersionDetectable
76 top_dir
= Pathname(__dir__
).parent
.parent
77 cpp_cmake_lists
= top_dir
+ "cpp" + "CMakeLists.txt"
78 @snapshot_version = cpp_cmake_lists
.read
[/ARROW_VERSION "(.+?)"/, 1]
79 @release_version = @snapshot_version.gsub(/-SNAPSHOT\z/, "")
80 @so_version = compute_so_version(@release_version)
81 @next_version = @release_version.gsub(/\A\d+/) {|major
| major
.succ
}
82 @next_snapshot_version = "#{@next_version}-SNAPSHOT"
83 @next_so_version = compute_so_version(@next_version)
84 r_description
= top_dir
+ "r" + "DESCRIPTION"
85 @previous_version = r_description
.read
[/^Version: (.+?)\.9000$/, 1]
88 def compute_so_version(version)
89 major
, minor
, _patch
= version.split(".")
90 Integer(major
, 10) * 100 + Integer(minor
, 10)
93 def on_release_branch
?
94 @snapshot_version == @release_version