You are not logged in.

#1 2013-03-17 21:47:47

drevilt
Member
Registered: 2013-03-17
Posts: 4

Refactor vcs prefetching routines out of PKGBUILDs

hi,

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

[1] https://aur.archlinux.org/packages/kd/k … t/PKGBUILD

Offline

#2 2013-03-17 22:36:28

derhamster
Member
Registered: 2012-07-08
Posts: 86

Re: Refactor vcs prefetching routines out of PKGBUILDs

You should take a look at the VCS (including git) support in the upcoming pacman 4.1. Allan wrote about it on his blog.
But I'm not sure if -depth 1 is used by default. There might be use cases, that require a complete clone of a repository.

Offline

#3 2013-03-17 23:18:49

drevilt
Member
Registered: 2013-03-17
Posts: 4

Re: Refactor vcs prefetching routines out of PKGBUILDs

great, this looks nearly exactly like what i try to achive. One second problem is that there are many PKGBUILDs which are no longer maintained. I mean the package maintainer did not flag it as unmaintained and does not respond to comments. Is there any process of flagging these packages as unmainted so that other people would be able to update the code to use the new vcs-url technique ?

Offline

#4 2013-03-18 03:37:24

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,540

Re: Refactor vcs prefetching routines out of PKGBUILDs

Procedure is documented in the wiki:

https://wiki.archlinux.org/index.php/AU … do_I_do.3F

Offline

Board footer

Powered by FluxBB