~alpine/devel

2 2

[alpine-devel] How to handle regular git/svn builds

Mark Constable <markc@renta.net>
Details
Message ID
<4A779F91.6090707@renta.net>
Sender timestamp
1249353617
DKIM signature
missing
Download raw message
Perhaps I missed something obvious but I haven't yet come across
an example of an APKBUILD pulling source from git or svn repos.

ATM I do this with Archlinux by using a non-standard getsource()
function in the PKGBUILD. I don't want to use the standard way
for two reasons, a) it needlessly self modifies the $pkgver
variable in the PKGBUILD and b) expects to pull the git/svn
source into $srcdir rather than my preferred $SRCDEST.

The implications of a) is that every PKGBUILD is changed with
every build so when it comes time to commit the source package
changes then EVERY package is going to have a be committed even
though it's only a redundant $pkgver variable update that is
not even used. It just creates useless git log noise.

I solve this problem by using $pkgrel=$(date -u +%Y%m%d%H) which
dynamically updates that field and allows me to build unique
packages multiple times per day without modifying the PKGBUILD.

The second b) point is that I have about 20Gb of cloned and checked
out sources and there is no way I want all that bulk intermixed
in with my source packages.

Anyway, this works but I'm wondering what any official thoughts
about handling this might be?

--markc

-----------------------------------------------------------------
pkgname=apk-tools
pkgver=2.0_pre17
pkgrel=$(date -u +%Y%m%d%H)
pkgdesc="Alpine Package Keeper - package manager for alpine"
depends=
makedepends="zlib-dev openssl-dev pkgconfig"
source="0001-db-fix-checksum-storing-to-db.patch
0001-io-fix-corruption-of-big-files-on-mmap-write.patch"

url="http://git.alpinelinux.org/cgit/apk-tools/"
license=GPL-2

build()
{
  _getsource || return 1

  cd "$srcdir/$pkgname-$pkgver"
  sed -i -e 's:-Werror::' Make.rules
  make || return 1
  make DESTDIR="$pkgdir" install
  cd "$pkgdir/sbin"
  ln -s apk apk_add
  ln -s apk apk_audit
  ln -s apk apk_del
  ln -s apk apk_index
  ln -s apk apk_info
  ln -s apk apk_version
}

_getsource()
{
  [ -d $SRCDEST ] && cd $SRCDEST || return 1
  if [ -d $pkgname/.git ]; then
    cd $pkgname && git pull origin
  else
    git clone git://git.alpinelinux.org/apk-tools $pkgname
  fi
  rsync -a --cvs-exclude --delete $SRCDEST/$pkgname/ $srcdir/$pkgname-$pkgver
}

md5sums="d7944308cefe6f5fc45a24e1840d087e  0001-db-fix-checksum-storing-to-db.patch
57693255bb36abe74423578b83ff2cf4  0001-io-fix-corruption-of-big-files-on-mmap-write.patch"
-----------------------------------------------------------------


# . /etc/abuild.conf
# ll $REPODEST/main/apk*
-rw-r--r--    1 root     root        40419 Aug  4 02:22 /home/packages/main/apk-tools-2.0_pre17-r2009080402.apk


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Details
Message ID
<1249368727.12941.69.camel@localhost.localdomain>
In-Reply-To
<4A779F91.6090707@renta.net> (view parent)
Sender timestamp
1249368727
DKIM signature
missing
Download raw message
On Tue, 2009-08-04 at 12:40 +1000, Mark Constable wrote:
> Perhaps I missed something obvious but I haven't yet come across
> an example of an APKBUILD pulling source from git or svn repos.

I think I copied some examples from Archlinux... oh... I didnt ship them
with the release. Probably because I was not sure how to deal with it
officially.


> ATM I do this with Archlinux by using a non-standard getsource()
> function in the PKGBUILD. I don't want to use the standard way
> for two reasons, a) it needlessly self modifies the $pkgver
> variable in the PKGBUILD and b) expects to pull the git/svn
> source into $srcdir rather than my preferred $SRCDEST.
> 
> The implications of a) is that every PKGBUILD is changed with
> every build so when it comes time to commit the source package
> changes then EVERY package is going to have a be committed even
> though it's only a redundant $pkgver variable update that is
> not even used. It just creates useless git log noise.

not really following here. You dont need to commit if you dont want log
noise? If you do have a new build, new package, then its nice to have
tha logged?

