I would like to discuss a suggestion to the PKGBUILD format.
Let's take a snippet from the "kdevelop-git" PKGBUILD file [1] .
# ...
_gitroot="git://anongit.kde.org/kdevelop"
_gitname="kdevelop"
build() {
cd "$srcdir"
msg "Connecting to Git server...."
if [ -d $_gitname ] ; then
cd $_gitname && git pull origin
msg "The local files are updated."
else
git clone $_gitroot $_gitname
fi
msg "Git checkout done."
msg "Starting make..."
# ...
If you have looked at some PKGBUILDs where the package is built from a git source you might have seen these lines quite often. The Problem with this example is that it does not use the "--depth 1" option from git. This option can save you a LOT of bandwith when you *only* need to build a large repository and are not interested in the last 3 year history of it.
This strategy has already been discussed here on the board but I think it is very important for people with low bandwidth and for overall bandwith savings to enable this option in PKGBUILDs where you clone from git repositories.
I would like to suggest that 'makepkg' should take care of prefetching the (git-)repository if it can find the "$_gitroot" and "$_gitname" variables. This should happen in a step before 'build()' so that when the 'build()' function begins the repository is already preloaded. Important is that makepkg should do this with the "--depth 1" option. This is also adaptable for mercurial and svn and cvs repositories.
Gentoo , for example , is already doing this with their EGIT_REPO_URI variable.
I have not looked at the code of makepkg yet but it looks like you already have some similar code for it when you unzip source tarballs. The benefit of this method is also that you would not break existing PKGBUILDs as they would run into the first if statement and just try to pull again from the repository. In the long term package maintainers could get rid of these redundant statements.
If you want I could write a patch for makepkg to do this routine.
I hope you like the idea and please tell me your opinions.
Best,
Daniel Nagy