public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 3/7] update copyright year in version output of gdb, gdbserver and gdbreplay
  2020-01-01  6:28 FYI: Start of New Year updates performed (and copyright.py switch to Python3) Joel Brobecker
@ 2020-01-01  6:28 ` Joel Brobecker
  2020-01-01  6:28 ` [PATCH 6/7] gdb/copyright.py: Convert to Python 3 Joel Brobecker
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2020-01-01  6:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

gdb/ChangeLog:

        * top.c (print_gdb_version): Change copyright year to 2020.

gdb/gdbserver/ChangeLog:

        * server.c (gdbserver_version): Change copyright year to 2020.
        * gdbreplay.c (gdbreplay_version): Likewise.
---
 gdb/ChangeLog             | 4 ++++
 gdb/gdbserver/ChangeLog   | 5 +++++
 gdb/gdbserver/gdbreplay.c | 2 +-
 gdb/gdbserver/server.c    | 2 +-
 gdb/top.c                 | 2 +-
 5 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8743dec0f5d..6a4d26939bb 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-01-01  Joel Brobecker  <brobecker@adacore.com>
+
+	* top.c (print_gdb_version): Change copyright year to 2020.
+
 2020-01-01  Joel Brobecker  <brobecker@adacore.com>
 
 	* config/djgpp/fnchange.lst: Add entry for gdb/ChangeLog-2019.
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 028d1e92d80..12a7f0068fc 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-01  Joel Brobecker  <brobecker@adacore.com>
+
+	* server.c (gdbserver_version): Change copyright year to 2020.
+	* gdbreplay.c (gdbreplay_version): Likewise.
+
 2019-12-19  Christian Biesinger  <cbiesinger@google.com>
 
 	* configure: Regenerate.
