[arch-projects] [devtools] [PATCH 1/3] merge archco and communityco
Signed-off-by: Florian Pritz <bluewind@xinu.at> delete mode 100755 communityco diff --git a/Makefile b/Makefile index 8772bc0..27cefba 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,6 @@ BINPROGS = \ checkpkg \ commitpkg \ archco \ - communityco \ archrelease \ archrm \ archbuild \ @@ -57,6 +56,7 @@ install: install -m0644 ${CONFIGFILES} $(DESTDIR)/usr/share/devtools for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)/usr/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)/usr/bin/$$l; done + ln -sf archco $(DESTDIR)/usr/bin/communityco install -Dm0644 bash_completion $(DESTDIR)/etc/bash_completion.d/devtools uninstall: diff --git a/archco b/archco index 5fc9ebe..3a153a7 100755 --- a/archco +++ b/archco @@ -1,10 +1,23 @@ #!/bin/bash +scriptname=${0##*/} + if [ "$1" = '' ]; then - echo 'Usage: archco <package name> [<package name>]' + echo 'Usage: '$scriptname' <package name> [<package name>]' exit 1 fi +case $scriptname in + archco) + SVNURL="svn+ssh://gerolde.archlinux.org/srv/svn-packages";; + communityco) + SVNURL="svn+ssh://aur.archlinux.org/srv/svn-packages";; + *) + echo "error: couldn't find svn url for $scriptname" + exit 1 + ;; +esac + for i in "$@"; do - svn co svn+ssh://gerolde.archlinux.org/srv/svn-packages/$i + svn co "$SVNURL/$i" done diff --git a/communityco b/communityco deleted file mode 100755 index 0909db1..0000000 --- a/communityco +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -if [ "$1" = '' ]; then - echo 'Usage: communityco <package name> [<package name>]' - exit 1 -fi - -for i in "$@"; do - svn co svn+ssh://aur.archlinux.org/srv/svn-packages/$i -done -- 1.7.6
Signed-off-by: Florian Pritz <bluewind@xinu.at> diff --git a/archco b/archco index 3a153a7..098cf31 100755 --- a/archco +++ b/archco @@ -1,9 +1,13 @@ #!/bin/bash scriptname=${0##*/} +CREATE= +STARTDIR=$PWD if [ "$1" = '' ]; then - echo 'Usage: '$scriptname' <package name> [<package name>]' + echo 'Usage: '$scriptname' [options] <package name> [<package name>]' + echo "Options:" + echo " -n create new packages and check them out" exit 1 fi @@ -18,6 +22,26 @@ case $scriptname in ;; esac +if [[ $1 = "-n" ]]; then + CREATE=1 + shift + + TMPDIR=$(mktemp -d /tmp/$scripname.XXXXXXXX) + trap "rm -rf $TMPDIR" EXIT INT TERM + + cd $TMPDIR + svn checkout -N "$SVNURL" svn + +fi + for i in "$@"; do + if (($CREATE)); then + cd $TMPDIR/svn + mkdir -p "$i/"{repos,trunk} + svn add "$i" + svn commit -m "add new package: $i" + cd $STARTDIR + fi + svn co "$SVNURL/$i" done -- 1.7.6
On Mon, 8 Aug 2011 21:21:45 +0200, Florian Pritz wrote:
Signed-off-by: Florian Pritz <bluewind@xinu.at>
diff --git a/archco b/archco index 3a153a7..098cf31 100755 --- a/archco +++ b/archco @@ -1,9 +1,13 @@ #!/bin/bash
scriptname=${0##*/} +CREATE= +STARTDIR=$PWD
if [ "$1" = '' ]; then - echo 'Usage: '$scriptname' <package name> [<package name>]' + echo 'Usage: '$scriptname' [options] <package name> [<package name>]' + echo "Options:" + echo " -n create new packages and check them out" exit 1 fi
@@ -18,6 +22,26 @@ case $scriptname in ;; esac
+if [[ $1 = "-n" ]]; then + CREATE=1 + shift + + TMPDIR=$(mktemp -d /tmp/$scripname.XXXXXXXX) + trap "rm -rf $TMPDIR" EXIT INT TERM + + cd $TMPDIR + svn checkout -N "$SVNURL" svn + +fi + for i in "$@"; do + if (($CREATE)); then + cd $TMPDIR/svn + mkdir -p "$i/"{repos,trunk} + svn add "$i" + svn commit -m "add new package: $i" + cd $STARTDIR + fi + svn co "$SVNURL/$i" done
archco shouldn't commit a package itself. This is kind of unexpected. So two suggestions: create a new script for this and/or do not commit. -- Pierre Schmitz, https://users.archlinux.de/~pierre
Signed-off-by: Florian Pritz <bluewind@xinu.at> create mode 100755 find-libdeps.sh diff --git a/Makefile b/Makefile index 27cefba..20a4523 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ BINPROGS = \ archbuild \ lddd \ finddeps \ - rebuildpkgs + rebuildpkgs \ + find-libdeps.sh SBINPROGS = \ mkarchroot \ @@ -57,6 +58,7 @@ install: for l in ${COMMITPKG_LINKS}; do ln -sf commitpkg $(DESTDIR)/usr/bin/$$l; done for l in ${ARCHBUILD_LINKS}; do ln -sf archbuild $(DESTDIR)/usr/bin/$$l; done ln -sf archco $(DESTDIR)/usr/bin/communityco + ln -sf find-libdeps.sh $(DESTDIR)/usr/bin/find-libprovides.sh install -Dm0644 bash_completion $(DESTDIR)/etc/bash_completion.d/devtools uninstall: diff --git a/find-libdeps.sh b/find-libdeps.sh new file mode 100755 index 0000000..a7a3c7c --- /dev/null +++ b/find-libdeps.sh @@ -0,0 +1,101 @@ +#!/bin/bash + +set -e + +IGNORE_INTERNAL=0 + +if [[ $1 = "--ignore-internal" ]]; then + IGNORE_INTERNAL=1 + shift +fi + +script_mode=${0##*/find-lib} +script_mode=${script_mode%%.sh} + +case $script_mode in + deps|provides) true;; + *) echo "error: unknown mode $script_mode"; exit 1;; +esac + +if [[ -z $1 ]]; then + echo "${0##*/} [options] <package file|extracted package dir>" + echo "Options:" + echo " --ignore-internal ignore internal libraries" + exit 1 +fi + +cleanup() { + if [[ $tmpdir ]]; then + rm -rf $tmpdir; + fi +} + +if [[ -d $1 ]]; then + cd $1 +else + tmpdir=$(mktemp -d /tmp/find-sodeps.XXXXXXX) + trap "cleanup" EXIT INT TERM + + case ${script_mode} in + deps) bsdtar -C $tmpdir -xf "$1";; + provides)bsdtar -C $tmpdir -xf "$1" --include="*.so*";; + esac + + cd $tmpdir +fi + +in_array() { + local needle=$1; shift + [[ -z $1 ]] && return 1 # Not Found + local item + for item in "$@"; do + [[ $item = $needle ]] && return 0 # Found + done + return 1 # Not Found +} + +process_sofile() { + # extract the library name: libfoo.so + soname="${sofile%%\.so\.*}.so" + # extract the major version: 1 + soversion="${sofile##*\.so\.}" + if [[ "$soversion" = "$sofile" ]] && (($IGNORE_INTERNAL)); then + continue + fi + if ! in_array "${soname}=${soversion}-${soarch}" ${soobjects[@]}; then + # libfoo.so=1-64 + echo "${soname}=${soversion}-${soarch}" + soobjects=(${soobjects[@]} "${soname}=${soversion}-${soarch}") + fi +} + +case $script_mode in + deps) find_args="-perm -u+x";; + provides) find_args="-name *.so*";; +esac + +find . -type f $find_args | while read filename; do + if [[ $script_mode = "provides" ]]; then + # ignore if we don't have a shared object + if ! LC_ALL=C readelf -h "$filename" 2>/dev/null | grep -q '.*Type:.*DYN (Shared object file).*'; then + continue + fi + fi + + # get architecture of the file; if soarch is empty it's not an ELF binary + soarch=$(LC_ALL=C readelf -h "$filename" 2>/dev/null | sed -n 's/.*Class.*ELF\(32\|64\)/\1/p') + [ -n "$soarch" ] || continue + + if [[ $script_mode = "provides" ]]; then + # get the string binaries link to: libfoo.so.1.2 -> libfoo.so.1 + sofile=$(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -n 's/.*Library soname: \[\(.*\)\].*/\1/p') + [ -z "$sofile" ] && sofile="${filename##*/}" + process_sofile + elif [[ $script_mode = "deps" ]]; then + # process all libraries needed by the binary + for sofile in $(LC_ALL=C readelf -d "$filename" 2>/dev/null | sed -nr 's/.*Shared library: \[(.*)\].*/\1/p'); do + process_sofile + done + fi +done + -- 1.7.6
On Mon, 8 Aug 2011 21:21:46 +0200, Florian Pritz wrote:
Signed-off-by: Florian Pritz <bluewind@xinu.at>
create mode 100755 find-libdeps.sh
diff --git a/Makefile b/Makefile index 27cefba..20a4523 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,8 @@ BINPROGS = \ archbuild \ lddd \ finddeps \ - rebuildpkgs + rebuildpkgs \ + find-libdeps.sh
Didn't test the script itself; just saying that it would be more consistent removing the .sh suffix. -- Pierre Schmitz, https://users.archlinux.de/~pierre
participants (2)
-
Florian Pritz
-
Pierre Schmitz