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
8713159a
Commit
8713159a
authored
Nov 09, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
epm-restore: improvement
parent
2071a97f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
122 additions
and
6 deletions
+122
-6
epm-restore
bin/epm-restore
+5
-6
test_sections.sh
tests/test_sections.sh
+117
-0
No files found.
bin/epm-restore
View file @
8713159a
...
...
@@ -26,8 +26,7 @@ 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|bs4|BeautifulSoup4|"
\
-e
"s|bs4|beautifulsoup4|"
\
-e
"s|pillow|Pillow|"
\
-e
"s|sqlalchemy|SQLAlchemy|"
\
-e
"s|flask-SQLAlchemy|flask_sqlalchemy|"
\
...
...
@@ -84,7 +83,7 @@ __epm_lineprint_python_array()
local
a
=
"
$*
"
[
-n
"
$a
"
]
||
return
local
name
=
"
$(
__epm_get_array_name
"
$a
"
)
"
(
echo
"
$a
"
|
sed
-
e
's|\].*|]|
'
;
echo
"print('
\n
'.join(
$name
))"
)
|
(
a
=
python -
||
a
=
python3
)
(
echo
"
$a
"
|
sed
-
E
-e
's@(\]|\)).*@\1@
'
;
echo
"print('
\n
'.join(
$name
))"
)
|
(
a
=
python -
||
a
=
python3
)
}
# translate pip requirement lines to rpm notation
...
...
@@ -94,7 +93,7 @@ __epm_restore_convert_to_rpm_notation()
local
equal
=
"
$1
"
local
l
while
read
l
;
do
if
echo
"
$l
"
|
grep
-q
"; *python_version *< *
'3.0'
"
;
then
if
echo
"
$l
"
|
grep
-q
"; *python_version *< *
['
\"
]3
"
;
then
[
-n
"
$verbose
"
]
&&
warning
"
$t
is python2 only requirement, skipped"
continue
fi
...
...
@@ -147,7 +146,7 @@ __epm_restore_pip()
__eresection
()
{
rhas
"
$1
"
"[[:space:]]*
$2
[[:space:]]*=[[:space:]]*
\[
"
rhas
"
$1
"
"[[:space:]]*
$2
[[:space:]]*=[[:space:]]*
[
\[
(]
"
}
__epm_restore_setup_py
()
...
...
@@ -188,7 +187,7 @@ $l"
fi
# not end of section
if
[
-z
"
$section
"
]
||
!
rhas
"
$l
"
"
\]
,*"
;
then
if
[
-z
"
$section
"
]
||
!
rhas
"
$l
"
"
(
\]
|
\)
)
,*"
;
then
continue
fi
...
...
tests/test_sections.sh
0 → 100755
View file @
8713159a
#!/bin/sh
load_helper
()
{
.
../bin/
$1
}
PMTYPE
=
apt-rpm
.
../bin/epm-sh-altlinux
.
../bin/epm-sh-functions
.
../bin/epm-restore
ok
()
{
__eresection
"
$1
"
"
$2
"
&&
echo
"
$1
OK"
||
echo
"
$1
failed"
}
notok
()
{
__eresection
"
$1
"
"
$2
"
&&
echo
"
$1
failed"
||
echo
"
$1
OK"
}
ok
"install=["
"install"
ok
"install=[''"
"install"
ok
"install=['']"
"install"
ok
"install=("
"install"
ok
"install=(fd"
"install"
ok
"install=(fd)"
"install"
notok
"install=fd"
"install"
echo
echo
"rhas:"
ok
()
{
# something is wrong
rhas
"
$1
"
"[
\]
)],*"
&&
echo
"
$1
OK"
||
echo
"
$1
failed"
# rhas "$1" "(\]|\)),*" && echo "$1 OK" || echo "$1 failed"
}
ok
"),"
ok
")"
ok
"]"
ok
"],"
ok
()
{
# something is wrong
# rhas "$1" "[\])],*" && echo "$1 OK" || echo "$1 failed"
rhas
"
$1
"
"(
\]
|
\)
),*"
&&
echo
"
$1
OK"
||
echo
"
$1
failed"
}
ok
"),"
ok
")"
ok
"]"
ok
"],"
ok
()
{
rhas
"
$1
"
"[
\[
(],*"
&&
echo
"
$1
OK"
||
echo
"
$1
failed"
}
ok
"=("
ok
"("
ok
"=["
ok
"[,"
echo
echo
"==="
f1
()
{
sed
-E
-e
's@(\]|\)).*@OK@'
}
echo
"),"
| f1
echo
"]"
| f1
f1
()
{
sed
-e
's|[\])].*|OK|'
}
echo
"),"
| f1
echo
"]"
| f1
echo
echo
"==="
f1
()
{
sed
-e
's|[\[(].*|OK|'
}
echo
"(,"
| f1
echo
"["
| f1
f1
()
{
sed
-e
's@\(\[|(\).*@OK@'
}
echo
"(,"
| f1
echo
"["
| f1
f1
()
{
sed
-E
-e
's@(\[|\().*@OK@'
}
echo
"(,"
| f1
echo
"["
| f1
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