Should PPAs be forced to specify a ~ppa1 or similar in the package version?

Loïc Minier loic.minier at ubuntu.com
Sun Apr 3 17:36:35 UTC 2011


 I don't mind some safe heuristics like ~ppa being stripped for you if
 you say you're uploading to Ubuntu instead of a PPA, or vice-versa.
   But there are many different uses for PPA packages, so I wouldn't
 want a specific scheme to be required.  I would propose that we try to
 discuss how to improve specific workflows and work from them.

 To take a couple of examples:
 * we had the case of people uploading to a PPA without a ~ in the
   version or people uploading to the archive something which was meant
   to be uploaded to the distro; I personally use a small dput wrapper
   (attached) which isn't too nice but does the job for me: it asks for
   confirmation if the version in the upload contains "ppa", a ~, or
   "dooz" (which is just what I use when uploading to my own PPAs -- I
   sometimes use ~linaro for Linaro PPAs, but sometimes ~lucid for
   backports)
 * another common request is identifying packages which come from PPAs;
   we could automatically include this information in .debs via some
   pkgbinarymangler trick, or via Launchpad; something like Built-In:
   ubuntu/lucid, Built-In: ppa:lool/ppa/ubuntu/lucid etc.  This would
   likely be easier to implement globally.

 There are also packages which don't like special version numbers; I had
 cases of build failures when certain chars appear in the version or
 there is the case of the linux source package which puts very specific
 meaning behind versions, so it's not practical to impose a specific
 version scheming to all PPA packages immediately.

-- 
Loïc Minier
-------------- next part --------------
#!/bin/sh
# dput - wrapper for /usr/bin/dput asking for confirmation on some uploads
# Copyright (C) 2008 Loïc Minier <lool at dooz.org>
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
# SOFTWARE IN THE PUBLIC INTEREST, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
# DEALINGS IN THE SOFTWARE.
# Except as contained in this notice, the name of the author shall not be used
# in advertising or otherwise to promote the sale, use or other dealings in
# this Software without prior written authorization from the author.
#
# depends: dput

set -e

log() {
    echo "$*" >&2
}

log_i() {
    log "I:" "$@"
}

die() {
    log "E:" "$@"
    exit 1
}

yes_no_prompt() {
    local prompt="$1"
    local answer

    while read -p "$1" answer; do
        case "$answer" in
          Y|y|yes)
            return 0
          ;;
          N|n|no)
            return 1
          ;;
          "")
            return 2
          ;;
        esac
    done
}

changes=""
host=""
for arg; do
    case "$arg" in
      -*)
        :
      ;;
      *.changes)
        changes="$changes $arg"
      ;;
      *)
        if [ -n "$host" ]; then
            die "Host $host already given but found $arg in args"
        fi
        host="$arg"
      ;;
    esac
done

confirm=no
for change in $changes; do
    version="`sed -n '/^Format:/,/^$/s/^Version: *//p' "$change"`"
    if [ -z "$version" ]; then
        die "No Version header in $change"
    fi

    case "$host" in
      debian|ubuntu)
        case "$version" in
          *dooz*|*~*|*ppa*)
            log_i "Uploading $change with version $version to host $host requires confirmation"
            confirm=yes
            :
          ;;
          *)
            # doesn't need confirmation
            :
          ;;
        esac
      ;;
      ppa:*|ppa-*)
        # doesn't need confirmation
        :
      ;;
      *)
        log_i "Uploading to unknown host $host requires confirmation"
        confirm=yes
      ;;
    esac
done

if [ "$confirm" != no ]; then
    if ! yes_no_prompt "Confirm this upload? [y/N] "; then
        die "Upload aborted"
    fi
fi

exec /usr/bin/dput "$@"


More information about the ubuntu-devel mailing list