Skip to content

Commit

Permalink
Changed to recognise the jam license.
Browse files Browse the repository at this point in the history
Added a summary mode.


[SVN r25082]
  • Loading branch information
jzmaddock committed Sep 14, 2004
1 parent dfad67c commit 1c8b0fc
Show file tree
Hide file tree
Showing 6 changed files with 104 additions and 44 deletions.
1 change: 1 addition & 0 deletions bcp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class bcp_application
virtual void enable_scan_mode() = 0;
virtual void enable_licence_mode() = 0;
virtual void enable_bsl_convert_mode() = 0;
virtual void enable_bsl_summary_mode() = 0;
virtual void set_boost_path(const char* p) = 0;
virtual void set_destination(const char* p) = 0;
virtual void add_module(const char* p) = 0;
Expand Down
5 changes: 5 additions & 0 deletions bcp_imp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ void bcp_implementation::enable_bsl_convert_mode()
m_bsl_convert_mode = true;
}

void bcp_implementation::enable_bsl_summary_mode()
{
m_bsl_summary_mode = true;
}

void bcp_implementation::enable_unix_lines()
{
m_unix_lines = true;
Expand Down
2 changes: 2 additions & 0 deletions bcp_imp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class bcp_implementation
void enable_scan_mode();
void enable_licence_mode();
void enable_bsl_convert_mode();
void enable_bsl_summary_mode();
void set_boost_path(const char* p);
void set_destination(const char* p);
void add_module(const char* p);
Expand Down Expand Up @@ -83,6 +84,7 @@ class bcp_implementation
bool m_unix_lines; // fix line endings
bool m_scan_mode; // scan non-boost files.
bool m_bsl_convert_mode; // try to convert to the BSL
bool m_bsl_summary_mode; // summarise BSL issues only
fs::path m_boost_path; // the path to the boost root
fs::path m_dest_path; // the path to copy to
std::map<fs::path, bool, path_less> m_cvs_paths; // valid files under cvs control
Expand Down
44 changes: 39 additions & 5 deletions licence_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ std::pair<const licence_info*, int> get_licences()
"\\d[^[:alpha:]]+"
"([[:alpha:]]"
"(?:"
"(?!Use\\b|Permission\\b|All\\b|<P|(?:-\\s*)\\w+(?:://|@)"
"(?!Use\\b|Permission\\b|All\\b|<P|(?:-\\s*)\\w+(?:://|@)|\\\\"
")[^\\n\\d]"
")+"
")"
Expand Down Expand Up @@ -72,7 +72,7 @@ std::pair<const licence_info*, int> get_licences()
"LICENSE_1_0.txt or copy at <a href=\"http://www.boost.org/LICENSE_1_0.txt\">http://www.boost.org/LICENSE_1_0.txt)</a></P>"
)
,
licence_info( boost::regex("\\W+subject\\W+to"
licence_info( boost::regex("(?!is)\\w\\w\\W+subject\\W+to"
"(\\W+the)?[^\"[:word:]]+Boost\\W+Software\\W+License\\W+Version\\W+1.0", boost::regex::perl | boost::regex::icase)
,
boost::regex(generic_author_sig, boost::regex::perl | boost::regex::icase)
Expand Down Expand Up @@ -599,11 +599,12 @@ std::pair<const licence_info*, int> get_licences()
"are\\W+clearly\\W+marked\\W+"
"ALL\\W+WARRANTIES\\W+ARE\\W+HEREBY\\W+DISCLAIMED"
"|"
"This\\W+file\\W+is\\W+part\\W+of\\W+Jam\\W+see\\W+jam\\.c\\W+for\\W+Copyright\\W+information", boost::regex::perl | boost::regex::icase)
"This\\W+file\\W+is\\W+part\\W+of\\W+Jam\\W+see\\W+jam\\.c\\W+for\\W+Copyright\\W+information"
"|This file has been donated to Jam", boost::regex::perl | boost::regex::icase)
,
boost::regex(generic_author_sig, boost::regex::perl | boost::regex::icase)
boost::regex(generic_author_sig + std::string("|(Craig\\W+W\\W+McPheeters\\W+Alias\\W+Wavefront)"), boost::regex::perl | boost::regex::icase)
,
generic_author_format
generic_author_format + std::string("(?4Craig W. McPheeters, Alias|Wavefront)")
,
"Perforce Jam License"
,
Expand All @@ -615,6 +616,39 @@ std::pair<const licence_info*, int> get_licences()
"<P>ALL WARRANTIES ARE HEREBY DISCLAIMED</P>"
)
,
licence_info( boost::regex(
"Permission\\W+is\\W+granted\\W+to\\W+anyone\\W+to\\W+use\\W+this\\W+software\\W+for\\W+any\\W+"
"purpose\\W+on\\W+any\\W+computer\\W+system\\W+and\\W+to\\W+redistribute\\W+it\\W+freely\\W+"
"subject\\W+to\\W+the\\W+following\\W+restrictions\\W+"
"1\\W+The\\W+author\\W+is\\W+not\\W+responsible\\W+for\\W+the\\W+consequences\\W+of\\W+use\\W+of\\W+"
"this\\W+software\\W+no\\W+matter\\W+how\\W+awful\\W+even\\W+if\\W+they\\W+arise\\W+"
"from\\W+defects\\W+in\\W+it\\W+"
"2\\W+The\\W+origin\\W+of\\W+this\\W+software\\W+must\\W+not\\W+be\\W+misrepresented\\W+either\\W+"
"by\\W+explicit\\W+claim\\W+or\\W+by\\W+omission\\W+"
"3\\W+Altered\\W+versions\\W+must\\W+be\\W+plainly\\W+marked\\W+as\\W+such\\W+and\\W+must\\W+not\\W+"
"be\\W+misrepresented\\W+as\\W+being\\W+the\\W+original\\W+software"
"|Definitions\\W+etc\\W+for\\W+regexp\\W+3\\W+routines", boost::regex::perl | boost::regex::icase)
,
boost::regex(generic_author_sig + std::string("|(Definitions\\W+etc\\W+for\\W+regexp\\W+3\\W+routines)"), boost::regex::perl | boost::regex::icase)
,
generic_author_format + std::string("(?4University of Toronto)")
,
"BSD Regex License"
,
"<P>Copyright (c) 1986 by University of Toronto.</P>"
"<P>Written by Henry Spencer. Not derived from licensed software.</P>"
"<P>Permission is granted to anyone to use this software for any"
"purpose on any computer system, and to redistribute it freely,"
"subject to the following restrictions:</P>"
"<P>The author is not responsible for the consequences of use of"
"this software, no matter how awful, even if they arise"
"from defects in it.</P>"
"<p>The origin of this software must not be misrepresented, either"
"by explicit claim or by omission.</p>"
"<p>Altered versions must be plainly marked as such, and must not"
"be misrepresented as being the original software.</P>"
)
,
};
return std::pair<const licence_info*, int>(licences, sizeof(licences)/sizeof(licences[0]));
}
Expand Down
4 changes: 4 additions & 0 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ int cpp_main(int argc, char* argv[])
{
papp->enable_bsl_convert_mode();
}
else if(0 == std::strcmp("--bsl-summary", argv[i]))
{
papp->enable_bsl_summary_mode();
}
else if(0 == std::strcmp("--unix-lines", argv[i]))
{
papp->enable_unix_lines();
Expand Down
92 changes: 53 additions & 39 deletions output_licence_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ void bcp_implementation::output_licence_info()
os << "<a href=\"#files\">Files with no recognised licence</a>\n"
"<a href=\"#authors\">Files with no recognised copyright holder</a>\n"
"Moving to the Boost Software License...\n"
" <a href=\"#bsl-converted\">Files that have been converted to the Boost Software License</a>\n"
" <a href=\"#to-bsl\">Files that can be moved to the BSL</a>\n"
" <a href=\"#not-to-bsl\">Files that can <b>NOT</b> be moved to the BSL</a>\n"
" <a href=\"#need-bsl-authors\">Authors we need to move to the BSL</a>\n"
" <a href=\"#bsl-converted\">Files that can be automatically converted to the Boost Software License</a>\n"
" <a href=\"#to-bsl\">Files that can be manually converted to the Boost Software License</a>\n"
" <a href=\"#not-to-bsl\">Files that can <b>NOT</b> be moved to the Boost Software License</a>\n"
" <a href=\"#need-bsl-authors\">Authors we need to move to the Boost Software License</a>\n"
"<a href=\"#copyright\">Copyright Holder Information</a>\n"
"<a href=\"#depend\">File Dependency Information</a>\n"
"</pre>";
Expand Down Expand Up @@ -158,6 +158,7 @@ void bcp_implementation::output_licence_info()
//
i = m_licence_data.begin();
j = m_licence_data.end();
int license_index = 0;
os << "<a name=\"details\"></a><h2>Licence Details</h2>\n";
while(i != j)
{
Expand All @@ -167,28 +168,36 @@ void bcp_implementation::output_licence_info()
<< "\"></a>" << licences.first[i->first].licence_name << "</H3>\n";
// licence text:
os << "<BLOCKQUOTE>" << licences.first[i->first].licence_text << "</BLOCKQUOTE>";
// Copyright holders:
os << "<P>This licence is used by the following " << i->second.authors.size() << " copyright holders:</P>\n<BLOCKQUOTE><P>";
std::set<std::string>::const_iterator x, y;
x = i->second.authors.begin();
y = i->second.authors.end();
while(x != y)
if(!m_bsl_summary_mode || (license_index >= 3))
{
os << *x << "<BR>\n";
++x;
// Copyright holders:
os << "<P>This licence is used by the following " << i->second.authors.size() << " copyright holders:</P>\n<BLOCKQUOTE><P>";
std::set<std::string>::const_iterator x, y;
x = i->second.authors.begin();
y = i->second.authors.end();
while(x != y)
{
os << *x << "<BR>\n";
++x;
}
os << "</P></BLOCKQUOTE>\n";
// Files using this licence:
os << "<P>This licence applies to the following " << i->second.files.size() << " files:</P>\n<BLOCKQUOTE><P>";
std::set<fs::path, path_less>::const_iterator m, n;
m = i->second.files.begin();
n = i->second.files.end();
while(m != n)
{
os << split_path(m_boost_path, *m) << "<br>\n";
++m;
}
os << "</P></BLOCKQUOTE>\n";
}
os << "</P></BLOCKQUOTE>\n";
// Files using this licence:
os << "<P>This licence applies to the following " << i->second.files.size() << " files:</P>\n<BLOCKQUOTE><P>";
std::set<fs::path, path_less>::const_iterator m, n;
m = i->second.files.begin();
n = i->second.files.end();
while(m != n)
else
{
os << split_path(m_boost_path, *m) << "<br>\n";
++m;
os << "<P>File list and Authors omitted for brevity</P>" << std::endl;
}
os << "</P></BLOCKQUOTE>\n";
++license_index;
++i;
}
//
Expand Down Expand Up @@ -223,28 +232,33 @@ void bcp_implementation::output_licence_info()
// Software License, along with enough information for human
// verification.
//
os << "<h2><a name=\"bsl-converted\"></a>Files that have been converted to the Boost Software License</h2>\n"
<< "<P>The following " << m_converted_to_bsl.size() << " files have been automatically converted to the Boost Software License, but require manual verification before they can be committed to CVS:</P>\n";
if (!m_converted_to_bsl.empty()) {
typedef std::map<fs::path, std::pair<std::string, std::string>, path_less>
::const_iterator conv_iterator;
conv_iterator i = m_converted_to_bsl.begin(),
ie = m_converted_to_bsl.end();
int file_num = 1;
while (i != ie) {
os << "<P>[" << file_num << "] File: <tt>" << split_path(m_boost_path, i->first)
<< "</tt><br>\n<table border=\"1\">\n <tr>\n <td><pre>"
<< i->second.first << "</pre></td>\n <td><pre>"
<< i->second.second << "</pre></td>\n </tr>\n</table>\n";
++i;
++file_num;
}
os << "<h2><a name=\"bsl-converted\"></a>Files that can be automatically converted to the Boost Software License</h2>\n"
<< "<P>The following " << m_converted_to_bsl.size() << " files can be automatically converted to the Boost Software License, but require manual verification before they can be committed to CVS:</P>\n";
if(!m_bsl_summary_mode)
{
if (!m_converted_to_bsl.empty())
{
typedef std::map<fs::path, std::pair<std::string, std::string>, path_less>
::const_iterator conv_iterator;
conv_iterator i = m_converted_to_bsl.begin(),
ie = m_converted_to_bsl.end();
int file_num = 1;
while (i != ie)
{
os << "<P>[" << file_num << "] File: <tt>" << split_path(m_boost_path, i->first)
<< "</tt><br>\n<table border=\"1\">\n <tr>\n <td><pre>"
<< i->second.first << "</pre></td>\n <td><pre>"
<< i->second.second << "</pre></td>\n </tr>\n</table>\n";
++i;
++file_num;
}
}
}
//
// Output list of files that could be moved over to the Boost Software License
//
os << "<h2><a name=\"to-bsl\"></a>Files that could be converted to the Boost Software License</h2>\n"
"<P>The following " << m_can_migrate_to_bsl.size() << " files could be converted to the Boost Software License, but have not yet been:</P>\n<BLOCKQUOTE><P>";
"<P>The following " << m_can_migrate_to_bsl.size() << " files could be manually converted to the Boost Software License, but have not yet been:</P>\n<BLOCKQUOTE><P>";
i2 = m_can_migrate_to_bsl.begin();
j2 = m_can_migrate_to_bsl.end();
while(i2 != j2)
Expand Down

0 comments on commit 1c8b0fc

Please sign in to comment.