LOGFILE=
KILL=
CHANGELOG=
+BUILD_DEBUG=
export PATH=$BUILD_DIR:$PATH
--icecream N
use N parallel build jobs with icecream
+ --debug
+ enable creation of a debuginfo package
+
Remember to have fun!
[*] Maximum RPM: http://www.rpm.org/max-rpm/
--ccache)
ccache=1
;;
+ --debug)
+ BUILD_DEBUG=1
+ ;;
----noarg)
echo "$ARG does not take an argument"
cleanup_and_exit
substitutedeps $RELEASE --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$BUILD_DIR/configs" $CHANGELOGARGS "$BUILD_ROOT$TOPDIR/SOURCES/$SPECFILE" "$BUILD_ROOT/.spec.new" || cleanup_and_exit 1
# extract macros from configuration
getmacros --dist "$BUILD_DIST" --archpath "$BUILD_ARCH" --configdir "$BUILD_DIR/configs" > $BUILD_ROOT/root/.rpmmacros
+ if test -n "$BUILD_DEBUG" ; then
+ echo '
+%prep %?_suse_insert_debug_package%%prep
+%package %?_suse_insert_debug_package%%package
+%suse_insert_debug_package \
+ %global _suse_insert_debug_package \\\
+ %%undefine _suse_insert_debug_package \\\
+ %%debug_package
+
+' >> $BUILD_ROOT/root/.rpmmacros
+ fi
test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/.rpmmacros $BUILD_ROOT/home/abuild/.rpmmacros
# extract optflags from configuration
- getoptflags --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath "$BUILD_ARCH" > $BUILD_ROOT/root/.rpmrc
+ getoptflags --dist "$BUILD_DIST" --configdir "$BUILD_DIR/configs" --archpath "$BUILD_ARCH" ${BUILD_DEBUG:+--debug} > $BUILD_ROOT/root/.rpmrc
test $BUILD_USER = abuild && cp -p $BUILD_ROOT/root/.rpmrc $BUILD_ROOT/home/abuild/.rpmrc
fi
if test -f $BUILD_ROOT/.spec.new ; then
rpmbopts[${#rpmbopts[@]}]='--eval'
rpmbopts[${#rpmbopts[@]}]="%define jobs $BUILD_JOBS"
fi
+ if [ -n "$BUILD_DEBUG" ]; then
+ rpmbopts[${#rpmbopts[@]}]='--eval'
+ rpmbopts[${#rpmbopts[@]}]="%suse_insert_debug_package"
+ fi
rpmbuild=rpmbuild
test -x $BUILD_ROOT/usr/lib/rpm/rpmi || rpmbuild=rpm
use Build;
-my ($dist, $archs, $configdir);
+my ($dist, $archs, $configdir, $debug);
while (@ARGV) {
if ($ARGV[0] eq '--dist') {
$configdir = shift @ARGV;
next;
}
+ if ($ARGV[0] eq '--debug') {
+ shift @ARGV;
+ $debug = 1;
+ next;
+ }
last;
}
exit 0 unless $cf->{'optflags'};
my $all = $cf->{'optflags'}->{'*'};
$all = defined($all) && $all ne '' ? " $all" : '';
+$all .= " -g" if $debug;
for (sort keys %{$cf->{'optflags'}}) {
next if $_ eq '*';
print "optflags: $_ $cf->{'optflags'}->{$_}$all\n";
next;
}
- $l =~ s/^(Release:\s*).*/$1$release/i if $release;
+ if ($release) {
+ if ($l =~ /^Release:/i) {
+ if (!($l =~ s/<RELEASE>/$release/g)) {
+ $l =~ s/^(Release:\s*).*/$1$release/i;
+ }
+ }
+ }
if (!$used || ($l !~ /^(?:Build)?Requires:/i)) {
print F "$l\n";