diff options
Diffstat (limited to 'src/opkbuild')
-rw-r--r-- | src/opkbuild | 50 |
1 files changed, 44 insertions, 6 deletions
diff --git a/src/opkbuild b/src/opkbuild index 6cae035..d920da9 100644 --- a/src/opkbuild +++ b/src/opkbuild @@ -21,6 +21,7 @@ . @@LIBDIR@@/opkhelper/controlfields . @@LIBDIR@@/opkhelper/architecture +. @@LIBDIR@@/opkhelper/archive print_usage() { @@ -171,16 +172,53 @@ for binpkgdir in ../*.pkg/; do oh_is_buildable "${binpkg}" if [ ${?} -eq 0 ]; then printf 'opkbuild: Attempting to build package "%s"...\n' "${binpkg}" - # Make installation directory. - # TODO: Maybe this should be an FHS-compliant filesystem hierarchy. - mkdir dest || error "${binpkg}" # Copy or extract software sources to src. if [ -d ../src ]; then + printf 'opkbuild: Copying sources into work area...\n' cp -Rp ../src src || error "${binpkg}" - elif [ -f ../${pkgname}_${pkgver}.tar.gz ]; then - tar -xzf ../${pkgname}_${pkgver}.tar.gz || error "${binpkg}" + else + printf 'opkbuild: Extracting sources into work area...\n' + oh_archive_extract_source + case ${?} in + 1) + printf 'opkbuild: Error: No source archive found\n' >&2 + exit 1 + ;; + 2) + printf 'opkbuild: Error: Multiple source archives found\n' \ + >&2 + exit 1 + ;; + 3) + printf 'opkbuild: Error: %s\n' \ + 'Unsupported archive compression format detected' >&2 + exit 1 + ;; + 4) + printf 'opkbuild: Error: %s\n' \ + 'No directories found in source archive' >&2 + exit 1 + ;; + 5) + printf 'opkbuild: Error: %s\n' \ + 'Multiple top-level directories found in source archive' >&2 + exit 1 + ;; + 6) + printf 'opkbuild: Error: %s\n' \ + 'Failed to extract source archive' >&2 + exit 1 + ;; + 7) + printf 'opkbuild: Error: %s\n' \ + 'Failed to move extracted sources' >&2 + exit 1 + ;; + esac fi - # TODO: Other compression formats, putting things in src/, ... + # Make installation directory. + # TODO: Maybe this should be an FHS-compliant filesystem hierarchy. + mkdir dest || error "${binpkg}" # Apply patches. oh-applypatches # Copy platform config files. |