Ungoogled-chromium: FYI - Ubuntu 20.04 focal fossa - Python 2 deprecated

Created on 26 Mar 2020  路  11Comments  路  Source: Eloston/ungoogled-chromium

Describe the bug
Users need to ensure they have the legacy python2 packages installed for the build to even be attempted. Lots of the scripts have #!/usr/bin/env python at the top so immediately break.

To fix

host:/local/ungoogled-chromium/build/src root# apt install python-is-python2-but-deprecated

host :/local/ungoogled-chromium/build/src root# ls -al /usr/bin/python
lrwxrwxrwx 1 root root 6 Mar 20 00:10 /usr/bin/python -> python2*

host:/local/ungoogled-chromium/build/src root# apt search python2 | grep ^python2 | grep installed
python2/focal,now 2.7.17-2ubuntu3 amd64 [installed]
python2-dbg/focal,now 2.7.17-2ubuntu3 amd64 [installed]
python2-dev/focal,now 2.7.17-2ubuntu3 amd64 [installed,automatic]
python2-minimal/focal,now 2.7.17-2ubuntu3 amd64 [installed,automatic]
python2.7/focal,now 2.7.17-1ubuntu5 amd64 [installed,automatic]
python2.7-dbg/focal,now 2.7.17-1ubuntu5 amd64 [installed,automatic]
python2.7-dev/focal,now 2.7.17-1ubuntu5 amd64 [installed,automatic]
python2.7-minimal/focal,now 2.7.17-1ubuntu5 amd64 [installed,automatic]

Logged to flag it for those encountering it soon.

discussion

All 11 comments

Currently using this recipe to compile, note the removal of some packages from the debian/control file. Using bionic1 tag for no particular reason, might change it if this build fails. Needs one for focal dist.

setenv UGTAG 80.0.3987.149-1.bionic1
mkdir -p /local/ungoogled-chromium
cd /local/ungoogled-chromium/
rm -rf ungoogled-chromium-* build/src
git clone --recurse-submodules https://github.com/ungoogled-software/ungoogled-chromium-debian.git
git -C ungoogled-chromium-debian checkout --recurse-submodules ${UGTAG}
mkdir -p build/src
cp -r ungoogled-chromium-debian/debian build/src/
cd build/src
perl -n -i.bak -e 'print unless m/^ lld-9,$/' debian/control
perl -n -i.bak -e 'print unless m/^ python,$/' debian/control
./debian/rules setup-debian
sudo mk-build-deps -i debian/control
rm ungoogled-chromium-build-deps_*.deb
./debian/rules setup-local-src
setenv PATH "/root/bin:/usr/local/bin:/bin:/usr/ccs/bin:/etc:/usr/etc:/usr/bin:/usr/local/X11/bin:/usr/bin/X11:/usr/proc/bin:/usr/local/sbin:/sbin:/usr/local/go/bin:/root/go/bin:/usr/local/etc:/usr/sbin"
touch /local/ungoogled-chromium/compile_`date +%Y-%m-%d-%H:%m:%S`_start
dpkg-buildpackage -b -uc
touch /local/ungoogled-chromium/compile_`date +%Y-%m-%d-%H:%m:%S`_stop
cd ..
rm *-dbgsym_*
apt purge chromium-browser chromium-browser-l10n ungoogled-chromium-driver
dpkg -i \
    ungoogled-chromium-common_${UGTAG}_amd64.deb \
    ungoogled-chromium-driver_${UGTAG}_amd64.deb \
    ungoogled-chromium-sandbox_${UGTAG}_amd64.deb \
    ungoogled-chromium-shell_${UGTAG}_amd64.deb \
    ungoogled-chromium_${UGTAG}_amd64.deb

Restart
dpkg-buildpackage -b -uc -nc

So essentially 2 problems with Focal. First, Python 2 is still provided but no longer as the base python binary. Second, Python 2 is deprecated so it will be removed in a future Ubuntu release.

After testing though I discover that Chromium's upstream build sources still depend on python2. The best we can do for now is to patch it to use python2. The second problem, the future removal of python2, is beyond us to deal with. Upstream Chromium must fix the problem on their end for a proper solution.

@Eloston In my testing I had to patch one of the upstream bootstrap scripts to use python2. Is this a patch for the Debian repository or this repository?

Edit: On second thought I think I can just invoke it through the python2 interpreter instead. That should work.

Success so far but I am going to need to patch some portions of the source code that tries to execute python child processes. I will work on that after confirming that my symlink hack builds so I know for sure that is the sole culprit.

I'm curious what's not compiling?

With the packages from the Description above installed on Focal, and pasting the recipe above the bionic1 build compiles and runs OK locally. Is the issues you are seeing coming from the sid1 build?

The build fails if the python symlink is missing. I'm trying to fix this the proper way since the python-is-python2 and such packages are not supposed to be used as an actual dependency. I'm using a hack just to see if anything else needs to be fixed first.

Ah ok, I took the easy route once I saw how many files needed a mod.

focal:/local/ungoogled-chromium/build/src root# grep -s env */* | grep python
build/apply_locales.py:#!/usr/bin/env python
build/check_gn_headers.py:#!/usr/bin/env python
build/check_gn_headers.py:        'python', '-c', 'import os;print os.environ["GCLIENT_DEP_PATH"]'],
build/check_gn_headers_unittest.py:#!/usr/bin/env python
build/check_return_value.py:#!/usr/bin/env python
build/clobber.py:#!/usr/bin/env python
build/compute_build_timestamp.py:#!/usr/bin/env python
build/copy_test_data_ios.py:#!/usr/bin/env python
build/cp.py:#!/usr/bin/env python
build/detect_host_arch.py:#!/usr/bin/env python
build/dir_exists.py:#!/usr/bin/env python
build/download_nacl_toolchains.py:#!/usr/bin/env python
build/env_dump.py:#!/usr/bin/env python
build/extract_from_cab.py:#!/usr/bin/env python
build/extract_partition.py:#!/usr/bin/env python
build/find_depot_tools.py:#!/usr/bin/env python
[...]

Actually most of those can be fixed by an argument to GN. ARCH has already dealt with this problem to a large degree since their python symlink references python3. It's just the scripts that insist on creating python subprocesses that are a problem. The bigger issue is the potential loss of python2 entirely since so much of the build system depends on it.

@Eloston this can be closed now. The issue has been addressed in my repository and needs only to be merged.

The bigger issue is the potential loss of python2 entirely since so much of the build system depends on it.

Google's migrating to Python 3.

It's not super-fast progress but it seems like steady progress.

Thanks all!

@Eloston Ok good to know. In the meantime though we may be unable to port it to newer Ubuntu if they do end up dropping python2 before the switchover to python3 is complete.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

floggle picture floggle  路  3Comments

usernamenotexist picture usernamenotexist  路  4Comments

MilesFM picture MilesFM  路  4Comments

Zoraver picture Zoraver  路  3Comments

hrj picture hrj  路  3Comments