Skip to content

Commit

Permalink
automataCI: finalized ar library
Browse files Browse the repository at this point in the history
Since we want to release soon, we must finalize the library. Hence,
let's deal with ar library.

This patch finalizes ar library capabilities in automataCI/
directory.

Co-authored-by: Galyna, Cory <[email protected]>
Co-authored-by: (Holloway) Chew, Kean Ho <[email protected]>
Signed-off-by: (Holloway) Chew, Kean Ho <[email protected]>
  • Loading branch information
hollowaykeanho and corygalyna committed Dec 15, 2023
1 parent 4a975c2 commit e0085db
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 23 deletions.
25 changes: 15 additions & 10 deletions automataCI/services/archive/ar.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,16 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
. "${env:PROJECT_PATH_ROOT}\${env:PROJECT_PATH_AUTOMATA}\services\io\os.ps1"
. "${env:LIBS_AUTOMATACI}\services\io\os.ps1"
. "${env:LIBS_AUTOMATACI}\services\io\fs.ps1"




function AR-Is-Available {
# execute
$__process = Get-Command "ar" -ErrorAction SilentlyContinue
if (-not ($__process)) {
$___process = OS-Is-Command-Available "ar"
if ($___process -ne 0) {
return 1
}

Expand All @@ -31,26 +32,30 @@ function AR-Is-Available {

function AR-Create {
param (
[string]$__name,
[string]$__list
[string]$___name,
[string]$___list
)


# validate input
if ([string]::IsNullOrEmpty($__name) -or [string]::IsNullOrEmpty($__list)) {
if (($(STRINGS-Is-Empty "${___name}") -eq 0) -or
($(STRINGS-Is-Empty "${___list}") -eq 0)) {
return 1
}

$__process = AR-Is-Available
if ($__process -ne 0) {
$___process = AR-Is-Available
if ($___process -ne 0) {
return 1
}


# execute
$__process = OS-Exec "ar" "r ${__name} ${__list}"
$___process = OS-Exec "ar" "r ${___name} ${___list}"
if ($___process -ne 0) {
return 1
}


# report status
return $__process
return 0
}
35 changes: 24 additions & 11 deletions automataCI/services/archive/ar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,38 +10,51 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
AR::is_available() {
. "${LIBS_AUTOMATACI}/services/io/os.sh"
. "${LIBS_AUTOMATACI}/services/io/strings.sh"




AR_Is_Available() {
# execute
if [ -z "$(type -t ar)" ]; then
OS::is_command_available "ar"
if [ $? -ne 0 ]; then
return 1
fi


# report status
return 0
}




AR::create() {
# __name="$1"
# __list="$2"
AR_Create() {
#___name="$1"
#___list="$2"


# validate input
if [ -z "$1" ] || [ -z "$2" ]; then
if [ $(STRINGS_Is_Available "$1") -eq 0 ] ||
[ $(STRINGS_Is_Available "$2") -eq 0 ]; then
return 1
fi

AR_Is_Available
if [ $? -ne 0 ]; then
return 1
fi


# execute
ar r "$1" $2
if [ $? -ne 0 ]; then
return 1
fi


# report status
if [ $? -eq 0 ]; then
return 0
fi

return 1
return 0
}
4 changes: 2 additions & 2 deletions automataCI/services/compilers/deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ DEB_Create_Archive() {

# archive into deb
___file="package.deb"
AR::create "$___file" "debian-binary control.tar.xz data.tar.xz"
AR_Create "$___file" "debian-binary control.tar.xz data.tar.xz"
if [ $? -ne 0 ]; then
cd "$___current_path" && unset ___current_path
return 1
Expand Down Expand Up @@ -472,7 +472,7 @@ DEB_Is_Available() {
return 1
fi

AR::is_available
AR_Is_Available
if [ $? -ne 0 ]; then
return 1
fi
Expand Down

0 comments on commit e0085db

Please sign in to comment.