Commit 32c9e1bb authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p7 as 1.5.23-alt0.M70P.1 (with rpmbph script)

parents 9d6d3636 6e53389e
...@@ -85,22 +85,21 @@ fi ...@@ -85,22 +85,21 @@ fi
# ALT Linux based # ALT Linux based
if distro altlinux-release ; then if distro altlinux-release ; then
DISTRIB_ID="ALTLinux" DISTRIB_ID="ALTLinux"
if has Strawberry ; then DISTRIB_RELEASE="2.3" if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has Citron ; then DISTRIB_RELEASE="2.4" elif has "ALT Linux 7.0" ; then DISTRIB_RELEASE="p7"
elif has 20050723 ; then DISTRIB_RELEASE="3.0" elif has "ALT Linux 6.0" ; then DISTRIB_RELEASE="p6"
elif has Ajuga ; then DISTRIB_RELEASE="4.0" elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
elif has 20070810 ; then DISTRIB_RELEASE="4.0" elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0" elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5"
elif has "ALT Linux 5.1" ; then DISTRIB_RELEASE="5.1"
elif has "ALT Linux 5.0" ; then DISTRIB_RELEASE="5.0"
elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1" elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1"
elif has Walnut ; then DISTRIB_RELEASE="4.0" elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
elif has 5.0 ; then DISTRIB_RELEASE="5.0" elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has 5.1 ; then DISTRIB_RELEASE="5.1" elif has 20070810 ; then DISTRIB_RELEASE="4.0"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5" elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6" elif has 20050723 ; then DISTRIB_RELEASE="3.0"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7" elif has Citron ; then DISTRIB_RELEASE="2.4"
elif has 6.0 ; then DISTRIB_RELEASE="p6"
elif has Centaurea ; then DISTRIB_RELEASE="p6"
elif has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
fi fi
elif distro gentoo-release ; then elif distro gentoo-release ; then
......
...@@ -261,13 +261,23 @@ check_command() ...@@ -261,13 +261,23 @@ check_command()
audit) # HELPCMD: audits installed packages against known vulnerabilities audit) # HELPCMD: audits installed packages against known vulnerabilities
epm_cmd=audit epm_cmd=audit
;; ;;
#checksystem) # HELPCMD: check system for known errors (package management related)
# epm_cmd=checksystem
# ;;
site|url) # HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site) site|url) # HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
epm_cmd=site epm_cmd=site
;; ;;
print) # HELPCMD: print various info, run epm print help for details
epm_cmd=print
;;
-V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum) -V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum)
epm_cmd=checkpkg epm_cmd=checkpkg
;; ;;
-h|--help|help) # HELPOPT: print this help
help=1
phelp
exit 0
;;
*) *)
return 1 return 1
;; ;;
...@@ -278,10 +288,6 @@ check_command() ...@@ -278,10 +288,6 @@ check_command()
check_option() check_option()
{ {
case $1 in case $1 in
-h|--help|help) # HELPOPT: this help
phelp
exit 0
;;
-v|--version) # HELPOPT: print version -v|--version) # HELPOPT: print version
print_version print_version
exit 0 exit 0
......
...@@ -96,7 +96,7 @@ __epm_changelog_unlocal_names() ...@@ -96,7 +96,7 @@ __epm_changelog_unlocal_names()
docmd equery changes -f $1 | less docmd equery changes -f $1 | less
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE. Try install the package firstly."
;; ;;
esac esac
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
__remove_alt_apt_cache_file() __remove_alt_apt_cache_file()
{ {
sudocmd rm -vf /var/cache/apt/*.bin sudocmd rm -vf /var/cache/apt/*.bin
sudocmd rm -vf /var/cache/apt/partial/*
sudocmd rm -vf /var/lib/apt/lists/*pkglist* sudocmd rm -vf /var/lib/apt/lists/*pkglist*
sudocmd rm -vf /var/lib/apt/lists/*release* sudocmd rm -vf /var/lib/apt/lists/*release*
} }
...@@ -27,6 +28,7 @@ __remove_alt_apt_cache_file() ...@@ -27,6 +28,7 @@ __remove_alt_apt_cache_file()
__remove_deb_apt_cache_file() __remove_deb_apt_cache_file()
{ {
sudocmd rm -vf /var/cache/apt/*.bin sudocmd rm -vf /var/cache/apt/*.bin
sudocmd rm -vf /var/cache/apt/archives/partial/*
sudocmd rm -vf /var/lib/apt/lists/*Packages* sudocmd rm -vf /var/lib/apt/lists/*Packages*
sudocmd rm -vf /var/lib/apt/lists/*Release* sudocmd rm -vf /var/lib/apt/lists/*Release*
sudocmd rm -vf /var/lib/apt/lists/*Translation* sudocmd rm -vf /var/lib/apt/lists/*Translation*
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
load_helper epm-query load_helper epm-query
load_helper epm-print
# TODO: port or rewrite apt-file # TODO: port or rewrite apt-file
# https://bugzilla.altlinux.org/show_bug.cgi?id=14449 # https://bugzilla.altlinux.org/show_bug.cgi?id=14449
...@@ -39,6 +40,12 @@ __alt_local_content_filelist() ...@@ -39,6 +40,12 @@ __alt_local_content_filelist()
} | $OUTCMD } | $OUTCMD
} }
__deb_local_content_filelist()
{
showcmd "apt-file list $1 | grep '^$1: ' | sed -e 's|$1: ||g'"
apt-file list "$1" | grep "^$1: " | sed -e "s|$1: ||g"
}
__epm_filelist_remote() __epm_filelist_remote()
{ {
...@@ -50,9 +57,10 @@ __epm_filelist_remote() ...@@ -50,9 +57,10 @@ __epm_filelist_remote()
docmd_foreach __alt_local_content_filelist $@ docmd_foreach __alt_local_content_filelist $@
;; ;;
apt-dpkg) apt-dpkg)
assure_exists apt-file assure_exists apt-file || return
sudocmd apt-file update # if sudo requires a password, skip autoupdate
docmd apt-file list $@ sudo -n true 2>/dev/null && sudocmd apt-file update || info "sudo requires a password, skip apt-file update"
docmd_foreach __deb_local_content_filelist $@
;; ;;
*) *)
fatal "Query filelist for non installed packages does not realized" fatal "Query filelist for non installed packages does not realized"
...@@ -104,7 +112,7 @@ __epm_filelist_name() ...@@ -104,7 +112,7 @@ __epm_filelist_name()
CMD="conary query --ls" CMD="conary query --ls"
;; ;;
pacman) pacman)
docmd pacman -Ql $pkg_names | sed -e "s|.* ||g" | less docmd pacman -Ql $@ | sed -e "s|.* ||g" | less
return return
;; ;;
emerge) emerge)
...@@ -115,7 +123,7 @@ __epm_filelist_name() ...@@ -115,7 +123,7 @@ __epm_filelist_name()
CMD="pkg info -l" CMD="pkg info -l"
;; ;;
slackpkg) slackpkg)
is_installed $pkg_names || fatal "Query filelist for non installed packages does not realized" is_installed $@ || fatal "Query filelist for non installed packages does not realized"
docmd awk 'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}' /var/log/packages/${pkg_filenames}* | less docmd awk 'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}' /var/log/packages/${pkg_filenames}* | less
return return
;; ;;
...@@ -125,9 +133,9 @@ __epm_filelist_name() ...@@ -125,9 +133,9 @@ __epm_filelist_name()
esac esac
# TODO: add less # TODO: add less
docmd $CMD $pkg_names && return docmd $CMD $@ && return
# TODO: may be we need check is installed before prev. line? # TODO: may be we need check is installed before prev. line?
is_installed $pkg_names || __epm_filelist_remote $pkg_names is_installed $@ || __epm_filelist_remote $@
} }
...@@ -137,6 +145,6 @@ epm_filelist() ...@@ -137,6 +145,6 @@ epm_filelist()
__epm_filelist_file $pkg_files || return __epm_filelist_file $pkg_files || return
__epm_filelist_name $pkg_names || return __epm_filelist_name $(print_name $pkg_names) || return
} }
...@@ -424,8 +424,10 @@ epm_install() ...@@ -424,8 +424,10 @@ epm_install()
[ -z "$files$names" ] && info "Skip empty install list" && return 22 [ -z "$files$names" ] && info "Skip empty install list" && return 22
# it is useful for first time running if [ -z "$files" ] ; then
update_repo_if_needed # it is useful for first time running
update_repo_if_needed
fi
epm_install_names $names || return epm_install_names $names || return
epm_install_files $files epm_install_files $files
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# TODO: is it different from rpm --rebuilddb?
__repack_rpm_base()
{
assure_exists db_dump || fatal
assure_exists db_load || fatal
cd /var/lib/rpm || fatal
mv Packages Packages.BACKUP || fatal
db_dump Packages.BACKUP | db_load Packages || fatal
rm Packages.BACKUP
}
epm_optimize()
{
case $PMTYPE in
*-rpm)
#__repack_rpm_base
#rm -f /var/lib/rpm/__db*
rpm --rebuilddb
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
...@@ -34,6 +34,7 @@ case $PMTYPE in ...@@ -34,6 +34,7 @@ case $PMTYPE in
esac esac
} }
# TODO: we have a problem with error status here
epm_packages() epm_packages()
{ {
local CMD local CMD
...@@ -46,8 +47,10 @@ case $PMTYPE in ...@@ -46,8 +47,10 @@ case $PMTYPE in
;; ;;
*-dpkg) *-dpkg)
#CMD="dpkg -l $pkg_filenames" #CMD="dpkg -l $pkg_filenames"
CMD="dpkg-query -W --showformat=\${Package}-\${Version}\n $pkg_filenames" CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}\n $pkg_filenames"
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${Package}\n $pkg_filenames" [ -n "$short" ] && CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}\n $pkg_filenames"
docmd $CMD | grep "^i" | sed -e "s|.* ||g"
return
;; ;;
snappy) snappy)
CMD="snappy info" CMD="snappy info"
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2008, 2015 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Query variables from rpm package
# TODO: rpm only
query_package_field()
{
local FORMAT="%{$1}\n"
shift
local INSTALLED="-p"
# if not file, drop -p for get from rpm base
[ -e "$1" ] || INSTALLED=""
rpmquery $INSTALLED --queryformat "$FORMAT" "$@"
}
# build binary package list (1st - repo dir, 2st - pkgname)
# algorithm: list all files in PKGDIR, print packages with our source pkg name
print_binpkgfilelist()
{
local PKGDIR=$1
local PKGNAME=$(basename $2)
find "$PKGDIR" ! -name '*\.src\.rpm' -name '*\.rpm' -execdir \
rpmquery -p --qf='%{sourcerpm}\t%{name}-%{version}-%{release}.%{arch}.rpm\n' "{}" \; \
| grep "^$PKGNAME[[:space:]].*" | cut -f2 | xargs -n1 -I "{}" echo -n "$PKGDIR/{} "
}
# TODO: need try detect more strict
# TODO: package name mask for every system
#PKGNAMEMASK1="\(.*\)-\([^0-9].*[^0-9]\)-\(.*[0-9].*\)"
# mask to parse package name
PKGNAMEMASK="\(.*\)-\([0-9].*\)-\(.*[0-9].*\)"
print_name()
{
echo "$@" | xargs -n1 echo | sed -e "s|$PKGNAMEMASK|\1|g"
}
print_version()
{
echo "$1" | xargs -n1 echo | sed -e "s|$PKGNAMEMASK|\2|g"
}
print_release()
{
echo "$1" | xargs -n1 echo | sed -e "s|$PKGNAMEMASK|\3|g"
}
print_pkgname()
{
local i
for i in $@ ; do
# TODO: deb and other, arch string
echo "$(basename "$i") " | sed -e "s|\.[a-z_0-9]*\.rpm||g" -e "s|\(.*\)_\(.*\)_[a-z_0-9]*\.deb|\1-\2|g"
done
}
print_srcname()
{
print_name $(print_srcpkgname "$@")
}
print_srcpkgname()
{
query_package_field sourcerpm "$@"
}
__epm_print()
{
local WHAT="$1"
shift
local FNFLAG=
local PKFLAG=
[ "$1" = "from" ] && shift
[ "$1" = "for" ] && shift
[ "$1" = "in" ] && shift
if [ "$1" = "filename" ] ; then
FNFLAG="$1"
shift
fi
if [ "$1" = "package" ] ; then
PKFLAG="$1"
shift
fi
case "$WHAT" in
"")
fatal "Use epm print help for get help."
;;
"-h"|"--help"|"help")
cat <<EOF
Examples:
epm print name [from filename|for package] NN print only name of package name or package file
epm print version [from filename|for package] NN print only version of package name or package file
epm print release [from filename|for package] NN print only release of package name or package file
epm print field FF for package NN print field of the package
epm print pkgname from filename NN print package name for package file
epm print srcname from filename NN print source name for package file
epm print srcpkgname from [filename|package] NN print source package name for the binary package file
epm print binpkgfilelist in DIR for NN list binary package(s) filename(s) from DIR for the source package file
EOF
;;
"name")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_name $(print_pkgname "$@")
elif [ -n "$PKFLAG" ] ; then
query_package_field "name" "$@"
else
print_name "$@"
fi
;;
"version")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_version $(print_pkgname "$@")
elif [ -n "$PKFLAG" ] ; then
query_package_field "version" "$@"
else
print_version "$@"
fi
;;
"release")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_release $(print_pkgname "$@")
elif [ -n "$PKFLAG" ] ; then
query_package_field "release" "$@"
else
print_release "$@"
fi
;;
"field")
[ -n "$1" ] || fatal "Arg is missed"
local FIELD="$1"
shift
[ "$1" = "for" ] && shift
query_package_field "$FIELD" "$@"
;;
"pkgname")
[ -n "$FNFLAG" ] || fatal "print $WHAT works only for filename(s)"
[ -n "$1" ] || fatal "Arg is missed"
# TODO: drop_pkg_extensions
print_pkgname "$@"
;;
"srcname")
[ -n "$FNFLAG" ] || fatal "print $WHAT works only for filename(s)"
[ -n "$1" ] || fatal "Arg is missed"
print_srcname "$@"
;;
"srcpkgname")
[ -n "$FNFLAG" ] || [ -n "$PKFLAG" ] || fatal "print $WHAT works only for filename(s)"
[ -n "$1" ] || fatal "Arg is missed"
print_srcpkgname "$@"
;;
"binpkgfilelist")
# TODO: rpm only
# TODO: replace get_binpkg_list
local DIR="$1"
shift
[ "$1" = "for" ] && shift
[ -n "$DIR" ] || fatal "DIR arg is missed"
[ -n "$1" ] || fatal "source package filename is missed"
print_binpkgfilelist "$DIR" "$1"
;;
*)
fatal "Unknown command $ epm print $WHAT. Use epm print help for get help."
;;
esac
}
epm_print()
{
[ -n "$pkg_filenames" ] || fatal "Missed args. Use epm print help for get help."
__epm_print $(eval echo $quoted_args)
}
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
load_helper epm-query load_helper epm-query
load_helper epm-print
epm_provides_files() epm_provides_files()
{ {
...@@ -105,5 +106,5 @@ epm_provides() ...@@ -105,5 +106,5 @@ epm_provides()
[ -n "$pkg_filenames" ] || fatal "Provides: missing package(s) name" [ -n "$pkg_filenames" ] || fatal "Provides: missing package(s) name"
epm_provides_files $pkg_files epm_provides_files $pkg_files
epm_provides_names $pkg_names epm_provides_names $(print_name $pkg_names)
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
load_helper epm-packages load_helper epm-packages
load_helper epm-print
_get_grep_exp() _get_grep_exp()
...@@ -185,5 +186,5 @@ epm_query() ...@@ -185,5 +186,5 @@ epm_query()
__epm_query_file $pkg_files || return __epm_query_file $pkg_files || return
__epm_query_name $pkg_names || return __epm_query_name $(print_name $pkg_names) || return
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
load_helper epm-query load_helper epm-query
load_helper epm-print
# Try remove with low level removing # Try remove with low level removing
epm_remove_low() epm_remove_low()
...@@ -28,7 +29,7 @@ epm_remove_low() ...@@ -28,7 +29,7 @@ epm_remove_low()
sudocmd rpm -ev $nodeps $@ sudocmd rpm -ev $nodeps $@
return ;; return ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
sudocmd dpkg -P $(subst_option nodeps --force-all) $@ sudocmd dpkg -P $(subst_option nodeps --force-all) $(print_name "$@")
return ;; return ;;
pkgsrc) pkgsrc)
sudocmd pkg_delete -r $@ sudocmd pkg_delete -r $@
......
...@@ -18,17 +18,18 @@ ...@@ -18,17 +18,18 @@
# #
# FIXME # FIXME
SUBST_ALT_RULE="s!^([^#].*)[/ ](ALTLinux|LINUX@Etersoft)[/ ](Sisyphus|p7[/ ]branch|p6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi" SUBST_ALT_RULE='s!^([^#].*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ](Sisyphus|p7[/ ]branch|p6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
__fix_apt_sources_list() __fix_apt_sources_list()
{ {
[ -n "$SUDO" ] && fatal "run only under root"
for i in "$@" ; do for i in "$@" ; do
[ -s "$i" ] || continue [ -s "$i" ] || continue
sudocmd perl -i.bak -pe "$SUBST_ALT_RULE" $i perl -i.bak -pe "$SUBST_ALT_RULE" $i
done done
} }
epm_repolist() epm_repofix()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
...@@ -36,6 +37,15 @@ case $PMTYPE in ...@@ -36,6 +37,15 @@ case $PMTYPE in
docmd apt-repo list docmd apt-repo list
__fix_apt_sources_list /etc/apt/sources.list __fix_apt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/*.list __fix_apt_sources_list /etc/apt/sources.list.d/*.list
docmd apt-repo list
# rebuild rpm database
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
yum-rpm|dnf-rpm)
sudocmd rm -fv /var/lib/rpm/__db*
sudocmd rpm --rebuilddb
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
load_helper epm-query load_helper epm-query
load_helper epm-print
epm_requires_files() epm_requires_files()
{ {
...@@ -104,5 +105,5 @@ epm_requires() ...@@ -104,5 +105,5 @@ epm_requires()
{ {
[ -n "$pkg_filenames" ] || fatal "Requires: missing package(s) name" [ -n "$pkg_filenames" ] || fatal "Requires: missing package(s) name"
epm_requires_files $pkg_files epm_requires_files $pkg_files
epm_requires_names $pkg_names epm_requires_names $(print_name $pkg_names)
} }
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
# #
load_helper epm-query load_helper epm-query
load_helper epm-print
run_command_if_exists() run_command_if_exists()
{ {
...@@ -38,35 +39,14 @@ open_browser() ...@@ -38,35 +39,14 @@ open_browser()
done done
} }
# FIXME: Copied from etersoft-build-utils
# Query variables from rpm package
querypackage()
{
local FORMAT="%{$2}"
local INSTALLED="-p"
# if name empty, use third param as format string
[ -n "$2" ] || FORMAT="$3"
# if not file, drop -p for get from rpm base
[ -e "$1" ] || INSTALLED=""
rpmquery $INSTALLED --queryformat "$FORMAT" $1
}
# FIXME: Copied from etersoft-build-utils
# return source package name by binary rpm package file
get_sourcepkg_name()
{
local FILE="$1"
local PKGVERSION=$(querypackage "$FILE" VERSION)
querypackage "$FILE" sourcerpm | sed -e "s|-$PKGVERSION.*||g"
}
__query_package_hl_url() __query_package_hl_url()
{ {
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs # http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl || return 1 epm assure curl || return 1
curl --header "Accept: application/json" "http://packages.altlinux.org/api/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g' showcmd curl "http://packages.altlinux.org/api/srpms/$1"
curl -s --header "Accept: application/json" "http://packages.altlinux.org/api/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g'
return 0 return 0
;; ;;
esac esac
...@@ -79,7 +59,8 @@ query_package_url() ...@@ -79,7 +59,8 @@ query_package_url()
case $PMTYPE in case $PMTYPE in
*-rpm) *-rpm)
querypackage "$1" URL || __query_package_hl_url "$1" # TODO: for binary packages?
query_package_field URL "$1" || __query_package_hl_url "$1"
#LANG=C epm info "$1" #LANG=C epm info "$1"
return return
;; ;;
...@@ -114,7 +95,7 @@ query_altlinux_url() ...@@ -114,7 +95,7 @@ query_altlinux_url()
local URL local URL
case $PMTYPE in case $PMTYPE in
*-rpm) *-rpm)
local srpm=$(get_sourcepkg_name "$1") local srpm=$(print_srcname "$1")
[ -n "$srpm" ] || fatal "Can't get source name for $1" [ -n "$srpm" ] || fatal "Can't get source name for $1"
echo "$(get_pao_url)/$srpm" echo "$(get_pao_url)/$srpm"
return return
......
...@@ -41,10 +41,12 @@ case $PMTYPE in ...@@ -41,10 +41,12 @@ case $PMTYPE in
;; ;;
yum-rpm) yum-rpm)
info "update command is stubbed for yum" info "update command is stubbed for yum"
# yum makecache
#sudocmd yum check-update #sudocmd yum check-update
;; ;;
dnf-rpm) dnf-rpm)
info "update command is stubbed for dnf" info "update command is stubbed for dnf"
# dnf makecache
#sudocmd dnf check-update #sudocmd dnf check-update
;; ;;
urpm-rpm) urpm-rpm)
......
...@@ -17,10 +17,14 @@ ...@@ -17,10 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-print
epm_whatdepends() epm_whatdepends()
{ {
local CMD local CMD
[ -n "$pkg_filenames" ] || fatal "Whatdepends: missing package(s) name" [ -n "$pkg_files" ] && fatal "whatdepends do not handle files"
[ -n "$pkg_names" ] || fatal "whatdepends: missing package(s) name"
local pkg=$(print_name $pkg_names)
# by package name # by package name
case $PMTYPE in case $PMTYPE in
...@@ -48,6 +52,6 @@ case $PMTYPE in ...@@ -48,6 +52,6 @@ case $PMTYPE in
;; ;;
esac esac
docmd $CMD $pkg_filenames docmd $CMD $pkg
} }
...@@ -17,10 +17,14 @@ ...@@ -17,10 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
load_helper epm-print
epm_whatprovides() epm_whatprovides()
{ {
local CMD local CMD
[ -n "$pkg_filenames" ] || fatal "Whatprovides: missing package(s) name" [ -n "$pkg_files" ] && fatal "whatprovides does not handle files"
[ -n "$pkg_names" ] || fatal "whatprovides: missing package(s) name"
local pkg=$(print_name $pkg_names)
# by package name # by package name
case $PMTYPE in case $PMTYPE in
...@@ -28,7 +32,7 @@ case $PMTYPE in ...@@ -28,7 +32,7 @@ case $PMTYPE in
CMD="conary repquery --what-provides" CMD="conary repquery --what-provides"
;; ;;
apt-rpm|apt-dpkg|aptitude-dpkg) apt-rpm|apt-dpkg|aptitude-dpkg)
LANG=C docmd apt-get install --print-uris $pkg_filenames | grep "^Selecting" | cut -f2 -d" " LANG=C docmd apt-get install --print-uris $pkg | grep "^Selecting" | cut -f2 -d" "
return return
;; ;;
yum-rpm) yum-rpm)
...@@ -42,6 +46,6 @@ case $PMTYPE in ...@@ -42,6 +46,6 @@ case $PMTYPE in
;; ;;
esac esac
docmd $CMD $pkg_filenames docmd $CMD $pkg
} }
# This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it. # This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it.
# #
Name: eepm Name: eepm
Version: 1.5.20 Version: 1.5.23
Release: alt0.M70P.1 Release: alt0.M70P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -67,9 +67,27 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}* ...@@ -67,9 +67,27 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Mon Oct 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.20-alt0.M70P.1 * Sun Nov 22 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.23-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script) - backport to ALTLinux p7 (by rpmbph script)
* Sun Nov 22 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.23-alt1
- epm install: disable update if try install local package files
- epm clean: remove partial files
- real check if package(s) is installed
- small improve print name
* Sun Oct 25 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.22-alt1
- distr_info: fix ALT Linux version detection
- epm: fix print help command
- fix epm repofix
- improve epm-filelist
- use short names when possible
* Tue Oct 13 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.21-alt1
- introduce epm print for print out package names and fields
- epm-site: use functions from epm-print
- epm-remove: do short package name from deb
* Mon Oct 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.20-alt1 * Mon Oct 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.20-alt1
- distr_info: add mcst support - distr_info: add mcst support
- skip update checking for non root users have no nopassword sudo - skip update checking for non root users have no nopassword sudo
......
#!/bin/sh
get_numdelim()
{
echo -n "$@" | sed -e "s|[^-]||g" | wc -c
}
check()
{
[ "$2" != "$3" ] && echo "FATAL with '$1': result '$3' do not match with '$2'" || echo "OK for '$1' with '$2'"
}
check_file()
{
check "$1" "$2" $(../bin/epm print name from filename "$1")
}
check_pkgfile()
{
check "$1" "$2" $(../bin/epm print pkgname from filename "$1")
}
check_pkg()
{
get_numdelim "$1"
check "$1" "$2" $(../bin/epm print name "$1")
}
echo "check_file"
check_file pkg-source-1.0.src.rpm pkg-source
check_file pkg-source_1.0.src.rpm pkg-source
check_file pkg-source[-_]1.0.src.rpm pkg-source
check_file pkg-source*.src.rpm pkg-source
check_file pkg-source-1.0-2.0*.src.rpm pkg-source-1.0
check_file pkg-source-1.0_2.0*.src.rpm pkg-source-1.0
check_file libpq5.2-9.0eter-9.0.4-alt14.i586.rpm libpq5.2-9.0eter
check_file bison_2.7.1.dfsg-1_i386.deb bison
check_file postgre-etersoft9.0_9.0.4-eter14ubuntu_i386.deb postgre-etersoft9.0
check_file libpq5.2-9.0eter-9.0.4-alt14.i586.rpm libpq5.2-9.0eter
echo
echo "check_pkgfile"
check_pkgfile libpq5.2-9.0eter-9.0.4-alt14.i586.rpm libpq5.2-9.0eter-9.0.4-alt14
check_pkgfile bison_2.7.1.dfsg-1_i386.deb bison-2.7.1.dfsg-1
check_pkgfile postgre-etersoft9.0_9.0.4-eter14ubuntu_i386.deb postgre-etersoft9.0-9.0.4-eter14ubuntu
check_pkgfile libpq5.2-9.0eter-9.0.4-alt14.i586.rpm libpq5.2-9.0eter-9.0.4-alt14
echo
echo "check_pkg"
check_pkg pkg-source-1.0 pkg-source
check_pkg pkg-source_1.0 pkg-source
check_pkg pkg-source[-_]1.0 pkg-source
check_pkg pkg-source* pkg-source
check_pkg pkg-source-1.0-2.0 pkg-source-1.0
check_pkg pkg-source-1.0_2.0 pkg-source-1.0
check_pkg libpq5.2-9.0eter-9.0.4-alt14 libpq5.2-9.0eter
check_pkg libpjlib-util2-2.1.0.0.ast20130823-1 libpjlib-util2
check_pkg rpm-build-python-tools-0.36.2-alt1 rpm-build-python-tools
check_pkg saxon9-B.9.0.0.8-alt2 saxon9
check_pkg rootfiles-alt-alt11 rootfiles
check_pkg git-bzr-1.1_48_g61d6007-alt1.1 git-bzr
check_pkg liblz4-r127-alt1.svn20141224 liblz4
check_pkg libijs-0.35_9.15-alt1 libijs
echo
echo "check_pkg"
check_pkg pkg-1.0.spec pkg
check_pkg pkg-source-1.0.spec pkg-source
check_pkg pkg-source-less-1.0.spec pkg-source-less
check_pkg pkg123-1.0.spec pkg123
check_pkg pkg123[_-]1.0.spec pkg123
check_pkg pkg*.spec pkg
check_pkg qt5-webkit-doc qt5-webkit-doc
check_pkg geronimo-j2ee-management-1.1-api geronimo-j2ee-management-1.1-api
check_pkg i586-libgphoto2_port-12 i586-libgphoto2_port-12
check_pkg python-module-qscintilla2-qt4 python-module-qscintilla2-qt4
check_pkg python-module-qscintilla2-qt4-2.9-alt4 python-module-qscintilla2-qt4
check_pkg libqscintilla2-6-qt4 libqscintilla2-6-qt4
check_pkg libqscintilla2-6-qt4-2.5.1-alt4 libqscintilla2-6-qt4
#!/bin/sh
../bin/epmqa --short >$0.0
# get two - packages list
cat $0.0 | grep ".*-.*-.*" | sort >$0.1
# try get their names, it does not have difference
cat $0.1 | ../bin/epm print name | sort >$0.1.1
cat $0.0 | ../bin/epm print name | sort >$0.2
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