/breezy-debian/trunk

To get this branch, use:
bzr branch https://code.breezy-vcs.org/breezy-debian/trunk

« back to all changes in this revision

Viewing changes to upstream/__init__.py

  • Committer: Jelmer Vernooij
  • Date: 2019-01-22 00:30:03 UTC
  • Revision ID: jelmer@jelmer.uk-20190122003003-0pwtog2dhissrktk
Pass copyright-file to uscan, so that Files-Excluded can be read.

Show diffs side-by-side

added added

removed removed

Lines of Context:
197
197
        dehs_tag = dehs_tags[0]
198
198
        for w in dehs_tag.getElementsByTagName("warnings"):
199
199
            warning(w.firstChild.wholeText)
200
 
        upstream_version_tags = dehs_tag.getElementsByTagName("upstream-version")
 
200
        upstream_version_tags = dehs_tag.getElementsByTagName(
 
201
            "upstream-version")
201
202
        if len(upstream_version_tags) != 1:
202
203
            return None
203
204
        upstream_version_tag = upstream_version_tags[0]
205
206
 
206
207
    def get_latest_version(self, package, current_version):
207
208
        try:
208
 
            tempfilename = self._export_file('watch')
 
209
            watch_tempfilename = self._export_file('watch')
209
210
        except NoSuchFile:
210
211
            note("No watch file to use to check latest upstream release.")
211
212
            return None
 
213
        args = ["--package=%s" % package, "--report",
 
214
                "--no-download", "--dehs",
 
215
                "--upstream-version=%s" % current_version]
212
216
        try:
213
 
            p = subprocess.Popen(["uscan", "--package=%s" % package, "--report",
214
 
                "--no-download", "--dehs", "--watchfile=%s" % tempfilename,
215
 
                "--upstream-version=%s" % current_version],
 
217
            p = subprocess.Popen(
 
218
                ["uscan", "--watchfile=%s" % watch_tempfilename] + args,
216
219
                stdout=subprocess.PIPE)
217
220
            (stdout, stderr) = p.communicate()
218
221
        finally:
219
 
            os.unlink(tempfilename)
 
222
            os.unlink(watch_tempfilename)
220
223
        return self._xml_report_extract_upstream_version(stdout)
221
224
 
222
225
    def fetch_tarballs(self, package, version, target_dir, components=None):
223
226
        note("Using uscan to look for the upstream tarball.")
224
227
        try:
225
 
            tempfilename = self._export_file('watch')
 
228
            watch_tempfilename = self._export_file('watch')
226
229
        except NoSuchFile:
227
230
            note("No watch file to use to retrieve upstream tarball.")
228
231
            raise PackageVersionNotPresent(package, version, self)
229
 
        try:
230
 
            r = subprocess.call(["uscan", "--watchfile=%s" % tempfilename, 
231
 
                "--upstream-version=%s" % version,
 
232
        args = ["--upstream-version=%s" % version,
232
233
                "--force-download", "--rename", "--package=%s" % package,
233
234
                "--check-dirname-level=0",
234
235
                "--download", "--destdir=%s" % target_dir,
235
 
                "--download-version=%s" % version])
 
236
                "--download-version=%s" % version]
 
237
        try:
 
238
            copyright_tempfilename = self._export_file('copyright')
 
239
        except NoSuchFile:
 
240
            note('No copyright file found.')
 
241
            copyright_tempfilename = None
 
242
        else:
 
243
            args.append("--copyright-file=%s" % copyright_tempfilename)
 
244
        try:
 
245
            r = subprocess.call(
 
246
                ["uscan", "--watchfile=%s" % watch_tempfilename] + args)
236
247
        finally:
237
 
            os.unlink(tempfilename)
 
248
            os.unlink(watch_tempfilename)
 
249
            if copyright_tempfilename:
 
250
                os.unlink(copyright_tempfilename)
238
251
        if r != 0:
239
252
            note("uscan could not find the needed tarball.")
240
253
            raise PackageVersionNotPresent(package, version, self)