All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oleksandr Poznyak <oleksandr.poznyak@gmail.com>
To: Diego <diego.ml@zoho.com>
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>, yocto@yoctoproject.org
Subject: Re: Per image customizations
Date: Wed, 1 Jun 2016 21:57:32 +0300	[thread overview]
Message-ID: <CAEeWubJiiAh4w9b4HM_WaTK9U95ZEj=1uvsJdOnmTW7GTX=nBw@mail.gmail.com> (raw)
In-Reply-To: <2192667.NjFLBh3Ny5@ip-192-168-197-87.eu-west-1.compute.internal>

[-- Attachment #1: Type: text/plain, Size: 2978 bytes --]

Here is the content of bbappend recipe for base-files recipe:

FILESEXTRAPATHS_append := "${THISDIR}/${PN}"

SRC_URI += "file://fstab-flash \
        file://fstab-regular \
        "

PACKAGES += " ${PN}-flash ${PN}-regular"
CONFFILES_${PN}-flash = "${CONFFILES_${PN}}"
CONFFILES_${PN}-regular = "${CONFFILES_${PN}}"

pkg_preinst_${PN}-flash = "${pkg_preinst_${PN}}"
pkg_preinst_${PN}-regular = "${pkg_preinst_${PN}}"

RREPLACES_${PN}-flash = "${PN}"
RPROVIDES_${PN}-flash = "${PN}"
RCONFLICTS_${PN}-flash = "${PN}"

RREPLACES_${PN}-regular = "${PN}"
RPROVIDES_${PN}-regular = "${PN}"
RCONFLICTS_${PN}-regular = "${PN}"

python populate_packages_prepend() {
    import shutil

    packages = ("${PN}-flash", "${PN}-regular")
    for package in packages:
        # copy ${PN} content to packages
        shutil.copytree("${PKGD}", "${PKGDEST}/%s" % package, symlinks=True)
        # replace fstab
        if package == "${PN}-flash":
            shutil.copy("${WORKDIR}/fstab-flash",
"${PKGDEST}/${PN}-flash/etc/fstab")
        else:
            shutil.copy("${WORKDIR}/fstab-regular",
"${PKGDEST}/${PN}-regular/etc/fstab")
}


This will produce two separate packages that will replace base-files
package.
Moreover, this trick allows You to modify base-files package separately for
flash-OS and regular-OS

in other recipes add packages like this:

base-files-flash or base-files-regular

Thanks,
Oleksandr Poznyak!

On Wed, Jun 1, 2016 at 7:15 PM, Diego <diego.ml@zoho.com> wrote:

> In data mercoledì 1 giugno 2016 15:25:09, Oleksandr Poznyak ha scritto:
> > Don't forget to add your fstab/inittab files into CONFFILES_${PN} cause
> if
> > the package that includes them will be changed and You'll update it via
> > package system, your POSTPROCESS hacks will be overwritten.
> >
> > Anyway, its better to avoid POSTPROCESS if possible.
> > 1) Create *.bbappend recipe base-files_%s.bbappend in your layer. It
> > appends to poky "base-files" recipe.
> > 2) Create your own "python do_package_prepend" function where you should
> > make your recipe produce two different packages
> > 3) Add them to DEPENDS in your image recipe
> >
>
> Hi Oleksandr,
>
> your approach is really interesting, but I'm unsure how to proceed with
> step
> 2) of your list.
>
> I've added the following in the bbappend:
>
> python do_package_prepend() {
>     d.setVar('PACKAGES', "${PACKAGES} ${PN}-fstab-regular
> ${PN}-fstab-flash")
> }
>
> which creates the two additional packages, but then I'm confused on how to
> manage the two 'variant' fstab files. The FILES variable doesn't support
> "source -> destination", so how do I manage the fact that two different
> files
> need to go to the same destination path?
>
> An easier option would be to remove fstab in the base-files_%s.bbappend,
> and
> create 2 different .bb recipes for the 2 fstab files.
>
> Thanks anyhow for your help,
> Diego
>
>

[-- Attachment #2: Type: text/html, Size: 3933 bytes --]

  reply	other threads:[~2016-06-01 18:57 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-31 16:05 Per image customizations Diego
2016-05-31 23:57 ` Paul Eggleton
2016-06-01 12:25   ` Oleksandr Poznyak
2016-06-01 16:15     ` Diego
2016-06-01 18:57       ` Oleksandr Poznyak [this message]
2016-06-03 13:52         ` Diego
2016-06-03 17:56           ` Oleksandr Poznyak
2016-06-06 13:27             ` Diego
2016-06-27  4:11               ` Paul Eggleton
2016-07-01  9:18                 ` Diego
2016-06-06 20:55         ` Edward Wingate
2016-06-06 21:10           ` Oleksandr Poznyak
2016-06-06 22:06             ` Edward Wingate
2016-06-06 23:52               ` Edward Wingate
2016-06-07 10:20             ` Paul Eggleton
2016-06-07 10:51               ` Oleksandr Poznyak
2016-06-07 15:57               ` Edward Wingate
2016-06-07 20:47                 ` Paul Eggleton
2016-06-07 23:07                   ` Edward Wingate
2016-06-07 23:23                     ` Paul Eggleton
2016-06-08  8:58                       ` Oleksandr Poznyak
2016-06-08 18:01                         ` Edward Wingate

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAEeWubJiiAh4w9b4HM_WaTK9U95ZEj=1uvsJdOnmTW7GTX=nBw@mail.gmail.com' \
    --to=oleksandr.poznyak@gmail.com \
    --cc=diego.ml@zoho.com \
    --cc=paul.eggleton@linux.intel.com \
    --cc=yocto@yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.