Skip to content

Commit

Permalink
optimize copyrights generation script
Browse files Browse the repository at this point in the history
  • Loading branch information
elfmz committed Oct 20, 2021
1 parent 3f239ee commit 3d3976a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
27 changes: 15 additions & 12 deletions packaging/debian/copyright/generate.pl
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,7 @@
my @copyright = collect_bone_field('Copyright');
if (scalar(@files) > 0) {
my %commiters;
for (@files) {
my @subfiles = split(/ /, $_);
for (@subfiles) {
my $file = trim($_);
collect_commiters($file, \%commiters) if $file ne '';
}
}
collect_commiters(\@files, \%commiters);
append_commiters(\%commiters, \@copyright);
}
my $skipping = undef;
Expand Down Expand Up @@ -90,11 +84,20 @@

sub collect_commiters
{
my ($file, $commiters) = (@_);
my $path = "$scandir/$file";
$path = substr($path, 0, length($path) - 2) if substr($path, -2) eq '/*';
print "Copyrighting: $path\n";
my @gitout = split /[\n\r]/, `git log --date=short --pretty=format:\"%an%x09%ad\" -- \'$path\'`;
my ($files, $commiters) = (@_);
my $pathes = '';
for (@{$files}) {
my @subfiles = split(/ /, $_);
for (@subfiles) {
my $path = "$scandir/$_";
$path = substr($path, 0, length($path) - 2) if substr($path, -2) eq '/*';
$pathes.= ' ' if $pathes ne '';
$pathes.= "'$path'";
}
}
return if $pathes eq '';
print "Copyrighting: $pathes\n";
my @gitout = split /[\n\r]/, `git log --date=short --pretty=format:\"%an%x09%ad\" -- $pathes`;
for $gitline (@gitout) {
# $gitline == 'somebody 2021-09-01'
my ($commiter, $date) = split(/\t/, trim($gitline));
Expand Down
2 changes: 1 addition & 1 deletion packaging/debian/copyright/skeleton
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ Copyright: 2003-2006 Alberto Demichelis
License: T-Rex

Files: editorcomp/*
Copyright: 2017-2018 MikeMirzayanov
Copyright:
License: GPL-2

Files: far2l/bootstrap/* far2l/Include/* far2l/array.hpp far2l/BaseFileMask.hpp far2l/bitflags.hpp far2l/cache.cpp far2l/cache.hpp far2l/cddrv.cpp far2l/cddrv.hpp far2l/CFileMask.cpp far2l/CFileMask.hpp far2l/chgmmode.cpp far2l/chgmmode.hpp far2l/chgprior.cpp far2l/chgprior.hpp far2l/clipboard.cpp far2l/clipboard.hpp far2l/cmdline.cpp far2l/cmdline.hpp far2l/codepage.cpp far2l/codepage.hpp far2l/colors.hpp far2l/config.cpp far2l/config.hpp far2l/console.cpp far2l/console.hpp far2l/constitle.cpp far2l/constitle.hpp far2l/copy.cpp far2l/copy.hpp far2l/CriticalSections.hpp far2l/ctrlobj.cpp far2l/ctrlobj.hpp far2l/cvtname.cpp far2l/cvtname.hpp far2l/datetime.cpp far2l/datetime.hpp far2l/delete.cpp far2l/delete.hpp far2l/dialog.cpp far2l/dialog.hpp far2l/dirinfo.cpp far2l/dirinfo.hpp far2l/dirmix.cpp far2l/dirmix.hpp far2l/dizlist.cpp far2l/dizlist.hpp far2l/DlgBuilder.cpp far2l/DlgBuilder.hpp far2l/dlgedit.cpp far2l/dlgedit.hpp far2l/DlgGuid.cpp far2l/DlgGuid.hpp far2l/DList.cpp far2l/DList.hpp far2l/drivemix.cpp far2l/drivemix.hpp far2l/edit.cpp far2l/edit.hpp far2l/editor.cpp far2l/editor.hpp far2l/eject.cpp far2l/eject.hpp far2l/elevation.cpp far2l/elevation.hpp far2l/execute.cpp far2l/execute.hpp far2l/exitcode.hpp far2l/FarDlgBuilder.hpp far2l/farexcpt.cpp far2l/farexcpt.hpp far2l/farqueue.cpp far2l/farqueue.hpp far2l/farrtl.cpp far2l/farrtl.hpp far2l/farwinapi.cpp far2l/farwinapi.hpp far2l/BookmarksLegacy.cpp far2l/BookmarksMenu.cpp far2l/fileattr.cpp far2l/fileattr.hpp far2l/fileedit.cpp far2l/fileedit.hpp far2l/filefilter.cpp far2l/filefilter.hpp far2l/filefilterparams.cpp far2l/filefilterparams.hpp far2l/filelist.cpp far2l/filelist.hpp far2l/FileMasksProcessor.cpp far2l/FileMasksProcessor.hpp far2l/FileMasksWithExclude.cpp far2l/FileMasksWithExclude.hpp far2l/fileowner.cpp far2l/fileowner.hpp far2l/filepanels.cpp far2l/filepanels.hpp far2l/filestr.cpp far2l/filestr.hpp far2l/filetype.cpp far2l/filetype.hpp far2l/fileview.cpp far2l/fileview.hpp far2l/findfile.cpp far2l/findfile.hpp far2l/flink.cpp far2l/flink.hpp far2l/flmodes.cpp far2l/flplugin.cpp far2l/flshow.cpp far2l/flupdate.cpp far2l/fnparce.cpp far2l/fnparce.hpp far2l/foldtree.cpp far2l/foldtree.hpp far2l/format.cpp far2l/format.hpp far2l/frame.cpp far2l/frame.hpp far2l/global.cpp far2l/global.hpp far2l/grabber.cpp far2l/grabber.hpp far2l/headers.cpp far2l/headers.hpp far2l/help.cpp far2l/help.hpp far2l/hilight.cpp far2l/hilight.hpp far2l/history.cpp far2l/history.hpp far2l/hmenu.cpp far2l/hmenu.hpp far2l/imports.cpp far2l/imports.hpp far2l/Include/farcolor.hpp far2l/Include/farkeys.hpp far2l/Include/plugin.hpp far2l/infolist.cpp far2l/infolist.hpp far2l/interf.cpp far2l/interf.hpp far2l/keybar.cpp far2l/keybar.hpp far2l/keyboard.cpp far2l/keyboard.hpp far2l/keys.hpp far2l/lang.hpp far2l/language.cpp far2l/language.hpp far2l/local.cpp far2l/local.hpp far2l/localOEM.cpp far2l/localOEM.hpp far2l/lockscrn.cpp far2l/lockscrn.hpp far2l/macro.cpp far2l/macro.hpp far2l/macroopcode.hpp far2l/main.cpp far2l/manager.cpp far2l/manager.hpp far2l/menubar.cpp far2l/menubar.hpp far2l/message.cpp far2l/message.hpp far2l/mix.cpp far2l/mix.hpp far2l/mkdir.cpp far2l/mkdir.hpp far2l/modal.cpp far2l/modal.hpp far2l/namelist.cpp far2l/namelist.hpp far2l/network.cpp far2l/network.hpp far2l/noncopyable.hpp far2l/options.cpp far2l/options.hpp far2l/palette.cpp far2l/palette.hpp far2l/panel.cpp far2l/panel.hpp far2l/panelctype.hpp far2l/panelmix.cpp far2l/panelmix.hpp far2l/pathmix.cpp far2l/pathmix.hpp far2l/plclass.hpp far2l/plist.cpp far2l/plist.hpp far2l/plognmn.cpp far2l/plognmn.hpp far2l/plugapi.cpp far2l/plugapi.hpp far2l/plugin.hpp far2l/PluginA.cpp far2l/PluginA.hpp far2l/plugins.cpp far2l/plugins.hpp far2l/PluginW.cpp far2l/PluginW.hpp far2l/poscache.cpp far2l/poscache.hpp far2l/processname.cpp far2l/processname.hpp far2l/qview.cpp far2l/qview.hpp far2l/rdrwdsk.cpp far2l/rdrwdsk.hpp far2l/RefreshFrameManager.cpp far2l/RefreshFrameManager.hpp far2l/RegExp.cpp far2l/RegExp.hpp far2l/savescr.cpp far2l/savescr.hpp far2l/scantree.cpp far2l/scantree.hpp far2l/scrbuf.cpp far2l/scrbuf.hpp far2l/scrobj.cpp far2l/scrobj.hpp far2l/scrsaver.cpp far2l/scrsaver.hpp far2l/setattr.cpp far2l/setattr.hpp far2l/setcolor.cpp far2l/setcolor.hpp far2l/stddlg.cpp far2l/stddlg.hpp far2l/strmix.cpp far2l/strmix.hpp far2l/synchro.cpp far2l/synchro.hpp far2l/syntax.cpp far2l/syntax.hpp far2l/syslog.cpp far2l/syslog.hpp far2l/TPreRedrawFunc.cpp far2l/TPreRedrawFunc.hpp far2l/treelist.cpp far2l/treelist.hpp far2l/TStack.hpp far2l/tvar.cpp far2l/tvar.hpp far2l/udlist.cpp far2l/udlist.hpp far2l/FARString.cpp far2l/FARString.hpp far2l/usermenu.cpp far2l/usermenu.hpp far2l/viewer.cpp far2l/viewer.hpp far2l/vmenu.cpp far2l/vmenu.hpp far2l/wakeful.hpp far2l/window.cpp far2l/window.hpp far2l/wrap.cpp far2l/xlat.cpp far2l/xlat.hpp
Expand Down

0 comments on commit 3d3976a

Please sign in to comment.