This file is indexed.

/usr/share/quickly/templates/ubuntu-application/internal/launchpad_helper.py is in quickly-ubuntu-template 12.08.1-0ubuntu2.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

 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
# -*- Mode: Python; coding: utf-8; indent-tabs-mode: nil; tab-width: 4 -*-
# Copyright 2010 Didier Roche, some part based on
# Martin Pitt <martin.pitt@ubuntu.com>
# and http://blog.launchpad.net/api/recipe-for-uploading-files-via-the-api
#
# This file is part of Quickly ubuntu-application template
#
#This program is free software: you can redistribute it and/or modify it
#under the terms of 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 GNU 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/>.

import datetime
import os
import sys
import subprocess

from launchpadlib.errors import HTTPError # pylint: disable=E0611

import gettext
from gettext import gettext as _
gettext.textdomain('quickly')

#TODO: see if 0 release in the project

def create_release(project, version):
    '''Create new release and milestone for LP project.

    If more than one release already exists, take the last one.'''

    release_date = datetime.date.today().strftime('%Y-%m-%d')
    if len(project.series) == 0:
        print "No serie is not supported right now. Not uploading the tarball for you"
        sys.exit(1)
    serie = project.series[project.series.total_size - 1]
    milestone = serie.newMilestone(name=version,
                                   date_targeted=release_date)
    return milestone.createProductRelease(date_released=release_date)

def push_tarball_to_launchpad(project, version, tarball, changelog_content):
    '''Push new tarball to Launchpad, create release if needed and sign it'''

        # Find the release in the project's releases collection.
    release = None
    for rel in project.releases:
        if rel.version == version:
            release = rel
            break
    if not release:
        release = create_release(project, version)

    # Get the file contents.
    file_content = open(tarball, 'r').read()
    # Get the signature, if available.
    signature = tarball + '.asc'
    if not os.path.exists(signature):
        print _('Calling GPG to create tarball signature...')
        if subprocess.call(['gpg', '--armor', '--sign', '--detach-sig',
                            tarball]) != 0:
            sys.stderr.write(_('Signing the tarball failed, not uploading the ' \
                               'signature'))

    if os.path.exists(signature):
        signature_content = open(signature, 'r').read()
    else:
        signature_content = None

    # Create a new product release file.
    tarball_pretty_name = os.path.basename(tarball)
    signature_pretty_name = os.path.basename(signature)
    release.add_file(filename=tarball_pretty_name, description='%s tarball' % version,
            file_content=file_content, content_type='appplication/x-gzip',
            file_type='Code Release Tarball', signature_filename=signature_pretty_name,
            signature_content=signature_content)

    if not changelog_content:
        changelog_content = _('New release available: %s') % version
    else:
        changelog_content = "\n".join(changelog_content)
    release.changelog = changelog_content
    release.release_notes = changelog_content
    try:
        release.lp_save()
    except HTTPError, e:
        print(_('An error happened during tarball upload:'), e.content)
        sys.exit(1)