hongquan / CoBang

A QR code scanner desktop app for Linux
GNU General Public License v3.0
243 stars 28 forks source link

Can't create or remove files in install directory #16

Closed yochananmarqos closed 3 years ago

yochananmarqos commented 3 years ago

I tested your latest commit, but it fails:

arch-meson cobang build
+ exec meson setup --prefix /usr --libexecdir lib --sbindir bin --buildtype plain --auto-features enabled --wrap-mode nodownload -D b_lto=true -D b_pie=true cobang build
The Meson build system
Version: 0.54.3
Source dir: /home/yochanan/Documents/AUR/cobang/src/cobang
Build dir: /home/yochanan/Documents/AUR/cobang/src/build
Build type: native build
Project name: cobang
Project version: 0.5.6
Host machine cpu family: x86_64
Host machine cpu: x86_64
Program python3 found: YES (/usr/sbin/python3)
Found pkg-config: /usr/sbin/pkg-config (1.7.3)
Run-time dependency python-3.8-embed found: YES 3.8
Run-time dependency glib-2.0 found: YES 2.64.4
Run-time dependency gobject-2.0 found: YES 2.64.4
Run-time dependency gobject-introspection-1.0 found: YES 1.64.1
Run-time dependency gtk+-3.0 found: YES 3.24.21
Run-time dependency libnm found: YES 1.26.0
Run-time dependency gstreamer-1.0 found: YES 1.16.2
Program setup.py found: YES (/home/yochanan/Documents/AUR/cobang/src/cobang/setup.py)
Program desktop-file-validate found: YES (/usr/sbin/desktop-file-validate)
Program appstream-util found: YES (/usr/sbin/appstream-util)
Program glib-compile-schemas found: YES (/usr/sbin/glib-compile-schemas)
Configuring cobang using configuration
Program flatpak/meson/postinstall.py found: YES (/home/yochanan/Documents/AUR/cobang/src/cobang/flatpak/meson/postinstall.py)
Build targets in project: 3
meson compile -C build
Found ninja-1.10.0 at /usr/sbin/ninja
Found runner: ninja
ninja: Entering directory `build'
ninja: no work to do.
DESTDIR="$pkgdir" meson install -C build
ninja: Entering directory `build'
ninja: no work to do.
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/main.glade to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/cobang
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/about.glade to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/cobang
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/url-display.glade to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/cobang
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/wifi-display.glade to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/cobang
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/cobang_128.png to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/cobang
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/wireframe-image-add.svg to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/cobang
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/vn.hoabinh.quan.CoBang.desktop to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/applications
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/vn.hoabinh.quan.CoBang.svg to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/icons/hicolor/scalable/apps
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/vn.hoabinh.quan.CoBang.appdata.xml to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/metainfo
Installing /home/yochanan/Documents/AUR/cobang/src/cobang/data/vn.hoabinh.quan.CoBang.gschema.xml to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/share/glib-2.0/schemas
Installing /home/yochanan/Documents/AUR/cobang/src/build/exe/cobang to /home/yochanan/Documents/AUR/cobang/pkg/cobang/usr/bin
Running custom install script '/home/yochanan/Documents/AUR/cobang/src/cobang/setup.py install --prefix /usr'
running install
error: can't create or remove files in install directory

The following error occurred while trying to add or remove files in the
installation directory:

    [Errno 13] Permission denied: '/usr/lib/python3.8/site-packages/test-easy-install-327599.write-test'

The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:

    /usr/lib/python3.8/site-packages/

Perhaps your account does not have write access to this directory?  If the
installation directory is a system-owned directory, you may need to sign in
as the administrator or "root" account.  If you do not have administrative
access to this machine, you may wish to choose a different installation
directory, preferably one that is listed in your PYTHONPATH environment
variable.

For information on other options, you may wish to consult the
documentation at:

  https://setuptools.readthedocs.io/en/latest/easy_install.html

Please make the appropriate changes for your system and try again.
hongquan commented 3 years ago

I think the line

meson.add_install_script('setup.py', 'install', '--prefix', get_option('prefix'))

in my meson.build script should respect DESTDIR environment variable.

hongquan commented 3 years ago

I'm looking for a way to read environment variable from Meson script, which is not directly supported by Meson.

hongquan commented 3 years ago

@yochananmarqos Please help test the 37a1a01d commit.

yochananmarqos commented 3 years ago

No difference, I'm afraid.

hongquan commented 3 years ago

@yochananmarqos Please send me the debug log (I don't use Arch, I cannot debug myself).

hongquan commented 3 years ago

Found the reason. When your tool run

DESTDIR="$pkgdir" meson install -C build

Meson just invoke Ninja to run the Ninja script generated previously. When the Ninja script was generated, the DESTDIR was not set, the the Ninja script didn't build the "python setup.py" command as we expected.

I'm looking for other solution.

hongquan commented 3 years ago

@yochananmarqos This commit a54f71683fcf6403962923f95601cd676a03788e may fix it. Please help test.

yochananmarqos commented 3 years ago

That did the trick! 👍️