commit:     bc664e9702e20aaa58249e27b39a99372b68ed41
Author:     Samuel Bernardo <samuelbernardo.mail <AT> gmail <DOT> com>
AuthorDate: Thu Jul  9 23:52:07 2020 +0000
Commit:     Samuel Bernardo <samuelbernardo.mail <AT> gmail <DOT> com>
CommitDate: Thu Jul  9 23:52:07 2020 +0000
URL:        https://gitweb.gentoo.org/repo/user/ssnb.git/commit/?id=bc664e97

Add osc cli for open build service

Signed-off-by: Samuel Bernardo <samuelbernardo.mail <AT> gmail.com>

 dev-util/osc/Manifest                 |   5 ++
 dev-util/osc/files/osc.zsh_completion | 147 ++++++++++++++++++++++++++++++++++
 dev-util/osc/metadata.xml             |  13 +++
 dev-util/osc/osc-0.169.1.ebuild       |  70 ++++++++++++++++
 dev-util/osc/osc-9999.ebuild          |   1 +
 5 files changed, 236 insertions(+)

diff --git a/dev-util/osc/Manifest b/dev-util/osc/Manifest
new file mode 100644
index 0000000..f37c963
--- /dev/null
+++ b/dev-util/osc/Manifest
@@ -0,0 +1,5 @@
+AUX osc.zsh_completion 4144 BLAKE2B 
5b724cc3eda861eca4c8d691abbdbfbe98a53ae3dde75d6bf52ddb2757118b7e1bb7b37d8d7e0f93e695ae23fc7f4764ea6ae0a324a90e4c9a503b26c56beeb9
 SHA512 
08f110a7427165d19df1f46fd73cd015c0277d8590cc23687038f0a70941f9a353b7ae99cdfb067f1be6313b8f0f3efa2ad62dea243957b214adec938522f1e6
+DIST 0.169.1.tar.gz 357179 BLAKE2B 
d65b6b238aff7cd9c4e5e1509318bfcb4bccdb00c363485c4ae106fab40051f9e5f5b4b76baca3ac25b0cf64d66d0003b3580fcd930511aa6ea7c8d36d7f50e7
 SHA512 
9429864bcc61c47505c8924cdf35164289f55adf890bc6f28e3fb6063438a53722384594512e3c12662dffc1d31b84f2b292af873d72b3de552a27aa4403ab16
+EBUILD osc-0.169.1.ebuild 1617 BLAKE2B 
0c03a10289c0e4877001b1abbdf81c73d6c9df19cf9c55b569d2c31430c89a4b611e6d93b37c2ed916bc39d723984b4f429b5567c51fff3fff5955986e964043
 SHA512 
b66f1078c1354ace3eecfae8528169e2666ec8b5349dec8e2f692f398ad417a517a38acb414cb16082381b7247a66e3f65a020aa5e61fda9bc1cccbfc24cd645
+EBUILD osc-9999.ebuild 1617 BLAKE2B 
0c03a10289c0e4877001b1abbdf81c73d6c9df19cf9c55b569d2c31430c89a4b611e6d93b37c2ed916bc39d723984b4f429b5567c51fff3fff5955986e964043
 SHA512 
b66f1078c1354ace3eecfae8528169e2666ec8b5349dec8e2f692f398ad417a517a38acb414cb16082381b7247a66e3f65a020aa5e61fda9bc1cccbfc24cd645
+MISC metadata.xml 596 BLAKE2B 
e9844885a86d7d202706bd6d90ec91843d515e06e037a2fd6322fa31e521d48d406ac7f84b01f8558c967aa5c94edf79c2faa969256871f663d4a3f1a9e89b12
 SHA512 
9887dab455ed047e79c01b6a06bdf4aea5b081a76839320a7d34e53d2fd0d68958e833642b4c19a176a010ab8e2829a0f36b7fa39cb1466390fd3835101dc171

