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
Vladislav
eepm
Commits
04b49e26
Commit
04b49e26
authored
Aug 15, 2015
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add epm url|site command (with -p arg for open at packages.altlinux.org)
parent
e9f956c2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
139 additions
and
1 deletion
+139
-1
epm
bin/epm
+4
-1
epm-site
bin/epm-site
+135
-0
No files found.
bin/epm
View file @
04b49e26
...
...
@@ -246,7 +246,7 @@ check_command()
downgrade
)
# HELPCMD: downgrade [all] packages to the repo state
epm_cmd
=
downgrade
;;
download
)
# HELPCMD: download package(s) file to the current dir
download
)
# HELPCMD: download package(s) file to the current dir
epm_cmd
=
download
;;
simulate
)
# HELPCMD: simulate install with check requires
...
...
@@ -255,6 +255,9 @@ check_command()
audit
)
# HELPCMD: audits installed packages against known vulnerabilities
epm_cmd
=
audit
;;
site|url
)
# HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
epm_cmd
=
site
;;
-V
|
checkpkg|integrity
)
# HELPCMD: check package file integrity (checksum)
epm_cmd
=
checkpkg
;;
...
...
bin/epm-site
0 → 100644
View file @
04b49e26
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 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/>.
#
load_helper epm-query
run_command_if_exists
()
{
local
CMD
=
"
$1
"
shift
if
which
"
$CMD
"
2>/dev/null
>
/dev/null
;
then
docmd
"
$CMD
"
"
$@
"
return
0
fi
return
1
}
open_browser
()
{
local
i
for
i
in
xdg-open firefox chromium links
;
do
run_command_if_exists
$i
"
$@
"
&&
return
done
}
# FIXME: Copied from etersoft-build-utils
# Query variables from rpm package
querypackage
()
{
local
FORMAT
=
"%{
$2
}"
local
INSTALLED
=
"-p"
# if name empty, use third param as format string
[
-n
"
$2
"
]
||
FORMAT
=
"
$3
"
# if not file, drop -p for get from rpm base
[
-e
"
$1
"
]
||
INSTALLED
=
""
rpmquery
$INSTALLED
--queryformat
"
$FORMAT
"
$1
}
# FIXME: Copied from etersoft-build-utils
# return source package name by binary rpm package file
get_sourcepkg_name
()
{
local
FILE
=
"
$1
"
local
PKGVERSION
=
$(
querypackage
"
$FILE
"
VERSION
)
querypackage
"
$FILE
"
sourcerpm |
sed
-e
"s|-
$PKGVERSION
.*||g"
}
query_package_url
()
{
local
URL
case
$PMTYPE
in
*
-rpm
)
querypackage
"
$1
"
URL
#LANG=C epm info "$1"
return
;;
esac
fatal
"rpm based distro supported only. TODO: Realize via web service?"
}
get_locale
()
{
local
loc
loc
=
$(
a
=
natspec
--locale
2>/dev/null
)
[
-n
"
$loc
"
]
||
loc
=
$LANG
echo
$loc
}
get_pao_url
()
{
local
loc
loc
=
$(
get_locale |
cut
-c1-2
)
case
$loc
in
en|ru|uk|br
)
loc
=
$loc
;;
*
)
loc
=
en
esac
echo
"http://packages.altlinux.org/
$loc
/Sisyphus/srpms"
}
query_altlinux_url
()
{
local
URL
case
$PMTYPE
in
*
-rpm
)
local
srpm
=
$(
get_sourcepkg_name
"
$1
"
)
[
-n
"
$srpm
"
]
||
fatal
"Can't get source name for
$1
"
echo
"
$(
get_pao_url
)
/
$srpm
"
return
;;
esac
fatal
"rpm based distro supported only. TODO: Realize via web service?"
}
epm_site
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Info: missing package(s) name"
PAO
=
for
f
in
$pkg_names
$pkg_files
;
do
[
"
$f
"
=
"-p"
]
&&
PAO
=
"
$f
"
&&
continue
if
[
-n
"
$PAO
"
]
;
then
pkg_url
=
$(
query_altlinux_url
$f
)
else
pkg_url
=
$(
query_package_url
$f
)
fi
[
-n
"
$pkg_url
"
]
&&
open_browser
"
$pkg_url
"
&&
continue
warning
"Can't get URL for
$f
package"
done
#for f in $pkg_names ; do
# LANG=C epm info $f
#done
# TODO: -p for p.a.o (see rpmurl)
}
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