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
2600428f
Commit
2600428f
authored
Feb 06, 2013
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpmbph: move remove_bashism to the spec module, fix it and add test
parent
61a0b678
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
67 additions
and
19 deletions
+67
-19
rpmbph
bin/rpmbph
+1
-19
spec
share/eterbuild/functions/spec
+23
-0
test_remove_bashism.sh
tests/test_remove_bashism.sh
+43
-0
No files found.
bin/rpmbph
View file @
2600428f
...
...
@@ -12,25 +12,7 @@
# load common functions, compatible with local and installed script
.
`
dirname
$0
`
/../share/eterbuild/functions/common
load_mod repl rpm git buildsrpm
# for rpm + (d)ash
remove_bashism
()
{
local
SPECNAME
=
$1
subst
"s|^pushd
\(
.*
\)
|cd
\1
>/dev/null|g"
$SPECNAME
subst
"s|^popd|cd - >/dev/null|g"
$SPECNAME
# {1,2} translation
# FIXME: miss first spaces
while
read
-r
n
;
do
echo
"
$n
"
|
grep
-v
"{.*}"
&&
continue
eval echo
"
$n
"
done
<
$SPECNAME
>
$SPECNAME
.tmp
[
-e
"
$SPECNAME
.tmp"
]
&&
mv
-f
$SPECNAME
.tmp
$SPECNAME
checkbashisms
$SPECNAME
}
load_mod repl rpm git buildsrpm spec
altspec_to_local
()
...
...
share/eterbuild/functions/spec
View file @
2600428f
...
...
@@ -233,3 +233,26 @@ separate_changelog()
cat
$SPEC
|
awk
'BEGIN{desk=0}{if (desk==1) {print}; if(/^%changelog/&&desk==0){desk++}}'
>
"
$3
"
}
# for rpm + (d)ash
remove_bashism
()
{
local
SPECNAME
=
"
$1
"
test
-w
"
$SPECNAME
"
||
fatal
"File '
$SPECNAME
' is missed or read only"
separate_changelog
$SPECNAME
$SPECNAME
.main
$SPECNAME
.changelog
subst
"s|^pushd
\(
.*
\)
|cd
\1
>/dev/null|g"
$SPECNAME
.main
subst
"s|^popd|cd - >/dev/null|g"
$SPECNAME
.main
# {1,2} translation
# FIXME: miss first spaces
while
read
-r
n
;
do
echo
"
$n
"
|
grep
-v
"{.*}"
&&
continue
eval echo
"
$n
"
done
<
$SPECNAME
.main
>
$SPECNAME
.tmp
[
-s
"
$SPECNAME
.tmp"
]
&&
mv
-f
$SPECNAME
.tmp
$SPECNAME
checkbashisms
$SPECNAME
cat
$SPECNAME
.changelog
>>
$SPECNAME
rm
-f
$SPECNAME
.main
$SPECNAME
.changelog
}
tests/test_remove_bashism.sh
0 → 100755
View file @
2600428f
#!/bin/bash
.
`
dirname
$0
`
/../share/eterbuild/functions/common
load_mod spec
SPEC
=
get_ver.spec
gen_spec
()
{
cat
<<
EOF
>
$SPEC
Name: get_version_test
Release: alt1
Version:
$TESTVER
Source:
$SOURCEPATH
%name-%version.tar.bz2
Summary: Test
Group: Other
License: Public License
%define major 1.0
%define ver 10
%define maj 1.0
%build
pushd txt
echo {1,2}text
popd
%description
Get version test
%changelog
* Date
- Hello
* dsdkljd
* Date
EOF
}
TESTVER
=
0
SOURCEPATH
=
ftp://etersoft.ru/pub/Etersoft/TEST/
gen_spec
remove_bashism
$SPEC
mv
$SPEC
$SPEC
.new
gen_spec
diff
-u
$SPEC
$SPEC
.new
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