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
c760a3b0
Commit
c760a3b0
authored
Jan 27, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add restore command (install packages by project list (python's requirements.txt)
parent
22829662
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
108 additions
and
1 deletion
+108
-1
TODO
TODO
+2
-0
epm
bin/epm
+4
-1
epm-restore
bin/epm-restore
+102
-0
No files found.
TODO
View file @
c760a3b0
apt-mark (для работы autoremove)
repack: проверять, если нет входного файла; писать полный путь к выходному файлу
apt-mark hold unhold showhold auto manual showauto showmanual
...
...
bin/epm
View file @
c760a3b0
...
...
@@ -270,6 +270,9 @@ check_command()
clean
)
# HELPCMD: clean local package cache
epm_cmd
=
clean
;;
restore
)
# HELPCMD: install (restore) packages need for the project (f.i. by requirements.txt)
epm_cmd
=
restore
;;
autoremove|package-cleanup
)
# HELPCMD: auto remove unneeded package(s) Supports args for ALT: [libs|python|perl|libs-devel]
epm_cmd
=
autoremove
;;
...
...
@@ -353,7 +356,7 @@ check_option()
--noremove
|
--no-remove
)
# HELPOPT: exit if any packages are to be removed during upgrade
noremove
=
"--no-remove"
;;
--no-stdin
|
--inscript
)
# HELPOPT: don't read from stdin for epm args
--no-stdin
|
--inscript
)
# HELPOPT: don't read from stdin for epm args
inscript
=
1
;;
--dry-run
|
--simulate
|
--just-print
|
-recon--no-act
)
# HELPOPT: print only (autoremove/autoorphans/remove only)
...
...
bin/epm-restore
0 → 100644
View file @
c760a3b0
#!/bin/sh
#
# Copyright (C) 2020 Etersoft
# Copyright (C) 2020 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-sh-altlinux
load_helper epm-assure
__epm_filter_pip_to_rpm
()
{
tr
"A-Z"
"a-z"
|
sed
-e
"s|-|_|g"
-e
"s|^python_||"
\
-e
"s|beautifulsoup4|bs4|"
\
-e
"s|pillow|PIL|"
\
-e
"s|pyjwt|jwt|"
\
-e
"s|pyyaml|yaml|"
\
-e
"s|memcached|memcache|"
\
-e
"s|pyopenssl|OpenSSL|"
}
__epm_restore_pip
()
{
local
req_file
=
"
$1
"
info
"Install requirements from
$req_file
..."
local
ilist
=
''
while
read
l
;
do
local
t
=
"
$(
echo
"
$l
"
|
sed
-e
"s| *[<>]*=.*||"
| __epm_filter_pip_to_rpm
)
"
if
echo
"
$l
"
|
grep
-qE
"^ *#"
;
then
continue
fi
if
echo
"
$l
"
|
grep
-qE
"://"
;
then
if
echo
"
$l
"
|
grep
-q
"#egg="
;
then
t
=
"
$(
echo
"
$l
"
|
sed
-e
"s|.*#egg=||"
-e
"s|
\[
.*||"
| __epm_filter_pip_to_rpm
)
"
else
echo
" skipping URL
$l
..."
continue
fi
fi
if
echo
"
$l
"
|
grep
-q
"; *python_version *< *'3.0'"
;
then
echo
"
$t
is python2 only requirement, skipped"
continue
fi
local
pi
=
"python3(
$t
)"
echo
"
$l
->
$t
->
$pi
"
[
-n
"
$t
"
]
||
continue
ilist
=
"
$ilist
$pi
"
done
<
$req_file
epm
install
$ilist
}
__epm_restore_by
()
{
local
req_file
=
"
$1
"
[
-s
"
$req_file
"
]
||
return
case
$(
basename
$req_file
)
in
requirements.txt
)
[
-s
"
$req_file
"
]
&&
__epm_restore_pip
"
$req_file
"
;;
Gemfile|package.json
)
info
"
$req_file
support is not implemented yet"
;;
esac
}
epm_restore
()
{
req_file
=
"
$pkg_filenames
"
if
[
-n
"
$pkg_urls
"
]
&&
echo
"
$pkg_urls
"
|
grep
-qE
"^https?://"
;
then
req_file
=
"
$(
basename
"
$pkg_urls
"
)
"
#assure eget
[
-r
"
$req_file
"
]
&&
fatal
"File
$req_file
is already exists in
$(
pwd
)
"
info
"Downloading '
$req_file
' from '
$pkg_urls
' ..."
eget
"
$pkg_urls
"
[
-s
"
$req_file
"
]
||
fatal
"Can't download
$req_file
from '
$pkg_urls
'"
fi
if
[
-n
"
$req_file
"
]
;
then
__epm_restore_by
$req_file
return
fi
# if run with empty args
for
i
in
requirements.txt Gemfile
;
do
__epm_restore_by
$i
done
}
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