diff mbox series

Allow get_maintainer.pl / add_maintainers.pl scripts to be called outside of xen.git

Message ID 20190815171158.33884-1-lars.kurth@citrix.com (mailing list archive)
State Superseded
Headers show
Series Allow get_maintainer.pl / add_maintainers.pl scripts to be called outside of xen.git | expand

Commit Message

Lars Kurth Aug. 15, 2019, 5:11 p.m. UTC
Use-case: Allow using both scripts on xen repositories such as
mini-os.git, osstest.git,

Tool changes:
* add_maintainers.pl: $get_maintainer inherits path from $0
* get_maintainer.pl: warn (instead fo die) when called
  from a different tree

Assumptions: the repository contains a MAINTAINERS file that
follows the same conventions as the file in xen.git

A suggested template

========================================================
This file follows the same conventions as outlined in
xen.git:MAINTAINERS. Please refer to the file in xen.git
for more information.

THE REST
M:	MAINTAINER1 <maintainer1@email.com>
M:      MAINTAINER2 <maintainer2@email.com>
L:	xen-devel@lists.xenproject.org
S:	Supported
F:	*/
========================================================

Signed-off-by: Lars Kurth <lars.kurth@citrix.com>
---
 scripts/add_maintainers.pl |  9 ++++++---
 scripts/get_maintainer.pl  | 13 +++++++++++--
 2 files changed, 17 insertions(+), 5 deletions(-)

Comments

Lars Kurth Aug. 15, 2019, 5:16 p.m. UTC | #1
On 15/08/2019, 18:12, "Lars Kurth" <lars.kurth@citrix.com> wrote:

    Use-case: Allow using both scripts on xen repositories such as
    mini-os.git, osstest.git,
    
    Tool changes:
    * add_maintainers.pl: $get_maintainer inherits path from $0
    * get_maintainer.pl: warn (instead fo die) when called
      from a different tree
    
    Assumptions: the repository contains a MAINTAINERS file that
    follows the same conventions as the file in xen.git
    
    A suggested template
    
    ========================================================
    This file follows the same conventions as outlined in
    xen.git:MAINTAINERS. Please refer to the file in xen.git
    for more information.
    
    THE REST
    M:	MAINTAINER1 <maintainer1@email.com>
    M:      MAINTAINER2 <maintainer2@email.com>
    L:	xen-devel@lists.xenproject.org
    S:	Supported
    F:	*/
    ========================================================
    
    Signed-off-by: Lars Kurth <lars.kurth@citrix.com>
    ---
     scripts/add_maintainers.pl |  9 ++++++---
     scripts/get_maintainer.pl  | 13 +++++++++++--
     2 files changed, 17 insertions(+), 5 deletions(-)
    
    diff --git a/scripts/add_maintainers.pl b/scripts/add_maintainers.pl
    index 09e9f6609f..7f98dde874 100755
    --- a/scripts/add_maintainers.pl
    +++ b/scripts/add_maintainers.pl
    @@ -25,10 +25,13 @@ sub normalize ($$);
     sub insert ($$$$);
     sub hastag ($$);
     
    -# Tool Variables
    -my $get_maintainer      = "./scripts/get_maintainer.pl";
    -
    +# Tool Variables 
     my $tool = $0;
    +my $get_maintainer = $tool; 
    +$get_maintainer =~ s/add_maintainers/get_maintainer/; 
    +
    +print $get_maintainer."\n";

Will re-send a v2. I left a debug message in. Apologies
Lars
diff mbox series

Patch

diff --git a/scripts/add_maintainers.pl b/scripts/add_maintainers.pl
index 09e9f6609f..7f98dde874 100755
--- a/scripts/add_maintainers.pl
+++ b/scripts/add_maintainers.pl
@@ -25,10 +25,13 @@  sub normalize ($$);
 sub insert ($$$$);
 sub hastag ($$);
 
-# Tool Variables
-my $get_maintainer      = "./scripts/get_maintainer.pl";
-
+# Tool Variables 
 my $tool = $0;
+my $get_maintainer = $tool; 
+$get_maintainer =~ s/add_maintainers/get_maintainer/; 
+
+print $get_maintainer."\n";
+
 my $usage = <<EOT;
 OPTIONS:
 --------
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 174dfb7e40..8bc9012cdb 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -266,8 +266,17 @@  if ($email &&
 }
 
 if (!top_of_tree($xen_path)) {
-    die "$P: The current directory does not appear to be "
-	. "a Xen source tree.\n";
+    # Do not exit, but print an error message to STDERR to allow calling 
+    # the tool from xen-related repos such as mini-os.git, 
+    # live patch-build-tools.git, etc
+    print STDERR "$P:\n".
+          "=====================================================\n".
+          "WARNING: The current directory does not appear to be \n".
+	  "the xen.git source tree.\n\n".
+          "The tool works outside of the xen.git tree, if the\n".
+          "MAINTAINERS file follows the same format as that of\n".
+          "xen.git. Use at your own peril.\n".
+          "=====================================================\n";
 }
 
 ## Read MAINTAINERS for type/value pairs