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
27ad1b7d
Commit
27ad1b7d
authored
Aug 23, 2016
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rewrite query and packages
parent
e0f6e354
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
22 deletions
+45
-22
epm-packages
bin/epm-packages
+36
-18
epm-query
bin/epm-query
+9
-4
No files found.
bin/epm-packages
View file @
27ad1b7d
...
...
@@ -41,6 +41,11 @@ __aptcyg_print_full()
echo
"
$1
-
$VERSION
"
}
__fo_pfn
()
{
grep
-v
"^$"
|
grep
--
"
$pkg_filenames
"
}
# TODO: we have a problem with error status here
epm_packages
()
{
...
...
@@ -49,23 +54,28 @@ epm_packages()
case
$PMTYPE
in
apt-rpm
)
# FIXME: strong equal
CMD
=
"rpm -qa
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qa --queryformat %{name}
\n
$pkg_filenames
"
;;
docmd
$CMD
return
;;
*
-dpkg
)
# FIXME: strong equal
#CMD="dpkg -l $pkg_filenames"
CMD
=
"dpkg-query -W --showformat=
\$
{db:Status-Abbrev}
\$
{Package}-
\$
{Version}
\n
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{db:Status-Abbrev}
\$
{Package}
\n
$pkg_filenames
"
docmd
$CMD
|
grep
"^i"
|
sed
-e
"s|.* ||g"
retur
n
;;
showcmd
$CMD
$CMD
|
grep
"^i"
|
sed
-e
"s|.* ||g"
| __fo_pf
n
return
;;
snappy
)
CMD
=
"snappy info"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm
)
# FIXME: strong equal
CMD
=
"rpm -qa
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qa --queryformat %{name}
\n
$pkg_filenames
"
;;
docmd
$CMD
return
;;
emerge
)
CMD
=
"qlist -I -C"
# print with colors for console output
...
...
@@ -73,26 +83,27 @@ case $PMTYPE in
;;
pkgsrc
)
CMD
=
"pkg_info"
docmd
$CMD
|
sed
-e
"s| .*||g"
retur
n
;;
showcmd
$CMD
$CMD
|
sed
-e
"s| .*||g"
| __fo_pf
n
return
;;
pkgng
)
if
[
-n
"
$pkg_filenames
"
]
;
then
CMD
=
"pkg info -E
$pkg_filenames
"
else
CMD
=
"pkg info"
fi
showcmd
$CMD
if
[
-n
"
$short
"
]
;
then
docmd
$CMD
|
sed
-e
"s| .*||g"
|
sed
-e
"s|-[0-9].*||g"
$CMD
|
sed
-e
"s| .*||g"
|
sed
-e
"s|-[0-9].*||g"
| __fo_pfn
else
docmd
$CMD
|
sed
-e
"s| .*||g"
$CMD
|
sed
-e
"s| .*||g"
| __fo_pfn
fi
return
;;
return
;;
pacman
)
CMD
=
"pacman -Qs
$pkg_filenames
"
showcmd
$CMD
if
[
-n
"
$short
"
]
;
then
docmd
$CMD
|
sed
-e
"s| .*||g"
-e
"s|.*/||g"
|
grep
-v
"^$"
$CMD
|
sed
-e
"s| .*||g"
-e
"s|.*/||g"
| __fo_pfn
return
fi
;;
...
...
@@ -112,7 +123,7 @@ case $PMTYPE in
# FIXME: does not work for libjpeg-v8a
# TODO: remove last 3 elements (if arch is second from the last?)
# FIXME this hack
docmd
ls
-1
/var/log/packages/ |
sed
-e
"s|-[0-9].*||g"
|
sed
-e
"s|libjpeg-v8a.*|libjpeg|g"
docmd
ls
-1
/var/log/packages/ |
sed
-e
"s|-[0-9].*||g"
|
sed
-e
"s|libjpeg-v8a.*|libjpeg|g"
| __fo_pfn
return
fi
;;
...
...
@@ -133,10 +144,18 @@ case $PMTYPE in
;;
xbps
)
CMD
=
"xbps-query -l"
showcmd
$CMD
if
[
-n
"
$short
"
]
;
then
$CMD
|
sed
-e
"s|^ii ||g"
-e
"s| .*||g"
-e
"s|
\(
.*
\)
-.*|
\1
|g"
| __fo_pfn
else
$CMD
|
sed
-e
"s|^ii ||g"
-e
"s| .*||g"
| __fo_pfn
fi
return
0
;;
android
)
CMD
=
"pm list packages"
docmd
$CMD
|
sed
-e
"s|^package:||g"
showcmd
$CMD
$CMD
|
sed
-e
"s|^package:||g"
| __fo_pfn
return
;;
aptcyg
)
...
...
@@ -155,8 +174,7 @@ case $PMTYPE in
;;
esac
docmd
$CMD
# FIXME: do not print empty lines, but we will lost error status definitely
# | grep -v "^$"
docmd
$CMD
| __fopfn
# FIXME: we print empty lines, but will lost error status
}
bin/epm-query
View file @
27ad1b7d
...
...
@@ -33,16 +33,18 @@ _get_grep_exp()
# TODO: combine with -qa (the difference only in return status now)
_shortquery_via_packages_list
()
{
local
res
=
0
local
res
=
1
local
grepexp
local
firstpkg
=
$1
shift
grepexp
=
$(
_get_grep_exp
$firstpkg
)
# TODO: we miss status due grep
# Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
--
"
$grepexp
"
||
res
=
1
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
--
"
$grepexp
"
&&
res
=
0
||
res
=
1
local
pkg
for
pkg
in
"
$@
"
;
do
...
...
@@ -57,16 +59,19 @@ _shortquery_via_packages_list()
# TODO: non optimal double epm packages call
_query_via_packages_list
()
{
local
res
=
0
local
res
=
1
local
grepexp
local
firstpkg
=
$1
shift
grepexp
=
$(
_get_grep_exp
$firstpkg
)
# TODO: we miss status due grep
# TODO: grep correctly
# Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
-q
--
"
$grepexp
"
&&
quiet
=
1
pkg_filenames
=
$firstpkg
epm_packages
||
res
=
1
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
-q
--
"
$grepexp
"
&&
quiet
=
1
pkg_filenames
=
$firstpkg
epm_packages
&&
res
=
0
||
res
=
1
local
pkg
for
pkg
in
"
$@
"
;
do
...
...
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