From a6555b5246b965038664e9538f2c0db2c5a71cfd Mon Sep 17 00:00:00 2001 From: Jacob Hrbek Date: Thu, 22 Sep 2022 11:18:00 +0200 Subject: [PATCH] Add guile script to pull upstream --- automation/common.scm | 19 ++++++++++++++++++ automation/hotfixes.scm | 33 ++++++++++++++++++++++++++++++++ automation/pull-upstream.scm | 37 ++++++++++++++++++------------------ 3 files changed, 70 insertions(+), 19 deletions(-) create mode 100755 automation/common.scm create mode 100755 automation/hotfixes.scm diff --git a/automation/common.scm b/automation/common.scm new file mode 100755 index 0000000000..2be4aed5df --- /dev/null +++ b/automation/common.scm @@ -0,0 +1,19 @@ +#!/usr/bin/env sh +exec guile -s "$0" "$@" +!# +;;;C DNM: Title +;;;C Copyright (C) 2022 Jacob Hrbek +;;;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 + +;(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 diff --git a/automation/hotfixes.scm b/automation/hotfixes.scm new file mode 100755 index 0000000000..6630b87ef1 --- /dev/null +++ b/automation/hotfixes.scm @@ -0,0 +1,33 @@ +#!/usr/bin/env sh +exec guile -s "$0" "$@" +!# +;;;C DNM: Title +;;;C Copyright (C) 2022 Jacob Hrbek +;;;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 + +;(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 diff --git a/automation/pull-upstream.scm b/automation/pull-upstream.scm index f924c913fa..aec0c5a4f6 100755 --- a/automation/pull-upstream.scm +++ b/automation/pull-upstream.scm @@ -1,28 +1,27 @@ #!/usr/bin/env sh exec guile -s "$0" "$@" !# -;;; The Project Manager ("pman") -- GNU Guile-based solution for project management -;;; Copyright (C) 2022 Jacob Hrbek -;;; -;;; 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. -;;; -;;; You should have received a copy of the GNU General Public license along with this project. If not, see +;;;C DNM: Title +;;;C Copyright (C) 2022 Jacob Hrbek +;;;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 -;(use-modules ()) +#;(use-modules + (git) + (git checkout)) -(define (git-checkout branch) - "Git checkout on set BRANCH" - (system* "git" "checkout" branch)) +;;; GNU Guile script to keep the 'upstream' branch up to date with upstream repository -(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 pull from REMOTE and optional BRANCH" - (system* - "git" - "pull" - remote)) +(git:checkout-index %repodir "upstream") -(git-pull "upstream" "master") +(git:pull %repodir) +(git:push %repodir "upstream") + +;;;X pull-upstream.scm ends here