Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nurlan
eepm
Commits
7aa30211
Commit
7aa30211
authored
5 years ago
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move dedup code to the separate command
parent
2d3de381
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
32 deletions
+66
-32
epm
bin/epm
+4
-1
epm-check
bin/epm-check
+1
-31
epm-dedup
bin/epm-dedup
+61
-0
No files found.
bin/epm
View file @
7aa30211
...
...
@@ -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-201
8
"
echo
"Copyright (c) Etersoft 2012-201
9
"
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
;;
...
...
This diff is collapsed.
Click to expand it.
bin/epm-check
View file @
7aa30211
...
...
@@ -17,36 +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
--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_check
()
{
case
$PMTYPE
in
...
...
@@ -54,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
...
...
This diff is collapsed.
Click to expand it.
bin/epm-dedup
0 → 100644
View file @
7aa30211
#!/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
)
try_fix_apt_rpm_dupls
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
esac
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment