diff mbox series

[2/2,FOCAL,kernel-snaps-uc20] pc-lowlatency: snapcraft.yaml use pure snapcraft syntax

Message ID 20210728141824.67699-3-dimitri.ledkov@canonical.com
State New
Headers show
Series Snapcraft only syntax for kernelefi snaps | expand

Commit Message

Dimitri John Ledkov July 28, 2021, 2:18 p.m. UTC
Use pure snapcraft syntax to package debs into a snap, with
declarative syntax for additional PPA repositories, packages to stage,
and reorg inside the kernel snap.

This removes dependency on the Makefiles, and makes the snap always
buildable as ABI version is automatically selected. This makes it
possible to build this snapcraft.yaml in ESM and embargoed PPAs ahead
of public releases without cranking, simply by doing requestbuilds()
via API or launchpad WebUI. Once can still do empty git commit and
push to trigger builds with a code change. One can also build it
locally with multipass or lxd providers, remotely with remote-build,
or push to launchpad and create snap build there.

Sample build at
https://launchpad.net/~xnox/+snap/xnox-lowlatency/+build/1478574

Differences versus current snap:
- different locations of the copyright and license files
- lack of lib/{modules|firmware} ../{modules|firmware} symlinks, which
  are unused (?!)

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
 snapcraft.yaml | 43 +++++++++++++++++++++++++++++++------------
 1 file changed, 31 insertions(+), 12 deletions(-)

Comments

Stefan Bader July 29, 2021, 9:30 a.m. UTC | #1
On 28.07.21 16:18, Dimitri John Ledkov wrote:
> Use pure snapcraft syntax to package debs into a snap, with
> declarative syntax for additional PPA repositories, packages to stage,
> and reorg inside the kernel snap.
> 
> This removes dependency on the Makefiles, and makes the snap always
> buildable as ABI version is automatically selected. This makes it
> possible to build this snapcraft.yaml in ESM and embargoed PPAs ahead
> of public releases without cranking, simply by doing requestbuilds()
> via API or launchpad WebUI. Once can still do empty git commit and
> push to trigger builds with a code change. One can also build it
> locally with multipass or lxd providers, remotely with remote-build,
> or push to launchpad and create snap build there.
> 
> Sample build at
> https://launchpad.net/~xnox/+snap/xnox-lowlatency/+build/1478574
> 
> Differences versus current snap:
> - different locations of the copyright and license files
> - lack of lib/{modules|firmware} ../{modules|firmware} symlinks, which
>    are unused (?!)
> 
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
> ---

This breaks tooling as it is. And I have not idea (as this never properly was 
discussed what would be the way to fix it.

-Stefan

>   snapcraft.yaml | 43 +++++++++++++++++++++++++++++++------------
>   1 file changed, 31 insertions(+), 12 deletions(-)
> 
> diff --git a/snapcraft.yaml b/snapcraft.yaml
> index acf96d8636..283ef172e6 100644
> --- a/snapcraft.yaml
> +++ b/snapcraft.yaml
> @@ -1,23 +1,42 @@
>   name: pc-lowlatency-kernel
> -version: 5.4.0-80.90.1
> +adopt-info: kernel
>   summary: lowlatency linux kernel
>   description: The lowlatency Ubuntu kernel package as a snap
>   type: kernel
> +grade: stable
>   confinement: strict
>   build-base: core20
> +# In addition to these repositories, the /+snap/ page on launchpad may
> +# also build with ESM repositories enabled, or built in a particular
> +# PPA, which will also be used.
> +package-repositories:
> +  - type: apt
> +    ppa: canonical-kernel-team/uc20-release
> +  - type: apt
> +    ppa: canonical-kernel-team/uc20-staging
> +  - type: apt
> +    ppa: canonical-kernel-team/proposed
>   
>   parts:
>     kernel:
> -    source: git://git.launchpad.net/~canonical-kernel-snaps/+git/kernel-snaps-uc20
> -    source-type: git
> -    source-branch: master
> -    plugin: make
> -    make-parameters:
> -      - KERNEL_SOURCE=focal:linux-uc20-efi
> -      - KERNEL=linux-image-uc20-efi-lowlatency
> -      - KERNEL_IMAGE_FORMAT=efi
> -      - PROPOSED=true
> +    plugin: nil
> +    override-pull: |
> +      snapcraftctl pull
> +      snapcraftctl set-version "$(apt show linux-image-uc20-efi-lowlatency 2>/dev/null | sed -n 's/^Version: //p')"
>       build-packages:
> -      - gnupg
>         - kmod
> -      - lsb-release
> +    stage-packages:
> +      - linux-image-uc20-efi-lowlatency
> +    override-build: |
> +      snapcraftctl build
> +      depmod -b $SNAPCRAFT_PART_INSTALL $(ls $SNAPCRAFT_PART_INSTALL/lib/modules)
> +      mv $SNAPCRAFT_PART_INSTALL/boot/kernel.efi* $SNAPCRAFT_PART_INSTALL/boot/kernel.efi
> +    organize:
> +      boot/: /
> +      lib/modules: modules
> +      lib/firmware: firmware
> +    stage:
> +      - -usr/share/man
> +      - -usr/lib/linux
> +      - -lib/crda
> +      - -lib/modprobe.d
>
Dimitri John Ledkov July 29, 2021, 11:14 a.m. UTC | #2
On Thu, Jul 29, 2021 at 10:30 AM Stefan Bader
<stefan.bader@canonical.com> wrote:
>
> On 28.07.21 16:18, Dimitri John Ledkov wrote:
> > Use pure snapcraft syntax to package debs into a snap, with
> > declarative syntax for additional PPA repositories, packages to stage,
> > and reorg inside the kernel snap.
> >
> > This removes dependency on the Makefiles, and makes the snap always
> > buildable as ABI version is automatically selected. This makes it
> > possible to build this snapcraft.yaml in ESM and embargoed PPAs ahead
> > of public releases without cranking, simply by doing requestbuilds()
> > via API or launchpad WebUI. Once can still do empty git commit and
> > push to trigger builds with a code change. One can also build it
> > locally with multipass or lxd providers, remotely with remote-build,
> > or push to launchpad and create snap build there.
> >
> > Sample build at
> > https://launchpad.net/~xnox/+snap/xnox-lowlatency/+build/1478574
> >
> > Differences versus current snap:
> > - different locations of the copyright and license files
> > - lack of lib/{modules|firmware} ../{modules|firmware} symlinks, which
> >    are unused (?!)
> >
> > Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
> > ---
>
> This breaks tooling as it is. And I have not idea (as this never properly was
> discussed what would be the way to fix it.
>

Let me create a cranky update-snap patch that will still make it crankable.

But also add cranky snap-request-builds command to trigger rebuilds of
snaps crankless.

What does swm currently use to detect whether or not a snap got
cranked? does it look at versions in the snapstore? git tags? version
in snapcraft.yaml?

Would it help to split removal of version tag into stand alone change?


> -Stefan
>
> >   snapcraft.yaml | 43 +++++++++++++++++++++++++++++++------------
> >   1 file changed, 31 insertions(+), 12 deletions(-)
> >
> > diff --git a/snapcraft.yaml b/snapcraft.yaml
> > index acf96d8636..283ef172e6 100644
> > --- a/snapcraft.yaml
> > +++ b/snapcraft.yaml
> > @@ -1,23 +1,42 @@
> >   name: pc-lowlatency-kernel
> > -version: 5.4.0-80.90.1
> > +adopt-info: kernel
> >   summary: lowlatency linux kernel
> >   description: The lowlatency Ubuntu kernel package as a snap
> >   type: kernel
> > +grade: stable
> >   confinement: strict
> >   build-base: core20
> > +# In addition to these repositories, the /+snap/ page on launchpad may
> > +# also build with ESM repositories enabled, or built in a particular
> > +# PPA, which will also be used.
> > +package-repositories:
> > +  - type: apt
> > +    ppa: canonical-kernel-team/uc20-release
> > +  - type: apt
> > +    ppa: canonical-kernel-team/uc20-staging
> > +  - type: apt
> > +    ppa: canonical-kernel-team/proposed
> >
> >   parts:
> >     kernel:
> > -    source: git://git.launchpad.net/~canonical-kernel-snaps/+git/kernel-snaps-uc20
> > -    source-type: git
> > -    source-branch: master
> > -    plugin: make
> > -    make-parameters:
> > -      - KERNEL_SOURCE=focal:linux-uc20-efi
> > -      - KERNEL=linux-image-uc20-efi-lowlatency
> > -      - KERNEL_IMAGE_FORMAT=efi
> > -      - PROPOSED=true
> > +    plugin: nil
> > +    override-pull: |
> > +      snapcraftctl pull
> > +      snapcraftctl set-version "$(apt show linux-image-uc20-efi-lowlatency 2>/dev/null | sed -n 's/^Version: //p')"
> >       build-packages:
> > -      - gnupg
> >         - kmod
> > -      - lsb-release
> > +    stage-packages:
> > +      - linux-image-uc20-efi-lowlatency
> > +    override-build: |
> > +      snapcraftctl build
> > +      depmod -b $SNAPCRAFT_PART_INSTALL $(ls $SNAPCRAFT_PART_INSTALL/lib/modules)
> > +      mv $SNAPCRAFT_PART_INSTALL/boot/kernel.efi* $SNAPCRAFT_PART_INSTALL/boot/kernel.efi
> > +    organize:
> > +      boot/: /
> > +      lib/modules: modules
> > +      lib/firmware: firmware
> > +    stage:
> > +      - -usr/share/man
> > +      - -usr/lib/linux
> > +      - -lib/crda
> > +      - -lib/modprobe.d
> >
>
>
> --
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
Dimitri John Ledkov July 29, 2021, 12:41 p.m. UTC | #3
On Thu, Jul 29, 2021 at 12:14 PM Dimitri John Ledkov
<dimitri.ledkov@canonical.com> wrote:
>
> On Thu, Jul 29, 2021 at 10:30 AM Stefan Bader
> <stefan.bader@canonical.com> wrote:
> >
> > On 28.07.21 16:18, Dimitri John Ledkov wrote:
> > > Use pure snapcraft syntax to package debs into a snap, with
> > > declarative syntax for additional PPA repositories, packages to stage,
> > > and reorg inside the kernel snap.
> > >
> > > This removes dependency on the Makefiles, and makes the snap always
> > > buildable as ABI version is automatically selected. This makes it
> > > possible to build this snapcraft.yaml in ESM and embargoed PPAs ahead
> > > of public releases without cranking, simply by doing requestbuilds()
> > > via API or launchpad WebUI. Once can still do empty git commit and
> > > push to trigger builds with a code change. One can also build it
> > > locally with multipass or lxd providers, remotely with remote-build,
> > > or push to launchpad and create snap build there.
> > >
> > > Sample build at
> > > https://launchpad.net/~xnox/+snap/xnox-lowlatency/+build/1478574
> > >
> > > Differences versus current snap:
> > > - different locations of the copyright and license files
> > > - lack of lib/{modules|firmware} ../{modules|firmware} symlinks, which
> > >    are unused (?!)
> > >
> > > Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
> > > ---
> >
> > This breaks tooling as it is. And I have not idea (as this never properly was
> > discussed what would be the way to fix it.
> >
>

pushing no source change commits with a new tag will make this scheme
be compatible with existing workflow. As it tries to find the latest
tip of git repo, resolve it to a tag, and check that there have been
builds done with it.

to make the switch to crankless from there, instead of of state of
"confirmed / fix committed" be ready to be cranked / crank committed.
We'd need to make it "ready to request builds", and then builds should
be done. Something along the lines of interating the builds, and
checking if there was a build done, after the task has became
"confirmed" (once again).

But I'm not too sure if swm currently even works correctly for ESM
snaps, because it seems like we only search for snaps in
~canonical-kernel-snaps and do not look in ~canonical-kernel-esm. I
think I should send a fix for it. Also filed a bug report for
launchpad to expose over the API which snaps are attached to a given
git branch.

>
> > -Stefan
> >
> > >   snapcraft.yaml | 43 +++++++++++++++++++++++++++++++------------
> > >   1 file changed, 31 insertions(+), 12 deletions(-)
> > >
> > > diff --git a/snapcraft.yaml b/snapcraft.yaml
> > > index acf96d8636..283ef172e6 100644
> > > --- a/snapcraft.yaml
> > > +++ b/snapcraft.yaml
> > > @@ -1,23 +1,42 @@
> > >   name: pc-lowlatency-kernel
> > > -version: 5.4.0-80.90.1
> > > +adopt-info: kernel
> > >   summary: lowlatency linux kernel
> > >   description: The lowlatency Ubuntu kernel package as a snap
> > >   type: kernel
> > > +grade: stable
> > >   confinement: strict
> > >   build-base: core20
> > > +# In addition to these repositories, the /+snap/ page on launchpad may
> > > +# also build with ESM repositories enabled, or built in a particular
> > > +# PPA, which will also be used.
> > > +package-repositories:
> > > +  - type: apt
> > > +    ppa: canonical-kernel-team/uc20-release
> > > +  - type: apt
> > > +    ppa: canonical-kernel-team/uc20-staging
> > > +  - type: apt
> > > +    ppa: canonical-kernel-team/proposed
> > >
> > >   parts:
> > >     kernel:
> > > -    source: git://git.launchpad.net/~canonical-kernel-snaps/+git/kernel-snaps-uc20
> > > -    source-type: git
> > > -    source-branch: master
> > > -    plugin: make
> > > -    make-parameters:
> > > -      - KERNEL_SOURCE=focal:linux-uc20-efi
> > > -      - KERNEL=linux-image-uc20-efi-lowlatency
> > > -      - KERNEL_IMAGE_FORMAT=efi
> > > -      - PROPOSED=true
> > > +    plugin: nil
> > > +    override-pull: |
> > > +      snapcraftctl pull
> > > +      snapcraftctl set-version "$(apt show linux-image-uc20-efi-lowlatency 2>/dev/null | sed -n 's/^Version: //p')"
> > >       build-packages:
> > > -      - gnupg
> > >         - kmod
> > > -      - lsb-release
> > > +    stage-packages:
> > > +      - linux-image-uc20-efi-lowlatency
> > > +    override-build: |
> > > +      snapcraftctl build
> > > +      depmod -b $SNAPCRAFT_PART_INSTALL $(ls $SNAPCRAFT_PART_INSTALL/lib/modules)
> > > +      mv $SNAPCRAFT_PART_INSTALL/boot/kernel.efi* $SNAPCRAFT_PART_INSTALL/boot/kernel.efi
> > > +    organize:
> > > +      boot/: /
> > > +      lib/modules: modules
> > > +      lib/firmware: firmware
> > > +    stage:
> > > +      - -usr/share/man
> > > +      - -usr/lib/linux
> > > +      - -lib/crda
> > > +      - -lib/modprobe.d
> > >
> >
> >
> > --
> > kernel-team mailing list
> > kernel-team@lists.ubuntu.com
> > https://lists.ubuntu.com/mailman/listinfo/kernel-team
>
>
>
> --
> Regards,
>
> Dimitri.
Stefan Bader Aug. 2, 2021, 12:57 p.m. UTC | #4
On 29.07.21 13:14, Dimitri John Ledkov wrote:
> On Thu, Jul 29, 2021 at 10:30 AM Stefan Bader
> <stefan.bader@canonical.com> wrote:
>>
>> On 28.07.21 16:18, Dimitri John Ledkov wrote:
>>> Use pure snapcraft syntax to package debs into a snap, with
>>> declarative syntax for additional PPA repositories, packages to stage,
>>> and reorg inside the kernel snap.
>>>
>>> This removes dependency on the Makefiles, and makes the snap always
>>> buildable as ABI version is automatically selected. This makes it
>>> possible to build this snapcraft.yaml in ESM and embargoed PPAs ahead
>>> of public releases without cranking, simply by doing requestbuilds()
>>> via API or launchpad WebUI. Once can still do empty git commit and
>>> push to trigger builds with a code change. One can also build it
>>> locally with multipass or lxd providers, remotely with remote-build,
>>> or push to launchpad and create snap build there.
>>>
>>> Sample build at
>>> https://launchpad.net/~xnox/+snap/xnox-lowlatency/+build/1478574
>>>
>>> Differences versus current snap:
>>> - different locations of the copyright and license files
>>> - lack of lib/{modules|firmware} ../{modules|firmware} symlinks, which
>>>     are unused (?!)
>>>
>>> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
>>> ---
>>
>> This breaks tooling as it is. And I have not idea (as this never properly was
>> discussed what would be the way to fix it.
>>
> 
> Let me create a cranky update-snap patch that will still make it crankable.
> 
> But also add cranky snap-request-builds command to trigger rebuilds of
> snaps crankless.

No, I want to do that myself and ensure that this is a soft transition for crankers.

-Stefan

> 
> What does swm currently use to detect whether or not a snap got
> cranked? does it look at versions in the snapstore? git tags? version
> in snapcraft.yaml?
> 
> Would it help to split removal of version tag into stand alone change?
> 
> 
>> -Stefan
>>
>>>    snapcraft.yaml | 43 +++++++++++++++++++++++++++++++------------
>>>    1 file changed, 31 insertions(+), 12 deletions(-)
>>>
>>> diff --git a/snapcraft.yaml b/snapcraft.yaml
>>> index acf96d8636..283ef172e6 100644
>>> --- a/snapcraft.yaml
>>> +++ b/snapcraft.yaml
>>> @@ -1,23 +1,42 @@
>>>    name: pc-lowlatency-kernel
>>> -version: 5.4.0-80.90.1
>>> +adopt-info: kernel
>>>    summary: lowlatency linux kernel
>>>    description: The lowlatency Ubuntu kernel package as a snap
>>>    type: kernel
>>> +grade: stable
>>>    confinement: strict
>>>    build-base: core20
>>> +# In addition to these repositories, the /+snap/ page on launchpad may
>>> +# also build with ESM repositories enabled, or built in a particular
>>> +# PPA, which will also be used.
>>> +package-repositories:
>>> +  - type: apt
>>> +    ppa: canonical-kernel-team/uc20-release
>>> +  - type: apt
>>> +    ppa: canonical-kernel-team/uc20-staging
>>> +  - type: apt
>>> +    ppa: canonical-kernel-team/proposed
>>>
>>>    parts:
>>>      kernel:
>>> -    source: git://git.launchpad.net/~canonical-kernel-snaps/+git/kernel-snaps-uc20
>>> -    source-type: git
>>> -    source-branch: master
>>> -    plugin: make
>>> -    make-parameters:
>>> -      - KERNEL_SOURCE=focal:linux-uc20-efi
>>> -      - KERNEL=linux-image-uc20-efi-lowlatency
>>> -      - KERNEL_IMAGE_FORMAT=efi
>>> -      - PROPOSED=true
>>> +    plugin: nil
>>> +    override-pull: |
>>> +      snapcraftctl pull
>>> +      snapcraftctl set-version "$(apt show linux-image-uc20-efi-lowlatency 2>/dev/null | sed -n 's/^Version: //p')"
>>>        build-packages:
>>> -      - gnupg
>>>          - kmod
>>> -      - lsb-release
>>> +    stage-packages:
>>> +      - linux-image-uc20-efi-lowlatency
>>> +    override-build: |
>>> +      snapcraftctl build
>>> +      depmod -b $SNAPCRAFT_PART_INSTALL $(ls $SNAPCRAFT_PART_INSTALL/lib/modules)
>>> +      mv $SNAPCRAFT_PART_INSTALL/boot/kernel.efi* $SNAPCRAFT_PART_INSTALL/boot/kernel.efi
>>> +    organize:
>>> +      boot/: /
>>> +      lib/modules: modules
>>> +      lib/firmware: firmware
>>> +    stage:
>>> +      - -usr/share/man
>>> +      - -usr/lib/linux
>>> +      - -lib/crda
>>> +      - -lib/modprobe.d
>>>
>>
>>
>> --
>> kernel-team mailing list
>> kernel-team@lists.ubuntu.com
>> https://lists.ubuntu.com/mailman/listinfo/kernel-team
> 
> 
>
diff mbox series

Patch

diff --git a/snapcraft.yaml b/snapcraft.yaml
index acf96d8636..283ef172e6 100644
--- a/snapcraft.yaml
+++ b/snapcraft.yaml
@@ -1,23 +1,42 @@ 
 name: pc-lowlatency-kernel
-version: 5.4.0-80.90.1
+adopt-info: kernel
 summary: lowlatency linux kernel
 description: The lowlatency Ubuntu kernel package as a snap
 type: kernel
+grade: stable
 confinement: strict
 build-base: core20
+# In addition to these repositories, the /+snap/ page on launchpad may
+# also build with ESM repositories enabled, or built in a particular
+# PPA, which will also be used.
+package-repositories:
+  - type: apt
+    ppa: canonical-kernel-team/uc20-release
+  - type: apt
+    ppa: canonical-kernel-team/uc20-staging
+  - type: apt
+    ppa: canonical-kernel-team/proposed
 
 parts:
   kernel:
-    source: git://git.launchpad.net/~canonical-kernel-snaps/+git/kernel-snaps-uc20
-    source-type: git
-    source-branch: master
-    plugin: make
-    make-parameters:
-      - KERNEL_SOURCE=focal:linux-uc20-efi
-      - KERNEL=linux-image-uc20-efi-lowlatency
-      - KERNEL_IMAGE_FORMAT=efi
-      - PROPOSED=true
+    plugin: nil
+    override-pull: |
+      snapcraftctl pull
+      snapcraftctl set-version "$(apt show linux-image-uc20-efi-lowlatency 2>/dev/null | sed -n 's/^Version: //p')"
     build-packages:
-      - gnupg
       - kmod
-      - lsb-release
+    stage-packages:
+      - linux-image-uc20-efi-lowlatency
+    override-build: |
+      snapcraftctl build
+      depmod -b $SNAPCRAFT_PART_INSTALL $(ls $SNAPCRAFT_PART_INSTALL/lib/modules)
+      mv $SNAPCRAFT_PART_INSTALL/boot/kernel.efi* $SNAPCRAFT_PART_INSTALL/boot/kernel.efi
+    organize:
+      boot/: /
+      lib/modules: modules
+      lib/firmware: firmware
+    stage:
+      - -usr/share/man
+      - -usr/lib/linux
+      - -lib/crda
+      - -lib/modprobe.d