Compare commits
149 Commits
b97d611c79
...
master
Author | SHA1 | Date | |
---|---|---|---|
![]() |
50f193b2db | ||
e30641250e | |||
0c858eaba1 | |||
c4f00b4328 | |||
f984ec736d | |||
454e474564 | |||
![]() |
8f06ffbed9 | ||
![]() |
c15231193b | ||
![]() |
bd51a307e8 | ||
![]() |
f948bbc974 | ||
![]() |
6fff2d19f5 | ||
![]() |
fb6a44f132 | ||
![]() |
c5800c3e14 | ||
![]() |
1a4d5ade8f | ||
![]() |
331c908cb8 | ||
![]() |
c5d71a4da7 | ||
![]() |
452e84b2ca | ||
![]() |
1e00424274 | ||
e19bd34d0c | |||
f8e6992cea | |||
28d6cb1a44 | |||
0ca87cfbee | |||
13d705639c | |||
![]() |
c690004aca | ||
![]() |
a90599279b | ||
![]() |
9916c56721 | ||
![]() |
5c4f74da8f | ||
f7e6b20b25 | |||
![]() |
9fd4f2cce8 | ||
![]() |
c8f81a0315 | ||
![]() |
0c53f9fae6 | ||
![]() |
ce14ed07fc | ||
![]() |
eaf957da50 | ||
![]() |
4ddb8de08e | ||
c25fa1943a | |||
![]() |
19efadfa1d | ||
![]() |
750bde5b38 | ||
![]() |
de31b20e72 | ||
![]() |
c6e57c9475 | ||
![]() |
98eddc7b64 | ||
![]() |
e2b9906429 | ||
![]() |
99be082770 | ||
029b3fe3cd | |||
![]() |
70daf74b8d | ||
![]() |
307a492847 | ||
![]() |
ee106a077c | ||
![]() |
fd798e83c3 | ||
![]() |
477ecb7c4d | ||
6e9f8dddb9 | |||
![]() |
133cea8089 | ||
![]() |
e966afb059 | ||
be872a008e | |||
![]() |
b60d27a7fe | ||
![]() |
ff0eeb0fce | ||
5b30bee2a9 | |||
![]() |
89e71d95a5 | ||
![]() |
21a3a248b2 | ||
![]() |
36616d567f | ||
![]() |
44432a300b | ||
![]() |
11c8552978 | ||
![]() |
211c2ee576 | ||
![]() |
27b59de7aa | ||
![]() |
afe2c69d3e | ||
![]() |
5cf5ed1278 | ||
![]() |
38fa8363e5 | ||
![]() |
b7188cbf4b | ||
![]() |
7a7a68753a | ||
![]() |
6d940ffda8 | ||
![]() |
988513d86b | ||
![]() |
bf8e39046a | ||
![]() |
913c24a33f | ||
![]() |
f50cfc1ca7 | ||
![]() |
3094498fc6 | ||
![]() |
a0fe5dd71d | ||
![]() |
999c22b420 | ||
![]() |
3f8e6f31ae | ||
![]() |
1333f1a651 | ||
![]() |
8f8632e65e | ||
![]() |
e3f3040073 | ||
![]() |
a99d2a59c1 | ||
![]() |
ea5551e41f | ||
![]() |
15899ef0c7 | ||
![]() |
9c4d268e3d | ||
94f7e151c0 | |||
4671bb0abd | |||
![]() |
bb5278ebd5 | ||
![]() |
9c827793e0 | ||
![]() |
5207676ada | ||
![]() |
5861b6af76 | ||
![]() |
7c125e18d1 | ||
![]() |
6237cbec79 | ||
![]() |
d0242b29ce | ||
![]() |
7eb6b5769e | ||
![]() |
dc0ed1b79d | ||
![]() |
96094332ef | ||
![]() |
1e40fa679c | ||
![]() |
2b60851ea3 | ||
![]() |
51ecfe7ee1 | ||
![]() |
f0a02bc746 | ||
![]() |
ff91ef36e3 | ||
![]() |
09f76ab8ab | ||
![]() |
d05df71e5c | ||
![]() |
0c2b8da54f | ||
![]() |
f2b2c021f8 | ||
![]() |
72625870bf | ||
![]() |
485c2090a1 | ||
![]() |
15ffd74a3e | ||
![]() |
ef23cc5f9a | ||
![]() |
c9e3f1782c | ||
![]() |
de4a821af5 | ||
![]() |
32268cd2a9 | ||
![]() |
9fd1578a7e | ||
![]() |
75aa177430 | ||
![]() |
1116647ec2 | ||
![]() |
9cd1d56a72 | ||
![]() |
96f7295f96 | ||
![]() |
901042b562 | ||
![]() |
2036ae59f4 | ||
![]() |
178d0f37ab | ||
![]() |
a7b3cda711 | ||
![]() |
ce96666422 | ||
![]() |
9b86646411 | ||
![]() |
6f09d7a865 | ||
![]() |
80d42edbc1 | ||
![]() |
80f76cf8ac | ||
![]() |
1aeb5b4c36 | ||
![]() |
b497a00693 | ||
![]() |
277035cf55 | ||
![]() |
61f97c908e | ||
![]() |
6b45e5f846 | ||
![]() |
7cde1aaeff | ||
![]() |
96e105213e | ||
![]() |
d0ceacf5ef | ||
![]() |
db62df1090 | ||
![]() |
51d864512f | ||
![]() |
ec984efd3d | ||
![]() |
5c065162dd | ||
![]() |
255cce967a | ||
![]() |
7fb53cc776 | ||
![]() |
a7eebc7ac7 | ||
![]() |
aab64d1ed7 | ||
![]() |
2822c44f8e | ||
![]() |
3b2ab5189a | ||
![]() |
240928b74b | ||
![]() |
d05be5fa35 | ||
![]() |
840b9e9057 | ||
![]() |
5199f9ea5e | ||
456cee3067 | |||
9cbece1ab8 |
169
README.md
169
README.md
@@ -4,6 +4,8 @@ Utilities to use with smeserver on Koozali.org GITEA instance
|
|||||||
|
|
||||||
Just a repackaging of some of Brian Read's tools with some modifications for the new git structure and some tidy-up of the ini file and debug statements
|
Just a repackaging of some of Brian Read's tools with some modifications for the new git structure and some tidy-up of the ini file and debug statements
|
||||||
|
|
||||||
|
It's a good idea to have the scripts somewhere in your path (some do call others). You can put them in ~/bin (you may need to create this if it doesn't exist)
|
||||||
|
|
||||||
## config
|
## config
|
||||||
sample ~/.smegit/config or /etc/smegit.ini file - fill in your details\
|
sample ~/.smegit/config or /etc/smegit.ini file - fill in your details\
|
||||||
It will use the user config first and system ini, if user config does not exist
|
It will use the user config first and system ini, if user config does not exist
|
||||||
@@ -24,8 +26,9 @@ optional parameters, can appear in any order
|
|||||||
## git-get-and-build-repo.sh
|
## git-get-and-build-repo.sh
|
||||||
bring down current git repository and run mockbuild
|
bring down current git repository and run mockbuild
|
||||||
|
|
||||||
git-get-and-build.sh <organisation> <repository> [<local> <debug>]
|
git-get-and-build.sh <repository> <organisation> [branch=<branch> <local> <debug>]
|
||||||
|
|
||||||
|
* \<branch=<branch\> will bring back a specific branch, otherwise Master
|
||||||
* \<repository\> repository (package) to be built (e.g. smeserver-yum)
|
* \<repository\> repository (package) to be built (e.g. smeserver-yum)
|
||||||
* \<organisation\> can be any organisation or user on the remote GITEA instance
|
* \<organisation\> can be any organisation or user on the remote GITEA instance
|
||||||
|
|
||||||
@@ -37,58 +40,172 @@ optional parameters, can appear in any order
|
|||||||
## git-migrate-repo.sh
|
## git-migrate-repo.sh
|
||||||
create mirror or copy of src.koozali.org repository in a local GITEA instance
|
create mirror or copy of src.koozali.org repository in a local GITEA instance
|
||||||
|
|
||||||
git-migrate-repo.sh <repository> <organisation> [<copy|mirror> <target organisation> <debug>]
|
git-migrate-repo.sh <repository> <organisation> [<target organisation> <copy|mirror> <local> <debug>]
|
||||||
|
|
||||||
* \<repository\> repository (package) to be copied (e.g. smeserver-yum)
|
* \<repository\> repository (package) to be copied (e.g. smeserver-yum)
|
||||||
* \<organisation\> can be any organisation or user on the remote GITEA instance
|
* \<organisation\> can be any organisation or user on the remote GITEA instance
|
||||||
* \<debug\> run in debug mode
|
|
||||||
|
|
||||||
optional parameters, can appear in any order
|
optional parameters, can appear in any order
|
||||||
|
|
||||||
|
* \<target organisation\> within your local GITEA, otherwise local user - must exist already
|
||||||
* \<copy|mirror\> will create local repo as either a copy or a mirror of the remote repo (default = copy)
|
* \<copy|mirror\> will create local repo as either a copy or a mirror of the remote repo (default = copy)
|
||||||
* \<target organisation\> within your local GITEA, otherwise local user - must exist already
|
* \<local\> use local GITEA as source (i.e. copy between organisations on local GITEA)
|
||||||
* \<debug\> run in debug mode
|
* \<debug\> run in debug mode
|
||||||
|
|
||||||
## git-migrate-org.sh
|
## git-transfer-repo.sh
|
||||||
create mirrors of all repos for an organisation in a local GITEA instance
|
Transfer a repo to a different user (or organisation)
|
||||||
|
|
||||||
git-migrate-org.sh <organisation> [<copy|mirror> <review> <target organisation> <debug>]
|
git-transfer-repo.sh <repository> <source organization> <target organisation> [<local> <force> <debug> <silent>]
|
||||||
|
|
||||||
* \<organisation\> can be any organisation or user on the remote GITEA instance
|
* \<repository\> repository name to be transferred (e.g. smeserver-clamav)
|
||||||
|
* \<source organisation\> to be transferred from (any valid organisation or user)
|
||||||
|
* \<target organisation\> to be transferred to (any valid organisation or user - you need owner privileges)
|
||||||
|
|
||||||
optional parameters, can appear in any order
|
optional parameters, can appear in any order
|
||||||
|
|
||||||
* \<copy|mirror\> will create local repos as either a copy or a mirror of the remote repos (default = copy)
|
\<local\> will use parameters set for local repository, else it will use remote
|
||||||
* \<review\> will just list the repos to be migrated, rather than doing it
|
\<force\> will automagically delete an existing target repo, otherwise it will prompt
|
||||||
* \<target organisation\> within your local GITEA, otherwise local user - must exist already
|
\<debug\> run in debug mode
|
||||||
* \<debug\> run in debug mode
|
\<silent\> suppress success message
|
||||||
* \<noisy\> show each repo being migrated
|
|
||||||
|
|
||||||
## rename-e-smith-pkg.sh
|
## git-retag.sh
|
||||||
Rename an e-smith package as smeserver and change relevant files
|
Create a new tag based on %version-%release in spec file (without trailing el7.sme) and optionally remove old tags
|
||||||
|
|
||||||
rename-emith-pkg.sh <pkg> [<organisation> <local> <force> <debug>]
|
git-retag.sh <repository> <organisation> [<local> <debug> <noisy>]
|
||||||
|
|
||||||
* \<pkg\> Module name to be renamed e.g. e-smith-dnscache
|
* \<repository\> repository to be retagged
|
||||||
|
* \<organisation\> organisation\owner that the repository belongs to
|
||||||
|
|
||||||
optional parameters, can appear in any order
|
optional parameters, can appear in any order
|
||||||
|
|
||||||
* \<organisation\> (any gitea organisation smeserver, smecontribs or user - defaults to smeserver)
|
* \<purge\> will remove all existing tags
|
||||||
* \<local\> will use parameters set for local repository else it will use remote
|
* \<local\> will use parameters set for local repository, else it will use remote
|
||||||
* \<force\> will automagically delete an existing repo, otherwise it will prompt
|
* \<debug\> run with debug output
|
||||||
* \<debug\> run in debug mode
|
* \<noisy\> will will print a line showing how it was called
|
||||||
|
|
||||||
This works whether the repo and local files exist of not (it deletes them if necessary)
|
|
||||||
|
|
||||||
## parse-list.sh
|
## parse-list.sh
|
||||||
Parse a list of parameters and execute script with those parameters
|
Parse a list of parameters and execute script with those parameters
|
||||||
|
|
||||||
parse-list.sh <param file> <script> [<noisy> <additional> <additional> <additional>]
|
parse-list.sh <param file|org='organisation'> <script> [<local> <noisy> <review> <additional*>]
|
||||||
|
|
||||||
* \<param file\> name of file containing parameters
|
* \<param file\|org='organisation'> name of file containing parameters or organisation which will be used to generate a list of all repos for input to \<script\>
|
||||||
* \<script\> script to run (e.g. rename-e-smith-pkg.sh)
|
* \<script\> script to run (e.g. rename-e-smith-pkg.sh)
|
||||||
|
|
||||||
optional params can appear in any order
|
optional params can appear in any order
|
||||||
|
|
||||||
|
* \<local\> used with org= and will use local GITEA instance, default remote - will be passed to \<script\>
|
||||||
* \<noisy\> show line being executed
|
* \<noisy\> show line being executed
|
||||||
* \<additional\> additional params to be passed (up to 3) e.g. debug,force,local
|
* \<review\> show line to be executed, but NOT executing
|
||||||
|
* \<additional\> additional params to be passed (up to 3) e.g. debug,force,local
|
||||||
|
|
||||||
|
### example:
|
||||||
|
|
||||||
|
parse-list.sh org=smeserver git-migrate-repo.sh review
|
||||||
|
|
||||||
|
will echo the command that would be run for each repo in the smeserver organisation on the remote GITEA instance
|
||||||
|
|
||||||
|
git-migrate-repo.sh perl-Moo smeserver
|
||||||
|
git-migrate-repo.sh buildsys-macros smeserver
|
||||||
|
git-migrate-repo.sh clamav smeserver
|
||||||
|
...
|
||||||
|
|
||||||
|
## git-post-create-repo.sh
|
||||||
|
Update a repo created from a template (contribs,base or 3rd party) with things not able to be updated from the template:
|
||||||
|
|
||||||
|
* \<repository\> repository (package) to be editted (e.g. smeserver-yum)
|
||||||
|
* \<organisation\> can be any organisation or user on the remote or local GITEA instance
|
||||||
|
|
||||||
|
optional:
|
||||||
|
|
||||||
|
* \<local\> will migrate into your local GITEA (in config), otherwise remote GITEA
|
||||||
|
|
||||||
|
Does:
|
||||||
|
|
||||||
|
Rename spec file
|
||||||
|
Set current date in change log
|
||||||
|
Set Wiki and Issues links external (SME Wiki and Bugzilla)
|
||||||
|
|
||||||
|
## git-make-release.sh
|
||||||
|
Create a release and upload the rpm (src and bin) as attachments to that release
|
||||||
|
|
||||||
|
* \<repository\> repository (package) to be editted (e.g. smeserver-yum)
|
||||||
|
* \<draft | prerelease> create draft or prerelease else it will create full stable release
|
||||||
|
* \<organisation\> can be any organisation or user on the remote or local GITEA instance
|
||||||
|
* \<release-tag\> will have "SME" added to the front of it (so e.g. 10.2 -> SME10.2)
|
||||||
|
|
||||||
|
optional: (in any order)
|
||||||
|
|
||||||
|
* \<local\> used with org= and will use local GITEA instance, default remote - will be passed to \<script\>
|
||||||
|
* \<noisy\> show line being executed
|
||||||
|
* \<debug\> run in debug mode
|
||||||
|
* \<draft\> create a draft release
|
||||||
|
* \<prerelease\> create a pre-release
|
||||||
|
|
||||||
|
Note that no release type will give a full stable release
|
||||||
|
|
||||||
|
Does:
|
||||||
|
|
||||||
|
Create the release (deleting one that is the same tag),
|
||||||
|
Then uploads the .src.rpm and .rpm as an attachment (deleting any one of the same name)
|
||||||
|
|
||||||
|
## git-list-all-org-repos.sh
|
||||||
|
List the repos in any one organisation and optionally show the release and some associated fields
|
||||||
|
|
||||||
|
* \<organisation\> can be any organisation or user on the remote or local GITEA instance
|
||||||
|
|
||||||
|
optional: (in any order)
|
||||||
|
|
||||||
|
* \<local\> used with org= and will use local GITEA instance, default remote - will be passed to \<script\>
|
||||||
|
* \<noisy\> show line being executed
|
||||||
|
* \<debug\> run in debug mode
|
||||||
|
* \<draftrelease\> Show all draft releases
|
||||||
|
* \<prerelease\> Show all prereleases
|
||||||
|
* \<release\> Show all full releases
|
||||||
|
* \<allreleases\> Show all releases
|
||||||
|
* \<cloneurl\> Show the url to use to clone this repo
|
||||||
|
* \<zipurl\> Show the url to get the zipped contents of the repo
|
||||||
|
* \<asseturls\> Show the URLs of the assets associated with the release
|
||||||
|
|
||||||
|
Does:
|
||||||
|
|
||||||
|
Display a "table" of each repo and the optional extras requested.
|
||||||
|
|
||||||
|
## git-update-release-in-one-repo.sh
|
||||||
|
Update the release (draft/prerelease/release)
|
||||||
|
|
||||||
|
* \<organisation\> can be any organisation or user on the remote or local GITEA instance
|
||||||
|
* \<repo\> name of the repo (package)
|
||||||
|
* \<releasetag\> Full tag of the release (inc SME if applicable) OR
|
||||||
|
* \<id\>
|
||||||
|
* draft|prerelease|release
|
||||||
|
|
||||||
|
|
||||||
|
optional: (in any order)
|
||||||
|
|
||||||
|
* \<local\> used with org= and will use local GITEA instance, default remote - will be passed to \<script\>
|
||||||
|
* \<debug\> run in debug mode
|
||||||
|
|
||||||
|
Does:
|
||||||
|
|
||||||
|
Resets the release specified to the type specified.
|
||||||
|
|
||||||
|
## git-get-latest-tag.sh
|
||||||
|
|
||||||
|
Return the newest tag for the repo
|
||||||
|
|
||||||
|
* \<repo\> name of the repo (package)
|
||||||
|
* \<organisation\> can be any organisation or user on the remote or local GITEA instance
|
||||||
|
|
||||||
|
## github-make-push-mirror.sh
|
||||||
|
|
||||||
|
Create a repo on github.com and add a push mirror entry to the equivalent gitea repo.
|
||||||
|
|
||||||
|
* \<repo\> Name of the repo
|
||||||
|
* \<organisation\> Name of the organisation in GITEA
|
||||||
|
* \<github organisation\> Name of the organisation in GITHUB
|
||||||
|
|
||||||
|
Note that .smegit/conf needd GITHUBTOKEN and GITHUBLOGIN the token must have the necessary permissions. Either fine-grain token or one of the orginal tokens. Created through settings/developer tools/api tokens on github.com.
|
||||||
|
|
||||||
|
Also need to login in to github using `gh auth login` before running the command.
|
||||||
|
|
||||||
|
|
||||||
|
6
config
6
config
@@ -2,9 +2,9 @@
|
|||||||
DEBUG=false
|
DEBUG=false
|
||||||
# if first character ~ will be relative to users home, otherwise absolute
|
# if first character ~ will be relative to users home, otherwise absolute
|
||||||
WORKDIR=~/smegit
|
WORKDIR=~/smegit
|
||||||
COMMONREPO=https://src.koozali.org/smedev/common.git
|
COMMONREPO=https://src.koozali.org/smeserver/common.git
|
||||||
# Brian's token, but please use wisely!
|
# OpenAI key for readme comment lookup.
|
||||||
OPENAI_API_KEY=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
|
OPENAI_API_KEY=<key - ask Brian for his..>
|
||||||
[local]
|
[local]
|
||||||
USER=<local GITEA user name>
|
USER=<local GITEA user name>
|
||||||
GITEAHOST=<local GITEA URL>
|
GITEAHOST=<local GITEA URL>
|
||||||
|
@@ -77,12 +77,12 @@ if [ $NOISY ] ; then echo "git-cvs2git.sh $1 $2 $3 $4 $5 $6" ; fi
|
|||||||
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
||||||
# Make this null if you want lots of output. Still quite a bit anyway
|
# Make this null if you want lots of output. Still quite a bit anyway
|
||||||
QUIET="-q"
|
QUIET="-q"
|
||||||
curlsilent="-s"
|
SILENT4CURL="-s"
|
||||||
suppress=" &> /dev/null"
|
SILENT4MAKE="-s"
|
||||||
if [ $DEBUG ] ; then
|
if [ $DEBUG ] ; then
|
||||||
QUIET=
|
QUIET=
|
||||||
curlsilent="-v"
|
SILENT4CURL="-v"
|
||||||
suppress=
|
SILENT4MAKE=
|
||||||
fi
|
fi
|
||||||
# Make this null to get curl to check ssl cert
|
# Make this null to get curl to check ssl cert
|
||||||
checkSSL="-k"
|
checkSSL="-k"
|
||||||
@@ -144,12 +144,23 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# Check that lua is installed (needed for change-log)
|
||||||
|
if command -v lua -V > /dev/null; then
|
||||||
|
if [ $DEBUG ] ; then echo "************lua is installed" ; fi
|
||||||
|
else
|
||||||
|
echo "ERROR********************** lua is not installed (try EPEL)**************"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# and check for the special scripts - changelog and BogusDateBot.sh - I think these are available in the
|
# and check for the special scripts - changelog and BogusDateBot.sh - I think these are available in the
|
||||||
# mockbuild rpm, but beware Bug:12340 - changelog needs an edit to work!
|
# mockbuild rpm, but beware Bug:12340 - changelog needs an edit to work!
|
||||||
if type -P change-log >/dev/null 2>&1; then
|
if type -P change-log >/dev/null 2>&1; then
|
||||||
if [ $DEBUG ] ; then echo "************change-log is installed" ; fi
|
if [ $DEBUG ] ; then echo "************change-log is installed" ; fi
|
||||||
else
|
else
|
||||||
echo "ERROR********************change-log is not installed*********** (try installing smeserver-mockbuild)"
|
echo "ERROR********************change-log is not installed*********** (try installing smeserver-mockbuild)"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
if [ $DEBUG ] ; then echo "************..and also note bug:12340" ; fi
|
if [ $DEBUG ] ; then echo "************..and also note bug:12340" ; fi
|
||||||
|
|
||||||
@@ -157,6 +168,7 @@ if type -P BogusDateBot.sh >/dev/null 2>&1; then
|
|||||||
if [ $DEBUG ] ; then echo "************BogusDateBot.sh is installed"; fi
|
if [ $DEBUG ] ; then echo "************BogusDateBot.sh is installed"; fi
|
||||||
else
|
else
|
||||||
echo "ERROR********************BogusDateBot.sh is not installed*********** (try installing smeserver-mockbuild)"
|
echo "ERROR********************BogusDateBot.sh is not installed*********** (try installing smeserver-mockbuild)"
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create work directories
|
# Create work directories
|
||||||
@@ -225,7 +237,7 @@ if [[ $GOTONE -eq 0 ]] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Create the local Git repository
|
# Create the local Git repository
|
||||||
GITFiles=$WORKDIR/GITFiles/$ORGGITEA
|
GITFiles=$WORKDIR/$ORGGITEA
|
||||||
mkdir -p $GITFiles
|
mkdir -p $GITFiles
|
||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
|
|
||||||
@@ -239,7 +251,7 @@ fi
|
|||||||
REPO_NAME=$1
|
REPO_NAME=$1
|
||||||
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$REPO_NAME exists" ; fi
|
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$REPO_NAME exists" ; fi
|
||||||
READMECONTENTS=
|
READMECONTENTS=
|
||||||
RESPONSE=$(curl $checkSSL $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME")
|
RESPONSE=$(curl $checkSSL $SILENT4CURL -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME")
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
if [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi
|
if [ $DEBUG ] ; then echo "************Repository for $1 already exists!" ; fi
|
||||||
# If so, clone it (just want the README.md)
|
# If so, clone it (just want the README.md)
|
||||||
@@ -253,7 +265,7 @@ if [ "$RESPONSE" == "200" ]; then
|
|||||||
fi
|
fi
|
||||||
# Now delete the repo, re-create it and clone it in to local
|
# Now delete the repo, re-create it and clone it in to local
|
||||||
if [ $DEBUG ] ; then echo "Delete $ORGGITEA/$1" ; fi
|
if [ $DEBUG ] ; then echo "Delete $ORGGITEA/$1" ; fi
|
||||||
RESPONSE=$(curl "$checkSSL" "$curlsilent" -o /dev/null -w "%{http_code}" -X 'DELETE' \
|
RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -o /dev/null -w "%{http_code}" -X 'DELETE' \
|
||||||
"$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \
|
"$GITEAHOST/api/v1/repos/$ORGGITEA/$1" \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H "Authorization: token $GITEAACCESSTOKEN")
|
-H "Authorization: token $GITEAACCESSTOKEN")
|
||||||
@@ -279,7 +291,7 @@ cd $GITFiles
|
|||||||
# Re-create the repo
|
# Re-create the repo
|
||||||
#
|
#
|
||||||
if [ $DEBUG ] ; then echo "************Creating repo for $1 $PACKAGETYPE" ; fi
|
if [ $DEBUG ] ; then echo "************Creating repo for $1 $PACKAGETYPE" ; fi
|
||||||
RESPONSE=$(curl "$checkSSL" "$curlsilent" -X 'POST' \
|
RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -X 'POST' \
|
||||||
"$GITEAHOST/api/v1/orgs/$ORGGITEA/repos" \
|
"$GITEAHOST/api/v1/orgs/$ORGGITEA/repos" \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H "Authorization: token $GITEAACCESSTOKEN" \
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
@@ -310,7 +322,7 @@ if [[ -z "${HTTP_URL}" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# And check it now exists
|
# And check it now exists
|
||||||
RESPONSE=$(curl "$curlsilent" -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$1")
|
RESPONSE=$(curl "$SILENT4CURL" -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$1")
|
||||||
if [[ "$RESPONSE" == "200" ]]; then
|
if [[ "$RESPONSE" == "200" ]]; then
|
||||||
if [ $DEBUG ] ; then echo "************Repository for $1 exists" ; fi
|
if [ $DEBUG ] ; then echo "************Repository for $1 exists" ; fi
|
||||||
else
|
else
|
||||||
@@ -333,7 +345,8 @@ cd $CVSFiles/$1/$BASEORCONTRIB
|
|||||||
# Fully populate the directory (gets the tar file - which is not strictly in CVS) and creates the directory source tree
|
# Fully populate the directory (gets the tar file - which is not strictly in CVS) and creates the directory source tree
|
||||||
# applying the patches to the base in the tar file.
|
# applying the patches to the base in the tar file.
|
||||||
# Might need to replace this by the code from the makefile if we decide to move "make prep" to git moe likely we'll implement a new one "make gitprep".
|
# Might need to replace this by the code from the makefile if we decide to move "make prep" to git moe likely we'll implement a new one "make gitprep".
|
||||||
make prep "$suppress"
|
make $SILENT4MAKE prep
|
||||||
|
#echo `pwd`; exit 0
|
||||||
|
|
||||||
# Extract the directory name for the file tree (it will include the name of the module plus some version information)
|
# Extract the directory name for the file tree (it will include the name of the module plus some version information)
|
||||||
# Same trick that we use in the makefile.common - taking the name and verison from the .spec file.
|
# Same trick that we use in the makefile.common - taking the name and verison from the .spec file.
|
||||||
@@ -500,9 +513,9 @@ else
|
|||||||
# Third party package
|
# Third party package
|
||||||
# copy over the archive file and make sure the extension is tracked by git-lfs
|
# copy over the archive file and make sure the extension is tracked by git-lfs
|
||||||
if [ $DEBUG ] ; then echo "************Found 3rd party package $NAME" ; fi
|
if [ $DEBUG ] ; then echo "************Found 3rd party package $NAME" ; fi
|
||||||
git lfs install $QUIET
|
git lfs install
|
||||||
git lfs track "*.$EXT" $QUIET
|
git lfs track "*.$EXT"
|
||||||
git add .gitattributes $QUIET
|
git add .gitattributes
|
||||||
#git config lfs.http://gitea.bjsystems.co.uk/SMEContribs/bugzilla.git/info/lfs.locksverify true
|
#git config lfs.http://gitea.bjsystems.co.uk/SMEContribs/bugzilla.git/info/lfs.locksverify true
|
||||||
if [[ -f $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE ]] ; then
|
if [[ -f $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE ]] ; then
|
||||||
if [ $DEBUG ] ; then echo "************Copying archivefile $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE" ; fi
|
if [ $DEBUG ] ; then echo "************Copying archivefile $CVSFiles/$1/$BASEORCONTRIB/$ARCHIVEFILE" ; fi
|
||||||
@@ -514,24 +527,37 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
cd $GITFiles/$1
|
cd $GITFiles/$1
|
||||||
if [[ $ARCHIVEFILE != "$TREEPATH.tar.gz" ]] ; then
|
#if [[ $ARCHIVEFILE != "$TREEPATH.tar.gz" ]] ; then
|
||||||
echo "$ARCHIVEFILE" > archivefilename
|
# echo "$ARCHIVEFILE" > archivefilename
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
# Take out any bogus dates:
|
# Take out any bogus dates:
|
||||||
/usr/bin/BogusDateBot.sh $(basename $SPECFILE) "$suppress"
|
BogusDateBot.sh $(basename $SPECFILE)
|
||||||
|
|
||||||
# If it is an SME package, take out the patches and then update the release.
|
# If it is an SME package, take out the patches and then update the release.
|
||||||
if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
||||||
# Now edit the spec file to remove all those patches and adjust the paths
|
# Now edit the spec file to remove all those patches and adjust the paths
|
||||||
sed -i '/^Patch/d; /^%patch/d' $(basename $SPECFILE)
|
sed -i '/^Patch/d; /^%patch/d' $(basename $SPECFILE)
|
||||||
# no paths need adjusting at this time!
|
# no paths need adjusting at this time!
|
||||||
|
# - change Source: to new standard of tar.xz
|
||||||
|
sed -i '/^Source:/s/tar.gz/tar.xz/;s/tgz/tar.xz/' $(basename $SPECFILE)
|
||||||
# Bump the release and add changelog
|
# Bump the release and add changelog
|
||||||
change-log $(basename $SPECFILE) "$suppress"
|
change-log $(basename $SPECFILE)
|
||||||
# and edit in the reason
|
# and edit in the reason
|
||||||
# sed - TBD - to look for "fix [SME: ]"
|
# sed - TBD - to look for "fix [SME: ]"
|
||||||
sed -i 's/fix \[SME: \]/Roll up patches and move to git repo \[SME: 12338\]/' $(basename $SPECFILE)
|
sed -i 's/fix \[SME: \]/Roll up patches and move to git repo \[SME: 12338\]/' $(basename $SPECFILE)
|
||||||
sed -i 's/ME MYSELF <myemail@koozali.org>/cvs2git.sh aka Brian Read <brianr@koozali.org>/' $(basename $SPECFILE)
|
sed -i 's/ME MYSELF <myemail@koozali.org>/cvs2git.sh aka Brian Read <brianr@koozali.org>/' $(basename $SPECFILE)
|
||||||
|
# package specific changes needed because we use make prep to create the root tree
|
||||||
|
if [[ $NAME == "e-smith-grub" ]] ; then
|
||||||
|
sed -i '/^Source1:/d' $(basename $SPECFILE)
|
||||||
|
sed -i '/^Source2:/d' $(basename $SPECFILE)
|
||||||
|
sed -i '/^%setup/{n;N;N;N;d}' $(basename $SPECFILE)
|
||||||
|
sed -i '/\[SME: 12338\]/a - Remove Source1 & Source2 \[SME: 12338\]' $(basename $SPECFILE)
|
||||||
|
fi
|
||||||
|
if [[ $NAME == "e-smith-lib" ]] ; then
|
||||||
|
sed -i '/^%setup/{n;N;d}' $(basename $SPECFILE)
|
||||||
|
sed -i '/\[SME: 12338\]/a - Remove create e-smith-lib-update event \[SME: 12338\]' $(basename $SPECFILE)
|
||||||
|
fi
|
||||||
# Add in the autochangelog and autorelease macros into the spec file
|
# Add in the autochangelog and autorelease macros into the spec file
|
||||||
# Commented out for now until we have build systems that can install the rpmautospec package (CEntos, Rocky etc V9 only so far)
|
# Commented out for now until we have build systems that can install the rpmautospec package (CEntos, Rocky etc V9 only so far)
|
||||||
# sed -i 's/Release:.*/Release: %autorelease/' $(basename $SPECFILE)
|
# sed -i 's/Release:.*/Release: %autorelease/' $(basename $SPECFILE)
|
||||||
@@ -577,9 +603,6 @@ else
|
|||||||
git pull $QUIET
|
git pull $QUIET
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Now make sure that the make-archive is executible
|
|
||||||
chmod +x $GITFiles/common/make-archive.sh
|
|
||||||
|
|
||||||
# Edit the Readme.md - try to add a link to the wiki for this package - only if it is an SME package
|
# Edit the Readme.md - try to add a link to the wiki for this package - only if it is an SME package
|
||||||
cd $GITFiles/$1
|
cd $GITFiles/$1
|
||||||
if [ $DEBUG ] ; then echo "************READMECONTENTS:$READMECONTENTS" ; fi
|
if [ $DEBUG ] ; then echo "************READMECONTENTS:$READMECONTENTS" ; fi
|
||||||
@@ -646,7 +669,7 @@ if [[ "$NAME" =~ ^(smeserver-|e-smith-).* ]]; then
|
|||||||
model="text-davinci-003"
|
model="text-davinci-003"
|
||||||
temperature=0.8
|
temperature=0.8
|
||||||
# Send the request to the API
|
# Send the request to the API
|
||||||
response=$(curl "$curlsilent" -X POST https://api.openai.com/v1/engines/$model/completions \
|
response=$(curl "$SILENT4CURL" -X POST https://api.openai.com/v1/engines/$model/completions \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||||||
-d '{"prompt": "'"$prompt"'", "temperature": 0.8, "max_tokens": 256}')
|
-d '{"prompt": "'"$prompt"'", "temperature": 0.8, "max_tokens": 256}')
|
||||||
@@ -670,7 +693,7 @@ else
|
|||||||
model="text-davinci-003"
|
model="text-davinci-003"
|
||||||
temperature=0.8
|
temperature=0.8
|
||||||
# Send the request to the API
|
# Send the request to the API
|
||||||
response=$(curl "$curlsilent" -X POST https://api.openai.com/v1/engines/$model/completions \
|
response=$(curl "$SILENT4CURL" -X POST https://api.openai.com/v1/engines/$model/completions \
|
||||||
-H "Content-Type: application/json" \
|
-H "Content-Type: application/json" \
|
||||||
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
-H "Authorization: Bearer $OPENAI_API_KEY" \
|
||||||
-d '{"prompt": "'"$prompt"'", "temperature": 0.8, "max_tokens": 256}')
|
-d '{"prompt": "'"$prompt"'", "temperature": 0.8, "max_tokens": 256}')
|
||||||
@@ -695,7 +718,7 @@ if [[ -z $WIKILINK ]] ; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# and then update the repo parameters
|
# and then update the repo parameters
|
||||||
RESPONSE=$(curl "$curlsilent" -X 'PATCH' "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME" \
|
RESPONSE=$(curl "$SILENT4CURL" -X 'PATCH' "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME" \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H "Authorization: token $GITEAACCESSTOKEN" \
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
@@ -731,7 +754,9 @@ git push --force -u $QUIET origin master
|
|||||||
|
|
||||||
# Now create the version and release tag for these files
|
# Now create the version and release tag for these files
|
||||||
RELEASE=`rpm --queryformat '%{release}\n' --specfile $NAME.spec | head -n 1`
|
RELEASE=`rpm --queryformat '%{release}\n' --specfile $NAME.spec | head -n 1`
|
||||||
TAG=$VERSION-$RELEASE
|
# Release is not reliable - if you run on Rocky it comes back EL8, centos 7 - EL7
|
||||||
|
# So, we need to just take the build part (first word)
|
||||||
|
TAG=$VERSION"-"${RELEASE%.*}
|
||||||
git tag -a $TAG -m "$COMMENT"
|
git tag -a $TAG -m "$COMMENT"
|
||||||
git push origin $TAG $QUIET
|
git push origin $TAG $QUIET
|
||||||
|
|
||||||
|
84
git-delete-release-in-one-rep.sh
Executable file
84
git-delete-release-in-one-rep.sh
Executable file
@@ -0,0 +1,84 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# git-delete-release-in-one-rep.sh <organisation> <repo> [ <releasetag> | <id> ]
|
||||||
|
#
|
||||||
|
# Create the release (deleting one that is the same tag),
|
||||||
|
# then uploads the .src.rpm and .rpm as an attachment (deleting any one of the same name)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "git-delete-release-in-one-rep.sh <organisation> <repo> <organisation> <repo> [ <releasetag> | <id> ] [local] [debug]"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
|
#
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
|
echo "git-delete-release-in-one-rep.sh <organisation> <repo> <organisation> <repo> [ <releasetag> | <id> ] [local] [debug]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
initfilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
|
||||||
|
DEBUG=
|
||||||
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
for param in $2 $3 $4 $5 $6 $7; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
local )
|
||||||
|
GITEAUser=${local_USER}
|
||||||
|
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
* )
|
||||||
|
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Uses if ist char is numeric to see if an id or tag is provided
|
||||||
|
if [[ ! "${3:0:1}" =~ [0-9] ]]; then
|
||||||
|
# <organisation> <repo> <releasetag> - find the id from the info provided
|
||||||
|
ID=999;
|
||||||
|
# TBD
|
||||||
|
else
|
||||||
|
ID=$3;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $DEBUG ]; then echo "I:$ID"; fi
|
||||||
|
|
||||||
|
# And then delete it by id.
|
||||||
|
RESPONSE=$(curl -s -X 'DELETE' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases/$ID" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN")
|
||||||
|
if [ $DEBUG ]; then echo "$RESPONSE"; fi
|
||||||
|
exit 0
|
70
git-edit-readme.sh
Executable file
70
git-edit-readme.sh
Executable file
@@ -0,0 +1,70 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# git-edit-readme.sh
|
||||||
|
#
|
||||||
|
# Edit the README.md for an smeserver package and alter the Bugzilla link
|
||||||
|
#
|
||||||
|
# $1 = package name
|
||||||
|
|
||||||
|
ORG=smecontribs # or smeserver
|
||||||
|
|
||||||
|
echo "$ORG / $1"
|
||||||
|
|
||||||
|
cd ~/GITFiles/$ORG
|
||||||
|
if [ -d "$1" ]; then
|
||||||
|
cd "$1"
|
||||||
|
git pull
|
||||||
|
else
|
||||||
|
git clone "https://src.koozali.org/$ORG/$1"
|
||||||
|
cd "$1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Current directory: `pwd`"
|
||||||
|
|
||||||
|
if [ -f "README.md" ]; then
|
||||||
|
echo "Running awk to update README.md"
|
||||||
|
|
||||||
|
# Use a temporary file to handle multi-line replacement
|
||||||
|
awk '/Show list of outstanding bugs: \[here\]/{
|
||||||
|
print "Show list of outstanding bugs:"
|
||||||
|
print "[All](https://bugs.koozali.org/buglist.cgi?action=wrap" \
|
||||||
|
"&bug_status=UNCONFIRMED&bug_status=CONFIRMED" \
|
||||||
|
"&bug_status=NEEDINFO&bug_status=IN_PROGRESS" \
|
||||||
|
"&bug_status=RESOLVED&bug_status=VERIFIED" \
|
||||||
|
"&classification=Contribs&component='"$1"'&list_id=105781" \
|
||||||
|
"&order=changeddate+DESC%2Ccomponent%2Cpriority" \
|
||||||
|
"%2Cbug_severity&product=SME+Contribs&query_format=advanced) "
|
||||||
|
print "[Confirmed](https://bugs.koozali.org/buglist.cgi?action=wrap" \
|
||||||
|
"&bug_status=CONFIRMED&classification=Contribs&component='"$1"'" \
|
||||||
|
"&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \
|
||||||
|
"%2Cbug_severity&product=SME+Contribs&query_format=advanced) "
|
||||||
|
print "[Unconfirmed](https://bugs.koozali.org/buglist.cgi?action=wrap" \
|
||||||
|
"&bug_status=UNCONFIRMED&classification=Contribs&component='"$1"'" \
|
||||||
|
"&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \
|
||||||
|
"%2Cbug_severity&product=SME+Contribs&query_format=advanced) "
|
||||||
|
print "[Need Info](https://bugs.koozali.org/buglist.cgi?action=wrap" \
|
||||||
|
"&bug_status=NEEDINFO&classification=Contribs&component='"$1"'" \
|
||||||
|
"&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \
|
||||||
|
"%2Cbug_severity&product=SME+Contribs&query_format=advanced) "
|
||||||
|
print "[In Progress](https://bugs.koozali.org/buglist.cgi?action=wrap" \
|
||||||
|
"&bug_status=IN_PROGRESS&classification=Contribs&component='"$1"'" \
|
||||||
|
"&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \
|
||||||
|
"%2Cbug_severity&product=SME+Contribs&query_format=advanced) "
|
||||||
|
print "[Verified](https://bugs.koozali.org/buglist.cgi?action=wrap" \
|
||||||
|
"&bug_status=VERIFIED&classification=Contribs&component='"$1"'" \
|
||||||
|
"&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \
|
||||||
|
"%2Cbug_severity&product=SME+Contribs&query_format=advanced) "
|
||||||
|
print "[Resolved](https://bugs.koozali.org/buglist.cgi?action=wrap" \
|
||||||
|
"&bug_status=RESOLVED&classification=Contribs&component='"$1"'" \
|
||||||
|
"&list_id=105781&order=changeddate+DESC%2Ccomponent%2Cpriority" \
|
||||||
|
"%2Cbug_severity&product=SME+Contribs&query_format=advanced) "
|
||||||
|
next
|
||||||
|
}1' README.md > README.tmp && mv README.tmp README.md
|
||||||
|
|
||||||
|
git status
|
||||||
|
git add --all
|
||||||
|
git commit -m "Update README with specific Bugzilla links"
|
||||||
|
git push
|
||||||
|
else
|
||||||
|
echo "README.md not found in $1"
|
||||||
|
fi
|
57
git-get-latest-tag.sh
Executable file
57
git-get-latest-tag.sh
Executable file
@@ -0,0 +1,57 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
if [[ $# -ne 2 ]]; then
|
||||||
|
echo "git-get-latest-tag.sh <modulename> <organisation>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
|
echo "git-cvs2git.sh <modulename> <organization> [<local>]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
initfilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
|
||||||
|
DEBUG=
|
||||||
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
|
|
||||||
|
# Check that jq is installed
|
||||||
|
if command -v jq -V > /dev/null; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Jq is installed" ; fi
|
||||||
|
else
|
||||||
|
echo "ERROR********************** jq is not installed (try EPEL)**************"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
|
||||||
|
REPO_OWNER="$2"
|
||||||
|
REPO_NAME="$1"
|
||||||
|
|
||||||
|
# Send request to Gitea API to get the list of tags
|
||||||
|
LATEST_TAG=$(curl -H "Authorization: token $GITEAACCESSTOKEN" -s $GITEAHOST/api/v1/repos/$REPO_OWNER/$REPO_NAME/tags | jq -r '.[0].name')
|
||||||
|
|
||||||
|
# Print the latest tag
|
||||||
|
echo "Latest tag for the repository $REPO_NAME is: $LATEST_TAG"
|
@@ -8,7 +8,7 @@ if [ ! -e $inifilename ] ; then
|
|||||||
# Not here, look at system default
|
# Not here, look at system default
|
||||||
if [ ! -e /etc/smegit.ini ] ; then
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
echo "No ini file found $inifiename or /etc/smegit.ini"
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
echo "get-repo-and-build.sh <organisation> <reponame> [<local>]"
|
echo "get-repo-and-build.sh <organisation> <reponame> [branch=<branch> <local> <debug>]"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
initfilename="/etc/smegit.ini"
|
initfilename="/etc/smegit.ini"
|
||||||
@@ -30,27 +30,45 @@ while read -r line || [[ -n "$line" ]]; do
|
|||||||
done < "$inifilename"
|
done < "$inifilename"
|
||||||
|
|
||||||
if [[ -z $1 && -z $2 ]] ; then
|
if [[ -z $1 && -z $2 ]] ; then
|
||||||
echo "get-repo-and-build.sh <organisation> <reponame> [<local>]"
|
echo "get-repo-and-build.sh <reponame> <organisation> [<local>]"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DEBUG=
|
DEBUG=
|
||||||
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
|
||||||
if [ $DEBUG ] ; then echo "found ini file: $inifilename" ; fi
|
|
||||||
|
|
||||||
curlsilent="-s"
|
|
||||||
if [ $DEBUG ] ; then curlsilent= ; fi
|
|
||||||
|
|
||||||
GITEAHOST=${remote_GITEAHOST}
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
ACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
ACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
if [ $3 ] ; then
|
ORG_NAME="$2"
|
||||||
if [ $3 == "local" ] ; then
|
REPO_NAME="$1"
|
||||||
GITEAHOST=${local_GITEAHOST}
|
BRANCH=
|
||||||
ACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
fi
|
for param in $3 $4 $5 $6; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
branch=* )
|
||||||
|
BRANCH="--${param}"
|
||||||
|
;;
|
||||||
|
local )
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
ACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
* )
|
||||||
|
TARGETORG=$param ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
SILENT="-s"
|
||||||
|
QUIET="-q"
|
||||||
|
if [ $DEBUG ] ; then
|
||||||
|
echo "found ini file: $inifilename"
|
||||||
|
SILENT=
|
||||||
|
QUIET=
|
||||||
fi
|
fi
|
||||||
ORG_NAME="$1"
|
|
||||||
REPO_NAME="$2"
|
|
||||||
if [[ $smegit_WORKDIR == ~* ]] ; then
|
if [[ $smegit_WORKDIR == ~* ]] ; then
|
||||||
# relative to users home dir
|
# relative to users home dir
|
||||||
WORKDIR=$(echo ~)${smegit_WORKDIR:1}
|
WORKDIR=$(echo ~)${smegit_WORKDIR:1}
|
||||||
@@ -59,7 +77,7 @@ else
|
|||||||
WORKDIR=${smegit_WORKDIR}
|
WORKDIR=${smegit_WORKDIR}
|
||||||
fi
|
fi
|
||||||
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
||||||
GITFiles=$WORKDIR/GITFiles/$ORG_NAME
|
GITFiles=$WORKDIR/$ORG_NAME
|
||||||
REPOURL="$GITEAHOST/$ORG_NAME/$REPO_NAME.git"
|
REPOURL="$GITEAHOST/$ORG_NAME/$REPO_NAME.git"
|
||||||
|
|
||||||
if [ $DEBUG ] ; then echo "getting $REPO_NAME from $ORG_NAME on $GITEAHOST" ; fi
|
if [ $DEBUG ] ; then echo "getting $REPO_NAME from $ORG_NAME on $GITEAHOST" ; fi
|
||||||
@@ -75,81 +93,82 @@ if [ $DEBUG ] ; then echo $GITFiles ; fi
|
|||||||
# See if it already exists
|
# See if it already exists
|
||||||
if [ ! -e $GITFiles/common ]; then
|
if [ ! -e $GITFiles/common ]; then
|
||||||
#Get it
|
#Get it
|
||||||
|
if [ $DEBUG ] ; then echo "clone common" ; fi
|
||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
git clone "${smegit_COMMONREPO}"
|
git clone "${smegit_COMMONREPO}" $QUIET
|
||||||
if [ ! -e $GITFiles/common ]; then
|
if [ ! -e $GITFiles/common ]; then
|
||||||
echo "ERROR*******No Common Repo found - package $1"
|
echo "ERROR*******No Common Repo found - package $REPO_NAME"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# Just refresh it
|
# Just refresh it
|
||||||
|
if [ $DEBUG ] ; then echo "refresh common" ; fi
|
||||||
cd $GITFiles/common
|
cd $GITFiles/common
|
||||||
git pull
|
git pull
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Now make sure that the make-archive is executible
|
|
||||||
chmod +x $GITFiles/common/make-archive.sh
|
|
||||||
|
|
||||||
# See if repo exits in git
|
# See if repo exits in git
|
||||||
RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME")
|
if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi
|
||||||
|
BRANCHES=
|
||||||
|
if [ $BRANCH ] ; then BRANCHES="/branches/${BRANCH#*=}" ; fi
|
||||||
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME$BRANCHES")
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
if [ $DEBUG ] ; then echo "Repository for $1/$2 exists!" ; fi
|
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME exists!" ; fi
|
||||||
else
|
else
|
||||||
if [ $DEBUG ] ; then echo "Repository for $1/$2 does not exist" ; fi
|
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME does not exist" ; fi
|
||||||
logname="git-cvs2git-create-$2-$1-$(date +'%FT%H%M').log"
|
if [ $BRANCH ] ; then
|
||||||
while true; do
|
echo "Can't find the ${BRANCH#*=} branch of $ORG_NAME/$REPO_NAME - exiting"
|
||||||
read -p "Do you wish to run git-cvs2git?(y/n) " yn
|
exit 1
|
||||||
case $yn in
|
else
|
||||||
[Yy]* ) git-cvs2git.sh "$REPO_NAME" "$ORG_NAME" > $logname; break;;
|
while true; do
|
||||||
[Nn]* ) exit;;
|
read -p "Do you wish to run git-cvs2git?(y/n) " yn
|
||||||
* ) echo "Please answer yes or no.";;
|
case $yn in
|
||||||
esac
|
[Yy]* )
|
||||||
done
|
if [ $DEBUG ] ; then echo "running git-cvs2git.sh" ; fi
|
||||||
|
logname="git-cvs2git-create-$ORG_NAME-$REPO_NAME-$(date +'%FT%H%M').log"
|
||||||
|
git-cvs2git.sh "$REPO_NAME" "$ORG_NAME" > $logname
|
||||||
|
break;;
|
||||||
|
[Nn]* ) exit;;
|
||||||
|
* ) echo "Please answer yes or no.";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
# And check it is now there
|
# And check it is now there
|
||||||
RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME")
|
if [ $DEBUG ] ; then echo "check if $REPO_NAME in $ORG_NAME exists on $GITEAHOST" ; fi
|
||||||
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORG_NAME/$REPO_NAME$BRANCHES")
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
if [ $DEBUG ] ; then echo "Repository for $1/$2 created sucessfully!" ; fi
|
if [ $DEBUG ] ; then echo "Repository for $ORG_NAME/$REPO_NAME created sucessfully!" ; fi
|
||||||
else
|
else
|
||||||
echo "git-cvs2git.sh was unable to create $1/$2 sucessfully"
|
echo "git-cvs2git.sh was unable to create $ORG_NAME/$REPO_NAME sucessfully"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
# Ok, we have a repo!!
|
# Ok, we have a repo!!
|
||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
echo $GITFiles
|
if [ $DEBUG ] ; then echo $GITFiles ; fi
|
||||||
# Delete it if these already
|
# Delete it if these already
|
||||||
if [[ -d $REPO_NAME ]] ; then
|
if [[ -d $REPO_NAME ]] ; then
|
||||||
# Should delete everything....
|
# Should delete everything....
|
||||||
cd $GITFiles/$REPO_NAME
|
|
||||||
if [ $DEBUG ] ; then echo "Deleting all files in $GITFiles/$REPO_NAME" ; fi
|
if [ $DEBUG ] ; then echo "Deleting all files in $GITFiles/$REPO_NAME" ; fi
|
||||||
rm -rf "$REPO_NAME"
|
rm -rf "$GITFiles/$REPO_NAME"
|
||||||
fi
|
fi
|
||||||
cd $GITFiles
|
if [ $DEBUG ] ; then echo "cloning $REPOURL $BRANCH" ; fi
|
||||||
git clone "$REPOURL"
|
git clone "$REPOURL" $BRANCH $QUIET
|
||||||
|
|
||||||
|
|
||||||
cd $GITFiles
|
cd $GITFiles
|
||||||
if [[ ! -d $REPO_NAME ]] ; then
|
if [[ ! -d $GITFiles/$REPO_NAME ]] ; then
|
||||||
echo "git clone has not created the directory"
|
echo "git clone has not created the $REPO_NAME directory"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
cd $GITFiles/$REPO_NAME
|
cd $GITFiles/$REPO_NAME
|
||||||
# and run mockbuild
|
# and run mockbuild
|
||||||
logname="mockbuild-$2-$1-$(date +'%FT%H%M').log"
|
if [ $DEBUG ] ; then echo "running make mockbuild" ; fi
|
||||||
|
logname="mockbuild-$ORG_NAME-$REPO_NAME-$(date +'%FT%H%M').log"
|
||||||
if make mockbuild 2>&1 > $logname ; then
|
if make mockbuild 2>&1 > $logname ; then
|
||||||
echo "Looks like mockbuild worked for $1/$2"
|
echo "Looks like mockbuild worked for $ORG_NAME/$REPO_NAME"
|
||||||
echo "$(date +'%FT%H%M') Mockbuild worked for $1/$2 " >> $GITFiles/mockbuilds.log
|
echo "$(date +'%FT%H%M') Mockbuild worked for $ORG_NAME/$REPO_NAME " >> $GITFiles/mockbuilds.log
|
||||||
else
|
else
|
||||||
echo "Mockbuild failed"
|
echo "Mockbuild failed"
|
||||||
echo "$(date +'%FT%H%M') Mockbuild failed for $1/$2 " >> $GITFiles/mockbuilds.log
|
echo "$(date +'%FT%H%M') Mockbuild failed for $ORG_NAME/$REPO_NAME " >> $GITFiles/mockbuilds.log
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
494
git-getperl.sh
Executable file
494
git-getperl.sh
Executable file
@@ -0,0 +1,494 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# $1 = perl Module e.g. File::MMagic
|
||||||
|
# $2 = Organisation (smeserver, smecontrib or user) - default smeserver
|
||||||
|
# optional (can be in any order)
|
||||||
|
# <local> will use parameters set for local repository else it will use remote
|
||||||
|
# <debug> turn on debug regardless of ~/.smegit/config
|
||||||
|
# <noisy> print a line showing how it was called
|
||||||
|
# This works whether the repo and local files exist of not (it deletes them if necessary)
|
||||||
|
# However if the remote repo exists, it preserves the README.md file so that edits are not lost
|
||||||
|
# Also note: I have had difficulty deleting all the link files in the source tree!
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "************git-getperl.sh <modulename> <organization> [<local> | <debug> | <noisy>]"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
|
#
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
|
echo "git-getperl.sh <modulename> <organization> [<local>]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
initfilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
DEBUG=
|
||||||
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
|
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
NOISY=
|
||||||
|
EXTRAPARAMS=
|
||||||
|
MODULENAME=$1
|
||||||
|
ORGGITEA="smeserver"
|
||||||
|
for param in $2 $3 $4 $5 $6; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
local )
|
||||||
|
GITEAUser=${local_USER}
|
||||||
|
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
noisy )
|
||||||
|
NOISY=true ;;
|
||||||
|
* )
|
||||||
|
ORGGITEA=$param ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $NOISY ] ; then echo "git-getperl.sh $1 $2 $3 $4 $5 $6" ; fi
|
||||||
|
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
||||||
|
# Make this null if you want lots of output. Still quite a bit anyway
|
||||||
|
QUIET="-q"
|
||||||
|
SILENT4CURL="-s"
|
||||||
|
SILENT4MAKE="-s"
|
||||||
|
if [ $DEBUG ] ; then
|
||||||
|
QUIET=
|
||||||
|
SILENT4CURL="-v"
|
||||||
|
SILENT4MAKE=
|
||||||
|
fi
|
||||||
|
# Make this null to get curl to check ssl cert
|
||||||
|
checkSSL="-k"
|
||||||
|
|
||||||
|
LOCALUser=${local_USER}
|
||||||
|
if [[ $smegit_WORKDIR == ~* ]] ; then
|
||||||
|
# relative to users home dir
|
||||||
|
WORKDIR=$(echo ~)${smegit_WORKDIR:1}
|
||||||
|
else
|
||||||
|
# absolute path
|
||||||
|
WORKDIR=${smegit_WORKDIR}
|
||||||
|
fi
|
||||||
|
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
||||||
|
# create repo name from perl- module with :: replaced by -
|
||||||
|
IFS=::
|
||||||
|
words=()
|
||||||
|
for i in $MODULENAME; do words+=($i) ; done
|
||||||
|
RepoName="perl"
|
||||||
|
ShortName=
|
||||||
|
for word in ${words[@]}; do
|
||||||
|
RepoName="$RepoName-$word"
|
||||||
|
if [ $ShortName ] ; then
|
||||||
|
ShortName="$ShortName-$word"
|
||||||
|
else
|
||||||
|
ShortName="$word"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if [ $DEBUG ] ; then echo "RepoName=$RepoName" ; fi
|
||||||
|
IFS="${IFS:0:3}"
|
||||||
|
RemoteRepoURL="$GITEAHOST/$ORGGITEA/$RepoName"
|
||||||
|
|
||||||
|
COMMONREPO=${smegit_COMMONREPO}
|
||||||
|
|
||||||
|
# Prepare variable for file in repo to indicate core or contrib.
|
||||||
|
# and init gitea organisation
|
||||||
|
# Adjust where we put the repo locally accordingly.
|
||||||
|
ORGGITEA="smeserver"
|
||||||
|
if [[ "$2" == "smecontribs" ]]; then
|
||||||
|
ORGGITEA=$2
|
||||||
|
BASEORCONTRIB="contribs10"
|
||||||
|
PRODUCTBUGZILLA="SME%20Contribs"
|
||||||
|
else
|
||||||
|
BASEORCONTRIB="sme10"
|
||||||
|
PRODUCTBUGZILLA="SME%20Server%2010.X"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Work out if it is an SMEServer package or a 3rd party one
|
||||||
|
PACKAGETYPE="3rd Party (Maintained by Koozali)"
|
||||||
|
|
||||||
|
# check that cpanspec is installed
|
||||||
|
if command -v cpanspec >/dev/null; then
|
||||||
|
if [ $DEBUG ] ; then echo "************cpanspec is installed"; fi
|
||||||
|
else
|
||||||
|
echo "ERROR********************cpanspec is not installed*********** (try installing cpanspec)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that git-lfs is installed
|
||||||
|
if command -v git-lfs > /dev/null; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Git LFS is installed" ; fi
|
||||||
|
else
|
||||||
|
echo "ERROR********************** Git LFS is not installed ******************"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that lua is installed (needed for change-log)
|
||||||
|
if command -v lua -V > /dev/null; then
|
||||||
|
if [ $DEBUG ] ; then echo "************lua is installed" ; fi
|
||||||
|
else
|
||||||
|
echo "ERROR********************** lua is not installed (try EPEL)**************"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# and check for the special scripts - changelog and BogusDateBot.sh - I think these are available in the
|
||||||
|
# mockbuild rpm, but beware Bug:12340 - changelog needs an edit to work!
|
||||||
|
if type -P change-log >/dev/null 2>&1; then
|
||||||
|
if [ $DEBUG ] ; then echo "************change-log is installed" ; fi
|
||||||
|
else
|
||||||
|
echo "ERROR********************change-log is not installed*********** (try installing smeserver-mockbuild)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ $DEBUG ] ; then echo "************..and also note bug:12340" ; fi
|
||||||
|
|
||||||
|
# Create work directories
|
||||||
|
cd $WORKDIR
|
||||||
|
perlFiles="$WORKDIR/$ORGGITEA/perl"
|
||||||
|
mkdir -p $perlFiles
|
||||||
|
|
||||||
|
# Make sure credentials taken from store
|
||||||
|
# The first time you pull or push it will ask for credentials and then save them in a file.
|
||||||
|
git config --global credential.helper store
|
||||||
|
|
||||||
|
#
|
||||||
|
# Create the perl repository
|
||||||
|
#
|
||||||
|
cd $perlFiles
|
||||||
|
# First delete any existing module directory tree
|
||||||
|
# if there at all
|
||||||
|
if [ -d "$RepoName" ] ; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Deleting local CVS files" ; fi
|
||||||
|
rm -Rf $perlFiles/$RepoName
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Then get it fully from CVS
|
||||||
|
mkdir -p $perlFiles/$RepoName
|
||||||
|
cd $perlFiles/$RepoName
|
||||||
|
cpanspec "$MODULENAME"
|
||||||
|
|
||||||
|
# Check that the spec file is there
|
||||||
|
# First bet is the packagename.spec
|
||||||
|
SPECFILE=$RepoName.spec
|
||||||
|
ORIGSPECFILE=$SPECFILE
|
||||||
|
GOTONE=0
|
||||||
|
if [ ! -f $SPECFILE ] ; then
|
||||||
|
# See if it is a perl package which has the perl or perl-pear taken off the front
|
||||||
|
for front in "perl-" "perl-pear-" ; do
|
||||||
|
reg="^($front).*"
|
||||||
|
echo "$front $RepoName $reg"
|
||||||
|
if [[ "$RepoName" =~ $reg ]]; then
|
||||||
|
NEWNAME="${RepoName#$front}"
|
||||||
|
#echo $NEWNAME
|
||||||
|
SPECFILE="$NEWNAME.spec"
|
||||||
|
#echo $SPECFILE
|
||||||
|
if [ -f $SPECFILE ] ; then
|
||||||
|
GOTONE=1
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
GOTONE=1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $GOTONE -eq 0 ]] ; then
|
||||||
|
echo "Cannot find .spec file: `pwd`/$ORIGSPECFILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get the tarball file extension
|
||||||
|
EXT=$(cat "$(basename $SPECFILE)" | grep -i ^Source | head -n 1 | sed -r 's/^[S|s]ource[0..9]?:\s?//' | xargs basename | sed -E 's/^([^.]*\.)(.*)$/\2/')
|
||||||
|
|
||||||
|
# Create the local Git repository
|
||||||
|
GITFiles=$WORKDIR/$ORGGITEA
|
||||||
|
mkdir -p $GITFiles
|
||||||
|
cd $GITFiles
|
||||||
|
|
||||||
|
# Delete the local first
|
||||||
|
if [ -d "$RepoName" ] ; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi
|
||||||
|
rm -Rf $GITFiles/$RepoName
|
||||||
|
fi
|
||||||
|
|
||||||
|
# See if it exists on the Gitea host
|
||||||
|
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$RepoName exists" ; fi
|
||||||
|
RESPONSE=$(curl $checkSSL $SILENT4CURL -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$RepoName")
|
||||||
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Repository for $RepoName already exists!" ; fi
|
||||||
|
# Now delete the repo, re-create it and clone it in to local
|
||||||
|
if [ $DEBUG ] ; then echo "Delete $ORGGITEA/$RepoName" ; fi
|
||||||
|
RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -o /dev/null -w "%{http_code}" -X 'DELETE' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$ORGGITEA/$RepoName" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN")
|
||||||
|
if [[ $RESPONSE == "204" || $RESPONSE == "404" ]] ; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Repository $ORGGITEA/$RepoName deleted or does not exist" ; fi
|
||||||
|
else
|
||||||
|
echo "************Can NOT delete Repository $ORGGITEA/$RepoName - results will be unknown - Aborting!"
|
||||||
|
echo "RESPONSE=$RESPONSE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
# Delete all files, links and directories
|
||||||
|
if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi
|
||||||
|
cd $GITFiles
|
||||||
|
rm -Rf $GITFiles/$RepoName
|
||||||
|
else
|
||||||
|
if [ $DEBUG ] ; then echo "************Repository for $RepoName does not exist." ; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $GITFiles
|
||||||
|
|
||||||
|
#
|
||||||
|
# Re-create the repo
|
||||||
|
#
|
||||||
|
if [ $DEBUG ] ; then echo "************Creating repo for $RepoName $PACKAGETYPE" ; fi
|
||||||
|
RESPONSE=$(curl "$checkSSL" "$SILENT4CURL" -X 'POST' \
|
||||||
|
"$GITEAHOST/api/v1/orgs/$ORGGITEA/repos" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"auto_init": true,
|
||||||
|
"default_branch": "master",
|
||||||
|
"description": "'"$PACKAGETYPE git repo for $RepoName $ORGGITEA"'",
|
||||||
|
"gitignores": "",
|
||||||
|
"issue_labels": "Default",
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"name": "'"$RepoName"'",
|
||||||
|
"private": false,
|
||||||
|
"readme": "Default",
|
||||||
|
"template": false,
|
||||||
|
"trust_model": "Default Trust Model"
|
||||||
|
}')
|
||||||
|
if [ $DEBUG ] ; then echo $RESPONSE ; fi
|
||||||
|
|
||||||
|
# And check it now exists
|
||||||
|
RESPONSE=$(curl "$SILENT4CURL" -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$RepoName")
|
||||||
|
if [[ "$RESPONSE" == "200" ]]; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Repository for $RepoName exists" ; fi
|
||||||
|
else
|
||||||
|
echo "ERROR*******Repository for $RepoName has not been created ($RESPONSE)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Tell repo to use koozali.org bugzilla and wiki - this does not work on CREATE currently - 19Apr2023
|
||||||
|
WIKILINK="https://wiki.koozali.org/$RepoName"
|
||||||
|
|
||||||
|
# and then update the repo parameters
|
||||||
|
RESPONSE=$(curl "$SILENT4CURL" -X 'PATCH' "$GITEAHOST/api/v1/repos/$ORGGITEA/$RepoName" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"external_tracker": {
|
||||||
|
"external_tracker_format": "https://bugs.koozali.org/show_bug.cgi?id={index}",
|
||||||
|
"external_tracker_style": "numeric",
|
||||||
|
"external_tracker_url": "'"https://bugs.koozali.org/buglist.cgi?component=$RepoName&product=$PRODUCTBUGZILLA"'"
|
||||||
|
},
|
||||||
|
"external_wiki": {
|
||||||
|
"external_wiki_url": "'"$WIKILINK"'"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
')
|
||||||
|
# should check response here.
|
||||||
|
if [ $DEBUG ] ; then echo $RESPONSE ; fi
|
||||||
|
#exit 0
|
||||||
|
|
||||||
|
# Pull in the auto created or updated files
|
||||||
|
cd $GITFiles
|
||||||
|
git clone "$GITEAHOST/$ORGGITEA/$RepoName.git"
|
||||||
|
|
||||||
|
if [ ! -d $GITFiles/$RepoName ] ; then
|
||||||
|
echo "ERROR*******Unable to access the new repo directory for $GITFiles/$RepoName"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Fully populate the directory (gets the tar file - which is not strictly in CVS) and creates the directory source tree
|
||||||
|
# applying the patches to the base in the tar file.
|
||||||
|
# Might need to replace this by the code from the makefile if we decide to move "make prep" to git moe likely we'll implement a new one "make gitprep".
|
||||||
|
cd $GITFiles/$RepoName
|
||||||
|
cp $perlFiles/$RepoName/* .
|
||||||
|
|
||||||
|
# create the Makefile
|
||||||
|
cat > Makefile <<- _EOT
|
||||||
|
# Makefile for source rpm: $RepoName
|
||||||
|
# \$Id: Makefile,v 1.1 2016/02/04 12:24:52 vip-ire Exp $
|
||||||
|
NAME := $RepoName
|
||||||
|
SPECFILE = \$(firstword \$(wildcard *.spec))
|
||||||
|
|
||||||
|
define find-makefile-common
|
||||||
|
for d in common ../common ../../common ; do if [ -f \$\$d/Makefile.common ] ; then if [ -f \$\$d/CVS/Root -a -w \$\$/Makefile.common ] ; then cd \$\$d ; cvs -Q update ; fi ; echo "\$\$d/Makefile.common" ; break ; fi ; done
|
||||||
|
endef
|
||||||
|
|
||||||
|
MAKEFILE_COMMON := \$(shell \$(find-makefile-common))
|
||||||
|
|
||||||
|
ifeq (\$(MAKEFILE_COMMON),)
|
||||||
|
# attept a checkout
|
||||||
|
define checkout-makefile-common
|
||||||
|
test -f CVS/Root && { cvs -Q -d \$\$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2
|
||||||
|
endef
|
||||||
|
|
||||||
|
MAKEFILE_COMMON := \$(shell \$(checkout-makefile-common))
|
||||||
|
endif
|
||||||
|
|
||||||
|
include \$(MAKEFILE_COMMON)
|
||||||
|
_EOT
|
||||||
|
|
||||||
|
# Add file indicating which release and contribs or base - this is matched by the makefile with the contents of the branch file in the common directory
|
||||||
|
# to give the details of the release (EL7/8/9/ etc)
|
||||||
|
# This assumes SME10 and contribs10 or sme10 directory names, later releases can update the value in the file and Makefile should still work.
|
||||||
|
echo "sme11" > contriborbase
|
||||||
|
|
||||||
|
# and see if the spec file is not according to specification of <packagename>.spec
|
||||||
|
# if not rename it
|
||||||
|
if [[ $SPECFILE != $ORIGSPECFILE ]] ; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Renaming specfile from $(basename $SPECFILE) $(basename $ORIGSPECFILE)" ; fi
|
||||||
|
mv "$(basename $SPECFILE)" "$(basename $ORIGSPECFILE)"
|
||||||
|
SPECFILE=$ORIGSPECFILE
|
||||||
|
fi
|
||||||
|
|
||||||
|
## and there may be extra files that maybe needed, these can be identified from the "Source" spec in the .spec files
|
||||||
|
SOURCES=$(grep -i -E '^Source[0-9]*:' $(basename $SPECFILE) | cut -d: -f2- | sed 's/ //g')
|
||||||
|
if [ $DEBUG ] ; then echo "$SOURCES" ; fi
|
||||||
|
|
||||||
|
#SOURCE=$(rpm --queryformat '$SOURCE\n' --specfile $SPECFILE | head -n 1)
|
||||||
|
for fpath in $SOURCES; do
|
||||||
|
# Needs another step incase the extraction from the spec file contains spec variables
|
||||||
|
fpathfile=$(basename $fpath)
|
||||||
|
if [ $DEBUG ] ; then echo "$fpathfile" ; fi
|
||||||
|
translatefpath=$(rpm --queryformat "$fpathfile\n" --specfile $(basename $SPECFILE) | head -n 1)
|
||||||
|
if [ $DEBUG ] ; then echo "$translatefpath" ; fi
|
||||||
|
if [[ -f $perlFiles/$RepoName/$translatefpath ]] ; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Copying $perlFiles/$RepoName/$translatefpath" ; fi
|
||||||
|
cp $perlFiles/$RepoName/$translatefpath .
|
||||||
|
else
|
||||||
|
if [ $DEBUG ] ; then echo "************Not found $perlFiles/$RepoName/$translatefpath ( $fpathfile )- so not copied" ; fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Take out the logs and rpms from the git save
|
||||||
|
echo "*.rpm" >> .gitignore
|
||||||
|
echo "*.log" >> .gitignore
|
||||||
|
# and the backed up spec file from BogusDateBot.sh
|
||||||
|
echo "*spec-20*" >>.gitignore
|
||||||
|
|
||||||
|
cd $GITFiles/$RepoName
|
||||||
|
# All perl packages are Third party packages
|
||||||
|
# copy over the archive file and make sure the extension is tracked by git-lfs
|
||||||
|
if [ $DEBUG ] ; then echo "************Found 3rd party package $NAME" ; fi
|
||||||
|
git lfs install
|
||||||
|
git lfs track "*.$EXT"
|
||||||
|
git add .gitattributes
|
||||||
|
if [[ -f $perlFiles/$RepoName/$ARCHIVEFILE ]] ; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Copying archivefile $perlFiles/$RepoName/$ARCHIVEFILE" ; fi
|
||||||
|
cp $perlFiles/$RepoName/$ARCHIVEFILE .
|
||||||
|
else
|
||||||
|
if [ $DEBUG ] ; then echo "Unable to find archivefile: $perlFiles/$RepoName/$ARCHIVEFILE - nothing copied" ; fi
|
||||||
|
fi
|
||||||
|
cd $GITFiles/$RepoName
|
||||||
|
|
||||||
|
# Add the BuildRequires now needed by el8(Rocky 8)
|
||||||
|
sed -i -e '/BuildRequires/{a\BuildRequires: perl(inc::Module::Install)' -e ':a;n;ba}' "$SPECFILE"
|
||||||
|
sed -i -e '/BuildRequires/{a\BuildRequires: perl(ExtUtils::Manifest)' -e ':a;n;ba}' "$SPECFILE"
|
||||||
|
|
||||||
|
# Re-factor the Common directory so that it is outside the repo being created.
|
||||||
|
# one Common directory for each Organisation
|
||||||
|
#
|
||||||
|
# See if it already exists
|
||||||
|
if [ ! -e $GITFiles/common ]; then
|
||||||
|
#Get it
|
||||||
|
cd $GITFiles
|
||||||
|
git clone "${smegit_COMMONREPO}"
|
||||||
|
if [ ! -e $GITFiles/common ]; then
|
||||||
|
echo "ERROR*******No Common Repo found - package $RepoName"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
# Just refresh it
|
||||||
|
cd $GITFiles/common
|
||||||
|
git pull $QUIET
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Edit the Readme.md - try to add the description from the spec file for this package
|
||||||
|
cd $GITFiles/$RepoName
|
||||||
|
DESCRIPTION=`rpm --queryformat '%{description}\n' --specfile $SPECFILE`
|
||||||
|
|
||||||
|
# create the README.md
|
||||||
|
cat > README.md <<- _EOT
|
||||||
|
# $RepoName ($MODULENAME)
|
||||||
|
|
||||||
|
SMEServer Koozali local git repo for $RepoName
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
https://metacpan.org/pod/$MODULENAME
|
||||||
|
|
||||||
|
## Bugs
|
||||||
|
CPAN bug report are [here](https://rt.cpan.org/Public/Dist/Display.html?Name=$ShortName)
|
||||||
|
|
||||||
|
Show list of Koozali outstanding bugs: [here](https://bugs.koozali.org/buglist.cgi?component=$RepoName&product=SME%20Server%2011.X&query_format=advanced&limit=0&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=CONFIRMED)
|
||||||
|
|
||||||
|
## Description
|
||||||
|
$DESCRIPTION
|
||||||
|
_EOT
|
||||||
|
|
||||||
|
cd $GITFiles/$RepoName
|
||||||
|
# stage and commit all the files created locally
|
||||||
|
git add -A
|
||||||
|
echo "$RepoName git status" >>gitstatus.log
|
||||||
|
git status >>gitstatus.log
|
||||||
|
if [ $DEBUG ] ; then git status ; fi
|
||||||
|
COMMENT="initial create of smeserver perl $MODULENAME on `date`"
|
||||||
|
git commit -m "$COMMENT" $QUIET
|
||||||
|
|
||||||
|
# push the converted git repository to the remote
|
||||||
|
git remote remove origin
|
||||||
|
git remote add origin "$GITEAHOST/$ORGGITEA/$RepoName.git"
|
||||||
|
git push --force -u $QUIET origin master
|
||||||
|
|
||||||
|
# Now create the version and release tag from the specfile
|
||||||
|
VERSION_RELEASE_LONG=`rpm --queryformat '%{version} %{release}\n' --specfile $SPECFILE`
|
||||||
|
VERSION_RELEASE=${VERSION_RELEASE_LONG%%$'\n'*}
|
||||||
|
VERSION=${VERSION_RELEASE% *}
|
||||||
|
VERSION=${VERSION//./_}
|
||||||
|
RELEASE=${VERSION_RELEASE#* }
|
||||||
|
TAG=$VERSION"-"${RELEASE%.*}
|
||||||
|
if [ $DEBUG ] ; then
|
||||||
|
echo "VERSION_RELEASE=$VERSION_RELEASE"
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "RELEASE=$RELEASE"
|
||||||
|
echo "TAG=$TAG"
|
||||||
|
fi
|
||||||
|
git pull
|
||||||
|
git tag -a $TAG -m "align tag with version and release from spec file: $TAG"
|
||||||
|
git push origin --tag $TAG $QUIET
|
||||||
|
|
||||||
|
|
||||||
|
echo "$COMMENT tag:$TAG"
|
||||||
|
exit 0
|
148
git-list-all-org-repos.sh
Executable file
148
git-list-all-org-repos.sh
Executable file
@@ -0,0 +1,148 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
# Pull in parameters from a ini file
|
||||||
|
#
|
||||||
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
|
#
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifilename or /etc/smegit.ini"
|
||||||
|
echo "git-list-all-org-repos.sh <organisation> [draftrelease | prerelease | release | allreleases] [cloneurl] [zipurl] [asseturls]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
inifilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
NOISY=
|
||||||
|
EXTRAPARAMS=
|
||||||
|
DEBUG=
|
||||||
|
for param in $2 $3 $4 $5 $6 $7 $8 $9 $10; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
local )
|
||||||
|
GITEAUser=${local_USER}
|
||||||
|
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
noisy )
|
||||||
|
NOISY=true ;;
|
||||||
|
release )
|
||||||
|
SHOWRELEASE=true;SHOWPRERELEASE=false;SHOWDRAFT=false ;;
|
||||||
|
draftrelease )
|
||||||
|
SHOWRELEASE=true;SHOWPRERELEASE=false;SHOWDRAFT=true ;;
|
||||||
|
prerelease )
|
||||||
|
SHOWRELEASE=true;SHOWPRERELEASE=true;SHOWDRAFT=false ;;
|
||||||
|
allreleases )
|
||||||
|
SHOWRELEASE=true;SHOWALLRELEASES=true ;;
|
||||||
|
cloneurl )
|
||||||
|
SHOWCLONEURL=true ;;
|
||||||
|
zipurl )
|
||||||
|
SHOWZIPURL=true ;;
|
||||||
|
id )
|
||||||
|
SHOWID=true ;;
|
||||||
|
asseturls )
|
||||||
|
SHOWASSETURLS=true ;;
|
||||||
|
* )
|
||||||
|
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "git-list-all-org-repos.sh <organisation> [draftrelease | prerelease | release | allreleases] [cloneurl] [zipurl] [asseturls]"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
ORG_NAME="$1"
|
||||||
|
PAGE_COUNTER=1
|
||||||
|
REPO_LIST=""
|
||||||
|
|
||||||
|
while true; do
|
||||||
|
REPO_PAGE=$(curl -s -H "Authorization: token $GITEAACCESSTOKEN" "$GITEAHOST/api/v1/orgs/$ORG_NAME/repos?page=$PAGE_COUNTER")
|
||||||
|
if [[ $(echo $REPO_PAGE | jq length) -eq 0 ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
REPO_LIST="$REPO_LIST $(echo $REPO_PAGE | jq -r .[].full_name | cut -d / -f 2 )"
|
||||||
|
PAGE_COUNTER=$((PAGE_COUNTER+1))
|
||||||
|
done
|
||||||
|
REPO_LIST=$(echo $REPO_LIST | tr -s '[:space:]' '\n' | sort)
|
||||||
|
for item in $REPO_LIST ; do
|
||||||
|
line=$item
|
||||||
|
if [[ $SHOWID || $SHOWRELEASE || $SHOWCLONEURL || $ZIPURL || $SHOWALLRELEASES ]] ; then
|
||||||
|
#Find and show releases
|
||||||
|
# echo "$GITEAHOST/api/v1/repos/$ORG_NAME/$item/releases?draft=true&pre-release=true&limit=100" \
|
||||||
|
# -H 'accept: application/json' \
|
||||||
|
# -H "Authorization: token $GITEAACCESSTOKEN"
|
||||||
|
if [ $SHOWALLRELEASES ] ; then
|
||||||
|
RESPONSE=$(curl -s -X 'GET' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$ORG_NAME/$item/releases" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN");
|
||||||
|
else
|
||||||
|
RESPONSE=$(curl -s -X 'GET' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$ORG_NAME/$item/releases?draft=$SHOWDRAFT&pre-release=$SHOWPRERELEASE&limit=100" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN");
|
||||||
|
fi
|
||||||
|
if [ $DEBUG ] ; then echo "$RESPONSE"; fi
|
||||||
|
if [ $SHOWRELEASE ] ; then
|
||||||
|
# Will need to use " jq 'map(.name)'" once we have more than one release.
|
||||||
|
REL=$(echo $RESPONSE | jq -r '.[0].tag_name')
|
||||||
|
ID=$(echo $RESPONSE | jq -r '.[0].id')
|
||||||
|
PRE=$(echo $RESPONSE | jq -r '.[0].prerelease')
|
||||||
|
DRAFT=$(echo $RESPONSE | jq -r '.[0].draft')
|
||||||
|
# Get assets - json for any files uploaded
|
||||||
|
ASSETS=$(echo $RESPONSE | jq -r '.[0].assets')
|
||||||
|
# Number of assets
|
||||||
|
NUMASSETS=$(echo $ASSETS | jq length)
|
||||||
|
if [ $DEBUG ]; then echo "Assets:$NUMASSETS"; fi
|
||||||
|
if [ $PRE = "true" ] ; then PRE="pre";
|
||||||
|
else PRE=""; fi
|
||||||
|
if [ $DRAFT = "true" ] ; then DRAFT="draft";
|
||||||
|
else DRAFT=""; fi
|
||||||
|
if [ $DEBUG ] ; then echo "pre:$PRE Draft:$DRAFT"; fi
|
||||||
|
if [ $DEBUG ] ; then echo $REL; fi
|
||||||
|
if [ "$REL" ] ; then line="$line $REL $ID $PRE $DRAFT $NUMASSETS"; fi
|
||||||
|
if [ $SHOWCLONEURL ] ; then
|
||||||
|
URL=$(echo $RESPONSE | jq -r '.[0].url')
|
||||||
|
if [ "$URL" ] ; then line="$line $URL"; fi
|
||||||
|
fi
|
||||||
|
if [ $SHOWZIPURL ] ; then
|
||||||
|
URL=$(echo $RESPONSE | jq -r '.[0].zipball_url')
|
||||||
|
if [ "$URL" ] ; then line="$line $URL"; fi
|
||||||
|
fi
|
||||||
|
if [[ $NUMASSETS -gt 0 && $SHOWASSETURLS ]]; then
|
||||||
|
ASSETURLS=$(echo $ASSETS | jq 'map("\(.name):\(.browser_download_url).")')
|
||||||
|
if [ $DEBUG ]; then echo "$ASSETURLS"; fi
|
||||||
|
# Turn the json into a list one on each line
|
||||||
|
ASSETURLS=$(echo $ASSETURLS | sed 's/\[//' | sed 's/\]//' | sed 's/,/\\n/g' | sed 's/\"//g')
|
||||||
|
line="$line\n$ASSETURLS";
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
echo -e $line;
|
||||||
|
done
|
255
git-make-release.sh
Executable file
255
git-make-release.sh
Executable file
@@ -0,0 +1,255 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# git-make-release.sh <organisation> <repo> <tagname> [usual options]
|
||||||
|
#
|
||||||
|
# Create the release (deleting one that is the same tag),
|
||||||
|
# then uploads the .src.rpm and .rpm as an attachment (deleting any one of the same name)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "git-make-release <modulename> <organization> <release> [local] [debug] [noisy] [draft] [prerelease]"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
|
#
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
|
echo "git-make-release <modulename> <organization> <release> [local] [debug] [noisy] [draft] [prerelease]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
initfilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
DEBUG=
|
||||||
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
|
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
NOISY=
|
||||||
|
EXTRAPARAMS=
|
||||||
|
MAKEPRE=false
|
||||||
|
MAKEDRAFT=false
|
||||||
|
for param in $4 $5 $6; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
local )
|
||||||
|
GITEAUser=${local_USER}
|
||||||
|
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
noisy )
|
||||||
|
NOISY=true ;;
|
||||||
|
draft )
|
||||||
|
MAKEDRAFT=true ;;
|
||||||
|
prerelease )
|
||||||
|
MAKEPRE=true ;;
|
||||||
|
draftpre )
|
||||||
|
MAKEPRE=true;MAKEDRAFT=true ;;
|
||||||
|
* )
|
||||||
|
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $DEBUG ] ; then echo "draft:$MAKEDRAFT*pre:$MAKEPRE"; fi
|
||||||
|
#check for release tag
|
||||||
|
if [ -z $3 ]; then
|
||||||
|
echo "Release tag not set";
|
||||||
|
exit 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $NOISY ] ; then echo "make-release $1 $2 $3 $4 $5 $6" ; fi
|
||||||
|
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
||||||
|
# Make this null if you want lots of output. Still quite a bit anyway
|
||||||
|
QUIET="-q"
|
||||||
|
SILENT4CURL="-s"
|
||||||
|
SILENT4MAKE="-s"
|
||||||
|
if [ $DEBUG ] ; then
|
||||||
|
QUIET=
|
||||||
|
SILENT4CURL="-v"
|
||||||
|
SILENT4MAKE=
|
||||||
|
fi
|
||||||
|
# Make this null to get curl to check ssl cert
|
||||||
|
checkSSL="-k"
|
||||||
|
|
||||||
|
LOCALUser=${local_USER}
|
||||||
|
if [[ $smegit_WORKDIR == ~* ]] ; then
|
||||||
|
# relative to users home dir
|
||||||
|
WORKDIR=$(echo ~)${smegit_WORKDIR:1}
|
||||||
|
else
|
||||||
|
# absolute path
|
||||||
|
WORKDIR=${smegit_WORKDIR}
|
||||||
|
fi
|
||||||
|
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
||||||
|
RemoteRepoURL="$GITEAHOST/$2/$1"
|
||||||
|
if [ $DEBUG ] ; then echo "URL="$RemoteRepoURL; fi
|
||||||
|
|
||||||
|
# First see if release exists:
|
||||||
|
RESPONSE=$(curl -s -X 'GET' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases/tags/SME$3" \
|
||||||
|
-H 'accept: application/json')
|
||||||
|
if [ $DEBUG ] ; then echo "See if Release exists response="$RESPONSE; fi
|
||||||
|
#parse result
|
||||||
|
ID=""
|
||||||
|
if echo "$RESPONSE" | jq empty >/dev/null 2>&1; then
|
||||||
|
if echo "$RESPONSE" | jq 'has("errors")' | grep -q 'true'; then
|
||||||
|
if [ $DEBUG ] ; then echo "Error detected:"; fi
|
||||||
|
ERROR=$(echo "$RESPONSE" | jq '.message')
|
||||||
|
if [ $DEBUG ] ; then echo "Error="$ERROR; fi
|
||||||
|
elif echo "$RESPONSE" | jq 'has("id")' | grep -q 'true'; then
|
||||||
|
if [ $DEBUG ] ; then echo "Id detected:"; fi
|
||||||
|
ID=$(echo "$RESPONSE" | jq -r '.id')
|
||||||
|
else
|
||||||
|
echo "No error or id detected ($RESPONSE)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Invalid JSON string ($RESPONSE)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z "$ID" ]]; then
|
||||||
|
# Create Release
|
||||||
|
if [ $NOISY ]; then echo "Creating Release $3 for $2/$1"; fi
|
||||||
|
# 3 branches 'cos I can't get the ascaping correct for using $MAKEPRE and $MAKEDRAFT in the -d json parameter to curl!
|
||||||
|
if [ $MAKEDRAFT = "true" ]; then
|
||||||
|
if [ $DEBUG ] ; then echo "$MAKEDRAFT:Creating draft release"; fi
|
||||||
|
RESPONSE=$(curl -s -X 'POST' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"body": "'"1st Draft Release of rpm built from git - `date` "'",
|
||||||
|
"draft": true,
|
||||||
|
"name": "'"$1"'",
|
||||||
|
"prerelease": false,
|
||||||
|
"tag_name": "'SME"$3"'",
|
||||||
|
"target_commitish": ""}'
|
||||||
|
);
|
||||||
|
elif [ $MAKEPRE = "true" ]; then
|
||||||
|
if [ $DEBUG ] ; then echo "Creating pre-release"; fi
|
||||||
|
RESPONSE=$(curl -s -X 'POST' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"body": "'"1st Pre-Release of rpm built from git - `date` "'",
|
||||||
|
"draft": false,
|
||||||
|
"name": "'"$1"'",
|
||||||
|
"prerelease": true,
|
||||||
|
"tag_name": "'SME"$3"'",
|
||||||
|
"target_commitish": ""}'
|
||||||
|
);
|
||||||
|
else
|
||||||
|
if [ $DEBUG ] ; then echo "Creating full release"; fi
|
||||||
|
RESPONSE=$(curl -s -X 'POST' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"body": "'"1st Stable Release of rpm built from git - `date` "'",
|
||||||
|
"draft": false,
|
||||||
|
"name": "'"$1"'",
|
||||||
|
"prerelease": false,
|
||||||
|
"tag_name": "'SME"$3"'",
|
||||||
|
"target_commitish": ""}'
|
||||||
|
);
|
||||||
|
fi
|
||||||
|
# Extract id from release
|
||||||
|
if [ $DEBUG ]; then echo "Create Release response="$RESPONSE; fi
|
||||||
|
exit 0
|
||||||
|
ID=$(echo $RESPONSE | jq -r '.id')
|
||||||
|
if [[ -z $ID ]] ; then
|
||||||
|
echo "Unable to create release for $2/$1 ($3)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ $NOISY ]; then echo "Found Release $ID for $2/$1 ($3)"; fi
|
||||||
|
fi
|
||||||
|
if [ $DEBUG ] ; then echo "ID:"$ID; fi
|
||||||
|
|
||||||
|
# And use it to upload the rpm and src rpm
|
||||||
|
cd $WORKDIR/$2/$1
|
||||||
|
# Got to cd to rpm directory here
|
||||||
|
RPMDIR=$(ls $(basename `pwd`)*.rpm | sort | head -n 1 | sed 's/.src.rpm//' | sed 's/\./_/g')
|
||||||
|
echo $RPMDIR
|
||||||
|
# List the existing attachments
|
||||||
|
ASSETSRESPONSE=$(curl -s -X 'GET' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases/$ID/assets" \
|
||||||
|
-H 'accept: application/json')
|
||||||
|
if [ $DEBUG ]; then echo "Asset response:"$ASSETSRESPONSE; fi
|
||||||
|
NAMES=$(echo $ASSETSRESPONSE | jq -r '.[].name' | paste -sd "," -)
|
||||||
|
if [ $DEBUG ]; then echo "Names:"$NAMES; fi
|
||||||
|
if [ $DEBUG ]; then echo $(ls $RPMDIR/*.rpm); fi
|
||||||
|
|
||||||
|
FULLPATH=$(pwd);
|
||||||
|
for File in $(ls $RPMDIR/*.rpm) ; do
|
||||||
|
if [ $NOISY ]; then echo "Uploading $File"; fi
|
||||||
|
BASEFile=$(basename $File)
|
||||||
|
if [ $DEBUG ]; then echo $BASEFile; fi
|
||||||
|
# Need to check if file is there already
|
||||||
|
if [[ "$NAMES" == *"$BASEFile"* ]] ; then
|
||||||
|
#Delete it - need the ID for it
|
||||||
|
if [ $NOISY ]; then echo "Deleting $BASEFile from $1/$2 $3 ($ID) release"; fi
|
||||||
|
ATTID=$(echo $ASSETSRESPONSE | jq -r '[ .[] | select(.name == "'"$BASEFile"'") | .id]')
|
||||||
|
#echo "ATTID:"$ATTID
|
||||||
|
ATTID=$(echo $ATTID | sed 's/\[//' | sed 's/\]//' | sed 's/ //g')
|
||||||
|
if [ $DEBUG ]; then echo "ATTID:"$ATTID; fi
|
||||||
|
RESPONSE=$(curl -s -X 'DELETE' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases/$ID/assets/$ATTID" \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'accept: application/json')
|
||||||
|
if [ $DEBUG ]; then echo "DELETED Response:"$RESPONSE; fi
|
||||||
|
if [[ -z $RESPONSE ]] ; then
|
||||||
|
echo "Deleted $BASEFile from $1/$2 $3 ($ID) release"
|
||||||
|
else
|
||||||
|
echo "Delete failed $BASEFile from $2/$1 $3 ($ID) release ($RESPONSE)"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ $DEBUG ]; then echo "Did not find $BASEFile in \"$NAMES\""; fi
|
||||||
|
fi
|
||||||
|
# Then send current version
|
||||||
|
FULLFILENAME=$FULLPATH/$File
|
||||||
|
if [ $DEBUG ] ; then echo $FULLFILENAME; fi
|
||||||
|
RESPONSE=$(curl -s -X 'POST' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases/$ID/assets?name=$BASEFile" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: multipart/form-data' \
|
||||||
|
-F "attachment=@$FULLFILENAME;type=application/x-rpm")
|
||||||
|
if [ $DEBUG ]; then echo "Send current version($File) response="$RESPONSE; fi
|
||||||
|
if echo "$RESPONSE" | jq 'has("errors")' | grep -q 'true'; then
|
||||||
|
ERROR=$(echo "$RESPONSE" | jq '.message')
|
||||||
|
echo "$BASEFile not sucessfully uploaded ($ERROR)"
|
||||||
|
else
|
||||||
|
if [ $NOISY ]; then echo "$BASEFile sucessfully uploaded"; fi
|
||||||
|
fi
|
||||||
|
done
|
@@ -1,114 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Migrate (mirror) a remote repository
|
|
||||||
#
|
|
||||||
# migrate-repo.sh <reponame> <organisation> [<traget organisation>]
|
|
||||||
#
|
|
||||||
inifilename=$(echo ~)"/.smegit/config"
|
|
||||||
if [ ! -e $inifilename ] ; then
|
|
||||||
# Not here, look at system default
|
|
||||||
if [ ! -e /etc/smegit.ini ] ; then
|
|
||||||
echo "No ini file found $inifiename or /etc/smegit.ini"
|
|
||||||
echo "git-mirror-org.sh <source organisation> [<target organisation>]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
initfilename="/etc/smegit.ini"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
while read -r line || [[ -n "$line" ]]; do
|
|
||||||
if [[ $line =~ ^\[.*\]$ ]]
|
|
||||||
then
|
|
||||||
section=${line#*[}
|
|
||||||
section=${section%]*}
|
|
||||||
else
|
|
||||||
if [[ $line =~ ^[^#]*= ]]
|
|
||||||
then
|
|
||||||
key=${line%=*}
|
|
||||||
value=${line#*=}
|
|
||||||
declare "${section}_${key}=$value"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done < "$inifilename"
|
|
||||||
|
|
||||||
if [[ -z $1 ]] ; then
|
|
||||||
echo "migrate-org.sh <source organisation> [<target organisation> <review>]"
|
|
||||||
echo "<target organisation> is optional and will default to the gitea user"
|
|
||||||
echo "<review> is optional and will echo the changes, but not execute"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
DEBUG=
|
|
||||||
curlsilent="-s"
|
|
||||||
if [ ${smegit_DEBUG} == true ] ; then DEBUG=true ; fi
|
|
||||||
if [ $DEBUG ] ; then
|
|
||||||
echo "found ini file: $inifilename"
|
|
||||||
curlsilent="-v"
|
|
||||||
fi
|
|
||||||
|
|
||||||
MIRROR="copy"
|
|
||||||
TARGETORG=
|
|
||||||
for param in $2 $3 $4 ; do
|
|
||||||
if [ $param ] ; then
|
|
||||||
if [[ $param == "copy" || $param == "mirror" ]] ; then
|
|
||||||
MIRROR=$param
|
|
||||||
elif [[ $param == "review" ]] ; then
|
|
||||||
REVIEW=true
|
|
||||||
else
|
|
||||||
TARGETORG=$param
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
REMOTEACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
|
||||||
LOCALACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
|
||||||
REMOTEGITEAHOST=${remote_GITEAHOST}
|
|
||||||
LOCALGITEAHOST=${local_GITEAHOST}
|
|
||||||
if [ $DEBUG ] ; then echo "TARGETORG=$TARGETORG" ; fi
|
|
||||||
|
|
||||||
# check that the target organisation exists locally
|
|
||||||
if [ $DEBUG ] ; then echo "checking that $TARGETORG exists on $LOCALGITEAHOST" ; fi
|
|
||||||
RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" $LOCALGITEAHOST/$TARGETORG)
|
|
||||||
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
|
||||||
if [[ "$RESPONSE" != "200" ]] ; then
|
|
||||||
echo "$TARGETORG does not exist on $LOCALGITEAHOST"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ ! $REVIEW ]] ; then
|
|
||||||
while true; do
|
|
||||||
read -p "Are you sure?(y/n) " yn
|
|
||||||
case $yn in
|
|
||||||
[Yy]* ) break;;
|
|
||||||
[Nn]* ) exit;;
|
|
||||||
* ) echo "Please answer yes or no.";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
# get a list of repositories in the source organisation
|
|
||||||
for page in {1..10} ; do
|
|
||||||
if [ $DEBUG ] ; then echo "getting page $page of repos from $REMOTEGITHOST $1" ; fi
|
|
||||||
RESPONSE=$(curl $curlsilent -X 'GET' \
|
|
||||||
"$REMOTEGITEAHOST/api/v1/orgs/$1/repos?page=$page" \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H "Authorization: token $REMOTEACCESSTOKEN"
|
|
||||||
)
|
|
||||||
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
|
||||||
|
|
||||||
if [[ $RESPONSE == '[]' ]] ; then
|
|
||||||
# we have them all
|
|
||||||
break
|
|
||||||
else
|
|
||||||
echo $RESPONSE | grep -oP '(?<="name":").+?(?=")' | while read repo; do
|
|
||||||
if [ $DEBUG ] ; then echo "git-migrate-repo.sh ${repo} $1 $TARGETORG $MIRROR" ; fi
|
|
||||||
if [[ $REVIEW ]] ; then
|
|
||||||
echo "git-migrate-repo.sh ${repo} $1 $TARGETORG $MIRROR"
|
|
||||||
else
|
|
||||||
git-migrate-repo.sh ${repo} $1 $TARGETORG $MIRROR
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
done
|
|
@@ -4,6 +4,13 @@
|
|||||||
#
|
#
|
||||||
# migrate-repo.sh <reponame> <organisation> [<target organisation>]
|
# migrate-repo.sh <reponame> <organisation> [<target organisation>]
|
||||||
#
|
#
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "git_migrate-repo.sh <reponame> <organisation> [<target organization> <copy|mirror> <local> <debug>]"
|
||||||
|
echo "will migrate repo to local user unless <target organisation> specified"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# get config file and params
|
||||||
inifilename=$(echo ~)"/.smegit/config"
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
if [ ! -e $inifilename ] ; then
|
if [ ! -e $inifilename ] ; then
|
||||||
# Not here, look at system default
|
# Not here, look at system default
|
||||||
@@ -31,62 +38,67 @@ while read -r line || [[ -n "$line" ]]; do
|
|||||||
fi
|
fi
|
||||||
done < $inifilename
|
done < $inifilename
|
||||||
|
|
||||||
if [[ -z $1 ]] ; then
|
|
||||||
echo "git_migrate-repo.sh <reponame> <organisation> [<target organization>]"
|
|
||||||
echo "will migrate repo to local user unless <target organisation> specified"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
DEBUG=
|
DEBUG=
|
||||||
if [ ${smegit_DEBUG} == true ] ; then DEBUG=true ; fi
|
if [ ${smegit_DEBUG} == true ] ; then DEBUG=true ; fi
|
||||||
if [ $DEBUG ] ; then echo "found ini file: $inifilename" ; fi
|
if [ $DEBUG ] ; then echo "found ini file: $inifilename" ; fi
|
||||||
|
|
||||||
curlsilent="-s"
|
SILENT="-s"
|
||||||
if [ $DEBUG ] ; then curlsilent="-v" ; fi
|
if [ $DEBUG ] ; then SILENT="-v" ; fi
|
||||||
|
|
||||||
REMOTEACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
SOURCEHOST=${remote_GITEAHOST}
|
||||||
LOCALACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
SOURCEACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
REMOTEGITEAHOST=${remote_GITEAHOST}
|
TARGETHOST=${local_GITEAHOST}
|
||||||
CLONEADDRESS=$REMOTEGITEAHOST/$2/$1.git
|
TARGETACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
LOCALGITEAHOST=${local_GITEAHOST}
|
|
||||||
TARGETORG=${local_USER}
|
TARGETORG=${local_USER}
|
||||||
#if [ $3 ] ; then TARGETORG=$3 ; fi
|
MIRROR=false
|
||||||
MIRROR="false"
|
for param in $2 $3 $4 $5 $6; do
|
||||||
for param in $3 $4 ; do
|
if [ $param ] ; then
|
||||||
if [ $param ] ; then
|
case $param in
|
||||||
if [[ $param == "copy" || $param == "mirror" ]] ; then
|
local )
|
||||||
if [ $param == "mirror" ] ; then MIRROR="true" ; fi
|
SOURCEHOST=${local_GITEAHOST}
|
||||||
else
|
SOURCEACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
TARGETORG=$param
|
CLONEADDRESS=$LOCALGITEAHOST/$2/$1.git
|
||||||
fi
|
;;
|
||||||
else
|
copy )
|
||||||
break
|
MIRROR=false
|
||||||
fi
|
;;
|
||||||
|
mirror )
|
||||||
|
MIRROR=true ;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
* )
|
||||||
|
TARGETORG=$param ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
CLONEADDRESS=$SOURCEHOST/$2/$1.git
|
||||||
if [ $DEBUG ] ; then
|
if [ $DEBUG ] ; then
|
||||||
echo "MIRROR=$MIRROR"
|
echo "MIRROR=$MIRROR"
|
||||||
echo "TARGETORG=$TARGETORG"
|
echo "TARGETORG=$TARGETORG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# check that the TARGETORG exists
|
# check that the TARGETORG exists
|
||||||
if [ $DEBUG ] ; then echo "checking if $TARGETORG exists on $LOCALGITEAHOST" ; fi
|
if [ $DEBUG ] ; then echo "checking if $TARGETORG exists on $TARGETHOST" ; fi
|
||||||
RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" $LOCALGITEAHOST/$TARGETORG)
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" $TARGETHOST/$TARGETORG)
|
||||||
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
||||||
if [[ "$RESPONSE" != "200" ]] ; then
|
if [[ "$RESPONSE" != "200" ]] ; then
|
||||||
echo "$TARGETORG does not exist on $LOCALGITEAHOST"
|
echo "$TARGETORG does not exist on $TARGETHOST"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# And check if this repo already exists on the target
|
# And check if this repo already exists on the target
|
||||||
if [ $DEBUG ] ; then echo "checking if $TARGETORG/$1 already exists on $LOCALGITEAHOST" ; fi
|
if [ $DEBUG ] ; then echo "checking if $TARGETORG/$1 already exists on $TARGETHOST" ; fi
|
||||||
RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" $LOCALGITEAHOST/$TARGETORG/$1)
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" $TARGETHOST/$TARGETORG/$1)
|
||||||
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
||||||
if [ "$RESPONSE" == "200" ] ; then
|
if [ "$RESPONSE" == "200" ] ; then
|
||||||
echo "Repository $TARGETORG/$1 already exists on $LOCALGITEAHOST - cannot migrate"
|
echo "Repository $TARGETORG/$1 already exists on $TARGETHOST - cannot migrate"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
DATA=$(cat << EOT
|
DATA=$(cat << EOT
|
||||||
"auth_token": "$REMOTEACCESSTOKEN",
|
"auth_token": "$TARGETACCESSTOKEN",
|
||||||
"clone_addr": "$CLONEADDRESS",
|
"clone_addr": "$CLONEADDRESS",
|
||||||
"issues": true,
|
"issues": true,
|
||||||
"labels": true,
|
"labels": true,
|
||||||
@@ -105,11 +117,11 @@ EOT
|
|||||||
)
|
)
|
||||||
if [ $DEBUG ] ; then echo "JSON DATA=$DATA" ; fi
|
if [ $DEBUG ] ; then echo "JSON DATA=$DATA" ; fi
|
||||||
|
|
||||||
if [ $DEBUG ] ; then echo "Migrating $2/$1 as $TARGETORG/$1 on $LOCALGITEAHOST MIRROR=$MIRROR" ; fi
|
if [ $DEBUG ] ; then echo "Migrating $2/$1 as $TARGETORG/$1 on $TARGETHOST MIRROR=$MIRROR" ; fi
|
||||||
RESPONSE=$(curl $curlsilent -k -X 'POST' \
|
RESPONSE=$(curl $SILENT -k -X 'POST' \
|
||||||
"$LOCALGITEAHOST/api/v1/repos/migrate" \
|
"$TARGETHOST/api/v1/repos/migrate" \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H "Authorization: token $LOCALACCESSTOKEN" \
|
-H "Authorization: token $TARGETACCESSTOKEN" \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d "{ $DATA }"
|
-d "{ $DATA }"
|
||||||
)
|
)
|
||||||
@@ -117,7 +129,7 @@ if [ $DEBUG ] ; then echo $? $RESPONSE ; fi
|
|||||||
|
|
||||||
# And check if this repo is there
|
# And check if this repo is there
|
||||||
if [ $DEBUG ] ; then echo "checking that $TARGETORG/$1 exists" ; fi
|
if [ $DEBUG ] ; then echo "checking that $TARGETORG/$1 exists" ; fi
|
||||||
RESPONSE=$(curl $curlsilent -o /dev/null -w "%{http_code}" $LOCALGITEAHOST/$TARGETORG/$1)
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" $TARGETHOST/$TARGETORG/$1)
|
||||||
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
||||||
if [ "$RESPONSE" == "200" ] ; then
|
if [ "$RESPONSE" == "200" ] ; then
|
||||||
msg="Repository $TARGETORG/$1 has been created"
|
msg="Repository $TARGETORG/$1 has been created"
|
||||||
|
176
git-retag.sh
Executable file
176
git-retag.sh
Executable file
@@ -0,0 +1,176 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# $1 = Module name e.g. smeserver-ddclient
|
||||||
|
# $2 = Organisation (smeserver or smecontrib)e
|
||||||
|
# optional (can be in any order)
|
||||||
|
# <local> will use parameters set for local repository else it will use remote
|
||||||
|
# <purge> will purge all old tags
|
||||||
|
# <debug> turn on debug regardless of ~/.smegit/config
|
||||||
|
# <noisy> print a line showing how it was called
|
||||||
|
# Module name must exist
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "************git-retag.sh <modulename> <organization> [<local> | <purge> | <debug> | <noisy>]"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#Needs /usr/bin/rpmspec
|
||||||
|
if command -v /usr/bin/rpmspec > /dev/null; then
|
||||||
|
if [ $DEBUG ] ; then echo "************rpmspec is installed" ; fi
|
||||||
|
else
|
||||||
|
echo "ERROR********************** rpmspec is not installed ******************"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
|
#
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
|
echo "git-retag.sh <modulename> <organization> [<local> | <purge> | <debug> | <noisy>]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
initfilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
DEBUG=
|
||||||
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
|
|
||||||
|
REPO_NAME=$1
|
||||||
|
ORGGITEA=$2
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
NOISY=
|
||||||
|
CLEAN=
|
||||||
|
EXTRAPARAMS=
|
||||||
|
for param in $3 $4 $5 $6 ; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
local )
|
||||||
|
GITEAUser=${local_USER}
|
||||||
|
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
noisy )
|
||||||
|
NOISY=true ;;
|
||||||
|
purge )
|
||||||
|
CLEAN=true ;;
|
||||||
|
* )
|
||||||
|
echo "Unkown parameter: $param"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $NOISY ] ; then echo "git-retag.sh $1 $2 $3 $4 $5 $6" ; fi
|
||||||
|
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
||||||
|
# Make this null if you want lots of output. Still quite a bit anyway
|
||||||
|
QUIET="-q"
|
||||||
|
SILENT4CURL="-s"
|
||||||
|
SILENT4MAKE="-s"
|
||||||
|
if [ $DEBUG ] ; then
|
||||||
|
QUIET=
|
||||||
|
SILENT4CURL="-v"
|
||||||
|
SILENT4MAKE=
|
||||||
|
fi
|
||||||
|
# Make this null to get curl to check ssl cert
|
||||||
|
checkSSL="-k"
|
||||||
|
|
||||||
|
LOCALUser=${local_USER}
|
||||||
|
if [[ $smegit_WORKDIR == ~* ]] ; then
|
||||||
|
# relative to users home dir
|
||||||
|
WORKDIR=$(echo ~)${smegit_WORKDIR:1}
|
||||||
|
else
|
||||||
|
# absolute path
|
||||||
|
WORKDIR=${smegit_WORKDIR}
|
||||||
|
fi
|
||||||
|
if [ $DEBUG ] ; then echo "WORKDIR=$WORKDIR" ; fi
|
||||||
|
RemoteRepoURL="$GITEAHOST/$ORGGITEA/$REPO_NAME"
|
||||||
|
|
||||||
|
# Make sure credentials taken from store
|
||||||
|
# The first time you pull or push it will ask for credentials and then save them in a file.
|
||||||
|
git config --global credential.helper store
|
||||||
|
|
||||||
|
# Create the local Git repository
|
||||||
|
GITFiles=$WORKDIR/$ORGGITEA
|
||||||
|
mkdir -p $GITFiles
|
||||||
|
cd $GITFiles
|
||||||
|
|
||||||
|
# Delete the local first
|
||||||
|
if [ -d "$REPO_NAME" ] ; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Deleting local GIT files" ; fi
|
||||||
|
rm -Rf $GITFiles/$REPO_NAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
# See if it exists on the Gitea host
|
||||||
|
if [ $DEBUG ] ; then echo "check that $GITEAHOST/$ORGGITEA/$REPO_NAME exists" ; fi
|
||||||
|
RESPONSE=$(curl $checkSSL $SILENT4CURL -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$ORGGITEA/$REPO_NAME")
|
||||||
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
|
if [ $DEBUG ] ; then echo "************Repository for $REPO_NAME exists, cloning!" ; fi
|
||||||
|
# If so, clone it (just want the README.md)
|
||||||
|
if [ $DEBUG ] ; then echo "git clone $GITEAHOST/$ORGGITEA/$REPO_NAME.git" ; fi
|
||||||
|
cd $GITFiles
|
||||||
|
git clone "$GITEAHOST/$ORGGITEA/$REPO_NAME.git"
|
||||||
|
else
|
||||||
|
echo "************Repository for $ORGGITEA/$REPO_NAME does not exist. Aborting $RESPONSE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
cd $GITFiles/$REPO_NAME
|
||||||
|
if [ $CLEAN ] ; then
|
||||||
|
# read the existing tags
|
||||||
|
OLDTAGS=$(git tag --list)
|
||||||
|
# delete old tag/s
|
||||||
|
for tag in $OLDTAGS ; do
|
||||||
|
if [ $DEBUG ] ; then echo "Removing tag $tag" ; fi
|
||||||
|
git tag --delete $tag
|
||||||
|
git push origin --delete $tag
|
||||||
|
git push --tags
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
# Now create the version and release tag from the specfile
|
||||||
|
VERSION_RELEASE_LONG=`rpm --queryformat '%{version} %{release}\n' --specfile $REPO_NAME.spec`
|
||||||
|
VERSION_RELEASE=${VERSION_RELEASE_LONG%%$'\n'*}
|
||||||
|
VERSION=${VERSION_RELEASE% *}
|
||||||
|
VERSION=${VERSION//./_}
|
||||||
|
RELEASE=${VERSION_RELEASE#* }
|
||||||
|
TAG=$VERSION"-"${RELEASE%.*}
|
||||||
|
if [ $DEBUG ] ; then
|
||||||
|
echo "VERSION_RELEASE=$VERSION_RELEASE"
|
||||||
|
echo "VERSION=$VERSION"
|
||||||
|
echo "RELEASE=$RELEASE"
|
||||||
|
echo "TAG=$TAG"
|
||||||
|
fi
|
||||||
|
git pull
|
||||||
|
git tag -a $TAG -m "Setting tag to current Version-Release in spec file: $TAG"
|
||||||
|
git push origin --tag $TAG $QUIET
|
||||||
|
|
||||||
|
echo "Current $ORGGITEA/$REPO_NAME tagged as $TAG"
|
||||||
|
if [ $CLEAN ] ; then echo " - old tags removed" ; fi
|
||||||
|
exit 0
|
178
git-transfer-repo.sh
Executable file
178
git-transfer-repo.sh
Executable file
@@ -0,0 +1,178 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# Transfer a repo to a different user (or organisation)
|
||||||
|
# $1 = Module name e.g. e-smith-dnscache
|
||||||
|
# $2 = Source Organisation (any valid organisation or user)
|
||||||
|
# $3 = Target Organisation (any valid organisation or user - you need owner privileges)
|
||||||
|
# $4-$7 can appear in any order and are optional
|
||||||
|
# = "local" will use parameters set for local repository else it will use remote
|
||||||
|
# = "force" will automagically delete an existing repo, otherwise it will prompt
|
||||||
|
# = "debug" run in debug mode
|
||||||
|
# = "silent" suppress success message
|
||||||
|
#
|
||||||
|
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "Transfer a repo to a different user (or organisation)"
|
||||||
|
echo "git-transfer-repo.sh <repository> <source organization> ,target organisation> [<local> <force> <debug> <silent>]"
|
||||||
|
echo "<repository> = repository name (e.g. smeserver-clamav)"
|
||||||
|
echo "<source organisation> (any valid organisation or user)"
|
||||||
|
echo "<target organisation> (any valid organisation or user - you need owner privileges)"
|
||||||
|
echo " can appear in any order and are optional"
|
||||||
|
echo " - <local> will use parameters set for local repository, else it will use remote"
|
||||||
|
echo " - <force> will automagically delete an existing target repo, otherwise it will prompt"
|
||||||
|
echo " - <debug> run in debug mode"
|
||||||
|
echo " - <silent> suppress success message"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
|
#
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
|
echo "git-cvs2git.sh <modulename> <organization> [<local>]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
initfilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
DEBUG=
|
||||||
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
|
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
||||||
|
|
||||||
|
if [[ $smegit_WORKDIR == ~* ]] ; then
|
||||||
|
# relative to users home dir
|
||||||
|
WORKDIR=$(echo ~)${smegit_WORKDIR:1}
|
||||||
|
else
|
||||||
|
# absolute path
|
||||||
|
WORKDIR=${smegit_WORKDIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Command line parameters
|
||||||
|
REPO=$1
|
||||||
|
SOURCEORG=$2
|
||||||
|
TARGETORG=$3
|
||||||
|
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
DELETEIT=
|
||||||
|
NOOUTPUT=
|
||||||
|
for param in $4 $5 $6 $7; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
local )
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
;;
|
||||||
|
force )
|
||||||
|
DELETEIT=true ;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
silent )
|
||||||
|
NOOUTPUT=true ;;
|
||||||
|
* )
|
||||||
|
echo "Ignoring $param" ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Debug settings
|
||||||
|
# Make this null if you want lots of output. Still quite a bit anyway
|
||||||
|
QUIET="--quiet"
|
||||||
|
SILENT="-s"
|
||||||
|
if [ $DEBUG ] ; then
|
||||||
|
QUIET=
|
||||||
|
SILENT="-v"
|
||||||
|
fi
|
||||||
|
# Make this null to get curl to check ssl cert
|
||||||
|
checkSSL="-k"
|
||||||
|
|
||||||
|
#Check that source package exists
|
||||||
|
if [ $DEBUG ] ; then echo "Check if $SOURCEORG/$REPO is there!" ; fi
|
||||||
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$SOURCEORG/$REPO")
|
||||||
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
|
if [ $DEBUG ] ; then echo "Repository for $SOURCEORG/$REPO exists!" ; fi
|
||||||
|
else
|
||||||
|
echo "************Repository for $SOURCEORG/$REPO does not exist on $GITEAHOST ($RESPONSE)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $DEBUG ] ; then echo "Transferring $TARGETORG/$REPO to $SOURCEORG/$REPO" ; fi
|
||||||
|
#Check that target repo does not exist
|
||||||
|
if [ $DEBUG ] ; then echo "Check if $TARGETORG/$REPO is there!" ; fi
|
||||||
|
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$TARGETORG/$REPO")
|
||||||
|
EXISTS=
|
||||||
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
|
EXISTS=true
|
||||||
|
if [ $DEBUG ] ; then echo "Repository for $TARGETORG/$REPO exists!" ; fi
|
||||||
|
if [ -z ${DELETEIT} ] ; then
|
||||||
|
while true; do
|
||||||
|
read -p "$TARGETORG/$REPO exists! Do you wish to delete it and continue?(y/n) " yn
|
||||||
|
case $yn in
|
||||||
|
[Yy]* )
|
||||||
|
DELETEIT=true
|
||||||
|
break ;;
|
||||||
|
[Nn]* )
|
||||||
|
DELETEIT=
|
||||||
|
break ;;
|
||||||
|
* ) echo "Please answer yes or no.";;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
if [ $DELETEIT ] ; then
|
||||||
|
if [ $DEBUG ] ; then echo "Deleting $TARGETORG/$REPO" ; fi
|
||||||
|
RESPONSE=$(curl "$checkSSL" "$SILENT" -o /dev/null -w "%{http_code}" -X 'DELETE' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$TARGETORG/$REPO" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" )
|
||||||
|
if [[ $RESPONSE != "204" ]] ; then
|
||||||
|
echo "Unable to delete $TARGETORG/$REPO ($RESPONSE)"
|
||||||
|
else
|
||||||
|
EXISTS=
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
if [ $DEBUG ] ; then echo "Repository for $SOURCEORG/$REPO does not exist on $GITEAHOST" ; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Transfer the repo
|
||||||
|
if [[ -z $EXISTS ]] ; then
|
||||||
|
if [ $DEBUG ] ; then echo "Actual Transfer" ; fi
|
||||||
|
RESPONSE=$(curl "$SILENT" "$checkSSL" -o /dev/null -w "%{http_code}" -X 'POST' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$SOURCEORG/$REPO/transfer" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"new_owner": "'"$TARGETORG"'"
|
||||||
|
}'
|
||||||
|
)
|
||||||
|
fi
|
||||||
|
if [[ $EXISTS || $RESPONSE != "202" ]] ; then
|
||||||
|
echo "Unable to transfer $SOURCEORG/$REPO to $TARGETORG/$REPO ($RESPONSE) - Aborting!"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
if [[ -z $NOOUTPUT ]] ; then echo "$SOURCEORG/$REPO has been transferred to $TARGETORG/$REPO" ; fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
121
git-update-release-in-one-repo.sh
Executable file
121
git-update-release-in-one-repo.sh
Executable file
@@ -0,0 +1,121 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# git-update-release-in-one-repo.sh <organisation> <repo> [ <releasetag> | <id> ] [draft|prerelease|release]
|
||||||
|
#
|
||||||
|
# Create the release (deleting one that is the same tag),
|
||||||
|
# then uploads the .src.rpm and .rpm as an attachment (deleting any one of the same name)
|
||||||
|
#
|
||||||
|
#
|
||||||
|
if [[ -z $1 ]] ; then
|
||||||
|
echo "git-update-release-in-one-repo.sh <organisation> <repo> [ <releasetag> | <id> ] [draft|prerelease|release] [local] [debug]"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -z $4 ]] ; then
|
||||||
|
echo "Must provide release type"
|
||||||
|
echo "git-update-release-in-one-repo.sh <organisation> <repo> [ <releasetag> | <id> ] [draft|prerelease|release] [local] [debug]"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
|
#
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
|
echo "git-update-release-in-one-repo.sh <organisation> <repo> [ <releasetag> | <id> ] [draft|prerelease|release] [local] [debug]"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
initfilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
|
||||||
|
DEBUG=
|
||||||
|
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
for param in $2 $3 $4 $5 $6 $7; do
|
||||||
|
if [ $param ] ; then
|
||||||
|
case $param in
|
||||||
|
local )
|
||||||
|
GITEAUser=${local_USER}
|
||||||
|
GITEAACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
|
* )
|
||||||
|
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
||||||
|
esac
|
||||||
|
else
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Uses if ist char is numeric to see if an id or tag is provided
|
||||||
|
if [[ ! "${3:0:1}" =~ [0-9] ]]; then
|
||||||
|
# <organisation> <repo> <releasetag> - find the id from the info provided
|
||||||
|
ID=999;
|
||||||
|
# TBD
|
||||||
|
else
|
||||||
|
ID=$3;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $DEBUG ]; then echo "I:$ID"; fi
|
||||||
|
|
||||||
|
# And then edit it by id.
|
||||||
|
|
||||||
|
if [ $4 = "draft" ]; then
|
||||||
|
RESPONSE=$(curl -s -X 'PATCH' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases/$ID" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"draft": true,
|
||||||
|
"prerelease": false
|
||||||
|
}')
|
||||||
|
elif [ $4 = "prerelease" ]; then
|
||||||
|
RESPONSE=$(curl -s -X 'PATCH' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases/$ID" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"draft": false,
|
||||||
|
"prerelease": true
|
||||||
|
}')
|
||||||
|
else
|
||||||
|
RESPONSE=$(curl -s -X 'PATCH' \
|
||||||
|
"$GITEAHOST/api/v1/repos/$2/$1/releases/$ID" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $GITEAACCESSTOKEN" \
|
||||||
|
-H 'Content-Type: application/json' \
|
||||||
|
-d '{
|
||||||
|
"draft": false,
|
||||||
|
"prerelease": false
|
||||||
|
}')
|
||||||
|
fi
|
||||||
|
if [ $DEBUG ]; then echo "$RESPONSE"; fi
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
194
github-make-push-mirror.sh
Executable file
194
github-make-push-mirror.sh
Executable file
@@ -0,0 +1,194 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
#
|
||||||
|
# $1 = Module name e.g. smeserver-ddclient (assumes github repo is to be called the same)
|
||||||
|
# $2 = gitea Organisation (smeserver or smecontrib)
|
||||||
|
# $3 = github Organisation (Koozali-SME-Server or Koozali-SME-Server-contribs or smeserver)
|
||||||
|
#
|
||||||
|
|
||||||
|
# Make this null to get curl to check ssl cert
|
||||||
|
checkSSL="-k"
|
||||||
|
# and -v for curl verbose mode
|
||||||
|
SILENT4CURL="-s"
|
||||||
|
|
||||||
|
if [ "$#" -ne 3 ]; then
|
||||||
|
echo "Error: github-make-push-mirror.sh <modulename> <organization> <github orgamisation>"
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check that jq is installed
|
||||||
|
if command -v jq -V > /dev/null; then
|
||||||
|
if [ $DEBUG ] ; then echo "Jq is installed" ; fi
|
||||||
|
else
|
||||||
|
echo "Error: jq is not installed (try EPEL)"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#check gh is loaded
|
||||||
|
if command -v gh --version > /dev/null; then
|
||||||
|
if [ $DEBUG ] ; then echo "gh is installed" ; fi
|
||||||
|
else
|
||||||
|
echo "Error: gh is not installed **************"
|
||||||
|
echo "try: curl -fsSL https://cli.github.com/packages/rpm/gh-cli.repo | sudo tee /etc/yum.repos.d/github-cli.repo"
|
||||||
|
echo "then:sudo dnf -y install gh"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
#
|
||||||
|
# Pull in parameters from a config file ~/.smegit/config
|
||||||
|
#
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
initfilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]]
|
||||||
|
then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]]
|
||||||
|
then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
|
||||||
|
GITEAUser=${remote_USER}
|
||||||
|
GITEAACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
|
||||||
|
#First check repo name exists in gitea
|
||||||
|
REPO_NAME=$1
|
||||||
|
RESPONSE=$(curl $checkSSL $SILENT4CURL -o /dev/null -w "%{http_code}" "$GITEAHOST/api/v1/repos/$2/$REPO_NAME")
|
||||||
|
if [ "$RESPONSE" == "200" ]; then
|
||||||
|
echo "$2/$1 exists in GITEA"
|
||||||
|
else
|
||||||
|
echo "Error: $2/$1 does not exists in GITEA"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# and that the github token has been installed in the .smegit file
|
||||||
|
# Note that this personal access token is generated by github against a particular login
|
||||||
|
GITHUBLOGIN=${remote_GITHUBLOGIN}
|
||||||
|
if [ -z "${remote_GITHUBTOKEN}" ]; then
|
||||||
|
echo "Error: The GITHUBTOKEN is not defined in .smegit/config ."
|
||||||
|
fi
|
||||||
|
|
||||||
|
#and check that github is logged in
|
||||||
|
if ! gh auth status > /dev/null 2>&1; then
|
||||||
|
echo "You must log in with GitHub CLI first."
|
||||||
|
echo "Run 'gh auth login' and follow the instructions."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# first create repo on github or skip over if already created
|
||||||
|
REPO_NAME=$3/$1
|
||||||
|
DESCRIPTION="Repo-$1 - push mirror from Koozali gitea repo $1"
|
||||||
|
|
||||||
|
# Create the repository
|
||||||
|
|
||||||
|
# Check if the repository exists
|
||||||
|
repo_exists=$(gh repo view "$REPO_NAME" > /dev/null 2>&1)
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "The repository '$REPO_NAME' already exists."
|
||||||
|
else
|
||||||
|
echo "Creating GitHub repository '$REPO_NAME'..."
|
||||||
|
gh repo create "$REPO_NAME" --description "$DESCRIPTION" --public
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "GitHub Repository '$REPO_NAME' created successfully."
|
||||||
|
else
|
||||||
|
echo "Failed to create repository '$REPO_NAME'."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Now update the equivalent gitea repo to push to the github one.
|
||||||
|
GITHUB_REPO_URL="https://github.com/$3/$1.git"
|
||||||
|
|
||||||
|
# API endpoint to create a push mirror
|
||||||
|
API_ENDPOINT="${remote_GITEAHOST}/api/v1/repos/${2}/${1}/push_mirrors"
|
||||||
|
|
||||||
|
# See if the push mirror exists already
|
||||||
|
# Fetch repository mirror settings using the Gitea API
|
||||||
|
response=$(curl $checkSSL $SILENT4CURL -s -H "Authorization: token ${remote_GITEAACCESSTOKEN}" \
|
||||||
|
"$API_ENDPOINT")
|
||||||
|
|
||||||
|
if [ -z "$response" ]; then
|
||||||
|
echo "Failed to fetch mirror settings from Gitea."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check if there are any push mirrors
|
||||||
|
push_mirrors=$(echo "$response" | jq -r '.[] | select(.sync_on_commit == true)')
|
||||||
|
|
||||||
|
if [ -z "$push_mirrors" ]; then
|
||||||
|
echo "No push mirror configurations found for the repository '$2/$1'."
|
||||||
|
else
|
||||||
|
echo "Push mirror configurations found for the repository '$2/$1:"
|
||||||
|
#echo "$push_mirrors" | jq
|
||||||
|
fi
|
||||||
|
|
||||||
|
# check if one of them is the one to github
|
||||||
|
github_mirror=$(echo "$response" | jq -r --arg address "${GITHUB_REPO_URL}" '.[] | select(.remote_address == $address)')
|
||||||
|
if [ -z "$github_mirror" ]; then
|
||||||
|
echo "No push mirror configuration with remote address '${GITHUB_REPO_URL}' found for the repository '$REPO_NAME'."
|
||||||
|
else
|
||||||
|
echo "Push mirror configuration with remote address '${GITHUB_REPO_URL}' found for the repository '$REPO_NAME':"
|
||||||
|
echo "$github_mirror" | jq
|
||||||
|
remote_name=$(echo "$github_mirror" | jq -r '.remote_name')
|
||||||
|
echo "Deleting this push mirror entry with remote_name: $remote_name"
|
||||||
|
# Delete the mirror using the mirror ID
|
||||||
|
delete_response=$(curl $checkSSL $SILENT4CURL -s -X DELETE -H "Authorization: token ${remote_GITEAACCESSTOKEN}" \
|
||||||
|
"$API_ENDPOINT/$remote_name")
|
||||||
|
if [ -z "$delete_response" ]; then
|
||||||
|
echo "Successfully deleted the mirror with remote name '$remote_name'."
|
||||||
|
else
|
||||||
|
echo "Failed to delete the mirror with remote name '$remote_name'. Response: $delete_response"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# JSON payload to be sent to the Gitea API to create the push mirrir
|
||||||
|
MIRROR_PAYLOAD=$(cat <<EOF
|
||||||
|
{
|
||||||
|
"interval" : "8h0m0s",
|
||||||
|
"remote_address": "${GITHUB_REPO_URL}",
|
||||||
|
"remote_username": "${GITHUBLOGIN}",
|
||||||
|
"remote_password": "${remote_GITHUBTOKEN}",
|
||||||
|
"sync_on_commit" : true
|
||||||
|
}
|
||||||
|
EOF
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create the push mirror
|
||||||
|
response=$(curl $checkSSL $SILENT4CURL -s -w "\nHTTP_STATUS_CODE:%{http_code}" -X POST "$API_ENDPOINT" \
|
||||||
|
-H "Authorization: token ${remote_GITEAACCESSTOKEN}" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d "$MIRROR_PAYLOAD")
|
||||||
|
|
||||||
|
# Extract the response and HTTP status code
|
||||||
|
echo "Creating the push mirror for $2/$1 to $3/$1"
|
||||||
|
body=$(echo "$response" | sed -n '1,/HTTP_STATUS_CODE:/p' | sed '$d')
|
||||||
|
status_code=$(echo "$response" | grep "HTTP_STATUS_CODE:" | awk -F ':' '{print $2}')
|
||||||
|
|
||||||
|
# Evaluate the response
|
||||||
|
if [[ "$status_code" -ge 200 && "$status_code" -lt 300 ]]; then
|
||||||
|
echo "Successfully set up push mirror from Gitea repository to GitHub for $2/$1 to $3/$1."
|
||||||
|
else
|
||||||
|
echo "Failed to set up push mirror. HTTP Status Code: $status_code"
|
||||||
|
echo "Response: $body"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
|
||||||
|
|
106
parse-list.sh
106
parse-list.sh
@@ -5,17 +5,53 @@
|
|||||||
if [[ -z $1 ]] ; then
|
if [[ -z $1 ]] ; then
|
||||||
echo "parse a list of parameters and execute script with those parameters"
|
echo "parse a list of parameters and execute script with those parameters"
|
||||||
echo "parse-list.sh <param file> <script> [<noisy> <additional> <additional> <additional>]"
|
echo "parse-list.sh <param file> <script> [<noisy> <additional> <additional> <additional>]"
|
||||||
echo "<param file> = name of file containing parameters"
|
echo "<param file|org='organisation'> name of file containing parameters"
|
||||||
echo "<script> script to run (e.g. rename-e-smith-pkh.sh)"
|
echo " or the organisation list of repos"
|
||||||
echo "optional params can appear in any order"
|
echo "<script> script to run (e.g. rename-e-smith-pkh.sh)"
|
||||||
echo " <noisy> show line being executed"
|
echo "optional params can appear in any order"
|
||||||
echo " <additional> additional params to be passed (up to 3)"
|
echo " <review> show line being executed but do NOTHING!"
|
||||||
exit 0
|
echo " <noisy> show line being executed"
|
||||||
|
echo " <additional> additional params to be passed (up to 3)"
|
||||||
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -f $1 ]] ; then
|
# parse the command line parameters
|
||||||
|
PROCESSORG=
|
||||||
|
EXTRAPARAMS=
|
||||||
|
if [[ $1 == org=* ]] ; then
|
||||||
|
# using a list of the repos in this organisatoin as input
|
||||||
|
PROCESSORG=${1#*=}
|
||||||
|
EXTRAPARAMS=$PROCESSORG # add the org as the first additional param
|
||||||
|
# Get the ini file and relevant parameters - only needed for org processing
|
||||||
|
inifilename=$(echo ~)"/.smegit/config"
|
||||||
|
if [ ! -e $inifilename ] ; then
|
||||||
|
# Not here, look at system default
|
||||||
|
if [ ! -e /etc/smegit.ini ] ; then
|
||||||
|
echo "No ini file found $inifiename or /etc/smegit.ini"
|
||||||
|
exit 1
|
||||||
|
else
|
||||||
|
initfilename="/etc/smegit.ini"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r line || [[ -n "$line" ]]; do
|
||||||
|
if [[ $line =~ ^\[.*\]$ ]] ; then
|
||||||
|
section=${line#*[}
|
||||||
|
section=${section%]*}
|
||||||
|
else
|
||||||
|
if [[ $line =~ ^[^#]*= ]] ; then
|
||||||
|
key=${line%=*}
|
||||||
|
value=${line#*=}
|
||||||
|
declare "${section}_${key}=$value"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done < "$inifilename"
|
||||||
|
else
|
||||||
|
# using a file as input
|
||||||
|
if [[ ! -f $1 ]] ; then
|
||||||
echo "Can NOT find $1 - Aborting"
|
echo "Can NOT find $1 - Aborting"
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(which $2 | grep "no $2") ]] ; then
|
if [[ $(which $2 | grep "no $2") ]] ; then
|
||||||
@@ -23,13 +59,25 @@ if [[ $(which $2 | grep "no $2") ]] ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
DEBUG=
|
||||||
|
REVIEW=
|
||||||
NOISY=
|
NOISY=
|
||||||
EXTRAPARAMS=
|
GITEAHOST=${remote_GITEAHOST}
|
||||||
|
ACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
||||||
for param in $3 $4 $5 $6; do
|
for param in $3 $4 $5 $6; do
|
||||||
if [ $param ] ; then
|
if [ $param ] ; then
|
||||||
case $param in
|
case $param in
|
||||||
|
review )
|
||||||
|
REVIEW=true ;;
|
||||||
noisy )
|
noisy )
|
||||||
NOISY=true ;;
|
NOISY=true ;;
|
||||||
|
local )
|
||||||
|
GITEAHOST=${local_GITEAHOST}
|
||||||
|
ACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
||||||
|
EXTRAPARAMS=$EXTRAPARAMS" "$param
|
||||||
|
;;
|
||||||
|
debug )
|
||||||
|
DEBUG=true ;;
|
||||||
* )
|
* )
|
||||||
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
EXTRAPARAMS=$EXTRAPARAMS" "$param ;;
|
||||||
esac
|
esac
|
||||||
@@ -38,10 +86,42 @@ for param in $3 $4 $5 $6; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# read through input file and run script using params from file
|
# Build array of parameters to cycle through
|
||||||
while read -r line
|
PARAMLIST=()
|
||||||
|
if [ $PROCESSORG ] ; then
|
||||||
|
# get a list of repositories in the source organisation and store in array of parameters
|
||||||
|
for page in {1..10} ; do
|
||||||
|
if [ $DEBUG ] ; then echo "getting page $page of repos from $GITEAHOST $PROCESSORG" ; fi
|
||||||
|
RESPONSE=$(curl -s -X 'GET' \
|
||||||
|
"$GITEAHOST/api/v1/orgs/$PROCESSORG/repos?page=$page" \
|
||||||
|
-H 'accept: application/json' \
|
||||||
|
-H "Authorization: token $ACCESSTOKEN"
|
||||||
|
)
|
||||||
|
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
||||||
|
|
||||||
|
if [[ $RESPONSE == '[]' ]] ; then
|
||||||
|
# we have them all
|
||||||
|
break
|
||||||
|
else
|
||||||
|
PARAMLIST="$PARAMLIST $(echo $RESPONSE | grep -oP '(?<="name":").+?(?=")')"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
else
|
||||||
|
# load array of parameters from input file
|
||||||
|
while read -r line ; do PARAMLIST+=($line) ; done < $1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Cycle through array of parameters and execute script
|
||||||
|
for param in ${PARAMLIST[@]}
|
||||||
do
|
do
|
||||||
if [[ $NOISY ]] ; then echo "$2 $line $EXTRAPARAMS" ; fi
|
if [[ $NOISY || $REVIEW ]] ; then echo "$2 $param $EXTRAPARAMS" ; fi
|
||||||
if [[ $line ]] ; then $2 $line $EXTRAPARAMS ; fi
|
if [[ -z $REVIEW ]] ; then
|
||||||
done < $1
|
if [[ $param ]] ; then
|
||||||
|
RESPONSE=$($2 $param $EXTRAPARAMS) ; rc=$?
|
||||||
|
if [ $rc -ne 0 ] ; then echo "($rc)\n$RESPONSE" ; fi
|
||||||
|
if [ $DEBUG ] ; then echo "RESPONSE=$RESPONSE" ; fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
exit 0
|
exit 0
|
@@ -1,295 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# Rename an e-smith package as smeserver and change relevant files
|
|
||||||
# $1 = Module name e.g. e-smith-dnscache
|
|
||||||
# $2-$5 can appear in any order and are optional
|
|
||||||
# = Organisation (smeserver or user - defaults to smeserver)
|
|
||||||
# = "local" will use parameters set for local repository else it will use remote
|
|
||||||
# = "force" will automagically delete an existing repo, otherwise it will prompt
|
|
||||||
# = "debug" run in debug mode
|
|
||||||
# This works whether the repo and local files exist of not (it deletes them if necessary)
|
|
||||||
#
|
|
||||||
|
|
||||||
if [[ -z $1 ]] ; then
|
|
||||||
echo "Rename an e-smith package as smeserver and change relevant files"
|
|
||||||
echo "rename-e-smith-pkg.sh <modulename> [<organization> <local> <force> <debug>]"
|
|
||||||
echo "<modulename> = Module/package name (e.g. e-smith-dnscache)"
|
|
||||||
echo " can appear in any order and are optional"
|
|
||||||
echo " - <organisation> (smeserver, smecontribs or user - defaults to smeserver)"
|
|
||||||
echo " - <local> will use parameters set for local repository, else it will use remote"
|
|
||||||
echo " - <force> will automagically delete an existing repo, otherwise it will prompt"
|
|
||||||
echo " - <debug> run in debug mode"
|
|
||||||
echo " - <nooutput> completely suppress all output"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
#
|
|
||||||
# Pull in parameters from a config file ~/.smegit/config
|
|
||||||
#
|
|
||||||
inifilename=$(echo ~)"/.smegit/config"
|
|
||||||
if [ ! -e $inifilename ] ; then
|
|
||||||
# Not here, look at system default
|
|
||||||
if [ ! -e /etc/smegit.ini ] ; then
|
|
||||||
echo "No ini file found $inifiename or /etc/smegit.ini"
|
|
||||||
echo "git-cvs2git.sh <modulename> <organization> [<local>]"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
initfilename="/etc/smegit.ini"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
while read -r line || [[ -n "$line" ]]; do
|
|
||||||
if [[ $line =~ ^\[.*\]$ ]]
|
|
||||||
then
|
|
||||||
section=${line#*[}
|
|
||||||
section=${section%]*}
|
|
||||||
else
|
|
||||||
if [[ $line =~ ^[^#]*= ]]
|
|
||||||
then
|
|
||||||
key=${line%=*}
|
|
||||||
value=${line#*=}
|
|
||||||
declare "${section}_${key}=$value"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done < "$inifilename"
|
|
||||||
DEBUG=
|
|
||||||
if [ ${smegit_DEBUG} == "true" ] ; then DEBUG=true ; fi
|
|
||||||
if [ $DEBUG ] ; then echo "************found ini file: $inifilename" ; fi
|
|
||||||
|
|
||||||
if [[ $smegit_WORKDIR == ~* ]] ; then
|
|
||||||
# relative to users home dir
|
|
||||||
WORKDIR=$(echo ~)${smegit_WORKDIR:1}
|
|
||||||
else
|
|
||||||
# absolute path
|
|
||||||
WORKDIR=${smegit_WORKDIR}
|
|
||||||
fi
|
|
||||||
|
|
||||||
SOURCEHOST=${remote_GITEAHOST}
|
|
||||||
SOURCEACCESSTOKEN=${remote_GITEAACCESSTOKEN}
|
|
||||||
SOURCEORG="smeserver"
|
|
||||||
TARGETORG=${remote_USER}
|
|
||||||
DELETEIT=
|
|
||||||
NOOUTPUT=
|
|
||||||
for param in $2 $3 $4 $5 $6; do
|
|
||||||
if [ $param ] ; then
|
|
||||||
case $param in
|
|
||||||
local )
|
|
||||||
SOURCEHOST=${local_GITEAHOST}
|
|
||||||
SOURCEACCESSTOKEN=${local_GITEAACCESSTOKEN}
|
|
||||||
TARGETORG=${local_USER} ;;
|
|
||||||
force )
|
|
||||||
DELETEIT=true ;;
|
|
||||||
debug )
|
|
||||||
DEBUG=true ;;
|
|
||||||
nooutput )
|
|
||||||
NOOUTPUT=true ;;
|
|
||||||
* )
|
|
||||||
SOURCEORGORG=$param ;;
|
|
||||||
esac
|
|
||||||
else
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
# Debug settings
|
|
||||||
# Make this null if you want lots of output. Still quite a bit anyway
|
|
||||||
QUIET="--quiet"
|
|
||||||
SILENT="-s"
|
|
||||||
if [ $DEBUG ] ; then
|
|
||||||
QUIET=
|
|
||||||
SILENT="-v"
|
|
||||||
fi
|
|
||||||
# Make this null to get curl to check ssl cert
|
|
||||||
checkSSL="-k"
|
|
||||||
|
|
||||||
#Extract <pkg>
|
|
||||||
SOURCEPKG=$1
|
|
||||||
TARGETPKG=${SOURCEPKG/e-smith/smeserver}
|
|
||||||
|
|
||||||
#Check that source package exists
|
|
||||||
if [ $DEBUG ] ; then echo "Check if $SOURCEORG/$SOURCEPKG is there!" ; fi
|
|
||||||
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$SOURCEHOST/api/v1/repos/$SOURCEORG/$SOURCEPKG")
|
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
|
||||||
if [ $DEBUG ] ; then echo "Repository for $SOURCEORG/$SOURCEPKG exists!" ; fi
|
|
||||||
else
|
|
||||||
echo "************Repository for $SOURCEORG/$SOURCEPKG does not exist on $SOURCEHOST ($RESPONSE)"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Check that target package does not exist
|
|
||||||
if [ $DEBUG ] ; then echo "Check if $TARGETORG/$TARGETPKG is there!" ; fi
|
|
||||||
RESPONSE=$(curl $SILENT -o /dev/null -w "%{http_code}" "$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG")
|
|
||||||
if [ "$RESPONSE" == "200" ]; then
|
|
||||||
if [ $DEBUG ] ; then echo "Repository for $TARGETORG/$TARGETPKG exists!" ; fi
|
|
||||||
if [ -z ${DELETEIT} ] ; then
|
|
||||||
while true; do
|
|
||||||
read -p "Do you wish to delete it and continue?(y/n) " yn
|
|
||||||
case $yn in
|
|
||||||
[Yy]* )
|
|
||||||
DELETEIT=true
|
|
||||||
break ;;
|
|
||||||
[Nn]* )
|
|
||||||
echo "************Abandoning Fork of $SOURCEORG/$SOURCEPKG on $SOURCEHOST ($RESPONSE)"
|
|
||||||
exit 1 ;;
|
|
||||||
* ) echo "Please answer yes or no.";;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
if [ $DELETEIT ] ; then
|
|
||||||
if [ $DEBUG ] ; then echo "Deleting $TARGETORG/$TARGETPKG" ; fi
|
|
||||||
RESPONSE=$(curl "$checkSSL" "$SILENT" -X 'DELETE' \
|
|
||||||
"$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H "Authorization: token $SOURCEACCESSTOKEN" )
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ $DEBUG ] ; then echo "Repository for $TARGETORG/$TARGETPKG does not exist on $SOURCEHOST" ; fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Fork e-smith-<pkg> into users repositories as smeserver-<pkg>
|
|
||||||
# - add bugzilla and wiki references
|
|
||||||
|
|
||||||
if [ $DEBUG ] ; then echo "Forking $SORCEORG/$SOURCEPKG into $TARGETORG/$TARGETPKG!" ; fi
|
|
||||||
RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'POST' \
|
|
||||||
"https://src.koozali.org/api/v1/repos/$SOURCEORG/$SOURCEPKG/forks" \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-H "Authorization: token $SOURCEACCESSTOKEN" \
|
|
||||||
-d '{
|
|
||||||
"name": "'"$TARGETPKG"'",
|
|
||||||
"description": "'"SMEServer Koozali developed git repo for $TARGETPKG base"'"
|
|
||||||
}')
|
|
||||||
|
|
||||||
# create a Bugzilla URL
|
|
||||||
PRODUCTBUGZILLA="SME%20Server%2010.X"
|
|
||||||
if [[ "$SOURCEORG" == "smecontribs" ]]; then
|
|
||||||
PRODUCTBUGZILLA="SME%20Contribs"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# find the relevant wiki entry
|
|
||||||
WIKILINK="https://wiki.koozali.org"
|
|
||||||
MEDIAWIKI_SITE="https://wiki.koozali.org/api.php"
|
|
||||||
SEARCH_TERM=${SOURCEPKG/e-smith-/}
|
|
||||||
|
|
||||||
# Call the API to perform the search and store the JSON response in a variable
|
|
||||||
RESPONSE=$(curl -s "$MEDIAWIKI_SITE?action=query&format=json&list=search&srsearch=${SEARCH_TERM}&srprop=size%7Cwordcount%7Ctimestamp%7Csnippet&srlimit=10")
|
|
||||||
|
|
||||||
# Use jq to extract the titles and pageids of the pages that match the search term (case-insensitive)
|
|
||||||
RESULTS=$(echo "$RESPONSE" | jq -r '.query.search[] | select(.title | ascii_downcase | contains("'"${SEARCH_TERM}"'" | ascii_downcase)) | .title, .pageid')
|
|
||||||
|
|
||||||
# Loop through the results and construct the URL for each page
|
|
||||||
URLS=$(while read -r TITLE; do \
|
|
||||||
read -r PAGEID; \
|
|
||||||
URL="https://wiki.koozali.org/${TITLE}"; \
|
|
||||||
URL=$(echo $URL | sed 's/ /_/g'); \
|
|
||||||
echo "<br />${URL}"; \
|
|
||||||
done <<< "${RESULTS}" )
|
|
||||||
# and get the first non french (sorry JP!)
|
|
||||||
WIKILINK=$(while read -r TITLE; do \
|
|
||||||
read -r PAGEID; \
|
|
||||||
URL="https://wiki.koozali.org/${TITLE}"; \
|
|
||||||
URL=$(echo $URL | sed 's/ /_/g'); \
|
|
||||||
if [[ ! "$URL" =~ 'fr' ]] ; then echo "${URL}"; break; fi \
|
|
||||||
done <<< "${RESULTS}" )
|
|
||||||
|
|
||||||
if [ $DEBUG ] ; then echo "Updating Description, Bug and Wiki links" ; fi
|
|
||||||
RESPONSE=$(curl "$SILENT" "$checkSSL" -X 'PATCH' \
|
|
||||||
"$SOURCEHOST/api/v1/repos/$TARGETORG/$TARGETPKG" \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H "Authorization: token $SOURCEACCESSTOKEN" \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d '{
|
|
||||||
"description": "'"SMEServer Koozali developed repo for $TARGETPKG base"'",
|
|
||||||
"has_issues": true,
|
|
||||||
"external_tracker": {
|
|
||||||
"external_tracker_format": "https://bugs.koozali.org/show_bug.cgi?id={index}",
|
|
||||||
"external_tracker_style": "numeric",
|
|
||||||
"external_tracker_url": "'"https://bugs.koozali.org/buglist.cgi?component=$TARGETPKG&product=$PRODUCTBUGZILLA"'"
|
|
||||||
},
|
|
||||||
"has_wiki": true,
|
|
||||||
"external_wiki": {
|
|
||||||
"external_wiki_url": "'"$WIKILINK"'"
|
|
||||||
}
|
|
||||||
}'
|
|
||||||
)
|
|
||||||
|
|
||||||
# Create the local Git repository
|
|
||||||
GITFiles=$WORKDIR/GITFiles/$TARGETORG
|
|
||||||
mkdir -p $GITFiles
|
|
||||||
cd $GITFiles
|
|
||||||
|
|
||||||
# Delete the local first
|
|
||||||
if [ -d "$TARGETPKG" ] ; then
|
|
||||||
if [ $DEBUG ] ; then echo "Deleting local GIT files" ; fi
|
|
||||||
rm -Rf $GITFiles/$TARGETPKG
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clone the package
|
|
||||||
if [ $DEBUG ] ; then echo "git clone $SOURCEHOST/$TARGETORG/$TARGETPKG.git" ; fi
|
|
||||||
cd $GITFiles
|
|
||||||
git clone "$SOURCEHOST/$TARGETORG/$TARGETPKG.git" $QUIET
|
|
||||||
cd $GITFiles/$TARGETPKG
|
|
||||||
|
|
||||||
#Update README.md
|
|
||||||
# - new name
|
|
||||||
sed -i 's/e-smith/smeserver/g' README.md
|
|
||||||
|
|
||||||
# - Bugzilla link to new name whilst keeping old link for Legacy
|
|
||||||
sed -i '/Show list/p' README.md
|
|
||||||
sed -i "/Show list/{ n; s/Show list of outstanding bugs\:/And a list of outstanding Legacy bugs\: ($SOURCEPKG)/}" README.md
|
|
||||||
sed -i '/Show list/{ n; s/smeserver-/e-smith-/g}' README.md
|
|
||||||
sed -i '/Show list/ s/)/)\\/' README.md
|
|
||||||
|
|
||||||
git add README.md
|
|
||||||
|
|
||||||
#Update Makefile
|
|
||||||
# - NAME := smeserver-<pkg>
|
|
||||||
|
|
||||||
sed -i 's/e-smith/smeserver/g' Makefile
|
|
||||||
git add Makefile
|
|
||||||
|
|
||||||
# spec file
|
|
||||||
#Rename e-smith-<pkg>.spec as smeserver-<pkg>.spec
|
|
||||||
git mv "$SOURCEPKG.spec" "$TARGETPKG.spec"
|
|
||||||
|
|
||||||
#Update smeserver-<pkg>.spec
|
|
||||||
# - change name to smeserver-<pkg>
|
|
||||||
sed -i "/^Summary:/ s/e-smith/smeserver/" "$TARGETPKG.spec"
|
|
||||||
sed -i "s/^%define name.*$SOURCEPKG/%define name $TARGETPKG/" "$TARGETPKG.spec"
|
|
||||||
sed -i "/^%description/{ n; s/e-smith/smeserver/}" "$TARGETPKG.spec"
|
|
||||||
|
|
||||||
# - change all Requires: and BuildRequires: e-smith* to smeserver*
|
|
||||||
sed -i 's/^Requires:.*e-smith/Requires: smeserver/g' "$TARGETPKG.spec"
|
|
||||||
sed -i 's/^BuildRequires:.*e-smith/BuildRequires: smeserver/g' "$TARGETPKG.spec"
|
|
||||||
|
|
||||||
# - add changelog entry (Bugzilla #12359)
|
|
||||||
# Bump the release and add changelog
|
|
||||||
change-log "$TARGETPKG.spec" >/dev/null 2>&1
|
|
||||||
# and edit in the reason and add by whom
|
|
||||||
sed -i "s/fix \[SME: \]/Rename to $TARGETPKG \[SME: 12359\]/" "$TARGETPKG.spec"
|
|
||||||
sed -i 's/ME MYSELF <myemail@koozali.org>/rename-e-smith-pkg.sh by Trevor Batley <trevor@batley.id.au>/' "$TARGETPKG.spec"
|
|
||||||
|
|
||||||
# - add PROVIDES: smeserver-<pkg>
|
|
||||||
sed -i "/%description/i Provides: $SOURCEPKG" "$TARGETPKG.spec"
|
|
||||||
|
|
||||||
# - change Source: to new standard of tar.gz
|
|
||||||
sed -i "/^Source:/ s/tar.xz/tar.gz/" "$TARGETPKG.spec"
|
|
||||||
|
|
||||||
# tell git about the changes
|
|
||||||
git add "$TARGETPKG.spec"
|
|
||||||
|
|
||||||
#Delete archivefilename file if it follows the new standard
|
|
||||||
if [ -e archivefilename ] ; then git rm archivefilename $QUIET ; fi
|
|
||||||
|
|
||||||
#Update createlinks
|
|
||||||
# - if there is an e-smith-<pkg>-update event rename to smeserver-<pkg>-update and add symlink
|
|
||||||
|
|
||||||
git commit -m "rename-e-smith-pkg script (#12359)" $QUIET
|
|
||||||
git push origin &> /dev/null
|
|
||||||
|
|
||||||
#Convert repository to a Regular Repository (rather than fork)
|
|
||||||
#Can't do via API call ATM, so leave a message
|
|
||||||
if [[ -z $NOOUTPUT ]] ; then
|
|
||||||
echo "$SOURCEORG/$SOURCEPKG has been renamed as $TARGETORG/$TARGETPKG"
|
|
||||||
echo "It is still a forked repository, so you need to 'Convert to Regular Repository' in GITEA and then 'Transfer' it to it's final Organisation"
|
|
||||||
fi
|
|
||||||
exit 0
|
|
Reference in New Issue
Block a user