Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
etersoft-build-utils
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
korinf
etersoft-build-utils
Commits
052ae8e2
Commit
052ae8e2
authored
May 22, 2012
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
major rewrite get_pkgname_from_filename
parent
193b521b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
1 deletion
+36
-1
rpm
share/eterbuild/functions/rpm
+33
-1
get_packagename.sh
tests/get_packagename.sh
+3
-0
No files found.
share/eterbuild/functions/rpm
View file @
052ae8e2
...
...
@@ -97,6 +97,7 @@ build_rpms_name_by_srpm()
fi
}
# FIXME: hack
spec_by_srpm
()
{
local
PKG
=
$1
...
...
@@ -105,13 +106,44 @@ spec_by_srpm()
[
-n
"
$PKGNAME
"
]
&&
echo
$PKGNAME
.spec
}
# FIXME: this is hack and needs to be removed from code!
# pkg-source-1.0.src.rpm -> pkg-source
# pkg-source_1.0.src.rpm -> pkg-source
# pkg-source[-_]1.0.src.rpm -> pkg-source
# pkg-source*.src.rpm -> pkg-source
# incorrect for
# pkg-source-1.0-2.0*.src.rpm -> pkg-source-1.0
# pkg-source-1.0_2.0*.src.rpm -> pkg-source-1.0
get_pkgname_from_filename
()
{
local
FN
=
$(
basename
$1
|
sed
-e
"s|[
\[\*
].*||g"
)
local
FN
=
$(
basename
$1
)
#local SR=$(echo ${FN/[\\*]*/})
local
SR
=
$(
echo
$FN
|
sed
-e
"s|[
\[\*
].*||g"
)
if
[
"
$SR
"
!=
"
$FN
"
]
;
then
echo
$SR
return
fi
# for RPM file
#if echo $FN | grep -q "rpm$" && [ -e "$FN" ] ; then
# querypackage $FN NAME
# return
#fi
# for DEB
if
echo
$FN
|
grep
-q
"deb$"
;
then
echo
${
FN
/_[0-9]*/
}
return
fi
# libpq5.2-9.0eter-9.0.4-alt14.i586.rpm
local
SR
=
$(
echo
$FN
|
sed
-e
"s|
\(
.*
\)
-[0-9][0-9a-zA-Z
\.
]*-[a-z]*[0-9][0-9
\.
a-zA-Z]*
\.
[a-z0-9_]*.*
$|
\1
|g"
)
if
[
"
$SR
"
!=
"
$FN
"
]
;
then
echo
$SR
return
fi
echo
${
FN
/[-_][0-9]*/
}
}
...
...
tests/get_packagename.sh
View file @
052ae8e2
...
...
@@ -19,3 +19,5 @@ check_pkg pkg-source-less-1.0.spec pkg-source-less
check_pkg pkg123-1.0.spec pkg123
check_pkg pkg123[_-]1.0.spec pkg123
check_pkg pkg
*
.spec pkg
check_pkg libpq5.2-9.0eter-9.0.4-alt14.i586.rpm libpq5.2-9.0eter
check_pkg postgre-etersoft9.0_9.0.4-eter14ubuntu_i386.deb postgre-etersoft9.0
\ No newline at end of file
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