git-maintain 0.9.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 868f7d13ca258e469a2a32f892646f22486c006b2dd6cdd927a8df4ee349aaaf
4
- data.tar.gz: ee9fabe23d3918015bd195d67ca36d528dba9d993574749134e338143d06429f
3
+ metadata.gz: 3f55eb06d04154df930e2e69d85b4d0d3b882361681f2d70a2acc503dc9abfad
4
+ data.tar.gz: 6d4597f517459cf6304ca419ef7b4897b894c032200f311a1efd549524fc13ba
5
5
  SHA512:
6
- metadata.gz: 306f260c676c76fc85d2bf87b797e3e8831cdcdd5fb0d847f3d7515e6b68ca35d271dd2348d6b1f850300c22a806be344b8eeeac382e9ed02ab19d3dabe18aab
7
- data.tar.gz: c7a5aae40d1ab800006f6bc8aa9674eaced5a9acc5ec92a71e338d85a75e9e19768dce0be894b3a846c7976a5b2df189292c2973d31c86aadf0e9a9fdbd66a4e
6
+ metadata.gz: 9363ed5154f62cef4ac12ee4a1599c108f48bd192dcaea8154cbf4b0db3f80eda06baf8972f39986d8870b6cf5c812ad6877d0fd75c24eb594e4f9e96dc53731
7
+ data.tar.gz: 97d60ac6e78bec2d3c8c6233e99412f4941c1e9fed9f69f1ce9acc923e9f3060279c9a82d7dd6f50a66b6c50c6799c0d686e86aeaec984b8fe704e018497f3d9
data/CHANGELOG CHANGED
@@ -1,3 +1,32 @@
1
+ ------------------
2
+ 0.12.0 (2025-09-11)
3
+ ------------------
4
+
5
+ * Cleanup code for Addons releases
6
+ * Replace all egrep calls with grep -E
7
+ * Replace $? handling with Exceptions
8
+ * Various minor fixes
9
+ * Drop obsolete Travis CI code
10
+
11
+ ------------------
12
+ 0.11.0 (2025-04-15)
13
+ ------------------
14
+
15
+ * Add github workflow for CI and publishing released rubygems
16
+
17
+ ------------------
18
+ 0.10.0 (2025-04-15)
19
+ ------------------
20
+
21
+ * Fix and extend CI
22
+ * Add addons info in general help and repo summary
23
+ * Add ENV var to point to custom addons
24
+ * Addons updates
25
+ * Set PS1_WARNING to help dealing with subshell status
26
+ * Azure fixes
27
+ * Remove list_stable, monitor_stable, push_stable commands. Replace with --stable option of the regular ones
28
+ * Add pull command
29
+
1
30
  ------------------
2
31
  0.9.0 (2022-10-18)
3
32
  ------------------
data/README.md CHANGED
@@ -13,12 +13,9 @@ The idea is to script most of the maintenance tasks so the maintainer can focus
13
13
  - **delete**: Delete all local branches using the suffix
14
14
  - **steal**: Steal commit from upstream that fixes commit in the branch or were tagged as stable
15
15
  - **list**: List commit present in the branch but not in the stable branch
16
- - **list_stable**: List commit present in the stable branch but not in the latest associated relase
17
16
  - **merge**: Merge branch with suffix specified in -m <suff> into the main branch
18
17
  - **push**: Push branches to github for validation
19
18
  - **monitor**: Check the CI state of all branches
20
- - **push_stable**: Push to stable repo
21
- - **monitor_stable**: Check the CI state of all stable branches
22
19
  - **release**: Create new release on all concerned branches
23
20
  - **reset**: Reset branch against upstream
24
21
  - **submit_release**: Push the to stable and create the release packages
@@ -167,7 +164,7 @@ Some time later, check their status
167
164
 
168
165
  If everything looks good, push to the stable repo
169
166
 
170
- ```git maintain push_stable --version '1[789]'```
167
+ ```git maintain push --stable --version '1[789]'```
171
168
 
