forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ib-rotate-weeks
executable file
·36 lines (32 loc) · 1.55 KB
/
ib-rotate-weeks
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/sh -ex
[ -f ib-weeks ] || exit 1
ARCHITECTURE=slc6_amd64_gcc530
# We use %U rather than %W because the groovy macros expect
# weeks to start on sunday, not monday.
CURRENT_WEEK=$(echo "`date +%U` + 1" | bc)
CURRENT_WEEK_LETTER=$(echo "$CURRENT_WEEK % 3" | bc | tr 012 ABC )
CURRENT_WEEK_NUMBER=$(echo "$CURRENT_WEEK % 2" | bc)
WEEK_NO=`date +%Y`-$CURRENT_WEEK
WEEK_FOUND=`grep "^$WEEK_NO\$" ib-weeks | wc -l`
if [ "X$WEEK_FOUND" = "X0" ] ; then
rm -rf dummybuild
mkdir dummybuild
pushd dummybuild
git clone git://github.com/cms-sw/cmsdist.git CMSDIST || git clone https://:@git.cern.ch/kerberos/CMSDIST.git CMSDIST
git clone git://github.com/cms-sw/pkgtools.git PKGTOOLS || git clone https://:@git.cern.ch/kerberos/PKGTOOLS.git PKGTOOLS
echo -e "### RPM cms dummy `date +%s`\n## NOCOMPILER\nSource: none\n%prep\n%build\n%install\n" > CMSDIST/dummy.spec
PKGTOOLS/cmsBuild --debug --repository cms --architecture $ARCHITECTURE --work-dir w build dummy
PKGTOOLS/cmsBuild --debug --repository cms --upload-tmp-repository $CMS_REPOSITORY --architecture $ARCHITECTURE --work-dir w upload dummy
popd
rm -rf dummybuild
echo "$WEEK_NO" >> ib-weeks
git commit -m "Added new ib-week $WEEK_NO" ib-weeks
git pull --rebase
git push origin
echo "ARCHITECTURE=${ARCHITECTURE}" > cvmfs-reset-week
echo "REPOSITORY=cms.${CMS_REPOSITORY}" >> cvmfs-reset-week
echo "RELEASE_FORMAT=" >> cvmfs-reset-week
echo "CMSDIST_HASH=" >> cvmfs-reset-week
cd /afs/cern.ch/cms/sw/ReleaseCandidates
ln -sfT vol$CURRENT_WEEK_LETTER vol$CURRENT_WEEK_NUMBER
fi