TritonDataCenter / pkgsrc-legacy

Automatically updated conversion of the "pkgsrc" module from anoncvs.netbsd.org
http://www.pkgsrc.org
127 stars 64 forks source link

Unable to init bootstrap from linux OS #564

Open thochra opened 6 years ago

thochra commented 6 years ago

Hello there.

I'm trying to build some packages with pkgsrc. I was happy to see everything was working fine until I understood that instead of using the pkgsrc-2016Q4 from pkgsrc repo I had to use the joyent/release/2016Q4 from pkgsrc-legacy repos to get all updates.

My problem here is I got stuck with the bootstrap. It complains with that message Binary packages not supported during bootstrap => https://github.com/joyent/pkgsrc-legacy/blob/f6760ab5a4616e0845515ed737727db7d6dfb766/pkgtools/pkg_install/files/info/perform.c#L342.

Trying to dig in the commits did not helped me (I also don't know much about pkgsrc for now). I have no idea how to fix this, so expect someone can give a hint for that.

My OS is archlinux, kernel 4.14.24-1-lts.

Here is the docker file I used to init my packages builder image:

FROM debian:9-slim

# Defines pkgsrc version
ARG PKG_VERSION

RUN DEBIAN_FRONTEND=noninteractive apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get -y upgrade && \
    DEBIAN_FRONTEND=noninteractive apt-get -y autoremove && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y build-essential git

ENV SH /bin/bash
ENV PATH $PATH:/usr/pkg/bin:/usr/pkg/sbin
ENV PKG_VERSION $PKG_VERSION
ENV PKG_BOOTSTRAP_ARCHIVE pkgsrc-bootstrap-x86_64-$PKG_VERSION.tar.gz
ENV PKGSRC_PATH /data/pkgsrc

# Fix for pkgsrc fetch error Unsupported URL scheme `https' (see xz source fetching fix below)
# This blocks https sources fetching which are not anymore in the main BSD ftp repos
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y curl
ENV FETCH_CMD=curl

# Init pkgsrc and pkgin
RUN mkdir -p /data && \
    cd /data && \
    git clone --depth 1 -b joyent/release/$PKG_VERSION https://github.com/joyent/pkgsrc-legacy.git pkgsrc
    #  && \
    # Fix missing source code
    # sed -i 's~http://tukaani.org/xz/~https://github.com/xz-mirror/xz/releases/download/v5.2.2/~' $PKGSRC_PATH/archivers/xz/Makefile && \
    # # Now continue with common procedure
    # cd $PKGSRC_PATH/bootstrap && \
    # ./bootstrap && \
    # cd $PKGSRC_PATH/pkgtools/pkgin && \
    # bmake && \
    # bmake install

# docker build --build-arg PKG_VERSION=2016Q4 -t pkgsrc:2016Q4-release .
# docker run -it --rm pkgsrc:2016Q4-release bash
# cd /data/pkgsrc/bootstrap && ./bootstrap

Eventually do not take care of the xz sources fix I made, I did it for the pkgsrc-2016Q4 from pkgsrc repo and I wasn't able to check for the pkgsrc-legacy repo.

Thanks in advance, Thomas.

mguegan commented 6 years ago

Hi, I can confirm the same result. After investigation it seems the culprit is the following commit : https://github.com/joyent/pkgsrc-legacy/commit/7f2ba521e33be1144ef166b66fe418d417a93a91#diff-53f6ebd732875a7c23723b84c1fc0ed6 By reverting it, you can compile the bootstrap with this Dockerfile.

@jperkin I think this is not only happening on 2016Q4 but also on pkgsrc/2017Q4

jperkin commented 6 years ago

Nice catch, this is indeed the culprit. I don't notice this, I think because I have a working pkg_info in $PATH (though it shouldn't be using it), but was able to reproduce with a stripped $PATH.

My diff to fix this will be:

-       ${PKG_INFO} -X ${PKGFILE} >${.TARGET}
+       ${PKG_INFO} -X ${PKGFILE} >${.TARGET} 2>/dev/null || ${TRUE}

which isn't perfect but there's no good way of detecting that we're running in bootstrap mode at the moment.

thochra commented 6 years ago

Thank you for the patch guys ! Bootstrap is working now :heart_eyes: