mirror of
https://github.com/release-engineering/dist-git.git
synced 2025-02-23 15:02:54 +00:00
Garbage collection script
This makes subsequent git clones from the dist-git machine much more IO effective and faster. It also saves disk space. It cleans up all unnecessary files. The dist-git-gc script will run monthly.
This commit is contained in:
parent
c30673c51c
commit
003303a065
5 changed files with 34 additions and 0 deletions
|
@ -7,6 +7,9 @@ git_author_email = rel-eng@lists.fedoraproject.org
|
|||
|
||||
lookaside_dir = /var/lib/dist-git/cache/lookaside/pkgs
|
||||
gitroot_dir = /var/lib/dist-git/git
|
||||
# relates to the dist-git-gc script (and timer),
|
||||
# we need to dive 2 levels from gitroot_dir in the directory structure
|
||||
git_gc_depth = 2
|
||||
|
||||
gitolite = True
|
||||
grok = True
|
||||
|
|
9
configs/systemd/dist-git-gc.service
Normal file
9
configs/systemd/dist-git-gc.service
Normal file
|
@ -0,0 +1,9 @@
|
|||
[Unit]
|
||||
Description=Git Repositories Clean Up
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/bin/dist-git-gc
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
8
configs/systemd/dist-git-gc.timer
Normal file
8
configs/systemd/dist-git-gc.timer
Normal file
|
@ -0,0 +1,8 @@
|
|||
[Unit]
|
||||
Description=Git Repositories Clean Up Timer
|
||||
|
||||
[Timer]
|
||||
OnCalendar=monthly
|
||||
|
||||
[Install]
|
||||
WantedBy=timers.target
|
|
@ -165,6 +165,7 @@ ln -s %{_datadir}/dist-git/setup_git_package %{buildroot}%{_bindir}/setup_git_pa
|
|||
ln -s %{_datadir}/dist-git/mkbranch %{buildroot}%{_bindir}/mkbranch
|
||||
ln -s %{_datadir}/dist-git/mkbranch_branching %{buildroot}%{_bindir}/mkbranch_branching
|
||||
ln -s %{_datadir}/dist-git/remove_unused_sources %{buildroot}%{_bindir}/remove_unused_sources
|
||||
mv %{buildroot}%{_datadir}/dist-git/dist-git-gc %{buildroot}%{_bindir}/dist-git-gc
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# SELinux
|
||||
|
@ -226,6 +227,8 @@ fi
|
|||
|
||||
%{_unitdir}/dist-git@.service
|
||||
%{_unitdir}/dist-git.socket
|
||||
%{_unitdir}/dist-git-gc.service
|
||||
%{_unitdir}/dist-git-gc.timer
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# /var/lib/ ...... dynamic persistent files
|
||||
|
|
11
scripts/dist-git/dist-git-gc
Executable file
11
scripts/dist-git/dist-git-gc
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/usr/bin/bash
|
||||
# Cleanup unnecessary files
|
||||
# The default DEPTH is 2 because the directory path is /var/lib/dist-git/git/rpms/<package>
|
||||
|
||||
REPODIR=$(crudini --get dist-git.conf dist-git gitroot_dir)
|
||||
DEPTH=$(crudini --get dist-git.conf dist-git git_gc_depth)
|
||||
|
||||
find "$REPODIR" -mindepth "$DEPTH" -maxdepth "$DEPTH" -type d |
|
||||
while read -r DIRECTORY; do
|
||||
(cd "$DIRECTORY" && git gc)
|
||||
done
|
Loading…
Add table
Reference in a new issue