Commit 9d6d3636 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 8ebc1c2d d22e2cad
......@@ -51,7 +51,7 @@ pkgtype()
gentoo) echo "tbz2" ;;
windows) echo "exe" ;;
android) echo "apk" ;;
debian|ubuntu|mint|runtu) echo "deb" ;;
debian|ubuntu|mint|runtu|mcst) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;;
fedora|redhat|scientific|centos|rhel)
......@@ -129,6 +129,10 @@ elif distro arch-release ; then
DISTRIB_RELEASE="2011"
fi
elif distro mcst_version ; then
DISTRIB_ID="MCST"
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g")
# for Ubuntu use standard LSB info
elif [ "$DISTRIB_ID" = "Ubuntu" ] && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB version
......
......@@ -206,6 +206,9 @@ check_command()
assure) # HELPCMD: <command> [package]: install package if command does not exists
epm_cmd=assure
;;
policy) # HELPCMD: print detailed information about the priority selection of package
epm_cmd=policy
;;
# Repository control
update) # HELPCMD: update remote package repository databases
......@@ -217,6 +220,9 @@ check_command()
repolist|sl|rl|listrepo) # HELPCMD: print repo list
epm_cmd=repolist
;;
repofix) # HELPCMD: fix paths in sources lists (ALT Linux only)
epm_cmd=repofix
;;
removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo
;;
......
......@@ -22,8 +22,7 @@ __is_repo_info_downloaded()
case $PMTYPE in
apt-*)
if [ -r /var/cache/apt ] ; then
# FIXME: only if root permissions, now skip for user
test -r /var/cache/apt/pkgcache.bin || return
$SUDO test -r /var/cache/apt/pkgcache.bin || return
fi
;;
*)
......@@ -36,12 +35,12 @@ __is_repo_info_uptodate()
{
case $PMTYPE in
apt-*)
if [ -r /var/cache/apt ] ; then
# FIXME: only if root permissions, now skip for user
test -r /var/cache/apt/pkgcache.bin || return
if $SUDO [ -r /var/lib/apt/lists ] ; then
local LOCKFILE=/var/lib/apt/lists/lock
$SUDO test -r $LOCKFILE || return
# if repo older than 1 day, return false
# find print string if file is obsoleted
test -z "$(find /var/cache/apt/pkgcache.bin -mtime +1)" || return
test -z "$($SUDO find $LOCKFILE -mtime +1)" || return
fi
;;
*)
......@@ -52,6 +51,12 @@ __is_repo_info_uptodate()
update_repo_if_needed()
{
# check if we need skip update checking
if [ "$1" = "soft" ] && [ -n "$SUDO" ] ; then
# if sudo requires a password, skip autoupdate
sudo -n true 2>/dev/null || { info "sudo requires a password, skip repo status checking" ; return 0 ; }
fi
if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then
load_helper epm-update
epm_update
......
#!/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: rpm list from bash_completion in /var/log/rpmpkgs
epm_checksystem_ALTLinux()
{
local TDIR=$(mktemp -d)
touch $TDIR/added
for ft in $(ls /usr/lib/rpm/*.filetrigger | sort) ; do
echo "Try run $ft ..."
echo $TDIR/added $TDIR/removed | time $ft
done
rm -f $TDIR/added fatal
rmdir $TDIR || fatal
echo "Count lines:"
wc -l /var/lib/rpm/files-awaiting-filetriggers
}
epm_checksystem()
{
[ -n "$SUDO" ] || fatal "Do not use checksystem under root"
case $DISTRNAME in
ALTLinux)
epm_checksystem_$DISTRNAME
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
SUDO=sudo
DISTRNAME=ALTLinux
epm_checksystem
......@@ -17,14 +17,35 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__remove_alt_apt_cache_file()
{
sudocmd rm -vf /var/cache/apt/*.bin
sudocmd rm -vf /var/lib/apt/lists/*pkglist*
sudocmd rm -vf /var/lib/apt/lists/*release*
}
__remove_deb_apt_cache_file()
{
sudocmd rm -vf /var/cache/apt/*.bin
sudocmd rm -vf /var/lib/apt/lists/*Packages*
sudocmd rm -vf /var/lib/apt/lists/*Release*
sudocmd rm -vf /var/lib/apt/lists/*Translation*
}
epm_clean()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
apt-rpm)
sudocmd apt-get clean
__remove_alt_apt_cache_file
;;
apt-dpkg)
sudocmd apt-get clean
__remove_deb_apt_cache_file
;;
aptitude-dpkg)
sudocmd aptitude clean
__remove_deb_apt_cache_file
;;
yum-rpm)
sudocmd yum clean all
......
#!/bin/sh
#
# Copyright (C) 2012-2014 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2015 Etersoft
# Copyright (C) 2012-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
......@@ -91,21 +91,12 @@ __epm_filelist_name()
[ -z "$*" ] && return
case $PMTYPE in
apt-rpm)
*-rpm)
CMD="rpm -ql"
;;
*-dpkg)
CMD="dpkg -L"
;;
yum-rpm)
CMD="rpm -ql"
;;
urpm-rpm)
CMD="rpm -ql"
;;
zypper-rpm)
CMD="rpm -ql"
;;
android)
CMD="pm list packages -f"
;;
......
#!/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/>.
#
epm_policy()
{
[ -n "$pkg_names" ] || fatal "Info: missing package(s) name"
case $PMTYPE in
apt-rpm)
docmd apt-cache policy $pkg_names
;;
apt-dpkg)
docmd apt-cache policy $pkg_names
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/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/>.
#
# 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"
__fix_apt_sources_list()
{
for i in "$@" ; do
[ -s "$i" ] || continue
sudocmd perl -i.bak -pe "$SUBST_ALT_RULE" $i
done
}
epm_repolist()
{
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
docmd apt-repo list
__fix_apt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/*.list
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
......@@ -155,7 +155,7 @@ epm_search()
[ -n "$pkg_filenames" ] || fatal "Search: missing search argument(s)"
# it is useful for first time running
update_repo_if_needed
update_repo_if_needed soft
# FIXME: do it better
local MGS
......
......@@ -60,12 +60,26 @@ get_sourcepkg_name()
querypackage "$FILE" sourcerpm | sed -e "s|-$PKGVERSION.*||g"
}
__query_package_hl_url()
{
case $DISTRNAME in
ALTLinux)
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
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'
return 0
;;
esac
return 1
}
query_package_url()
{
local URL
case $PMTYPE in
*-rpm)
querypackage "$1" URL
querypackage "$1" URL || __query_package_hl_url "$1"
#LANG=C epm info "$1"
return
;;
......
# This spec is backported to ALTLinux p7 automatically by rpmbph script. Do not edit it.
#
Name: eepm
Version: 1.5.17
Version: 1.5.20
Release: alt0.M70P.1
Summary: Etersoft EPM package manager
......@@ -67,9 +67,26 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Wed Aug 19 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.17-alt0.M70P.1
* Mon Oct 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.20-alt0.M70P.1
- backport to ALTLinux p7 (by rpmbph script)
* Mon Oct 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.20-alt1
- distr_info: add mcst support
- skip update checking for non root users have no nopassword sudo
- epm_checksystem: add initial file for check system health
* Wed Aug 26 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.19-alt1
- epm-clean: add deb-based support
- check_updated_repo: use $SUDO for check if updated
- epm-site: get url for noninstalled packages from packages.altlinux.org on ALT Linux
* Tue Aug 25 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.18-alt1
- epm: add policy (like apt-cache policy) command
- initial repofix code, need fix regexp and test
- epm-filelist: realize low level file list for rpm in the same code
- fix checking update files
- epm clean: clean all cached files on ALT
* Wed Aug 19 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.17-alt1
- fix update repo checking
- print Uwaga about eatmydata only if verbose mode
......
# Local package resource list for APT goes here.
# To inspect package defined part, see /etc/apt/sources.list.d/*.list
#rpm ftp://server/pub/ALTLinux/Sisyphus x86_64 classic games media
#rpm ftp://server/pub/ALTLinux/Sisyphus x86_32 classic
#rpm ftp://server/pub/ALTLinux/Sisyphus noarch classic games media
#rpm file:/var/ftp/pub/ALTLinux i586 bonus
rpm file:/var/ftp/pub/ALTLinux/Sisyphus x86_64 classic debuginfo
rpm file:/var/ftp/pub/ALTLinux/Sisyphus x86_64-i586 classic
rpm file:/var/ftp/pub/ALTLinux/Sisyphus noarch classic
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus x86_64 addon nonfree
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus x86_64-i586 addon
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus noarch addon nonfree
rpm file:/var/ftp/pub/Etersoft/WINE@Etersoft/2.1-testing/WINE/ALTLinux Sisyphus main
rpm file:/var/ftp/pub/Etersoft/WINE@Etersoft/2.1-testing/WINE/ALTLinux Sisyphus/extra main
#rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus i586 addon nonfree
#rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus x86_64 nonfree
#rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus noarch nonfree
#rpm http://git.altlinux.org/repo/81290/ x86_64 task
rpm http://download.etersoft.ru/pub/Etersoft/RX@Etersoft/testing x86_64/ALTLinux/Sisyphus main
rpm http://download.etersoft.ru/pub/Etersoft/RX@Etersoft/unstable x86_64/ALTLinux/Sisyphus main
#rpm http://git.altlinux.org/repo/125605/ x86_64-i586 task
# ftp.altlinux.org (ALT Linux, Moscow)
# ALT Linux Sisyphus
rpm [alt] ftp://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus x86_64 classic
rpm [alt] ftp://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus noarch classic
rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux p7/branch/x86_64 classic
rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux p7/branch/noarch classic
rpm [alt] rsync://ftp.altlinux.org/ALTLinux/Sisyphus x86_64 classic
rpm [alt] rsync://ftp.altlinux.org/ALTLinux/Sisyphus noarch classic
# possible it will be in apt-conf-etersoft?
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft Sisyphus/i586 addon nonfree
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft Sisyphus/noarch addon nonfree
# mirror.yandex.ru (Yandex, Moscow)
# ALT Linux Sisyphus
rpm [alt] ftp://mirror.yandex.ru/altlinux/Sisyphus x86_64 classic
rpm [alt] ftp://mirror.yandex.ru/altlinux/Sisyphus noarch classic
rpm [alt] http://mirror.yandex.ru/altlinux/Sisyphus x86_64 classic
rpm [alt] http://mirror.yandex.ru/altlinux/Sisyphus noarch classic
rpm [alt] rsync://mirror.yandex.ru/altlinux/Sisyphus x86_64 classic
rpm [alt] rsync://mirror.yandex.ru/altlinux/Sisyphus noarch classic
# Local package resource list for APT goes here.
# To inspect package defined part, see /etc/apt/sources.list.d/*.list
#rpm ftp://server/pub/ALTLinux/Sisyphus x86_64 classic games media
#rpm ftp://server/pub/ALTLinux/Sisyphus x86_32 classic
#rpm ftp://server/pub/ALTLinux/Sisyphus noarch classic games media
#rpm file:/var/ftp/pub/ALTLinux i586 bonus
rpm file:/var/ftp/pub ALTLinux/Sisyphus/x86_64 classic debuginfo
rpm file:/var/ftp/pub ALTLinux/Sisyphus/x86_64-i586 classic
rpm file:/var/ftp/pub ALTLinux/Sisyphus/noarch classic
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/x86_64 addon nonfree
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/x86_64-i586 addon
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/noarch addon nonfree
rpm file:/var/ftp/pub/Etersoft WINE@Etersoft/2.1-testing/WINE/ALTLinux/Sisyphus main
rpm file:/var/ftp/pub/Etersoft WINE@Etersoft/2.1-testing/WINE/ALTLinux/Sisyphus/extra main
#rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/i586 addon nonfree
#rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/x86_64 nonfree
#rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/noarch nonfree
#rpm http://git.altlinux.org/repo/81290/ x86_64 task
rpm http://download.etersoft.ru/pub/Etersoft RX@Etersoft/testing/x86_64/ALTLinux/Sisyphus main
rpm http://download.etersoft.ru/pub/Etersoft RX@Etersoft/unstable/x86_64/ALTLinux/Sisyphus main
#rpm http://git.altlinux.org/repo/125605/ x86_64-i586 task
# ftp.altlinux.org (ALT Linux, Moscow)
# ALT Linux Sisyphus
rpm [alt] ftp://ftp.altlinux.org/pub/distributions ALTLinux/Sisyphus/x86_64 classic
rpm [alt] ftp://ftp.altlinux.org/pub/distributions ALTLinux/Sisyphus/noarch classic
rpm [alt] http://ftp.altlinux.org/pub/distributions ALTLinux/p7/branch/x86_64 classic
rpm [alt] http://ftp.altlinux.org/pub/distributions ALTLinux/p7/branch/noarch classic
rpm [alt] rsync://ftp.altlinux.org ALTLinux/Sisyphus/x86_64 classic
rpm [alt] rsync://ftp.altlinux.org ALTLinux/Sisyphus/noarch classic
# possible it will be in apt-conf-etersoft?
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/i586 addon nonfree
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/noarch addon nonfree
# mirror.yandex.ru (Yandex, Moscow)
# ALT Linux Sisyphus
rpm [alt] ftp://mirror.yandex.ru altlinux/Sisyphus/x86_64 classic
rpm [alt] ftp://mirror.yandex.ru altlinux/Sisyphus/noarch classic
rpm [alt] http://mirror.yandex.ru altlinux/Sisyphus/x86_64 classic
rpm [alt] http://mirror.yandex.ru altlinux/Sisyphus/noarch classic
rpm [alt] rsync://mirror.yandex.ru altlinux/Sisyphus/x86_64 classic
rpm [alt] rsync://mirror.yandex.ru altlinux/Sisyphus/noarch classic
#!/bin/sh
. ../bin/epm-repofix
#__fix_apt_sources_list
perl -pe "$SUBST_ALT_RULE" <test_sources.list >test_sources.list.out
echo "Fixes:"
diff -u test_sources.list test_sources.list.out
echo "==========="
echo "Diffs:"
diff -u test_sources.list.reference test_sources.list.out && echo DONE
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