Skip to content

Instantly share code, notes, and snippets.

/gist:2339399
Created Apr 8, 2012

Embed
What would you like to do?
commit 9b848dea87bc0dd627040ba586eb37d0e0ae0dab
Author: Thomas Dziedzic <gostrc@gmail.com>
Date: Thu Apr 5 23:11:26 2012 -0500
Add script to move packages from [community] and [extra] to the AUR
diff --git a/.gitignore b/.gitignore
index 691fd83..ed126a1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -15,3 +15,4 @@ rebuildpkgs
zsh_completion
find-libdeps
crossrepomove
+repotoaur
diff --git a/Makefile b/Makefile
index df94262..fc12b5d 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,8 @@ BINPROGS = \
finddeps \
rebuildpkgs \
find-libdeps \
- crossrepomove
+ crossrepomove \
+ repotoaur
SBINPROGS = \
mkarchroot \
@@ -64,6 +65,10 @@ CROSSREPOMOVE_LINKS = \
extra2community \
community2extra
+REPOTOAUR_LINKS = \
+ extra2aur \
+ community2aur
+
all: $(BINPROGS) $(SBINPROGS) bash_completion zsh_completion
edit = sed -e "s|@pkgdatadir[@]|$(DESTDIR)$(PREFIX)/share/devtools|g"
@@ -88,6 +93,7 @@ install:
for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${CROSSREPOMOVE_LINKS}; do ln -sf crossrepomove $(DESTDIR)$(PREFIX)/bin/$$l; done
+ for l in ${REPOTOAUR_LINKS}; do ln -sf repotoaur $(DESTDIR)$(PREFIX)/bin/$$l; done
ln -sf find-libdeps $(DESTDIR)$(PREFIX)/bin/find-libprovides
install -Dm0644 bash_completion $(DESTDIR)/usr/share/bash-completion/completions/devtools
install -Dm0644 zsh_completion $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
@@ -100,6 +106,7 @@ uninstall:
for l in ${COMMITPKG_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${ARCHBUILD_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
for l in ${CROSSREPOMOVE_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
+ for l in ${REPOTOAUR_LINKS}; do rm -f $(DESTDIR)$(PREFIX)/bin/$$l; done
rm $(DESTDIR)/usr/share/bash-completion/completions/devtools
rm $(DESTDIR)$(PREFIX)/share/zsh/site-functions/_devtools
rm -f $(DESTDIR)$(PREFIX)/bin/communityco
diff --git a/repotoaur.in b/repotoaur.in
new file mode 100644
index 0000000..05f5cea
--- /dev/null
+++ b/repotoaur.in
@@ -0,0 +1,61 @@
+#!/bin/bash
+
+m4_include(lib/common.sh)
+
+scriptname=${0##*/}
+
+if [[ -z $1 ]]; then
+ echo 'Usage: '$scriptname' [pkgbase]'
+ exit 1
+fi
+
+pkgbase="${1}"
+
+packages_svn='svn+ssh://gerolde.archlinux.org/srv/svn-packages'
+packages_server='gerolde.archlinux.org'
+community_svn='svn+ssh://aur.archlinux.org/srv/svn-packages'
+community_server='aur.archlinux.org'
+
+case $scriptname in
+ extra2aur)
+ source_svn="${packages_svn}"
+ source_server="${packages_server}"
+ source_repo='extra'
+ ;;
+ community2aur)
+ source_svn="${community_svn}"
+ source_server="${community_server}"
+ source_repo='community'
+ ;;
+ *)
+ die "Couldn't find configuration for $scriptname"
+ ;;
+esac
+
+setup_workdir
+
+pushd $WORKDIR >/dev/null
+
+msg "Adding ${pkgbase} to AUR"
+svn -q checkout -N "${source_svn}" source_checkout
+svn -q up "source_checkout/${pkgbase}"
+cd "source_checkout/${pkgbase}/trunk"
+. PKGBUILD
+if declare -p pkgname 2> /dev/null | grep -q 'declare \-a'; then
+ die "${pkgbase} is a split package. Uploading split packages to the AUR is unsupported."
+else
+ makepkg --source --skipinteg
+ burp *.src.tar.gz || die "Failed to upload to the AUR."
+fi
+cd "$OLDPWD"
+
+msg "Removing ${pkgbase} from ${source_repo}"
+for _arch in ${arch[@]}; do
+ ssh "${source_server}" "/arch/db-remove ${source_repo} ${_arch} ${pkgbase}"
+done
+svn -q checkout -N "${source_svn}" remove_checkout
+svn -q up "remove_checkout/${pkgbase}"
+svn -q rm "remove_checkout/${pkgbase}"
+svn -q commit -m"${scriptname}: Moving ${pkgbase} from ${source_repo} to AUR" remove_checkout
+
+popd >/dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.