summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLars Kurth <lars.kurth@citrix.com>2019-08-30 20:35:13 +0100
committerIan Jackson <ian.jackson@eu.citrix.com>2019-09-12 17:20:18 +0100
commit1014f47c7a808e025b8920ab80bfe73a2888b3e5 (patch)
treef35a07430d9950fd0485aeec104445773d3bf59b /scripts
parent8ed96cd071fa1080281036cdd1194c65fcdf2696 (diff)
downloadxen-1014f47c7a808e025b8920ab80bfe73a2888b3e5.tar.gz
scripts/add_maintainers.pl: Add logic to use V entry
Add logic to use V section entry in THE REST for identifying xen trees 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> Acked-by: Julien Grall <julien.grall@arm.com> Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/get_maintainer.pl57
1 files changed, 35 insertions, 22 deletions
diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 174dfb7e40..2e661f47d8 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) = @_;