From 48abaf6a72dca4485f0bc64af075febac6ef590d Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Wed, 20 Feb 2013 17:13:38 +0100 Subject: Added arguments to packages/bddeb: -d pass through '-d' to debuild --no-cloud-utils don't depend on cloud-utils package (default: False) These are essential for building on Debian 6, because there are no python-mocker (build dependency) and cloud-utils (install dependency) in squeeze and squeeze-backports. --- packages/bddeb | 17 +++++++++++++---- packages/debian/control.in | 3 +-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/bddeb b/packages/bddeb index bda3170d..61399739 100755 --- a/packages/bddeb +++ b/packages/bddeb @@ -36,10 +36,10 @@ PKG_MP = { 'prettytable': 'python-prettytable', 'pyyaml': 'python-yaml', } -DEBUILD_ARGS = ["-us", "-S", "-uc"] +DEBUILD_ARGS = ["-us", "-S", "-uc", "-d"] -def write_debian_folder(root, version, revno): +def write_debian_folder(root, version, revno, append_requires=[]): deb_dir = util.abs_join(root, 'debian') os.makedirs(deb_dir) @@ -58,7 +58,7 @@ def write_debian_folder(root, version, revno): pkgs = [p.lower().strip() for p in stdout.splitlines()] # Map to known packages - requires = [] + requires = append_requires for p in pkgs: tgt_pkg = PKG_MP.get(p) if not tgt_pkg: @@ -87,6 +87,11 @@ def main(): " (default: %(default)s)"), default=False, action='store_true') + parser.add_argument("--no-cloud-utils", dest="no_cloud_utils", + help=("don't depend on cloud-utils package" + " (default: %(default)s)"), + default=False, + action='store_true') for ent in DEBUILD_ARGS: parser.add_argument(ent, dest="debuild_args", action='append_const', @@ -128,7 +133,11 @@ def main(): shutil.move(extracted_name, xdir) print("Creating a debian/ folder in %r" % (xdir)) - write_debian_folder(xdir, version, revno) + if not args.no_cloud_utils: + append_requires=['cloud-utils'] + else: + append_requires=[] + write_debian_folder(xdir, version, revno, append_requires) # The naming here seems to follow some debian standard # so it will whine if it is changed... diff --git a/packages/debian/control.in b/packages/debian/control.in index edb5aff5..b9352f5b 100644 --- a/packages/debian/control.in +++ b/packages/debian/control.in @@ -18,8 +18,7 @@ Standards-Version: 3.9.3 Package: cloud-init Architecture: all -Depends: cloud-utils, - procps, +Depends: procps, python, #for $r in $requires ${r}, -- cgit v1.2.3 From 27ce4ea4f2bfe1e33454b8cec63276b044e29d12 Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Thu, 21 Feb 2013 14:23:53 +0100 Subject: Modify init-scripts to be able to run both on RHEL and Debian. --- setup.py | 2 +- sysvinit/cloud-config | 11 ++++------- sysvinit/cloud-final | 11 ++++------- sysvinit/cloud-init | 11 ++++------- sysvinit/cloud-init-local | 11 ++++------- 5 files changed, 17 insertions(+), 29 deletions(-) diff --git a/setup.py b/setup.py index 24476681..38c8cd93 100755 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ INITSYS_FILES = { 'upstart': [f for f in glob('upstart/*') if is_f(f)], } INITSYS_ROOTS = { - 'sysvinit': '/etc/rc.d/init.d', + 'sysvinit': '/etc/init.d', 'systemd': '/etc/systemd/system/', 'upstart': '/etc/init/', } diff --git a/sysvinit/cloud-config b/sysvinit/cloud-config index e587446d..ad8ed831 100755 --- a/sysvinit/cloud-config +++ b/sysvinit/cloud-config @@ -29,15 +29,13 @@ # Should-Start: $time # Required-Stop: # Should-Stop: -# Default-Start: 3 5 -# Default-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: The config cloud-init job # Description: Start cloud-init and runs the config phase # and any associated config modules as desired. ### END INIT INFO -. /etc/init.d/functions - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -60,8 +58,9 @@ prog="cloud-init" cloud_init="/usr/bin/cloud-init" conf="/etc/cloud/cloud.cfg" -# If there exists a sysconfig variable override file use it... +# If there exist sysconfig/default variable override files use it... [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init +[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init start() { [ -x $cloud_init ] || return 5 @@ -80,8 +79,6 @@ stop() { return $RETVAL } -. /etc/init.d/functions - case "$1" in start) start diff --git a/sysvinit/cloud-final b/sysvinit/cloud-final index 5deb8457..aeae8903 100755 --- a/sysvinit/cloud-final +++ b/sysvinit/cloud-final @@ -29,15 +29,13 @@ # Should-Start: $time # Required-Stop: # Should-Stop: -# Default-Start: 3 5 -# Default-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: The final cloud-init job # Description: Start cloud-init and runs the final phase # and any associated final modules as desired. ### END INIT INFO -. /etc/init.d/functions - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -60,8 +58,9 @@ prog="cloud-init" cloud_init="/usr/bin/cloud-init" conf="/etc/cloud/cloud.cfg" -# If there exists a sysconfig variable override file use it... +# If there exist sysconfig/default variable override files use it... [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init +[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init start() { [ -x $cloud_init ] || return 5 @@ -80,8 +79,6 @@ stop() { return $RETVAL } -. /etc/init.d/functions - case "$1" in start) start diff --git a/sysvinit/cloud-init b/sysvinit/cloud-init index f8ab5d5f..c1c92ad0 100755 --- a/sysvinit/cloud-init +++ b/sysvinit/cloud-init @@ -29,15 +29,13 @@ # Should-Start: $time # Required-Stop: # Should-Stop: -# Default-Start: 3 5 -# Default-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: The initial cloud-init job (net and fs contingent) # Description: Start cloud-init and runs the initialization phase # and any associated initial modules as desired. ### END INIT INFO -. /etc/init.d/functions - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -60,8 +58,9 @@ prog="cloud-init" cloud_init="/usr/bin/cloud-init" conf="/etc/cloud/cloud.cfg" -# If there exists a sysconfig variable override file use it... +# If there exist sysconfig/default variable override files use it... [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init +[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init start() { [ -x $cloud_init ] || return 5 @@ -80,8 +79,6 @@ stop() { return $RETVAL } -. /etc/init.d/functions - case "$1" in start) start diff --git a/sysvinit/cloud-init-local b/sysvinit/cloud-init-local index 0c63b9b0..b53e0db2 100755 --- a/sysvinit/cloud-init-local +++ b/sysvinit/cloud-init-local @@ -29,15 +29,13 @@ # Should-Start: $time # Required-Stop: # Should-Stop: -# Default-Start: 3 5 -# Default-Stop: +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 # Short-Description: The initial cloud-init job (local fs contingent) # Description: Start cloud-init and runs the initialization phases # and any associated initial modules as desired. ### END INIT INFO -. /etc/init.d/functions - # Return values acc. to LSB for all commands but status: # 0 - success # 1 - generic or unspecified error @@ -60,8 +58,9 @@ prog="cloud-init" cloud_init="/usr/bin/cloud-init" conf="/etc/cloud/cloud.cfg" -# If there exists a sysconfig variable override file use it... +# If there exist sysconfig/default variable override files use it... [ -f /etc/sysconfig/cloud-init ] && . /etc/sysconfig/cloud-init +[ -f /etc/default/cloud-init ] && . /etc/default/cloud-init start() { [ -x $cloud_init ] || return 5 @@ -80,8 +79,6 @@ stop() { return $RETVAL } -. /etc/init.d/functions - case "$1" in start) start -- cgit v1.2.3 From 3f61f2ee54ca1e550c733bb5d9b27f6250c1e51e Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Thu, 21 Feb 2013 15:07:54 +0100 Subject: New option INIT_SYSTEM=sysvinit_deb for Debian /etc/ directories --- setup.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 38c8cd93..b30cd53b 100755 --- a/setup.py +++ b/setup.py @@ -38,11 +38,13 @@ def is_f(p): INITSYS_FILES = { 'sysvinit': [f for f in glob('sysvinit/*') if is_f(f)], + 'sysvinit_deb': [f for f in glob('sysvinit/*') if is_f(f)], 'systemd': [f for f in glob('systemd/*') if is_f(f)], 'upstart': [f for f in glob('upstart/*') if is_f(f)], } INITSYS_ROOTS = { - 'sysvinit': '/etc/init.d', + 'sysvinit': '/etc/rc.d/init.d', + 'sysvinit_deb': '/etc/init.d', 'systemd': '/etc/systemd/system/', 'upstart': '/etc/init/', } -- cgit v1.2.3 From 10ea1c0bb933b21d32012d89b218a3bbbd15a75a Mon Sep 17 00:00:00 2001 From: Vlastimil Holer Date: Thu, 21 Feb 2013 16:29:06 +0100 Subject: Split Debian and Ubuntu APT sources --- cloudinit/config/cc_apt_configure.py | 9 ++++-- templates/sources.list.debian.tmpl | 28 +++++++++++++++++ templates/sources.list.tmpl | 60 ------------------------------------ templates/sources.list.ubuntu.tmpl | 60 ++++++++++++++++++++++++++++++++++++ 4 files changed, 94 insertions(+), 63 deletions(-) create mode 100644 templates/sources.list.debian.tmpl delete mode 100644 templates/sources.list.tmpl create mode 100644 templates/sources.list.ubuntu.tmpl diff --git a/cloudinit/config/cc_apt_configure.py b/cloudinit/config/cc_apt_configure.py index f8664160..3ce3b351 100644 --- a/cloudinit/config/cc_apt_configure.py +++ b/cloudinit/config/cc_apt_configure.py @@ -140,10 +140,13 @@ def get_release(): def generate_sources_list(codename, mirrors, cloud, log): - template_fn = cloud.get_template_filename('sources.list') + template_fn = cloud.get_template_filename('sources.list.%s' % + (cloud.distro.name)) if not template_fn: - log.warn("No template found, not rendering /etc/apt/sources.list") - return + template_fn = cloud.get_template_filename('sources.list') + if not template_fn: + log.warn("No template found, not rendering /etc/apt/sources.list") + return params = {'codename': codename} for k in mirrors: diff --git a/templates/sources.list.debian.tmpl b/templates/sources.list.debian.tmpl new file mode 100644 index 00000000..609bc6bd --- /dev/null +++ b/templates/sources.list.debian.tmpl @@ -0,0 +1,28 @@ +\## Note, this file is written by cloud-init on first boot of an instance +\## modifications made here will not survive a re-bundle. +\## if you wish to make changes you can: +\## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg +\## or do the same in user-data +\## b.) add sources in /etc/apt/sources.list.d +\## c.) make changes to template file /etc/cloud/templates/sources.list.debian.tmpl +\### + +# See http://www.debian.org/releases/stable/i386/release-notes/ch-upgrading.html +# for how to upgrade to newer versions of the distribution. +deb $mirror $codename main contrib non-free +deb-src $mirror $codename main contrib non-free + +\## Major bug fix updates produced after the final release of the +\## distribution. +deb $security $codename/updates main contrib non-free +deb-src $security $codename/updates main contrib non-free +deb $mirror $codename-updates main contrib non-free +deb-src $mirror $codename-updates main contrib non-free + +\## Uncomment the following two lines to add software from the 'backports' +\## repository. +\## N.B. software from this repository may not have been tested as +\## extensively as that contained in the main release, although it includes +\## newer versions of some applications which may provide useful features. +# deb http://backports.debian.org/debian-backports $codename-backports main contrib non-free +# deb-src http://backports.debian.org/debian-backports $codename-backports main contrib non-free diff --git a/templates/sources.list.tmpl b/templates/sources.list.tmpl deleted file mode 100644 index ce395b3d..00000000 --- a/templates/sources.list.tmpl +++ /dev/null @@ -1,60 +0,0 @@ -\## Note, this file is written by cloud-init on first boot of an instance -\## modifications made here will not survive a re-bundle. -\## if you wish to make changes you can: -\## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg -\## or do the same in user-data -\## b.) add sources in /etc/apt/sources.list.d -\## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl -\### - -# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to -# newer versions of the distribution. -deb $mirror $codename main -deb-src $mirror $codename main - -\## Major bug fix updates produced after the final release of the -\## distribution. -deb $mirror $codename-updates main -deb-src $mirror $codename-updates main - -\## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -\## team. Also, please note that software in universe WILL NOT receive any -\## review or updates from the Ubuntu security team. -deb $mirror $codename universe -deb-src $mirror $codename universe -deb $mirror $codename-updates universe -deb-src $mirror $codename-updates universe - -\## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu -\## team, and may not be under a free licence. Please satisfy yourself as to -\## your rights to use the software. Also, please note that software in -\## multiverse WILL NOT receive any review or updates from the Ubuntu -\## security team. -# deb $mirror $codename multiverse -# deb-src $mirror $codename multiverse -# deb $mirror $codename-updates multiverse -# deb-src $mirror $codename-updates multiverse - -\## Uncomment the following two lines to add software from the 'backports' -\## repository. -\## N.B. software from this repository may not have been tested as -\## extensively as that contained in the main release, although it includes -\## newer versions of some applications which may provide useful features. -\## Also, please note that software in backports WILL NOT receive any review -\## or updates from the Ubuntu security team. -# deb $mirror $codename-backports main restricted universe multiverse -# deb-src $mirror $codename-backports main restricted universe multiverse - -\## Uncomment the following two lines to add software from Canonical's -\## 'partner' repository. -\## This software is not part of Ubuntu, but is offered by Canonical and the -\## respective vendors as a service to Ubuntu users. -# deb http://archive.canonical.com/ubuntu $codename partner -# deb-src http://archive.canonical.com/ubuntu $codename partner - -deb $security $codename-security main -deb-src $security $codename-security main -deb $security $codename-security universe -deb-src $security $codename-security universe -# deb $security $codename-security multiverse -# deb-src $security $codename-security multiverse diff --git a/templates/sources.list.ubuntu.tmpl b/templates/sources.list.ubuntu.tmpl new file mode 100644 index 00000000..ce395b3d --- /dev/null +++ b/templates/sources.list.ubuntu.tmpl @@ -0,0 +1,60 @@ +\## Note, this file is written by cloud-init on first boot of an instance +\## modifications made here will not survive a re-bundle. +\## if you wish to make changes you can: +\## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg +\## or do the same in user-data +\## b.) add sources in /etc/apt/sources.list.d +\## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl +\### + +# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to +# newer versions of the distribution. +deb $mirror $codename main +deb-src $mirror $codename main + +\## Major bug fix updates produced after the final release of the +\## distribution. +deb $mirror $codename-updates main +deb-src $mirror $codename-updates main + +\## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +\## team. Also, please note that software in universe WILL NOT receive any +\## review or updates from the Ubuntu security team. +deb $mirror $codename universe +deb-src $mirror $codename universe +deb $mirror $codename-updates universe +deb-src $mirror $codename-updates universe + +\## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu +\## team, and may not be under a free licence. Please satisfy yourself as to +\## your rights to use the software. Also, please note that software in +\## multiverse WILL NOT receive any review or updates from the Ubuntu +\## security team. +# deb $mirror $codename multiverse +# deb-src $mirror $codename multiverse +# deb $mirror $codename-updates multiverse +# deb-src $mirror $codename-updates multiverse + +\## Uncomment the following two lines to add software from the 'backports' +\## repository. +\## N.B. software from this repository may not have been tested as +\## extensively as that contained in the main release, although it includes +\## newer versions of some applications which may provide useful features. +\## Also, please note that software in backports WILL NOT receive any review +\## or updates from the Ubuntu security team. +# deb $mirror $codename-backports main restricted universe multiverse +# deb-src $mirror $codename-backports main restricted universe multiverse + +\## Uncomment the following two lines to add software from Canonical's +\## 'partner' repository. +\## This software is not part of Ubuntu, but is offered by Canonical and the +\## respective vendors as a service to Ubuntu users. +# deb http://archive.canonical.com/ubuntu $codename partner +# deb-src http://archive.canonical.com/ubuntu $codename partner + +deb $security $codename-security main +deb-src $security $codename-security main +deb $security $codename-security universe +deb-src $security $codename-security universe +# deb $security $codename-security multiverse +# deb-src $security $codename-security multiverse -- cgit v1.2.3