xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Lars Kurth <lars.kurth@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Lars Kurth <lars.kurth@citrix.com>,
	Stefano Stabellini <sstabellini@kernel.org>, Wei Liu <wl@xen.org>,
	Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <ian.jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>,
	Julien Grall <julien.grall@arm.com>,
	Jan Beulich <jbeulich@suse.com>
Subject: [Xen-devel] [PATCH v4 3/3] Add logic to use V section entry in THE REST for identifying xen trees
Date: Wed,  4 Sep 2019 12:30:10 +0100	[thread overview]
Message-ID: <0b543489f930ab966d916e47a738d77de793b8c4.1567596460.git-series.lars.kurth@citrix.com> (raw)
In-Reply-To: <cover.8155a0a9d3da9781c83c5eaf5718c901934174f8.1567596460.git-series.lars.kurth@citrix.com>
In-Reply-To: <cover.8155a0a9d3da9781c83c5eaf5718c901934174f8.1567596460.git-series.lars.kurth@citrix.com>

Specifically:
* Move check until after the MAINTAINERS file has been read
* Add get_xen_maintainers_file_version() for check
* Remove top_of_tree as not needed any more
* Fail with extended error message when used out of tree

Signed-off-by: Lars Kurth <lars.kurth@citrix.com>
---
 scripts/get_maintainer.pl | 57 ++++++++++++++++++++++++----------------
 1 file changed, 35 insertions(+), 22 deletions(-)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 174dfb7..2e661f4 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -265,11 +265,6 @@ if ($email &&
     die "$P: Please select at least 1 email option\n";
 }
 
-if (!top_of_tree($xen_path)) {
-    die "$P: The current directory does not appear to be "
-	. "a Xen source tree.\n";
-}
-
 ## Read MAINTAINERS for type/value pairs
 
 my @typevalue = ();
@@ -311,6 +306,16 @@ while (<$maint>) {
 }
 close($maint);
 
+# Check whether we have a V entry under the REST
+# and use it to get the file's version number
+my $maintainers_file_version = get_xen_maintainers_file_version();
+if (!$maintainers_file_version) {
+    die "$P: the MAINTAINERS file ".
+         "in the current directory does not appear to be from ".
+         "the xen.git source tree or a sister tree.\n\n".
+         "A 'V: xen-maintainers-<version>' entry under THE REST ".
+         "is needed to identify a Xen MAINTAINERS file.\n\n";
+}
 
 #
 # Read mail address map
@@ -564,6 +569,31 @@ sub range_has_maintainer {
     return 0;
 }
 
+sub get_xen_maintainers_file_version {
+    my $tvi = find_first_section();
+
+    while ($tvi < @typevalue) {
+        my $start = find_starting_index($tvi);
+        my $end = find_ending_index($tvi);
+        my $i;
+
+        for ($i = $start; $i < $end; $i++) {
+            my $line = $typevalue[$i];
+            if ($line =~ m/^V:\s*(.*)/) {
+                # Note that get_maintainer_role() requires processing
+                # of more of the file. So do it directly
+                if ($typevalue[$start] eq "THE REST") {
+                    if ($line =~ m/xen-maintainers-(.*)/) {
+                        return $1;
+                    }
+                }
+	    }
+        }
+        $tvi = $end + 1;
+    }
+    return 0;
+}
+
 sub get_maintainers {
     %email_hash_name = ();
     %email_hash_address = ();
@@ -867,23 +897,6 @@ Notes:
 EOT
 }
 
-sub top_of_tree {
-    my ($xen_path) = @_;
-
-    if ($xen_path ne "" && substr($xen_path,length($xen_path)-1,1) ne "/") {
-	$xen_path .= "/";
-    }
-    if (    (-f "${xen_path}COPYING")
-        && (-f "${xen_path}MAINTAINERS")
-        && (-f "${xen_path}Makefile")
-        && (-d "${xen_path}docs")
-        && (-f "${xen_path}CODING_STYLE")
-        && (-d "${xen_path}xen")) {
-	return 1;
-    }
-    return 0;
-}
-
 sub parse_email {
     my ($formatted_email) = @_;
 
-- 
git-series 0.9.1

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2019-09-04 11:30 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-04 11:30 [Xen-devel] [PATCH v4 0/3] Allow get_maintainer.pl / add_maintainers.pl scripts to be called outside of xen.git Lars Kurth
2019-09-04 11:30 ` [Xen-devel] [PATCH v4 1/3] Remove hardcoding from scripts/add_maintainers.pl Lars Kurth
2019-09-10 15:17   ` Julien Grall
2019-09-04 11:30 ` [Xen-devel] [PATCH v4 2/3] Add V section entry to allow identification of Xen MAINTAINERS file Lars Kurth
2019-09-10 15:18   ` Julien Grall
2019-09-10 15:31     ` Julien Grall
2019-09-10 15:35       ` Lars Kurth
2019-09-10 16:01         ` Julien Grall
2019-09-04 11:30 ` Lars Kurth [this message]
2019-09-11 15:41   ` [Xen-devel] [PATCH v4 3/3] Add logic to use V section entry in THE REST for identifying xen trees Ian Jackson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0b543489f930ab966d916e47a738d77de793b8c4.1567596460.git-series.lars.kurth@citrix.com \
    --to=lars.kurth@citrix.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ian.jackson@eu.citrix.com \
    --cc=jbeulich@suse.com \
    --cc=julien.grall@arm.com \
    --cc=konrad.wilk@oracle.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wl@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).