[arch-general] Any suggestions on frequently rebuilding a git package?

C Anthony Risinger anthony at xtfx.me
Mon Sep 19 12:46:24 EDT 2011


On Mon, Sep 19, 2011 at 11:36 AM, C Anthony Risinger <anthony at xtfx.me> wrote:
> 2011/9/19 Lukáš Jirkovský <l.jirkovsky at gmail.com>:
>> On 18 September 2011 17:33, XeCycle <xecycle at gmail.com> wrote:
>>>
>>> Hi, I build Emacs from git quite frequently, about twice a month or so.
>>> However the PKGBUILD from AUR rebuilds everything each time, which takes
>>> too many time I think.  Perhaps Emacs is small, but I think there should
>>> be a way to prevent too many rebuilds --- is that possible?
>>
>> I don't know which package you are using, but in my opinion the best
>> approach is the following:
>>
>> Look in the PKGBUILD and change "cd $srcdir/some_build_directory"
>> (which is most likely created git clone) to a directory where the
>> sources are downloaded (in most cases it's "$srcdir/$_gitname"). Now
>> when you build package using makepkg, only the updated sources are
>> rebuilt.
>>
>> Generally, it's a good idea to read and understand the PKGBUILD before
>> building. Then it's pretty simple to edit it in way which allows
>> incremental builds.
>>
>> If you would have any problems with editing this particular PKGBUILD
>> to suit your need, you can send the it here and I (or maybe someone
>> else) will try to help you with that.
>
> i posted the solution i use for my AUR/internal packages awhile back,
> with the intention of suggesting it as a standardized way to handle
> this use case:
>
> http://mailman.archlinux.org/pipermail/arch-general/2011-July/021078.html
>
> ... not all that long of a thread ;-), but i'll highlight a few key
> benefits over locally storing repositories [in build dir], or other ad
> hoc solutions:
>
> ) uses a targeted fetch instead of a naive clone (for kernel IIRC you
> get ~50% size reduction, something like ~180MB)
> ) stores repositories in a known list of locations, with predictable
> ordering (allows for reuse between package variants)
> ) generates a lightweight proxy in the event a repository is found but
> it is read-only (allows for safe use concurrently or within a chroot
> [mkchrootpkg])
>
> ... this doesn't stop emacs/etc from needing a fresh rebuild each
> time, but the repo will forever be intact until removed (it was
> unclear if the OP used `rebuild` in the sense of the software [make]
> or the repo [clone])
>
> you'd need to add the routines to the target package (they are at the
> end of the link i provided).  this package:
>
> http://aur.archlinux.org/packages/py/pyjamas-engine-pythonwebkit/PKGBUILD
>
> ... makes use of them, and serves as an example.  it's not quite as
> "simple" or "KISS" as some may prefer, but hey, features/flexibility
> don't always agree with simplicity ... it's not complicated, but it's
> not a one-liner either.  in the end it saves me a whole 'lotta time,
> and frankly, what else really matters?

... ah forgot to mention one other thing i found to be useful; said
routines introduce the concept of a `_gitspec` variable -- this var
falls back to `_gitname` (the branch to be checked out) if missing,
and is used when the working directory is being updated:

git --git-dir="${g}" --work-tree="${w}" read-tree --reset -u
"${_gitspec:-${_gitname}}"

... setting it allows you build any arbitrary revision (must exist on
the branch your targeting -- targeted fetch means you don't have the
whole repo, only the specific branch you need).  i've used this to
quickly rebuild stuff when HEAD turned out to be busted, bisecting for
bugs, etc.

-- 

C Anthony


More information about the arch-general mailing list