Commit 418a4968 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 037462aa 47232fca
Etersoft EPM package manager README
# Etersoft EPM package manager README
Really, EPM is a wrapper for any package manager used in your operating system.
Run $ epm --help for check all support commands.
Run
```
$ epm --help
```
to see list of all supported commands.
The main goal of the project provide the same package management interface
on any platform.
The main goal of the project is to provide the same package management interface
on all platforms.
You can use
```
# epmi NAME
```
or
```
# epm -i NAME
```
or
```
# epm install NAME
for install package. It is just aliases for one command: install of the package.
EEPM will run urpmi on Mandriva, apt-get install on Ubuntu, yum install on Fedora.
And it have a little intelligence, so EEPM will try install file with package via
low level commands (rpm or dpkg) before use hi level commands (yum, apt).
```
to install a package. It is just an alias for one command: install the package.
EEPM will run `urpmi` on Mandriva, `apt-get install` on Ubuntu, `yum install` on Fedora.
And it has a little intelligence, so EEPM will first try to install a package file via
low level commands (`rpm` or `dpkg`) before using higher level commands (`yum`, `apt`).
Just try your comfort style for package management and save your experience the same
on any platform. EEPM will print out any real command it uses so you can learn from it.
Just try your comfort style for package management and carry your experience the same
to any platform. EEPM will print out any real command it uses so you can learn from it.
Also EEPM has initial support for control repositories: list, add, remove, update
Also EEPM has initial support for repository management: list, add, remove, update
Pay attention to follow useful commands:
epmqf - query package(s) owning file
epmqp - search in the list of installed packages
Pay attention to the following useful commands:
* `epmqf` - query package(s) owning file
* `epmqp` - search in the list of installed packages
epmqf helps get package name for any file or command in the system:
`epmqf` can be helpful to get package name for any file or command in the system:
```
$ epmqf epmqf
Note: epmqf is placed as /usr/bin/epmqf
$ rpm -qf /usr/bin/epmqf
......@@ -36,20 +47,23 @@ Note: /usr/bin/epmqf is link to epm
Note: epm is placed as /usr/bin/epm
$ rpm -qf /usr/bin/epm
eepm-1.1.0-alt2
```
== Install on any system ==
## Install on any system
Just run under root user:
```
# curl -s https://raw.githubusercontent.com/Etersoft/eepm/master/packed/epm.sh | bash /dev/stdin ei --auto
```
== How to add new distro support ==
1. Fix detection with distr_info
2. Add distro support in set_pm_type function
3. Realize every command in epm-* files
4. Check epm packages and epm --short packages works correctly
(epm package 'awk' have to print packages with awk substring in their names)
## How to add new distro support
1. Fix detection with `distr_info`
2. Add distro support in `set_pm_type` function
3. Implement every command in epm-* files
4. Ensure that `epm packages` and `epm --short packages` works correctly
(`epm package 'awk'` has to print packages with `awk` substring in their names)
See detailed description in russian at
See detailed description in Russian at
http://wiki.etersoft.ru/Epm
Please e-mail me:
......
......@@ -67,7 +67,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-2018"
echo "Copyright (c) Etersoft 2012-2019"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -199,6 +199,9 @@ check_command()
check|fix|verify) # HELPCMD: check local package base integrity and fix it
epm_cmd=check
;;
dedup) # HELPCMD: remove unallowed duplicated pkgs (after upgrade crash)
epm_cmd=dedup
;;
-cl|cl|changelog) # HELPCMD: show changelog for package
epm_cmd=changelog
;;
......
......@@ -31,7 +31,7 @@ epm_autoorphans()
case $PMTYPE in
apt-rpm)
# ALT Linux only
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
assure_exists /usr/share/apt/scripts/list-extras.lua apt-scripts
if [ -z "$dryrun" ] ; then
echo "We will try remove all installed packages which are missed in repositories"
warning "Use with caution!"
......
......@@ -132,7 +132,7 @@ __epm_autoremove_altrpm()
{
local i
load_helper epm-packages
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
assure_exists /usr/share/apt/scripts/list-nodeps.lua apt-scripts
if [ -z "$pkg_names" ] ; then
__epm_autoremove_altrpm_pp '^(python-module-|python3-module-|python-modules-|python3-modules|perl-)'
......
......@@ -17,34 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# remove duplicates
try_fix_apt_rpm_dupls()
{
info "Check for duplicates ..."
local TESTPKG="ignoreflock"
local has_testpkg=""
if epm --quiet installed $TESTPKG ; then
has_testpkg=1
sudocmd epm remove --auto $TESTPKG || return
fi
local PKGLIST
PKGLIST=$(LANG=C $SUDO apt-get install $TESTPKG 2>&1 | grep "W: There are multiple versions of" | \
sed -e 's|W: There are multiple versions of "\(.*\)" in your system.|\1|')
local TODEL
for i in $PKGLIST ; do
local pkg=${i/.32bit/}
local todel="$(rpm -q $pkg | head -n1)"
local todel2="$(rpm -q $pkg | head -n2 | tail -n1)"
if [ "$todel" = "$todel2" ] ; then
echo "Fix the same name duplicates for $pkg..."
sudocmd rpm -e "$todel" --allmatches --nodeps && epm install $pkg && continue
fi
sudocmd rpm -e "$todel" || TODEL="$TODEL $todel"
done
[ -n "$TODEL" ] && sudocmd rpm -e "$TODEL"
[ -n "$has_testpkg" ] && epm install $TESTPKG
}
epm_check()
{
case $PMTYPE in
......@@ -52,7 +24,7 @@ case $PMTYPE in
#sudocmd apt-get check || exit
#sudocmd apt-get update || exit
sudocmd apt-get -f install || return
try_fix_apt_rpm_dupls
info "You can use epm dedup also"
;;
apt-dpkg)
#sudocmd apt-get check || exit
......
#!/bin/sh
#
# Copyright (C) 2019 Etersoft
# Copyright (C) 2019 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/>.
#
# remove duplicates
try_fix_apt_rpm_dupls()
{
info "Check for duplicates (internal implementation) ..."
local TESTPKG="ignoreflock"
local has_testpkg=""
if epm --quiet installed $TESTPKG ; then
has_testpkg=1
sudocmd epm remove --auto $TESTPKG || return
fi
local PKGLIST
PKGLIST=$(LANG=C $SUDO apt-get install $TESTPKG 2>&1 | grep "W: There are multiple versions of" | \
sed -e 's|W: There are multiple versions of "\(.*\)" in your system.|\1|')
local TODEL
for i in $PKGLIST ; do
local pkg=${i/.32bit/}
local todel="$(rpm -q $pkg | head -n1)"
local todel2="$(rpm -q $pkg | head -n2 | tail -n1)"
if [ "$todel" = "$todel2" ] ; then
echo "Fix the same name duplicates for $pkg..."
sudocmd rpm -e "$todel" --allmatches --nodeps --justdb && epm install $pkg && continue
fi
# first use older package
[ "$(rpmevrcmp "$todel" "$todel2")" = "1" ] && todel="$todel2"
sudocmd rpm -e "$todel" || TODEL="$TODEL $todel"
done
[ -n "$TODEL" ] && sudocmd rpm -e "$TODEL"
[ -n "$has_testpkg" ] && epm install $TESTPKG
}
epm_dedup()
{
case $PMTYPE in
apt-rpm)
# ALT Linux only
assure_exists /usr/share/apt/scripts apt-scripts
if [ -f /usr/share/apt/scripts/dedup.lua ] ; then
"Check for duplicates via apt-get dedup from apt-scripts"
sudocmd apt-get dedup
else
try_fix_apt_rpm_dupls
fi
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2013, 2016, 2017 Etersoft
# Copyright (C) 2013, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2016, 2017, 2019 Etersoft
# Copyright (C) 2013, 2016, 2017, 2019 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
......@@ -82,10 +82,17 @@ __replace_alt_version_in_repo()
__alt_repofix()
{
local TO="$1"
load_helper epm-repofix
showcmd epm repofix
quiet=1 pkg_filenames='' epm_repofix >/dev/null
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\]![updates]!g"
# replace sign name
if [ -n "$TO" ] ; then
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[sisyphus\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\]![$TO]!g"
fi
}
__get_conflict_release_pkg()
......@@ -140,21 +147,20 @@ get_fix_release_pkg()
__update_to_the_distro()
{
local TO="$1"
__alt_repofix
case "$TO" in
p7)
__alt_repofix
docmd epm update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__alt_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
__alt_repofix $TO
docmd epm update || fatal
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;;
p8)
__alt_repofix
docmd epm update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__alt_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
__alt_repofix $TO
docmd epm update || fatal
# sure we have systemd if systemd is running
if is_installed systemd && is_active_systemd systemd ; then
......@@ -162,12 +168,23 @@ __update_to_the_distro()
fi
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;;
p9)
#docmd epm update || fatal
#docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__alt_repofix $TO
docmd epm update || fatal
# sure we have systemd if systemd is running
#if is_installed systemd && is_active_systemd systemd ; then
# docmd epm install systemd || fatal
#fi
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;;
Sisyphus)
__alt_repofix
docmd epm update || fatal
local ADDPKG
ADDPKG=$(epm -q --short make-initrd sssd-ad 2>/dev/null)
docmd epm install librpm7 librpm rpm apt $ADDPKG "$(get_fix_release_pkg --force "$TO")" ConsoleKit2- || fatal "Check an error and run again"
#docmd apt-get upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
#local ADDPKG
#ADDPKG=$(epm -q --short make-initrd sssd-ad 2>/dev/null)
#docmd epm install librpm7 librpm rpm apt $ADDPKG "$(get_fix_release_pkg --force "$TO")" ConsoleKit2- || fatal "Check an error and run again"
docmd epm upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
;;
*)
......@@ -186,6 +203,7 @@ __update_alt_to_next_distro()
TO="p7"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo "$FROM/branch/" "$TO/branch/"
__update_to_the_distro "$TO"
docmd epm update-kernel
......@@ -196,6 +214,17 @@ __update_alt_to_next_distro()
TO="p8"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo $FROM/branch/ $TO/branch/
__update_to_the_distro $TO
docmd epm update-kernel || fatal
info "Done."
;;
"p8"|"p8 p9"|"t8 p9"|"c8 c9"|"p9 p9")
TO="p9"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo $FROM/branch/ $TO/branch/
__update_to_the_distro $TO
docmd epm update-kernel || fatal
......@@ -206,19 +235,28 @@ __update_alt_to_next_distro()
confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "$FROM/" "$TO/branch/"
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
#__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__update_to_the_distro $TO
docmd epm downgrade || fatal
info "Done."
;;
"Sisyphus p9")
TO="p9"
confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "$FROM/" "$TO/branch/"
#__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__update_to_the_distro $TO
docmd epm downgrade || fatal
info "Done."
;;
"p8 Sisyphus"|"Sisyphus Sisyphus")
"p8 Sisyphus"|"p9 Sisyphus"|"Sisyphus Sisyphus")
TO="Sisyphus"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
docmd epm upgrade || fatal
__replace_alt_version_in_repo "$FROM/branch/" "$TO/"
__alt_repofix
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![alt]!g"
__alt_repofix "sisyphus"
__update_to_the_distro $TO
docmd epm update-kernel || fatal
info "Done."
......@@ -258,15 +296,18 @@ epm_release_upgrade()
fi
fi
__alt_repofix
# check forced target
if [ -n "$pkg_filenames" ] ; then
[ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames"
fi
TARGET="$pkg_filenames"
__alt_repofix
# TODO: ask before upgrade
__update_alt_to_next_distro $DISTRVERSION $pkg_filenames
__update_alt_to_next_distro $DISTRVERSION $TARGET
return
;;
*)
......
......@@ -60,7 +60,7 @@ case $PMTYPE in
CMD="dnf search --"
;;
zypper-rpm)
CMD="zypper search --"
CMD="zypper search -d --"
;;
mpkg)
CMD="mpkg search"
......
......@@ -75,7 +75,7 @@ case $PMTYPE in
CMD="urpmf"
;;
zypper-rpm)
CMD="zypper wp vi"
CMD="zypper search --file-list"
;;
pacman)
CMD="pacman -Qo"
......
......@@ -558,11 +558,12 @@ is_active_systemd()
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
[ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a='' mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
readlink /sbin/init | grep -q 'systemd' || return
#a='' mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
cat /proc/1/cmdline | grep -q 'systemd' || return
#readlink /sbin/init | grep -q 'systemd' || return
# some hack
# shellcheck disable=SC2009
ps ax | grep '[s]ystemd' | grep -q -v 'systemd-udev'
#ps ax | grep '[s]ystemd' | grep -q -v 'systemd-udev'
}
assure_distr()
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 2.5.8
Version: 2.5.10
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -90,9 +90,20 @@ rm -f %buildroot%_datadir/%name/tools_eget
%_sysconfdir/bash_completion.d/cerv
%changelog
* Tue Mar 26 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.8-alt0.M80P.1
* Thu Aug 15 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.10-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Thu Aug 15 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.10-alt1
- move dedup code to the separate command
- epm dedup: add apt-get dedup from apt-get dedup support
- epm search: improve for zypper
- release_upgrade: rewrite to p9 upgrade support
* Fri May 17 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.9-alt1
- epm-check: use rpmevrcmp to delete old versions
- epm-sh-functions: improve systemd detection (docker support)
- support release upgrade for p9
* Tue Mar 26 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.8-alt1
- add trueconf-client repack config
- epm: set timeout for 2 secs
......
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