From e5d940b39d648d1ecb8b9a64869a3b0add9065d1 Mon Sep 17 00:00:00 2001 From: dianzhu Date: Fri, 12 Jul 2024 19:36:33 -0400 Subject: [PATCH 1/3] Integrate AI with tinyllama model into zopen-build file --- bin/zopen-build | 309 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 240 insertions(+), 69 deletions(-) diff --git a/bin/zopen-build b/bin/zopen-build index 4ce8495f..fa7ff9c5 100755 --- a/bin/zopen-build +++ b/bin/zopen-build @@ -19,7 +19,9 @@ setupMyself() MYDIR="$(cd "$(dirname "$0")" > /dev/null 2>&1 && pwd -P)" INCDIR="${MYDIR}/../include" if ! [ -d "${INCDIR}" ] && ! [ -f "${INCDIR}/common.sh" ]; then - echo "Internal Error. Unable to find common.sh file to source." >&2 + Error_Message="Internal Error. Unable to find common.sh file to source." >&2 + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printSoftError" "${Error_Message}" "${Error_Message}" exit 8 fi . "${INCDIR}/common.sh" @@ -43,12 +45,16 @@ asciiecho() file="$2" if ! echo "${text}" > "${file}"; then - echo "Unable to echo text to ${file}" >&2 + Error_Message="Unable to echo text to ${file}" >&2 + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printSoftError" "${Error_Message}" "${Error_Message}" return 2 fi if [ "$(chtag -p "${file}" | cut -f2 -d' ')" = "IBM-1047" ]; then if ! /bin/iconv -f IBM-1047 -t ISO8859-1 < "${file}" > "${file}_ascii" || ! chtag -tc ISO8859-1 "${file}_ascii" || ! mv "${file}_ascii" "${file}"; then - printError "Unable to convert EBCDIC text to ASCII for ${file}" >&2 + Error_Message="Unable to convert EBCDIC text to ASCII for ${file}" >&2 + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi return 0 @@ -271,7 +277,9 @@ for tmp in "${TMPDIR}" "${TMP}" /tmp; do done if [ ! -d "${tmp}" ]; then - printError "Temporary directory not found. Please specify \$TMPDIR, \$TMP or have a valid /tmp directory." + Error_Message="Temporary directory not found. Please specify \$TMPDIR, \$TMP or have a valid /tmp directory." + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi TMP_FIFO_PIPE="${tmp}/${LOGNAME}.pipe" @@ -387,6 +395,8 @@ Option: -vv run in very verbose mode (sets environment variables V=1 and VERBOSE=1). -u, --upgradedeps upgrade all dependencies by running zopen install. + --ai run with tinyllama model via LocalAI, zopen build will send error to + the model and the model will provide what patch we need to do. The specifics of how the tool works can be controlled through environment variables. The only environment variables you _must_ specify are to tell @@ -424,6 +434,7 @@ processOptions() forceUpgradeDeps=false noInstallRuntimeDeps=false depsDepth=2 + ai=false while [ $# -gt 0 ]; do case $1 in "-h" | "--help" | "-?") @@ -460,6 +471,9 @@ processOptions() buildInReleaseMode=false fi ;; + "--ai") + ai=true + ;; "--deps-depth") shift depsDepth=$1 @@ -505,7 +519,9 @@ processOptions() startShell=true ;; *) - printError "Unknown option ${1} specified" + Error_Message="Unknown option ${1} specified" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" ;; esac shift @@ -515,7 +531,9 @@ processOptions() loadBuildEnv() { if [ ! -r ${buildEnvFile} ]; then - printError "Build environment file '${buildEnvFile}' does not exist or is not readable" + Error_Message="Build environment file '${buildEnvFile}' does not exist or is not readable" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi # Indicates to .env script that we're in zopen build @@ -539,11 +557,15 @@ checkEnv() if [ ! -z "${ZOPEN_BUILD_LINE}" ]; then if [ "${ZOPEN_BUILD_LINE}x" = "DEVx" ]; then if [ -z "${ZOPEN_DEV_DEPS}" ]; then - printError "Building from dev, but ZOPEN_DEV_DEPS not specified" + Error_Message="Building from dev, but ZOPEN_DEV_DEPS not specified" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi ZOPEN_DEPS="${ZOPEN_DEV_DEPS}" if [ -z "${ZOPEN_DEV_URL}" ]; then - printError "Building from dev, but ZOPEN_DEV_URL not specified" + Error_Message="Building from dev, but ZOPEN_DEV_URL not specified" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi ZOPEN_URL="${ZOPEN_DEV_URL}" if [ ! -z "${ZOPEN_DEV_BRANCH}" ]; then @@ -564,11 +586,15 @@ checkEnv() fi elif [ "${ZOPEN_BUILD_LINE}x" = "STABLEx" ]; then if [ -z "${ZOPEN_STABLE_DEPS}" ]; then - printError "Building from stable, but ZOPEN_STABLE_DEPS not specified" + Error_Message="Building from stable, but ZOPEN_STABLE_DEPS not specified" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi ZOPEN_DEPS="${ZOPEN_STABLE_DEPS}" if [ -z "${ZOPEN_STABLE_URL}" ]; then - printError "Building from stable, but ZOPEN_STABLE_URL not specified" + Error_Message="Building from stable, but ZOPEN_STABLE_URL not specified" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi ZOPEN_URL="${ZOPEN_STABLE_URL}" if [ ! -z "${ZOPEN_STABLE_BRANCH}" ]; then @@ -588,7 +614,9 @@ checkEnv() fi fi else - printError "Unrecognized build line ${ZOPEN_BUILD_LINE}" + Error_Message="Unrecognized build line ${ZOPEN_BUILD_LINE}" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi else if [ "${ZOPEN_TYPE}x" = "TARBALLx" ]; then @@ -636,7 +664,9 @@ checkEnv() if [ "${ZOPEN_CHECK}x" != "skipx" ] && ! ${skipcheck}; then export ZOPEN_CHECK_RESULTS_CODE="${ZOPEN_ROOT}/portchk.sh" if ! [ -x "${ZOPEN_CHECK_RESULTS_CODE}" ]; then - printError "zopen_check_results script needs to be provided to check the results." + Error_Message="zopen_check_results script needs to be provided to check the results." + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi fi @@ -658,10 +688,14 @@ checkEnv() if [ "${ZOPEN_TYPE}x" = "TARBALLx" ]; then if [ -z "${ZOPEN_URL}" ]; then - printError "ZOPEN_STABLE_URL, ZOPEN_DEV_URL, ZOPEN_URL or ZOPEN_TARBALL_URL needs to be defined" + Error_Message="ZOPEN_STABLE_URL, ZOPEN_DEV_URL, ZOPEN_URL or ZOPEN_TARBALL_URL needs to be defined" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi if [ -z "${ZOPEN_DEPS}" ]; then - printError "ZOPEN_STABLE_DEPS, ZOPEN_DEV_DEPS, ZOPEN_DEPS or ZOPEN_TARBALL_DEPS needs to be defined" + Error_Message="ZOPEN_STABLE_DEPS, ZOPEN_DEV_DEPS, ZOPEN_DEPS or ZOPEN_TARBALL_DEPS needs to be defined" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi implicitDeps="${implicitDeps} tar" ext=${ZOPEN_URL##*.} @@ -677,10 +711,14 @@ checkEnv() printVerbose "Implicitly adding tarball dependencies: ${implicitDeps}" elif [ "${ZOPEN_TYPE}x" = "GITx" ]; then if [ -z "${ZOPEN_URL}" ]; then - printError "ZOPEN_STABLE_URL, ZOPEN_DEV_URL, ZOPEN_URL or ZOPEN_GIT_URL needs to be defined" + Error_Message="ZOPEN_STABLE_URL, ZOPEN_DEV_URL, ZOPEN_URL or ZOPEN_GIT_URL needs to be defined" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi if [ -z "${ZOPEN_DEPS}" ]; then - printError "ZOPEN_STABLE_DEPS, ZOPEN_DEV_DEPS, ZOPEN_DEPS or ZOPEN_GIT_DEPS needs to be defined" + Error_Message="ZOPEN_STABLE_DEPS, ZOPEN_DEV_DEPS, ZOPEN_DEPS or ZOPEN_GIT_DEPS needs to be defined" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi implicitDeps="${implicitDeps}" printVerbose "Implicitly adding git dependencies: ${implicitDeps}" @@ -693,7 +731,9 @@ checkEnv() for category in $(echo ${ZOPEN_CATEGORIES_LOWER} | tr ' ' '\n' | sort -u); do if ! echo "${ZOPEN_VALID_CATEGORIES}" | tr ' ' '\n' | grep -q "^${category}$"; then - printError "Invalid category specified in \$ZOPEN_CATEGORIES: ${category}" + Error_Message="Invalid category specified in \$ZOPEN_CATEGORIES: ${category}" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi done @@ -744,7 +784,9 @@ setDepsEnv() printVerbose "Setting up ${depdir} dependency environment" cd "${depdir}" && . ./.env if [ $? -gt 0 ]; then - printError "Failed to source ${depdir} .env" + Error_Message="Failed to source ${depdir} .env" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi foundDep=true @@ -763,20 +805,26 @@ setDepsEnv() fi path=${ZOPEN_PKGINSTALL} # Install location if ! runAndLog "PATH=\"${ZOPEN_OLD_PATH}\" ${MYDIR}/zopen-install --install-or-upgrade ${dep} -v -y"; then - printError "zopen install command failed" + Error_Message="zopen install command failed" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi depdir="${path}/${dep}/${dep}" printVerbose "Setting up upgraded ${depdir} dependency environment" cd "${depdir}" && . ./.env if [ $? -gt 0 ]; then - printError "Failed to source ${depdir} .env" + Error_Message="Failed to source ${depdir} .env" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi versionPath="${depdir}/.version" if [ -r "${versionPath}" ]; then version=$(cat "${versionPath}") fi if ! validateVersion "${version}" "${operator}" "${requestedVersion}" "${depdir}"; then - printError "Dependency ${depdir} upgraded, but does not satisfy \"${operator}\" \"${requestedVersion}\"" + Error_Message="Dependency ${depdir} upgraded, but does not satisfy \"${operator}\" \"${requestedVersion}\"" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi done @@ -886,14 +934,18 @@ tagTree() checkGitVersion() { if ! git --version > /dev/null 2> /dev/null; then - printError "git is required to download from the git repo" + Error_Message="git is required to download from the git repo" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi gitraw=$(git --version | awk '{print $3;}') v=${gitraw%%.*} vr=${gitraw%.*} r=${vr##*.} if [ ${v} -lt 2 ] || [ ${r} -lt 39 ]; then - printError "Need to be running at least git 2.39" + Error_Message="Need to be running at least git 2.39" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi } @@ -910,15 +962,21 @@ gitClone() gitOptions=" --recurse-submodules" fi if ! runAndLog "git clone \"${ZOPEN_URL}\" ${gitOptions}"; then - printError "Unable to clone ${gitname} from ${ZOPEN_URL}" + Error_Message="Unable to clone ${gitname} from ${ZOPEN_URL}" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi if [ -n "${ZOPEN_GIT_BRANCH}" ]; then if ! git -C "${dir}" checkout "${ZOPEN_GIT_BRANCH}" > /dev/null; then - printError"Unable to checkout ${ZOPEN_URL} branch ${ZOPEN_GIT_BRANCH}" + Error_Message="Unable to checkout ${ZOPEN_URL} branch ${ZOPEN_GIT_BRANCH}" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi elif [ -n "${ZOPEN_GIT_TAG}" ]; then if ! git -C "${dir}" checkout tags/"${ZOPEN_GIT_TAG}" -b "${ZOPEN_GIT_TAG}" > /dev/null; then - printError"Unable to checkout ${ZOPEN_URL} tag ${ZOPEN_GIT_TAG}" + Error_Message="Unable to checkout ${ZOPEN_URL} tag ${ZOPEN_GIT_TAG}" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi tagTree "${dir}" @@ -934,19 +992,25 @@ extractTarBall() if [ "x${noext}" = "x${tarballz}" ]; then # Standard tarball if ! tar --version > /dev/null 2> /dev/null; then - printError "The tar open source package is required by zopen-build. The z/OS default 'tar' is insufficient" + Error_Message="The tar open source package is required by zopen-build. The z/OS default 'tar' is insufficient" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi tarraw=$(tar --version | head -1 | awk '{print $4;}') v=${tarraw%%.*} r=${tarraw##*.} if [ ${v} -lt 1 ] || [ ${r} -lt 34 ]; then - printError "Need to be running at least tar 1.34" + Error_Message="Need to be running at least tar 1.34" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi printInfo "Extract tarball ${tarballz} into ${dir}" tar -axf "${tarballz}" if [ $? -gt 0 ]; then - printError "Unable to untar ${tarballz}" + Error_Message="Unable to untar ${tarballz}" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi else # Standard unzip @@ -957,13 +1021,17 @@ extractTarBall() printInfo "Extract zip ${tarballz} into ${dir}" out=$(unzip "${tarballz}" 2> /dev/null) if [ $? -gt 1 ]; then - printError "unzip failed for ${tarballz}." + Error_Message="unzip failed for ${tarballz}." + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" echo "${out}" >&2 fi fi rm -f "${tarballz}" tagTree "${dir}" - cd "${dir}" || printError "Cannot cd to ${dir}" + Error_Message="Cannot cd to ${dir}" + content="${Error_Message}.How to fix error?" + cd "${dir}" || AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" # Clean up .git* files since we will be creating our own local git repo for applying patches rm -rf .git* .travis* @@ -974,11 +1042,15 @@ extractTarBall() # if [ "${ZOPEN_GIT_SETUP}x" = "Nx" ]; then if ! git init -b main . > /dev/null || ! git commit --allow-empty -m "Create Empty Repository for patch management" > /dev/null; then - printError "Unable to initialize empty git repository for tarball" + Error_Message="Unable to initialize empty git repository for tarball" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi else if ! git init -b main . > /dev/null; then - printError "Unable to initialize git repository for tarball" + Error_Message="Unable to initialize git repository for tarball" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi if ! asciiecho " @@ -997,15 +1069,21 @@ extractTarBall() *.po binary *.der binary " ".gitattributes"; then - printError "Unable to create .gitattributes for tarball" + Error_Message="Unable to create .gitattributes for tarball" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi if ! git add . > /dev/null; then - printError "Unable to add files for git repository" + Error_Message="Unable to add files for git repository" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi if ! git commit --allow-empty -m "Create Repository for patch management" > /dev/null; then - printError "Unable to commit git repository" + Error_Message="Unable to commit git repository" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi } @@ -1013,7 +1091,9 @@ extractTarBall() downloadTarBall() { if ! curl --version > /dev/null; then - printError "curl is required to download a tarball" + Error_Message="curl is required to download a tarball" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi tarballz=$(basename "${ZOPEN_URL}") dir=${tarballz%%.tar.*} @@ -1043,10 +1123,14 @@ downloadTarBall() if [ -f "${tarballz}" ] && [ $(wc -c "${tarballz}" | awk '{print $1}') -lt 1024 ]; then cat "${tarballz}" > /dev/null else - printError "Re-try curl for diagnostics" + Error_Message="Re-try curl for diagnostics" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" curlCmd -L -0 -o /dev/null "${ZOPEN_URL}" fi - printError "Unable to download ${tarballz} from ${ZOPEN_URL}" + Error_Message="Unable to download ${tarballz} from ${ZOPEN_URL}" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi # curl tags the file as ISO8859-1 (oops) so the tag has to be removed chtag -b "${tarballz}" @@ -1135,8 +1219,10 @@ applyPatches() (cd "${code_dir}" && git apply --reject "${p}" 2>&1) else if ! out=$( (cd "${code_dir}" && git apply --check "${p}" 2>&1 && git apply "${p}" 2>&1)); then - printSoftError "Patch of make tree failed (${p})." - printSoftError "${out}" + First_Error_Message="Patch of make tree failed (${p})." + Second_Error_Message="${out}" + content="${Second_Error_Message} is incorrect.${First_Error_Message}How to fix error?" + AI_Response "${content}" "printSoftError" "${First_Error_Message}\n***ERROR: ${Second_Error_Message}" "${First_Error_Message}\n***ERROR: ${Second_Error_Message}" failedcount=$((failedcount + 1)) break fi @@ -1179,7 +1265,9 @@ getCode() return 4 fi else - printError "ZOPEN_TYPE should be one of GIT or TARBALL" + Error_Message="ZOPEN_TYPE should be one of GIT or TARBALL" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" return 4 fi } @@ -1204,7 +1292,10 @@ cleanup() cleanlog="${ZOPEN_LOG_DIR}/${LOG_PFX}_clean.log" create_fifo_pipe "${cleanlog}" if ! runAndLog "${ZOPEN_CLEAN_CMD} >${TMP_FIFO_PIPE} 2>&1"; then - printError "Cleanup failed. Log: ${cleanlog}" >&2 + Error_Message="Cleanup failed. Log: ${cleanlog}" >&2 + filecontent=$(cat ${cleanlog} | tr -d "\n") + content="Log file failed:${filecontent}.Cleanup failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${cleanlog}" "${Error_Message}" fi fi rm -f ${ZOPEN_LOG_DIR}/bootstrap.success @@ -1222,7 +1313,10 @@ bootstrap() bootlog="${ZOPEN_LOG_DIR}/${LOG_PFX}_bootstrap.log" create_fifo_pipe "${bootlog}" if ! runAndLog "${ZOPEN_BOOTSTRAP_CMD} >${TMP_FIFO_PIPE} 2>&1"; then - printError "Bootstrap failed. Log: ${bootlog}" >&2 + Error_Message="Bootstrap failed. Log: ${bootlog}" >&2 + filecontent=$(cat ${bootlog} | tr -d "\n") + content="Log file failed:${filecontent}.Bootstrap failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${bootlog}" "${Error_Message}" fi touch ${ZOPEN_LOG_DIR}/bootstrap.success fi @@ -1238,7 +1332,9 @@ configure() if command -V "${ZOPEN_PRE_CONFIGURE_CODE}" >/dev/null 2>&1; then printVerbose "Running ${ZOPEN_PRE_CONFIGURE_CODE}" if ! "${ZOPEN_PRE_CONFIGURE_CODE}"; then - printError "Pre configure failed." + Error_Message="Pre configure failed." + content="${ZOPEN_PRE_CONFIGURE_CODE} is incorrect.Pre configure failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi @@ -1252,9 +1348,15 @@ configure() create_fifo_pipe "${configlog}" if ! runAndLog "${ZOPEN_CONFIGURE_CMD} >${TMP_FIFO_PIPE} 2>&1"; then if [ "${ZOPEN_CONFIGURE_MINIMAL}" = "yes" ]; then - printError "Configure (minimal) failed. Log: ${configlog}" + Error_Message="Configure (minimal) failed. Log: ${configlog}" + filecontent=$(cat ${configlog} | tr -d "\n") + content="Log file failed:${filecontent}.Configure (minimal) failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${configlog}" "${Error_Message}" else - printError "Configure (full) failed. Log: ${configlog}" + Error_Message="Configure (full) failed. Log: ${configlog}" + filecontent=$(cat ${configlog} | tr -d "\n") + content="Log file failed:${filecontent}.Configure (full) failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${configlog}" "${Error_Message}" fi fi touch ${ZOPEN_LOG_DIR}/config.success @@ -1265,13 +1367,26 @@ configure() printElapsedTime verbose "configure" "${configureStartTime}" } +AI_Response() +{ + if ${ai}; then + CURL_OUTPUT=$(curl http://163.74.89.179:8080/v1/chat/completions -H "Content-Type: application/json" -d '{"model": "tinyllama", "messages": [{"role": "user", "content": "'"$1"'"}], "temperature": 0.9}') + response=$(echo $CURL_OUTPUT | jq -r '.choices[0].message.content') + $2 "$3\nHow to fix error:\n${response}" + else + $2 "$4" + fi +} + build() { buildStartTime=${SECONDS} if command -V "${ZOPEN_PRE_BUILD_CODE}" > /dev/null 2>&1; then printVerbose "Running ${ZOPEN_PRE_BUILD_CODE}" if ! "${ZOPEN_PRE_BUILD_CODE}"; then - printError "Pre build failed." + Error_Message="Pre build failed." + content="${ZOPEN_PRE_BUILD_CODE} is incorrect.Pre build failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi @@ -1281,9 +1396,15 @@ build() create_fifo_pipe "${makelog}" if ! runAndLog "${ZOPEN_MAKE_CMD} > ${TMP_FIFO_PIPE} 2>&1"; then if [ "${ZOPEN_MAKE_MINIMAL}" = "yes" ]; then - printError "Make (minimal) failed. Log: ${makelog}" + Error_Message="Make (minimal) failed. Log: ${makelog}" + filecontent=$(cat ${makelog} | tr -d "\n") + content="Log file failed:${filecontent}.Make (minimal) failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${makelog}" "${Error_Message}" else - printError "Make (full) failed. Log: ${makelog}" + Error_Message="Make (full) failed. Log: ${makelog}" + filecontent=$(cat ${makelog} | tr -d "\n") + content="Log file failed:${filecontent}.Make (full) failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${makelog}" "${Error_Message}" fi fi else @@ -1313,23 +1434,35 @@ check() if echo "${testStatus}" | grep -q -E "actualFailures:[ ]*[0-9]+"; then failures=$(echo "${testStatus}" | grep "actualFailures:" | sed -e "s/.*actualFailures://" | tr -d ' ') else - printSoftError "${ZOPEN_CHECK_RESULTS_CODE} needs to emit an actualFailures: line" + Error_Message="${ZOPEN_CHECK_RESULTS_CODE} needs to emit an actualFailures: line" + filecontent=$(cat ${checklog} | tr -d "\n") + content="Log file failed:${filecontent}.${Error_Message}.How to fix error?" + AI_Response "${content}" "printSoftError" "${Error_Message}\nPlease check content of log file: ${checklog}" "${Error_Message}" testStatusError=true fi if echo "${testStatus}" | grep -q -E "expectedFailures:[ ]*[0-9]+"; then expectedFailures=$(echo "${testStatus}" | grep "expectedFailures:" | sed -e "s/.*expectedFailures://" | tr -d ' ') else - printSoftError "${ZOPEN_CHECK_RESULTS_CODE} needs to emit an expectedFailures: line" + Error_Message="${ZOPEN_CHECK_RESULTS_CODE} needs to emit an expectedFailures: line" + filecontent=$(cat ${checklog} | tr -d "\n") + content="Log file failed:${filecontent}.${Error_Message}.How to fix error?" + AI_Response "${content}" "printSoftError" "${Error_Message}\nPlease check content of log file: ${checklog}" "${Error_Message}" testStatusError=true fi if echo "${testStatus}" | grep -q -E "totalTests:[ ]*[0-9]+"; then totalTests=$(echo "${testStatus}" | grep "totalTests:" | sed -e "s/.*totalTests://" | tr -d ' ') if [ ${totalTests} -eq 0 ]; then - printSoftError "Total tests is 0" + Error_Message="Total tests is 0" + filecontent=$(cat ${checklog} | tr -d "\n") + content="Log file failed:${filecontent}.${Error_Message}.How to fix error?" + AI_Response "${content}" "printSoftError" "${Error_Message}\nPlease check content of log file: ${checklog}" "${Error_Message}" testStatusError=true fi else - printSoftError "${ZOPEN_CHECK_RESULTS_CODE} needs to emit an totalTests: line" + Error_Message="${ZOPEN_CHECK_RESULTS_CODE} needs to emit an totalTests: line" + filecontent=$(cat ${checklog} | tr -d "\n") + content="Log file failed:${filecontent}.${Error_Message}.How to fix error?" + AI_Response "${content}" "printSoftError" "${Error_Message}\nPlease check content of log file: ${checklog}" "${Error_Message}" testStatusError=true fi if echo "${testStatus}" | grep -q -E "expectedTotalTests:[ ]*[0-9]+"; then @@ -1337,7 +1470,10 @@ check() checkTotalTests=true fi if ${testStatusError}; then - printError "Test Status:\n${testStatus}" + Error_Message="Test Status:\n${testStatus}" + filecontent=$(cat ${checklog} | tr -d "\n") + content="Log file failed:${filecontent}.$(echo "${Error_Message}" | tr -d "\n").How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${checklog}" "${Error_Message}" fi success="$((totalTests - failures))" percent="$(echo "${success}" "${totalTests}" | awk '{printf "%.0f", $1 * 100 / $2}')" @@ -1365,7 +1501,10 @@ check() if ${checkTotalTests}; then if [ ${totalTests} -lt ${expectedTotalTests} ]; then printElapsedTime verbose "check" "${checkStartTime}" - printError "Executed tests (${totalTests}) is less than expected (${expectedTotalTests}). Failing..." + Error_Message="Executed tests (${totalTests}) is less than expected (${expectedTotalTests}). Failing..." + filecontent=$(cat ${checklog} | tr -d "\n") + content="Log file failed:${filecontent}.${totalTests} executed tests is less than ${expectedTotalTests} expected tests.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${checklog}" "${Error_Message}" fi fi if [ ${failures} -le ${expectedFailures} ]; then @@ -1373,7 +1512,10 @@ check() return 0 else printElapsedTime verbose "check" "${checkStartTime}" - printError "Failures (${failures}) not less than than expected (${expectedFailures}). Failing..." + Error_Message="Failures (${failures}) not less than than expected (${expectedFailures}). Failing..." + filecontent=$(cat ${checklog} | tr -d "\n") + content="Log file failed:${filecontent}.${failures} failures not less than ${expectedFailures} expected failures.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${checklog}" "${Error_Message}" fi fi else @@ -1570,7 +1712,9 @@ ZZ # Use the first path specified in the dependency search list to install to if $noInstallRuntimeDeps; then if ! runAndLog "PATH=\"${ZOPEN_OLD_PATH}\" ${MYDIR}/zopen-install --install-or-upgrade ${dep} -v --no-deps -y"; then - printError "Failed to install dependencies" + Error_Message="Failed to install dependencies" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi @@ -1731,7 +1875,9 @@ cat <> "${ZOPEN_INSTALL_DIR}/metadata.json" }} zz if ! jq -e '.' "${ZOPEN_INSTALL_DIR}/metadata.json" 1>/dev/null 2>&1; then - printError "${ZOPEN_INSTALL_DIR}/metadata.json contains invalid json: $(cat ${ZOPEN_INSTALL_DIR}/metadata.json)" + Error_Message="${ZOPEN_INSTALL_DIR}/metadata.json contains invalid json: $(cat ${ZOPEN_INSTALL_DIR}/metadata.json)" + content="${ZOPEN_INSTALL_DIR}/metadata.json contains invalid json:$(cat ${ZOPEN_INSTALL_DIR}/metadata.json | tr -d "\n").How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of json file: ${ZOPEN_INSTALL_DIR}/metadata.json" "${Error_Message}" fi if [ -n "${caveats}" ]; then jq --arg caveats "${caveats}" \ @@ -1760,7 +1906,10 @@ install() installlog="${ZOPEN_LOG_DIR}/${LOG_PFX}_install.log" create_fifo_pipe "${installlog}" if ! runAndLog "${ZOPEN_INSTALL_CMD} > ${TMP_FIFO_PIPE} 2>&1"; then - printError "Install failed. Log: ${installlog}" + Error_Message="Install failed. Log: ${installlog}" + filecontent=$(cat ${installlog} | tr -d "\n") + content="Log file failed:${filecontent}.Install failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${installlog}" "${Error_Message}" fi replaceHardcodedPaths createEnvAndSetup @@ -1768,7 +1917,10 @@ install() if command -V "${ZOPEN_POST_INSTALL_CODE}" > /dev/null 2>&1; then printVerbose "Running ${ZOPEN_POST_INSTALL_CODE}" if ! "${ZOPEN_POST_INSTALL_CODE}" "${ZOPEN_INSTALL_DIR}"; then - printError "Post install failed.${installlog}" + Error_Message="Post install failed.${installlog}" + filecontent=$(cat ${installlog} | tr -d "\n") + content="Log file failed:${filecontent}.Post install failed.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${installlog}" "${Error_Message}" fi fi @@ -1784,7 +1936,10 @@ install() asciiecho "${ZOPEN_BUILD_LINE}" "${ZOPEN_INSTALL_DIR}/.buildline" if [ -z "$(command -v zopen_get_version)" ]; then - printError "A zopen_get_version() function must be defined in the buildenv to extract the version contents" + Error_Message="A zopen_get_version() function must be defined in the buildenv to extract the version contents" + filecontent=$(cat ${installlog} | tr -d "\n") + content="Log file failed:${filecontent}.${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${installlog}" "${Error_Message}" else versionString=$(zopen_get_version) echo ${versionString} | awk -F. '{ @@ -1807,7 +1962,10 @@ install() }' if [ $? -ne 0 ]; then - printError "The version string \"${versionString}\" uses an invalid version format" + Error_Message="The version string \"${versionString}\" uses an invalid version format" + filecontent=$(cat ${installog} | tr -d "\n") + content="Log file failed:${filecontent}.${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${installlog}" "${Error_Message}" fi asciiecho "${versionString}" "${ZOPEN_INSTALL_DIR}/.version" cp "${ZOPEN_INSTALL_DIR}/.version" "${ZOPEN_ROOT}/install/" @@ -1827,7 +1985,10 @@ install() if ${generatePax}; then printHeader "Generating pax.Z from ${ZOPEN_INSTALL_DIR}" if ! runAndLog "${ZOPEN_PAX_CMD}"; then - printError "Could not generate pax \"${paxFileName}\"" + Error_Message="Could not generate pax \"${paxFileName}\"" + filecontent=$(cat ${installlog} | tr -d "\n") + content="Log file failed:${filecontent}.${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of log file: ${installlog}" "${Error_Message}" fi #TODO: Hack so that we can use coreutils md5sum without impacting builds @@ -2028,7 +2189,9 @@ LABEL specification=1.0.0" dockerfilecontents="${dockerfilecontents}\nCOPY .zpm @{CONTAINER_READWRITE}/.zpm" if ! asciiecho "${dockerfilecontents}" "${ZOPEN_IMAGE_DOCKERFILE_NAME}"; then - printError "Unable to make ${ZOPEN_IMAGE_DOCKERFILE_NAME}" + Error_Message="Unable to make ${ZOPEN_IMAGE_DOCKERFILE_NAME}" + content="Please help us check content of docker file:$(echo "${dockerfilecontents}" | tr -d "\n").${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}\nPlease check content of docker file:\n${dockerfilecontents}" "${Error_Message}" fi if [ -z ${ZOPEN_IMAGE_REGISTRY} ]; then @@ -2152,7 +2315,9 @@ zz # |set| # |overrideset| if [ $(echo "${line}" | awk -F '|' '{print NF-1}') -ne 2 ]; then - printError "${line} must have 2 '|' seperators only" + Error_Message="${line} must have 2 '|' seperators only" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi var=$(echo ${line} | cut -d '|' -f 1) action=$(echo ${line} | cut -d '|' -f 2) @@ -2227,7 +2392,9 @@ zz free(envar_value); zz else - printError "${action} is not valid, must be one of set, unset, or prepend" + Error_Message="${action} is not valid, must be one of set, unset, or prepend" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi done @@ -2243,7 +2410,9 @@ zz fi if ! runAndLog "${CC} ${CFLAGS} ${CPPFLAGS} -DPATH_MAX=1024 ${extraOptions} -c ${output} -o ${output}.o"; then - printError "Compiler command for ${output} failed to compile" + Error_Message="Compiler command for ${output} failed to compile" + content="${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi # Apply it in both LIB envars because some ports use ZOPEN_EXTRA_LIBS directly @@ -2354,7 +2523,9 @@ fi if command -V "${ZOPEN_PRE_TERMINATE_CODE}" > /dev/null 2>&1; then printVerbose "Running ${ZOPEN_PRE_TERMINATE_CODE}" if ! "${ZOPEN_PRE_TERMINATE_CODE}" "${ZOPEN_INSTALL_DIR}"; then - printError "Pre terminate failed." + Error_Message="Pre terminate failed." + content="Both ${ZOPEN_PRE_TERMINATE_CODE} and ${ZOPEN_INSTALL_DIR} are incorrect.${Error_Message}.How to fix error?" + AI_Response "${content}" "printError" "${Error_Message}" "${Error_Message}" fi fi From 6885b0d97c5fc2f922a0639596872ce07dd05ff1 Mon Sep 17 00:00:00 2001 From: dianzhu Date: Mon, 15 Jul 2024 12:14:44 -0400 Subject: [PATCH 2/3] Update help output with new option --ai --- bin/zopen | 3 +++ bin/zopen-alt | 4 ++++ bin/zopen-audit | 4 ++++ bin/zopen-clean | 4 ++++ bin/zopen-compute-builddeps | 6 ++++++ bin/zopen-config-helper | 4 ++++ bin/zopen-generate | 1 + bin/zopen-help2man | 3 +++ bin/zopen-init | 8 ++++++++ bin/zopen-install | 3 +++ bin/zopen-md2man | 1 + bin/zopen-migrate-buildenv | 1 + bin/zopen-migrate-groovy | 1 + bin/zopen-promote | 5 +++++ bin/zopen-query | 1 + bin/zopen-remove | 5 +++++ bin/zopen-split-patch | 4 ++++ bin/zopen-update-cacert | 2 ++ bin/zopen-version | 5 ++++- bin/zopen-versions | 1 + 20 files changed, 65 insertions(+), 1 deletion(-) diff --git a/bin/zopen b/bin/zopen index f1fcbe9d..3691f92d 100755 --- a/bin/zopen +++ b/bin/zopen @@ -45,6 +45,8 @@ Command: Options: -h, --help, -? display this help and exit -v, --verbose run in verbose mode + --ai run with tinyllama model via LocalAI by using zopen build, zopen build + will send error to the model and the model will provide what patch we need to do. Examples: zopen --help displays zopen help @@ -53,6 +55,7 @@ Examples: zopen upgrade -y upgrade all installed packages to the latest release, without prompting zopen alt bash list installed alternative bash packages + zopen build --ai run with tinyllama model via LocalAI SEE ALSO: zopen-alt(1) diff --git a/bin/zopen-alt b/bin/zopen-alt index 34f1ec79..e6688aa1 100755 --- a/bin/zopen-alt +++ b/bin/zopen-alt @@ -36,6 +36,9 @@ Options: set the active version for PACKAGE to VERSION. -v, --verbose run in verbose mode. --version print version + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will + provide what patch we need to do. Examples: zopen alt foo list the available alternatives for package 'foo' @@ -45,6 +48,7 @@ Examples: zopen alt --set foo foo-1.2.3.19700101_012345.zos set the active version of package 'foo' to version foo-1.2.3.19700101_012345.zos if available + zopen build --ai run with tinyllama model via LocalAI Report bugs at https://github.com/ZOSOpenTools/meta/issues diff --git a/bin/zopen-audit b/bin/zopen-audit index 11c17063..d2cae0e1 100755 --- a/bin/zopen-audit +++ b/bin/zopen-audit @@ -28,9 +28,13 @@ Usage: ${ME} [OPTION] Options: -v, --verbose run in verbose mode. --version print version. + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will + provide what patch we need to do. Examples: zopen audit check for vulnerabilities in all installed packages + zopen build --ai run with tinyllama model via LocalAI Report bugs at https://github.com/ZOSOpenTools/meta/issues. diff --git a/bin/zopen-clean b/bin/zopen-clean index 8fcbd8d9..94dbf51e 100755 --- a/bin/zopen-clean +++ b/bin/zopen-clean @@ -42,12 +42,16 @@ Options: alternatives, leaving only the currently active version. -v, --verbose run in verbose mode. --version print version. + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will + provide what patch we need to do. Examples: zopen clean -c clear the package download cache zopen clean -d analyse the zopen file system and remove dangling symlinks zopen clean -u [PACKAGE] remove unused versions for PACKAGE + zopen build --ai run with tinyllama model via LocalAI Report bugs at https://github.com/ZOSOpenTools/meta/issues. diff --git a/bin/zopen-compute-builddeps b/bin/zopen-compute-builddeps index 035d4a12..87e9e1b0 100755 --- a/bin/zopen-compute-builddeps +++ b/bin/zopen-compute-builddeps @@ -34,10 +34,16 @@ Usage: $ME [OPTION] [tool] Options: --help display this help and exit. --version print version. + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will + provide what patch we need to do. Examples: Print out the tools required to build git. $ME git + + Run with tinyllama model via LocalAI. + zopen build --ai HELPDOC exit 0 } diff --git a/bin/zopen-config-helper b/bin/zopen-config-helper index fde50b1d..4b0fcef2 100755 --- a/bin/zopen-config-helper +++ b/bin/zopen-config-helper @@ -38,12 +38,16 @@ Options: -?, --help display this help -v, --verbose run in verbose mode. --version print version. + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will provide + what patch we need to do. Examples: zopen config --get autocacheclean get the value for the autocacheclean setting zopen config --set is_collecting_stats false disable the is_collecting_stats functionality + zopen build --ai run with tinyllama model via LocalAI Notes: Configuration options are not validated such that any key/value pairs can diff --git a/bin/zopen-generate b/bin/zopen-generate index 81705f6d..c2792218 100755 --- a/bin/zopen-generate +++ b/bin/zopen-generate @@ -35,6 +35,7 @@ printSyntax() { echo "zopen-generate will generate a zopen compatible project" >&2 echo "Syntax: zopen-generate" >&2 + echo "zopen build --ai will run with tinyllama model via LocalAI, zopen build will send error to the model and the model will provide what patch we need to do." >&2 } if [ $# -eq 1 ]; then diff --git a/bin/zopen-help2man b/bin/zopen-help2man index a0f60cca..7214770a 100755 --- a/bin/zopen-help2man +++ b/bin/zopen-help2man @@ -31,8 +31,11 @@ Usage: ${ME} [OPTION] DIRECTORY Options: --help display this help and exit --version print version + --ai run with tinyllama model via LocalAI by using zopen build, zopen build will + send error to the model and the model will provide what patch we need to do. Example:" ${ME} /tmp/man1 write the man pages to the /tmp/man1 directory. + zopen build --ai run with tinyllama model via LocalAI. HELPDOC } diff --git a/bin/zopen-init b/bin/zopen-init index 0e358bac..78346f0f 100755 --- a/bin/zopen-init +++ b/bin/zopen-init @@ -80,6 +80,11 @@ Options: -y, --yes automatically answer 'yes' to prompts + --ai + run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will + provide what patch we need to do. + Examples: zopen init interactively bootstrap a zopen environment @@ -96,6 +101,9 @@ Examples: '/zopen/etc/zopen-config' when new terminal sessions start + zopen build --ai + run with tinyllama model via LocalAI + Report bugs at https://github.com/ZOSOpenTools/meta/issues HELPDOC diff --git a/bin/zopen-install b/bin/zopen-install index bccbd880..b935245f 100755 --- a/bin/zopen-install +++ b/bin/zopen-install @@ -50,6 +50,9 @@ Options: -v, --verbose print verbose messages. --version print version. -y, --yes automatically answer yes to prompts. + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will provide + what patch we need to do. HELPDOC } diff --git a/bin/zopen-md2man b/bin/zopen-md2man index af9a7915..3964d7b5 100755 --- a/bin/zopen-md2man +++ b/bin/zopen-md2man @@ -24,6 +24,7 @@ printSyntax() { echo "zopen-md2man will generate man pages from markdown (to be removed)" >&2 echo "Syntax: zopen-md2man" >&2 + echo "zopen build --ai will run with tinyllama model via LocalAI, zopen build will send error to the model and the model will provide what patch we need to do." >&2 } if [[ $# -eq 1 ]]; then diff --git a/bin/zopen-migrate-buildenv b/bin/zopen-migrate-buildenv index d5a89afe..b9b4e3a1 100755 --- a/bin/zopen-migrate-buildenv +++ b/bin/zopen-migrate-buildenv @@ -23,6 +23,7 @@ Syntax() echo "$ME [--version|--help]" echo " simple sed script to change over env vars in a buildenv from 'old style' to 'new style'" echo " By no means bullet-proof but might save some typing" + echo "zopen build --ai will run with tinyllama model via LocalAI, zopen build will send error to the model and the model will provide what patch we need to do." } setupMyself diff --git a/bin/zopen-migrate-groovy b/bin/zopen-migrate-groovy index d24c1267..a576af65 100755 --- a/bin/zopen-migrate-groovy +++ b/bin/zopen-migrate-groovy @@ -28,6 +28,7 @@ Syntax() echo " By no means bullet-proof but might save some typing" echo " Has no checks in it and requires you fill in the ...'s in the generated files." echo " Also, spacing is a bit off - but easy enough to change post-processing in the editor." + echo "zopen build --ai will run with tinyllama model via LocalAI, zopen build will send error to the model and the model will provide what patch we need to do." } setupMyself diff --git a/bin/zopen-promote b/bin/zopen-promote index c5ae0fc9..8ce8dfa8 100755 --- a/bin/zopen-promote +++ b/bin/zopen-promote @@ -65,6 +65,10 @@ Options: promoted zopen environment with the given [PERMISSIONS] string, specified in symbolic mode. + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will + provide what patch we need to do. + Examples: zopen promote Interactively promote current zopen environment. zopen promote /prod @@ -81,6 +85,7 @@ Examples: allowing only the current user to source the zopen-config environment file and only permit access to zopen environment files to the user 'FOO'. + zopen build --ai run with tinyllama model via LocalAI. Report bugs at https://github.com/ZOSOpenTools/meta/issues diff --git a/bin/zopen-query b/bin/zopen-query index 0d2843e1..812a7ebc 100755 --- a/bin/zopen-query +++ b/bin/zopen-query @@ -55,6 +55,7 @@ fi echo " --no-version, suppress version information, return package names." echo " -v run in verbose mode." echo " --version print version" + echo " --ai run with tinyllama model via LocalAI by using zopen build, zopen build will send error to the model and the model will provide what patch we need to do." } colorizepct() diff --git a/bin/zopen-remove b/bin/zopen-remove index 0dc3e0df..4c3ed0b0 100755 --- a/bin/zopen-remove +++ b/bin/zopen-remove @@ -35,6 +35,9 @@ Options: -v, --verbose run in verbose mode. --version print version. -y, --yes automatically answer yes to prompts. + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will + provide what patch we need to do. Examples: zopen remove foo bar @@ -42,6 +45,8 @@ Examples: zopen remove --yes foo bar remove the foo and bar packages if installed, without asking for confirmation + zopen build --ai + run with tinyllama model via LocalAI Report bugs at https://github.com/ZOSOpenTools/meta/issues . diff --git a/bin/zopen-split-patch b/bin/zopen-split-patch index d25909f7..ec53caeb 100755 --- a/bin/zopen-split-patch +++ b/bin/zopen-split-patch @@ -32,9 +32,13 @@ Usage: ${ME} [OPTION] [PATCHFILE] Options: --help display this help and exit. --version print version. + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will + provide what patch we need to do. Example: ${ME} P1.patch write P1.patch into multiple patches under ${pd} + zopen build --ai run with tinyllama model via LocalAI HELPDOC } diff --git a/bin/zopen-update-cacert b/bin/zopen-update-cacert index d6a0194c..80fe935c 100755 --- a/bin/zopen-update-cacert +++ b/bin/zopen-update-cacert @@ -53,6 +53,8 @@ Options: (UNSAFE) Skip certificate validation during download. -v, --verbose print verbose messages. --version print version. + --ai run with tinyllama model via LocalAI by using zopen build, zopen build + will send error to the model and the model will provide what patch we need to do. Parameters: : the directory where the cacert.pem will be updated. diff --git a/bin/zopen-version b/bin/zopen-version index 7489d731..4579543d 100755 --- a/bin/zopen-version +++ b/bin/zopen-version @@ -29,6 +29,9 @@ Usage: ${ME} [OPTION] tool Options: --help display this help and exit. --version print version. + --ai run with tinyllama model via LocalAI by using zopen build, + zopen build will send error to the model and the model will + provide what patch we need to do. HELPDOC } @@ -64,4 +67,4 @@ if [ $# -eq 1 ]; then fi fi -printVersion \ No newline at end of file +printVersion diff --git a/bin/zopen-versions b/bin/zopen-versions index 760dc0ad..26c45bef 100755 --- a/bin/zopen-versions +++ b/bin/zopen-versions @@ -25,6 +25,7 @@ syntax() echo "Options:" echo " --help display this help and exit" echo " --version print version" + echo " --ai run with tinyllama model via LocalAI by using zopen build, zopen build will send error to the model and the model will provide what patch we need to do." } if [[ $# -eq 1 ]]; then From 813c10ca07d1dbfa7feb45d4b2478cf42cf9bcc7 Mon Sep 17 00:00:00 2001 From: dianzhu Date: Mon, 15 Jul 2024 17:25:37 -0400 Subject: [PATCH 3/3] Delete option --ai for help output --- bin/zopen | 3 --- bin/zopen-alt | 4 ---- bin/zopen-audit | 4 ---- bin/zopen-clean | 4 ---- bin/zopen-compute-builddeps | 6 ------ bin/zopen-config-helper | 4 ---- bin/zopen-generate | 1 - bin/zopen-help2man | 3 --- bin/zopen-init | 8 -------- bin/zopen-install | 3 --- bin/zopen-md2man | 1 - bin/zopen-migrate-buildenv | 1 - bin/zopen-migrate-groovy | 1 - bin/zopen-promote | 5 ----- bin/zopen-query | 1 - bin/zopen-remove | 5 ----- bin/zopen-split-patch | 4 ---- bin/zopen-update-cacert | 2 -- bin/zopen-version | 3 --- bin/zopen-versions | 1 - 20 files changed, 64 deletions(-) diff --git a/bin/zopen b/bin/zopen index 3691f92d..f1fcbe9d 100755 --- a/bin/zopen +++ b/bin/zopen @@ -45,8 +45,6 @@ Command: Options: -h, --help, -? display this help and exit -v, --verbose run in verbose mode - --ai run with tinyllama model via LocalAI by using zopen build, zopen build - will send error to the model and the model will provide what patch we need to do. Examples: zopen --help displays zopen help @@ -55,7 +53,6 @@ Examples: zopen upgrade -y upgrade all installed packages to the latest release, without prompting zopen alt bash list installed alternative bash packages - zopen build --ai run with tinyllama model via LocalAI SEE ALSO: zopen-alt(1) diff --git a/bin/zopen-alt b/bin/zopen-alt index e6688aa1..34f1ec79 100755 --- a/bin/zopen-alt +++ b/bin/zopen-alt @@ -36,9 +36,6 @@ Options: set the active version for PACKAGE to VERSION. -v, --verbose run in verbose mode. --version print version - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will - provide what patch we need to do. Examples: zopen alt foo list the available alternatives for package 'foo' @@ -48,7 +45,6 @@ Examples: zopen alt --set foo foo-1.2.3.19700101_012345.zos set the active version of package 'foo' to version foo-1.2.3.19700101_012345.zos if available - zopen build --ai run with tinyllama model via LocalAI Report bugs at https://github.com/ZOSOpenTools/meta/issues diff --git a/bin/zopen-audit b/bin/zopen-audit index d2cae0e1..11c17063 100755 --- a/bin/zopen-audit +++ b/bin/zopen-audit @@ -28,13 +28,9 @@ Usage: ${ME} [OPTION] Options: -v, --verbose run in verbose mode. --version print version. - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will - provide what patch we need to do. Examples: zopen audit check for vulnerabilities in all installed packages - zopen build --ai run with tinyllama model via LocalAI Report bugs at https://github.com/ZOSOpenTools/meta/issues. diff --git a/bin/zopen-clean b/bin/zopen-clean index 94dbf51e..8fcbd8d9 100755 --- a/bin/zopen-clean +++ b/bin/zopen-clean @@ -42,16 +42,12 @@ Options: alternatives, leaving only the currently active version. -v, --verbose run in verbose mode. --version print version. - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will - provide what patch we need to do. Examples: zopen clean -c clear the package download cache zopen clean -d analyse the zopen file system and remove dangling symlinks zopen clean -u [PACKAGE] remove unused versions for PACKAGE - zopen build --ai run with tinyllama model via LocalAI Report bugs at https://github.com/ZOSOpenTools/meta/issues. diff --git a/bin/zopen-compute-builddeps b/bin/zopen-compute-builddeps index 87e9e1b0..035d4a12 100755 --- a/bin/zopen-compute-builddeps +++ b/bin/zopen-compute-builddeps @@ -34,16 +34,10 @@ Usage: $ME [OPTION] [tool] Options: --help display this help and exit. --version print version. - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will - provide what patch we need to do. Examples: Print out the tools required to build git. $ME git - - Run with tinyllama model via LocalAI. - zopen build --ai HELPDOC exit 0 } diff --git a/bin/zopen-config-helper b/bin/zopen-config-helper index 4b0fcef2..fde50b1d 100755 --- a/bin/zopen-config-helper +++ b/bin/zopen-config-helper @@ -38,16 +38,12 @@ Options: -?, --help display this help -v, --verbose run in verbose mode. --version print version. - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will provide - what patch we need to do. Examples: zopen config --get autocacheclean get the value for the autocacheclean setting zopen config --set is_collecting_stats false disable the is_collecting_stats functionality - zopen build --ai run with tinyllama model via LocalAI Notes: Configuration options are not validated such that any key/value pairs can diff --git a/bin/zopen-generate b/bin/zopen-generate index c2792218..81705f6d 100755 --- a/bin/zopen-generate +++ b/bin/zopen-generate @@ -35,7 +35,6 @@ printSyntax() { echo "zopen-generate will generate a zopen compatible project" >&2 echo "Syntax: zopen-generate" >&2 - echo "zopen build --ai will run with tinyllama model via LocalAI, zopen build will send error to the model and the model will provide what patch we need to do." >&2 } if [ $# -eq 1 ]; then diff --git a/bin/zopen-help2man b/bin/zopen-help2man index 7214770a..a0f60cca 100755 --- a/bin/zopen-help2man +++ b/bin/zopen-help2man @@ -31,11 +31,8 @@ Usage: ${ME} [OPTION] DIRECTORY Options: --help display this help and exit --version print version - --ai run with tinyllama model via LocalAI by using zopen build, zopen build will - send error to the model and the model will provide what patch we need to do. Example:" ${ME} /tmp/man1 write the man pages to the /tmp/man1 directory. - zopen build --ai run with tinyllama model via LocalAI. HELPDOC } diff --git a/bin/zopen-init b/bin/zopen-init index 78346f0f..0e358bac 100755 --- a/bin/zopen-init +++ b/bin/zopen-init @@ -80,11 +80,6 @@ Options: -y, --yes automatically answer 'yes' to prompts - --ai - run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will - provide what patch we need to do. - Examples: zopen init interactively bootstrap a zopen environment @@ -101,9 +96,6 @@ Examples: '/zopen/etc/zopen-config' when new terminal sessions start - zopen build --ai - run with tinyllama model via LocalAI - Report bugs at https://github.com/ZOSOpenTools/meta/issues HELPDOC diff --git a/bin/zopen-install b/bin/zopen-install index b935245f..bccbd880 100755 --- a/bin/zopen-install +++ b/bin/zopen-install @@ -50,9 +50,6 @@ Options: -v, --verbose print verbose messages. --version print version. -y, --yes automatically answer yes to prompts. - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will provide - what patch we need to do. HELPDOC } diff --git a/bin/zopen-md2man b/bin/zopen-md2man index 3964d7b5..af9a7915 100755 --- a/bin/zopen-md2man +++ b/bin/zopen-md2man @@ -24,7 +24,6 @@ printSyntax() { echo "zopen-md2man will generate man pages from markdown (to be removed)" >&2 echo "Syntax: zopen-md2man" >&2 - echo "zopen build --ai will run with tinyllama model via LocalAI, zopen build will send error to the model and the model will provide what patch we need to do." >&2 } if [[ $# -eq 1 ]]; then diff --git a/bin/zopen-migrate-buildenv b/bin/zopen-migrate-buildenv index b9b4e3a1..d5a89afe 100755 --- a/bin/zopen-migrate-buildenv +++ b/bin/zopen-migrate-buildenv @@ -23,7 +23,6 @@ Syntax() echo "$ME [--version|--help]" echo " simple sed script to change over env vars in a buildenv from 'old style' to 'new style'" echo " By no means bullet-proof but might save some typing" - echo "zopen build --ai will run with tinyllama model via LocalAI, zopen build will send error to the model and the model will provide what patch we need to do." } setupMyself diff --git a/bin/zopen-migrate-groovy b/bin/zopen-migrate-groovy index a576af65..d24c1267 100755 --- a/bin/zopen-migrate-groovy +++ b/bin/zopen-migrate-groovy @@ -28,7 +28,6 @@ Syntax() echo " By no means bullet-proof but might save some typing" echo " Has no checks in it and requires you fill in the ...'s in the generated files." echo " Also, spacing is a bit off - but easy enough to change post-processing in the editor." - echo "zopen build --ai will run with tinyllama model via LocalAI, zopen build will send error to the model and the model will provide what patch we need to do." } setupMyself diff --git a/bin/zopen-promote b/bin/zopen-promote index 8ce8dfa8..c5ae0fc9 100755 --- a/bin/zopen-promote +++ b/bin/zopen-promote @@ -65,10 +65,6 @@ Options: promoted zopen environment with the given [PERMISSIONS] string, specified in symbolic mode. - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will - provide what patch we need to do. - Examples: zopen promote Interactively promote current zopen environment. zopen promote /prod @@ -85,7 +81,6 @@ Examples: allowing only the current user to source the zopen-config environment file and only permit access to zopen environment files to the user 'FOO'. - zopen build --ai run with tinyllama model via LocalAI. Report bugs at https://github.com/ZOSOpenTools/meta/issues diff --git a/bin/zopen-query b/bin/zopen-query index 812a7ebc..0d2843e1 100755 --- a/bin/zopen-query +++ b/bin/zopen-query @@ -55,7 +55,6 @@ fi echo " --no-version, suppress version information, return package names." echo " -v run in verbose mode." echo " --version print version" - echo " --ai run with tinyllama model via LocalAI by using zopen build, zopen build will send error to the model and the model will provide what patch we need to do." } colorizepct() diff --git a/bin/zopen-remove b/bin/zopen-remove index 4c3ed0b0..0dc3e0df 100755 --- a/bin/zopen-remove +++ b/bin/zopen-remove @@ -35,9 +35,6 @@ Options: -v, --verbose run in verbose mode. --version print version. -y, --yes automatically answer yes to prompts. - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will - provide what patch we need to do. Examples: zopen remove foo bar @@ -45,8 +42,6 @@ Examples: zopen remove --yes foo bar remove the foo and bar packages if installed, without asking for confirmation - zopen build --ai - run with tinyllama model via LocalAI Report bugs at https://github.com/ZOSOpenTools/meta/issues . diff --git a/bin/zopen-split-patch b/bin/zopen-split-patch index ec53caeb..d25909f7 100755 --- a/bin/zopen-split-patch +++ b/bin/zopen-split-patch @@ -32,13 +32,9 @@ Usage: ${ME} [OPTION] [PATCHFILE] Options: --help display this help and exit. --version print version. - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will - provide what patch we need to do. Example: ${ME} P1.patch write P1.patch into multiple patches under ${pd} - zopen build --ai run with tinyllama model via LocalAI HELPDOC } diff --git a/bin/zopen-update-cacert b/bin/zopen-update-cacert index 80fe935c..d6a0194c 100755 --- a/bin/zopen-update-cacert +++ b/bin/zopen-update-cacert @@ -53,8 +53,6 @@ Options: (UNSAFE) Skip certificate validation during download. -v, --verbose print verbose messages. --version print version. - --ai run with tinyllama model via LocalAI by using zopen build, zopen build - will send error to the model and the model will provide what patch we need to do. Parameters: : the directory where the cacert.pem will be updated. diff --git a/bin/zopen-version b/bin/zopen-version index 4579543d..f8929cb5 100755 --- a/bin/zopen-version +++ b/bin/zopen-version @@ -29,9 +29,6 @@ Usage: ${ME} [OPTION] tool Options: --help display this help and exit. --version print version. - --ai run with tinyllama model via LocalAI by using zopen build, - zopen build will send error to the model and the model will - provide what patch we need to do. HELPDOC } diff --git a/bin/zopen-versions b/bin/zopen-versions index 26c45bef..760dc0ad 100755 --- a/bin/zopen-versions +++ b/bin/zopen-versions @@ -25,7 +25,6 @@ syntax() echo "Options:" echo " --help display this help and exit" echo " --version print version" - echo " --ai run with tinyllama model via LocalAI by using zopen build, zopen build will send error to the model and the model will provide what patch we need to do." } if [[ $# -eq 1 ]]; then