summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2014-07-31 21:07:41 -0400
committerDave Reisner <dreisner@archlinux.org>2014-07-31 21:07:41 -0400
commit60fe3079670b07187d6db2b7d952500c24b19db0 (patch)
tree90947c2ce7d5966f42f5562f747cc9b53ab18900
parent92df942545fb2536b42b7c63f45d3293db326754 (diff)
downloadasp32-60fe3079670b07187d6db2b7d952500c24b19db0.tar.xz
add checkout verb, to make bite-sized git repos
This allows you to create a repo as a child of asp's, which you can modify as you wish, and continue to pull changes from after calling 'abs update'. One might create a new remote for this repo in which to publish their own downstream branch.
-rw-r--r--README.md6
-rw-r--r--asp.in3
-rw-r--r--man/asp.1.txt10
-rw-r--r--package.inc.sh13
4 files changed, 31 insertions, 1 deletions
diff --git a/README.md b/README.md
index 2671a9f..177d8ff 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,12 @@ Get the source files for some packages:
asp export pacman testing/systemd extra/pkgfile
~~~
+Get a fully functional git checkout of a single package:
+
+~~~
+asp checkout pkgfile
+~~~
+
List the repositories a package has been pushed to:
~~~
diff --git a/asp.in b/asp.in
index fcf16b0..0797bc9 100644
--- a/asp.in
+++ b/asp.in
@@ -264,6 +264,9 @@ case $action in
usage
exit 0
;;
+ checkout)
+ map package_checkout "$@"
+ ;;
'')
log_fatal 'no action specified (use -h for help)'
;;
diff --git a/man/asp.1.txt b/man/asp.1.txt
index f94fe8c..c318d3c 100644
--- a/man/asp.1.txt
+++ b/man/asp.1.txt
@@ -23,12 +23,20 @@ Commands
--------
The following commands are understood:
+*checkout*::
+ Create a new git repository containing the full source and history
+ for each of the given targets. The new repository will pull from the
+ repository in '$ASPROOT' and must be updated separately after using
+ 'abs update'. If a checkout occurs on the same filesystem as '$ASPROOT',
+ most of the metadata can be hard linked, making this a relatively cheap
+ copy.
+
*difflog*::
Show the full revision history of the target, with file diffs.
*export*::
Dump the build source files for each target into a directory of the
- target's name in $PWD. Targets can be specified simply as 'package' to
+ target's name in '$PWD'. Targets can be specified simply as 'package' to
check out the source files at HEAD, or in 'repository/package' format
to checkout the source files which were used to push the 'package' which
exists in 'repository'.
diff --git a/package.inc.sh b/package.inc.sh
index f6059e4..63b968a 100644
--- a/package.inc.sh
+++ b/package.inc.sh
@@ -91,6 +91,19 @@ package_export() {
bsdtar -C "$startdir" -s ",^$subtree/,$pkgname/," -xf - "$subtree/"
}
+package_checkout() {
+ local pkgname=$1 remote
+
+ package_init "$pkgname" remote || return 1
+
+ # create a local tracking branch to clone from. ignore errors because
+ # it might already exist.
+ git branch "$remote/packages/$pkgname" "$remote/packages/$pkgname" 2>/dev/null
+
+ git clone "$ASPROOT" --single-branch --branch "$remote/packages/$pkgname" \
+ "$startdir/$pkgname"
+}
+
package_get_repos_with_arch() {
local pkgname=$1 remote=$2
local objtype path arch repo