From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6500 invoked by alias); 16 Aug 2019 09:59:00 -0000 Mailing-List: contact dwz-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: dwz-owner@sourceware.org Received: (qmail 6331 invoked by uid 89); 16 Aug 2019 09:59:00 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.100.3 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 spammy=rh, bumps, LLC X-Spam-Status: No, score=-26.0 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,SPF_PASS autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on sourceware.org X-Spam-Level: X-HELO: mx1.suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Subject: [committed] Update --version copyright message From: Tom de Vries To: Jakub Jelinek Cc: dwz@sourceware.org, Michael Matz References: <20190722074131.GA32307@delia> <20190729172036.GF15878@tucnak> <573e6c65-9e69-5fe1-e156-f6ccd6b700b8@suse.de> Openpgp: preference=signencrypt Autocrypt: addr=tdevries@suse.de; keydata= mQENBF0ltCcBCADDhsUnMMdEXiHFfqJdXeRvgqSEUxLCy/pHek88ALuFnPTICTwkf4g7uSR7 HvOFUoUyu8oP5mNb4VZHy3Xy8KRZGaQuaOHNhZAT1xaVo6kxjswUi3vYgGJhFMiLuIHdApoc u5f7UbV+egYVxmkvVLSqsVD4pUgHeSoAcIlm3blZ1sDKviJCwaHxDQkVmSsGXImaAU+ViJ5l CwkvyiiIifWD2SoOuFexZyZ7RUddLosgsO0npVUYbl6dEMq2a5ijGF6/rBs1m3nAoIgpXk6P TCKlSWVW6OCneTaKM5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yyHTItXBzsfe+V3Mn0CgrdDGnRDor+sM55TLccyp7BAZyquxFGHQ1cMhCTkKBKtmyU97juo ht7c7uKT8wKrfUU0gBAk+YpdfbkHXXkwzORIqW/i51/Hsp3LEetNKTBZkCstCIRmPkobhwIq EigzKA9MDdTIZoi8j8EY60dntsQFVQIUMV85Ynbog4Kg+dJVS8o8Q4f12/6w3LuPIGw/lDF5 OrDEL/Vm01INQJIVCOoDpsQbAzbZ0/w5RjpIL3jHUbzUD3/Fu2b0tDEqbQSIMfwoEwt9 Message-ID: Date: Tue, 01 Jan 2019 00:00:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <573e6c65-9e69-5fe1-e156-f6ccd6b700b8@suse.de> Content-Type: multipart/mixed; boundary="------------0445C7A5E052CF7296FF9482" Content-Language: en-US X-SW-Source: 2019-q3/txt/msg00095.txt.bz2 This is a multi-part message in MIME format. --------------0445C7A5E052CF7296FF9482 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-length: 1991 [ was: Re: [PATCH] Add do-release.sh ] On 12-08-19 17:18, Tom de Vries wrote: > On 29-07-19 19:20, Jakub Jelinek wrote: >> On Mon, Jul 22, 2019 at 09:41:33AM +0200, Tom de Vries wrote: >>> Hi, >>> >>> this commit adds a script that: >>> - bumps either the minor or the major version, using options >>> --major or --minor >>> - updates VERSION >>> - commits VERSION update >>> - tags VERSION update >>> >>> OK for trunk? >>> >>> Is there anything else involved in doing a release? >> >> I think that is all, bumping VERSION, commiting and tagging was all I did in >> the past. >> >> One thing that might be worth doing is bump copyright years on files you've >> modified, I know dwz.c has been using mostly Red Hat copyright, if you want >> to use say FSF copyright, can you change that 2003 in there to 2003, 2019? >> Or do you want to use SUSE copyright instead? >> I guess because I have touched dwz.c last year the RH copyright should be >> -2018 instead of -2015 too, and dwarf2.def should be probably changed to >> 1992-2018 FSF copyright, using the simple range. After the release we >> should likely import new dwarf2.def and dwarf2.h from GCC tree. > > Hmm, something I overlooked: > ... > $ ./dwz --version > dwz version 0.13 > Copyright (C) 2001-2012 Red Hat, Inc. > Copyright (C) 2003 Free Software Foundation, Inc. > ... > > We've updated the copyright in the file headers, but not in the version > message. > > Patch below fixes this, updating the message using the copyright from > the dwz.c file header. > > I wonder though, what about the copyright in the other files: > dwarf2.def, dwarf2.h, dwarfnames.c, hashtab.c, hashtab.h, sha1.c and > sha1.h? Should we take the copyright in those files into account as > well? Or is it just dwz.c that matters? I've written a script that: - extracts copyright lines from the source files, - merges them, and - writes out define flags to a new file COPYRIGHT_YEARS. The version message now uses those defines. Thanks, - Tom --------------0445C7A5E052CF7296FF9482 Content-Type: text/x-patch; name="0002-Update-version-copyright-message.patch" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="0002-Update-version-copyright-message.patch" Content-length: 6602 Update --version copyright message In commit 9a663b4 "Update copyright" we've updated copyright in the sources, but not in the --version copyright message. Update the --version copyright message, using new script contrib/gen-copyright-years.sh that extracts the copyright years from the source files, and generates a file COPYRIGHT_YEARS containing define flags: ... -DFSF_YEARS='"1992-2019"' -DRH_YEARS='"2001-2018"' -DSUSE_YEARS='"2019"' ... resulting in: ... $ dwz --version dwz version 0.13 Copyright (C) 2001-2018 Red Hat, Inc. Copyright (C) 1992-2019 Free Software Foundation, Inc. Copyright (C) 2019 SUSE LLC. ... 2019-08-15 Tom de Vries * contrib/copyright-lines.awk: New file. * contrib/gen-copyright-years.sh: New file. * COPYRIGHT_YEARS: Generate. * Makefile (override CFLAGS +=, dwz-for-test): Add COPYRIGHT_YEARS defines. * dwz.c (version): Update copyright message using COPYRIGHT_YEARS defines. --- COPYRIGHT_YEARS | 3 + Makefile | 6 +- contrib/copyright-lines.awk | 27 +++++++ contrib/gen-copyright-years.sh | 162 +++++++++++++++++++++++++++++++++++++++++ dwz.c | 5 +- 5 files changed, 199 insertions(+), 4 deletions(-) diff --git a/COPYRIGHT_YEARS b/COPYRIGHT_YEARS new file mode 100644 index 0000000..bcb248f --- /dev/null +++ b/COPYRIGHT_YEARS @@ -0,0 +1,3 @@ +-DFSF_YEARS='"1992-2019"' +-DRH_YEARS='"2001-2018"' +-DSUSE_YEARS='"2019"' diff --git a/Makefile b/Makefile index 7e281e5..c945c9d 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,8 @@ srcdir=$(shell pwd) endif CFLAGS = -O2 -g DWZ_VERSION := $(shell cat $(srcdir)/VERSION) -override CFLAGS += -Wall -W -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"$(DWZ_VERSION)"' +override CFLAGS += -Wall -W -D_FILE_OFFSET_BITS=64 \ + -DDWZ_VERSION='"$(DWZ_VERSION)"' $(shell cat $(srcdir)/COPYRIGHT_YEARS) prefix = /usr exec_prefix = $(prefix) bindir = $(exec_prefix)/bin @@ -52,7 +53,8 @@ DWZ_TEST_SOURCES := $(patsubst %.o,%-for-test.c,$(OBJECTS)) dwz-for-test: $(DWZ_TEST_SOURCES) $(CC) $(DWZ_TEST_SOURCES) -O2 -g -lelf -o $@ -Wall -W -DDEVEL \ - -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"for-test"' -I$(srcdir) + -D_FILE_OFFSET_BITS=64 -DDWZ_VERSION='"for-test"' -I$(srcdir) \ + $(shell cat $(srcdir)/COPYRIGHT_YEARS) min: $(CC) $(TEST_SRC)/min.c $(TEST_SRC)/min-2.c -o $@ -g diff --git a/contrib/copyright-lines.awk b/contrib/copyright-lines.awk new file mode 100644 index 0000000..b031c50 --- /dev/null +++ b/contrib/copyright-lines.awk @@ -0,0 +1,27 @@ +BEGIN { + start=0 +} + +/Copyright \(C\).*[.]/ { + print + next +} + +/Copyright \(C\)/ { + start=1 + printf $0 + next +} + +/[.]/ { + if (start == 0) + next + print + start=0 +} + +// { + if (start == 0) + next + printf $0 +} diff --git a/contrib/gen-copyright-years.sh b/contrib/gen-copyright-years.sh new file mode 100755 index 0000000..1ef6f3f --- /dev/null +++ b/contrib/gen-copyright-years.sh @@ -0,0 +1,162 @@ +#!/bin/bash + +this=$(basename $0) + +max () +{ + local a + a=$1 + local b + b=$2 + + if [ "$a" = "" ]; then + echo "$b" + return + elif [ "$b" = "" ]; then + echo "$a" + return + fi + + if [ $a -gt $b ]; then + echo "$a" + else + echo "$b" + fi +} + +min () +{ + local a + a="$1" + local b + b="$2" + + if [ "$a" = "" ]; then + echo "$b" + return + elif [ "$b" = "" ]; then + echo "$a" + return + fi + + if [ $a -lt $b ]; then + echo "$a" + else + echo "$b" + fi +} + +print_range () { + local a + a="$1" + local b + b="$2" + + if [ "$a" = "$b" ]; then + echo "$a" + return + fi + echo "$a-$b" +} + +process_line () +{ + local line + line="$1" + + fsf=false + rh=false + suse=false; + + if echo "$line" \ + | grep -q "Free Software Foundation, Inc\."; then + fsf=true + who=fsf + line=$(echo "$line" \ + | sed 's/Free Software Foundation, Inc\.//') + elif echo "$line" \ + | grep -q "Red Hat, Inc\."; then + rh=true + who=rh + line=$(echo "$line" \ + | sed 's/Red Hat, Inc\.//') + elif echo "$line" \ + | grep -q "SUSE LLC\."; then + suse=true + who=suse + line=$(echo "$line" \ + | sed 's/SUSE LLC\.//') + else + echo "error: unknown copyright: $line" + exit 1 + fi + + line=$(echo "$line" \ + | sed 's/[,-]/ /g') + max_year=$(echo "$line" \ + | sed 's/ /\n/g' \ + | grep -v '^$' \ + | sort -n -r \ + | head -n 1) + min_year=$(echo "$line" \ + | sed 's/ /\n/g' \ + | grep -v '^$' \ + | sort -n \ + | head -n 1) + + if $fsf; then + fsf_max=$(max "$fsf_max" "$max_year") + fsf_min=$(min "$fsf_min" "$min_year") + elif $rh; then + rh_max=$(max "$rh_max" "$max_year") + rh_min=$(min "$rh_min" "$min_year") + elif $suse; then + suse_max=$(max "$suse_max" "$max_year") + suse_min=$(min "$suse_min" "$min_year") + fi +} + +main () +{ + if ! git status --ignored 2>&1 \ + | grep -q "nothing to commit, working tree clean"; then + echo "Git tree not clean" + exit 1 + fi + + local tmp + tmp=$(mktemp) + + for f in *.c *.h *.def; do + if ! grep -q "Copyright (C)" $f; then + echo "error: found file without copyright marker: $f" + exit 1 + fi + + echo processing file: $f + + grep -v '"' $f \ + | awk -f contrib/copyright-lines.awk \ + > $tmp + + while read line; do + line=$(echo "$line" \ + | sed 's/ */ /g') + line=$(echo "$line" \ + | sed 's/.*Copyright (C) *//') + echo "Processing line: $line" + process_line "$line" + done < $tmp + done + + rm -f $tmp + + echo "-DFSF_YEARS='\"$(print_range $fsf_min $fsf_max)\"'" \ + > COPYRIGHT_YEARS + echo "-DRH_YEARS='\"$(print_range $rh_min $rh_max)\"'" \ + >> COPYRIGHT_YEARS + echo "-DSUSE_YEARS='\"$(print_range $suse_min $suse_max)\"'" \ + >> COPYRIGHT_YEARS +} + +main "$@" diff --git a/dwz.c b/dwz.c index 266f56d..727314f 100644 --- a/dwz.c +++ b/dwz.c @@ -12395,8 +12395,9 @@ version (void) { fprintf (stderr, "dwz version " DWZ_VERSION "\n" - "Copyright (C) 2001-2012 Red Hat, Inc.\n" - "Copyright (C) 2003 Free Software Foundation, Inc.\n" + "Copyright (C) " RH_YEARS " Red Hat, Inc.\n" + "Copyright (C) " FSF_YEARS " Free Software Foundation, Inc.\n" + "Copyright (C) " SUSE_YEARS " SUSE LLC.\n" "This program is free software; you may redistribute it under the terms of\n" "the GNU General Public License version 3 or (at your option) any later version.\n" "This program has absolutely no warranty.\n"); --------------0445C7A5E052CF7296FF9482--