HEAD_DETACHED=""
DEPTH=""
REMOTE_PLD="origin"
+NEW_REPO=""
RES_FILE=""
-debug - produce rpm debug package (same as --opts -debug)
-V, --version - output builder version string
--short-version - output builder short version
--a, --add_cvs - try add new package to PLD repo.
+-a, --add_vcs - try add new package to PLD repo.
-b, -ba, --build - get all files from PLD repo or HTTP/FTP and build package
from <package>.spec,
-bb, --build-binary - get all files from PLD repo or HTTP/FTP and build binary
remove_build_requires
echo >&2 "Error: conditions reject building this spec (${2})."
exit 12 ;;
+ "err_remote_problem" )
+ remove_build_requires
+ echo >&2 "Error: problem with remote (${2})"
+ exit 13 ;;
"err_not_implemented" )
remove_build_requires
echo >&2 "Error: functionality not yet imlemented"
__PWD=$(pwd)
}
+create_git_repo() {
+ update_shell_title "add_package"
+
+ if [ -n "$DEBUG" ]; then
+ set -x
+ set -v
+ fi
+
+ cd "$REPO_DIR"
+ SPECFILE=$(basename $SPECFILE)
+ if [ ! -f "$ASSUMED_NAME/$SPECFILE" ]; then
+ echo "ERROR: No package to add ($ASSUMED_NAME/$SPECFILE)" >&2
+ exit 101
+ fi
+ [ -d "$ASSUMED_NAME/.git" ] || NEW_REPO=yes
+ pldpkg.py add ${ASSUMED_NAME} || Exit_error err_cvs_add_failed
+ git init
+ git remote add $REMOTE_PLD ${GIT_SERVER}/${ASSUMED_NAME}.git || Exit_error err_remote_problem $REMOTE_PLD
+}
+
get_spec() {
update_shell_title "get_spec"
# create symlinks for tools
if [ "$SYMLINK_TOOLS" != "no" ]; then
- for a in dropin md5 adapter builder {relup,compile,repackage,rsync,pearize}.sh pldnotify.awk; do
+ for a in dropin md5 adapter builder {relup,compile,repackage,pearize}.sh pldnotify.awk; do
[ -f $a ] || continue
ln -sf ../$a $ASSUMED_NAME
cvsignore_df $a
if [ "$TAG_VERSION" = "yes" ]; then
update_shell_title "tag sources: $TAGVER"
git $OPTIONS $TAGVER || exit
- git push $CVS_FORCE $REMOTE_PLD tag $TAGVER
+ git push $CVS_FORCE $REMOTE_PLD tag $TAGVER || Exit_error err_remote_problem $REMOTE_PLD
fi
if [ -n "$TAG" ]; then
update_shell_title "tag sources: $TAG"
git $OPTIONS $TAG $chunk || exit
- git push $CVS_FORCE $REMOTE_PLD tag $TAG
+ git push $CVS_FORCE $REMOTE_PLD tag $TAG || Exit_error err_remote_problem $REMOTE_PLD
fi
}
echo "Initializing rpm directories to $TOP_DIR from $GIT_SERVER"
mkdir -p $TOP_DIR $rpmdir $buildir $srpmdir
- GIT_WORK_TREE=${TOP_DIR}/rpm-build-tools git clone ${GIT_SERVER}/rpm-build-tools.git ||
- for a in dropin md5 adapter builder mirrors {relup,compile,repackage,rsync,pearize}.sh pldnotify.awk; do
+ cd "$TOP_DIR"
+ git clone ${GIT_SERVER}/rpm-build-tools.git ${TOP_DIR}/rpm-build-tools
+ for a in dropin md5 adapter builder mirrors {relup,compile,repackage,pearize}.sh pldnotify.awk; do
ln -s rpm-build-tools/$a .
done
init_builder
init_builder
NOCVSSPEC="yes"
DONT_PRINT_REVISION="yes"
- get_spec
- parse_spec
# remove spec and sources
- $RPMBUILD --clean --rmsource --rmspec --nodeps --define "_specdir $PACKAGE_DIR" --define "_sourcedir $PACKAGE_DIR" $SPECFILE
+ $RPMBUILD --clean --rmsource --rmspec --nodeps --define "_specdir $PACKAGE_DIR" --define "_sourcedir $PACKAGE_DIR" $PACKAGE_DIR/$SPECFILE
rm -rf $PACKAGE_DIR/.git .gitignore
- cd $__PWD
rmdir --ignore-fail-on-non-empty $PACKAGE_DIR
}
if [ "$TREE_PREFIX" != "$TAG_PREFIX" ]; then
TAG_BRANCH="${TREE_PREFIX}-branch"
TAG_STATUS=$(git branch -r | grep -i "${REMOTE_PLD}/$TAG_BRANCH$" | sed "s# *${REMOTE_PLD}/##")
- if [ "$TAG_STATUS" != "$CVSTAG" ]; then
+ if [ -n "$TAG_STATUS" -a "$TAG_STATUS" != "$CVSTAG" ]; then
Exit_error err_branch_exists "$TAG_STATUS"
fi
fi
Exit_error err_no_spec_in_cmdl
fi
- ADD_PACKAGE_CVS=yes get_spec
- parse_spec
-
- if [ -n "$NOSOURCE0" ] ; then
- SOURCES=`echo $SOURCES | xargs | sed -e 's/[^ ]*//'`
+ create_git_repo
+ if [ -n "$NEW_REPO" ]; then
+ parse_spec
+ local file
+ for file in $SOURCES $PATCHES; do
+ if [ -z $(src_md5 "$file") ]; then
+ git add $file || Exit_error err_no_source_in_repo $file
+ else
+ cvsignore_df `nourl $file`
+ fi
+ done
+ git add $SPECFILE
+ git commit -m 'Initial commit'
+ git push --dry-run $REMOTE_PLD master || Exit_error err_cvs_add_failed
+ else
+ echo "You had already git repository. Push chosen branches to remote: ${REMOTE_PLD}"
fi
- get_files $SOURCES $PATCHES
- check_md5 $SOURCES
;;
"get" )
init_builder