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
06080dd8
Commit
06080dd8
authored
Oct 24, 2020
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement correct has_space() with tests
parent
a8fe0722
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
9 deletions
+35
-9
epm
bin/epm
+4
-9
epm-sh-functions
bin/epm-sh-functions
+5
-0
test_smallfuncs.sh
tests/test_smallfuncs.sh
+26
-0
No files found.
bin/epm
View file @
06080dd8
...
...
@@ -416,27 +416,22 @@ check_option()
return
0
}
has_space
()
{
[
-n
"
$2
"
]
}
check_filenames
()
{
local
opt
for
opt
in
"
$@
"
;
do
# files can be with full path or have extension via .
if
[
-f
"
$opt
"
]
&&
echo
"
$opt
"
|
grep
-q
"[/
\.
]"
;
then
has_space
$opt
&&
warning
"There are space(s) in filename '
$opt
', it is not supported. Skipped"
&&
continue
has_space
"
$opt
"
&&
warning
"There are space(s) in filename '
$opt
', it is not supported. Skipped"
&&
continue
pkg_files
=
"
$pkg_files
$opt
"
elif
[
-d
"
$opt
"
]
;
then
has_space
$opt
&&
warning
"There are space(s) in directory path '
$opt
', it is not supported. Skipped"
&&
continue
has_space
"
$opt
"
&&
warning
"There are space(s) in directory path '
$opt
', it is not supported. Skipped"
&&
continue
pkg_dirs
=
"
$pkg_dirs
$opt
"
elif
echo
"
$opt
"
|
grep
-q
"^[fhtps]*://"
;
then
has_space
$opt
&&
warning
"There are space(s) in URL '
$opt
', it is not supported. Skipped"
&&
continue
has_space
"
$opt
"
&&
warning
"There are space(s) in URL '
$opt
', it is not supported. Skipped"
&&
continue
pkg_urls
=
"
$pkg_urls
$opt
"
else
has_space
$opt
&&
warning
"There are space(s) in package name '
$opt
', it is not supported. Skipped"
&&
continue
has_space
"
$opt
"
&&
warning
"There are space(s) in package name '
$opt
', it is not supported. Skipped"
&&
continue
pkg_names
=
"
$pkg_names
$opt
"
fi
quoted_args
=
"
$quoted_args
\"
$opt
\"
"
...
...
bin/epm-sh-functions
View file @
06080dd8
...
...
@@ -626,3 +626,8 @@ get_pkg_name_delimiter()
[
"
$pkgtype
"
=
"deb"
]
&&
echo
"_"
&&
return
echo
"-"
}
has_space
()
{
[
"
$1
"
!=
"
${
1
/ //
}
"
]
}
tests/test_smallfuncs.sh
0 → 100755
View file @
06080dd8
#!/bin/sh
has_space
()
{
[
"
$1
"
!=
"
${
1
/ //
}
"
]
}
notok
()
{
echo
"notok test for '
$*
'"
has_space
"
$@
"
&&
echo
"FAILED: space(s) detected"
}
ok
()
{
echo
"ok test for '
$*
'"
has_space
"
$@
"
||
echo
"FAILED: space(s) not detected"
}
notok
"list"
ok
"l i s t"
ok
" l i s t "
ok
" l "
ok
" "
ok
" "
notok
""
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