[MacPorts] #57894: Unable to install ports from git source as root : Could not open file
MacPorts
noreply at macports.org
Sat Jan 12 12:44:08 UTC 2019
#57894: Unable to install ports from git source as root : Could not open file
--------------------+--------------------
Reporter: toki07 | Owner: (none)
Type: defect | Status: new
Priority: Normal | Milestone:
Component: base | Version: 2.5.4
Keywords: | Port:
--------------------+--------------------
Hello,
I'm trying to use macports and ports from git sources. I have followed the
instructions from the [https://guide.macports.org/#installing.macports.git
manual], but it doesn't work.
The port macports-base compiles well, but it is impossible to install any
port as root (as well as user). I have an error message.
- As sudo : ''"Error: Unable to execute port: Could not open file:
macports-ports/sysutils/coreutils/Portfile"''
- As user : ''"Error: Insufficient privileges to write to MacPorts
install prefix."''
I need to chown the macports-base tree to the user who is running the
port, and then most of them can compile, but only as user, and not as
root.
{{{
sudo chown -R $UID:$GROUPS $MACPORTS_DIR/macports-base
sudo chown -R $UID:$GROUPS $MACPORTS_DIR/macports-ports
}}}
Some of ports still need to have root access, and cannot be installed (eg
libnetpbm) and then cannot be installed.
The error message is : ''"Error: Failed to destroot libnetpbm: command
execution failed"''
Note that this seems to work if instead of using a subdir of $HOME as root
for projects, a subdir of /tmp is used to build the ports.
Here is a script that simulates the test cases.
Regards, Joel
{{{
MACPORTS_DIR=$HOME/macports/WORK
mkdir -p $MACPORTS_DIR
chmod 755 $MACPORTS_DIR
cd $MACPORTS_DIR
git clone --depth 1 --branch v2.5.4 https://github.com/macports/macports-
base.git
git clone --depth 1 --branch master https://github.com/macports/macports-
ports.git
# Adapting to use local ports (replacing rsync:// and file:// in sources
with file://$MACPORTS_DIR/macports-ports)
find $MACPORTS_DIR/macports-base -name 'sources.conf' -exec /usr/bin/sed
-i '' -E 's/^(rsync|file)(.*)$/#\1\2/' {} \;
find $MACPORTS_DIR/macports-base -name 'sources.conf' -exec sh -c "echo
'file://$MACPORTS_DIR/macports-ports [default]' >> {}" \;
# Building base ports
cd $MACPORTS_DIR/macports-base
export PATH=/bin:/sbin:/usr/bin:/usr/sbin
mkdir -p $MACPORTS_DIR/macports-base/Applications
./configure --enable-readline --prefix=$MACPORTS_DIR/macports-base --with-
applications-dir=$MACPORTS_DIR/macports-base/Applications --without-
startupitems
make -j8
# make install needs sudo, but it changes owner to root on installed files
sudo make install
sudo make distclean
export PATH=$MACPORTS_DIR/macports-base:$MACPORTS_DIR/macports-
base/bin:$MACPORTS_DIR/macports-base/sbin:$PATH
cd $MACPORTS_DIR/macports-ports
$MACPORTS_DIR/macports-base/bin/portindex
# Failure when installing as sudo
sudo $MACPORTS_DIR/macports-base/bin/port install -vd coreutils
sudo $MACPORTS_DIR/macports-base/bin/port install -vd libnetpbm
sudo chown -R $UID:$GROUPS $MACPORTS_DIR/macports-base
sudo chown -R $UID:$GROUPS $MACPORTS_DIR/macports-ports
# After chown done, some ports can build, but not when sudo access is
needed
$MACPORTS_DIR/macports-base/bin/port install -vd coreutils
$MACPORTS_DIR/macports-base/bin/port install -vd libnetpbm
}}}
--
Ticket URL: <https://trac.macports.org/ticket/57894>
MacPorts <https://www.macports.org/>
Ports system for macOS
More information about the macports-tickets
mailing list