Skip to content

Commit

Permalink
Merge pull request #139 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 3.4.0
  • Loading branch information
andyone authored Sep 10, 2024
2 parents ab8b02d + becf05b commit 5e47276
Show file tree
Hide file tree
Showing 11 changed files with 186 additions and 159 deletions.
203 changes: 102 additions & 101 deletions .github/images/usage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 5 additions & 5 deletions SOURCES/libexec/build-local.shx
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,12 @@ copySourcesToBuildDir() {

if [[ $? -ne 0 ]] ; then
source_file_name=$(basename "$source_file")
error "Can't copy source file ${CL_BL_RED}${source_file_name}${CL_RED} to directory ${CL_BL_RED}${src_dir}${CL_RED} - error while copy process"
error "Can't copy source file \"$source_file_name\" to directory \"$src_dir\" - error while copying file"
doExit $ERROR_SOURCE
fi
done
else
error "Error! Can't copy source files - directory ${CL_BL_RED}${src_dir}${CL_RED} doesn't exist"
error "Can't copy source files - directory \"$src_dir\" doesn't exist"
doExit $ERROR_SOURCE
fi

Expand All @@ -79,7 +79,7 @@ copySourcesToBuildDir() {

[[ -n "$bump" ]] && releaseBump "$specs_dir/$spec"
else
error "Error! Can't copy spec file - directory ${CL_BL_RED}${specs_dir}${CL_RED} doesn't exist."
error "Can't copy spec file - directory \"$specs_dir\" doesn't exist"
doExit $ERROR_SOURCE
fi
}
Expand Down Expand Up @@ -203,7 +203,7 @@ localBuildProcess() {
stopStatusObserver
show ""

error "Error! Can't build a package."
error "Can't build a package"

if [[ -z "$verbose" ]] ; then
error "Last $LOG_QUOTE_SIZE lines from build log:"
Expand All @@ -221,7 +221,7 @@ localBuildProcess() {

cp "$tmp_output" "$CWD/$lname"

error "Build log saved to current directory as ${CL_BL_RED}${lname}"
error "Build log saved to current directory as \"${lname}\""
fi

removeLocalLock
Expand Down
23 changes: 15 additions & 8 deletions SOURCES/libexec/build-remote.shx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ require "build-remote-worker"
# Echo: No
parallelBuild() {
if [[ -n "$dlcache" ]] ; then
warn "Warning! You can't use a parallel build with download cache."
warn "You can't use a parallel build with download cache."
doExit $ERROR_ARGS
fi

Expand All @@ -28,7 +28,7 @@ parallelBuild() {
build_hosts=($(filterNodeList "$remote"))

if [[ ${#build_hosts[@]} -eq 0 ]] ; then
error "Error! Can't start parallel build process - there are no build nodes with given indices."
error "Can't start parallel build process - there are no build nodes with given indices"
doExit $ERROR_ARGS
fi

Expand Down Expand Up @@ -199,11 +199,11 @@ remoteCheckEnv() {

if isRemoteServerReachable "$host" ; then
if ! isSSHConnectionWorks "$host" ; then
error "Can't connect to host ${CL_BL_RED}${host}:${port:-22}${CL_RED} (server is reachable but SSH command returned an error)"
error "Can't connect to host \"${host}:${port:-22}\" (server is reachable but SSH command returned an error)"
doExit $ERROR_REMOTE
fi
else
error "Remote server ${CL_BL_RED}${host}:${port:-22}${CL_RED} is not reachable!"
error "Remote server \"${host}:${port:-22}\" is not reachable!"
doExit $ERROR_REMOTE
fi

Expand Down Expand Up @@ -232,10 +232,17 @@ remoteDepsInstall() {
yum_opts=$(getYumOpts "$verbose")

if [[ -n "$install_latest" ]] ; then
yum_opts="$yum_opts --actual"
yum_opts="$yum_opts -A"
fi

sshCommand "$host" "cd $specs_dir && sudo spec-builddep --clean $yum_opts $spec_name"
if [[ -n "$define" ]] ; then
local macro_def
for macro_def in $define ; do
yum_opts="$yum_opts -D $macro_def"
done
fi

sshCommand "$host" "cd $specs_dir && sudo spec-builddep -C $yum_opts $spec_name"

if [[ $? -ne 0 ]] ; then
doExit $ERROR_DEPS
Expand Down Expand Up @@ -386,7 +393,7 @@ remoteBuildProcess() {
show "All rpm packages saved to a current directory" $GREEN
fi
else
error "Error! Can't build a package."
error "Can't build a package"

if [[ -z "$verbose" ]] ; then
error "Last $LOG_QUOTE_SIZE lines from build log:"
Expand Down Expand Up @@ -546,7 +553,7 @@ configurePrivateKey() {
fi

if ! ssh-keygen -lf "$key" &> /dev/null ; then
error "Error! Private key is not valid."
error "Private key is not valid"
doExit $ERROR_ARGS
fi
}
Expand Down
32 changes: 24 additions & 8 deletions SOURCES/libexec/build.shx
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ startBuild() {
spec="${spec}.spec"
else
err=$(validateSpec "$spec")
error "${CL_BL_RED}${spec}${CL_RED} is not a spec file!${CL_NORM}"
error "${CL_BL_RED}${err}${CL_NORM}"

error "\"$spec\" is not a spec file!"

if [[ -n "$err" ]] ; then
error "$err"
fi

doExit $ERROR_SPEC
fi
fi
Expand Down Expand Up @@ -153,7 +158,7 @@ processSpec() {
downloadSource "$source_file" "$dlcache"

if [[ $? -ne 0 ]] ; then
error "Error! Can't download file ${CL_BL_RED}${source_file}${CL_RED}."
error "Can't download file \"$source_file\""
doExit $ERROR_SOURCE
fi

Expand All @@ -167,7 +172,7 @@ processSpec() {
downloadSource "$source_file" "$tmp_dir"

if [[ $? -ne 0 ]] ; then
error "Error! Can't download file ${CL_BL_RED}${source_file}${CL_RED}."
error "Can't download file \"$source_file\""
doExit $ERROR_SOURCE
fi

Expand Down Expand Up @@ -205,7 +210,7 @@ processSpec() {

source_num=$(( source_num + 1 )) && continue
else
error "Can't use file ${CL_BL_RED}${source_file}${CL_RED} for build - file not found in sources directory"
error "Can't use file \"$source_file\" for build - file not found in sources directory"
doExit $ERROR_SOURCE
fi
fi
Expand Down Expand Up @@ -326,6 +331,17 @@ checkOptions() {
doExit $ERROR_UNKNOWN
fi
fi

if [[ -n "$define" ]] ; then
local macro_def

for macro_def in $define ; do
if [[ ${macro_def:0:1} != "_" ]] ; then
error "Invalid macro name definition (must start with \"_\")"
doExit $ERROR_UNKNOWN
fi
done
fi
}

# Print message and exit from utility
Expand Down Expand Up @@ -525,11 +541,11 @@ getBuildOpts() {
# Code: No
# Echo: Options (String)
getDefineOpts() {
local opts macros_def
local opts macro_def

if [[ -n "$define" ]] ; then
for macros_def in $define ; do
opts="--define=\"${macros_def/=/ }\" ${opts}"
for macro_def in $define ; do
opts="--define=\"${macro_def/:/ }\" ${opts}"
done
fi

Expand Down
4 changes: 2 additions & 2 deletions SOURCES/libexec/package.shx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ validatePackage() {

if rpm -qp --scripts "$rpm_file" 2>&1 | grep -E -q '\%\{.*\}' ; then
show "ERROR\n" $RED
show "RPM package ${CL_BL_RED}${rpm_name}${CL_RED} contains unexpanded macros in scriptlets:" $RED
show "RPM package \"$rpm_name\" contains unexpanded macros in scriptlets:" $RED
show "${CL_GREY}"
rpm -qp --scripts "$rpm_file" 2>&1 | grep -E -A1 -B1 '\%\{.*\}' | sed '/^$/d' | sed 's/^/ /g'
show "${CL_NORM}"
Expand All @@ -29,7 +29,7 @@ validatePackage() {

if rpm -qlp "$rpm_file" 2>&1 | grep -E -q '\%\{.*\}' ; then
show "ERROR\n" $RED
show "RPM package ${CL_BL_RED}${rpm_name}${CL_RED} contains unexpanded macros in files section:" $RED
show "RPM package \"$rpm_name\" contains unexpanded macros in files section:" $RED
show "${CL_GREY}"
rpm -qlp "$rpm_file" 2>&1 | grep -E -A1 -B1 '\%\{.*\}' | sed '/^$/d' | sed 's/^/ /g'
show "${CL_NORM}"
Expand Down
6 changes: 3 additions & 3 deletions SOURCES/libexec/sources-remote.shx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ downloadRemoteSources() {
downloadSource "$source_file" "$download"

if [[ $? -ne 0 ]] ; then
error "Error! Can't download file ${CL_BL_RED}${source_file}${CL_RED}."
error "Can't download file \"$source_file\""
doExit $ERROR_SOURCE
fi

Expand Down Expand Up @@ -82,7 +82,7 @@ downloadSource() {
file_name=$(basename "$url")

if ! isAccessibleURL "$url" ; then
error "Can't download file ${CL_BL_RED}${file_name}${CL_RED} - server return error code"
error "Can't download file \"$file_name\" - server return non-ok status code"
doExit $ERROR_SOURCE
else
start=$(now)
Expand All @@ -100,7 +100,7 @@ downloadSource() {
fi

if ! validateSourceFile "$dir/$file_name" ; then
error "Invalid file ${CL_BL_RED}${source_name}${CL_RED} - file type doesn't match to file content"
error "Invalid file \"$source_name\" - file type doesn't match to file content"
doExit $ERROR_SOURCE
fi
fi
Expand Down
20 changes: 10 additions & 10 deletions SOURCES/libexec/sources-scm.shx
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ packSourcesFromGit() {
fi

if [[ $? -ne 0 ]] ; then
error "Can't checkout revision ${CL_BL_RED}${revision}${CL_RED}:"
error "Can't checkout revision \"$revision\""

if [[ -z "$verbose" ]] ; then
error ""
Expand All @@ -255,7 +255,7 @@ packSourcesFromGit() {

if [[ -n "$path" ]] ; then
if [[ ! -d "$dir_name/$path" ]] ; then
error "Can't find path ${CL_BL_RED}${path}${CL_NORM} in git repository"
error "Can't find path \"$path\" in git repository"
doExit $ERROR_SOURCE
else
mv "$dir_name/$path" "$source_name"
Expand Down Expand Up @@ -342,7 +342,7 @@ packSourcesFromHg() {
fi

if [[ $? -ne 0 ]] ; then
error "Can't switch branch to ${CL_BL_RED}${branch}${CL_RED}:"
error "Can't switch branch to \"$branch\""

if [[ -z "$verbose" ]] ; then
error ""
Expand All @@ -363,7 +363,7 @@ packSourcesFromHg() {
fi

if [[ $? -ne 0 ]] ; then
error "Can't checkout revision ${CL_BL_RED}${revision}${CL_RED}:"
error "Can't checkout revision \"$revision\""

if [[ -z "$verbose" ]] ; then
error ""
Expand All @@ -382,7 +382,7 @@ packSourcesFromHg() {
fi

if [[ $? -ne 0 ]] ; then
error "Can't checkout tag ${CL_BL_RED}${tag}${CL_RED}:"
error "Can't checkout tag \"$tag\""

if [[ -z "$verbose" ]] ; then
error ""
Expand All @@ -400,7 +400,7 @@ packSourcesFromHg() {

if [[ -n "$path" ]] ; then
if [[ ! -d "$dir_name/$path" ]] ; then
error "Can't find path ${CL_BL_RED}${path}${CL_NORM} in mercurial repository"
error "Can't find path \"$path\" in mercurial repository"
doExit $ERROR_SOURCE
else
mv "$dir_name/$path" "$source_name"
Expand Down Expand Up @@ -490,7 +490,7 @@ packSourcesFromBzr() {
fi

if [[ $? -ne 0 ]] ; then
error "Can't revert to revision ${CL_BL_RED}${revision}"
error "Can't revert to revision \"$revision\""

if [[ -z "$verbose" ]] ; then
error ""
Expand All @@ -508,7 +508,7 @@ packSourcesFromBzr() {

if [[ -n "$path" ]] ; then
if [[ ! -d "$dir_name/$path" ]] ; then
error "Can't find path ${CL_BL_RED}${path}${CL_NORM} in bazaar repository"
error "Can't find path \"$path\" in bazaar repository"
doExit $ERROR_SOURCE
else
mv "$dir_name/$path" "$source_name"
Expand Down Expand Up @@ -599,7 +599,7 @@ packSourcesFromSvn() {
fi

if [[ $? -ne 0 ]] ; then
error "Can't checkout source code from ${CL_BL_RED}${svn}"
error "Can't checkout source code from \"$svn\""

if [[ -z "$verbose" ]] ; then
error ""
Expand All @@ -614,7 +614,7 @@ packSourcesFromSvn() {

if [[ -n "$path" ]] ; then
if [[ ! -d "${source_name}_tmp/$path" ]] ; then
error "Can't find path ${CL_BL_RED}${path}${CL_NORM} in svn repository"
error "Can't find path \"$path\" in svn repository"
doExit $ERROR_SOURCE
else
mv "${source_name}_tmp/$path" "$source_name"
Expand Down
10 changes: 5 additions & 5 deletions SOURCES/libexec/sources.shx
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@ packLocalSources() {

if [[ -n "$source_list" ]] ; then
if [[ ! -r $source_list ]] ; then
error "Can't pack sources - file ${CL_BL_RED}${source_list}${CL_RED} not readable"
error "Can't pack sources - file \"$source_list\" not readable"
doExit $ERROR_SOURCE
fi

if [[ ! -s $source_list ]] ; then
error "Can't pack sources - file ${CL_BL_RED}${source_list}${CL_RED} is empty"
error "Can't pack sources - file \"$source_list\" is empty"
doExit $ERROR_SOURCE
fi

Expand All @@ -87,7 +87,7 @@ packLocalSources() {

for src_target in $pack ; do
if [[ ! -a $src_target ]] ; then
error "Can't pack sources - ${CL_BL_RED}${src_target}${CL_RED} not exist or not accessible"
error "Can't pack sources - \"$src_target\" not exist or not accessible"
doExit $ERROR_SOURCE
fi
done
Expand Down Expand Up @@ -158,7 +158,7 @@ packDir() {
elif [[ "$ext" == "tar.xz" || "$ext" == "txz" ]] ; then
tar cf - "$dir_name" | xz -9 -c - > "$arch_name.$ext"
else
error "Error! Unknown archive type."
error "Unknown archive type"
doExit $ERROR_SOURCE
fi

Expand Down Expand Up @@ -243,7 +243,7 @@ validateSources() {
show ""
fi

error "Can't use file ${CL_BL_RED}${source_name}${CL_RED} for build - file type doesn't match to file content"
error "Can't use file \"$source_name\" for build - file type doesn't match to file content"
has_errors=true
fi
done
Expand Down
2 changes: 1 addition & 1 deletion SOURCES/libexec/spec.shx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ isSpecFile() {
# Code: Yes
# Echo: Validation error (String)
validateSpec() {
spectool -n "$1" 1>/dev/null
spectool -n "$1" 1>/dev/null 2>&1
return $?
}

Expand Down
Loading

0 comments on commit 5e47276

Please sign in to comment.