[arch-general] PKGBUILD.proto improvements

Rogutės Sparnuotos rogutes at googlemail.com
Fri Jul 22 16:41:59 EDT 2011


C Anthony Risinger (2011-07-22 11:25):
> On Thu, Jul 21, 2011 at 5:08 PM, Rogutės Sparnuotos
> <rogutes at googlemail.com> wrote:
> > C Anthony Risinger (2011-07-21 16:42):
> >> ... the motivation of this message is to encourage adding some
> >> routines to the makepkg library, similar to msg/msg2/warning/etc, to
> >> handle development checkouts.  basically i see people using _gitroot
> >> and _gitname for different stuff ... namely _gitname.  i'd like to see
> >> a routine that pulls the repo to a known location so it doenst get
> >> blown away every update, and so the user doesnt have to manually
> >> manage this.  everyone does it differently, puts the repository in all
> >> sorts of different locations/etc, and it just isnt very pretty IMO.
> > <snip>
> >
> > I am sure you didn't ask, but I use $SRCDEST/scm for this, do not define
> > sources=() and run this in build():
> >  cp -r "$SRCDEST/scm/$pkgname" "$srcdir/"
> 
> nah i didnt ask, but hey no one needs my approval anyway :-)
> 
> i started off doing it just like that too ... but there are some problems:
> 
> ) mkchrootpkg sets that variable itself, ie. it's not stable
> ) ... *anyone* can set it, ie. it's very not stable
> ) more of a runtime/per-invocation/cache setting vs. a stable/known location
> ) not overridable from env in mkchrootpkg without patch (use of sudo kills env)

mkarchroot/makechrootpkg should learn to bind mount $SRCDEST to /srcdest.
And $SRCDEST/scm could be 
  chmod 0775 $SRCDEST/scm && chgrp builder $SRCDEST/scm
And the 'builder' group id could be synced between chroot and the real
system.

> also, $SRCDEST is still a "cache" location, like the pacman cache.
> it's safe to delete.  in fact that's what `--cleancache` in makepkg
> does ... i want to establish a known STABLE location because it's NOT
> safe to delete repos unless you really really REALLY mean to.

--cleancache doesn't delete directories, so $SRCDEST/scm stays in place :)
And you should know what you are doing when saying --cleancache.

> additionally, your routine, while it would work for most simple/small
> packages, would cause a 1GB+ copy and then a massive checkout for my
> reference PKGBUILD *everytime* i ran makepkg.  considering this
> package take several hours to build on a fairly powerful machine, up
> to 8+ on a normal machine, i'd prefer if it didn't wipe it out when
> something failed :-)  my routines are specifically designed for
> maximum reuse and minimum downtime.  if everyone used the same
> routines, we could have *automagic* sharing between competing
> PKGBUILDs, AND i could reuse those repositories for my own development
> tinkerings.

Your reference PKGBUILD is a very bad example. What happened to the good
old simple PKGBUILDs?

> ... imo development packages should be able to mirror the options of
> regular packages as close as possible, eg.`--noextract` should build
> without a sync/checkout, `--nobuild` should sync/checkout without a
> build, maybe even `--allsource` does a checkout + bundling.

All this needs support in makepkg.
Your mail subject says "PKGBUILD.proto improvements" and your text talks
about some custom, agreed upon routine for SCM handling, but what you
really want is SCM support in makepkg. Well, you are not alone:
https://bugs.archlinux.org/task/16384#comment50310
https://bugs.archlinux.org/task/16872

Anyway, not sure why I am arguing, because I am not intending to write the
code and haven't done enough homework :)

Btw., makepkg currently runs this on files in the source=() array:
  ln -s "$SRCDEST/$file" "$srcdir/"
It could learn to parse smth. like this (but I am sure there exists a case
where one needs to pull more than 1 repo):
  source=(xxx.patch [git]="git://git.sv.gnu.org/pythonwebkit.git")
When encountering a [git] subscript, makepkg could call some internal
function and download to $SRCDEST/scm/, or call fetch_git() if it is
defined in the PKGBUILD (cd'ing to $SRCDEST/scm before call, executing
`ln -s "$SRCDEST/scm/$_gitname" "$srcdir/"` afterwards)...

-- 
--  Rogutės Sparnuotos


More information about the arch-general mailing list