Continuous output and failure
authorStephen <stephengroat@users.noreply.github.com>
Mon, 10 Jul 2017 16:28:51 +0000 (09:28 -0700)
committerFredrik Fornwall <fredrik@fornwall.net>
Fri, 14 Jul 2017 21:21:20 +0000 (23:21 +0200)
some attempt at using dpkg for termux package installs instead of
rebuilding from source

.travis.yml
Rakefile
build-package.sh
packages/git/build.sh
packages/libuv/build.sh

index 5e19cd0..b23cca0 100644 (file)
@@ -1,6 +1,5 @@
 language: ruby
 sudo: required
-services:
-  - docker
+cache: bundler
+services: docker
 before_script: mkdir debs && chmod 777 debs
-
index ae966bf..c0927c0 100644 (file)
--- a/Rakefile
+++ b/Rakefile
@@ -1,4 +1,5 @@
 require 'rugged'
+require 'pty'
 
 task default: %w[build]
 
@@ -6,13 +7,32 @@ task :build do
   repo = Rugged::Repository.new('.')
   commit = repo.head.target
   parent = commit.parents.first
-  paths = commit.diff(parent).deltas.map { |d| d.new_file[:path] }
-  paths = paths.map { |p| Pathname.new(p).each_filename.to_a }
-  # looking for packages/[package]/...
-  packages = paths.map { |p| p[1] if p.length > 2 and p[0] == "packages" }
-  packages = packages.flatten.uniq
-  packages.each do |package|
-    puts package
-    printf `./scripts/run-docker.sh ./build-package.sh #{package}`
+  pkgs = commit.diff(parent).deltas.map { |d| d.new_file[:path] }
+  # Split paths into arrays
+  pkgs.map! { |p| Pathname.new(p).each_filename.to_a }
+  # looking for [disabled-]packages/(package_name)/...
+  pkgs.select! { |p| p.length > 2 and p[0] =~ /(?<disabled->)packages/ }
+  # Get package_name
+  pkgs.map! { |p| p[1] }
+  # Remove duplicate packages
+  pkgs.uniq!
+  pkgs.each do |pkg|
+    puts "Building #{pkg}"
+    begin
+      # Start blocking build loop
+      PTY.spawn("./scripts/run-docker.sh ./build-package.sh #{pkg}") do |stdout, stdin, pid|
+        begin
+          stdout.each { |line| print line }
+        rescue Errno::EIO
+        end
+      end
+    rescue PTY::ChildExited
+      puts "Process exited"
+    end
+    # Exit if PTY return a non-zero code
+    if $?.exitstatus != 0
+      STDERR.puts("Error building #{pkg}")
+      exit($?.exitstatus)
+    end
   end
 end
index 325f1fb..54a32d1 100755 (executable)
@@ -308,6 +308,21 @@ termux_step_start_build() {
                for p in $TERMUX_ALL_DEPS; do
                        if [ "$p" != "$TERMUX_PKG_NAME" ]; then
                                echo "Building dependency $p if necessary..."
+                               # TODO use apt and dpkg to install instead of building
+                               # Add apt repository and key, update
+                               # TODO move this install to Dockerfile
+                               sudo apt-get update && sudo apt-get install -y software-properties-common
+                               sudo add-apt-repository "deb [arch=all,$TERMUX_ARCH] http://termux.net stable main"
+                               cat $TERMUX_SCRIPTDIR/packages/apt/trusted.gpg | sudo apt-key add -
+                               sudo apt-get update && sudo dpkg --add-architecture $TERMUX_ARCH
+                               sudo apt-get -d install ${p}:${TERMUX_ARCH}
+                               # TODO delete debug info
+                               echo "SGROAT DEBUG"
+                               ls -lah /var/cache/apt/archives
+                               echo "SGROAT DEBUG"
+                               # TODO figure out what the root is?
+                               sudo dpkg --root $TERMUX_PREFIX --configure -a
+                               sudo dpkg --root $TERMUX_PREFIX -i /var/cache/apt/archives/${p}_*_${TERMUX_ARCH}.deb
                                ./build-package.sh -a $TERMUX_ARCH -s "$p"
                        fi
                done
index 6eb14a1..fb1ea69 100755 (executable)
@@ -1,6 +1,6 @@
 TERMUX_PKG_HOMEPAGE=https://git-scm.com/
 TERMUX_PKG_DESCRIPTION="Distributed version control system designed to handle everything from small to very large projects with speed and efficiency"
-# less is required as a pager for git log, and the busybox less does not handle used escape sequences.
+# less is required as a pager for git log, and the busybox less does not handle used escape sequences
 TERMUX_PKG_DEPENDS="libcurl, less"
 TERMUX_PKG_VERSION=2.13.3
 TERMUX_PKG_SRCURL=https://www.kernel.org/pub/software/scm/git/git-${TERMUX_PKG_VERSION}.tar.xz
index 62acb34..c62acdd 100644 (file)
@@ -3,7 +3,6 @@ TERMUX_PKG_DESCRIPTION="Support library with a focus on asynchronous I/O"
 TERMUX_PKG_VERSION=1.13.1
 TERMUX_PKG_SRCURL=http://dist.libuv.org/dist/v${TERMUX_PKG_VERSION}/libuv-v${TERMUX_PKG_VERSION}.tar.gz
 TERMUX_PKG_SHA256=824fe07476a9cab519d2d3e2be6d49f1faa1e7bb59224f0d81a7d6a307ce3937
-
 termux_step_pre_configure () {
        export PLATFORM=android
        sh autogen.sh