ChangeLogを抽出

まだbin2c追っかけてます。
bin2cの経緯を知るため、ChangeLog見ることにしました。
bin2cでgrep。ファイル名から修正年が分かるのが工夫してありますね。

takk@deb9:~/src/binutils-2.28/binutils$ grep bin2c ChangeLog*
ChangeLog-2007:	* ar.c, arlex.l, arparse.y, arsup.c, arsup.h, bin2c.c, binemul.c,
ChangeLog-2007:	(EXTRA_PROGRAMS): Remove bin2c.
ChangeLog-2007:	(bin2c$(EXEEXT_FOR_BUILD)): New rule.
ChangeLog-2007:	(bin2c_SOURCES): Delete.
ChangeLog-2007:	bin2c$(EXEEXT_FOR_BUILD).
ChangeLog-2007:	* configure.in (BUILD_MISC): Add $(EXEEXT_FOR_BUILD) to bin2c.
ChangeLog-2007:	* bin2c.c: New file.
ChangeLog-2007:	* Makefile.am (EXTRA_PROGRAMS): Add bin2c.
ChangeLog-2007:	(CFILES): Add bin2c.c.
ChangeLog-2007:	(bin2c_SOURCES): Define.
ChangeLog-2007:	(bin2c.o): Dependencies from "make dep-am".
ChangeLog-2007:	* configure.in (BUILD_MISC): Add bin2c.
ChangeLog-2008:	* bin2c.c (O_BINARY, O_TEXT, SET_BINARY): Don't define here.
ChangeLog-2009:	(bin2c$(EXEEXT_FOR_BUILD)): Likewise.
ChangeLog-2009:	(bin2c$(EXEEXT_FOR_BUILD): Adjust rule.
ChangeLog-2010:	* bin2c.c: Remove internationalization and version report.
ChangeLog-2010:	* Makefile.am: Update bin2c rule.
ChangeLog-2010:	* Makefile.am (bin2c): Add libintl dependance and library.
takk@deb9:~/src/binutils-2.28/binutils$ 

各修正のタイトルを知りたいときは、grepで-B 指定して検索行より前も表示します。

takk@deb9:~/src/binutils-2.28/binutils$ grep bin2c -B3 ChangeLog*
ChangeLog-2007-2007-07-05  Nick Clifton  <nickc@redhat.com>
ChangeLog-2007-
ChangeLog-2007-	* addr2line.c: Update copyright notice to refer to GPLv3.


省略

ChangeLog-2009:	(bin2c$(EXEEXT_FOR_BUILD): Adjust rule.
--
ChangeLog-2010-
ChangeLog-2010-2010-11-05  Alan Modra  <amodra@gmail.com>
ChangeLog-2010-
ChangeLog-2010:	* bin2c.c: Remove internationalization and version report.
ChangeLog-2010:	* Makefile.am: Update bin2c rule.
--
ChangeLog-2010-
ChangeLog-2010-2010-01-26  Tristan Gingold  <gingold@adacore.com>
ChangeLog-2010-
ChangeLog-2010:	* Makefile.am (bin2c): Add libintl dependance and library.
takk@deb9:~/src/binutils-2.28/binutils$ 

ChangeLogは書き方が統一されてるので、Log毎に抽出したりできます。
最大行数を求めておいて、

takk@deb9:~/src/binutils-2.28/binutils$ wc -l Change* | sort
    42 ChangeLog
   605 ChangeLog-2006
   681 ChangeLog-2013
   756 ChangeLog-2012
   799 ChangeLog-2004
   880 ChangeLog-2008
   936 ChangeLog-2011
   960 ChangeLog-2014
   979 ChangeLog-2016
  1034 ChangeLog-2015
  1083 ChangeLog-2010
  1171 ChangeLog-2007
  1356 ChangeLog-2005
  1361 ChangeLog-2009
  1914 ChangeLog-9899
  2066 ChangeLog-0001
  2187 ChangeLog-0203
  5223 ChangeLog-9197
 24033 合計
takk@deb9:~/src/binutils-2.28/binutils$ 

最大数5223なので、それを超える数、例えば9999をheadで指定して、全ファイルを一つのテキストに結合します。そして、結合テキストにセパレータを入れ込みます。例えば2000年以降を抽出したいなら、2000の前に、適当なセパレータ(:::としました)を追加し、tmpディレクトリの適当ファイルに保存。

takk@deb9:~/src/binutils-2.28/binutils$ head -9999 Change* | sed 's/^\(20..\)/:::\1/' > /tmp/test/clog
takk@deb9:~/src/binutils-2.28/binutils$ 

保存先へcd。

takk@deb9:~/src/binutils-2.28/binutils$ cd /tmp/test
takk@deb9:/tmp/test$ 

セパレータを指定して、csplit

takk@deb9:/tmp/test$ csplit clog /:::/ {*}

takk@deb9:/tmp/test$ 

こうしておくと、各ChangeLogがLog毎にファイルになります。

takk@deb9:/tmp/test$ grep -l bin2c xx*
xx1020
xx1091
xx1092
xx1154
xx1296
xx1301
xx1423
xx1520
takk@deb9:/tmp/test$ 

後は、head等で中身を見れば、bin2cに関して修正があったChangeLogがまとめて読めます。

takk@deb9:/tmp/test$ grep -l bin2c xx* | xargs head
==> xx1020 <==
:::2007-07-05  Nick Clifton  <nickc@redhat.com>

	* addr2line.c: Update copyright notice to refer to GPLv3.
	* ar.c, arlex.l, arparse.y, arsup.c, arsup.h, bin2c.c, binemul.c,
	binemul.h, bucomm.c, bucomm.h, budbg.h, coffdump.c, coffgrok.c,
	coffgrok.h, cxxfilt.c, debug.c, debug.h, deflex.l, defparse.y,
	dlltool.c, dlltool.h, dllwrap.c, dwarf.c, dwarf.h, embedspu.sh,
	emul_aix.c, emul_vanilla.c, filemode.c, ieee.c, mclex.c,
	mcparse.y, nlmconv.c, nlmconv.h, nlmheader.y, nm.c, objcopy.c,
	objdump.c, prdbg.c, rclex.c, rcparse.y, rdcoff.c, rddbg.c,

==> xx1091 <==
:::2007-02-28  Alan Modra  <amodra@bigpond.net.au>

	* Makefile.am (PROGS): Add BUILD_INSTALL_MISC.
	(bin_PROGRAMS): Replace BUILD_MISC with BUILD_INSTALL_MISC.
	(EXTRA_PROGRAMS): Remove bin2c.
	(bin2c$(EXEEXT_FOR_BUILD)): New rule.
	(bin2c_SOURCES): Delete.
	(DISTCLEANFILES): Remove sysinfo.
	(MOSTLYCLEANFILES): Add sysinfo$(EXEEXT_FOR_BUILD) and
	bin2c$(EXEEXT_FOR_BUILD).

==> xx1092 <==
:::2007-02-27  Alan Modra  <amodra@bigpond.net.au>

	* bin2c.c: New file.
	* Makefile.am (EXTRA_PROGRAMS): Add bin2c.
	(CFILES): Add bin2c.c.
	(bin2c_SOURCES): Define.
	(bin2c.o): Dependencies from "make dep-am".
	* configure.in (BUILD_MISC): Add bin2c.
	* version.c: Update year.
	* po/POTFILES.in: Regenerate.

==> xx1154 <==
:::2008-08-25  Alan Modra  <amodra@bigpond.net.au>

	* sysdep.h: Include "binary-io.h".
	(O_BINARY): Don't define here.
	* bin2c.c (O_BINARY, O_TEXT, SET_BINARY): Don't define here.
	* strings.c: Likewise.
	(main): Remove #ifdef SET_BINARY.
	* Makefile.am: Run "make dep-am"
	* Makefile.in: Regenerate.


==> xx1296 <==
:::2009-08-28  H.J. Lu  <hongjiu.lu@intel.com>

	* Makefile.am (sysinfo$(EXEEXT_FOR_BUILD)): Replace
	CFLAGS/LDFLAGS with CFLAGS_FOR_BUILD/LDFLAGS_FOR_BUILD.
	(syslex.o): Likewise.
	(sysinfo.o): Likewise.
	(bin2c$(EXEEXT_FOR_BUILD)): Likewise.
	* Makefile.in: Regenerated.


==> xx1301 <==
:::2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>

	* Makefile.am (AM_CPPFLAGS): Renamed from ...
	(INCLUDES): ... this.
	(bin2c$(EXEEXT_FOR_BUILD): Adjust rule.
	(installcheck-local): Renamed from ...
	(installcheck): ... this.
	* Makefile.in: Regenerate.

	* Makefile.am (AUTOMAKE_OPTIONS): Remove cygnus, add no-dist and

==> xx1423 <==
:::2010-11-05  Alan Modra  <amodra@gmail.com>

	* bin2c.c: Remove internationalization and version report.
	* Makefile.am: Update bin2c rule.
	* Makefile.in: Regenerate.


==> xx1520 <==
:::2010-01-26  Tristan Gingold  <gingold@adacore.com>

	* Makefile.am (bin2c): Add libintl dependance and library.
	* Makefile.in: Regenerate.

takk@deb9:/tmp/test$ 

コメント

タイトルとURLをコピーしました