172
169
  If patches have been sent to the ML but are not yet accepted, I usually try them out on a "pending" branch.
173
170
 
@@ -225,6 +222,11 @@ To run:
225
222
  Once some work has been done, it is time for a new release.
226
223
 
227
224
  First, unless you're working for the rdma-core repo, you'll need to add your own 'add-on' class to do automatize tyour release process. Please look at 'addons/RDMACore.rb' for an example.
225
+ Addons should be '.rb' file placed either in the same directory as pre-installed addons, or in a directory pointed to by the environment variable GIT_MAINTAIN_ADDON_DIR.
226
+
227
+ To list available addons, run:
228
+
229
+ ```git maintain -h```
228
230
 
229
231
  Then all you need to do is create your release(s)
230
232
 
@@ -232,16 +234,16 @@ Then all you need to do is create your release(s)
232
234
 
233
235
  This will run your addon code. What you usually want to do in there is create a tag and eventually bump version numbers, add releases notes, etc.
234
236
 
235
- I strongly advise here to then use the 'push_stable' command. It will update the branches, but NOT push the tag.
237
+ I strongly advise here to then use the 'push --stable' command. It will update the branches, but NOT push the tag.
236
238
  This means that if something has been broken by the release commit (if any), there is still time to fix it.
237
239
 
238
240
  The tag will not have been propagated anywhere else and can be deleted manually.
239
241
 
240
- ```git maintain push_stable --version '1[789]'```
242
+ ```git maintain push --stable --version '1[789]'```
241
243
 
242
244
  You can then monitor the status on CI
243
245
 
244
- ```git maintain monitor_stable --version '1[789]'```
246
+ ```git maintain monitor --stable --version '1[789]'```
245
247
 
246
248
 
247
249
  Once everything is green, it is time to submit your release
data/bin/git-maintain CHANGED
@@ -23,6 +23,15 @@ actionParser.separator "Possible actions:"
23
23
  ACTION_HELPS.each(){|k, x|
24
24
  actionParser.separator "\t * " + k.to_s() + ": " + x
25
25
  }
26
+ custom_classes = GitMaintain::getCustomClasses()
27
+ if custom_classes.length > 0 then
28
+ actionParser.separator "Custom repo addons available:"
29
+ custom_classes.each(){|k, x|
30
+ actionParser.separator "\t * " + k.to_s()
31
+ }
32
+
33
+ end
34
+
26
35
  rest = actionParser.order!(ARGV);
27
36
  if rest.length <= 0 then
28
37
  STDERR.puts("Error: No action provided")
@@ -1,13 +1,13 @@
1
1
  export _GIT_MAINTAIN_CMD_AWK=$(([ -f /bin/awk ] && echo "/bin/awk") || echo "/usr/bin/awk")
2
2
  export _GIT_MAINTAIN_CMD_SORT=$(([ -f /bin/sort ] && echo "/bin/sort") || echo "/usr/bin/sort")
3
- export _GIT_MAINTAIN_CMD_EGREP=$(([ -f /bin/egrep ] && echo "/bin/egrep") || echo "/usr/bin/egrep")
3
+ export _GIT_MAINTAIN_CMD_GREP=$(([ -f /bin/grep ] && echo "/bin/grep") || echo "/usr/bin/grep")
4
4
  export _GIT_MAINTAIN_CMD_SED=$(([ -f /bin/sed ] && echo "/bin/sed") || echo "/usr/bin/sed")
5
5
 
