Commit 9366b879 authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm play.d/common.sh: allow a few packages in PKGNAME (assume they with the same version)

parent 3417b2d6
...@@ -140,6 +140,7 @@ snap_get_pkgurl() ...@@ -140,6 +140,7 @@ snap_get_pkgurl()
eget -O- -H Snap-Device-Series:16 https://api.snapcraft.io/v2/snaps/info/$SNAPNAME | epm --inscript tool json -b | grep '\["channel-map",0,"download","url"\]' | head -n1 | sed -e 's|.*"\(.*\)"$|\1|' eget -O- -H Snap-Device-Series:16 https://api.snapcraft.io/v2/snaps/info/$SNAPNAME | epm --inscript tool json -b | grep '\["channel-map",0,"download","url"\]' | head -n1 | sed -e 's|.*"\(.*\)"$|\1|'
} }
# return version only for the first package
get_latest_version() get_latest_version()
{ {
local ver local ver
...@@ -288,6 +289,17 @@ is_repacked_package() ...@@ -288,6 +289,17 @@ is_repacked_package()
return 0 return 0
} }
is_repacked_packages()
{
local pkg
local pkgs="$1"
[ -n "$pkgs" ] || pkgs="$PKGNAME"
[ -n "$pkgs" ] || return 0 #fatal "is_repacked_package() is called without package name"
for pkg in $pkgs ; do
is_repacked_package $pkg || return
done
}
case "$1" in case "$1" in
"--description") "--description")
...@@ -306,13 +318,16 @@ esac ...@@ -306,13 +318,16 @@ esac
check_tty check_tty
pkgtext="package"
pkgistext="package is"
epm tool estrlist has_space "$PKGNAME" 2>/dev/null && pkgtext="packages" && pkgistext="packages are"
# set PKGNAME to $BASEPKGNAME-$VERSION if $VERSION is found in PRODUCTALT # set PKGNAME to $BASEPKGNAME-$VERSION if $VERSION is found in PRODUCTALT
[ -n "$PRODUCTALT" ] && check_alternative_pkgname [ -n "$PRODUCTALT" ] && check_alternative_pkgname
case "$1" in case "$1" in
"--remove") "--remove")
#is_repacked_package || exit 0 #is_repacked_packages || exit 0
epm remove $PKGNAME epm remove $PKGNAME
exit exit
;; ;;
...@@ -332,25 +347,26 @@ case "$1" in ...@@ -332,25 +347,26 @@ case "$1" in
;; ;;
"--installed") "--installed")
#epm installed $PKGNAME #epm installed $PKGNAME
is_repacked_package $PKGNAME is_repacked_packages $PKGNAME
exit exit
;; ;;
"--installed-version") "--installed-version")
epm print version for package $PKGNAME epm print version for package $PKGNAME | head -n1
exit exit
;; ;;
"--update") "--update")
if ! epm installed $PKGNAME ; then if ! epm installed $PKGNAME ; then
echo "Skipping update of $PKGNAME (package is not installed)" echo "Skipping update of $PKGNAME ($pkgistext not installed)"
exit exit
fi fi
if epm mark checkhold "$PKGNAME" ; then if epm mark checkhold $PKGNAME ; then
echo "Skipping update of $PKGNAME (package is on hold, see '# epm mark showhold')" echo "Skipping update of $PKGNAME ($pkgistext on hold, see '# epm mark showhold')"
exit exit
fi fi
pkgver="$(epm print version for package $PKGNAME)" # HACK: check version only by first package (we assume all packages have the same version)
pkgver="$(epm print version for package $PKGNAME | head -n1)"
latestpkgver="$(get_latest_version $PKGNAME)" latestpkgver="$(get_latest_version $PKGNAME)"
# ignore update if have no latest package version or the latest package version no more than installed one # ignore update if have no latest package version or the latest package version no more than installed one
if [ -n "$pkgver" ] ; then if [ -n "$pkgver" ] ; then
...@@ -390,10 +406,10 @@ esac ...@@ -390,10 +406,10 @@ esac
is_supported_arch "$(epm print info -a)" || fatal "Only '$SUPPORTEDARCHES' architectures is supported" is_supported_arch "$(epm print info -a)" || fatal "Only '$SUPPORTEDARCHES' architectures is supported"
epm tool estrlist has_space "$PKGNAME" && fatal "play.d/common does not support a new packages in PKGNAME at all!" #epm tool estrlist has_space "$PKGNAME" && fatal "play.d/common does not support a new packages in PKGNAME at all!"
# skip install if there is package installed not via epm play # skip install if there is package installed not via epm play
is_repacked_package $REPOPKGNAME || exit 0 is_repacked_packages $REPOPKGNAME || exit 0
if [ -z "$VERSION" ] && [ -z "$force" ] && [ -n "$EGET_IPFS_DB" ] ; then if [ -z "$VERSION" ] && [ -z "$force" ] && [ -n "$EGET_IPFS_DB" ] ; then
# IPFS is using, use known version # IPFS is using, use known version
...@@ -409,6 +425,6 @@ fi ...@@ -409,6 +425,6 @@ fi
[ -n "$VERSION" ] || VERSION="*" [ -n "$VERSION" ] || VERSION="*"
echo echo
echo "Installing $DESCRIPTION as $PKGNAME package ..." echo "Installing $DESCRIPTION as $PKGNAME $pkgtext ..."
export EEPM_INTERNAL_PKGNAME="$PKGNAME" export EEPM_INTERNAL_PKGNAME="$PKGNAME"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment