~alpine/users

3 2

[alpine-user] How do I creating a binary only package?

Details
Message ID
<CA+xeWLn=5j+6NN-K1Pf_UoC+OVCiDz3Vw6sqPbBt=AaNYaLFAw@mail.gmail.com>
Sender timestamp
1529561480
DKIM signature
missing
Download raw message
Hoping to get some pointers on how to create a binary only pkg.  I have the
binaries already compiled on Alpine and all I need to do is package them
up.  I don't want abuild to compile for me.  I already have the directory
structure layout in a separate directory ready to go.  All I need is to
package up the directory structure and create a installable package.  All
the docs reference abuild doing the compiling/etc.  Do I use abuild for
this or some other tool?

Thanks,
Dan
Paul Zillmann <p.zillmann@h6g.de>
Details
Message ID
<293f7579-94b1-4318-659d-53b17fcf36ed@h6g.de>
In-Reply-To
<CA+xeWLn=5j+6NN-K1Pf_UoC+OVCiDz3Vw6sqPbBt=AaNYaLFAw@mail.gmail.com> (view parent)
Sender timestamp
1529605092
DKIM signature
missing
Download raw message
Hello Dan,

just create a package with abuild / apkbuild.
In your APKBUILD file you have to provide a package() function which 
copies your binary data to it's final destination.
You will have to provide a build() function. Than one can be empty (or 
you return 0) - but it has to be there.

Paul

Am 21.06.2018 um 08:11 schrieb Dan Cook:
> Hoping to get some pointers on how to create a binary only pkg.  I 
> have the binaries already compiled on Alpine and all I need to do is 
> package them up.  I don't want abuild to compile for me.  I already 
> have the directory structure layout in a separate directory ready to 
> go.  All I need is to package up the directory structure and create a 
> installable package. All the docs reference abuild doing the 
> compiling/etc.  Do I use abuild for this or some other tool?
>
> Thanks,
> Dan


---
Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
Help:         alpine-user+help@lists.alpinelinux.org
---
Details
Message ID
<CA+xeWLkHLC+HaoPbhHhy54rNM-AtnES3JWbOTRHD2NWDWxWC+g@mail.gmail.com>
In-Reply-To
<293f7579-94b1-4318-659d-53b17fcf36ed@h6g.de> (view parent)
Sender timestamp
1529641700
DKIM signature
missing
Download raw message
Thanks Paul.  I will try it.  I have a question regarding the directory
structure.  I am familiar with rpm and deb packaging where the directory
structure is exactly as that on install target machine (the one installing
the pkg).  When you say the package function copies to the final
destination - which final destination - the destination from the packaging
perspective or the install.  I assume it is the package.
So for example, say I have an app called foo with the following directory
layout on the disk (after install):
  /etc/init.d/foo
  /opt/foo/bin/say_hi
  /opt/foo/etc/hello_msgs.db

After I compile my code the binaries and data directory tree is mirrored
under:  /home/dan/projects/foo/dist (very similar to rpm/deb pkg format)
So just for completeness:
   /home/dan/projects/foo/dist/etc/init.d/foo
   /home/dan/projects/foo/dist/opt/foo/bin/say_hi
   /home/dan/projects/foo/dist/opt/foo/etc/hello_msgs.db

>From the examples I have seen I would create a directory called pkg under
the /home/dan/projects/foo directory and add the following files:
  APKBUILD
  foo.XXXX scripts (like pre, post, etc).

What I am stuck on is the contents of the APKBUILD.

Let me try this very simple application and see if I can get a installable
pkg.  Any hints/tips would be helpful.

Thanks,
Dan



On Thu, Jun 21, 2018 at 11:18 AM, Paul Zillmann <p.zillmann@h6g.de> wrote:

> Hello Dan,
>
> just create a package with abuild / apkbuild.
> In your APKBUILD file you have to provide a package() function which
> copies your binary data to it's final destination.
> You will have to provide a build() function. Than one can be empty (or you
> return 0) - but it has to be there.
>
> Paul
>
>
> Am 21.06.2018 um 08:11 schrieb Dan Cook:
>
>> Hoping to get some pointers on how to create a binary only pkg.  I have
>> the binaries already compiled on Alpine and all I need to do is package
>> them up.  I don't want abuild to compile for me.  I already have the
>> directory structure layout in a separate directory ready to go.  All I need
>> is to package up the directory structure and create a installable package.
>> All the docs reference abuild doing the compiling/etc.  Do I use abuild for
>> this or some other tool?
>>
>> Thanks,
>> Dan
>>
>
>
> ---
> Unsubscribe:  alpine-user+unsubscribe@lists.alpinelinux.org
> Help:         alpine-user+help@lists.alpinelinux.org
> ---
>
>
Paul Zillmann <p.zillmann@h6g.de>
Details
Message ID
<575b8e32-932d-3997-b824-80384bc38361@h6g.de>
In-Reply-To
<CA+xeWLkHLC+HaoPbhHhy54rNM-AtnES3JWbOTRHD2NWDWxWC+g@mail.gmail.com> (view parent)
Sender timestamp
1529668282
DKIM signature
missing
Download raw message
Hello Dan,

> Thanks Paul.  I will try it.  I have a question regarding the 
> directory structure.  I am familiar with rpm and deb packaging where 
> the directory structure is exactly as that on install target machine 
> (the one installing the pkg).  When you say the package function 
> copies to the final destination - which final destination - the 
> destination from the packaging perspective or the install.  I assume 
> it is the package.
> So for example, say I have an app called foo with the following 
> directory layout on the disk (after install):
>   /etc/init.d/foo
>   /opt/foo/bin/say_hi
>   /opt/foo/etc/hello_msgs.db

That is correct. You can download an apk file (e.g. 
https://nl.alpinelinux.org/alpine/edge/main/x86_64/nginx-1.14.0-r0.apk 
), rename it to tar.gz and open it up.
The package content is an overlay to the root directory and is alway 
applied to the root directory.
>
> After I compile my code the binaries and data directory tree is 
> mirrored under:  /home/dan/projects/foo/dist (very similar to rpm/deb 
> pkg format)
> So just for completeness:
> /home/dan/projects/foo/dist/etc/init.d/foo
> /home/dan/projects/foo/dist/opt/foo/bin/say_hi
> /home/dan/projects/foo/dist/opt/foo/etc/hello_msgs.db
>
> From the examples I have seen I would create a directory called pkg 
> under the /home/dan/projects/foo directory and add the following files:
> APKBUILD
> foo.XXXX scripts (like pre, post, etc).
>
> What I am stuck on is the contents of the APKBUILD.
You have to copy your included files to the pkg folder as well. (cp 
~/projects/foo/dist/etc/init.d/foo ~/projects/foo/pkg/foo.initscript etc.pp)
Now you create yourself an APKBUILD file:

    # Contributor: Your Name <yourmail@example.com>
    # Maintainer: Your Name <yourmail@example.com>
    pkgname=mypkgname
    pkgver=1.0
    pkgrel=0
    pkgdesc="Sample for binary distribution"
    url="http://example.org"
    arch="x86_64"
    license="MIT"
    depends=""
    makedepends=""
    install=""
    subpackages=""
    source="foo.initscript
             say_hi
             hello_mgsgs.db"
    builddir="$srcdir/"

    build() {
         return 0
    }

    package() {
         cd "$srcdir"
         mkdir -p "$pkgdir"/etc/init.d/ "$pkgdir"/opt/foo/bin/
    "$pkgdir"/opt/foo/etc/
         install -m755 -D "$srcdir"/say_hi "$pkgdir"/opt/foo/bin/say_hi
    || return 1
         install -m644 -D "$srcdir"/hello_msgs.db
    "$pkgdir"/opt/foo/etc/hello_msgs.db || return 1
         install -m644 -D "$srcdir"/foo.initscript
    "$pkgdir"/etc/init.d/foo || return 1
    }

Abuild will then add the sha512 checksums to that file and create a package.
Usefull resources:

https://wiki.alpinelinux.org/wiki/APKBUILD_Reference
https://wiki.alpinelinux.org/wiki/APKBUILD_examples
https://wiki.alpinelinux.org/wiki/Creating_an_Alpine_package
>
> Let me try this very simple application and see if I can get a 
> installable pkg.  Any hints/tips would be helpful.
>
> Thanks,
> Dan
>
>

Paul

>
> On Thu, Jun 21, 2018 at 11:18 AM, Paul Zillmann <p.zillmann@h6g.de 
> <p.zillmann@h6g.de>> wrote:
>
>     Hello Dan,
>
>     just create a package with abuild / apkbuild.
>     In your APKBUILD file you have to provide a package() function
>     which copies your binary data to it's final destination.
>     You will have to provide a build() function. Than one can be empty
>     (or you return 0) - but it has to be there.
>
>     Paul
>
>
>     Am 21.06.2018 um 08:11 schrieb Dan Cook:
>
>         Hoping to get some pointers on how to create a binary only
>         pkg.  I have the binaries already compiled on Alpine and all I
>         need to do is package them up.  I don't want abuild to compile
>         for me.  I already have the directory structure layout in a
>         separate directory ready to go.  All I need is to package up
>         the directory structure and create a installable package. All
>         the docs reference abuild doing the compiling/etc.  Do I use
>         abuild for this or some other tool?
>
>         Thanks,
>         Dan
>
>
>
>     ---
>     Unsubscribe: alpine-user+unsubscribe@lists.alpinelinux.org
>     <alpine-user%2Bunsubscribe@lists.alpinelinux.org>
>     Help: alpine-user+help@lists.alpinelinux.org
>     <alpine-user%2Bhelp@lists.alpinelinux.org>
>     ---
>
>
Reply to thread Export thread (mbox)