#1035947 fresh build from git fails with cannot access local variable 'new_file'

#1035947#5
Date:
2023-05-11 14:32:40 UTC
From:
To:
I'm trying to build Firefox 113 from the git repository. I have pulled
the package with:

    debcheckout firefox

Then tried to download the latest tarballs with:

    uscan --download-current

This crashes with a Python exception:

anarcat@angela:firefox$ uscan --download-current
Newest version of firefox on remote site is 113.0, specified download version is 113.0
uscan warn: Possible OpenPGP signature found at:
https://archive.mozilla.org/pub/firefox/releases/113.0/source/firefox-113.0.source.tar.xz.asc
 * Add opts=pgpsigurlmangle=s/$/.asc/ or opts=pgpmode=auto to debian/watch
 * Add debian/upstream/signing-key.asc.
 See uscan(1) for more details
Successfully symlinked ../firefox-113.0.source.tar.xz to ../firefox_113.0.orig.tar.xz.
Traceback (most recent call last):
  File "/home/anarcat/dist/firefox/debian/repack.py", line 217, in <module>
    main()
  File "/home/anarcat/dist/firefox/debian/repack.py", line 205, in main
    if not new_file:
           ^^^^^^^^
UnboundLocalError: cannot access local variable 'new_file' where it is not associated with a value
uscan: error: python3 debian/repack.py --upstream-version 113.0 ../firefox_113.0.orig.tar.xz subprocess returned exit status 1
anarcat@angela:firefox[1]$

I believe the following patch fixes the issue somehow:

diff --git i/debian/repack.py w/debian/repack.py
index 00d20928f6e..4f04ea200fb 100755
--- i/debian/repack.py
+++ w/debian/repack.py
@@ -199,6 +199,8 @@ def main():

     if options.new_file:
         new_file = options.new_file
+    else:
+        new_file = None

     if os.path.islink(args[0]):
         orig = os.path.realpath(args[0])

a.

#1035947#10
Date:
2023-05-11 20:06:15 UTC
From:
To:
severity 1035947 normal
thanks

This would be serious if it failed to build with the sources in the
Debian archive, which is what counts.

Note that using uscan doesn't get you all the sources.