Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 3b013547e9
Fetching contributors…

Cannot retrieve contributors at this time

executable file 107 lines (90 sloc) 3.121 kB
#!/bin/bash
# A script to help manage the openSUSE:Tumbleweed project
# (C) 2010 Greg Kroah-Hartman <gregkh@suse.de>
# Released under the GPL v2.
#
# This script checks the links that are set up for a single Tumbleweed package.
# Tumbleweed works either by having packages submitted to it, or by linking to
# a "known stable" repository in the build service. This script checks the
# repo and package name requested on the command line and verifies that they
# are up to date. If they are not up to date, the proper 'osc' command is
# printed to output to be run by hand if necessary.
#
# If the package is not in the Tumbleweed repo, the proper 'osc' command
# to add it is printed out if you wish to run it.
#
# Any questions/comments/patches are gladly welcome, just send to:
# Greg Kroah-Hartman <gregkh@suse.de>
#
# Main Tumbleweed repository location
TUMBLE_REPO="openSUSE:Tumbleweed"
# some other repos we like to use for stuff
TESTING_REPO="openSUSE:Tumbleweed:Testing"
GNOME_REPO="openSUSE:Tumbleweed:GNOME"
KDE_REPO="openSUSE:Tumbleweed:KDE"
XFCE_REPO="openSUSE:Tumbleweed:xfce"
# expects:
# $PACKAGE to be set to the package name to be checked
# $REPO to be set to the base repo name
compare_version() {
# BASE_LINK=`osc log --csv $REPO/$PACKAGE 2> /dev/null | head -n 1 | cut -f 4 -d '|'`
BASE_LINK=`osc api /source/${REPO}/${PACKAGE}?expand=1 | sed -n 's@^.*directory.*srcmd5="\([0-9a-f]*\)".*$@\1@ p'`
#echo $BASE_LINK
if [ "$BASE_LINK" = "" ]
then
echo "# There is no such package as $REPO/$PACKAGE."
exit 1
fi
#TUMBLE_LINK=`osc cat $TUMBLE_REPO/$PACKAGE/_link 2> /dev/null | grep rev | cut -f 4 -d ' ' | cut -f 2 -d '=' | cut -f 1 -d '=' | sed -e 's/\"//g'`
TUMBLE_LINK=`osc cat $TUMBLE_REPO/$PACKAGE/_link 2> /dev/null | sed -n 's@^.*package.*rev="\([0-9a-f]*\)".*$@\1@ p'`
#echo $TUMBLE_LINK
if [ "$TUMBLE_LINK" = "" ]
then
EXIST=`osc ls $TUMBLE_REPO | grep "^${PACKAGE}$"`
if [ "$EXIST" = "" ]
then
echo "# $PACKAGE is not in $TUMBLE_REPO, add it by doing:"
echo "osc linkpac -f -r $BASE_LINK $REPO $PACKAGE $TUMBLE_REPO"
else
echo "# $PACKAGE is not a linked package in $TUMBLE_REPO, to overwrite the link, do:"
fi
fi
if [ "$BASE_LINK" = "$TUMBLE_LINK" ]
then
echo "# $PACKAGE is up to date."
else
#echo "osc linkpac -f -r $BASE_LINK $REPO $PACKAGE $TUMBLE_REPO"
echo "osc setlinkrev -r $BASE_LINK $TUMBLE_REPO $PACKAGE"
fi
}
#FULL_PACKAGE=$1
if [ $# -lt 1 ]; then
echo -e "Usage:\t $0 repo/packagename\ne.g.\t $0 Kernel:stable/kernel-source"
exit 1
fi
while [ "$1" != "" ]; do
case $1 in
--repo ) shift
TUMBLE_REPO=$1
;;
--kde ) TUMBLE_REPO=$KDE_REPO
;;
--gnome ) TUMBLE_REPO=$GNOME_REPO
;;
--xfce ) TUMBLE_REPO=$XFCE_REPO
;;
--testing ) TUMBLE_REPO=$TESTING_REPO
;;
* ) FULL_PACKAGE=$1
;;
esac
shift
done
#echo "# TUMBLE_REPO = '$TUMBLE_REPO'"
#echo "# FULL_PACKAGE = '$FULL_PACKAGE'"
# I'm sure that bash regex can do this better, but hey, this works...
REPO=`echo $FULL_PACKAGE | cut -f 1 -d '/'`
PACKAGE=`echo $FULL_PACKAGE | cut -f 2 -d '/'`
#echo $REPO
#echo $PACKAGE
compare_version
Jump to Line
Something went wrong with that request. Please try again.