]> git.pld-linux.org Git - packages/rpm-build-tools.git/blobdiff - builder.sh
Exit with error when cannot push tags
[packages/rpm-build-tools.git] / builder.sh
index 7713c5ec490dc9f2a98f4fc3beaf8d69c436b7ca..fbdecf8f44ba827ef44f45c928b87b5a72f625d9 100755 (executable)
@@ -63,7 +63,6 @@ UPDATE=""
 ADD5=""
 NO5=""
 ALWAYS_CVSUP=${ALWAYS_CVSUP:-"yes"}
-CVSROOT=""
 
 # use rpm 4.4.6+ digest format instead of comments if non-zero
 USEDIGEST=
@@ -107,14 +106,14 @@ ASSUMED_NAME=""
 PROTOCOL="http"
 WGET_RETRIES=${MAX_WGET_RETRIES:-0}
 
-CVS_COMMAND=${CVS_COMMAND:-cvs}
 CVS_FORCE=""
 CVSIGNORE_DF="yes"
-CVS_RETRIES=${MAX_CVS_RETRIES:-1000}
-CVS_SERVER="cvs.pld-linux.org"
 CVSTAG=""
 GIT_SERVER="git://github.com/draenog"
 HEAD_DETACHED=""
+DEPTH=""
+REMOTE_PLD="origin"
+NEW_REPO=""
 
 RES_FILE=""
 
@@ -175,6 +174,10 @@ fi
 
 [ -f "$USER_CFG" ] && . "$USER_CFG"
 
+if [ -n "$GIT_LOGINNAME" ]; then
+       GIT_SERVER="git@github.com:${GIT_LOGINNAME}"
+fi
+
 if [ "$SCHEDTOOL" = "auto" ]; then
        if [ -x /usr/bin/schedtool ] && schedtool -B -e echo >/dev/null; then
                SCHEDTOOL="schedtool -B -e"
