ENH: Add license and make it more verbose
This commit is contained in:
parent
689a4e4e12
commit
a8bb20dce5
|
@ -26,7 +26,9 @@ cpack_fix_slashes ()
|
|||
echo "$1" | sed 's/\\/\//g'
|
||||
}
|
||||
|
||||
|
||||
interactive=TRUE
|
||||
cpack_skip_license=FALSE
|
||||
cpack_include_subdir=""
|
||||
for a in "$@CPACK_AT_SIGN@"; do
|
||||
if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
|
||||
cpack_prefix_dir=`echo $a | sed "s/^--prefix=//"`
|
||||
|
@ -45,8 +47,16 @@ for a in "$@CPACK_AT_SIGN@"; do
|
|||
if echo $a | grep "^--exclude-subdir" > /dev/null 2> /dev/null; then
|
||||
cpack_include_subdir=FALSE
|
||||
fi
|
||||
if echo $a | grep "^--skip-license" > /dev/null 2> /dev/null; then
|
||||
cpack_skip_license=TRUE
|
||||
fi
|
||||
done
|
||||
|
||||
if [ "x${cpack_include_subdir}x" != "xx" -o "x${cpack_skip_license}x" == "xTRUEx" ]
|
||||
then
|
||||
interactive=FALSE
|
||||
fi
|
||||
|
||||
cpack_version
|
||||
echo "This is a self-extracting archive."
|
||||
toplevel="`pwd`"
|
||||
|
@ -56,16 +66,40 @@ then
|
|||
fi
|
||||
|
||||
echo "The archive will be extracted to: ${toplevel}"
|
||||
echo ""
|
||||
|
||||
if [ "x${cpack_include_subdir}x" == "xx" ]
|
||||
if [ "x${interactive}x" == "xTRUEx" ]
|
||||
then
|
||||
echo ""
|
||||
echo "If you want to stop extracting, please press <ctrl-C>."
|
||||
echo "Include the subdirectory @CPACK_PACKAGE_FILE_NAME@" [Yn]:
|
||||
read line
|
||||
if [ "x${line}x" != "xnx" -a "x${line}x" != "xNx" ]
|
||||
|
||||
if [ "x${cpack_skip_license}x" != "xTRUEx" ]
|
||||
then
|
||||
more << ____cpack__here_doc____
|
||||
@CPACK_RESOURCE_FILE_LICENSE_CONTENT@
|
||||
____cpack__here_doc____
|
||||
echo
|
||||
echo "Do you accept the license? [Yn]: "
|
||||
read line leftover
|
||||
case ${line} in
|
||||
y* | Y*)
|
||||
cpack_license_accepted=TRUE;;
|
||||
*)
|
||||
echo "License not accepted. Exiting ..."
|
||||
exit 1;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if [ "x${cpack_include_subdir}x" == "xx" ]
|
||||
then
|
||||
echo "By default the @CPACK_PACKAGE_NAME@ will be installed in:"
|
||||
echo " \"${toplevel}\""
|
||||
echo "Do you want to include the subdirectory @CPACK_PACKAGE_FILE_NAME@?"
|
||||
echo "Install in: \"${toplevel}/@CPACK_PACKAGE_FILE_NAME@\" [Yn]: "
|
||||
read line leftover
|
||||
case ${line} in
|
||||
y* | Y*)
|
||||
cpack_include_subdir=TRUE
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@ -74,7 +108,9 @@ then
|
|||
toplevel="${toplevel}/@CPACK_PACKAGE_FILE_NAME@"
|
||||
mkdir -p "${toplevel}"
|
||||
fi
|
||||
echo "Extracting... Please wait..."
|
||||
echo
|
||||
echo "Using target directory: ${toplevel}"
|
||||
echo "Extracting, please wait..."
|
||||
echo ""
|
||||
|
||||
# take the archive portion of this file and pipe it to tar
|
||||
|
|
|
@ -84,11 +84,20 @@ int cmCPackSTGZGenerator::GenerateHeader(std::ostream* os)
|
|||
cmsys_ios::ostringstream str;
|
||||
int counter = 0;
|
||||
|
||||
std::string inLicFile = this->GetOption("CPACK_RESOURCE_FILE_LICENSE");
|
||||
std::string line;
|
||||
std::ifstream ilfs(inLicFile.c_str());
|
||||
std::string licenseText;
|
||||
while ( cmSystemTools::GetLineFromStream(ilfs, line) )
|
||||
{
|
||||
licenseText += line + "\n";
|
||||
}
|
||||
this->SetOptionIfNotSet("CPACK_RESOURCE_FILE_LICENSE_CONTENT", licenseText.c_str());
|
||||
|
||||
const char headerLengthTag[] = "###CPACK_HEADER_LENGTH###";
|
||||
|
||||
// Create the header
|
||||
std::string inFile = this->GetOption("CPACK_STGZ_HEADER_FILE");
|
||||
std::string line;
|
||||
std::ifstream ifs(inFile.c_str());
|
||||
std::string packageHeaderText;
|
||||
while ( cmSystemTools::GetLineFromStream(ifs, line) )
|
||||
|
|
Loading…
Reference in New Issue