Permalink
Browse files

packaging: bring down the delta between 14.04 and 16.04. (#3835)

* packaging: bring down the delta between 14.04 and 16.04.

This is rather aggressive, and needs further testing before we're sure
it's the way to go, but one can hope.

* packaging: new code, new bugs. Fixed them.

* debian: improve package description
  • Loading branch information...
1 parent f96badd commit 67902f1ef14dd29ff809fabfcb9f7b2cbcd5fb7f @chipaca chipaca committed Sep 28, 2017
@@ -1 +0,0 @@
-9
@@ -1,22 +0,0 @@
-Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Upstream-Name: snappy
-Source: https://github.com/snapcore/snapd
-
-Files: *
-Copyright: Copyright (C) 2014,2015 Canonical, Ltd.
-License: GPL-3
- This program is free software: you can redistribute it and/or modify it
- under the terms of the the GNU General Public License version 3, as
- published by the Free Software Foundation.
- .
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranties of
- MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
- PURPOSE. See the applicable version of the GNU Lesser General Public
- License for more details.
- .
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
- .
- On Debian systems, the complete text of the GNU General Public License
- can be found in `/usr/share/common-licenses/GPL-3'
@@ -1,4 +0,0 @@
-[DEFAULT]
-debian-branch = ubuntu/14.04
-export-dir = ../build-area
-postexport = govendor sync
@@ -1 +0,0 @@
-debian/tmp/usr/share/gocode/src/*
@@ -166,8 +166,6 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
$(MAKE) -C cmd check
endif
-# no dh_systemd in trusty
-
override_dh_install:
# we do not need this in the package, its just needed during build
rm -rf ${CURDIR}/debian/tmp/usr/bin/xgettext-go
@@ -190,6 +188,7 @@ override_dh_install:
# it's a conf file so we're stuck with it
mv debian/snapd/etc/profile.d/snapd.sh debian/snapd/etc/profile.d/apps-bin-path.sh
+ # trusty needs this to make /snap rshared
install --mode=0644 debian/snap.mount.service debian/snapd/$(SYSTEMD_UNITS_DESTDIR)
$(MAKE) -C cmd install DESTDIR=$(CURDIR)/debian/tmp
@@ -1,3 +1,4 @@
+# trusty needs this to make /snap rshared
[Unit]
Description=Apply special mount sharing to /snap directory
ConditionPathExists=!/run/systemd/initctl/fifo
@@ -1,3 +0,0 @@
-# probe for assertions, must run before udisks2
-ACTION=="add", SUBSYSTEM=="block" \
- RUN+="/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/%k"
@@ -1,4 +0,0 @@
-# keep mount point busy
-# we used to ship a custom grub config that is no longer needed
-rm_conffile /etc/grub.d/09_snappy 1.7.3ubuntu1
-rm_conffile /etc/ld.so.conf.d/snappy.conf 2.0.7~
@@ -1 +0,0 @@
-snap.8
@@ -4,27 +4,24 @@ set -e
systemctl_stop() {
unit="$1"
- if systemctl is-active -q "$unit"; then
- echo "Stoping $unit"
+ for i in $(seq 10); do
+ if ! systemctl is-active -q "$unit"; then
+ echo "$unit is stopped."
+ break
+ fi
+ echo "Stoping $unit [attempt $i]"
systemctl stop -q "$unit" || true
- fi
+ sleep .1
+ done
}
if [ "$1" = "purge" ]; then
- mounts=$(systemctl list-unit-files --full | grep '^snap[-.].*\.mount' | cut -f1 -d ' ')
- services=$(systemctl list-unit-files --full | grep '^snap[-.].*\.service' | cut -f1 -d ' ')
-
- for unit in $mounts; do
- # ensure its really a snap mount unit or systemd unit
- if ! grep -q 'What=/var/lib/snapd/snaps/' "/etc/systemd/system/$unit" && ! grep -q 'X-Snappy=yes' "/etc/systemd/system/$unit"; then
- echo "Skipping non-snapd systemd unit $unit"
- continue
- fi
- echo "Stopping $unit"
- systemctl_stop "$unit"
- done
+ # snap.mount.service is a trusty thing
+ systemctl_stop snap.mount.service
- systemctl stop snap.mount.service || true
+ units=$(systemctl list-unit-files --full | grep '^snap[-.]' | cut -f1 -d ' ' | grep -vF snap.mount.service || true)
+ mounts=$(echo "$units" | grep '^snap[-.].*\.mount$' || true)
+ services=$(echo "$units" | grep '^snap[-.].*\.service$' || true)
for unit in $services $mounts; do
# ensure its really a snap mount unit or systemd unit
@@ -33,6 +30,9 @@ if [ "$1" = "purge" ]; then
continue
fi
+ echo "Stopping $unit"
+ systemctl_stop "$unit"
+
# if it is a mount unit, we can find the snap name in the mount
# unit (we just ignore unit files)
snap=$(grep 'Where=/snap/' "/etc/systemd/system/$unit"|cut -f3 -d/)
@@ -86,9 +86,8 @@ if [ "$1" = "purge" ]; then
done
umount -l /run/snapd/ns/ || true
- # prepare removal of /snap
- umount -l /snap || true
- rmdir --ignore-fail-on-non-empty /snap || true
+ echo "Removing extra snap-confine apparmor rules"
+ rm -f /etc/apparmor.d/snap.core.*.usr.lib.snapd.snap-confine
echo "Removing snapd cache"
rm -f /var/cache/snapd/*
@@ -1 +0,0 @@
-3.0 (native)
@@ -1,10 +0,0 @@
-## Autopkgtest
-
-In order to run the autopkgtest suite locally you need first to generate an image:
-
- $ adt-buildvm-ubuntu-cloud -a amd64 -r xenial -v
-
-This will create a `adt-xenial-amd64-cloud.img` file, then you can run the tests from
-the project's root with:
-
- $ adt-run --unbuilt-tree . --- qemu ./adt-xenial-amd64-cloud.img
@@ -1,3 +0,0 @@
-{
- "FromBranch": false
-}
@@ -162,68 +162,6 @@ ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
$(MAKE) -C cmd check
endif
-override_dh_systemd_enable:
- # enable auto-import
- dh_systemd_enable \
- -psnapd \
- data/systemd/snapd.autoimport.service
- # we want the auto-update timer enabled by default
- dh_systemd_enable \
- -psnapd \
- data/systemd/snapd.refresh.timer
- # but the auto-update service disabled
- dh_systemd_enable \
- --no-enable \
- -psnapd \
- data/systemd/snapd.refresh.service
- # we want the repair timer enabled by default
- dh_systemd_enable \
- -psnapd \
- data/systemd/snapd.snap-repair.timer
- # but the repair service disabled
- dh_systemd_enable \
- --no-enable \
- -psnapd \
- data/systemd/snapd.snap-repair.service
- # enable snapd
- dh_systemd_enable \
- -psnapd \
- data/systemd/snapd.socket
- dh_systemd_enable \
- -psnapd \
- data/systemd/snapd.service
- dh_systemd_enable \
- -psnapd \
- data/systemd/snapd.system-shutdown.service
- dh_systemd_enable \
- -psnapd \
- data/systemd/snapd.core-fixup.service
-
-override_dh_systemd_start:
- # we want to start the auto-update timer
- dh_systemd_start \
- -psnapd \
- data/systemd/snapd.refresh.timer
- # but not start the service
- dh_systemd_start \
- --no-start \
- -psnapd \
- data/systemd/snapd.refresh.service
- # start snapd
- dh_systemd_start \
- -psnapd \
- data/systemd/snapd.socket
- dh_systemd_start \
- -psnapd \
- data/systemd/snapd.service
- # start autoimport
- dh_systemd_start \
- -psnapd \
- data/systemd/snapd.autoimport.service
- dh_systemd_start \
- -psnapd \
- data/systemd/snapd.core-fixup.service
-
override_dh_install:
# we do not need this in the package, its just needed during build
rm -rf ${CURDIR}/debian/tmp/usr/bin/xgettext-go
@@ -4,22 +4,30 @@ set -e
systemctl_stop() {
unit="$1"
- if systemctl is-active -q "$unit"; then
- echo "Stoping $unit"
+ for i in $(seq 10); do
+ if ! systemctl is-active -q "$unit"; then
+ echo "$unit is stopped."
+ break
+ fi
+ echo "Stoping $unit [attempt $i]"
systemctl stop -q "$unit" || true
- fi
+ sleep .1
+ done
}
if [ "$1" = "purge" ]; then
# undo any bind mount to /snap that resulted from LP:#1668659
+ # (that bug can't happen in trusty -- and doing this would mess up snap.mount.service there)
if grep -q "/snap /snap" /proc/self/mountinfo; then
umount -l /snap || true
fi
- mounts=$(systemctl list-unit-files --full | grep '^snap[-.].*\.mount' | cut -f1 -d ' ')
- services=$(systemctl list-unit-files --full | grep '^snap[-.].*\.service' | cut -f1 -d ' ')
+ units=$(systemctl list-unit-files --full | grep '^snap[-.]' | cut -f1 -d ' ' | grep -vF snap.mount.service || true)
+ mounts=$(echo "$units" | grep '^snap[-.].*\.mount$' || true)
+ services=$(echo "$units" | grep '^snap[-.].*\.service$' || true)
+
for unit in $services $mounts; do
- # ensure its really a snapp mount unit or systemd unit
+ # ensure its really a snap mount unit or systemd unit
if ! grep -q 'What=/var/lib/snapd/snaps/' "/etc/systemd/system/$unit" && ! grep -q 'X-Snappy=yes' "/etc/systemd/system/$unit"; then
echo "Skipping non-snapd systemd unit $unit"
continue
@@ -43,7 +51,8 @@ if [ "$1" = "purge" ]; then
rm -f "/snap/bin/$snap"
rm -f "/snap/bin/$snap".*
# snap mount dir
- umount -l "/snap/$snap/$rev" 2> /dev/null || true
+ # we pass -d (clean up loopback devices) for trusty compatibility
+ umount -d -l "/snap/$snap/$rev" 2> /dev/null || true
rm -rf "/snap/$snap/$rev"
rm -f "/snap/$snap/current"
# snap data dir
@@ -53,7 +62,7 @@ if [ "$1" = "purge" ]; then
# opportunistic remove (may fail if there are still revisions left
for d in "/snap/$snap" "/var/snap/$snap"; do
if [ -d "$d" ]; then
- rmdir --ignore-fail-on-non-empty "$d"
+ rmdir --ignore-fail-on-non-empty "$d" || true
fi
done
fi

0 comments on commit 67902f1

Please sign in to comment.