@@ -246,16 +249,16 @@ run_poldek() {
 usage() {
        if [ -n "$DEBUG" ]; then set -xv; fi
        echo "\
-Usage: builder [-D|--debug] [-V|--version] [--short-version] [--as_anon] [-a|--add_cvs] [-b|-ba|--build]
+Usage: builder [-D|--debug] [-V|--version] [--short-version]  [-a|--add_cvs] [-b|-ba|--build]
 [-bb|--build-binary] [-bs|--build-source] [-bc] [-bi] [-bl] [-u|--try-upgrade]
-[{-cf|--cvs-force}] [{-B|--branch} <branch>] [{-d|--cvsroot} <cvsroot>]
+[{-cf|--cvs-force}] [{-B|--branch} <branch>] [--depth <number>]
 [-g|--get] [-h|--help] [--ftp] [--http] [{-l|--logtofile} <logfile>] [-m|--mr-proper]
-[-q|--quiet] [--date <yyyy-mm-dd> [-r <cvstag>] [{-T|--tag <cvstag>]
+[-q|--quiet] [--date <yyyy-mm-dd> [-r <tag>] [{-T|--tag <tag>]
 [-Tvs|--tag-version-stable] [-Ts|--tag-stable] [-Tv|--tag-version]
 [{-Tp|--tag-prefix} <prefix>] [{-tt|--test-tag}]
 [-nu|--no-urls] [-v|--verbose] [--opts <rpm opts>] [--short-circuit]
 [--show-bconds] [--with/--without <feature>] [--define <macro> <value>]
-<package>[.spec][:cvstag]
+<package>[.spec][:tag]
 
 -5, --update-md5    - update md5 comments in spec, implies -nd -ncs
 -a5, --add-md5      - add md5 comments to URL sources, implies -nc -nd -ncs
@@ -264,34 +267,33 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [--as_anon] [-a|--a
 -debug              - produce rpm debug package (same as --opts -debug)
 -V, --version       - output builder version string
 --short-version     - output builder short version
---as_anon           - get files via pserver as cvs@$CVS_SERVER,
--a, --add_cvs       - try add new package to CVS.
--b, -ba, --build    - get all files from CVS repo or HTTP/FTP and build package
+-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 CVS repo or HTTP/FTP and build binary
+-bb, --build-binary - get all files from PLD repo or HTTP/FTP and build binary
                       only package from <package>.spec,
 -bp, --build-prep   - execute the %prep phase of <package>.spec,
 -bc                 - execute the %build phase of <package>.spec,
 -bi                 - execute the %install phase of <package>.spec
 -bl                                    - execute the %files phase of <package>.spec
--bs, --build-source - get all files from CVS repo or HTTP/FTP and only pack
+-bs, --build-source - get all files from PLD repo or HTTP/FTP and only pack
                       them into src.rpm,
 --short-circuit     - short-circuit build
 -B, --branch        - add branch
 -c, --clean         - clean all temporarily created files (in BUILD\$RPM_BUILD_ROOT) after rpmbuild commands.
                       may be used with building process.
 -m, --mr-proper     - clean all temporarily created files (in BUILD, SOURCES,
-                                         SPECS and \$RPM_BUILD_ROOT and CVS/Entries). Doesn't run
+                                         SPECS and \$RPM_BUILD_ROOT). Doesn't run
                                          any rpm building.
--cf, --cvs-force       - use -F when tagging (useful when moving branches)
--d <cvsroot>, --cvsroot <cvsroot>
-                    - setup \$CVSROOT,
+-cf, --cvs-force       - use -f when tagging
 --define <macro> <value>
                     - define a macro <macro> with value <value>,
+--depth <number>
+                                       - make shallow fetch
 --alt_kernel <kernel>
                     - same as --define 'alt_kernel <kernel>'
 --nodeps            - rpm won't check any dependences
--g, --get           - get <package>.spec and all related files from CVS repo
+-g, --get           - get <package>.spec and all related files from PLD repo
                       or HTTP/FTP,
 -h, --help          - this message,
 -jN, -j N           - set %_smp_mflags to propagate concurrent jobs
@@ -299,7 +301,7 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [--as_anon] [-a|--a
 -l <logfile>, --logtofile <logfile>
                     - log all to file,
 -ncs, --no-cvs-specs
-                    - don't check specs in CVS
+                    - don't pull from PLD repo
 -nd, --no-distfiles - don't download from distfiles
 -nm, --no-mirrors   - don't download from mirror, if source URL is given,
 -nu, --no-urls      - don't try to download from FTP/HTTP location,
@@ -312,10 +314,10 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [--as_anon] [-a|--a
 --skip-existing-files - skip existing files in get_files
 --opts <rpm opts>   - additional options for rpm
 -q, --quiet         - be quiet,
---date yyyy-mm-dd   - build package using resources from specified CVS date,
--r <cvstag>, --cvstag <cvstag>
-                    - build package using resources from specified CVS tag,
--A                  - build package using CVS resources as any sticky tags/date/kopts being reset.
+--date yyyy-mm-dd   - build package using resources from specified date,
+-r <tag>, --cvstag <ref>
+                    - build package using resources from specified branch/tag,
+-A                  - build package using master branch as any sticky tags/branch/date being reset.
 -R, --fetch-build-requires
                     - fetch what is BuildRequired,
 -RB, --remove-build-requires
@@ -327,7 +329,7 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [--as_anon] [-a|--a
 -sd, --source-distfiles - list sources available from distfiles (intended for offline
                       operations; does not work when Icon field is present
                       but icon file is absent),
--sc, --source-cvs - list sources available from CVS
+-sc, --source-cvs - list sources available from PLD repo
 -sdp, --source-distfiles-paths - list sources available from distfiles -
                       paths relative to distfiles directory (intended for offline
                       operations; does not work when Icon field is present
@@ -340,14 +342,14 @@ Usage: builder [-D|--debug] [-V|--version] [--short-version] [--as_anon] [-a|--a
                       but icon file is absent),
 -su, --source-urls  - list urls - urls to sources and patches
                       intended for copying urls with spec with lots of macros in urls
--T <cvstag> , --tag <cvstag>
-                    - add cvs tag <cvstag> for files,
+-T <tag> , --tag <tag>
+                    - add git tag <tag> for files,
 -Tvs, --tag-version-stable
-                    - add cvs tags STABLE and NAME-VERSION-RELEASE for files,
+                    - add git tags STABLE and NAME-VERSION-RELEASE for files,
 -Ts, --tag-stable
-                    - add cvs tag STABLE for files,
+                    - add git tag STABLE for files,
 -Tv, --tag-version
-                    - add cvs tag NAME-VERSION-RELEASE for files,
+                    - add git tag NAME-VERSION-RELEASE for files,
 -Tp, --tag-prefix <prefix>
                     - add <prefix> to NAME-VERSION-RELEASE tags,
 -tt, --test-tag <prefix>
@@ -389,6 +391,31 @@ tempfile() {
        mktemp -t builder.XXXXXX || ${TMPDIR:-/tmp}/builder.$RANDOM.$$
 }
 
+# inserts git log instead of %changelog
+# outputs name of modified file created by tempfile
+insert_gitlog() {
+       local SPECFILE=$1 specfile=$(tempfile) gitlog=$(tempfile) speclog=$(tempfile) 
+
+       # allow this being customized
+       local log_entries=$(rpm -E '%{?_buildchangelogtruncate}')
+
+       # rpm5.org/rpm.org do not parse any other date format than 'Wed Jan 1 1997'
+       # otherwise i'd use --date=iso here
+       # http://rpm5.org/cvs/fileview?f=rpm/build/parseChangelog.c&v=2.44.2.1
+       # http://rpm.org/gitweb?p=rpm.git;a=blob;f=build/parseChangelog.c#l31
+       # NOTE: changelog date is always in UTC for rpmbuild
+       # * 1265749244 +0000 Random Hacker <nikt@pld-linux.org> 9370900
+       git log -${log_entries:-20} --format=format:"* %ad %an <%ae> %h%n%s%n" --date=raw > $gitlog
+       gawk '/^\* /{printf("* %s %s\n", strftime("%a %b %d %Y", $2), substr($0, length($1)+length($2)+length($3)+4)); next}{print}' $gitlog > $speclog
+       sed '/^%changelog/,$d' $SPECFILE | sed -e "\${
+                       a%changelog
+                       r $speclog
+               }
+       " > $specfile
+       rm -f $gitlog $speclog
+       echo $specfile
+}
+
 # change dependency to specname
 # common changes:
 # - perl(Package::Name) -> perl-Package-Name
@@ -646,14 +673,14 @@ Exit_error() {
                        exit 2 ;;
                "err_no_spec_in_repo" )
                        remove_build_requires
-                       echo >&2 "Error: spec file not stored in CVS repo."
+                       echo >&2 "Error: spec file not stored in PLD repo."
                        exit 3 ;;
                "err_no_source_in_repo" )
                        remove_build_requires
-                       echo >&2 "Error: some source, patch or icon files not stored in CVS repo. ($2)"
+                       echo >&2 "Error: some source, patch or icon files not stored in PLD repo. ($2)"
                        exit 4 ;;
                "err_cvs_add_failed" )
-                       echo >&2 "Error: failed to add package to CVS repo."
+                       echo >&2 "Error: failed to add package to PLD repo."
                        exit 4 ;;
                "err_build_fail" )
                        remove_build_requires
@@ -679,6 +706,10 @@ Exit_error() {
                        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"
@@ -719,6 +750,26 @@ init_builder() {
        __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"
@@ -735,29 +786,44 @@ get_spec() {
        fi
 
        if [ "$NOCVSSPEC" != "yes" ]; then
-               if [ -d "$ASSUMED_NAME/.git" ]; then
-                       git fetch origin || Exit_error err_no_spec_in_repo
-               elif [ "$ADD_PACKAGE_CVS" = "yes" ]; then
-                       if [ ! -r "$ASSUMED_NAME/$SPECFILE" ]; then
-                               echo "ERROR: No package to add ($ASSUMED_NAME/$SPECFILE)" >&2
-                               exit 101
+               if [ -z "$DEPTH" ]; then
+                       if [ -d "$ASSUMED_NAME/.git" ]; then
+                               git fetch $REMOTE_PLD || Exit_error err_no_spec_in_repo
+                       elif [ "$ADD_PACKAGE_CVS" = "yes" ]; then
+                               if [ ! -r "$ASSUMED_NAME/$SPECFILE" ]; then
+                                       echo "ERROR: No package to add ($ASSUMED_NAME/$SPECFILE)" >&2
+                                       exit 101
+                               fi
+                               Exit_error err_not_implemented
+                       else
+                               (
+                                       unset GIT_WORK_TREE
+                                       git clone  -o $REMOTE_PLD ${GIT_SERVER}/${ASSUMED_NAME}.git || {
+                                               # softfail if new package, i.e not yet added to PLD rep
+                                               [ ! -f "$ASSUMED_NAME/$SPECFILE" ] && Exit_error err_no_spec_in_repo
+                                               echo "Warning: package not in CVS - assuming new package"
+                                               NOCVSSPEC="yes"
+                                       }
+                               )
                        fi
-                       Exit_error err_not_implemented
                else
-                       (
-                               unset GIT_WORK_TREE
-                               git clone  ${GIT_SERVER}/${ASSUMED_NAME}.git || {
-                                       # softfail if new package, i.e not yet added to cvs
-                                       [ ! -f "$ASSUMED_NAME/$SPECFILE" ] && Exit_error err_no_spec_in_repo
-                                       echo "Warning: package not in CVS - assuming new package"
-                                       NOCVSSPEC="yes"
-                               }
-                       )
+                       if [ ! -d "$ASSUMED_NAME/.git" ]; then
+                               if [ ! -d "$ASSUMED_NAME" ]; then
+                                       mkdir $ASSUMED_NAME
+                               fi
+                               git init
+                               git remote add $REMOTE_PLD ${GIT_SERVER}/${ASSUMED_NAME}.git
+                               CVSTAG=${CVSTAG:-"master"}
+                       fi
+                       git fetch $DEPTH $REMOTE_PLD ${CVSTAG}:remotes/${REMOTE_PLD}/${CVSTAG} || {
+                               echo >&2 "Error: branch $CVSTAG does not exist"
+                               exit 3
+                       }
                fi
 
                cvsignore_df .gitignore
 
-               # add default log format to .cvsignore if it is relative to package dir
+               # add default log format to .gitignore if it is relative to package dir
                if [ -n "$LOGFILE" -a "$LOGFILE" = "${LOGFILE##*/}" ]; then
                        # substitute known "macros" to glob
                        local logfile=$(echo "$LOGFILE" | sed -e 's,\$\(PACKAGE_NAME\|DATE\),*,g')
@@ -768,7 +834,7 @@ 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
@@ -777,7 +843,7 @@ get_spec() {
        fi
 
        if [ -n "$CVSTAG" ]; then
-               git checkout "$CVSTAG" -- || exit
+               git checkout "$CVSTAG" -- 2>/dev/null || git checkout -t "${REMOTE_PLD}/$CVSTAG" > /dev/null || exit
                git symbolic-ref -q HEAD > /dev/null &&
                        git merge '@{u}'
                if [ -n "$CVSDATE" ]; then
@@ -801,8 +867,8 @@ get_spec() {
 find_mirror() {
        cd "$REPO_DIR"
        local url="$1"
-       if [ ! -f "mirrors" -a "$NOCVSSPEC" != "yes" ] ; then
-               $CVS_COMMAND update mirrors >&2
+       if [ ! -f "mirrors"  ] ; then
+               ln -s rpm-build-tools/mirrors .
        fi
 
        IFS="|"
@@ -840,13 +906,8 @@ src_md5() {
        local md5
 
        if [ -f additional-md5sums ]; then
-               local spec_rev=$(grep $SPECFILE CVS/Entries 2>/dev/null | sed -e s:/$SPECFILE/:: -e s:/.*::)
-               if [ -z "$spec_rev" ]; then
-                       spec_rev=$(head -n 1 $SPECFILE | sed -e 's/.*\$Revision: \([0-9.]*\).*/\1/')
-               fi
-               local spec="$SPECFILE[0-9.,]*,$(echo $spec_rev | sed 's/\./\\./g')"
                md5=$(grep -s -v '^#' additional-md5sums | \
-               grep -E "[      ]$(basename "$1")[      ]+${spec}([     ,]|\$)" | \
+               grep -E "[      ]$(basename "$1")([     ,]|\$)" | \
                sed -e 's/^\([0-9a-f]\{32\}\).*/\1/' | \
                grep -E '^[0-9a-f]{32}$')
 
@@ -1236,10 +1297,12 @@ tag_files() {
        if [ "$TAG_VERSION" = "yes" ]; then
                update_shell_title "tag sources: $TAGVER"
                git $OPTIONS $TAGVER || exit
+               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 || Exit_error err_remote_problem $REMOTE_PLD
        fi
 }
 
@@ -1387,10 +1450,11 @@ build_package() {
                        echo "LASTLOG=$LOG" > $LASTLOG_FILE
                fi
                RES_FILE=$(tempfile)
+               local specfile=$(insert_gitlog $SPECFILE)
 
-               (time eval ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $SPECFILE; echo $? > $RES_FILE) 2>&1 |tee $LOG
+               (time eval ${NICE_COMMAND} $RPMBUILD $TARGET_SWITCH $BUILD_SWITCH -v $QUIET $CLEAN $RPMOPTS $RPMBUILDOPTS $BCOND --define \'_specdir $PACKAGE_DIR\' --define \'_sourcedir $PACKAGE_DIR\' $specfile; echo $? > $RES_FILE) 2>&1 |tee $LOG
                RETVAL=`cat $RES_FILE`
-               rm $RES_FILE
+               rm $RES_FILE $specfile
                if [ -n "$LOGDIROK" ] && [ -n "$LOGDIRFAIL" ]; then
                        if [ "$RETVAL" -eq "0" ]; then
                                mv $LOG $LOGDIROK
@@ -1632,10 +1696,8 @@ display_bconds() {
 }
 
 display_branches() {
-       if [ "$NOCVSSPEC" != "yes" ]; then
-               echo -n "Available branches: "
-               git branch -r | grep '^  origin' | grep -v origin/HEAD | sed 's#^ *origin/##' | xargs
-       fi
+       echo -n "Available branches: "
+       git branch -r | grep "^  ${REMOTE_PLD}" | grep -v ${REMOTE_PLD}/HEAD | sed "s#^ *${REMOTE_PLD}/##" | xargs
 }
 
 # checks a given list of packages/files/provides agains current rpmdb.
@@ -1874,63 +1936,32 @@ fetch_build_requires()
 }
 
 init_rpm_dir() {
-       local CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"
        local TOP_DIR=$(eval $RPM $RPMOPTS --eval '%{_topdir}')
        local rpmdir=$(eval $RPM $RPMOPTS --eval '%{_rpmdir}')
        local buildir=$(eval $RPM $RPMOPTS --eval '%{_builddir}')
        local srpmdir=$(eval $RPM $RPMOPTS --eval '%{_srcrpmdir}')
        local tmp
 
-       echo "Initializing rpm directories to $TOP_DIR from $CVSROOT"
+       echo "Initializing rpm directories to $TOP_DIR from $GIT_SERVER"
        mkdir -p $TOP_DIR $rpmdir $buildir $srpmdir
 
-       # need to checkout to tmp dir or we can't name our topdir
-       tmp=$(TMPDIR= TEMPDIR= mktemp -p $TOP_DIR -d) || exit 1
-       cd $tmp
-       $CVS_COMMAND -d $CVSROOT co packages/{.cvsignore,rpm.groups,dropin,mirrors,md5,adapter{,.awk},fetchsrc_request,builder,{relup,compile,repackage}.sh,ci,civim}
-       cd -
-       mv $tmp/packages/* $TOP_DIR
-       rm -rf $tmp
-
-       init_builder
-
-       echo "To checkout *all* .spec files (read-only):"
-       echo "- run cvs co SPECS"
-
-       echo "To checkout *all* packages:"
-       echo "- run cvs up -dP in $TOP_DIR dir"
-
-       echo ""
-       echo "To commit with your developer account:"
-       echo "- edit $TOP_DIR/CVS/Root"
-}
-
-# remove entries from CVS/Entries
-cvs_entry_remove() {
-       local cvsdir="$1"; shift
-       if [ ! -d "$cvsdir" ]; then
-               echo >&2 "cvs_entry_remove: $cvsdir is not a directory"
-               exit 1
-       fi
-
-       for file in "$@"; do
-               rm -f $cvsdir/CVS/Entries.new || return 1
-               awk -ve="${file##*/}" -F/ '$2 != e {print}' $cvsdir/CVS/Entries > $cvsdir/CVS/Entries.new || return 1
-               mv -f $cvsdir/CVS/Entries.new $cvsdir/CVS/Entries || return 1
+       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
-       return 0
+       init_builder
 }
 
 mr_proper() {
        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
-       rm -rf $PACKAGE_DIR/.git
+       $RPMBUILD --clean --rmsource --rmspec --nodeps --define "_specdir $PACKAGE_DIR" --define "_sourcedir $PACKAGE_DIR" $PACKAGE_DIR/$SPECFILE
+       rm -rf $PACKAGE_DIR/.git .gitignore
+       rmdir --ignore-fail-on-non-empty $PACKAGE_DIR
 }
 
 #---------------------------------------------
@@ -1963,8 +1994,6 @@ while [ $# -gt 0 ]; do
                        COMMAND="version"; shift ;;
                --short-version )
                        COMMAND="short-version"; shift ;;
-               --as_anon )
-                       CVSROOT=":pserver:cvs@$CVS_SERVER:/cvsroot"; shift ;;
                -a | --add_cvs)
                        COMMAND="add_cvs";
                        shift ;;
@@ -1988,8 +2017,10 @@ while [ $# -gt 0 ]; do
                        CLEAN="--clean"; shift ;;
                -cf | --cvs-force )
                        CVS_FORCE="-f"; shift;;
-               -d | --cvsroot )
-                       shift; CVSROOT="${1}"; shift ;;
+               --depth )
+                       DEPTH="--depth=$2"
+                       shift 2
+                       ;;
                -g | --get )
                        COMMAND="get"; shift ;;
                -h | --help )
@@ -2348,14 +2379,14 @@ case "$COMMAND" in
                if [ -n "$TEST_TAG" ]; then
                        local TAGVER=`make_tagver`
                        echo "Searching for tag $TAGVER..."
-                       git show-ref --quiet --verify "refs/tags/$TAGVER" && Exit_error err_tag_exists "$TAGVER" "$TAGREL"
+                       git show-ref --quiet --verify "refs/tags/$TAGVER" && Exit_error err_tag_exists "$TAGVER"
 
                        # - do not allow to build from HEAD when XX-branch exists
                        TREE_PREFIX=$(echo "$TAG_PREFIX" | sed -e 's#^auto-\([a-zA-Z]\+\)-.*#\1#g')
                        if [ "$TREE_PREFIX" != "$TAG_PREFIX" ]; then
                                TAG_BRANCH="${TREE_PREFIX}-branch"
-                               TAG_STATUS=$(git branch -r | grep -i "origin/$TAG_BRANCH$" | sed 's# *origin/##')
-                               if [ -n "$TAG_STATUS" -a -z "$CVSTAG" ]; then
+                               TAG_STATUS=$(git branch -r | grep -i "${REMOTE_PLD}/$TAG_BRANCH$" | sed "s# *${REMOTE_PLD}/##")
+                               if [ -n "$TAG_STATUS" -a "$TAG_STATUS" != "$CVSTAG" ]; then
                                        Exit_error err_branch_exists "$TAG_STATUS"
                                fi
                        fi
@@ -2398,14 +2429,23 @@ case "$COMMAND" in
                        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
This page took 0.0686369999999999 seconds and 4 git commands to generate.