changeset 1553:da21ff27331e

Add ability to check out repositories in packages, IGNORE_REPOS to build from tarballs anyway, a FAQ entry on it, and more/repo.sh to set up/update some of the common ones.
author Rob Landley <rob@landley.net>
date Thu, 01 Nov 2012 23:35:09 -0500
parents c3b91b70cc42
children 36970f69f010
files config more/repo.sh sources/download_functions.sh sources/functions.sh www/FAQ.html
diffstat 5 files changed, 75 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/config	Tue Oct 30 19:55:35 2012 -0500
+++ b/config	Thu Nov 01 23:35:09 2012 -0500
@@ -54,19 +54,17 @@
 
 # export SYSIMAGE_TYPE=squashfs
 
-# Size of writeable HDA image (if any).  Does not apply to squashfs or initramfs
+# Size of writeable (ext2) HDA image. Does not apply to squashfs or initramfs
 
 # export SYSIMAGE_HDA_MEGS=2048
 
-# Set this to use symlinks instead of hard links when creating temporary copies
-# of the source packages (in setupfor).  This is slower and uses more inodes,
-# but allows the extracted source packages to live in a different filesystem
-# than the build directory.
+# Build from stable tarballs for these packages, instead of source control
+# repositories.
 
-# export SNAPSHOT_SYMLINK=1
+# export IGNORE_REPOS=all
 
 # Use qemu to run "hello world" built by the cross compiler.  Note that this
-# requires working qemu application emulation for your target to do this, which
+# requires working qemu application emulation for your target, which
 # is significantly more brittle than system emulation.  (To unbreak qemu-arm,
 # "echo 0 > /proc/sys/vm/mmap_min_addr" as root.)  You probably don't need
 # to do this.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/more/repo.sh	Thu Nov 01 23:35:09 2012 -0500
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Populate a few source control directories. If they exist, they'll be used
+# instead of source tarballs. (Note: if you want to apply patches you'll have
+# to do it yourself, sources/patches only applies to tarballs.)
+
+mkdir -p packages &&
+if [ ! -d packages/busybox ]
+then
+  git clone git://busybox.net/busybox packages/busybox || exit 1
+else
+  (cd packages/busybox && git pull) || exit 1
+fi
+
+if [ ! -d packages/uClibc ]
+then
+  git clone git://uclibc.org/uClibc packages/uClibc
+else
+  (cd packages/uClibc && git pull) || exit 1
+fi
+
+if [ ! -d packages/linux ]
+then
+  git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 \
+    packages/linux || exit 1
+else
+  (cd packages/linux && git pull) || exit 1
+fi
+
+if [ ! -d packages/toybox ]
+then
+  hg clone http://landley.net/hg/toybox packages/toybox || exit 1
+else
+  (cd packages/toybox && hg pull -u) || exit 1
+fi
--- a/sources/download_functions.sh	Tue Oct 30 19:55:35 2012 -0500
+++ b/sources/download_functions.sh	Thu Nov 01 23:35:09 2012 -0500
@@ -58,6 +58,8 @@
   mkdir -p "$SRCTREE" || dienow
 
   PACKAGE="$1"
+  ! is_in_list "PACKAGE" "$IGNORE_REPOS" && [ -d "$SRCDIR/$PACKAGE" ] &&
+    return 0
 
   # Announce to the world that we're cracking open a new package
 
@@ -205,6 +207,8 @@
 
   # Give package name, minus file's version number and archive extension.
   BASENAME="$(noversion "$FILENAME")"
+  ! is_in_list "$BASENAME" "$IGNORE_REPOS" &&
+    [ -d "$SRCDIR/$BASENAME" ] && echo "Using $SRCDIR/$BASENAME" && return 0
 
   # If environment variable specifies a preferred mirror, try that first.
 
--- a/sources/functions.sh	Tue Oct 30 19:55:35 2012 -0500
+++ b/sources/functions.sh	Thu Nov 01 23:35:09 2012 -0500
@@ -197,21 +197,28 @@
 
   echo "Snapshot '$PACKAGE'..."
 
-  if [ -z "$REUSE_CURSRC" ]
-  then
-    blank_workdir "$PACKAGE"
-    CURSRC="$(pwd)"
-  fi
+  SNAPFROM="$SRCDIR/$PACKAGE"
+  (is_in_list "$PACKAGE" "$IGNORE_REPOS" || [ ! -d "$SNAPFROM" ]) &&
+    SNAPFROM="$SRCTREE/$PACKAGE"
 
-  [ -z "$SNAPSHOT_SYMLINK" ] && LINKTYPE="l" || LINKTYPE="s"
-  cp -${LINKTYPE}fR "$SRCTREE/$PACKAGE/"* "$CURSRC"
-
-  if [ $? -ne 0 ]
+  if [ ! -d "$SNAPFROM" ]
   then
     echo "$PACKAGE not found.  Did you run download.sh?" >&2
     dienow
   fi
 
+  # Try hardlink, then symlink, then normal (noclobber) copy
+  for LINKTYPE in l s n
+  do
+    if [ -z "$REUSE_CURSRC" ]
+    then
+      blank_workdir "$PACKAGE"
+      CURSRC="$(pwd)"
+    fi
+
+    cp -${LINKTYPE}fR "$SNAPFROM/"* "$CURSRC" && break
+  done
+
   cd "$CURSRC" || dienow
   export WRAPPY_LOGPATH="$BUILD/logs/cmdlines.${ARCH_NAME}.${STAGE_NAME}.$1"
 
--- a/www/FAQ.html	Tue Oct 30 19:55:35 2012 -0500
+++ b/www/FAQ.html	Thu Nov 01 23:35:09 2012 -0500
@@ -28,6 +28,7 @@
 <li><p><a href=#debug_package_cache>Q: What's the package cache for?</a></p></li>
 <li><p><a href=#debug_working_copies>Q: What are working copies for?</a></p></li>
 </ul>
+<li><p><a href=#debug_repos>Q: Can I use source code from repositories instead of tarballs?</p></li>
 </ul>
 
 <li><p><a href=#development><h1>Development questions</h1></a></p></li>
@@ -515,6 +516,20 @@
 the source files and not the generated files, that's what the package
 cache is for.</p>
 
+<hr /><a name=debug_repos /><h2>Q: Can I use source code from repositories instead of tarballs?</h2>
+
+<p>Sure. Check them out into the packages directory with the name of the
+package you want. The more/repo.sh script provides an example for several
+packages.</p>
+
+<p>If a directory such as "packages/linux" exists, the build from that
+(instead of the package cache) for the appropriate package. Note that it
+will use this directory verbatim, if you want any of the patches from
+sources/patches you'll have to apply them yourself.</p>
+
+<p>When you'd like to build from vanilla tarballs again, either build with
+IGNORE_REPOS=all or delete the directory out of packages.</p>
+
 <a name=development>
 
 <hr /><a name=dev_miniconfig /><h2>Q: What's a miniconfig?</h2>