6
6
  _git_maintain_genoptlist(){
7
7
  local COMMAND=$*
8
8
  ${COMMAND} --help 2>&1 | \
9
9
  ${_GIT_MAINTAIN_CMD_AWK} 'BEGIN { found = 0 } { if(found == 1) print $$0; if($$1 == "Options:") {found = 1}}' | \
10
- ${_GIT_MAINTAIN_CMD_EGREP} -e "^[[:space:]]*--" -e "^[[:space:]]*-[a-zA-Z0-9]" | \
10
+ ${_GIT_MAINTAIN_CMD_GREP} -E -e "^[[:space:]]*--" -e "^[[:space:]]*-[a-zA-Z0-9]" | \
11
11
  ${_GIT_MAINTAIN_CMD_SED} -e 's/^[[:space:]]*//' -e 's/^-[^-], //' | \
12
12
  ${_GIT_MAINTAIN_CMD_AWK} '{ print $1}' | \
13
13
  ${_GIT_MAINTAIN_CMD_SED} -e 's/^\(.*\)\[no-\]\(.*$\)/\1\2\n\1no-\2/' | \
@@ -2,6 +2,10 @@ module GitMaintain
2
2
  class RDMACoreBranch < Branch
3
3
  REPO_NAME = "rdma-core"
4
4
  AZURE_MIN_VERSION = 18
5
+ ACTION_LIST = Branch::ACTION_LIST + [ :validate ]
6
+ ACTION_HELP = {
7
+ :validate => "Validate that branch still builds"
8
+ }.merge(Branch::ACTION_HELP)
5
9
 
6
10
  def self.set_opts(action, optsParser, opts)
7
11
  opts[:rel_type] = nil
@@ -28,7 +32,7 @@ module GitMaintain
28
32
  end
29
33
  end
30
34
  def release(opts)
31
- prev_ver=@repo.runGit("show HEAD:CMakeLists.txt | egrep \"[sS][eE][tT]\\\\(PACKAGE_VERSION\"").
35
+ prev_ver=@repo.runGit("show HEAD:CMakeLists.txt | grep -E \"[sS][eE][tT]\\\\(PACKAGE_VERSION\"").
32
36
  chomp().gsub(/[sS][eE][tT]\(PACKAGE_VERSION\s*"([0-9.]*)".*$/, '\1')
33
37
  ver_nums = prev_ver.split(".")
34
38
  new_ver = (ver_nums[0 .. -2] + [ver_nums[-1].to_i() + 1 ]).join(".")
@@ -45,8 +49,9 @@ module GitMaintain
45
49
 
46
50
  git_prev_ver = "v" + prev_ver
47
51
  # Older tags might do have the terminal minor version (.0) for major releases
48
- @repo.runGit("rev-parse --verify --quiet #{git_prev_ver}")
49
- if $? != 0 then
52
+ begin
53
+ @repo.ref_exist?(git_prev_ver)
54
+ rescue NoRefError
50
55
  # Try without the minor version number
51
56
  git_prev_ver = "v" + ver_nums[0 .. -2].join(".")
52
57
  end
@@ -76,10 +81,7 @@ module GitMaintain
76
81
 
77
82
  if opts[:rel_type] == :major
78
83
  # For major, tag the current version first
79
- @repo.runGitInteractive("tag -a -s v#{rel_ver} #{edit_flag} -F #{tag_path}")
80
- if $? != 0 then
81
- raise("Failed to tag branch #{local_branch}")
82
- end
84
+ release_do_tag(opts, "v" + rel_ver, tag_path)
83
85
  end
84
86
 
85
87
  # Update version number in relevant files
@@ -103,23 +105,30 @@ mv debian/changelog.new debian/changelog")
103
105
  end
104
106
 
105
107
  # Add and commit
106
- @repo.runGit("add */*.spec CMakeLists.txt debian/changelog")
107
- @repo.runGitInteractive("commit -m '#{commit_msg} #{new_ver}' --verbose #{edit_flag} --signoff")
108
- if $? != 0 then
109
- raise("Failed to commit on branch #{local_branch}")
110
- end
108
+ release_do_add_commit(opts, [ "*/*.spec", "CMakeLists.txt", "debian/changelog" ],
109
+ new_ver, nil, "#{commit_msg} #{new_ver}")
111
110
 
112
111
  if opts[:rel_type] == :stable
113
- @repo.runGitInteractive("tag -a -s v#{rel_ver} #{edit_flag} -F #{tag_path}")
114
- if $? != 0 then
115
- raise("Failed to tag branch #{local_branch}")
116
- end
112
+ release_do_tag(opts, rel_ver, tag_path)
117
113
  end
118
114
  `rm -f #{tag_path}`
115
+ return 0
116
+ end
117
+ def validate(opts)
118
+ begin
119
+ @repo.runSystem("rm -Rf build/ && mkdir build/ && cd build/ && cmake .. && make -j")
120
+ rescue RuntimeError
121
+ raise("Validation failure")
122
+ end
119
123
  end
120
124
  end
121
125
  class RDMACoreRepo < Repo
122
126
  AZURE_MIN_VERSION = 18
127
+ ACTION_LIST = Repo::ACTION_LIST + [ :create_stable ]
128
+ ACTION_HELP = {
129
+ :create_stable => "Create a stable branch from a release tag"
130
+ }.merge(Repo::ACTION_HELP)
131
+
123
132
  def submitReleases(opts, new_tags)
124
133
  new_tags.each(){|tag|
125
134
  next if tag !~ /v([0-9]*)\.[0-9]*/
@@ -128,6 +137,52 @@ mv debian/changelog.new debian/changelog")
128
137
  createRelease(opts, tag, major < AZURE_MIN_VERSION)
129
138
  }
130
139
  end
140
+
141
+ def self.set_opts(action, optsParser, opts)
142
+ case action
143
+ when :create_stable then
144
+ optsParser.on("-V", "--version [NUM]", Integer,
145
+ "Specify which version to use to create the stable branch.") {
146
+ |val| opts[:version] = val}
147
+ optsParser.on("-S", "--skip",
148
+ "Skip docker image generation") {
149
+ |val| opts[:skip_docker] = true}
150
+ end
151
+ end
152
+ def self.check_opts(opts)
153
+ case opts[:action]
154
+ when :create_stable
155
+ if opts[:version].to_s() == "" then
156
+ raise "Action #{opts[:action]} requires a branch number to be specified"
157
+ end
158
+ if opts[:br_suff] != "master" then
159
+ raise "Action #{opts[:action]} can only be done on 'master' suffixed branches"
160
+ end
161
+ end
162
+ end
163
+ def create_stable(opts)
164
+ ver = opts[:version].to_s()
165
+ suff = opts[:br_suff]
166
+ if getBranchList(suff).index(ver) != nil then
167
+ raise("Local branch already exists for version #{ver}")
168
+ end
169
+ br = versionToLocalBranch(ver, suff)
170
+ full_ver = ver.gsub(/([0-9]+)/, @stable_base_format)
171
+ runGit("checkout -B #{br} #{full_ver}")
172
+ cmdList = `awk '/\`\`\`/{p=!p; next};p' Documentation/stable.md`.chomp().split("\n")
173
+ if opts[:skip_docker] == true then
174
+ cmdList = cmdList.map(){|x| x if x !~ /build-images/}.compact()
175
+ end
176
+ cmdList = cmdList.map(){|x| (x !~ /pkg azp/) ? x : (x + " || true") }.compact()
177
+ cmdList << "./buildlib/cbuild pkg azp"
178
+
179
+ toDo=cmdList.join("&&")
180
+ begin
181
+ runSystem(toDo)
182
+ rescue RuntimeError
183
+ raise("Fail to run stable creation code")
184
+ end
185
+ end
131
186
  end
132
187
 
133
188
  class RDMACoreCI < CI
@@ -1,19 +1,47 @@
1
1
  module GitMaintain
2
2
  class GitMaintainBranch < Branch
3
3
  REPO_NAME = "git-maintain"
4
+ def self.set_opts(action, optsParser, opts)
5
+ opts[:rel_type] = nil
4
6
 
7
+ case action
8
+ when :release
9
+ optsParser.on("--major [VERSION]", "Release a major version.") {|val|
10
+ opts[:rel_type] = :major
11
+ opts[:new_ver] = val
12
+ }
13
+ optsParser.on("--stable", "Release a stable version.") {
14
+ opts[:rel_type] = :stable
15
+ }
16
+ end
17
+ end
18
+ def self.check_opts(opts)
19
+ if opts[:action] == :release then
20
+ case opts[:rel_type]
21
+ when nil
22
+ raise "No release type specified use --stable or --major"
23
+ when :major
24
+ if opts[:manual_branch] == nil then
25
+ GitMaintain::log(:INFO, "Major release selected. Auto-forcing branch to master")
26
+ opts[:manual_branch] = "master"
27
+ end
28
+ end
29
+ end
30
+ end
5
31
  def release(opts)
6
32
  prev_ver=@repo.runGit("show HEAD:CHANGELOG | grep -A 1 -- '---------' | head -n 2 | tail -n 1 | awk '{ print $1}'").chomp()
7
33
  ver_nums = prev_ver.split(".")
8
34
 
9
- if opts[:manual_branch] == nil then
35
+ if opts[:rel_type] == :stable then
10
36
  new_ver = (ver_nums[0 .. -2] + [ver_nums[-1].to_i() + 1 ]).join(".")
11
37
  git_prev_ver = "v" + (ver_nums[-1] == "0" ? ver_nums[0 .. -2].join(".") : prev_ver)
12
- else
38
+ elsif opts[:rel_type] == :major then
13
39
  new_ver = (ver_nums[0 .. -3] + [ver_nums[-2].to_i() + 1 ] + [ "0" ]).join(".")
40
+ new_ver = opts[:new_ver] if opts[:new_ver] != nil
14
41
  git_prev_ver = "v" + prev_ver
15
42
  end
16
43
 
44
+
17
45
  changes=@repo.runGit("show HEAD:CHANGELOG | awk ' BEGIN {count=0} {if ($1 == \"------------------\") count++; if (count == 0) print $0}'")
18
46
 
19
47
  puts "Preparing release #{prev_ver} => #{new_ver}"
@@ -41,17 +69,9 @@ $(cat CHANGELOG)
41
69
  EOF
42
70
  mv CHANGELOG.new CHANGELOG")
43
71
 
44
- # Add and commit
45
- @repo.runGit("add CHANGELOG")
46
- @repo.runGitInteractive("commit -F #{tag_path} --verbose --edit --signoff")
47
- if $? != 0 then
48
- raise("Failed to commit on branch #{local_branch}")
49
- end
50
- @repo.runGitInteractive("tag -a -s v#{new_ver} --edit -F #{tag_path}")
51
- if $? != 0 then
52
- raise("Failed to tag branch #{local_branch}")
53
- end
72
+ release_do_add_commit_tag(opts, ["CHANGELOG"], "v" + new_ver, tag_path)
54
73
  `rm -f #{tag_path}`
74
+ return 0
55
75
  end
56
76
  end
57
77
  class GitMaintainRepo < Repo
data/lib/azure.rb CHANGED
@@ -13,7 +13,7 @@ module GitMaintain
13
13
  def getState(sha1, resp)
14
14
  br = findBranch(sha1, resp)
15
15
  return "not found" if br == nil
16
- return "running" if br["result"] == nil
16
+ return "started" if br["result"] == nil
17
17
  return br["result"].to_s()
18
18
  end
19
19
  def getLog(sha1, resp)
@@ -34,7 +34,7 @@ module GitMaintain
34
34
  def getTS(sha1, resp)
35
35
  br = findBranch(sha1, resp)
36
36
  raise("Travis build not found") if br == nil
37
- return br["started_at"]
37
+ return br["startTime"]
38
38
  end
39
39
  def checkState(sha1, resp)
40
40
  st = getState(sha1, resp)