Permalink
Browse files

Move common functions to a shared file

* common.sh is included on build time
* most functions are copied from makepkg
  • Loading branch information...
1 parent 7c78599 commit aaa68e49e8e5a68950a63b9aa4a8c1f6aed2e2d2 @pierres pierres committed Nov 1, 2011
Showing with 252 additions and 171 deletions.
  1. +3 −1 Makefile
  2. +8 −6 archbuild.in
  3. +3 −2 archco.in
  4. +11 −13 archrelease.in
  5. +2 −0 archrm.in
  6. +10 −17 checkpkg.in
  7. +35 −53 commitpkg.in
  8. +10 −24 find-libdeps.in
  9. +3 −1 finddeps.in
  10. +5 −3 lddd.in
  11. +124 −0 lib/common.sh
  12. +13 −17 makechrootpkg.in
  13. +13 −18 mkarchroot.in
  14. +12 −16 rebuildpkgs.in
View
@@ -50,9 +50,11 @@ ARCHBUILD_LINKS = \
all: $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion
+edit = sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/devtools|g"
+
%: %.in
@echo "GEN $@"
- @sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/devtools|g" "$<" >"$@"
+ @m4 -P $@.in | $(edit) >$@
@chmod a-w "$@"
@chmod +x "$@"
View
@@ -1,6 +1,9 @@
#!/bin/bash
-base_packages=(base base-devel sudo)
+m4_include(lib/common.sh)
+
+# FIXME: temporary added curl until pacman 4.0 moves to [core]
+base_packages=(base base-devel sudo curl)
cmd="${0##*/}"
if [[ "${cmd%%-*}" == 'multilib' ]]; then
@@ -31,16 +34,15 @@ while getopts 'cr:' arg; do
done
if [[ "$EUID" != '0' ]]; then
- echo 'This script must be run as root.'
- exit 1
+ die 'This script must be run as root.'
fi
if ${clean_first} || [[ ! -d "${chroots}/${repo}-${arch}" ]]; then
- echo "Creating chroot for [${repo}] (${arch})..."
+ msg "Creating chroot for [${repo}] (${arch})..."
for copy in "${chroots}/${repo}-${arch}"/*; do
[[ -d $copy ]] || continue
- echo "Deleting chroot copy '$(basename "${copy}")'..."
+ msg2 "Deleting chroot copy '$(basename "${copy}")'..."
# Lock the copy
exec 9>"${copy}.lock"
@@ -71,5 +73,5 @@ else
"${chroots}/${repo}-${arch}/root"
fi
-echo "Building in chroot for [${repo}] (${arch})..."
+msg "Building in chroot for [${repo}] (${arch})..."
setarch "${arch}" makechrootpkg -c -r "${chroots}/${repo}-${arch}"
View
@@ -1,5 +1,7 @@
#!/bin/bash
+m4_include(lib/common.sh)
+
scriptname=${0##*/}
if [ "$1" = '' ]; then
@@ -13,8 +15,7 @@ case $scriptname in
communityco)
SVNURL="svn+ssh://aur.archlinux.org/srv/svn-packages";;
*)
- echo "error: couldn't find svn url for $scriptname"
- exit 1
+ die "error: couldn't find svn url for $scriptname"
;;
esac
View
@@ -1,18 +1,16 @@
#!/bin/bash
-abort() {
- echo ${1:-'archrelease: Cancelled'}
- exit 1
-}
+m4_include(lib/common.sh)
if [[ -z $1 ]]; then
- abort 'Usage: archrelease <repo>...'
+ echo 'Usage: archrelease <repo>...'
+ exit 1
fi
# TODO: validate repo is really repo-arch
if [[ ! -f PKGBUILD ]]; then
- abort 'archrelease: PKGBUILD not found'
+ die 'archrelease: PKGBUILD not found'
fi
trunk=${PWD##*/}
@@ -21,24 +19,24 @@ trunk=${PWD##*/}
# such as 'gnome-unstable'
IFS='/' read -r -d '' -a parts <<< "$PWD"
if [[ "${parts[@]:(-2):1}" == "repos" ]]; then
- abort 'archrelease: Should not be in repos dir (try from trunk/)'
+ die 'archrelease: Should not be in repos dir (try from trunk/)'
fi
unset parts
if [[ $(svn status -q) ]]; then
- abort 'archrelease: You have not committed your changes yet!'
+ die 'archrelease: You have not committed your changes yet!'
fi
pushd .. >/dev/null
IFS=$'\n' read -r -d '' -a known_files < <(svn ls -r HEAD "$trunk")
for file in "${known_files[@]}"; do
if [[ ${file:(-1)} = '/' ]]; then
- abort "archrelease: subdirectories are not supported in package directories!"
+ die "archrelease: subdirectories are not supported in package directories!"
fi
done
for tag in "$@"; do
- echo -n "copying ${trunk} to ${tag}..."
+ stat_busy "copying ${trunk} to ${tag}"
if [[ -d repos/$tag ]]; then
declare -a trash
@@ -55,12 +53,12 @@ for tag in "$@"; do
# copy all files at once from trunk to the subdirectory in repos/
svn copy -q -r HEAD ${known_files[@]/#/$trunk/} "repos/$tag/"
- echo 'done'
+ stat_done
done
-echo -n "releasing package..."
+stat_busy "releasing package"
printf -v tag_list ", %s" "$@"; tag_list="${tag_list#, }"
svn commit -q -m "archrelease: copy ${trunk} to $tag_list" || abort
-echo 'done'
+stat_done
popd >/dev/null
View
@@ -1,5 +1,7 @@
#!/bin/bash
+m4_include(lib/common.sh)
+
if [ "$1" = '' ]; then
echo 'Usage: archrm <path to checkout>'
exit 1
View
@@ -1,11 +1,12 @@
#!/bin/bash
+m4_include(lib/common.sh)
+
# Source makepkg.conf; fail if it is not found
if [[ -r '/etc/makepkg.conf' ]]; then
source '/etc/makepkg.conf'
else
- echo '/etc/makepkg.conf not found!'
- exit 1
+ die '/etc/makepkg.conf not found!'
fi
# Source user-specific makepkg.conf overrides
@@ -14,8 +15,7 @@ if [[ -r ~/.makepkg.conf ]]; then
fi
if [[ ! -f PKGBUILD ]]; then
- echo 'This must be run in the directory of a built package.'
- exit 1
+ die 'This must be run in the directory of a built package.'
fi
. PKGBUILD
@@ -28,33 +28,26 @@ TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX)
cd "$TEMPDIR"
for _pkgname in "${pkgname[@]}"; do
- if [[ -z ${epoch} ]] ; then
- pkgfile=${_pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
- else
- pkgfile=${_pkgname}-${epoch}:${pkgver}-${pkgrel}-${CARCH}${PKGEXT}
- fi
+ pkgfile=${_pkgname}-$(get_full_version $_pkgname)-${CARCH}${PKGEXT}
if [[ -f "$STARTDIR/$pkgfile" ]]; then
ln -s "$STARTDIR/$pkgfile" "$pkgfile"
elif [[ -f "$PKGDEST/$pkgfile" ]]; then
ln -s "$PKGDEST/$pkgfile" "$pkgfile"
else
- echo "File \"$pkgfile\" doesn't exist"
- exit 1
+ die "File \"$pkgfile\" doesn't exist"
fi
pkgurl=$(pacman -Spdd --print-format '%l' --noconfirm "$_pkgname")
if [[ $? -ne 0 ]]; then
- echo "Couldn't download previous package for $_pkgname."
- exit 1
+ die "Couldn't download previous package for $_pkgname."
fi
oldpkg=${pkgurl##*://*/}
if [[ ${oldpkg##*/} = ${pkgfile##*/} ]]; then
- echo "The built package ($_pkgname) is the one in the repo right now!"
- exit 1
+ die "The built package ($_pkgname) is the one in the repo right now!"
fi
if [[ ! -f $oldpkg ]]; then
@@ -83,8 +76,8 @@ for _pkgname in "${pkgname[@]}"; do
done
cd ..
else
- echo "No soname differences for $_pkgname."
+ msg "No soname differences for $_pkgname."
fi
done
-echo "Files saved to $TEMPDIR"
+msg "Files saved to $TEMPDIR"
Oops, something went wrong.

0 comments on commit aaa68e4

Please sign in to comment.