haikuports/haikuporter

Unable to build source packages after 5cecf6a0

Closed this issue · 7 comments

After 5cecf6a0, i'm unable to build source packages.

> ./haikuporter --create-source-packages libsolv -c
.
.
> ./haikuporter --create-source-packages libsolv
Checking if any dependency-infos need to be updated ...
Looking for stale dependency-infos ...
----------------------------------------------------------------------
dev-libs::libsolv-0.7.23
        /Data/Code/haikuports/dev-libs/libsolv/libsolv-0.7.23.recipe
----------------------------------------------------------------------
Skipping download of source for libsolv-0.7.23.tar.gz
Validating checksum of libsolv-0.7.23.tar.gz
Unpacking source of libsolv-0.7.23.tar.gz
Initialized empty Git repository in /Data/Code/haikuports/dev-libs/libsolv/work-0.7.23/sources/libsolv-0.7.23/.git/
Running patch function ...
Committing changes done in patch function for libsolv-0.7.23.tar.gz
chroot has these packages active:
        /boot/system/packages/bash-5.1.016-1-x86_64.hpkg
        /boot/system/packages/binutils-2.31.1-2-x86_64.hpkg
        /boot/system/packages/bzip2-1.0.8-2-x86_64.hpkg
        /boot/system/packages/ca_root_certificates-2022_10_11-1-any.hpkg
        /boot/system/packages/coreutils-9.1-1-x86_64.hpkg
        /boot/system/packages/expat-2.5.0-2-x86_64.hpkg
        /boot/system/packages/fontconfig-2.13.96-1-x86_64.hpkg
        /boot/system/packages/freetype-2.12.1-3-x86_64.hpkg
        /boot/system/packages/gcc_syslibs-11.2.0_2021_07_28-8-x86_64.hpkg
        /boot/system/packages/gettext_libintl-0.21.1-3-x86_64.hpkg
        /boot/system/packages/graphite2-1.3.14-1-x86_64.hpkg
        /boot/system/packages/grep-3.8-1-x86_64.hpkg
        /boot/system/packages/gzip-1.12-1-x86_64.hpkg
        /boot/system/packages/haiku-r1~beta4_hrev56578_70-1-x86_64.hpkg
        /boot/system/packages/harfbuzz-4.0.0-3-x86_64.hpkg
        /boot/system/packages/icu66-66.1-3-x86_64.hpkg
        /boot/system/packages/intel_wifi_firmwares-2022_01_11-3-any.hpkg
        /boot/system/packages/libedit-20210910_3.1-3-x86_64.hpkg
        /boot/system/packages/libiconv-1.17-3-x86_64.hpkg
        /boot/system/packages/libpcre-8.45-3-x86_64.hpkg
        /boot/system/packages/libpng16-1.6.38-2-x86_64.hpkg
        /boot/system/packages/libsolv-0.3.0_haiku_2014_12_22-4-x86_64.hpkg
        /boot/system/packages/libxml2-2.9.13-4-x86_64.hpkg
        /boot/system/packages/ncurses6-6.3-2-x86_64.hpkg
        /boot/system/packages/noto-20200106-1-any.hpkg
        /boot/system/packages/noto_sans_cjk_jp-1.004-2-any.hpkg
        /boot/system/packages/openssl-1.1.1t-1-x86_64.hpkg
        /boot/system/packages/ralink_wifi_firmwares-2015_02_11-2-any.hpkg
        /boot/system/packages/readline-8.1.002-1-x86_64.hpkg
        /boot/system/packages/realtek_wifi_firmwares-2019_01_02-1-any.hpkg
        /boot/system/packages/sed-4.8-1-x86_64.hpkg
        /boot/system/packages/tar-1.34-1-x86_64.hpkg
        /boot/system/packages/unzip-6.10c23-4-x86_64.hpkg
        /boot/system/packages/which-2.21-6-x86_64.hpkg
        /boot/system/packages/zlib-1.2.13-2-x86_64.hpkg
        /boot/system/packages/zstd-1.5.2-3-x86_64.hpkg
unmount: unmounting failed: Device/File/Resource busy
unmounting /Data/Code/haikuports/dev-libs/libsolv/work-0.7.23/boot/system failed - wait and retry ...
cleaning chroot folder

After I revert 5cecf6a0...

> ./haikuporter --create-source-packages libsolv
Checking if any dependency-infos need to be updated ...
Looking for stale dependency-infos ...
----------------------------------------------------------------------
dev-libs::libsolv-0.7.23
        /Data/Code/haikuports/dev-libs/libsolv/libsolv-0.7.23.recipe
----------------------------------------------------------------------
Skipping download of source for libsolv-0.7.23.tar.gz
Validating checksum of libsolv-0.7.23.tar.gz
Unpacking source of libsolv-0.7.23.tar.gz
Initialized empty Git repository in /Data/Code/haikuports/dev-libs/libsolv/work-0.7.23/sources/libsolv-0.7.23/.git/
Running patch function ...
Committing changes done in patch function for libsolv-0.7.23.tar.gz
[Errno -2147459069] No such file or directory: '/Data/Code/haikuports/repository/libsolv_source-0.7.23.DependencyInfo'

Then I remove /Data/Code/haikuports/repository/libsolv* to fix the stale dependency-infos...

> ./haikuporter --create-source-packages libsolv -c
.
.
> ./haikuporter --create-source-packages libsolv
Checking if any dependency-infos need to be updated ...
Looking for stale dependency-infos ...
----------------------------------------------------------------------
dev-libs::libsolv-0.7.23
        /Data/Code/haikuports/dev-libs/libsolv/libsolv-0.7.23.recipe
----------------------------------------------------------------------
Skipping download of source for libsolv-0.7.23.tar.gz
Validating checksum of libsolv-0.7.23.tar.gz
Unpacking source of libsolv-0.7.23.tar.gz
Initialized empty Git repository in /Data/Code/haikuports/dev-libs/libsolv/work-0.7.23/sources/libsolv-0.7.23/.git/
Running patch function ...
Committing changes done in patch function for libsolv-0.7.23.tar.gz
chroot has these packages active:
        /boot/system/packages/bash-5.1.016-1-x86_64.hpkg
        /boot/system/packages/binutils-2.31.1-2-x86_64.hpkg
        /boot/system/packages/bzip2-1.0.8-2-x86_64.hpkg
        /boot/system/packages/ca_root_certificates-2022_10_11-1-any.hpkg
        /boot/system/packages/coreutils-9.1-1-x86_64.hpkg
        /boot/system/packages/expat-2.5.0-2-x86_64.hpkg
        /boot/system/packages/fontconfig-2.13.96-1-x86_64.hpkg
        /boot/system/packages/freetype-2.12.1-3-x86_64.hpkg
        /boot/system/packages/gcc_syslibs-11.2.0_2021_07_28-8-x86_64.hpkg
        /boot/system/packages/gettext_libintl-0.21.1-3-x86_64.hpkg
        /boot/system/packages/graphite2-1.3.14-1-x86_64.hpkg
        /boot/system/packages/grep-3.8-1-x86_64.hpkg
        /boot/system/packages/gzip-1.12-1-x86_64.hpkg
        /boot/system/packages/haiku-r1~beta4_hrev56578_70-1-x86_64.hpkg
        /boot/system/packages/harfbuzz-4.0.0-3-x86_64.hpkg
        /boot/system/packages/icu66-66.1-3-x86_64.hpkg
        /boot/system/packages/intel_wifi_firmwares-2022_01_11-3-any.hpkg
        /boot/system/packages/libedit-20210910_3.1-3-x86_64.hpkg
        /boot/system/packages/libiconv-1.17-3-x86_64.hpkg
        /boot/system/packages/libpcre-8.45-3-x86_64.hpkg
        /boot/system/packages/libpng16-1.6.38-2-x86_64.hpkg
        /boot/system/packages/libsolv-0.3.0_haiku_2014_12_22-4-x86_64.hpkg
        /boot/system/packages/libxml2-2.9.13-4-x86_64.hpkg
        /boot/system/packages/ncurses6-6.3-2-x86_64.hpkg
        /boot/system/packages/noto-20200106-1-any.hpkg
        /boot/system/packages/noto_sans_cjk_jp-1.004-2-any.hpkg
        /boot/system/packages/openssl-1.1.1t-1-x86_64.hpkg
        /boot/system/packages/ralink_wifi_firmwares-2015_02_11-2-any.hpkg
        /boot/system/packages/readline-8.1.002-1-x86_64.hpkg
        /boot/system/packages/realtek_wifi_firmwares-2019_01_02-1-any.hpkg
        /boot/system/packages/sed-4.8-1-x86_64.hpkg
        /boot/system/packages/tar-1.34-1-x86_64.hpkg
        /boot/system/packages/unzip-6.10c23-4-x86_64.hpkg
        /boot/system/packages/which-2.21-6-x86_64.hpkg
        /boot/system/packages/zlib-1.2.13-2-x86_64.hpkg
        /boot/system/packages/zstd-1.5.2-3-x86_64.hpkg
unmount: unmounting failed: Device/File/Resource busy
unmounting /Data/Code/haikuports/dev-libs/libsolv/work-0.7.23/boot/system failed - wait and retry ...
cleaning chroot folder
Populating source package ...
name                    libsolv_source
version                 0.7.23-3
architecture            source
summary                 "A library for solving packages and reading repositories (source files)"
description             "A Library for solving packages and reading repositories."
packager                "Alexander von Gluck IV <kallisti5@unixzen.com>"
vendor                  "Haiku Project"
licenses {
        "BSD (3-clause)"
}
copyrights {
        "2007-2019, Novell Inc."
}
provides {
        libsolv_source = 0.7.23
}
urls {
        "https://github.com/openSUSE/libsolv"
}
source-urls {
# Download
        "https://github.com/openSUSE/libsolv/archive/0.7.23.tar.gz"
# Location 2
        "https://ports-mirror.haiku-os.org/libsolv/0.7.23.tar.gz"
}
mimesetting files for package libsolv_source-0.7.23-3-source.hpkg ...
creating package libsolv_source-0.7.23-3-source.hpkg ...
----- Package Info ----------------
header size:                     80
heap size:                   778788
TOC size:                     29383
package attributes size:        455
total size:                  778868
-----------------------------------
grabbing libsolv_source-0.7.23-3-source.hpkg and moving it to /Data/Code/haikuports/packages/libsolv_source-0.7.23-3-source.hpkg

