Line 4: |
Line 4: |
| # $1 = Module name e.g. smeserver-ddclient | | # $1 = Module name e.g. smeserver-ddclient |
| # $2 = "contrib" ...anything else -=> core module | | # $2 = "contrib" ...anything else -=> core module |
| + | if [ $1 = "" ] |
| + | then |
| + | echo "cvs2git <modulename> <contrib|base>" |
| + | exit 0 |
| + | fi |
| LocalUser="brianr" | | LocalUser="brianr" |
| RemoteUser="brianr" | | RemoteUser="brianr" |
Line 25: |
Line 30: |
| cd $1/contribs10 | | cd $1/contribs10 |
| make prep | | make prep |
| + | |
| + | #Extract the directory name for the file tree (it will include the name of the module plus some version information) |
| + | cd $CVSFiles/$1/contribs10/ |
| + | TREEPATH=`ls -d */ | grep $1 | grep -v "\.old" | grep -v "_sme"` |
| + | echo "TreePATH:$TREEPATH" |
| | | |
| # Create the local Git repository | | # Create the local Git repository |
Line 31: |
Line 41: |
| git init $1 | | git init $1 |
| cd $1 | | cd $1 |
− | echo `pwd` | + | echo "PWD:"`pwd` |
| #pull in all the files we want | | #pull in all the files we want |
| if [ $2 == "contrib" ]; then | | if [ $2 == "contrib" ]; then |
− | mkdir -p contribs10
| + | for fpath in "$TREEPATH" "*.spec" "Makefile" "$TREEPATH/createlinks" |
− | for fpath in "*.patch" "*.spec" "*.gz" "*.tgz" "*.xz" "Makefile" | |
| do | | do |
− | cp $CVSFiles/$1/contribs10/$fpath ./contribs10/ | + | cp -R $CVSFiles/$1/contribs10/$fpath . |
| done | | done |
| + | mv $TREEPATH/root ./root |
| + | rm -f $TREEPATH/* |
| + | rmdir $TREEPATH |
| else | | else |
− | mkdir -p sme10
| + | for fpath in "$TREEPATH" "*.spec" "Makefile" "$TREEPATH/createlinks" |
− | for fpath in "*.patch" "*.spec" "*.gz" "*.tgz" "*.xz" "Makefile" | |
| do | | do |
− | cp $CVSFiles/$1/sme10/$fpath ./sme10/
| + | cp -R $CVSFiles/$1/sme10/$fpath . |
| done | | done |
| + | mv $TREEPATH/root ./root |
| + | rm -f $TREEPATH/* |
| + | rmdir $TREEPATH |
| fi | | fi |
| | | |
− | #Get Clone the common directory | + | #Now edit the spec file to remove all those patches and adjust the paths |
| + | sed -i '/^Patch/d; /^%patch/d' $1.spec |
| + | # no paths adjusted yet! |
| + | |
| + | #Create the tar file needed (currently) for the rpm build |
| + | tar -czf $TREEPATH.tar.gz root/ |
| + | |
| + | #Clone the common directory |
| git clone https://src.koozali.org/brianr/common.git | | git clone https://src.koozali.org/brianr/common.git |
| # and delete the .git else it pushes back a link to the repo | | # and delete the .git else it pushes back a link to the repo |
Line 53: |
Line 74: |
| rm -fr ".git" | | rm -fr ".git" |
| cd .. | | cd .. |
| + | |
| + | # |
| + | # Use the https interface to create the remote repo (it will just bounce back if it exists already) |
| + | # Currently this creates a private repo (making it public here causes a gitea internal server error, as does auto_init |
| + | # Note that the token decides where the repo is created (i.e. under what user) |
| + | # We will need this to be "organisation" (smecontribs or smeserver) finally. |
| + | # |
| + | curl -X 'POST' 'https://src.koozali.org/api/v1/user/repos' \ |
| + | -H 'accept: application/json' \ |
| + | -H 'Authorization: token 28b6ebca17d6a70d6c1848e8edce4007f072961c' \ |
| + | -H 'Content-Type: application/json' \ |
| + | -d '{ |
| + | "auto_init": false, |
| + | "default_branch": "master", |
| + | "description": "'"SMEServer git repo for $1 $2"'", |
| + | "gitignores": "", |
| + | "issue_labels": "", |
| + | "license": "Apache 2.0", |
| + | "name": "'"$1"'", |
| + | "private": true, |
| + | "readme": "", |
| + | "template": false, |
| + | "trust_model": "default" |
| + | }' |
| + | |
| | | |
| #stage and commit them | | #stage and commit them |
Line 66: |
Line 112: |
| echo "Created $1 Repo in $RemoteRepoURL" | | echo "Created $1 Repo in $RemoteRepoURL" |
| exit 0 | | exit 0 |
| + | |
| + | |
| + | |
| </syntaxhighlight> | | </syntaxhighlight> |
| | | |