diff --git a/gdb/gdbserver/gdbreplay.c b/gdb/gdbserver/gdbreplay.c
index 32529147939..54eb0ebd5b8 100644
--- a/gdb/gdbserver/gdbreplay.c
+++ b/gdb/gdbserver/gdbreplay.c
@@ -434,7 +434,7 @@ static void
 gdbreplay_version (void)
 {
   printf ("GNU gdbreplay %s%s\n"
-	  "Copyright (C) 2019 Free Software Foundation, Inc.\n"
+	  "Copyright (C) 2020 Free Software Foundation, Inc.\n"
 	  "gdbreplay is free software, covered by "
 	  "the GNU General Public License.\n"
 	  "This gdbreplay was configured as \"%s\"\n",
diff --git a/gdb/gdbserver/server.c b/gdb/gdbserver/server.c
index a425fbaa013..bac77c3da76 100644
--- a/gdb/gdbserver/server.c
+++ b/gdb/gdbserver/server.c
@@ -3381,7 +3381,7 @@ static void
 gdbserver_version (void)
 {
   printf ("GNU gdbserver %s%s\n"
-	  "Copyright (C) 2019 Free Software Foundation, Inc.\n"
+	  "Copyright (C) 2020 Free Software Foundation, Inc.\n"
 	  "gdbserver is free software, covered by the "
 	  "GNU General Public License.\n"
 	  "This gdbserver was configured as \"%s\"\n",
diff --git a/gdb/top.c b/gdb/top.c
index f2bbe4abbb7..059b56fb7ef 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -1366,7 +1366,7 @@ print_gdb_version (struct ui_file *stream, bool interactive)
   /* Second line is a copyright notice.  */
 
   fprintf_filtered (stream,
-		    "Copyright (C) 2019 Free Software Foundation, Inc.\n");
+		    "Copyright (C) 2020 Free Software Foundation, Inc.\n");
 
   /* Following the copyright is a brief statement that the program is
      free software, that users are free to copy and change it on
-- 
2.17.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 4/7] gdb/copyright.py: Exit if run from the wrong directory
  2020-01-01  6:28 FYI: Start of New Year updates performed (and copyright.py switch to Python3) Joel Brobecker
  2020-01-01  6:28 ` [PATCH 3/7] update copyright year in version output of gdb, gdbserver and gdbreplay Joel Brobecker
  2020-01-01  6:28 ` [PATCH 6/7] gdb/copyright.py: Convert to Python 3 Joel Brobecker
@ 2020-01-01  6:28 ` Joel Brobecker
  2020-01-01  6:28 ` [PATCH 5/7] gdb/copyright.py: Adapt after move of gnulib from gdb to toplevel Joel Brobecker
  2020-01-01  6:28 ` [PATCH 1/7] Automatic date update in version.in Joel Brobecker
  4 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2020-01-01  6:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

We printed an error, but kept going anyway... ;-)

gdb/ChangeLog:

	* copyright.py (main): Exit if run from the wrong directory.
---
 gdb/ChangeLog    | 4 ++++
 gdb/copyright.py | 3 +++
 2 files changed, 7 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 6a4d26939bb..ca7960111fa 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-01-01  Joel Brobecker  <brobecker@adacore.com>
+
+	* copyright.py (main): Exit if run from the wrong directory.
+
 2020-01-01  Joel Brobecker  <brobecker@adacore.com>
 
 	* top.c (print_gdb_version): Change copyright year to 2020.
diff --git a/gdb/copyright.py b/gdb/copyright.py
index 84ead523eea..7771d9d7f64 100644
--- a/gdb/copyright.py
+++ b/gdb/copyright.py
@@ -34,6 +34,7 @@ import datetime
 import os
 import os.path
 import subprocess
+import sys
 
 
 def get_update_list():
@@ -143,6 +144,8 @@ def main ():
     """The main subprogram."""
     if not os.path.isfile("gnulib/import/extra/update-copyright"):
         print "Error: This script must be called from the gdb directory."
+        sys.exit(1)
+
     root_dir = os.path.dirname(os.getcwd())
     os.chdir(root_dir)
 
-- 
2.17.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/7] Automatic date update in version.in
  2020-01-01  6:28 FYI: Start of New Year updates performed (and copyright.py switch to Python3) Joel Brobecker
                   ` (3 preceding siblings ...)
  2020-01-01  6:28 ` [PATCH 5/7] gdb/copyright.py: Adapt after move of gnulib from gdb to toplevel Joel Brobecker
@ 2020-01-01  6:28 ` Joel Brobecker
  4 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2020-01-01  6:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: GDB Administrator

From: GDB Administrator <gdbadmin@sourceware.org>

---
 bfd/version.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bfd/version.h b/bfd/version.h
index 3674fb5fe13..9132e6eeb03 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -16,7 +16,7 @@
 
    In releases, the date is not included in either version strings or
    sonames.  */
-#define BFD_VERSION_DATE 20191231
+#define BFD_VERSION_DATE 20200101
 #define BFD_VERSION @bfd_version@
 #define BFD_VERSION_STRING  @bfd_version_package@ @bfd_version_string@
 #define REPORT_BUGS_TO @report_bugs_to@
-- 
2.17.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* FYI: Start of New Year updates performed (and copyright.py switch to Python3)
@ 2020-01-01  6:28 Joel Brobecker
  2020-01-01  6:28 ` [PATCH 3/7] update copyright year in version output of gdb, gdbserver and gdbreplay Joel Brobecker
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Joel Brobecker @ 2020-01-01  6:28 UTC (permalink / raw)
  To: gdb-patches

Hello,

Just a quick email to let you know that just pushed the following
patches to master. This is mostly applying the Start of New Year
procedure, but I took this opportunity to update our copyright.py
script to work with Python 3 (I used Python 3.6).

  * [PATCH 1/7] Automatic date update in version.in
  * [PATCH 2/7] Rotate gdb/ChangeLog (start of New Year procedure)
  * [PATCH 3/7] update copyright year in version output of gdb, gdbserver
  * [PATCH 4/7] gdb/copyright.py: Exit if run from the wrong directory
  * [PATCH 5/7] gdb/copyright.py: Adapt after move of gnulib from gdb to
  * [PATCH 6/7] gdb/copyright.py: Convert to Python 3
  * [PATCH 7/7] Update copyright year range in all GDB files.

Happy New Year!

Thanks,
-- 
Joel

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 6/7] gdb/copyright.py: Convert to Python 3
  2020-01-01  6:28 FYI: Start of New Year updates performed (and copyright.py switch to Python3) Joel Brobecker
  2020-01-01  6:28 ` [PATCH 3/7] update copyright year in version output of gdb, gdbserver and gdbreplay Joel Brobecker
@ 2020-01-01  6:28 ` Joel Brobecker
  2020-01-01  6:28 ` [PATCH 4/7] gdb/copyright.py: Exit if run from the wrong directory Joel Brobecker
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2020-01-01  6:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

gdb/ChangeLog:

        * copyright.py: Convert to Python 3.
---
 gdb/ChangeLog    |  4 ++++
 gdb/copyright.py | 36 ++++++++++++++++++++----------------
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 02dff2b35a2..a570039a88f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,7 @@
+2020-01-01  Joel Brobecker  <brobecker@adacore.com>
+
+	* copyright.py: Convert to Python 3.
+
 2020-01-01  Joel Brobecker  <brobecker@adacore.com>
 
 	* copyright.py: Adapt after move of gnulib directory from gdb
diff --git a/gdb/copyright.py b/gdb/copyright.py
index e6feb376a92..2f468441ae9 100644
--- a/gdb/copyright.py
+++ b/gdb/copyright.py
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 
 # Copyright (C) 2011-2019 Free Software Foundation, Inc.
 #
@@ -31,6 +31,7 @@ This removes the bulk of the changes which are most likely to be correct.
 """
 
 import datetime
+import locale
 import os
 import os.path
 import subprocess
@@ -84,7 +85,8 @@ def update_files(update_list):
     update_cmd += update_list
 
     p = subprocess.Popen(update_cmd, stdout=subprocess.PIPE,
-                         stderr=subprocess.STDOUT)
+                         stderr=subprocess.STDOUT,
+                         encoding=locale.getpreferredencoding())
     update_out = p.communicate()[0]
 
     # Process the output.  Typically, a lot of files do not have
@@ -95,20 +97,18 @@ def update_files(update_list):
     # the line out from the output, since there is nothing more to do,
     # short of looking at each file and seeing which notice is appropriate.
     # Too much work! (~4,000 files listed as of 2012-01-03).
-    update_out = update_out.splitlines()
+    update_out = update_out.splitlines(keepends=False)
     warning_string = ': warning: copyright statement not found'
     warning_len = len(warning_string)
 
     for line in update_out:
-        if line.endswith('\n'):
-            line = line[:-1]
         if line.endswith(warning_string):
             filename = line[:-warning_len]
             if may_have_copyright_notice(filename):
-                print line
+                print(line)
         else:
             # Unrecognized file format. !?!
-            print "*** " + line
+            print("*** " + line)
 
 
 def may_have_copyright_notice(filename):
@@ -128,11 +128,15 @@ def may_have_copyright_notice(filename):
     # 50 lines...
     MAX_LINES = 50
 
-    fd = open(filename)
+    # We don't really know what encoding each file might be following,
+    # so just open the file as a byte stream. We only need to search
+    # for a pattern that should be the same regardless of encoding,
+    # so that should be good enough.
+    fd = open(filename, 'rb')
 
     lineno = 1
     for line in fd:
-        if 'Copyright' in line:
+        if b'Copyright' in line:
             return True
         lineno += 1
         if lineno > 50:
@@ -147,7 +151,7 @@ def main ():
 
     if not (os.path.isdir('gdb') and
             os.path.isfile("gnulib/import/extra/update-copyright")):
-        print "Error: This script must be called from the gdb directory."
+        print("Error: This script must be called from the gdb directory.")
         sys.exit(1)
 
     update_list = get_update_list()
@@ -156,19 +160,19 @@ def main ():
     # Remind the user that some files need to be updated by HAND...
 
     if MULTIPLE_COPYRIGHT_HEADERS:
-        print
+        print()
         print("\033[31m"
               "REMINDER: Multiple copyright headers must be updated by hand:"
               "\033[0m")
         for filename in MULTIPLE_COPYRIGHT_HEADERS:
-            print "  ", filename
+            print("  ", filename)
 
     if BY_HAND:
-        print
-        print "\033[31mREMINDER: The following files must be updated by hand." \
-              "\033[0m"
+        print()
+        print("\033[31mREMINDER: The following files must be updated by hand." \
+              "\033[0m")
         for filename in BY_HAND:
-            print "  ", filename
+            print("  ", filename)
 
 ############################################################################
 #
-- 
2.17.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 5/7] gdb/copyright.py: Adapt after move of gnulib from gdb to toplevel
  2020-01-01  6:28 FYI: Start of New Year updates performed (and copyright.py switch to Python3) Joel Brobecker
                   ` (2 preceding siblings ...)
  2020-01-01  6:28 ` [PATCH 4/7] gdb/copyright.py: Exit if run from the wrong directory Joel Brobecker
@ 2020-01-01  6:28 ` Joel Brobecker
  2020-01-01  6:28 ` [PATCH 1/7] Automatic date update in version.in Joel Brobecker
  4 siblings, 0 replies; 6+ messages in thread
From: Joel Brobecker @ 2020-01-01  6:28 UTC (permalink / raw)
  To: gdb-patches; +Cc: Joel Brobecker

gdb/ChangeLog:

	* copyright.py: Adapt after move of gnulib directory from gdb
	directory to toplevel directory.
---
 gdb/ChangeLog    |  5 +++++
 gdb/copyright.py | 15 ++++++++-------
 2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ca7960111fa..02dff2b35a2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2020-01-01  Joel Brobecker  <brobecker@adacore.com>
+
+	* copyright.py: Adapt after move of gnulib directory from gdb
+	directory to toplevel directory.
+
 2020-01-01  Joel Brobecker  <brobecker@adacore.com>
 
 	* copyright.py (main): Exit if run from the wrong directory.
diff --git a/gdb/copyright.py b/gdb/copyright.py
index 7771d9d7f64..e6feb376a92 100644
--- a/gdb/copyright.py
+++ b/gdb/copyright.py
@@ -45,7 +45,7 @@ def get_update_list():
     the files are relative to that root directory.
     """
     result = []
-    for gdb_dir in ('gdb', 'sim', 'include/gdb'):
+    for gdb_dir in ('gdb', 'gnulib', 'sim', 'include/gdb'):
         for root, dirs, files in os.walk(gdb_dir, topdown=True):
             for dirname in dirs:
                 reldirname = "%s/%s" % (root, dirname)
@@ -80,7 +80,7 @@ def update_files(update_list):
     os.environ['UPDATE_COPYRIGHT_USE_INTERVALS'] = '2'
 
     # Perform the update, and save the output in a string.
-    update_cmd = ['bash', 'gdb/gnulib/import/extra/update-copyright']
+    update_cmd = ['bash', 'gnulib/import/extra/update-copyright']
     update_cmd += update_list
 
     p = subprocess.Popen(update_cmd, stdout=subprocess.PIPE,
@@ -142,13 +142,14 @@ def may_have_copyright_notice(filename):
 
 def main ():
     """The main subprogram."""
-    if not os.path.isfile("gnulib/import/extra/update-copyright"):
-        print "Error: This script must be called from the gdb directory."
-        sys.exit(1)
-
     root_dir = os.path.dirname(os.getcwd())
     os.chdir(root_dir)
 
+    if not (os.path.isdir('gdb') and
+            os.path.isfile("gnulib/import/extra/update-copyright")):
+        print "Error: This script must be called from the gdb directory."
+        sys.exit(1)
+
     update_list = get_update_list()
     update_files (update_list)
 
@@ -185,7 +186,7 @@ def main ():
 EXCLUDE_LIST = (
     'gdb/nat/glibc_thread_db.h',
     'gdb/CONTRIBUTE',
-    'gdb/gnulib/import'
+    'gnulib/import'
 )
 
 # Files which should not be modified, either because they are
-- 
2.17.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-01  6:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-01  6:28 FYI: Start of New Year updates performed (and copyright.py switch to Python3) Joel Brobecker
2020-01-01  6:28 ` [PATCH 3/7] update copyright year in version output of gdb, gdbserver and gdbreplay Joel Brobecker
2020-01-01  6:28 ` [PATCH 6/7] gdb/copyright.py: Convert to Python 3 Joel Brobecker
2020-01-01  6:28 ` [PATCH 4/7] gdb/copyright.py: Exit if run from the wrong directory Joel Brobecker
2020-01-01  6:28 ` [PATCH 5/7] gdb/copyright.py: Adapt after move of gnulib from gdb to toplevel Joel Brobecker
2020-01-01  6:28 ` [PATCH 1/7] Automatic date update in version.in Joel Brobecker

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 read-only IMAP folder(s) and NNTP newsgroup(s).