From 2940975a8f9476e9fcfc961c6fef9cada2f9b6a0 Mon Sep 17 00:00:00 2001
From: Amir MOHAMMADI <amir.mohammadi@idiap.ch>
Date: Tue, 13 Apr 2021 13:16:10 +0200
Subject: [PATCH] Fix software release process

---
 bob/devtools/data/changelog_since_last_release.md | 2 +-
 bob/devtools/release.py                           | 6 +++++-
 bob/devtools/scripts/changelog.py                 | 2 +-
 bob/devtools/scripts/getpath.py                   | 6 +++---
 bob/devtools/scripts/pipelines.py                 | 6 +++---
 bob/devtools/scripts/update_bob.py                | 2 +-
 bob/devtools/scripts/visibility.py                | 2 +-
 7 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/bob/devtools/data/changelog_since_last_release.md b/bob/devtools/data/changelog_since_last_release.md
index aa913355..55c9ae72 100644
--- a/bob/devtools/data/changelog_since_last_release.md
+++ b/bob/devtools/data/changelog_since_last_release.md
@@ -147,7 +147,7 @@
        add log output instead
      - bob.measure!86 Fix decimal number control for metrics: Fixes
        bob.measure#52
-     - bob.measure!88 Fix tests: Should fix bob.nightlies#40
+     - bob.measure!88 Fix tests: Should fix nightlies#40
      - bob.measure!67 Titles: Allow list of titles and remove `(development)`
        `(evaluation)` when default titles are modified
      - bob.measure!45 Condapackage
diff --git a/bob/devtools/release.py b/bob/devtools/release.py
index f606620f..1405190d 100644
--- a/bob/devtools/release.py
+++ b/bob/devtools/release.py
@@ -196,6 +196,10 @@ def get_parsed_tag(gitpkg, tag):
 
         # increase the version accordingly
         major, minor, patch = latest_tag_name.split(".")
+        # handle alpha and beta version
+        if "a" in patch or "b" in patch:
+            patch = patch.split("a")[0].split("b")[0]
+            patch = int(patch) - 1
 
         if "major" == tag:
             # increment the first number in 'v#.#.#' but make minor and patch
@@ -510,7 +514,7 @@ def release_package(gitpkg, tag_name, tag_comments_list, dry_run=False):
     # commit and push changes
     update_files_at_master(
         gitpkg,
-        {"README.rst": readme_content, "version.txt": version_number},
+        {"README.rst": readme_content, "version.txt": version_number + "\n"},
         "Increased stable version to %s" % version_number,
         dry_run,
     )
diff --git a/bob/devtools/scripts/changelog.py b/bob/devtools/scripts/changelog.py
index bc560a08..db9eb429 100644
--- a/bob/devtools/scripts/changelog.py
+++ b/bob/devtools/scripts/changelog.py
@@ -38,7 +38,7 @@ Examples:
   5. Generates a complete list of changelogs for a list of packages (one per line):
 
 \b
-     $ bdt gitlab getpath bob/bob.nightlies order.txt
+     $ bdt gitlab getpath bob/nightlies order.txt
      $ bdt gitlab lasttag bob/bob
      # copy and paste date to next command
      $ bdt gitlab changelog -vvv --since="2018-07-17 10:23:40" order.txt changelog.md
diff --git a/bob/devtools/scripts/getpath.py b/bob/devtools/scripts/getpath.py
index 5595c047..b6f61349 100644
--- a/bob/devtools/scripts/getpath.py
+++ b/bob/devtools/scripts/getpath.py
@@ -16,14 +16,14 @@ logger = get_logger(__name__)
     epilog="""
 Examples:
 
-  1. Get the file ``order.txt`` from bob.nightlies master branch:
+  1. Get the file ``order.txt`` from nightlies master branch:
 
-     $ bdt gitlab getpath bob/bob.nightlies order.txt
+     $ bdt gitlab getpath bob/nightlies order.txt
 
 
   2. Get the file ``order.txt`` from a different branch ``2.x``:
 
-     $ bdt gitlab getpath --ref=2.x bob/bob.nightlies order.txt
+     $ bdt gitlab getpath --ref=2.x bob/nightlies order.txt
 
 
   3. Get the directory ``gitlab`` (and eventual sub-directories) from bob.admin, save outputs in directory ``_ci``:
diff --git a/bob/devtools/scripts/pipelines.py b/bob/devtools/scripts/pipelines.py
index e362a4ce..a658b322 100644
--- a/bob/devtools/scripts/pipelines.py
+++ b/bob/devtools/scripts/pipelines.py
@@ -23,11 +23,11 @@ Examples:
 
   1. Process all the jobs from a particular pipeline
 
-     $ bdt gitlab process-pipelines bob/bob.nightlies pipelines
+     $ bdt gitlab process-pipelines bob/nightlies pipelines
 
   2. Process a particular job from a pipeline
 
-     $ bdt gitlab process-pipelines bob/bob.nightlies pipelines --job-id xxx
+     $ bdt gitlab process-pipelines bob/nightlies pipelines --job-id xxx
 
 """
 )
@@ -97,7 +97,7 @@ Examples:
 
   1. Get the most recent pipelines from a particular project wit their corresponding job numbers
 
-     $ bdt gitlab get-pipelines bob/bob.nightlies
+     $ bdt gitlab get-pipelines bob/nightlies
 
 
 """
diff --git a/bob/devtools/scripts/update_bob.py b/bob/devtools/scripts/update_bob.py
index a090cacd..cf8d121a 100644
--- a/bob/devtools/scripts/update_bob.py
+++ b/bob/devtools/scripts/update_bob.py
@@ -33,7 +33,7 @@ def update_bob(stable):
 
     gl = get_gitlab_instance()
 
-    # download order.txt form bob.nightlies and get the list of packages
+    # download order.txt form nightlies and get the list of packages
     nightlies = gl.projects.get("bob/nightlies")
 
     with tempfile.NamedTemporaryFile() as f:
diff --git a/bob/devtools/scripts/visibility.py b/bob/devtools/scripts/visibility.py
index 86eea473..d187a8a0 100644
--- a/bob/devtools/scripts/visibility.py
+++ b/bob/devtools/scripts/visibility.py
@@ -27,7 +27,7 @@ Examples:
   2. Checks the visibility of all packages in a file list:
 
 \b
-     $ bdt gitlab getpath bob/bob.nightlies order.txt
+     $ bdt gitlab getpath bob/nightlies order.txt
      $ bdt gitlab visibility order.txt
 """
 )
-- 
GitLab