Commit 9e6ef3cc authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmgp: use giter, drop girar functions

parent 1040a295
......@@ -10,7 +10,7 @@
# load common functions, compatible with local and installed script
. `dirname $0`/../share/eterbuild/functions/common
load_mod rpm repl git rpm web repos buildsrpm girar
load_mod rpm repl git rpm web repos buildsrpm
# loads repos file and fill SYSNAME and SYSURL arrays
load_systems_list()
......@@ -294,7 +294,7 @@ git_clone()
{
local RREPO="$1"
# Test if ssh access is available
if [ -z "$PUBLICACCESS" ] && has_ssh_girar_access ; then
if [ -z "$PUBLICACCESS" ] && giter check girar access ; then
docmd git clone $GIRARHOST:$RREPO
else
docmd git clone $GIRARURL/$RREPO
......@@ -306,7 +306,7 @@ if [ -n "$CLONEGIT" ] ; then
# http://git.altlinux.org/gears/N/NAME.git
REPOPATH="$(initial_letter $PKGNAME)/$PKGNAME.git"
RREPO="/gears/$REPOPATH"
# FIXME: use get_girar_repo?
# FIXME: use giter print girar repo?
# TODO: check appropriate repo with exist_git_repo
if [ -z "$MIGRATEGIRAR" ] ; then
if ! git_clone $RREPO ; then
......@@ -322,7 +322,7 @@ if [ -n "$CLONEGIT" ] ; then
fi
else
[ -z "$PUBLICACCESS" ] || fatal "Can't remote clone via public access"
RREPO=$(get_girar_repo $PKGNAME) || fatal "$PKGNAME does not exists in $GIRARHOST:/gears, nor in $GIRARHOST:/srpms. Can't clone."
RREPO=$(giter print girar repo $PKGNAME) || fatal "$PKGNAME does not exists in $GIRARHOST:/gears, nor in $GIRARHOST:/srpms. Can't clone."
echo "Remote clone from $RREPO ..."
docmd ssh $GIRARHOST clone $RREPO packages/$PKGNAME.git || warning "Can't remote clone."
......@@ -399,7 +399,7 @@ if [ -n "$CHECKONLINE" ] ; then
if [ -n "$GIRAR_USER" ] ; then
# FIXME: we have a function to get correct url
GITURL="http://git.altlinux.org/people/$GIRAR_USER/packages/$PKGNAME.git"
GITURL="$GIRARURL/people/$GIRAR_USER/packages/$PKGNAME.git"
if $GET -d $GITURL ; then
echog "Published at $GITURL by $GIRAR_USER"
else
......
#!/bin/bash
# 2013 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
load_mod repos
# Is allow connect with ssh to the GIRARHOST server?
has_ssh_girar_access()
{
ssh $GIRARHOST help >/dev/null 2>&1
}
check_http_status()
{
a= curl -s -I "$1" | grep HTTP | grep -q "200 OK"
}
# Returns true if repo with path from first arg is exits on the remote GIRARHOST server
is_exist_git_repo()
{
if has_ssh_girar_access ; then
ssh $GIRARHOST ls $1 >/dev/null 2>&1 && return
fi
# TODO: this is workaround for ALT bug #22745
# https://bugzilla.altlinux.org/show_bug.cgi?id=22745
check_http_status $(get_git_url $GIRARHOST)$1
}
# get gear repo for package name
get_girar_repo()
{
assert_var GIRARHOST
local PKGNAME="$1"
# http://git.altlinux.org/gears/N/NAME.git
local REPOPATH="$(initial_letter $PKGNAME)/$PKGNAME.git"
local RREPO="/gears/$REPOPATH"
if ! is_exist_git_repo $RREPO ; then
RREPO="/srpms/$REPOPATH"
is_exist_git_repo $RREPO || return
fi
echo "$RREPO"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment