Commit aaa68e49 authored by Pierre Schmitz's avatar Pierre Schmitz
Browse files

Move common functions to a shared file

* common.sh is included on build time
* most functions are copied from makepkg
parent 7c78599a
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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 "$@"

+8 −6
Original line number Diff line number Diff line
#!/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}"
+3 −2
Original line number Diff line number Diff line
#!/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

+11 −13
Original line number Diff line number Diff line
#!/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
+2 −0
Original line number Diff line number Diff line
#!/bin/bash

m4_include(lib/common.sh)

if [ "$1" = '' ]; then
	echo 'Usage: archrm <path to checkout>'
	exit 1
Loading