update PDUs list
[ktest-util.git] / vzt-vzlist2quilt
blob6ed8ef7a66cb85bb5028ba8e464a32425cdeaef7
1 #! /bin/bash
3 function show_usage
5 echo "Create plain patch list from list-XXX and XXX.spec"
6 echo "Usage: -d|--patch_dir Virtuozzo/kernel-patches/<PATCH_DIR> "
7 echo " -s|--spec_file <SPEC_FILE>"
8 echo " -l|--list listname script will it as list-<LIST_NAME>"
9 echo " -r|--revision kernel-ve cvs revision tag"
10 echo " -c make local copy for patches"
11 echo " -u make cvs update before."
12 exit
14 . /etc/vzt-cvs.cfg
15 update=0
16 local_copy=0
17 while [ $# -gt 0 ]; do
18 case "$1" in
19 -h|--help)
20 show_usage
21 exit
23 -u)
24 update=1
26 -d|--patch_dir)
27 patch_dir=$2
28 shift
30 -r|--revision)
31 revision=$2
32 shift
34 -l|--list)
35 list=$2
36 shift
38 -s|--spec)
39 spec=$2
40 shift
42 -c|--copy)
43 local_copy=1
46 show_usage
47 break
49 esac
50 shift
51 done
53 . guilt
54 if [ -z "$list" ]; then
55 echo "list not defined"
56 exit
59 if [ -z "$spec" ]; then
60 echo "spec not defined"
61 exit
63 if [ -z "$revision" ]; then
64 echo "revision not defined"
65 exit
68 if [ -z "$patch_dir" ]; then
69 echo "patch_dir not defined"
70 exit
72 echo "list: $list"
73 echo "spec: $spec"
74 echo "revision: $revision"
75 echo "patch_dir: $patch_dir"
78 function update_cvs {
79 local vzcvsroot=$1
80 local patch_dir=$2
81 local revision=$3
82 local cwd=`pwd`
83 cd $vzcvsroot
84 cvs up kernel-patches/$patch_dir
85 cvs up kernel-ve/kernel-ve
86 cd $cwd
89 function update_makefile_version
91 lnum=$1
92 if [ ! -f "$GUILT_DIR/$branch/series" ]; then
93 die "$GUILT_DIR/$branch/series does not exist. Aborting."
96 echo "Fixing uname"
97 cp Makefile Makefile.vers
98 sed -e "s/\\(^EXTRAVERSION =\\)[^\$]*\$/\\1 -${lnum//-shadow/}/" \
99 -e "s/\\(^EXTRAVERSION =\\) [^\$]\\+\\$/\\1 -${lnum//-shadow/}-\$/" \
100 Makefile.vers > Makefile
102 git-diff Makefile > diff-update-uname-to-$lnum
103 git-checkout Makefile
104 mv diff-update-uname-to-$lnum $GUILT_DIR/$branch || exit
105 echo diff-update-uname-to-$lnum >> $GUILT_DIR/$branch/series
108 function make_quilt_tree {
109 list=$1
110 spec=$2
111 local_copy=$3
113 if [ ! -f "$GUILT_DIR/$branch/series" ]; then
114 die "$GUILT_DIR/$branch/series does not exist. Aborting."
116 if [ ! -f "$list" ]; then
117 echo "No such list $list_file"
118 exit
121 if [ ! -f "$spec" ]; then
122 echo "No such spec $spec_file"
123 exit
125 vzt-show-list -l $list -s $spec -p . > $GUILT_DIR/$branch/series.tmp || exit
127 ln -s `dirname $list` $GUILT_DIR/$branch/patches
128 ln -s `dirname $spec` $GUILT_DIR/$branch/vzmod
129 if [ $local_copy == 1 ]; then
130 cp -r $GUILT_DIR/$branch/patches/ $GUILT_DIR/$branch/patches.copy/
131 cp -r $GUILT_DIR/$branch/vzmod/ $GUILT_DIR/$branch/vzmod.copy/
133 mv $GUILT_DIR/$branch/series.tmp $GUILT_DIR/$branch/series || exit
134 echo "OK"
136 if [ $update == 1 ]; then
137 update_cvs $VZCVSROOT $patch_dir $revision
140 #update_makefile_version $list-partial
141 make_quilt_tree $VZCVSROOT/kernel-patches/$patch_dir/list-$list \
142 $VZCVSROOT/kernel-ve/kernel-ve/$spec.spec $local_copy
143 #update_makefile_version $list