Commit f19e6172 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p8 as 2.0.1-alt0.M80P.1 (with rpmbph script)

parents a6cbbc81 4a4598e4
/etc/eepm.conf конфиг
<<<<<<< HEAD
<<<<<<< HEAD
FIXME: epm-install need realpath, missed on some systems
Lock a Specific Package
......@@ -11,6 +12,10 @@ Remove Lock from a Package
=======
>>>>>>> heads/master
=======
implement distr_info as inside tool and do access via epm command
>>>>>>> heads/master
[18:21:12] <danil> Вот так можно:
RED='\033[0;31m' ; NC='\033[0m' b="b" ; echo -e "aba" | sed -e "s|${b}|\\${RED}${b}\\${NC}|g" | xargs -0 printf
[18:23:40] <danil> > Ты знаешь способы?
......
......@@ -61,7 +61,7 @@ pkgtype()
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;;
fedora|redhat|scientific|centos|rhel)
fedora|redhat|scientific|centos|rhel|goslinux)
echo "rpm" ;;
*) echo "rpm" ;;
esac
......@@ -69,8 +69,8 @@ pkgtype()
get_var()
{
grep -i "^$1 *=" | head -n 1 | sed -e "s/^[^=]*[ \t]*=[ \t]*//"
# get first variable and print it out, drop quotes if exists
grep -i "^$1 *=" | head -n 1 | sed -e "s/^[^=]*[ \t]*=[ \t]*//" | sed -e "s/^[\'\"]\(.*\)[\'\"]/\1/"
}
# 2010.1 -> 2010
......@@ -97,6 +97,7 @@ if distro altlinux-release ; then
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT Workstation K 8." ; then DISTRIB_RELEASE="p8"
elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
......@@ -241,6 +242,8 @@ elif distro redhat-release ; then
DISTRIB_ID="CentOS"
elif has Scientific ; then
DISTRIB_ID="Scientific"
elif has GosLinux ; then
DISTRIB_ID="GosLinux"
fi
if has Beryllium ; then
DISTRIB_ID="Scientific"
......@@ -298,6 +301,8 @@ elif [ `uname -o 2>/dev/null` = "Cygwin" ] ; then
# try use standart LSB info by default
elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB
# fix distro name
case "$DISTRIB_ID" in
"openSUSE Tumbleweed")
DISTRIB_ID="Tumbleweed"
......@@ -344,7 +349,7 @@ case $1 in
exit 0
;;
-V)
echo "20160822"
echo "20161212"
exit 0
;;
*)
......
......@@ -65,7 +65,7 @@ print_version()
{
echo "EPM package manager version @VERSION@"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2016"
echo "Copyright (c) Etersoft 2012-2017"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......
#!/bin/sh
#
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2017 Etersoft
# Copyright (C) 2012, 2017 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
......@@ -31,7 +31,7 @@ case $DISTRNAME in
local branch="$DISTRVERSION/branch"
[ "$DISTRVERSION" = "Sisyphus" ] && branch="$DISTRVERSION"
# FIXME
[ -n "$DISTRVERSION" ] || fatal "Empty $DISTRVERSION"
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586"
echo "" | sudocmd tee -a /etc/apt/sources.list
......@@ -44,9 +44,17 @@ case $DISTRNAME in
repo="$DISTRVERSION"
return 0
;;
autoimports)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[A-Z]" "[a-z]")"
esac
assure_exists apt-repo
if [ -z "$repo" ] ; then
docmd apt-repo add branch
echo "etersoft"
return
fi
sudocmd apt-repo add "$repo"
return
;;
......
......@@ -53,15 +53,15 @@ __epm_autoremove_altrpm_lib()
local force=force
local flag=
local libexclude='^lib'
local libexclude='^(lib|i586-lib)'
[ -n "$force" ] || libexclude=$libexclude'[^-]*$'
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd "apt-cache list-nodeps | grep -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -- "$libexclude" \
pkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" \
| sed -e "s/[-\.]32bit$//g" \
| grep -E -v -- "-(devel|devel-static|debuginfo)$" \
| grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \
| sed -e "s/\.32bit$//g" \
| grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)" )
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
......
......@@ -34,15 +34,15 @@ __is_repo_info_downloaded()
__is_repo_info_uptodate()
{
case $PMTYPE in
apt-rpm)
apt-*)
# apt-deb do not update lock file date
if $SUDO test -r /var/lib/apt/lists ; then
local LOCKFILE=/var/lib/apt/lists/lock
#if $SUDO test -r /var/lib/apt/lists ; then
local LOCKFILE=/var/lib/apt/lists
$SUDO test -r $LOCKFILE || return
# if repo older than 1 day, return false
# find print string if file is obsoleted
test -z "$($SUDO find $LOCKFILE -mtime +1)" || return
fi
test -z "$(find $LOCKFILE -maxdepth 0 -mtime +1)" || return
#fi
;;
*)
;;
......
......@@ -67,6 +67,8 @@ __download_pkg_urls()
warning "Failed to download $url, ignoring"
fi
done
# restore
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
}
# NOTE: call __clean_downloaded_pkg_files after
......@@ -113,6 +115,7 @@ __epm_get_altpkg_url()
[ "$arch" = "noarch" ] || arch=$(arch)
# HACK: filename can be list
local filename=$(paoapi packages/$1 | get_pao_var filename | grep $arch)
[ -n "$filename" ] || fatal "Can't get filename"
# fixme: get from /branches
local dv=$DISTRNAME/$DISTRVERSION/branch
[ "$DISTRVERSION" = "Sisyphus" ] && dv=$DISTRNAME/$DISTRVERSION
......@@ -150,6 +153,9 @@ epm_download()
dnf-rpm)
sudocmd dnf download $pkg_filenames
;;
urpm-rpm)
sudocmd urpmi --no-install $URPMOPTIONS $@
;;
tce)
sudocmd tce-load -w $pkg_filenames
;;
......
......@@ -33,6 +33,12 @@ __epm_info_rpm_low()
epm_info()
{
# if possible, it will put pkg_urls into pkg_files or pkg_names
if [ -n "$pkg_urls" ] ; then
load_helper epm-download
__handle_pkg_urls_to_checking
fi
[ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name"
case $PMTYPE in
......@@ -117,4 +123,10 @@ case $PMTYPE in
;;
esac
local RETVAL=$?
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
return $RETVAL
}
......@@ -19,13 +19,27 @@
# copied from etersoft-build-utils/bin/rpmqf
# TODO: check for lib64/name situations
__abs_filename()
{
if echo "$1" | grep -q "/" ; then
echo "$1"
return
fi
if [ -e "$1" ] ; then
echo "$(pwd)/$1"
return
fi
echo "$1"
}
__do_query_real_file()
{
local TOFILE
# get canonical path
if [ -e "$1" ] ; then
TOFILE=$(realpath "$1")
TOFILE="$(__abs_filename "$1")"
else
TOFILE=$(which "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then
......
......@@ -232,9 +232,11 @@ epm_release_upgrade()
assure_exists dnf-plugin-system-upgrade
sudocmd dnf system-upgrade
local RELEASEVER="$pkg_filenames"
[ -n "$RELEASEVER" ] || fatal "Run me with new version"
[ -n "$RELEASEVER" ] || RELEASEVER=$(($DISTRVERSION + 1))
#[ -n "$RELEASEVER" ] || fatal "Run me with new version"
info "Upgrate to $DISTRNAME/$RELEASEVER"
sudocmd dnf system-upgrade download --refresh --releasever=$RELEASEVER
sudocmd dnf system-upgrade
sudocmd dnf distro-sync --releasever=$RELEASEVER
info "Run epm autoorphans to remove orphaned packages"
;;
urpm-rpm)
......
#!/bin/sh
#
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2017 Etersoft
# Copyright (C) 2012, 2017 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
......@@ -20,11 +20,24 @@
epm_removerepo()
{
local repo="$(eval echo $quoted_args)"
case $PMTYPE in
apt-rpm)
case $DISTRNAME in
ALTLinux)
case "$repo" in
autoimports)
info "remove autoimports repo"
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[A-Z]" "[a-z]")"
;;
esac
assure_exists apt-repo
sudocmd apt-repo rm "$repo"
return
;;
esac;
case $PMTYPE in
apt-dpkg|aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list"
;;
......
......@@ -29,8 +29,26 @@ __repofix_check_vendor()
return 1
}
# source-list vendor path
# example: /etc/apt/source.list p7 ALTLinux\/Sisyphus
__try_fix_apt_source_list()
{
local list="$1"
local br="$2"
local path="$3"
if grep -q -e "^[^#].*$path" $list ; then
if __repofix_check_vendor $br ; then
regexp_subst "/$path/s/^rpm[[:space:]]*([fhr])/rpm [$br] \1/" $list
else
warning "Skip set $br vendor key (it misssed) for $list"
regexp_subst "/$path/s/^rpm[[:space:]]*\[$br\][[:space:]]*([fhr])/rpm \1/" $list
fi
fi
}
__fix_apt_sources_list()
{
# for beauty spaces
local SUBST_ALT_RULE='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ](Sisyphus|p8[/ ]branch|p7[/ ]branch|p6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
local i
assure_root
......@@ -42,33 +60,14 @@ __fix_apt_sources_list()
regexp_subst "/^ *#/! $SUBST_ALT_RULE" $i
# Sisyphus uses 'alt' vendor key
if __repofix_check_vendor alt ; then
regexp_subst "/ALTLinux\/Sisyphus\//s/^rpm *([fhr])/rpm [alt] \1/" $i
else
warning "Skip set alt vendor key (it misssed)"
fi
__try_fix_apt_source_list $i alt "ALTLinux\/Sisyphus"
# skip branch replacement for ALT Linux Sisyphus
[ "$DISTRVERSION" = "Sisyphus" ] && continue
# add signs for branches
local br
for br in $DISTRVERSION ; do
if ! __repofix_check_vendor $br ; then
warning "Skip set $br vendor key (it misssed)"
continue
fi
regexp_subst "/ALTLinux\/$br\/branch/s/^rpm *([fhr])/rpm [$br] \1/" $i
done
for br in $DISTRVERSION ; do
#if is_installed apt-conf-etersoft-common ; then
if ! __repofix_check_vendor etersoft ; then
warning "Skip set etersoft vendor key (it misssed)"
continue
fi
regexp_subst "/Etersoft\/$br\/branch/s/^rpm *([fhr])/rpm [etersoft] \1/" $i
done
__try_fix_apt_source_list $i $DISTRVERSION "ALTLinux\/$DISTRVERSION\/branch"
__try_fix_apt_source_list $i etersoft "Etersoft\/$DISTRVERSION\/branch"
done
}
......
......@@ -524,5 +524,5 @@ is_active_systemd()
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
# some hack
ps ax | grep -q '[s]ystemd' | grep -v 'systemd-udev' >/dev/null
ps ax | grep '[s]ystemd' | grep -v 'systemd-udev' >/dev/null
}
......@@ -23,7 +23,7 @@ epm_upgrade()
{
local CMD
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
#[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
# it is useful for first time running
update_repo_if_needed
......@@ -42,18 +42,18 @@ epm_upgrade()
yum-rpm)
local OPTIONS="$(subst_option non_interactive -y)"
# can do update repobase automagically
CMD="yum $OPTIONS update"
CMD="yum $OPTIONS update $pkg_filenames"
;;
dnf-rpm)
local OPTIONS="$(subst_option non_interactive -y)"
CMD="dnf $OPTIONS distro-sync"
CMD="dnf $OPTIONS distro-sync $pkg_filenames"
;;
snappy)
CMD="snappy update"
;;
urpm-rpm)
# or --auto-select --replace-files
CMD="urpmi --update --auto-select"
CMD="urpmi --update --auto-select $pkg_filenames"
;;
zypper-rpm)
CMD="zypper dist-upgrade"
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.9.9
Version: 2.0.1
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -68,11 +68,27 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Thu Dec 08 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.9-alt0.M80P.1
* Tue Feb 07 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.1-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Tue Feb 07 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.1-alt1
- autoremove: skip -32bit suffix
* Mon Jan 16 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.0-alt1
- distr_info: fix get lsb-release file with quoted fields
- epm-download: add filename empty checking
- epm info: add URL support
- epm upgrade: allow extra args
- release_upgrade: improve for Fedora
- epm-download: add support for urpm
- check_update_repo: check for /var/lib/apt/lists date
- query_file: improve check for relative path
- epm-automove: fix i586-lib issue
- fix systemd detection
- epm: add/remove autoimports
* Wed Dec 07 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.9-alt1
- add realpath realization if missed
- add own realpath implementation if missed
- add openSUSE Tumbleweed support
- autoremove: do separate removing cycles for python/perl and libs
- epm-site: fix json parsing
......
......@@ -508,7 +508,7 @@ is_active_systemd()
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
# some hack
ps ax | grep -q '[s]ystemd' | grep -v 'systemd-udev' >/dev/null
ps ax | grep '[s]ystemd' | grep -v 'systemd-udev' >/dev/null
}
# File bin/serv-common:
......@@ -1063,7 +1063,7 @@ pkgtype()
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;;
fedora|redhat|scientific|centos|rhel)
fedora|redhat|scientific|centos|rhel|goslinux)
echo "rpm" ;;
*) echo "rpm" ;;
esac
......@@ -1071,8 +1071,8 @@ pkgtype()
get_var()
{
grep -i "^$1 *=" | head -n 1 | sed -e "s/^[^=]*[ \t]*=[ \t]*//"
# get first variable and print it out, drop quotes if exists
grep -i "^$1 *=" | head -n 1 | sed -e "s/^[^=]*[ \t]*=[ \t]*//" | sed -e "s/^[\'\"]\(.*\)[\'\"]/\1/"
}
# 2010.1 -> 2010
......@@ -1099,6 +1099,7 @@ if distro altlinux-release ; then
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT Workstation K 8." ; then DISTRIB_RELEASE="p8"
elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
......@@ -1243,6 +1244,8 @@ elif distro redhat-release ; then
DISTRIB_ID="CentOS"
elif has Scientific ; then
DISTRIB_ID="Scientific"
elif has GosLinux ; then
DISTRIB_ID="GosLinux"
fi
if has Beryllium ; then
DISTRIB_ID="Scientific"
......@@ -1300,6 +1303,8 @@ elif [ `uname -o 2>/dev/null` = "Cygwin" ] ; then
# try use standart LSB info by default
elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB
# fix distro name
case "$DISTRIB_ID" in
"openSUSE Tumbleweed")
DISTRIB_ID="Tumbleweed"
......@@ -1346,7 +1351,7 @@ case $1 in
exit 0
;;
-V)
echo "20160822"
echo "20161212"
exit 0
;;
*)
......@@ -1761,7 +1766,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 1.9.9"
echo "Service manager version 2.0.0"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......
LSB_VERSION="core-2.0-noarch:core-3.2-noarch:core-4.0-noarch:core-2.0-x86_64:core-3.2-x86_64:core-4.0-x86_64"
DISTRIB_ID="openSUSE Tumbleweed"
DISTRIB_RELEASE="20161014"
DISTRIB_CODENAME=""
DISTRIB_DESCRIPTION="openSUSE Tumbleweed"
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