commit:     e23d7a9f14e2efb0007ce40d3b015a3fe97505d8
Author:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Tue Oct 13 13:20:50 2015 +0000
Commit:     Michael Palimaka <kensington <AT> gentoo <DOT> org>
CommitDate: Tue Oct 13 13:21:46 2015 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=e23d7a9f

Documentation: start reorganising new maintainer scripts

 Documentation/maintainers/new/copy-to-main-tree.sh | 56 ++++++++++++++++++++++
 .../maintainers/new/diff-between-versions.sh       | 48 +++++++++++++++++++
 Documentation/maintainers/new/lib.sh               | 21 ++++++++
 .../{drop-from-set.sh => new/set-based-remove.sh}  | 25 ++++------
 4 files changed, 133 insertions(+), 17 deletions(-)

diff --git a/Documentation/maintainers/new/copy-to-main-tree.sh 
b/Documentation/maintainers/new/copy-to-main-tree.sh
new file mode 100755
index 0000000..9b93379
--- /dev/null
+++ b/Documentation/maintainers/new/copy-to-main-tree.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+
+. $(dirname "$0")/lib.sh
+
+: ${SOURCE_REPO:="$(realpath $(dirname $0)/../../../)"}
+: ${TARGET_REPO:="$(pwd)"}
+
+help() {
+       echo Simple set-based ebuild copier.
+       echo
+       echo Given a set in the source repository, copies all ebuilds with the 
specified
+       echo version into the target repository.
+       echo
+       echo Reads TARGET_REPO from your enviroment, defaulting to the current 
directory.
+       echo
+       echo Usage: copy-to-main-tree.sh SETNAME TARGETVERSION
+       echo Example: copy-to-main-tree.sh kde-frameworks-5.15 5.15.0
+       exit 0
+}
+
+
+SETNAME="$1"
+TARGETVERSION="$2"
+
+if [[ $1 == "--help" ]] ; then
+       help
+fi
+
+if [[ -z "${SETNAME}" || -z "${TARGETVERSION}" ]] ; then
+       echo ERROR: Not enough arguments
+       echo
+       help
+fi
+
+packages=$(get_package_list_from_set ${SETNAME})
+
+for cp in ${packages} ; do
+       trap "echo Exited without finishing!; exit;" SIGINT SIGTERM
+
+       target_dir="${TARGET_REPO}/${cp}"
+
+       if [[ ! -d "${target_dir}" ]] ; then
+               mkdir "${target_dir}"
+       fi
+
+       pushd "${target_dir}" > /dev/null
+
+       pn=$(basename $(pwd))
+       ebuild="${pn}-${TARGETVERSION}.ebuild"
+
+       cp "${SOURCE_REPO}/${cp}/${ebuild}" .
+       repoman manifest
+
+       popd > /dev/null
+
+done

diff --git a/Documentation/maintainers/new/diff-between-versions.sh 
b/Documentation/maintainers/new/diff-between-versions.sh
new file mode 100755
index 0000000..00c4a4b
--- /dev/null
+++ b/Documentation/maintainers/new/diff-between-versions.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+. $(dirname "$0")/lib.sh
+
+: ${SOURCE_REPO:="$(realpath $(dirname $0)/../../../)"}
+: ${TARGET_REPO:="$(pwd)"}
+
+help() {
+       echo Simple set-based ebuild differ.
+       echo
+       echo Given a set in the source repository, prints the diff between two 
versions
+       echo of ebuilds in the target repository.
+       echo
+       echo Reads TARGET_REPO from your enviroment, defaulting to the current 
directory.
+       echo
+       echo Usage: diff-between-versions.sh SETNAME VERSION1 VERSION2
+       echo Example: diff-between-versions.sh kde-frameworks-5.15 5.14.0 5.15.0
+       exit 0
+}
+
+
+SETNAME="$1"
+VERSION1="$2"
+VERSION2="$3"
+
+if [[ $1 == "--help" ]] ; then
+       help
+fi
+
+if [[ -z "${SETNAME}" || -z "${VERSION1}" || -z "${VERSION2}" ]] ; then
+       echo ERROR: Not enough arguments
+       echo
+       help
+fi
+
+packages=$(get_package_list_from_set ${SETNAME})
+
+for cp in ${packages} ; do
+       trap "echo Exited without finishing!; exit;" SIGINT SIGTERM
+
+       target_dir="${TARGET_REPO}/${cp}"
+
+       pushd "${TARGET_REPO}/${cp}" > /dev/null
+       pn=$(basename $(pwd))
+       diff -u "${pn}-${VERSION1}.ebuild" "${pn}-${VERSION2}.ebuild"
+
+       popd > /dev/null
+done

