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
ab380387
Commit
ab380387
authored
Jul 09, 2009
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move build package specifil functions to build module
parent
f1510d45
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
181 additions
and
170 deletions
+181
-170
build
share/eterbuild/functions/build
+179
-0
rpm
share/eterbuild/functions/rpm
+2
-170
No files found.
share/eterbuild/functions/build
0 → 100644
View file @
ab380387
#!/bin/bash
# 2008 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# Universal rpmbuild function
# 1st: rpmbuild, hsh, buildreq
# 2nd: spec name(s) (only one if git, we will skip it)
# other parameters
uni_rpmbuild
()
{
local
RET
=
0
# hack due quotes
# just for fill by something
local
ONEPARAM
=
"--quiet"
local
TWOPARAM
=
"--quiet"
local
THRPARAM
=
"--quiet"
local
COMMIT
=
""
if
[
"
$1
"
=
"--commit"
]
;
then
shift
COMMIT
=
"--commit"
fi
local
SPECNAME
=
$1
local
SPECDIR
=
`
dirname
$SPECNAME
`
local
GEAR
=
gear
if
[
-n
"
$USE_LEGACY_COMPRESSION
"
]
;
then
# FIXME: do not override -v
ONEPARAM
=
"--define=_source_payload w9.gzdio"
fi
if
[
-n
"
$USE_VENDOR
"
]
;
then
THRPARAM
=
"--define=_vendor
$USE_VENDOR
"
fi
if
[
-n
"
$RPMTOPDIR
"
]
;
then
TWOPARAM
=
"--define=_topdir
$RPMTOPDIR
"
fi
if
is_gear
$SPECDIR
;
then
[
-f
"
$SPECNAME
"
]
||
fatal
"run uni_rpmbuild with spec as 2nd parameter"
shift
# skip spec name
#[ -n "$SPECDIR" ] && [ "$SPECDIR" != "." ] && warning "Spec is not in git dir (SPECDIR='$SPECDIR')"
# build package without MENV checking
if
true
||
[
"
$MENV
"
=
"SS"
]
;
then
$NICE
$GEAR
$COMMIT
--rpmbuild
--
$RPMBUILD
"
$ONEPARAM
"
"
$TWOPARAM
"
"
$THRPARAM
"
$@
||
RET
=
$?
else
fatal
"Build backported src.rpm from git is unsupported now"
# build src.rpm via hasher (on ALT)
# $NICE gear-hsh --build-args="-bs" --rpmbuild -- $COMMAND "$ONEPARAM" $@
$NICE
$GEAR
--hasher
--
myhsh
--build-prog
=
$ETERBUILDDIR
/functions/rebuild
$@
||
RET
=
$?
fi
else
mkdir
-p
$RPMTOPDIR
/BUILD
$RPMTOPDIR
/SRPMS
$NICE
$RPMBUILD
"
$ONEPARAM
"
"
$TWOPARAM
"
"
$THRPARAM
"
$@
||
RET
=
$?
fi
[
-n
"
$VERBOSE
"
]
&&
echo
"Run
$RPMBUILD
$ONEPARAM
$TWOPARAM
$THRPARAM
$@
"
||
:
return
$RET
}
uni_buildreq
()
{
local
RET
=
0
local
SPECNAME
=
$1
local
SPECDIR
=
`
dirname
$SPECNAME
`
local
GEARBUILDREQ
=
gear-buildreq
if
is_gear
$SPECDIR
;
then
$NICE
$GEARBUILDREQ
--commit
--
$@
||
RET
=
$?
else
$NICE
buildreq
$@
||
RET
=
$?
fi
return
$RET
}
uni_rpminstall
()
{
local
RET
=
0
local
TWOPARAM
=
"-v"
if
[
-n
"
$RPMTOPDIR
"
]
;
then
TWOPARAM
=
"--define=_topdir
$RPMTOPDIR
"
fi
#if is_gear $SPECDIR ; then
# $NICE $GEARBUILDREQ --commit -- $@ || RET=$?
#else
echo
-n
"Install package "
mkdir
-p
$RPMTOPDIR
/SOURCES
$RPMTOPDIR
/SRPMS
$RPMTOPDIR
/RPMS
rpm
-iv
"
$TWOPARAM
"
$@
||
RET
=
$?
#fi
return
$RET
}
# LISTNAMES, options in arg
# build LISTBUILT list with src.rpm full path
pack_src_rpm
()
{
local
i
ARGS
=
$@
# NOTE: always nodeps
# enable --nodeps for other ENV
#test -n "$MENV" &&
[
-n
"
$VERBOSE
"
]
&&
echo
"LISTNAMES=
$LISTNAMES
ARGS=
$ARGS
"
||
:
ARGS
=
"
$ARGS
--nodeps"
for
i
in
$LISTNAMES
do
if
[
-z
${
i
/*rpm/
}
]
;
then
# if rpm not spec, guess it is src.rpm
#NAMESRPMIN=$(basename $i)
if
[
-f
"
$i
"
]
;
then
LISTBUILT
=
"
$LISTBUILT
$i
"
else
fatal
"pack_src_rpm: Can't find '
$i
'"
fi
else
#
# BASENAME, RELEASE, VERSION, NAMESRPMIN, NAMERPMIN
build_rpms_name
"
$i
"
$ARGS
if
[
-n
"
${
SIGN
}
"
]
;
then
echog
"Try to packing
\$
NAMESRPMIN package for sign"
add_changelog
$i
if
[
$?
=
"0"
]
;
then
echog
"Spec file
\$
i had not ChangeLog entry. It have added now, check it and enter your command again."
echog
"Wait for ten seconds."
sleep
10
exit
1
fi
uni_rpmbuild
$i
-bs
$ARGS
$NODEPS
--target
$DEFAULTARCH
else
echog
"Just packing
\$
NAMESRPMIN"
uni_rpmbuild
$i
-bs
$ARGS
$NODEPS
--target
$DEFAULTARCH
||
fatal
"Error with rpmbuild"
fi
# Check the package really built
if
[
-f
"
$RPMTOPDIR
/SRPMS/
$NAMESRPMIN
"
]
;
then
LISTBUILT
=
"
$LISTBUILT
$RPMTOPDIR
/SRPMS/
$NAMESRPMIN
"
else
fatal
"Can't find '
$NAMESRPMIN
' in '
$RPMTOPDIR
/SRPMS'"
fi
fi
done
# remove extra space before list
LISTBUILT
=
$(
echo
"
$LISTBUILT
"
|
sed
-e
"s|^ ||"
)
test
-z
"
$LISTBUILT
"
&&
fatal
"Error: List for build is empty. Check if file is exist."
#LISTRPMARGS=`echo ${LISTRPMARGS} | sed -e "s/--nodeps//g"`
}
check_log
()
{
local
LOGFILE i RES
echo
echo
"-------------------------------------------------------"
echog
"Check log for..."
LOGFILE
=
$1
grep
'ld: warning: libstdc++\.so\.5, needed by [^ ]\+, may conflict with libstdc++\.so\.6'
$LOGFILE
RES
=
$?
if
[
$RES
=
0
]
;
then
echog
"Error: libstdc++.so.5/6 conflicts"
return
1
fi
grep
'python-strict'
$LOGFILE
&&
warning
"python-strict used!!!"
NC1
=
"command not found"
NC2
=
"-march=athlon -mtune=athlon-xp"
#for i in ${NC1} ; do
grep
--
'$NC1'
$LOGFILE
&&
warning
"'
$NC1
' in build output (some errors in a scripts)"
grep
--
'$NC2'
$LOGFILE
&&
warning
"'
$NC2
' in build output (forbidden) "
#done
return
0
}
share/eterbuild/functions/rpm
View file @
ab380387
...
...
@@ -3,98 +3,9 @@
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
# FIXME: use build directly in build scripts
load_mod build
# Universal rpmbuild function
# 1st: rpmbuild, hsh, buildreq
# 2nd: spec name(s) (only one if git, we will skip it)
# other parameters
uni_rpmbuild
()
{
local
RET
=
0
# hack due quotes
# just for fill by something
local
ONEPARAM
=
"--quiet"
local
TWOPARAM
=
"--quiet"
local
THRPARAM
=
"--quiet"
local
COMMIT
=
""
if
[
"
$1
"
=
"--commit"
]
;
then
shift
COMMIT
=
"--commit"
fi
local
SPECNAME
=
$1
local
SPECDIR
=
`
dirname
$SPECNAME
`
local
GEAR
=
gear
if
[
-n
"
$USE_LEGACY_COMPRESSION
"
]
;
then
# FIXME: do not override -v
ONEPARAM
=
"--define=_source_payload w9.gzdio"
fi
if
[
-n
"
$USE_VENDOR
"
]
;
then
THRPARAM
=
"--define=_vendor
$USE_VENDOR
"
fi
if
[
-n
"
$RPMTOPDIR
"
]
;
then
TWOPARAM
=
"--define=_topdir
$RPMTOPDIR
"
fi
if
is_gear
$SPECDIR
;
then
[
-f
"
$SPECNAME
"
]
||
fatal
"run uni_rpmbuild with spec as 2nd parameter"
shift
# skip spec name
#[ -n "$SPECDIR" ] && [ "$SPECDIR" != "." ] && warning "Spec is not in git dir (SPECDIR='$SPECDIR')"
# build package without MENV checking
if
true
||
[
"
$MENV
"
=
"SS"
]
;
then
$NICE
$GEAR
$COMMIT
--rpmbuild
--
$RPMBUILD
"
$ONEPARAM
"
"
$TWOPARAM
"
"
$THRPARAM
"
$@
||
RET
=
$?
else
fatal
"Build backported src.rpm from git is unsupported now"
# build src.rpm via hasher (on ALT)
# $NICE gear-hsh --build-args="-bs" --rpmbuild -- $COMMAND "$ONEPARAM" $@
$NICE
$GEAR
--hasher
--
myhsh
--build-prog
=
$ETERBUILDDIR
/functions/rebuild
$@
||
RET
=
$?
fi
else
mkdir
-p
$RPMTOPDIR
/BUILD
$RPMTOPDIR
/SRPMS
$NICE
$RPMBUILD
"
$ONEPARAM
"
"
$TWOPARAM
"
"
$THRPARAM
"
$@
||
RET
=
$?
fi
[
-n
"
$VERBOSE
"
]
&&
echo
"Run
$RPMBUILD
$ONEPARAM
$TWOPARAM
$THRPARAM
$@
"
||
:
return
$RET
}
uni_buildreq
()
{
local
RET
=
0
local
SPECNAME
=
$1
local
SPECDIR
=
`
dirname
$SPECNAME
`
local
GEARBUILDREQ
=
gear-buildreq
if
is_gear
$SPECDIR
;
then
$NICE
$GEARBUILDREQ
--commit
--
$@
||
RET
=
$?
else
$NICE
buildreq
$@
||
RET
=
$?
fi
return
$RET
}
uni_rpminstall
()
{
local
RET
=
0
local
TWOPARAM
=
"-v"
if
[
-n
"
$RPMTOPDIR
"
]
;
then
TWOPARAM
=
"--define=_topdir
$RPMTOPDIR
"
fi
#if is_gear $SPECDIR ; then
# $NICE $GEARBUILDREQ --commit -- $@ || RET=$?
#else
echo
-n
"Install package "
mkdir
-p
$RPMTOPDIR
/SOURCES
$RPMTOPDIR
/SRPMS
$RPMTOPDIR
/RPMS
rpm
-iv
"
$TWOPARAM
"
$@
||
RET
=
$?
#fi
return
$RET
}
# get correct BUILDROOT, run build_rpms_name before!
build_buildroot
()
...
...
@@ -152,62 +63,6 @@ build_rpms_name()
build_buildroot
}
# LISTNAMES, options in arg
# build LISTBUILT list with src.rpm full path
pack_src_rpm
()
{
local
i
ARGS
=
$@
# NOTE: always nodeps
# enable --nodeps for other ENV
#test -n "$MENV" &&
[
-n
"
$VERBOSE
"
]
&&
echo
"LISTNAMES=
$LISTNAMES
ARGS=
$ARGS
"
||
:
ARGS
=
"
$ARGS
--nodeps"
for
i
in
$LISTNAMES
do
if
[
-z
${
i
/*rpm/
}
]
;
then
# if rpm not spec, guess it is src.rpm
#NAMESRPMIN=$(basename $i)
if
[
-f
"
$i
"
]
;
then
LISTBUILT
=
"
$LISTBUILT
$i
"
else
fatal
"pack_src_rpm: Can't find '
$i
'"
fi
else
#
# BASENAME, RELEASE, VERSION, NAMESRPMIN, NAMERPMIN
build_rpms_name
"
$i
"
$ARGS
if
[
-n
"
${
SIGN
}
"
]
;
then
echog
"Try to packing
\$
NAMESRPMIN package for sign"
add_changelog
$i
if
[
$?
=
"0"
]
;
then
echog
"Spec file
\$
i had not ChangeLog entry. It have added now, check it and enter your command again."
echog
"Wait for ten seconds."
sleep
10
exit
1
fi
uni_rpmbuild
$i
-bs
$ARGS
$NODEPS
--target
$DEFAULTARCH
else
echog
"Just packing
\$
NAMESRPMIN"
uni_rpmbuild
$i
-bs
$ARGS
$NODEPS
--target
$DEFAULTARCH
||
fatal
"Error with rpmbuild"
fi
# Check the package really built
if
[
-f
"
$RPMTOPDIR
/SRPMS/
$NAMESRPMIN
"
]
;
then
LISTBUILT
=
"
$LISTBUILT
$RPMTOPDIR
/SRPMS/
$NAMESRPMIN
"
else
fatal
"Can't find '
$NAMESRPMIN
' in '
$RPMTOPDIR
/SRPMS'"
fi
fi
done
# remove extra space before list
LISTBUILT
=
$(
echo
"
$LISTBUILT
"
|
sed
-e
"s|^ ||"
)
test
-z
"
$LISTBUILT
"
&&
fatal
"Error: List for build is empty. Check if file is exist."
#LISTRPMARGS=`echo ${LISTRPMARGS} | sed -e "s/--nodeps//g"`
}
# build binary package list (1st - repo dir, 2st - pkgname)
# algorithm: list all files in PKGDIR, print packages with our source pkg name
...
...
@@ -227,26 +82,3 @@ drop_pkg_extensions()
done
}
check_log
()
{
local
LOGFILE i RES
echo
echo
"-------------------------------------------------------"
echog
"Check log for..."
LOGFILE
=
$1
grep
'ld: warning: libstdc++\.so\.5, needed by [^ ]\+, may conflict with libstdc++\.so\.6'
$LOGFILE
RES
=
$?
if
[
$RES
=
0
]
;
then
echog
"Error: libstdc++.so.5/6 conflicts"
return
1
fi
grep
'python-strict'
$LOGFILE
&&
warning
"python-strict used!!!"
NC1
=
"command not found"
NC2
=
"-march=athlon -mtune=athlon-xp"
#for i in ${NC1} ; do
grep
--
'$NC1'
$LOGFILE
&&
warning
"'
$NC1
' in build output (some errors in a scripts)"
grep
--
'$NC2'
$LOGFILE
&&
warning
"'
$NC2
' in build output (forbidden) "
#done
return
0
}
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