Add guile script to pull upstream

This commit is contained in:
Jacob Hrbek 2022-09-22 11:15:41 +02:00
parent ee2249b4bd
commit c7be6e27a6
Signed by: kreyren
GPG Key ID: 667F0DAFAF09BA2B
3 changed files with 70 additions and 19 deletions

19
automation/common.scm Executable file

@ -0,0 +1,19 @@
#!/usr/bin/env sh
exec guile -s "$0" "$@"
!#
;;;C DNM: Title
;;;C Copyright (C) 2022 Jacob Hrbek <kreyren@rixotstudio.cz>
;;;C
;;;C This file is Free/Libre Open-Source Software; you may copy, redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
;;;C This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
;;;C
;;;C You should have received a copy of the GNU General Public license along with this project. If not, see <http://www.gnu.org/licenses>
;(use-modules ())
;;; GNU Guile script library for definitions used for automation
;;; String containing the full path to the project's repository
(define %repodir (string-append (dirname (current-filename)) "/.."))
;;; common.scm ends here

33
automation/hotfixes.scm Executable file

@ -0,0 +1,33 @@
#!/usr/bin/env sh
exec guile -s "$0" "$@"
!#
;;;C DNM: Title
;;;C Copyright (C) 2022 Jacob Hrbek <kreyren@rixotstudio.cz>
;;;C
;;;C This file is Free/Libre Open-Source Software; you may copy, redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
;;;C This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
;;;C
;;;C You should have received a copy of the GNU General Public license along with this project. If not, see <http://www.gnu.org/licenses>
;(use-modules ())
;;; GNU Guile script library for hotfix code used for automatization
;; FIXME(Krey): I found guile-git library to do the checkout which is as of 22/09/22-EU unfinished on https://gitlab.com/guile-git/guile-git/-/blob/master/git/checkout.scm so writting custom handling which should be replaced when/if it gets finished
;; DO-NOT-CONTRIBUTE(Krey): Just a quick wrapper because the handling is not finished in guile-git library
(define (git:checkout-index repository branch)
"Quick handling to checkout the git branch of REPOSITORY on BRANCH"
(system* "git" (string-append "--work-tree=" repository) "checkout" branch))
;; DO-NOT-CONTRIBUTE(Krey): Just a quick wrapper because the handling is not finished in guile-git library
(define (git:pull repository)
"Quick handling to invoke git pull in REPOSITORY"
(system* "git" (string-append "--work-tree=" repository) "pull"))
;; DO-NOT-CONTRIBUTE(Krey): Just a quick wrapper because the handling is not finished in guile-git library
(define (git:push repository branch)
"Quick handling to invoke git push in REPOSITORY with BRANCH"
(system* "git" (string-append "--work-tree=" repository) push repository branch))
;;;X hotfixes.scm ends here

@ -1,28 +1,27 @@
#!/usr/bin/env sh #!/usr/bin/env sh
exec guile -s "$0" "$@" exec guile -s "$0" "$@"
!# !#
;;; The Project Manager ("pman") -- GNU Guile-based solution for project management ;;;C DNM: Title
;;; Copyright (C) 2022 Jacob Hrbek <kreyren@rixotstudio.cz> ;;;C Copyright (C) 2022 Jacob Hrbek <kreyren@rixotstudio.cz>
;;; ;;;C
;;; This file is Free/Libre Open-Source Software; you may copy, redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. ;;;C This file is Free/Libre Open-Source Software; you may copy, redistribute and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version.
;;; This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ;;;C This file is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
;;; ;;;C
;;; You should have received a copy of the GNU General Public license along with this project. If not, see <http://www.gnu.org/licenses> ;;;C You should have received a copy of the GNU General Public license along with this project. If not, see <http://www.gnu.org/licenses>
;(use-modules ()) #;(use-modules
(git)
(git checkout))
(define (git-checkout branch) ;;; GNU Guile script to keep the 'upstream' branch up to date with upstream repository
"Git checkout on set BRANCH"
(system* "git" "checkout" branch))
(git-checkout "upstream") (load (string-append (dirname (current-filename)) "/common.scm"))
(load (string-append (dirname (current-filename)) "/hotfixes.scm"))
(define* (git-pull remote #:optional branch) (git:checkout-index %repodir "upstream")
"Git pull from REMOTE and optional BRANCH"
(system*
"git"
"pull"
remote))
(git-pull "upstream" "master") (git:pull %repodir)
(git:push %repodir "upstream")
;;;X pull-upstream.scm ends here