From 574d21c916c40211aeedf62b6a24dccc05feb872 Mon Sep 17 00:00:00 2001 From: Siegfried-Angel Gevatter Pujals Date: Sun, 25 Oct 2009 16:17:10 +0100 Subject: [PATCH] * setup-packaging-environment, setup.py, debian/copyright, debian/control: - Add a new script, setup-packaging-environment. --- debian/changelog | 2 + debian/control | 2 + debian/copyright | 8 +- setup-packaging-environment | 187 ++++++++++++++++++++++++++++++++++++ setup.py | 1 + 5 files changed, 196 insertions(+), 4 deletions(-) create mode 100755 setup-packaging-environment diff --git a/debian/changelog b/debian/changelog index 019a5d3..13d41fa 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,8 @@ ubuntu-dev-tools (0.82) UNRELEASED; urgency=low * pbuilder-dist, ubuntutools/misc.py: - Move the functions used to determine the hosts architecture and distribution to the ubuntutools.misc module. + * setup-packaging-environment, setup.py, debian/copyright, debian/control: + - Add a new script, setup-packaging-environment. [ Luca Falavigna ] * ubuntutools/requestsync/lp.py: explicitly import exceptions for diff --git a/debian/control b/debian/control index 92ca489..1000256 100644 --- a/debian/control +++ b/debian/control @@ -57,6 +57,8 @@ Description: useful tools for Ubuntu developers - requestsync - files a sync request with Debian changelog and ratione. - reverse-build-depends - find the reverse build dependencies that a package has. + - setup-packaging-environment - assistant to get an Ubuntu installation + ready for packaging work. - submittodebian - automatically send your changes to Debian as a bug report. - suspicious-source - outputs a list of files which are not common source files. diff --git a/debian/copyright b/debian/copyright index c597213..b8ecfe1 100644 --- a/debian/copyright +++ b/debian/copyright @@ -64,8 +64,8 @@ License v2 can be found in `/usr/share/common-licenses/GPL-2'. dch-repeat, get-branches, get-build-deps, manage-credentials, massfile, mk-sbuild-lv, ppaput, pull-debian-debdiff, pull-debian-source, pull-lp-source, -pull-revu-source, suspicious-source and what-patch are licensed under the GNU -General Public License, version 3: +pull-revu-source, setup-packaging-environment, suspicious-source and what-patch +are licensed under the GNU General Public License, version 3: This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -82,5 +82,5 @@ License v3 can be found in `/usr/share/common-licenses/GPL-3'. The following of the scripts can be used, at your option, regarding any later version of the previously specified license: 404main, dch-repeat, dgetlp, get-build-deps, manage-credentials, mk-sbuild-lv, pull-debian-debdiff, -pull-debian-source, pull-lp-source, reverse-build-depends, suspicious-source, -what-patch. +pull-debian-source, pull-lp-source, reverse-build-depends, +setup-packaging-environment, suspicious-source, what-patch. diff --git a/setup-packaging-environment b/setup-packaging-environment new file mode 100755 index 0000000..ae3caf6 --- /dev/null +++ b/setup-packaging-environment @@ -0,0 +1,187 @@ +#! /bin/sh +# +# Copyright (C) 2009 Siegfried-A. Gevatter +# +# ################################################################## +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; version 3 or later. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# See file /usr/share/common-licenses/GPL for more details. +# +# ################################################################## +# +# This assistants's aim is to make it more straightforward for new +# contributors to get their Ubuntu installation ready for packaging work. + +separator1() { + echo '------------------------------------------------------' + echo +} + +separator2() { + echo '======================================================' + echo +} + +await_response() { + echo + echo -n "Press enter when you're ready to continue... " + read line # Wait for a key press + echo +} + +# ################################################################## + +if [ "$(lsb_release -is)" != "Ubuntu" ] +then + echo "Error: This script has been created for Ubuntu, but you are " + echo "running «$(lsb_release -is)». Aborting." + exit 1 +fi + +echo "Welcome to the Ubuntu Packaging Environment setup!" +separator1 +echo "This assistant will help you setting up your computer with everything" +echo "necessary for getting started with Ubuntu development." +await_response +separator2 + +echo "Enabling the main, restricted, universe and multiverse components..." +separator1 +echo "Further steps will require packages from the «main» and «universe»" +echo "components. It's advisable for «restricted» and «multiverse» to also" +echo "be enabled, so that your apt cache knows about all official Ubuntu" +echo "packages." +echo +echo "This is the list of repositories enabled on your system:" +cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | \ +grep '^[ ]*deb[ ]' | while read line +do + echo " - $line" +done +echo +echo "Please check that the list above contains all four components from" +echo "Ubuntu's official repositories, and enable any missing component" +echo "(eg., using System -> Administration -> Software Sources). Do this" +echo "now." +await_response +separator2 + +echo "Installing recommended packages..." +separator1 +echo "In order to do packaging work, you'll need a minimal set of packages." +echo "Those, together with other packages which, though optional, have proven" +echo "to be useful, will now be installed." +echo +sudo aptitude install ubuntu-dev-tools devscripts debhelper cdbs patchutils pbuilder build-essential +separator2 + +echo "Enabling the source repository" +separator1 +echo "In order to do packaging work comfortably, you'll want to have" +echo "information about all of Ubuntu's source packages in your apt" +echo "cache. This will make it possible for you to:" +echo " - Check information about them without the need to go online." +echo " - Download the latest version of a source package with a single command." +echo +echo "This is the list of source repositories enabled on your system:" +cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list | \ +grep '^[ ]*deb-src[ ]' | while read line +do + echo " - $line" +done +echo +echo "Please check that the list above contains all four components, from" +echo "Ubuntu's official repositories and for the current development version" +echo "(important: even if you're using a stable Ubuntu release, the deb-src" +echo "line needs to be for the latest, in-development, Ubuntu version)". +echo +echo "Enable any missing component (eg., by editing your /etc/apt/sources.list" +echo "file). Do this now." +await_response +separator2 + +echo "Defining the DEBEMAIL and DEBFULLNAME environment variables" +separator1 +echo "Most packaging tools make use of the DEBEMAIL and DEBFULLNAME" +echo "environment variables to know who you are." +echo +skip_step=false +if [ -n "$DEBFULLNAME" -a -n "$DEBEMAIL" ] +then + echo "This variables currently have the following value on your system:" + echo "Full name (and comment): $DEBFULLNAME" + echo "Valid e-mail address: $DEBEMAIL" + echo + echo -n "Is this information correct? [yn] " + while read line + do + if [ "$line" = "y" ] + then + skip_step=true + break + fi + if [ "$line" = "n" ] + then + break + fi + echo -n "Please write on of «y» or «n»: " + done + echo +fi +show_gpg_info() { + if [ -n "gpg --list-secret-keys 2>/dev/null" ] + then + echo + echo "Note: Write your name and e-mail exactly like in your GPG key." + echo "For reference, here are your GPG identities:" + gpg --list-secret-keys | grep uid | cut -c4- | sed 's/^[ ]*//;' | \ + while read line + do + echo " - $line" + done + fi +} +if [ "$skip_step" = false -a "$(basename $SHELL)" != "bash" ] +then + echo "Please export the DEBEMAIL and DEBFULLNAME variables in your" + echo "shell's configuration file." + show_gpg_info + skip_step=true + await_response +fi +if [ "$skip_step" = false ] +then + echo + echo "Please indicate your name and e-mail address. This information will" + echo "be added to your ~/.bashrc." + show_gpg_info + echo + echo -n "Full name (and comment): " + read line + echo "export DEBFULLNAME=\"$(echo $line | sed 's/^[ ]*//;s/[ ]*$//')\"" >> ~/.bashrc + echo -n "Valid e-mail address: " + read line + echo "export DEBEMAIL=\"$(echo $line | sed 's/^[ ]*//;s/[ ]*$//')\"" >> ~/.bashrc + echo +fi +separator2 + +echo "Thank you!" +separator1 +echo "If you've followed all instructions carefully, your system does now" +echo "have the basic tools and configurations recommended for Ubuntu" +echo "development." +echo +echo "Some resources which may be useful during your path are:" +echo " - The Ubuntu Packaging Guide: http://wiki.ubuntu.com/PackagingGuide" +echo " - The Ubuntu Developers IRC channel: #ubuntu-motu on irc.freenode.net" +echo +echo "May the source be with you!" diff --git a/setup.py b/setup.py index dfc3ada..623f0d4 100755 --- a/setup.py +++ b/setup.py @@ -38,6 +38,7 @@ setup(name='ubuntu-dev-tools', 'pull-revu-source', 'requestsync', 'reverse-build-depends', + 'setup-packaging-environment', 'submittodebian', 'suspicious-source', 'ubuntu-iso',