> I solve this problem by using $pkgrel=$(date -u +%Y%m%d%H) which
> dynamically updates that field and allows me to build unique
> packages multiple times per day without modifying the PKGBUILD.

The drawback with this is that you will fork in global scope which is a
no-no from performance point of view. Its no problem if you have 1 or
two APKBUILDs doing this but it might be a problem if we get many many
APKBUILDs.

> The second b) point is that I have about 20Gb of cloned and checked
> out sources and there is no way I want all that bulk intermixed
> in with my source packages.
> 
> Anyway, this works but I'm wondering what any official thoughts
> about handling this might be?

sounds like you have more experience than me in this field. Personally i
dont create packages of git/svn versions. I prefer snapshots.

When i work on something I do 'make install' and just install it rather
than package it first.

Hm. I wonder if we could use git-describe to set the version.




> 
> --markc
> 
> -----------------------------------------------------------------
> pkgname=apk-tools
> pkgver=2.0_pre17
> pkgrel=$(date -u +%Y%m%d%H)
> pkgdesc="Alpine Package Keeper - package manager for alpine"
> depends=
> makedepends="zlib-dev openssl-dev pkgconfig"
> source="0001-db-fix-checksum-storing-to-db.patch
> 0001-io-fix-corruption-of-big-files-on-mmap-write.patch"
> 
> url="http://git.alpinelinux.org/cgit/apk-tools/"
> license=GPL-2
> 
> build()
> {
>   _getsource || return 1
> 
>   cd "$srcdir/$pkgname-$pkgver"
>   sed -i -e 's:-Werror::' Make.rules
>   make || return 1
>   make DESTDIR="$pkgdir" install
>   cd "$pkgdir/sbin"
>   ln -s apk apk_add
>   ln -s apk apk_audit
>   ln -s apk apk_del
>   ln -s apk apk_index
>   ln -s apk apk_info
>   ln -s apk apk_version
> }
> 
> _getsource()
> {
>   [ -d $SRCDEST ] && cd $SRCDEST || return 1

You need quotes "$SRCDEST" (or paths with spaces will break things for
you).

>   if [ -d $pkgname/.git ]; then
>     cd $pkgname && git pull origin
>   else
>     git clone git://git.alpinelinux.org/apk-tools $pkgname
>   fi
>   rsync -a --cvs-exclude --delete $SRCDEST/$pkgname/ $srcdir/$pkgname-$pkgver

you need to append rsync to makedepends.

> }


well, there are several ways to deal with svn/git packages, I think we
in general prefers to have the official packages only use releases, or
in worst case, snapshots.

It would still be nice to have some recommended way to build custom
svn/git packages.

-nc



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Mark Constable <markc@renta.net>
Details
Message ID
<4A77E878.9070202@renta.net>
In-Reply-To
<1249368727.12941.69.camel@localhost.localdomain> (view parent)
Sender timestamp
1249372280
DKIM signature
missing
Download raw message
I know replying to myself can be considered rude but I'm not
sure why when it is a direct on-topic extension to the discussion.

Regarding this example, I now have this update installed within
seconds of seeing this message because I have modified my local
abuild source package to pull directly from git. It could be in
my public binary repo in another few minutes if I rsync'd it up.

[Alpine build tools - Feature #112] (Closed) An option to skip all dependency checks

--markc


Again FWIW, ...

--------------------------------------------------------------
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgdesc="Script to build Alpine Packages"
pkgname=abuild
pkgver=2.0_rc4
pkgrel=$(date -u +%Y%m%d%H)
url=http://git.alpinelinux.org/cgit/abuild/
source=""
depends="fakeroot file sudo pax-utils openssl apk-tools"
makedepends="openssl-dev pkgconfig"
license=GPL-2

build()
{
  _getsource || return 1
  cd "$srcdir/$pkgname-$pkgver"
  make install DESTDIR="$pkgdir"
  install -m 644 abuild.conf "$pkgdir"/etc/abuild.conf
}

_getsource()
{
  [ -d $SRCDEST ] && cd $SRCDEST || return 1
  if [ -d $pkgname/.git ]; then
    cd $pkgname && git pull origin
  else
    git clone git://git.alpinelinux.org/abuild $pkgname
  fi
  rsync -a --cvs-exclude --delete $SRCDEST/$pkgname/ $srcdir/$pkgname-$pkgver
}


---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)