forked from cms-sw/cms-bot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathib-rotate-weeks
executable file
·28 lines (23 loc) · 1.27 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
#!/bin/sh -ex
ARCHITECTURE=slc6_amd64_gcc491
REPO_FILE_DIR=/afs/cern.ch/cms/sw/ReleaseCandidates/reset-repo-info
# We use %U rather than %W because the groovy macros expect
# weeks to start on sunday, not monday.
mkdir -p $REPO_FILE_DIR
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)
REPO_FILE=$REPO_FILE_DIR/`date +%Y`-$CURRENT_WEEK
if [ ! -f $REPO_FILE ]; then
mkdir -p $WORKSPACE/reset-repo
cd $WORKSPACE/reset-repo
rm -rf CMSDIST PKGTOOLS w
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
cd /afs/cern.ch/cms/sw/ReleaseCandidates
ln -sfT vol$CURRENT_WEEK_LETTER vol$CURRENT_WEEK_NUMBER
touch $REPO_FILE
fi