Not sure what's up with the mount errors, but they only show up during source builds... so suspect it's another bug.

Here's my haikuports.conf for good measure:

# Example HaikuPorts configuration
#
# =============
# Installation:
#   1) cp haikuports-sample.conf ~/config/settings/haikuports.conf
#
#   2) customize your settings:
#      lpe ~/config/settings/haikuports.conf

# ==================
# Tip:
#
# Put this into your ~/config/settings/profile to search for a string in all
# recipes with "inrecipe {searchstring}" and build a package with
# "hp {packagename}" (adjust your /path/to/your/haikuports/):
#
#       function inrecipe { grep -n $1 /path/to/your/haikuports/*/*/*.recipe; }
#       export -f inrecipe
#
#       alias hp="haikuporter -S -j8 --get-dependencies --no-source-packages"

# ==================
# Required settings:
#

# --------------
# TREE_PATH:
#     The full path to your cloned haikuports tree.
TREE_PATH="/Data/Code/haikuports"

# --------------
# PACKAGER:
#     Your name and email
PACKAGER="EMAUL <EMAUL@MAULMAIL.COM>"

# ==================
# Optional settings:

# --------------
# VENDOR:
#     Sets a custom VENDOR tag that will be inserted into all built packages
#     ("Haiku Project" by default).
#VENDOR="Haiku Project"

# --------------
# ALLOW_UNTESTED:
#     Allow build of untested recipes. '?x86' for example
ALLOW_UNTESTED="yes"

# --------------
# ALLOW_UNSAFE_SOURCES:
#     Allow building from unsafe sources. Setting this to yes allows
#     downloading sources for which there is no possibility to check if they
#     have been corrupted or tampered with.
#
#     Only set this to yes if you really need this and know what you're doing,
#     for example if you want to build recipes for development versions that
#     fetch the head from a repository.
#ALLOW_UNSAFE_SOURCES="yes"

# --------------
# TARGET_ARCHITECTURE:
#     The primary architectures you wish to compile recipes for.
#     Defaults to the current primary platform.
#TARGET_ARCHITECTURE="x86_gcc2"

# --------------
# SECONDARY_TARGET_ARCHITECTURES:
#     Secondary platforms you wish to build packages for (one per line)
#     Example is x86 (gcc4) packages on a x86_gcc2 (gcc2) system
#     Default is no secondary target architectures.
#SECONDARY_TARGET_ARCHITECTURES="x86"

What's 5cecf6a0? I get a 404 for that commit.

I get the same problem. This also blocks the boostrap build.
Problematic commit seems to be 5be7f1a
before: haikuporter builds source packages by default so --create-source-packages option is not needed (but also it results in error if we specify it explicitly)
after: haikuporter does not build source packages by default and we can't change this behavior with --create-source-packages as that results in the umount error

For this to work currently you need

CREATE_SOURCE_PACKAGES="yes"

in haikuports.conf.

It looks like I missed some cases, normally the source package should be enabled if you have either this option, or one of the command line options that results in creating a source package. Both shouldn't be needed, but it doesn't work as expected.

The condition at line 1055 looks particularly suspicious as it 'and's the config file option with the other conditions. Maybe try something like this?

if (not haveSourcePackage and not keys['DISABLE_SOURCE_PACKAGE']
			and not basedOnSourcePackage
			and (Configuration.shallCreateSourcePackages()
			or not getOption('noSourcePackages')))

I am not sure if this is right, either. This check is too complicated for me to understand what it does.

I have to admit that I'm a bit confused. The command line help prints out the following when invoked as haikuporter --help:

    --create-source-packages
                        build only the (regular) source packages
    --create-source-packages-for-bootstrap
                        build only source packages as required by thebootstrap
                        image

The --create-source-packages-for-bootstrap option is used during the bootstrap procedure when creating the 'rigged' source packages (which we don't really use) but it also needs regular source packages for the *_bootstrap recipes, and I'm not sure if we can rely on haikuporter.conf during bootstrapping. So how do we enable source package creation then, if not with the --create-source-packages option?

The command-line options should just work, but the commit introducing the option in haikuports.conf broke them. The option in haikuports.conf is meant to disable source packages only in the normal case (when --create-source-package is not specified), but I did not write the conditions the right way, and it doesn't work.

Note that you need to delete/regenerate the dependency info files in haikuports/repository for his fix to work.