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'
|
echo "$1" | sed 's/\\/\//g'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
interactive=TRUE
|
||||||
|
cpack_skip_license=FALSE
|
||||||
|
cpack_include_subdir=""
|
||||||
for a in "$@CPACK_AT_SIGN@"; do
|
for a in "$@CPACK_AT_SIGN@"; do
|
||||||
if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
|
if echo $a | grep "^--prefix=" > /dev/null 2> /dev/null; then
|
||||||
cpack_prefix_dir=`echo $a | sed "s/^--prefix=//"`
|
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
|
if echo $a | grep "^--exclude-subdir" > /dev/null 2> /dev/null; then
|
||||||
cpack_include_subdir=FALSE
|
cpack_include_subdir=FALSE
|
||||||
fi
|
fi
|
||||||
|
if echo $a | grep "^--skip-license" > /dev/null 2> /dev/null; then
|
||||||
|
cpack_skip_license=TRUE
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "x${cpack_include_subdir}x" != "xx" -o "x${cpack_skip_license}x" == "xTRUEx" ]
|
||||||
|
then
|
||||||
|
interactive=FALSE
|
||||||
|
fi
|
||||||
|
|
||||||
cpack_version
|
cpack_version
|
||||||
echo "This is a self-extracting archive."
|
echo "This is a self-extracting archive."
|
||||||
toplevel="`pwd`"
|
toplevel="`pwd`"
|
||||||
|
@ -56,16 +66,40 @@ then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "The archive will be extracted to: ${toplevel}"
|
echo "The archive will be extracted to: ${toplevel}"
|
||||||
echo ""
|
|
||||||
|
|
||||||
if [ "x${cpack_include_subdir}x" == "xx" ]
|
if [ "x${interactive}x" == "xTRUEx" ]
|
||||||
then
|
then
|
||||||
|
echo ""
|
||||||
echo "If you want to stop extracting, please press <ctrl-C>."
|
echo "If you want to stop extracting, please press <ctrl-C>."
|
||||||
echo "Include the subdirectory @CPACK_PACKAGE_FILE_NAME@" [Yn]:
|
|
||||||
read line
|
if [ "x${cpack_skip_license}x" != "xTRUEx" ]
|
||||||
if [ "x${line}x" != "xnx" -a "x${line}x" != "xNx" ]
|
|
||||||
then
|
then
|
||||||
cpack_include_subdir=TRUE
|
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
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -74,7 +108,9 @@ then
|
||||||
toplevel="${toplevel}/@CPACK_PACKAGE_FILE_NAME@"
|
toplevel="${toplevel}/@CPACK_PACKAGE_FILE_NAME@"
|
||||||
mkdir -p "${toplevel}"
|
mkdir -p "${toplevel}"
|
||||||
fi
|
fi
|
||||||
echo "Extracting... Please wait..."
|
echo
|
||||||
|
echo "Using target directory: ${toplevel}"
|
||||||
|
echo "Extracting, please wait..."
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
# take the archive portion of this file and pipe it to tar
|
# 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;
|
cmsys_ios::ostringstream str;
|
||||||
int counter = 0;
|
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###";
|
const char headerLengthTag[] = "###CPACK_HEADER_LENGTH###";
|
||||||
|
|
||||||
// Create the header
|
// Create the header
|
||||||
std::string inFile = this->GetOption("CPACK_STGZ_HEADER_FILE");
|
std::string inFile = this->GetOption("CPACK_STGZ_HEADER_FILE");
|
||||||
std::string line;
|
|
||||||
std::ifstream ifs(inFile.c_str());
|
std::ifstream ifs(inFile.c_str());
|
||||||
std::string packageHeaderText;
|
std::string packageHeaderText;
|
||||||
while ( cmSystemTools::GetLineFromStream(ifs, line) )
|
while ( cmSystemTools::GetLineFromStream(ifs, line) )
|
||||||
|
|
Loading…
Reference in New Issue