generate_notice.py: fix SPDX confusion.
The two-line copyright header style that looks like
// Copyright (C) 2025 The Android Open Source Project
// SPDX-License-Identifier: BSD-2-Clause
confuses the existing logic. Rather than try to deal with arbitrary
combinations from other projects, for now just ignore code we wrote
ourselves as already covered. So far the BSDs seem to be using SPDX in
addition to their existing copyright headers anyway, rather than as a
shorter alternative. And new code seems likely to come from llvm-libc
instead.
(Re-running the script also removes a now-obsolete entry from the recent
reallocarr.c removal --- "edits made in Cider don't run the upload
hooks" is a separate and much harder problem...)
Change-Id: Ib8d66572094bcc8328814cfefa57a6d753f11576
diff --git a/libc/NOTICE b/libc/NOTICE
index c52a102..c869a31 100644
--- a/libc/NOTICE
+++ b/libc/NOTICE
@@ -4122,35 +4122,6 @@
-------------------------------------------------------------------
-Copyright (c) 2015 Joerg Sonnenberger <joerg@NetBSD.org>.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in
- the documentation and/or other materials provided with the
- distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
-FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
-COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
-AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
-
--------------------------------------------------------------------
-
Copyright (c) 2015 Nuxi, https://nuxi.nl/
Redistribution and use in source and binary forms, with or without
diff --git a/libc/tools/generate_notice.py b/libc/tools/generate_notice.py
index c998e32..034a3b3 100755
--- a/libc/tools/generate_notice.py
+++ b/libc/tools/generate_notice.py
@@ -151,6 +151,12 @@
(path, len(lines)))
return
+ # Skip over our own files if they're SPDX licensed.
+ # Because we use the // comment style, without this we'd copy the whole source file!
+ if re.compile('^// Copyright \(C\) 2\d\d\d The Android Open Source Project\n' + \
+ '// SPDX-License-Identifier: ').match(content):
+ return
+
# Manually iterate because extract_copyright_at tells us how many lines to
# skip.
i = 0