Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
b0c40438
Commit
b0c40438
authored
Apr 24, 2016
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm-assure: rewrite to realize correct version comparing
parent
e0476e5e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
26 deletions
+29
-26
epm-assure
bin/epm-assure
+29
-26
No files found.
bin/epm-assure
View file @
b0c40438
...
...
@@ -43,7 +43,7 @@ __epm_need_update()
local
PACKAGE
=
"
$1
"
local
PACKAGEVERSION
=
"
$2
"
[
-n
"
$PACKAGEVERSION
"
]
||
return
1
[
-n
"
$PACKAGEVERSION
"
]
||
return
0
load_helper epm-query
is_installed
"
$PACKAGE
"
||
return
0
...
...
@@ -51,31 +51,19 @@ __epm_need_update()
load_helper epm-print
# epm print version for package N
local
INSTALLEDVERSION
=
$(
query_package_field
"version"
"
$PACKAGE
"
)
# if needed
<= installed, return
[
"
$(
compare_version
"
$PACKAGEVERSION
"
"
$INSTALLEDVERSION
"
)
"
-
l
t
0
]
&&
return
0
# if needed
>= installed, return 0
[
"
$(
compare_version
"
$PACKAGEVERSION
"
"
$INSTALLEDVERSION
"
)
"
-
g
t
0
]
&&
return
0
return
1
}
__epm_assure_install
()
{
local
PACKAGE
=
"
$1
"
#docmd epm --auto --skip-installed install "$PACKAGE"
docmd epm
--auto
install
"
$PACKAGE
"
}
# Do fast checking for command and install package if the command does not exist
# $1 - command name
# $2 - [package name]
# $3 - [needed package version]
__epm_assure
()
__epm_assure_checking
()
{
local
CMD
=
"
$1
"
local
PACKAGE
=
"
$2
"
local
PACKAGEVERSION
=
"
$3
"
[
-n
"
$PACKAGE
"
]
||
PACKAGE
=
"
$1
"
[
-n
"
$PACKAGEVERSION
"
]
&&
return
1
if
is_dirpath
"
$CMD
"
;
then
if
[
-e
"
$CMD
"
]
;
then
...
...
@@ -83,14 +71,11 @@ __epm_assure()
info
"File or directory
$CMD
is already exists."
epm qf
"
$CMD
"
fi
__epm_need_update
"
$PACKAGE
"
"
$PACKAGEVERSION
"
&&
__epm_assure_install
"
$PACKAGE
"
return
0
fi
[
-n
"
$2
"
]
||
fatal
"You need run with package name param when use with absolute path"
__epm_need_update
"
$PACKAGE
"
"
$PACKAGEVERSION
"
&&
__epm_assure_install
"
$PACKAGE
"
return
[
-n
"
$PACKAGE
"
]
||
fatal
"You need run with package name param when use with absolute path"
return
0
fi
if
__check_command_in_path
"
$CMD
"
>
/dev/null
;
then
...
...
@@ -99,13 +84,31 @@ __epm_assure()
info
"Command
$CMD
is exists:
$compath
"
epm qf
"
$compath
"
fi
__epm_need_update
"
$PACKAGE
"
"
$PACKAGEVERSION
"
&&
__epm_assure_install
"
$PACKAGE
"
return
0
fi
# TODO: use package name normalization
return
1
}
# Do fast checking for command and install package if the command does not exist
# $1 - command name
# $2 - [package name]
# $3 - [needed package version]
__epm_assure
()
{
local
CMD
=
"
$1
"
local
PACKAGE
=
"
$2
"
local
PACKAGEVERSION
=
"
$3
"
[
-n
"
$PACKAGE
"
]
||
PACKAGE
=
"
$1
"
__epm_assure_checking
$CMD
$PACKAGE
$PACKAGEVERSION
&&
return
0
info
"Installing appropriate package for
$CMD
command..."
__epm_need_update
"
$PACKAGE
"
"
$PACKAGEVERSION
"
&&
__epm_assure_install
"
$PACKAGE
"
__epm_need_update
$PACKAGE
$PACKAGEVERSION
||
return
0
docmd epm
--auto
install
$PACKAGE
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment