Ubuntu Pastebin

Paste from ogra at Fri, 12 Aug 2016 11:47:55 +0000

Download as text
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
diff -Nru livecd-rootfs-2.420+ppa15/debian/changelog livecd-rootfs-2.420+ppa16/debian/changelog
--- livecd-rootfs-2.420+ppa15/debian/changelog	2016-07-21 10:04:58.000000000 +0200
+++ livecd-rootfs-2.420+ppa16/debian/changelog	2016-08-12 13:43:34.000000000 +0200
@@ -1,3 +1,11 @@
+livecd-rootfs (2.420+ppa16) xenial; urgency=medium
+
+  * drop all snapcraft calls, kernel builds and hacked up code from
+    live-build/auto/build for ubuntu-core to speed up the new builds that we
+    now do on launchpad.
+
+ -- Oliver Grawert <ogra@ubuntu.com>  Fri, 12 Aug 2016 13:42:18 +0200
+
 livecd-rootfs (2.420+ppa15) xenial; urgency=medium
 
   * do not use lsb_release for the ubuntu-core version, it will not give us
diff -Nru livecd-rootfs-2.420+ppa15/live-build/auto/build livecd-rootfs-2.420+ppa16/live-build/auto/build
--- livecd-rootfs-2.420+ppa15/live-build/auto/build	2016-07-21 10:03:27.000000000 +0200
+++ livecd-rootfs-2.420+ppa16/live-build/auto/build	2016-08-12 13:47:48.000000000 +0200
@@ -256,25 +256,6 @@
         for dir in lib/modules lib/firmware writable meta; do
             mkdir -p $rootfs/$dir
         done
-
-        # get a proper version from the chroot
-        . $rootfs/etc/os-release
-        VERSION="$(echo $PRETTY_NAME | sed 's/[^0-9.]*//g')"
-
-        CORENAME="ubuntu-core"
-        cat > $rootfs/meta/snap.yaml <<EOF
-name: $CORENAME
-version: $VERSION
-summary: The core runtime environment for snapd
-architectures: [$ARCH]
-type: os
-EOF
-
-        apt-get -y install snapcraft
-        snapcraft snap $rootfs
-
-        snapfile="$(ls ${CORENAME}*.snap)"
-        cp -a $snapfile $PREFIX.os.snap
     fi
 fi
 
@@ -302,246 +283,6 @@
 # in a binary hook
 case $PROJECT:$SUBPROJECT in
         ubuntu-core:system-image|ubuntu-desktop-next:system-image)
-
-    # create device tarball (for snappy only atm)
-    if [ "$PROJECT:$SUBPROJECT" = "ubuntu-core:system-image" ]; then
-      case $ARCH in
-          armhf)
-            subarches="generic raspi2"
-            ;;
-          arm64)
-            subarches="generic dragonboard"
-            ;;
-          i386|amd64|powerpc|ppc64el|s390x)
-            subarches="generic"
-            ;;
-      esac
-
-      # create a clean chroot
-      debootstrap --variant=minbase $LB_DISTRIBUTION chroot-device $LB_PARENT_MIRROR_BOOTSTRAP
-
-      # ... but keep the PPA setup
-      cp -a chroot/etc/apt/* chroot-device/etc/apt/
-
-      # ... and move it in place
-      rm -rf chroot
-      mv chroot-device chroot
-
-      for devarch in $subarches; do
-        (echo "I: creating $devarch device tarball for $ARCH"
-        HERE="$(pwd)"
-        set -x
-
-        linux_package="linux-image-$devarch"
-        case $ARCH in
-            amd64)
-              linux_package="linux-signed-image-generic"
-              ;;
-            arm64)
-              if [ "$devarch" = "dragonboard" ]; then
-                  linux_package="linux-image-snapdragon linux-firmware-snapdragon"
-              fi
-              ;;
-            armhf)
-              if [ "$devarch" = "raspi2" ]; then
-                  linux_package="linux-image-raspi2"
-              fi
-              ;;
-            ppc64el|s390x)
-              echo "I: skipping kernel and device tarball for $ARCH"
-              return
-              ;;
-        esac
-
-        # make sure all virtual filesystems are available
-        lb chroot_proc install "$@"
-        lb chroot_sysfs install "$@"
-        lb chroot_devpts install "$@"
-
-        # prepare the env
-        Chroot chroot "apt-get -y update"
-        Chroot chroot "apt-get -y purge linux-image-*"
-        Chroot chroot "apt-get -y autoremove"
-        rm -rf chroot/boot/initrd.img* chroot/boot/vmlinu?-* chroot/lib/modules/* \
-            chroot/boot/abi-* chroot/boot/System.map-* chroot/boot/config-*
-        mkdir -p chroot/etc/initramfs-tools/conf.d
-        echo "COMPRESS=lzma" >chroot/etc/initramfs-tools/conf.d/snappy-device-tarball.conf
-
-        # install needed packages and the kernel itself
-        Chroot chroot "apt-get -y install initramfs-tools-ubuntu-core linux-firmware xz-utils"
-        Chroot chroot "apt-get -y install $linux_package"
-
-        Chroot chroot "dpkg -l" > chroot/dpkg.list
-        
-        # clean up
-        lb chroot_devpts remove "$@"
-        lb chroot_sysfs remove "$@"
-        lb chroot_proc remove "$@"
-
-        # now build the actual device tarball
-        TMPDIR="$(mktemp -d)"
-        mkdir -p $TMPDIR/system/
-        mkdir -p $TMPDIR/assets/
-
-        cd chroot
-        cp -ar lib/modules/ $TMPDIR/system/
-        cp -ar lib/firmware/ $TMPDIR/system/
-        # FIXME: compat with the old kernel spec/old initramfs that
-        #        expects lib/{modules,firmware}
-        # 
-        # FIXME2: update the initramfs-tools-ubuntu-core scripts/ubuntu-core
-        #         to look at the new location        
-        mkdir $TMPDIR/system/lib
-        ln -s $TMPDIR/system/modules $TMPDIR/system/lib
-        ln -s $TMPDIR/system/firmware $TMPDIR/system/lib
-
-        # new assets handling
-        if [ -f boot/vmlinu?-*.signed ]; then
-            kernel=boot/vmlinu?-*.signed
-        else
-            kernel=boot/vmlinu?-*
-        fi
-
-        initrd=boot/initrd.img-*
-
-        cp -ar $initrd $TMPDIR/assets/
-        cp -ar $kernel $TMPDIR/assets/
-        cp -ar boot/abi-* boot/System.map-* boot/config-* $TMPDIR/assets/
-
-        dtbs=$(find lib/firmware -type d -name 'device-tree' -print0)
-        if [ -n "$dtbs" ]; then
-           mv "$dtbs" $TMPDIR/assets/dtbs
-           case $devarch in
-               raspi2)
-                   # ubuntu-device-flash does not like subdirs here, we need to tar it up
-                   if [ -e $TMPDIR/assets/dtbs/overlays ]; then
-                       tar -C $TMPDIR/assets/dtbs -f $TMPDIR/assets/dtbs/overlays.tgz -czv overlays
-                       rm -rf $TMPDIR/assets/dtbs/overlays
-                   fi
-                   ;;
-               dragonboard)
-                   cp $TMPDIR/assets/dtbs/qcom/apq8016-sbc-snappy.dtb $TMPDIR/assets/dtbs/apq8016-sbc.dtb
-                   # add special link needed by the dragonboard wifi driver
-                   mkdir -p $TMPDIR/system/lib/firmware/wlan/
-                   ln -s /run/macaddr0 $TMPDIR/system/lib/firmware/wlan/
-                   ;;
-           esac
-        fi
-
-        # copy dpkg manifest
-        cp -ar dpkg.list $TMPDIR/assets
-
-        # create hardware.yaml
-        # this assumes armhf == u-boot
-        # and all others grub
-        # common bits
-        cat > $TMPDIR/hardware.yaml << EOF
-kernel: assets/$(basename $kernel)
-initrd: assets/$(basename $initrd)
-partition-layout: system-AB
-EOF
-        # arch specific ones
-        if [ "$ARCH" = "armhf" ]; then
-          cat >> $TMPDIR/hardware.yaml << EOF
-dtbs: assets/dtbs
-bootloader: u-boot
-EOF
-        else
-          cat >> $TMPDIR/hardware.yaml << EOF
-bootloader: grub
-EOF
-        fi
-
-        # compress everything
-        cd $TMPDIR
-        tarname="device.tar.gz"
-        manifestname="device.manifest"
-        if [ "$devarch" = "raspi2" ];then
-            tarname="raspi2.$tarname"
-            manifestname="$devarch.$manifestname"
-        elif [ "$devarch" = "dragonboard" ];then
-            tarname="$devarch.$tarname"
-            manifestname="$devarch.$manifestname"
-        fi
-        # create tarfile
-        tar -c -z -f $HERE/$PREFIX.$tarname system assets hardware.yaml
-
-        # create device specific manifest to track kernel dpkg version
-        cp assets/dpkg.list $HERE/$PREFIX.$manifestname
-
-        # show size of initrd and kernel in the log
-        ls -lh assets/
-
-        # dump the content list into the log
-        echo "I: device tarball contents for $PREFIX.$tarname:"
-        find . -type f
-
-        # azure wants its own device tarball
-        if [ "$ARCH" = "amd64" ]; then
-            cp $HERE/$PREFIX.$tarname $HERE/$PREFIX.azure.$tarname
-        fi
-
-        # create snap
-        snapname="kernel.snap"
-        metaname=canonical-pc-linux
-
-        if [ "$devarch" = "raspi2" ];then
-            metaname=canonical-pi2-linux
-            snapname="$devarch.kernel.snap"
-        elif [ "$devarch" = "generic" ] && [ "$ARCH" = "armhf" ];then
-            metaname=canonical-bbb-linux
-        elif [ "$devarch" = "dragonboard" ] && [ "$ARCH" = "arm64" ];then
-            metaname=canonical-snapdragon-linux
-            snapname="$devarch.kernel.snap"
-        fi
-
-        rm -rf $HERE/snap || true
-        mkdir -p $HERE/snap/meta
-        cp -a $TMPDIR/assets/* $HERE/snap
-        cp -a $TMPDIR/system/* $HERE/snap
-
-        cd $HERE/snap
-        kernel="$(ls vmlinuz-*)"
-        initrd="$(ls initrd.img-*)"
-        # old kernel spec
-        ln -s $kernel vmlinuz
-        ln -s $initrd initrd.img
-        # new kernel spec
-        ln -s $kernel kernel.img
-        kvers="$(ls vmlinuz-*|sed 's/^.*vmlinuz-//;s/-[a-z.]*$//')"
-
-        VERSION=$kvers
-
-        cat > meta/kernel.yaml <<EOF
-version: $kvers
-EOF
-        
-        cat > meta/snap.yaml <<EOF
-name: $metaname
-version: $VERSION
-architectures: [$ARCH]
-summary: The canonical $devarch $ARCH kernel
-type: kernel
-
-kernel: $(ls vmlinuz-*)
-initrd: $(ls initrd.img-*)
-modules: $(ls -d lib/modules/*)
-firmware: lib/firmware
-EOF
-        if [ -d dtbs ]; then
-            printf "dtbs: dtbs/ \n" >> meta/snap.yaml
-        fi
-        cd $HERE
-
-        apt-get -y install snapcraft
-        snapcraft snap snap
-
-        snapfile="$(ls $metaname*.snap)"
-        cp -a $snapfile $PREFIX.$snapname
-        )
-      done
-    fi
-
     LB_LINUX_FLAVOURS=none
     ;;
 esac
Download as text