diff --git a/dev-util/osc/files/osc.zsh_completion 
b/dev-util/osc/files/osc.zsh_completion
new file mode 100644
index 0000000..74f2432
--- /dev/null
+++ b/dev-util/osc/files/osc.zsh_completion
@@ -0,0 +1,147 @@
+#compdef osc
+#
+# Copyright (C) 2009,2010 Holger Macht <hol...@homac.de>
+#
+# This file is released under the GPLv2.
+#
+# Based on the the zsh guide from http://zsh.dotsrc.org/Guide/zshguide06.html
+#
+# Toggle verbose completions: zstyle ':completion:*:osc:*' verbose no
+#                             zstyle ':completion:*:osc-subcommand:*' verbose 
no
+# 
+# Use the variables $ZSH_OSC_BUILD_TARGETS_EXTRA and $ZSH_OSC_PROJECTS_EXTRA to
+# extend the list of possible completions in your ~/.zshrc like that:
+#  export OSC_PROJECTS_EXTRA="Base:System Base:shells"
+#
+# version 0.2
+#
+
+OSC_BUILD_TARGETS="openSUSE_10.2 openSUSE_10.3 openSUSE_11.0 openSUSE_11.1 
openSUSE_11.2 openSUSE_11.3 openSUSE_Factory"
+OSC_PROJECTS="openSUSE:Factory openSUSE:11.2 openSUSE:11.3 openSUSE:11.1 
openSUSE:11.0 openSUSE:10.3"
+
+# user defined variables $OSC_BUILD_TARGETS_EXTRA and
+# $OSC_PROJECTS_EXTRA can add to the project/build target list
+OSC_BUILD_TARGETS="$OSC_BUILD_TARGETS $ZSH_OSC_BUILD_TARGETS_EXTRA"
+OSC_PROJECTS="$OSC_PROJECTS $ZSH_OSC_PROJECTS_EXTRA"
+
+# Main dispatcher
+
+_osc() {
+    if (( CURRENT > 2 )) && [[ ${words[2]} != "help" ]]; then
+        # Remember the subcommand name
+       local cmd=${words[2]}
+        # Set the context for the subcommand.
+       curcontext="${curcontext%:*:*}:osc-subcommand"
+        # Narrow the range of words we are looking at to exclude `osc'
+       (( CURRENT-- ))
+       shift words
+        # Run the completion for the subcommand
+       if [ "$cmd" = "submitreq" -o "$cmd" = "sr" ]; then
+           _osc_cmd_submitreq
+       elif [ "$cmd" = "getbinaries" ]; then
+           _osc_cmd_getbinaries
+       elif [ "$cmd" = "checkout" -o "$cmd" = "co" -o "$cmd" = "branch" ]; then
+           _osc_cmd_checkout
+       elif [ "$cmd" = "buildlog" -o "$cmd" = "buildinfo" -o "$cmd" = "bl" ]; 
then
+           _osc_cmd_buildlog
+       else
+           _osc_cmd_do $cmd
+       fi
+    else
+       local hline
+       local -a cmdlist
+       local tag=0
+       _call_program help-commands osc help | while read -A hline; do
+           # start parsing with "commands:"
+           [[ $hline[1] = "commands:" ]] && tag=1
+           # stop parsing at the line starting with "For"
+           [[ $hline[1] = "For" ]] && tag=0
+           [[ $tag = 0 ]] && continue
+           # all commands have to start with lower case letters
+           [[ $hline[1] =~ ^[A-Z] ]] && continue
+           (( ${#hline} < 2 )) && continue
+
+           # ${hline[1]%,} truncates the last ','
+           cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+       done
+       _describe -t osc-commands 'osc command' cmdlist
+    fi
+}
+
+_osc_cmd_getbinaries() {
+    _arguments \
+       '1:PROJECT:( `echo $OSC_PROJECTS` )' \
+       '2:PACKAGE:(PACKAGE)' \
+       '3:REPOSITORY:( `echo $OSC_BUILD_TARGETS` )' \
+       '4:ARCHITECTURE:(i586 x86_64)'
+}
+
+_osc_cmd_checkout() {
+    _arguments \
+       '1:PROJECT:( `echo $OSC_PROJECTS` )' \
+       '2:PACKAGE:(PACKAGE)'
+}
+
+_osc_cmd_buildlog() {
+    _arguments \
+       '1:REPOSITORY:( `echo $OSC_BUILD_TARGETS` )' \
+       '2:ARCHITECTURE:(i586 x86_64)'
+}
+
+_osc_cmd_submitreq() {
+    local hline
+    local -a cmdlist
+    local tag=0
+    _call_program help-commands osc help $cmd | while read -A hline; do
+        # start parsing from "usage:"
+       [[ $hline[1] = "usage:" ]] && tag=1
+       [[ $tag = 0 ]] && continue
+
+       if [[ $hline[1] =~ ^osc ]]; then
+           shift hline; shift hline
+       elif ! [[ $hline[1] =~ ^- ]]; then
+            # Option has to start with a '-' or 'osc submitrequest'
+           continue
+       fi
+
+       (( ${#hline} < 2 )) && continue
+
+       cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+
+    done
+    
+    _describe -t osc-commands 'osc command' cmdlist
+}
+
+
+_osc_cmd_do() {
+    local hline
+    local -a cmdlist
+    local tag=0
+    
+    # only start completion if theres some '-' on the line
+    if ! [ "$words[2]" = "-" ]; then
+       _complete
+       return
+    fi
+
+    _call_program help-commands osc help $cmd | while read -A hline; do
+       # start parsing from "Options:"
+       [[ $hline[1] = "Options:" ]] && tag=1
+       [[ $tag = 0 ]] && continue
+       # Option has to start with a '-'
+       [[ $hline[1] =~ ^- ]] || continue
+       (( ${#hline} < 2 )) && continue
+
+       cmdlist=($cmdlist "${hline[1]%,}:${hline[2,-1]}")
+    done
+
+    if [ -n "$cmdlist" ]; then
+       _describe -t osc-commands 'osc command' cmdlist
+    else
+       _complete
+    fi
+}
+
+# Code to make sure _osc is run when we load it
+_osc "$@"

diff --git a/dev-util/osc/metadata.xml b/dev-util/osc/metadata.xml
new file mode 100644
index 0000000..ce1160f
--- /dev/null
+++ b/dev-util/osc/metadata.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer type="person">
+                <email>samuelbernardo.m...@gmail.com</email>
+                <name>Samuel Bernardo</name>
+        </maintainer>
+       <longdescription lang="en">
+               Subversion-like client for Open Build Service - 
http://open-build-service.org/ It serves as client for the source code 
repository part of the build service, and it is used to edit metadata or query 
about build results.
+       </longdescription>
+</pkgmetadata>
+
+# vim:set sts=2 ts=2 sw=2 et:

diff --git a/dev-util/osc/osc-0.169.1.ebuild b/dev-util/osc/osc-0.169.1.ebuild
new file mode 100644
index 0000000..cac3c5d
--- /dev/null
+++ b/dev-util/osc/osc-0.169.1.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+PYTHON_COMPAT=( python3_{6,7,8} )
+PYTHON_REQ_USE="xml"
+
+if [[ "${PV}" == "9999" ]]; then
+       EGIT_REPO_URI="https://github.com/openSUSE/${PN}.git";
+       EXTRA_ECLASS="git-r3"
+else
+       SRC_URI="https://github.com/openSUSE/${PN}/archive/${PV}.tar.gz";
+       OBS_PROJECT="openSUSE:Tools"
+fi
+
+DISTUTILS_SINGLE_IMPL=1
+inherit distutils-r1 ${EXTRA_ECLASS}
+unset EXTRA_ECLASS
+
+DESCRIPTION="Command line tool for Open Build Service"
+HOMEPAGE="https://en.opensuse.org/openSUSE:OSC";
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE=""
+
+# Don't move KEYWORDS on the previous line or ekeyword won't work # 399061
+[[ "${PV}" == "9999" ]] || \
+KEYWORDS="~amd64 ~x86"
+
+RDEPEND="
+       app-arch/rpm[python,${PYTHON_SINGLE_USEDEP}]
+  $(python_gen_cond_dep '
+         dev-python/m2crypto[${PYTHON_USEDEP}]
+  ')
+       ${PYTHON_SINGLE_DEPS}
+"
+
+BDEPEND="
+        $(python_gen_cond_dep '
+          >=dev-python/setuptools_scm-1.15.0[${PYTHON_USEDEP}]
+        ')
+        test? (
+                ${RDEPEND}
+                $(python_gen_cond_dep '
+                  dev-python/path-py[${PYTHON_USEDEP}]
+                ')
+        )
+"
+
+distutils_enable_tests pytest
+
+src_prepare() {
+       distutils-r1_src_prepare
+}
+
+src_install() {
+       distutils-r1_src_install
+       dosym osc-wrapper.py /usr/bin/osc
+       rm -f "${ED}"/usr/share/doc/${PN}*/TODO*
+       insinto /usr/share/bash-completion/completions
+       newins dist/complete.sh osc
+       insinto /usr/lib/osc
+       newins dist/osc.complete complete
+       insinto /usr/share/zsh/site-functions
+       newins ${FILESDIR}/osc.zsh_completion _osc
+}
+
+# vim:set sts=2 ts=2 sw=2 et:

diff --git a/dev-util/osc/osc-9999.ebuild b/dev-util/osc/osc-9999.ebuild
new file mode 120000
index 0000000..bbd5538
--- /dev/null
+++ b/dev-util/osc/osc-9999.ebuild
@@ -0,0 +1 @@
+osc-0.169.1.ebuild
\ No newline at end of file

Reply via email to