Make auto update working.

This commit is contained in:
Cor Legemaat 2025-07-28 10:19:50 +02:00
parent 878d52ee27
commit 97e30a68ec
3 changed files with 33 additions and 17 deletions

View file

@ -15,7 +15,7 @@ ebuild-autogen. If not, see <https://www.gnu.org/licenses/>.
m4_define([version_major], [0]) m4_define([version_major], [0])
m4_define([version_minor], [0]) m4_define([version_minor], [0])
m4_define([version_revision], [0]) m4_define([version_revision], [1])
AC_PACKAGE_URL([http://www.cor.za.net/code/ebuild-autogen]) AC_PACKAGE_URL([http://www.cor.za.net/code/ebuild-autogen])
AC_INIT(ebuild-autogen, AC_INIT(ebuild-autogen,

View file

@ -45,7 +45,7 @@
(synopsis "The verbosity level.")) (synopsis "The verbosity level."))
(switch (switch
(name 'submodule-update) (default #false) (test boolean?) (name 'submodule-update) (default #false) (test boolean?)
(synopsis "Fetch update subtree source repo")) (synopsis "Fetch update submodule source repo"))
(switch (switch
(name 'pkg-clean) (default #false) (test boolean?) (name 'pkg-clean) (default #false) (test boolean?)
(synopsis "Remove packages from repo that's not in autogen subtree.")) (synopsis "Remove packages from repo that's not in autogen subtree."))
@ -174,7 +174,8 @@ git repository.")
"" ""
"autogen" "autogen"
"README-repo.org" "README-repo.org"
(option-ref options 'verbosity)) (option-ref options 'verbosity)
#:file-dst "README.org")
(cp-repo-file repo (cp-repo-file repo
"" ""
"autogen" "autogen"
@ -318,7 +319,7 @@ git repository.")
repo-pkgs))) repo-pkgs)))
;; Commit and push the updates to master if requested. ;; Commit and push the updates to master if requested.
(if (option-ref options 'repo-push) (if (option-ref options 'remote-push)
(repo-push-master)) (repo-push-master repo))
(display "Completed successfully ...") (newline))))) (display "Completed successfully ...") (newline)))))

View file

@ -25,6 +25,7 @@
#:use-module (git bindings) #:use-module (git bindings)
#:use-module (git repository) #:use-module (git repository)
#:use-module (git clone) #:use-module (git clone)
#:use-module (git checkout)
#:use-module (git submodule) #:use-module (git submodule)
#:use-module (rx irregex)) #:use-module (rx irregex))
@ -70,14 +71,23 @@
(define-public repo-update-src (define-public repo-update-src
(lambda (path) (lambda (path)
"" ""
(submodule-update (submodule-lookup (repository-open path) (let ((repo (submodule-lookup (repository-open path)
"autogen")))) "autogen"))
(old-cwd (getcwd)))
;;Not working for updates only init?
;;(submodule-update repo)
(system* "/usr/bin/git" "submodule" "update" "autogen")
(chdir (string-join (list path "autogen")
file-name-separator-string))
(system* "/usr/bin/git" "checkout" "main")
(chdir old-cwd))))
;; TODO guile-git method... ;; TODO guile-git method...
;; https://stackoverflow.com/questions/572549/difference-between-git-add-a-and-git-add ;; https://stackoverflow.com/questions/572549/difference-between-git-add-a-and-git-add
(define-public repo-push-master (define-public repo-push-master
(lambda () (lambda (path)
"" ""
(chdir path)
(system* "/usr/bin/git" "add" "-A") (system* "/usr/bin/git" "add" "-A")
(system* "/usr/bin/git" "commit" "-m" "ebuild-autogen update") (system* "/usr/bin/git" "commit" "-m" "ebuild-autogen update")
(system* "/usr/bin/git" "push" "origin" "master"))) (system* "/usr/bin/git" "push" "origin" "master")))
@ -107,7 +117,18 @@
(list sub-folder file)) (list sub-folder file))
file-name-separator-string)) file-name-separator-string))
'())) '()))
files)))) files)))
(finish (lambda ()
(if (string-suffix? ".ebuild" file-dst)
(system* "ebuild"
(string-join (list folder-dst
file-dst)
file-name-separator-string)
"manifest"))
(list (string-join (if (string=? sub-folder "")
(list file-dst)
(list sub-folder file))
file-name-separator-string)))))
(if (eq? (stat:type (stat file-in)) 'directory) (if (eq? (stat:type (stat file-in)) 'directory)
(if (file-exists? file-out) (if (file-exists? file-out)
(if (eq? (stat:type (stat file-out)) 'directory) (if (eq? (stat:type (stat file-out)) 'directory)
@ -137,15 +158,9 @@
(newline))) (newline)))
(display data-in output-port) (display data-in output-port)
(close output-port)) (close output-port))
(list (string-join (if (string=? sub-folder "") (finish)))
(list file)
(list sub-folder file))
file-name-separator-string))))
(copy-file file-in file-out)) (copy-file file-in file-out))
(list (string-join (if (string=? sub-folder "") (finish))))))
(list file)
(list sub-folder file))
file-name-separator-string)))))))
(define-public folder-list (define-public folder-list
(lambda (path ignore-meta) (lambda (path ignore-meta)