diff --git a/Documentation/maintainers/new/lib.sh 
b/Documentation/maintainers/new/lib.sh
new file mode 100755
index 0000000..b336399
--- /dev/null
+++ b/Documentation/maintainers/new/lib.sh
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+# requires app-portage/portage-utils and app-portage/gentoolkit-dev
+
+: ${SOURCE_REPO:="$(realpath $(dirname $0)/../../../)"}
+: ${TARGET_REPO:="$(pwd)"}
+
+get_package_list_from_set() {
+       local set="${1}"
+
+       for entry in $(grep -v ^[#@] "${SOURCE_REPO}/sets/${set}") ; do
+               echo $(qatom ${entry} | cut -d " " -f 1-2 | tr " " "/")
+       done
+}
+
+get_main_tree_keyword() {
+       local portdir="$(portageq get_repo_path / gentoo)"
+       local cp="${1}"
+
+       echo $(sed -ne 's/^KEYWORDS="\(.*\)"/\1/p' "$(ls 
${portdir}/${cp}/*.ebuild | sort | tail -n 1)")
+}

diff --git a/Documentation/maintainers/drop-from-set.sh 
b/Documentation/maintainers/new/set-based-remove.sh
similarity index 51%
rename from Documentation/maintainers/drop-from-set.sh
rename to Documentation/maintainers/new/set-based-remove.sh
index 3267811..de485e1 100755
--- a/Documentation/maintainers/drop-from-set.sh
+++ b/Documentation/maintainers/new/set-based-remove.sh
@@ -1,28 +1,18 @@
 #!/bin/sh
 
-# requires app-portage/portage-utils and app-portage/gentoolkit-dev
+. $(dirname "$0")/lib.sh
 
-: ${PORTDIR:="$(pwd)"}
-
-get_package_list_from_set() {
-
-       local SET="${1}"
-
-       for entry in $(grep -v ^[#@] "${PORTDIR}/sets/${SET}") ; do
-               echo $(qatom ${entry} | cut -d " " -f 1-2 | tr " " "/")
-       done
-
-}
+: ${TARGET_REPO:="$(pwd)"}
 
 help() {
        echo Simple set-based version removed.
        echo
        echo Given a set file, removes all packages of a specified version.
        echo
-       echo Reads PORTDIR from your environment, defaulting to the current 
directory.
+       echo Reads TARGET_REPO from your environment, defaulting to the current 
directory.
        echo
-       echo Usage: drop-from-set.sh SETNAME VERSION
-       echo Example: drop-from-set.sh kde-plasma-5.0 5.0.1
+       echo Usage: set-based-remove.sh SETNAME VERSION
+       echo Example: set-based-remove.sh kde-plasma-5.0 5.0.1
        exit 0
 }
 
@@ -43,7 +33,8 @@ fi
 packages=$(get_package_list_from_set ${SETNAME})
 
 for package in ${packages} ; do
-       pushd "${PORTDIR}/${package}" > /dev/null
+       trap "echo Exited without finishing!; exit;" SIGINT SIGTERM
+       pushd "${TARGET_REPO}/${package}" > /dev/null
 
        pn=$(basename $(pwd))
 
@@ -51,5 +42,5 @@ for package in ${packages} ; do
        rm -f ${pn}-${VERSION}-r*.ebuild
 
        repoman manifest
-
+       popd > /dev/null
 done

Reply via email to