Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100755 107 lines (90 sloc) 3.121 kB
cc6df46 @gregkh added check_package
authored
1 #!/bin/bash
2
3 # A script to help manage the openSUSE:Tumbleweed project
4 # (C) 2010 Greg Kroah-Hartman <gregkh@suse.de>
5 # Released under the GPL v2.
6 #
11881ec @gregkh fix scripts to handle packages that are not in the repo better
authored
7 # This script checks the links that are set up for a single Tumbleweed package.
8 # Tumbleweed works either by having packages submitted to it, or by linking to
9 # a "known stable" repository in the build service. This script checks the
10 # repo and package name requested on the command line and verifies that they
11 # are up to date. If they are not up to date, the proper 'osc' command is
12 # printed to output to be run by hand if necessary.
cc6df46 @gregkh added check_package
authored
13 #
11881ec @gregkh fix scripts to handle packages that are not in the repo better
authored
14 # If the package is not in the Tumbleweed repo, the proper 'osc' command
15 # to add it is printed out if you wish to run it.
cc6df46 @gregkh added check_package
authored
16 #
17 # Any questions/comments/patches are gladly welcome, just send to:
18 # Greg Kroah-Hartman <gregkh@suse.de>
19 #
20
21 # Main Tumbleweed repository location
22 TUMBLE_REPO="openSUSE:Tumbleweed"
23
c17674a @gregkh check_package: add repo command line options
authored
24 # some other repos we like to use for stuff
25 TESTING_REPO="openSUSE:Tumbleweed:Testing"
26 GNOME_REPO="openSUSE:Tumbleweed:GNOME"
27 KDE_REPO="openSUSE:Tumbleweed:KDE"
cdbd418 added xfce repo
Greg KH authored
28 XFCE_REPO="openSUSE:Tumbleweed:xfce"
cc6df46 @gregkh added check_package
authored
29
30 # expects:
31 # $PACKAGE to be set to the package name to be checked
32 # $REPO to be set to the base repo name
33 compare_version() {
34
bc291bf @gregkh check_package: use the source link instead for packages
authored
35 # BASE_LINK=`osc log --csv $REPO/$PACKAGE 2> /dev/null | head -n 1 | cut -f 4 -d '|'`
36 BASE_LINK=`osc api /source/${REPO}/${PACKAGE}?expand=1 | sed -n 's@^.*directory.*srcmd5="\([0-9a-f]*\)".*$@\1@ p'`
37 #echo $BASE_LINK
cc6df46 @gregkh added check_package
authored
38
139ec24 @gregkh check_package: handle when projects are not present or are not links
authored
39 if [ "$BASE_LINK" = "" ]
40 then
b966f04 @gregkh check_package: proper comment the "There is no package" line
authored
41 echo "# There is no such package as $REPO/$PACKAGE."
139ec24 @gregkh check_package: handle when projects are not present or are not links
authored
42 exit 1
43 fi
cc6df46 @gregkh added check_package
authored
44
bc291bf @gregkh check_package: use the source link instead for packages
authored
45 #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'`
46 TUMBLE_LINK=`osc cat $TUMBLE_REPO/$PACKAGE/_link 2> /dev/null | sed -n 's@^.*package.*rev="\([0-9a-f]*\)".*$@\1@ p'`
9b511c6 @gregkh speed up check_package by about a second per call for the common case.
authored
47 #echo $TUMBLE_LINK
48 if [ "$TUMBLE_LINK" = "" ]
11881ec @gregkh fix scripts to handle packages that are not in the repo better
authored
49 then
1cb2d40 @gregkh check_package: fix 'osc ls' check
authored
50 EXIST=`osc ls $TUMBLE_REPO | grep "^${PACKAGE}$"`
9b511c6 @gregkh speed up check_package by about a second per call for the common case.
authored
51 if [ "$EXIST" = "" ]
139ec24 @gregkh check_package: handle when projects are not present or are not links
authored
52 then
9b511c6 @gregkh speed up check_package by about a second per call for the common case.
authored
53 echo "# $PACKAGE is not in $TUMBLE_REPO, add it by doing:"
bc291bf @gregkh check_package: use the source link instead for packages
authored
54 echo "osc linkpac -f -r $BASE_LINK $REPO $PACKAGE $TUMBLE_REPO"
9b511c6 @gregkh speed up check_package by about a second per call for the common case.
authored
55 else
56 echo "# $PACKAGE is not a linked package in $TUMBLE_REPO, to overwrite the link, do:"
139ec24 @gregkh check_package: handle when projects are not present or are not links
authored
57 fi
11881ec @gregkh fix scripts to handle packages that are not in the repo better
authored
58 fi
59
139ec24 @gregkh check_package: handle when projects are not present or are not links
authored
60 if [ "$BASE_LINK" = "$TUMBLE_LINK" ]
cc6df46 @gregkh added check_package
authored
61 then
62 echo "# $PACKAGE is up to date."
63 else
bc291bf @gregkh check_package: use the source link instead for packages
authored
64 #echo "osc linkpac -f -r $BASE_LINK $REPO $PACKAGE $TUMBLE_REPO"
65 echo "osc setlinkrev -r $BASE_LINK $TUMBLE_REPO $PACKAGE"
cc6df46 @gregkh added check_package
authored
66 fi
67 }
68
c17674a @gregkh check_package: add repo command line options
authored
69
70 #FULL_PACKAGE=$1
71
72 if [ $# -lt 1 ]; then
cc6df46 @gregkh added check_package
authored
73 echo -e "Usage:\t $0 repo/packagename\ne.g.\t $0 Kernel:stable/kernel-source"
74 exit 1
75 fi
76
c17674a @gregkh check_package: add repo command line options
authored
77 while [ "$1" != "" ]; do
78 case $1 in
79 --repo ) shift
80 TUMBLE_REPO=$1
81 ;;
82 --kde ) TUMBLE_REPO=$KDE_REPO
83 ;;
84 --gnome ) TUMBLE_REPO=$GNOME_REPO
85 ;;
cdbd418 added xfce repo
Greg KH authored
86 --xfce ) TUMBLE_REPO=$XFCE_REPO
87 ;;
c17674a @gregkh check_package: add repo command line options
authored
88 --testing ) TUMBLE_REPO=$TESTING_REPO
89 ;;
90 * ) FULL_PACKAGE=$1
91 ;;
92 esac
93 shift
94 done
95
96 #echo "# TUMBLE_REPO = '$TUMBLE_REPO'"
97 #echo "# FULL_PACKAGE = '$FULL_PACKAGE'"
cc6df46 @gregkh added check_package
authored
98
99
100 # I'm sure that bash regex can do this better, but hey, this works...
101 REPO=`echo $FULL_PACKAGE | cut -f 1 -d '/'`
102 PACKAGE=`echo $FULL_PACKAGE | cut -f 2 -d '/'`
103 #echo $REPO
104 #echo $PACKAGE
105
106 compare_version
Something went wrong with that request. Please try again.