Commit 1de2e43b authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 58f00307 1720f2c7
на p8, если в sources.list спереди стоит пробел
" rpm http://"
то имеем
# epm -sf /etc/fstab
Locate contents index file(s) ...
# apt-repo list
# eget -O /tmp/eepm/http:/10.10.19.99/altrepos/contents_index rpm/http://10.10.19.99/altrepos//base/contents_index
epm hs поиск с историей какой версией и changelog
https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks_(Русский) https://wiki.archlinux.org/index.php/Pacman/Tips_and_tricks_(Русский)
systemctl edit юнит systemctl edit юнит
......
...@@ -118,6 +118,8 @@ if distro altlinux-release ; then ...@@ -118,6 +118,8 @@ if distro altlinux-release ; then
elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1" elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0" elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
elif has Walnut ; then DISTRIB_RELEASE="4.0" elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has Hypericum ; then DISTRIB_RELEASE="p8"
elif has "starter kit" ; then DISTRIB_RELEASE="p8"
elif has 20070810 ; then DISTRIB_RELEASE="4.0" elif has 20070810 ; then DISTRIB_RELEASE="4.0"
elif has Ajuga ; then DISTRIB_RELEASE="4.0" elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has 20050723 ; then DISTRIB_RELEASE="3.0" elif has 20050723 ; then DISTRIB_RELEASE="3.0"
...@@ -354,11 +356,16 @@ esac ...@@ -354,11 +356,16 @@ esac
echo "$DIST_OS" echo "$DIST_OS"
} }
get_uname_m()
{
uname -m | tr [:upper:] [:lower:] | tr -d " \t\r\n"
}
get_arch() get_arch()
{ {
local DIST_ARCH local DIST_ARCH
# Resolve the architecture # Resolve the architecture
DIST_ARCH=`uname -m | tr [:upper:] [:lower:] | tr -d " \t\r\n"` DIST_ARCH="$(get_uname_m)"
case "$DIST_ARCH" in case "$DIST_ARCH" in
'ia32' | 'i386' | 'i486' | 'i586' | 'i686') 'ia32' | 'i386' | 'i486' | 'i586' | 'i686')
DIST_ARCH="x86" DIST_ARCH="x86"
...@@ -385,7 +392,7 @@ case "$DIST_ARCH" in ...@@ -385,7 +392,7 @@ case "$DIST_ARCH" in
DIST_ARCH="parisc" DIST_ARCH="parisc"
;; ;;
armv*) armv*)
if [ -z "`readelf -A /proc/self/exe | grep Tag_ABI_VFP_args`" ] ; then if [ -z "$(readelf -A /proc/self/exe | grep Tag_ABI_VFP_args)" ] ; then
DIST_ARCH="armel" DIST_ARCH="armel"
else else
DIST_ARCH="armhf" DIST_ARCH="armhf"
...@@ -399,7 +406,7 @@ get_bit_size() ...@@ -399,7 +406,7 @@ get_bit_size()
{ {
local DIST_BIT local DIST_BIT
# Check if we are running on 64bit platform, seems like a workaround for now... # Check if we are running on 64bit platform, seems like a workaround for now...
DIST_BIT=`uname -m | tr [:upper:] [:lower:] | tr -d " \t\r\n"` DIST_BIT="$(get_uname_m)"
case "$DIST_BIT" in case "$DIST_BIT" in
'amd64' | 'ia64' | 'x86_64' | 'ppc64') 'amd64' | 'ia64' | 'x86_64' | 'ppc64')
DIST_BIT="64" DIST_BIT="64"
...@@ -423,18 +430,20 @@ echo "$DIST_BIT" ...@@ -423,18 +430,20 @@ echo "$DIST_BIT"
# TODO: check before calc # TODO: check before calc
get_memory_size() { get_memory_size() {
local detected=0 local detected=0
local DIST_OS=$(get_base_os_name) local DIST_OS="$(get_base_os_name)"
if [ $DIST_OS = "macosx" ] case "$DIST_OS" in
then macosx)
detected=$((`sysctl hw.memsize | sed s/"hw.memsize: "//`/1024/1024)) detected=$((`sysctl hw.memsize | sed s/"hw.memsize: "//`/1024/1024))
elif [ $DIST_OS = "freebsd" ] ;;
then freebsd)
detected=$((`sysctl hw.physmem | sed s/"hw.physmem: "//`/1024/1024)) detected=$((`sysctl hw.physmem | sed s/"hw.physmem: "//`/1024/1024))
elif [ $DIST_OS = "linux" ] ;;
then linux)
[ -r /proc/meminfo ] && detected=$((`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`/1024)) [ -r /proc/meminfo ] && detected=$((`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`/1024))
fi ;;
# Exit codes only support values between 0 and 255. So use stdout. esac
# Exit codes only support values between 0 and 255. So use stdout.
echo $detected echo $detected
} }
......
...@@ -236,7 +236,7 @@ check_command() ...@@ -236,7 +236,7 @@ check_command()
update) # HELPCMD: update remote package repository databases update) # HELPCMD: update remote package repository databases
epm_cmd=update epm_cmd=update
;; ;;
addrepo|ar) # HELPCMD: add package repo addrepo|ar) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
epm_cmd=addrepo epm_cmd=addrepo
;; ;;
repolist|sl|rl|listrepo|repo) # HELPCMD: print repo list repolist|sl|rl|listrepo|repo) # HELPCMD: print repo list
...@@ -248,7 +248,7 @@ check_command() ...@@ -248,7 +248,7 @@ check_command()
removerepo|rr) # HELPCMD: remove package repo removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo epm_cmd=removerepo
;; ;;
release-upgrade|upgrade-release) # HELPCMD: update whole system to the next release release-upgrade|upgrade-release) # HELPCMD: update whole system to the release in arg (default: next (latest) release)
epm_cmd=release_upgrade epm_cmd=release_upgrade
;; ;;
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
......
...@@ -57,11 +57,14 @@ __epm_addrepo_altlinux() ...@@ -57,11 +57,14 @@ __epm_addrepo_altlinux()
local arch=$(uname -m) local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586" [ "$arch" = "i686" ] && arch="i586"
echo "" | sudocmd tee -a /etc/apt/sources.list echo "" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [alt] http://ftp.altlinux.org/pub/distributions archive/sisyphus/date/$datestr/$arch classic" | sudocmd tee -a /etc/apt/sources.list local distrversion="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
local rpmsign='[alt]'
[ "$distrversion" != "sisyphus" ] && rpmsign="[$distrversion]"
echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/$arch classic" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then if [ "$arch" = "x86_64" ] ; then
echo "rpm [alt] http://ftp.altlinux.org/pub/distributions archive/sisyphus/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list
fi fi
echo "rpm [alt] http://ftp.altlinux.org/pub/distributions archive/sisyphus/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list
return 0 return 0
;; ;;
esac esac
...@@ -74,8 +77,10 @@ __epm_addrepo_altlinux() ...@@ -74,8 +77,10 @@ __epm_addrepo_altlinux()
fi fi
if [ -z "$repo" ] ; then if [ -z "$repo" ] ; then
info "Add branch repo. TODO?" info "Add branch repo. Use follow params:"
sudocmd apt-repo add branch sudocmd apt-repo add branch
echo "etersoft (for LINUX@Etersoft repo)"
echo "archive 2018/02/09 (for archive from that date)"
return return
fi fi
...@@ -95,7 +100,15 @@ case $DISTRNAME in ...@@ -95,7 +100,15 @@ case $DISTRNAME in
esac esac
case $PMTYPE in case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg)
assure_exists apt-add-repository software-properties-common
if echo "$repo" | grep -q "https://" ; then
assure_exists apt-transport-https
fi
apt-add-repository "$repo"
info "Check file /etc/apt/sources.list if needed"
;;
aptitude-dpkg)
info "You need manually add repo to /etc/apt/sources.list (TODO)" info "You need manually add repo to /etc/apt/sources.list (TODO)"
;; ;;
yum-rpm) yum-rpm)
......
...@@ -56,13 +56,16 @@ case $PMTYPE in ...@@ -56,13 +56,16 @@ case $PMTYPE in
# sudocmd aura -Oj # sudocmd aura -Oj
# ;; # ;;
yum-rpm) yum-rpm)
docmd epm upgrade
assure_exists package-cleanup yum-utils
showcmd package-cleanup --orphans showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-") local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $dryrun $PKGLIST docmd epm remove $dryrun $PKGLIST
;; ;;
dnf-rpm) dnf-rpm)
# TODO: dnf list extras # TODO: dnf list extras
# TODO: Yum-utils package has been deprecated, use dnf instead. docmd epm upgrade
assure_exists package-cleanup dnf-utils
showcmd package-cleanup --orphans showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-") local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $dryrun $PKGLIST docmd epm remove $dryrun $PKGLIST
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2009, 2012, 2013, 2014, 2016 Etersoft # Copyright (C) 2009, 2012, 2013, 2014, 2016, 2018 Etersoft
# Copyright (C) 2009, 2012, 2013, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2009, 2012, 2013, 2014, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -17,15 +17,23 @@ ...@@ -17,15 +17,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# #
# changed since rpm 4.0.4
__rpm_allows_nosignature()
{
a= rpm --help | grep -q -- "--nosignature"
}
check_pkg_integrity() check_pkg_integrity()
{ {
local PKG="$1" local PKG="$1"
local RET local RET
local NOSIGNATURE
case $(get_package_type $PKG) in case $(get_package_type $PKG) in
rpm) rpm)
assure_exists rpm assure_exists rpm
docmd rpm --checksig $PKG __rpm_allows_nosignature && NOSIGNATURE="--nosignature" || NOSIGNATURE="--nogpg"
docmd rpm --checksig $NOSIGNATURE $PKG
;; ;;
deb) deb)
assure_exists dpkg assure_exists dpkg
......
...@@ -318,6 +318,7 @@ epm_install_files() ...@@ -318,6 +318,7 @@ epm_install_files()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
# TODO: replace with name changed function
__epm_check_if_try_install_deb $@ && return __epm_check_if_try_install_deb $@ && return
# do not using low-level for install by file path (FIXME: reasons?) # do not using low-level for install by file path (FIXME: reasons?)
...@@ -571,6 +572,7 @@ epm_install() ...@@ -571,6 +572,7 @@ epm_install()
if [ -z "$files$names" ] ; then if [ -z "$files$names" ] ; then
# TODO: assert $skip_installed # TODO: assert $skip_installed
[ -n "$verbose" ] && info "Skip empty install list" [ -n "$verbose" ] && info "Skip empty install list"
# FIXME: see to_remove below
return 22 return 22
fi fi
...@@ -579,10 +581,12 @@ epm_install() ...@@ -579,10 +581,12 @@ epm_install()
update_repo_if_needed update_repo_if_needed
fi fi
# FIXME: see to_remove below
epm_install_names $names || return epm_install_names $names || return
# repack binary files # repack binary files
if [ -n "$repack" ] ; then if [ -n "$repack" ] ; then
# FIXME: see to_remove below
__epm_repack_rpm $files || fatal __epm_repack_rpm $files || fatal
files="$repacked_rpms" files="$repacked_rpms"
fi fi
......
...@@ -30,7 +30,7 @@ case $PMTYPE in ...@@ -30,7 +30,7 @@ case $PMTYPE in
;; ;;
apt-dpkg) apt-dpkg)
warmup_dpkgbase warmup_dpkgbase
docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1 docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}:\${Architecture}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
;; ;;
*) *)
fatal "Sorted package list function is not implemented for $PMTYPE" fatal "Sorted package list function is not implemented for $PMTYPE"
...@@ -68,7 +68,8 @@ case $PMTYPE in ...@@ -68,7 +68,8 @@ case $PMTYPE in
warmup_dpkgbase warmup_dpkgbase
# FIXME: strong equal # FIXME: strong equal
#CMD="dpkg -l $pkg_filenames" #CMD="dpkg -l $pkg_filenames"
CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}\n $pkg_filenames" CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}:\${Architecture}\n $pkg_filenames"
# TODO: ${Architecture}
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}\n $pkg_filenames" [ -n "$short" ] && CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}\n $pkg_filenames"
showcmd $CMD showcmd $CMD
$CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn $CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn
......
...@@ -54,8 +54,9 @@ exp_with_arch_suffix() ...@@ -54,8 +54,9 @@ exp_with_arch_suffix()
# TODO: use estrlist or some function to do it # TODO: use estrlist or some function to do it
local pkg local pkg
for pkg in $(cat) ; do for pkg in $(cat) ; do
local p
# check only packages without arch # check only packages without arch
local p="$(__print_with_arch_suffix "$pkg" .i686)" || { echo "$pkg" ; continue ; } p="$(__print_with_arch_suffix "$pkg" .i686)" || { echo "$pkg" ; continue ; }
# add arch suffix only if arch package already installed (otherwise we don't know package arch) # add arch suffix only if arch package already installed (otherwise we don't know package arch)
is_installed "$p" || { echo "$pkg" ; continue ; } is_installed "$p" || { echo "$pkg" ; continue ; }
echo "$pkg.x86_64" echo "$pkg.x86_64"
......
...@@ -165,7 +165,8 @@ __update_to_the_distro() ...@@ -165,7 +165,8 @@ __update_to_the_distro()
Sisyphus) Sisyphus)
docmd epm update || fatal docmd epm update || fatal
docmd epm install librpm7 librpm rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run again" docmd epm install librpm7 librpm rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run again"
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again" #docmd apt-get upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
docmd epm upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
;; ;;
*) *)
esac esac
...@@ -277,7 +278,7 @@ epm_release_upgrade() ...@@ -277,7 +278,7 @@ epm_release_upgrade()
;; ;;
*-dpkg) *-dpkg)
assure_exists do-release-upgrade update-manager-core assure_exists do-release-upgrade update-manager-core
sudocmd do-release-upgrade -d sudocmd do-release-upgrade
;; ;;
yum-rpm) yum-rpm)
docmd epm install rpm yum docmd epm install rpm yum
...@@ -289,6 +290,7 @@ epm_release_upgrade() ...@@ -289,6 +290,7 @@ epm_release_upgrade()
dnf-rpm) dnf-rpm)
info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info" info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
docmd epm install dnf docmd epm install dnf
sudocmd dnf --refresh upgrade
sudocmd dnf clean all sudocmd dnf clean all
assure_exists dnf-plugin-system-upgrade assure_exists dnf-plugin-system-upgrade
sudocmd dnf upgrade --refresh sudocmd dnf upgrade --refresh
......
...@@ -63,7 +63,12 @@ case $DISTRNAME in ...@@ -63,7 +63,12 @@ case $DISTRNAME in
esac; esac;
case $PMTYPE in case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg)
assure_exists apt-add-repository software-properties-common
apt-add-repository --remove "$repo"
info "Check file /etc/apt/sources.list if needed"
;;
aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list" info "You need remove repo from /etc/apt/sources.list"
;; ;;
yum-rpm) yum-rpm)
......
...@@ -20,65 +20,97 @@ ...@@ -20,65 +20,97 @@
load_helper epm-sh-altlinux load_helper epm-sh-altlinux
load_helper epm-assure load_helper epm-assure
# arg: rpm or deb
# TODO: rewrite to convert (get some code from Korinf?) # fills split_replaced_pkgs with packages of that type
__epm_check_if_try_install_deb() __epm_split_by_pkg_type()
{ {
local pkg local type="$1"
local debpkgs="" shift
for pkg in $@ ; do
[ "$(get_package_type "$pkg")" = "deb" ] || return 1 split_replaced_pkgs=''
for pkg in "$@" ; do
[ "$(get_package_type "$pkg")" = "$type" ] || return 1
[ -e "$pkg" ] || fatal "Can't read $pkg" [ -e "$pkg" ] || fatal "Can't read $pkg"
debpkgs="$debpkgs $(realpath $pkg)" split_replaced_pkgs="$split_target_pkgs $(realpath "$pkg")"
done done
[ -n "$debpkgs" ] || return 1
[ -n "$split_replaced_pkgs" ]
}
# fills repacked_rpms
__epm_repack_deb_to_rpm()
{
local pkg
assure_exists alien assure_exists alien
assure_exists dpkg assure_exists dpkg
# TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен # TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен
# assure_exists debconf # assure_exists debconf
repacked_rpms=''
local TDIR=$(mktemp -d) local TDIR=$(mktemp -d)
cd $TDIR || fatal cd $TDIR || fatal
for pkg in $debpkgs ; do for pkg in "$@" ; do
# TODO: fakeroot for non ALT? # TODO: fakeroot for non ALT?
showcmd_store_output alien -r -k $scripts "$pkg" || fatal showcmd_store_output alien -r -k $scripts "$pkg" || fatal
local RPMCONVERTED=$(grep "rpm generated" $RC_STDOUT | sed -e "s| generated||g") local RPMCONVERTED=$(grep "rpm generated" $RC_STDOUT | sed -e "s| generated||g")
repacked_rpms="$repacked_rpms $(realpath $RPMCONVERTED)"
to_remove_pkg_files="$to_remove_pkg_files $(realpath $RPMCONVERTED)"
clean_store_output clean_store_output
docmd epm install $force $nodeps $RPMCONVERTED
done done
rm -f $TDIR/*
rmdir $TDIR/
cd - >/dev/null
return 0 return 0
} }
# TODO: rewrite to convert (get some code from Korinf?) __epm_check_if_try_install_deb()
__epm_check_if_try_install_rpm() {
__epm_split_by_pkg_type deb "$@" || return 1
__epm_repack_deb_to_rpm "$@"
# TODO: move to install
docmd epm install $force $nodeps $repacked_rpms
return 0
}
# fills repacked_debs
__epm_repack_rpm_to_deb()
{ {
local pkg local pkg
local rpmpkgs=""
for pkg in $@ ; do
[ "$(get_package_type "$pkg")" = "rpm" ] || return 1
[ -e "$pkg" ] || fatal "Can't read $pkg"
rpmpkgs="$rpmpkgs $(realpath $pkg)"
done
[ -n "$rpmpkgs" ] || return 1
assure_exists alien assure_exists alien
assure_exists fakeroot assure_exists fakeroot
assure_exists rpm assure_exists rpm
repacked_debs=''
local TDIR=$(mktemp -d) local TDIR=$(mktemp -d)
cd $TDIR || fatal cd $TDIR || fatal
for pkg in $rpmpkgs ; do for pkg in $rpmpkgs ; do
showcmd_store_output fakeroot alien -d -k $scripts "$pkg" showcmd_store_output fakeroot alien -d -k $scripts "$pkg"
local DEBCONVERTED=$(grep "deb generated" $RC_STDOUT | sed -e "s| generated||g") local DEBCONVERTED=$(grep "deb generated" $RC_STDOUT | sed -e "s| generated||g")
repacked_debs="$repacked_rpms $(realpath $DEBCONVERTED)"
to_remove_pkg_files="$to_remove_pkg_files $(realpath $DEBCONVERTED)"
clean_store_output clean_store_output
docmd epm install $force $nodeps $DEBCONVERTED
done done
rm -f $TDIR/*
rmdir $TDIR/ cd - >/dev/null
return 0
}
# TODO: rewrite to convert (get some code from Korinf?)
__epm_check_if_try_install_rpm()
{
__epm_split_by_pkg_type rpm "$@" || return 1
__epm_repack_rpm_to_deb "$@"
# TODO: move to install
docmd epm install $force $nodeps $repacked_debs
return 0 return 0
} }
...@@ -110,6 +142,17 @@ __apply_fix_code() ...@@ -110,6 +142,17 @@ __apply_fix_code()
docmd $repackcode "$1" "$2" || warning "There was errors with $repackcode script" docmd $repackcode "$1" "$2" || warning "There was errors with $repackcode script"
} }
__create_rpmmacros()
{
cat <<EOF >$HOME/.rpmmacros
%_topdir $HOME/RPM
%_tmppath $TMPDIR
%packager EPM <support@etersoft.ru>
%_gpg_name support@etersoft.ru
EOF
}
# will fill repacked_rpms var # will fill repacked_rpms var
__epm_repack_rpm() __epm_repack_rpm()
{ {
...@@ -120,8 +163,10 @@ __epm_repack_rpm() ...@@ -120,8 +163,10 @@ __epm_repack_rpm()
assure_exists rpmbuild rpm-build || fatal assure_exists rpmbuild rpm-build || fatal
local pkg local pkg
local tmpbuilddir=$(mktemp -d)/repack export HOME=$(mktemp -d)
local tmpbuilddir=$HOME/repack
mkdir $tmpbuilddir mkdir $tmpbuilddir
__create_rpmmacros
local abspkg local abspkg
repacked_rpms='' repacked_rpms=''
...@@ -144,9 +189,9 @@ __epm_repack_rpm() ...@@ -144,9 +189,9 @@ __epm_repack_rpm()
__apply_fix_code $pkgname $tmpbuilddir/$subdir $spec __apply_fix_code $pkgname $tmpbuilddir/$subdir $spec
showcmd fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec showcmd fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec
if [ -n "$verbose" ] ; then if [ -n "$verbose" ] ; then
a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec || fatal a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec || fatal
else else
a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec >/dev/null || fatal a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec >/dev/null || fatal
fi fi
local repacked_rpm="$(realpath $tmpbuilddir/../*.rpm)" local repacked_rpm="$(realpath $tmpbuilddir/../*.rpm)"
if [ -s "$repacked_rpm" ] ; then if [ -s "$repacked_rpm" ] ; then
...@@ -175,8 +220,32 @@ epm_repack() ...@@ -175,8 +220,32 @@ epm_repack()
[ -z "$pkg_files" ] && info "Skip empty repack list" && return 22 [ -z "$pkg_files" ] && info "Skip empty repack list" && return 22
__epm_repack_rpm $pkg_files || fatal # TODO: если у нас rpm, а пакет - deb и наоборот
cp -v $repacked_rpms . case $PKGFORMAT in
rpm)
if __epm_split_by_pkg_type deb $pkg_files ; then
__epm_repack_deb_to_rpm $split_replaced_pkgs
cp -v $repacked_rpms .
pkg_files="$(estrlist exclude $split_replaced_pkgs $pkg_files)"
fi
if [ -n "$pkg_files" ] ; then
__epm_repack_rpm $pkg_files || fatal
cp -v $repacked_rpms .
fi
;;
deb)
if __epm_split_by_pkg_type rpm $pkg_files ; then
__epm_repack_rpm_to_deb $split_replaced_pkgs
cp -v $repacked_debs .
pkg_files="$(estrlist exclude $split_replaced_pkgs $pkg_files)"
fi
;;
*)
fatal "$PKGFORMAT is not supported for repack yet"
;;
esac
# TODO: move it to exit handler # TODO: move it to exit handler
if [ -z "$DEBUG" ] ; then if [ -z "$DEBUG" ] ; then
......
...@@ -39,7 +39,7 @@ case $PMTYPE in ...@@ -39,7 +39,7 @@ case $PMTYPE in
docmd ds-conf docmd ds-conf
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
showcmd cat /etc/apt/sources.list* showcmd cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list
print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list
;; ;;
yum-rpm) yum-rpm)
......
...@@ -382,6 +382,20 @@ eget() ...@@ -382,6 +382,20 @@ eget()
$EGET "$@" $EGET "$@"
} }
estrlist()
{
if [ -s $SHAREDIR/tools_estrlist ] ; then
$SHAREDIR/tools_estrlist "$@"
return
fi
fatal "missed tools_estrlist"
}
onefile_estrlist()
{
internal_tools_estrlist "$@"
}
# will replaced within eget() in packed version # will replaced within eget() in packed version
onefile_eget() onefile_eget()
{ {
......
...@@ -64,6 +64,16 @@ if [ -z "$1" ] ; then ...@@ -64,6 +64,16 @@ if [ -z "$1" ] ; then
fatal "Run with URL, like http://somesite.ru/dir/*.log" fatal "Run with URL, like http://somesite.ru/dir/*.log"
fi fi
if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
echo "eget - wget wrapper, with support"
echo "Usage: eget [-O target file] [--list] http://somesite.ru/dir/na*.log"
echo "Options:"
echo " --list - print files frm url with mask"
echo
wget --help
exit
fi
# do not support / # do not support /
if echo "$1" | grep -q "/$" ; then if echo "$1" | grep -q "/$" ; then
fatal "Use http://example.com/e/* to download all files in dir" fatal "Use http://example.com/e/* to download all files in dir"
......
#!/bin/bash
# 2009-2010, 2012, 2017 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# TODO: rewrite with shell commands, perl or C
# Python - http://www.linuxtopia.org/online_books/programming_books/python_programming/python_ch16s03.html
# Shell - http://linux.byexamples.com/archives/127/uniq-and-basic-set-theory/
# - http://maiaco.com/articles/shellSetOperations.php
# Perl - http://docstore.mik.ua/orelly/perl/cookbook/ch04_09.htm
# - http://blogs.perl.org/users/polettix/2012/03/sets-operations.html
# http://rosettacode.org/wiki/Symmetric_difference
# TODO: add unit tests
# http://ru.wikipedia.org/wiki/Операции_над_множествами
# Base set operations:
# * union
# "1 2 3" "3 4 5" -> "1 2 3 4 5"
# * intersection
# "1 2 3" "3 4 5" -> "3"
# * relative complement (substracted, difference) ( A ? B – members in A but not in B )
# http://en.wikipedia.org/wiki/Complement_%28set_theory%29
# "1 3" "1 2 3 4" -> "2 4"
# * symmetric difference (симметричная разность) ( A ^ B – members in A or B but not both )
# http://en.wikipedia.org/wiki/Symmetric_difference
# "1 2 3" "3 4 5" -> "1 2 4 5"
filter_strip_spaces()
{
# possible use just
#xargs echo
sed -e "s| \+| |g" -e "s|^ ||" -e "s| \$||"
}
strip_spaces()
{
echo "$*" | filter_strip_spaces
}
isempty()
{
[ "$(strip_spaces "$*")" = "" ]
}
list()
{
local i
for i in $@ ; do
echo "$i"
done
}
count()
{
list $@ | wc -l
}
union()
{
strip_spaces $(list $@ | sort -u)
}
uniq()
{
union $@
}
has()
{
local wd="$1"
shift
echo "$*" | grep -q -- "$wd"
}
# Note: used egrep! write '[0-9]+(first|two)', not '[0-9]\+...'
match()
{
local wd="$1"
shift
echo "$*" | egrep -q -- "$wd"
}
# remove_from_list "1." "11 12 21 22" -> "21 22"
reg_remove()
{
local i
local RES=
for i in $2 ; do
echo "$i" | grep -q "$1" || RES="$RES $i"
done
strip_spaces "$RES"
}
# remove_from_list "1." "11 12 21 22" -> "21 22"
reg_wordremove()
{
local i
local RES=
for i in $2 ; do
echo "$i" | grep -q -w "$1" || RES="$RES $i"
done
strip_spaces "$RES"
}
# Args: LIST1 LIST2
# do_exclude_list print LIST2 list exclude fields contains also in LIST1
# Example: exclude "1 3" "1 2 3 4" -> "2 4"
exclude()
{
local i
local RES=
for i in $2 ; do
echo "$1" | grep -q -w "$i" || RES="$RES $i"
done
strip_spaces "$RES"
}
# regexclude_list "22 1." "11 12 21 22" -> "21"
reg_exclude()
{
local i
local RES="$2"
for i in $1 ; do
RES=$(reg_remove "$i" "$RES")
done
strip_spaces "$RES"
}
# regexclude_list "22 1." "11 12 21 22" -> "21"
reg_wordexclude()
{
local i
local RES="$2"
for i in $1 ; do
RES=$(reg_wordremove "$i" "$RES")
done
strip_spaces "$RES"
}
# FIXME:
# reg_include "1." "11 12 21 22" -> "11 12"
reg_include()
{
local i
local RES=
for i in $2 ; do
echo "$i" | grep -q -w "$1" && RES="$RES $i"
done
strip_spaces "$RES"
}
example()
{
local CMD="$1"
local ARG1="$2"
shift 2
echo "\$ $0 $CMD \"$ARG1\" \"$@\""
$0 $CMD "$ARG1" "$@"
}
example_res()
{
example "$@" && echo TRUE || echo FALSE
}
help()
{
echo "estrlist developed for string list operations. See also cut, join, paste..."
echo "Usage: $0 <command> [args]"
echo "Commands:"
echo " strip_spaces [args] - remove spaces between words"
echo " filter_strip_spaces - remove spaces from words from standart input"
echo " reg_remove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep notation)"
echo " reg_wordremove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep -w notation)"
echo " exclude <list1> <list2> - print list2 words exclude list1 items"
echo " reg_exclude <PATTERN> [word list] - print only words do not matched with PATTERN"
echo " reg_wordexclude <PATTERN> [word list] - print only words do not matched with PATTERN"
echo " has <PATTERN> string - check the string for a match to the regular expression given in PATTERN (grep notation)"
echo " match <PATTERN> string - check the string for a match to the regular expression given in PATTERN (egrep notation)"
echo " isempty [string] - true if string has no any symbols (only zero or more spaces)"
echo " union [word list] - sort and remove duplicates"
echo " uniq [word list] - alias for union"
echo " list [word list] - just list words line by line"
echo " count [word list] - print word count"
echo
echo "Examples:"
example reg_remove "1." "11 12 21 22"
example reg_wordremove "1." "11 12 21 22"
example exclude "1 3" "1 2 3 4"
example reg_exclude "22 1." "11 12 21 22"
example reg_wordexclude "wo.* er" "work were more else"
example union "1 2 2 3 3"
example count "1 2 3 4 10"
example_res isempty " "
#example_res isempty " 1 "
example_res has ex "exactly"
example_res has exo "exactly"
example_res match "M[0-9]+" "M250"
example_res match "M[0-9]+" "MI"
}
COMMAND="$1"
if [ -z "$COMMAND" ] ; then
echo "Run with --help for get command description."
exit 1
fi
if [ "$COMMAND" = "-h" ] || [ "$COMMAND" = "--help" ] ; then
COMMAND="help"
fi
shift
# FIXME: do to call function directly, use case instead?
if [ "$1" = "-" ] ; then
shift
"$COMMAND" "$(cat) $@"
elif [ "$2" = "-" ] ; then
"$COMMAND" "$1" "$(cat)"
else
"$COMMAND" "$@"
fi
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils. # This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 2.4.5 Version: 2.4.9
Release: alt0.M80P.1 Release: alt0.M80P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -90,9 +90,28 @@ rm -f %buildroot%_datadir/%name/tools_eget ...@@ -90,9 +90,28 @@ rm -f %buildroot%_datadir/%name/tools_eget
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Sun Feb 04 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.5-alt0.M80P.1 * Mon Jun 18 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.9-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script) - backport to ALTLinux p8 (by rpmbph script)
* Mon Jun 18 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.9-alt1
- repack: run independently to user's .rpmmacros
* Thu Jun 07 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.8-alt1
- autoorphans: assure for package-cleanup for yum/dnf
- apt-dpkg: implement addrepo/removerepo
- addrepo: add ALT branch support
- distr_info: support ALT starter kits
- epm-packages: add arch on deb
* Mon Mar 19 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.7-alt1
- checkpkg: detect rpm --nosignature/--nogpg
- epm-query: fix check only names without arch
* Mon Feb 26 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.6-alt1
- distr_info: cleanup code, fix quotes
- checkpkg: check only md5 (skip gpg)
- implement repack for rpm to deb and deb to rpm conversion
* Sun Feb 04 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.5-alt1 * Sun Feb 04 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.5-alt1
- implement assure_distr and use it - implement assure_distr and use it
- add repack command and move all repack code to a separate module - add repack command and move all repack code to a separate module
......
...@@ -48,6 +48,8 @@ filter_out() ...@@ -48,6 +48,8 @@ filter_out()
grep -v "^[ ]*load_helper " | \ grep -v "^[ ]*load_helper " | \
sed -e 's|^eget()|disabled_eget()|g' | \ sed -e 's|^eget()|disabled_eget()|g' | \
sed -e 's|^onefile_eget()|eget()|g' | \ sed -e 's|^onefile_eget()|eget()|g' | \
sed -e 's|^estrlist()|disabled_estrlist()|g' | \
sed -e 's|^onefile_estrlist()|estrlist()|g' | \
sed -e 's|$SHAREDIR/tools_json|internal_tools_json|g' | \ sed -e 's|$SHAREDIR/tools_json|internal_tools_json|g' | \
sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \ sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e "s|@VERSION@|$(get_version)|g" sed -e "s|@VERSION@|$(get_version)|g"
...@@ -70,6 +72,7 @@ done | filter_out >>$OUTPUT ...@@ -70,6 +72,7 @@ done | filter_out >>$OUTPUT
incorporate_subfile bin/distr_info incorporate_subfile bin/distr_info
#incorporate_subfile /usr/bin/eget #incorporate_subfile /usr/bin/eget
incorporate_subfile bin/tools_eget incorporate_subfile bin/tools_eget
incorporate_subfile bin/tools_estrlist
incorporate_subfile bin/tools_json incorporate_subfile bin/tools_json
awk 'BEGIN{desk=0}{if(desk>0) {print} ; if(/^load_helper epm-sh-functions/){desk++}}' <bin/$PACKCOMMAND | filter_out >>$OUTPUT awk 'BEGIN{desk=0}{if(desk>0) {print} ; if(/^load_helper epm-sh-functions/){desk++}}' <bin/$PACKCOMMAND | filter_out >>$OUTPUT
......
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