Commit 6a9b8686 authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmgs code refactoring

parent 4b72ea04
...@@ -232,102 +232,103 @@ if [ -n "${DELETENOW}" ]; then ...@@ -232,102 +232,103 @@ if [ -n "${DELETENOW}" ]; then
exit 0 exit 0
fi fi
test -z "$ETERDESTSRPM" && ETERDESTSRPM=$UPLOADDIR${MENVARG/-/.}
# if just packing
if [ -z "$SIGN" ]; then
rpmbs_copying_built
exit $?
fi
# Sign src.rpm and upload it # Sign src.rpm and upload it
if [ -n "$SIGN" ]; then release_check $LISTBUILT
release_check $LISTBUILT
if [ -r "$LISTBUILT" ] ; then if [ -r "$LISTBUILT" ] ; then
check_gear_and_tag check_gear_and_tag
fi fi
echog "Will try to sign follow packages with GPG: \$LISTBUILT" echog "Will try to sign follow packages with GPG: \$LISTBUILT"
# 1. only rpm command has --addsign 2. do 3 retries # 1. only rpm command has --addsign 2. do 3 retries
rpm --addsign $LISTBUILT || rpm --addsign $LISTBUILT || rpm --addsign $LISTBUILT rpm --addsign $LISTBUILT || rpm --addsign $LISTBUILT || rpm --addsign $LISTBUILT
RET=$? RET=$?
if [ ! "$RET" = "0" ] ; then
############################################ echog "Impossible to sign package. Check your password and try again."
echog "Changing permissions..." echog "Wait for ten seconds."
chmod 644 -- $LISTBUILT || fatal "can't chmod" sleep 10
echog -n "Checking with sisyphus_check..." exit 1
test -n "$NOCHECK" || sisyphus_check --files $LISTBUILT || fatal "sisyphus check failed" fi
echog "OK"
# rpm's find-req do not find rpmlint :)
RPMLINT=rpmlint
if which $RPMLINT >/dev/null ; then
echog -n "Checking with rpmlint..."
echo
$RPMLINT $LISTBUILT
else
echog "It is recommended to install rpmlint package for additional checking"
fi
test -n "$CHECKONLY" && exit 0
############################################
if [ "$RET" = "0" ]
then
if [ -n "${UPLOADNOW}" ] ; then
echog "Uploading to $GIRARHOST"
check_key
# TODO: rsync foo.src.rpm git.alt: && ssh git.alt build srpm foo.src.rpm
# git.alt build -b 4.0 srpm foo.src.rpm
rsync -vay --partial --progress $CHECKSUM \
-e ssh $LISTBUILT $GIRARHOST: && \
echo "---------------------" && \
echog "All files synced" || fatal "Error during rsync"
TASKLIST=""
for i in $LISTBUILT ; do
TASKLIST="$TASKLIST srpm $(basename $i)"
done
if [ -n "$TASKNUMBER" ] ; then
echo "Add $TASKLIST to task $TASKNUMBER"
[ -n "$VERBOSE" ] && echo "...with command ssh $GIRARHOST task add $TASKNUMBER $TASKLIST"
ssh $GIRARHOST task add $TASKNUMBER $TASKLIST
else
echo "Create task for $TASKLIST"
[ -n "$VERBOSE" ] && echo "...with command ssh $GIRARHOST build -b $BINARYREPO $TASKLIST"
ssh $GIRARHOST build -b $BINARYREPO $TASKLIST
fi
for i in $LISTBUILT ; do ############################################
LOGFILE="$LOGDIR/`basename $i .src.rpm`$MENVARG.log" echog "Changing permissions..."
echo >>$LOGFILE chmod 644 -- $LISTBUILT || fatal "can't chmod"
date >>$LOGFILE echog -n "Checking with sisyphus_check..."
echo "uploaded">>$LOGFILE test -n "$NOCHECK" || sisyphus_check --files $LISTBUILT || fatal "sisyphus check failed"
echo "$(basename $i) run build src.rpm at $GIRARHOST ($MENV) at `date "+%c"`" >>$RPMDIR/uploaded.log echog "OK"
done # rpm's find-req do not find rpmlint :)
RPMLINT=rpmlint
if which $RPMLINT >/dev/null ; then
echog -n "Checking with rpmlint..."
echo
$RPMLINT $LISTBUILT
else
echog "It is recommended to install rpmlint package for additional checking"
fi
else test -n "$CHECKONLY" && exit 0
test -z "$ETERDESTSRPM" && ETERDESTSRPM=$UPLOADDIR${MENVARG/-/.} ############################################
rpmbs_copying_built
fi
echog "Removing buildroot after upload..." # If upload signed package is not needed
for i in $LISTNAMES ; do if [ -z "${UPLOADNOW}" ] ; then
if [ -z ${i/*.src.rpm/} ] ; then rpmbs_copying_built
echo " skipping for $i" exit $?
continue fi
fi
#DDIR=$BUILDROOT/${i/.spec/-buildroot}
# Hack about paths
test -f "$i" && NAME=$i || NAME=$CURDIR/$i
build_rpms_name $NAME
echo -n " $BUILDROOT "
if [ -d "$BUILDROOT" ] ; then
rm -rf "$BUILDROOT" && echog "DONE" || echog "failed"
else
echog "missed"
fi
done
echog "Uploading to $GIRARHOST"
check_key
# TODO: rsync foo.src.rpm git.alt: && ssh git.alt build srpm foo.src.rpm
# git.alt build -b 4.0 srpm foo.src.rpm
rsync -vay --partial --progress $CHECKSUM \
-e ssh $LISTBUILT $GIRARHOST: && \
echo "---------------------" && \
echog "All files synced" || fatal "Error during rsync"
TASKLIST=""
for i in $LISTBUILT ; do
TASKLIST="$TASKLIST srpm $(basename $i)"
done
if [ -n "$TASKNUMBER" ] ; then
echo "Add $TASKLIST to task $TASKNUMBER"
[ -n "$VERBOSE" ] && echo "...with command ssh $GIRARHOST task add $TASKNUMBER $TASKLIST"
ssh $GIRARHOST task add $TASKNUMBER $TASKLIST
else
echo "Create task for $TASKLIST"
[ -n "$VERBOSE" ] && echo "...with command ssh $GIRARHOST build -b $BINARYREPO $TASKLIST"
ssh $GIRARHOST build -b $BINARYREPO $TASKLIST
fi
for i in $LISTBUILT ; do
LOGFILE="$LOGDIR/`basename $i .src.rpm`$MENVARG.log"
echo >>$LOGFILE
date >>$LOGFILE
echo "uploaded">>$LOGFILE
echo "$(basename $i) run build src.rpm at $GIRARHOST ($MENV) at `date "+%c"`" >>$RPMDIR/uploaded.log
done
echog "Removing buildroot after upload..."
for i in $LISTNAMES ; do
if [ -z ${i/*.src.rpm/} ] ; then
echo " skipping for $i"
continue
fi
#DDIR=$BUILDROOT/${i/.spec/-buildroot}
# Hack about paths
test -f "$i" && NAME=$i || NAME=$CURDIR/$i
build_rpms_name $NAME
echo -n " $BUILDROOT "
if [ -d "$BUILDROOT" ] ; then
rm -rf "$BUILDROOT" && echog "DONE" || echog "failed"
else else
echog "Impossible to sign package. Check your password and try again." echog "missed"
echog "Wait for ten seconds."
sleep 10
exit 1
fi fi
else done
rpmbs_copying_built
fi
...@@ -82,7 +82,7 @@ get_archive1() ...@@ -82,7 +82,7 @@ get_archive1()
echog -n "Converting to $WEXT.bz2..." echog -n "Converting to $WEXT.bz2..."
} }
TODO: use functions from tarball #TODO: use functions from tarball
get_tarbz2() get_tarbz2()
{ {
get_archive tar.bz2 get_archive tar.bz2
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment