Commit 61b7d98e authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents f42c0ade ac36efc1
......@@ -312,7 +312,6 @@ __epm_check_if_try_install_rpm()
cd $TDIR
for pkg in $rpmpkgs ; do
showcmd_store_output fakeroot alien -d -k --scripts "$pkg"
clean_store_output
local DEBCONVERTED=$(grep "deb generated" $RC_STDOUT | sed -e "s| generated||g")
clean_store_output
epm install $DEBCONVERTED
......
......@@ -22,6 +22,9 @@ epm_policy()
[ -n "$pkg_names" ] || fatal "Info: missing package(s) name"
# get package name for hi level package management command (with version if supported and if possible)
pkg_names=$(__epm_get_hilevel_name $pkg_names)
case $PMTYPE in
apt-rpm)
docmd apt-cache policy $pkg_names
......
......@@ -98,11 +98,11 @@ __epm_get_hilevel_nameform()
echo $pkg
return
;;
yum-rpm)
yum-rpm|dnf-rpm)
# just use strict version with Epoch and Serial
local pkg
pkg=$(rpm -q --queryformat "%{EPOCH}:%{NAME}%{VERSION}-%{RELEASE}.${ARCH}\n" $1)
echo $pkg | grep -q "(none)" && pkg=$(rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE}.${ARCH}\n" $1)
pkg=$(rpm -q --queryformat "%{EPOCH}:%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" $1)
echo $pkg | grep -q "(none)" && pkg=$(rpm -q --queryformat "%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\n" $1)
echo $pkg
return
;;
......
......@@ -17,22 +17,43 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__local_ercat()
{
local i
for i in $* ; do
case "$i" in
*.xz)
xzcat $i
;;
*.lz4)
lz4cat $i
;;
*)
cat $i
;;
esac
done
}
__alt_local_content_search()
{
load_helper epm-sh-altlinux
info "Locate contents index file(s) ..."
local CI="$(get_local_alt_contents_index)"
# TODO use something like
[ -n "$CI" ] || fatal "Have no local contents index"
#local OUTCMD="less"
info "Searching in"
echo "$CI"
echo "for $1... "
#[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD="cat"
# OUTCMD="cat"
{
[ -n "$USETTY" ] && info "Search in $CI for $1..."
# {
# note! tabulation below!
grep -h -- ".*$1.* " $CI | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
} | $OUTCMD
__local_ercat $CI | grep -h -- ".*$1.* " | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
# } | $OUTCMD
}
epm_search_file()
......
#!/bin/sh
#
# Copyright (C) 2014 Etersoft
# Copyright (C) 2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2014, 2017 Etersoft
# Copyright (C) 2014, 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
......@@ -17,19 +17,71 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# TODO: port or rewrite apt-file
# apt-file like. See also
# https://bugzilla.altlinux.org/show_bug.cgi?id=14449
# convert "http://download.etersoft.ru/pub/ALTLinux/p8/branch x86_64" to /tmp/epm/ALTLinux/p8/branch/x86_64
get_local_alt_mirror_path()
{
local DN1=$(dirname "$1")
local DN2=$(dirname $DN1)
local BN0=$(basename "$1") # arch
local BN1=$(basename $DN1) # branch/Sisyphus
local BN2=$(basename $DN2)
[ "$BN1" = "branch" ] && echo "/tmp/eepm/$BN2/$BN1/$BN0" || echo "/tmp/eepm/$BN1/$BN0"
}
# args: url target_file
# result: will set FILE
download_alt_contents_index()
{
local TD="$2"
local OFILE="$TD/$(basename "$1")"
local DONE="$TD/done.$(basename "$1")"
# TODO: check if too old
if [ -r "$DONE" ] ; then
return
fi
mkdir -p "$TD"
docmd eget -O "$OFILE" "$1" || return
# plain file by default
echo "" >$DONE
# try compress
if epm assure lz4 ; then
docmd lz4 --rm "$OFILE" "$OFILE.lz4" || return
echo "lz4" >$DONE
else
epm assure xz || return
docmd xz "$ofile" || return
echo "xz" >$DONE
fi
}
get_local_alt_contents_index()
{
load_helper epm-repolist
epm_repolist | grep "rpm.*file:/" | sed -e "s|^rpm.*file:||g" | while read URL ARCH other ; do
test -d "$URL/$ARCH" || continue # fatal "Local mirror is not accessible via $URL/$ARCH"
FILE="$URL/$ARCH/base/contents_index"
# print out from local mirror
epm_repolist | grep "rpm.*file:/" | sed -e "s|^rpm.*file:||g" | while read LOCALPATH ARCH other ; do
test -d "$LOCALPATH/$ARCH" || continue
FILE="$LOCALPATH/$ARCH/base/contents_index"
if [ -r "$FILE" ] ; then
echo "$FILE"
else
info "TODO for girar server: There is no $(basename $FILE) file in $(dirname $FILE)"
fi
done
# print out from mirrored contents_index
epm_repolist | grep -E "rpm[[:space:]]*(ftp|http|https)://" | sed -e "s@^rpm.*\(ftp\|http\|https://\)@\1@g" | while read URL ARCH other ; do
LOCALPATH=$(get_local_alt_mirror_path "$URL/$ARCH")
download_alt_contents_index $URL/$ARCH/base/contents_index $LOCALPATH
echo "$LOCALPATH/contents_index*"
done
}
......@@ -467,7 +467,7 @@ case $DISTRNAME in
ArchLinux)
CMD="pacman"
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
CMD="yum-rpm"
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;;
......
......@@ -58,7 +58,7 @@ case $DISTRNAME in
ALTLinux)
CMD="service-chkconfig"
;;
Ubuntu|Debian|Mint)
Ubuntu|Debian|Mint|AstraLinux)
CMD="service-update"
;;
Mandriva|ROSA)
......@@ -73,7 +73,7 @@ case $DISTRNAME in
# ArchLinux)
# CMD="pacman"
# ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
CMD="service-chkconfig"
;;
VoidLinux)
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 2.0.2
Version: 2.0.4
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -68,9 +68,18 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Thu Mar 02 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.2-alt0.M80P.1
* Thu Mar 09 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.4-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Thu Mar 09 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.4-alt1
- epm-policy: move to hilevel package name
- implement local cache for contents index for ALT repos
* Tue Mar 07 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.3-alt1
- fix query hilevel name for yum/dnf
- epm install: fix install rpm on deb
- add missed in some cases AstraLinux and GosLinux
* Thu Mar 02 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.2-alt1
- distr_info: fix version detection for all ALT p8 distros
- add workaround for ALT rpm missed https support
......
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