first attempt for https://svn.planet-lab.org/ticket/342
Thierry Parmentelat [Thu, 3 Jul 2008 21:03:40 +0000 (21:03 +0000)]
PlanetLabConf/f8/yum.conf [new file with mode: 0644]
PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo.in [new file with mode: 0644]
PlanetLabConf/f8/yum.myplc.d/fedora.repo.in [new file with mode: 0644]
PlanetLabConf/myplc.repo.php [new file with mode: 0644]
PlanetLabConf/yum.conf.php [deleted file]
nodeconfig.spec

diff --git a/PlanetLabConf/f8/yum.conf b/PlanetLabConf/f8/yum.conf
new file mode 100644 (file)
index 0000000..a0fd6b4
--- /dev/null
@@ -0,0 +1,10 @@
+[main]
+cachedir=/var/cache/yum
+reposdir=/etc/yum.myplc.d
+debuglevel=1
+logfile=/var/log/log
+lockfile=/var/lock/yum.pid
+pkgpolicy=newest
+distroverpkg=fedora-release
+installonlypkgs=
+exactarch=0
diff --git a/PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo.in b/PlanetLabConf/f8/yum.myplc.d/fedora-updates.repo.in
new file mode 100644 (file)
index 0000000..36da33a
--- /dev/null
@@ -0,0 +1,27 @@
+[updates]
+name=Fedora $releasever - $basearch - Updates
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-f$releasever&arch=$basearch
+@EXCLUDE@
+enabled=1
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
+
+[updates-debuginfo]
+name=Fedora $releasever - $basearch - Updates - Debug
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/$basearch/debug/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-debug-f$releasever&arch=$basearch
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
+
+[updates-source]
+name=Fedora $releasever - Updates Source
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/updates/$releasever/SRPMS/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=updates-released-source-f$releasever&arch=$basearch
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora
diff --git a/PlanetLabConf/f8/yum.myplc.d/fedora.repo.in b/PlanetLabConf/f8/yum.myplc.d/fedora.repo.in
new file mode 100644 (file)
index 0000000..4e77fbd
--- /dev/null
@@ -0,0 +1,27 @@
+[fedora]
+name=Fedora $releasever - $basearch
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-$releasever&arch=$basearch
+@EXCLUDE@
+enabled=1
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
+
+[fedora-debuginfo]
+name=Fedora $releasever - $basearch - Debug
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/$basearch/debug/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-debug-$releasever&arch=$basearch
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
+
+[fedora-source]
+name=Fedora $releasever - Source
+failovermethod=priority
+#baseurl=http://download.fedora.redhat.com/pub/fedora/linux/releases/$releasever/Everything/source/SRPMS/
+mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-source-$releasever&arch=$basearch
+enabled=0
+gpgcheck=1
+gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora file:///etc/pki/rpm-gpg/RPM-GPG-KEY
diff --git a/PlanetLabConf/myplc.repo.php b/PlanetLabConf/myplc.repo.php
new file mode 100644 (file)
index 0000000..b0d2960
--- /dev/null
@@ -0,0 +1,99 @@
+<?php
+//
+// part of yum config on nodes
+//
+// Thierry Parmentelat 
+// Copyright (C) 2008 INRIA
+//
+// $Id: yum.conf.php 9688 2008-06-25 08:24:27Z thierry $
+//
+
+// For PLC_NAME and PLC_BOOT_HOST
+include('plc_config.php');
+
+$PLC_NAME = PLC_NAME;
+$PLC_BOOT_HOST = PLC_BOOT_HOST;
+
+// Get admin API handle
+require_once 'plc_api.php';
+global $adm;
+
+if (isset($_REQUEST['gpgcheck'])) {
+  $gpgcheck = $_REQUEST['gpgcheck'];
+} else {
+  $gpgcheck = 0;
+}
+
+# get node family
+if ( ! isset($_REQUEST['slicefamily'])) {
+  # legacy : use the old naming scheme
+  $nodefamily="planetlab";
+  $pldistro="planetlab";
+ } else {
+  $slicefamily = $_REQUEST['slicefamily'];
+  echo "# slicefamily $slicefamily \n" ;
+  list( $pldistro, $fcdistro, $arch) = split ("-", $slicefamily);
+  $nodefamily = "$pldistro-$arch";
+  echo "# nodefamily $nodefamily \n" ;
+ }
+
+# the nodegroups the node is part of
+$nodegroup_names=array();
+
+if ( ! isset($_REQUEST['node_id'])) {
+  print "# Warning : node_id not set\n";
+ } else {
+  $node_id=intval($_REQUEST['node_id']);
+  echo "# node_id $node_id \n";
+  # compute nodegroups
+  $nodes = $adm->GetNodes(array('node_id'=>$node_id));
+  $nodegroup_ids = $nodes[0]['nodegroup_ids'];
+  $nodegroups = $adm->GetNodeGroups($nodegroup_ids);
+  foreach ($nodegroups as $nodegroup) {
+    $nodegroup_name = $nodegroup['name'];
+    $nodegroup_names [] = $nodegroup_name;
+    echo "# in nodegroup $nodegroup_name \n" ;
+  }
+ }
+
+$topdir=$_SERVER['DOCUMENT_ROOT'] . "/install-rpms/";
+$topurl="https://$PLC_BOOT_HOST" . "/install-rpms/";
+
+
+# locate the planetlab repo for this node family & nodegroup
+$repo=NULL;
+foreach ($nodegroup_names as $nodegroup_name) {
+  $groupdir = "$nodefamily-$nodegroup_name";
+  # have we got a repo like /install-rpms/planetlab-i386-alpha ?
+  echo "# trying " . $topdir . $groupdir . "\n";
+  if (is_dir (realpath($topdir . $groupdir))) {
+    $repo=array($pldistro, $groupdir, "$PLC_NAME $nodefamily $nodegroup_name");
+    break;
+  }
+}
+
+# if not found yet
+if ( ! $repo) {
+  echo "# trying default " . $topdir . $nodefamily . "\n";
+  if (is_dir (realpath($topdir . $nodefamily))) {
+    $repo = array($pldistro, $nodefamily, "$PLC_NAME $nodefamily regular");
+  }
+ }
+
+# default: if we're here it's probably very wrong
+if ( ! $repo) {
+  echo "# WARNING: could not find a decent planetlab repo for this node\n";
+  $repo = array ($pldistro, "planetlab", "default probably wrong");
+ }
+
+list( $id, $dir, $name) = $repo;
+
+echo <<< __PLC_REPO__
+[$id]
+name=$name
+baseurl=$topurl/$dir
+gpgcheck=$gpgcheck
+
+__PLC_REPO__;
+
+?>
diff --git a/PlanetLabConf/yum.conf.php b/PlanetLabConf/yum.conf.php
deleted file mode 100755 (executable)
index 40671b2..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
-<?php
-//
-// /etc/yum.conf for production nodes
-//
-// Mark Huang <mlhuang@cs.princeton.edu>
-// Copyright (C) 2004-2006 The Trustees of Princeton University
-//
-// $Id$
-//
-
-// For PLC_NAME and PLC_BOOT_HOST
-include('plc_config.php');
-
-$PLC_NAME = PLC_NAME;
-$PLC_BOOT_HOST = PLC_BOOT_HOST;
-
-////////////////////////////// mirror list
-
-// Requesting a mirror list. Yum bombs out completely if a repository
-// is (even temporarily) unavailable, so if CoBlitz is down, provide a
-// few more options. Make sure that gpgcheck remains enabled.  Last
-// chance option is ourselves so that yum never fails.
-if (isset($_REQUEST['mirrorlist']) &&
-    isset($_REQUEST['repo']) &&
-    isset($_REQUEST['releasever'])) {
-  $mirrors = array("http://coblitz.codeen.org/coblitz.planet-lab.org/pub/fedora/linux",
-                  "http://fedora.gtlib.cc.gatech.edu/pub/fedora.redhat/linux",
-                  "http://download.fedoraproject.org/pub/fedora/linux",
-                  "http://mirrors.kernel.org/fedora");
-                  #"ftp://rpmfind.net/linux/fedora",  still uses the old style of directory hierarchy
-  $releasever = $_REQUEST['releasever'];
-  switch ($_REQUEST['repo']) {
-  case "base":
-       if ( intval($releasever) >= 7 )
-       {
-               foreach ($mirrors as $mirror) {
-                 echo "$mirror/releases/$releasever/Everything/\$ARCH/os/\n";
-               }
-
-       } else {
-               foreach ($mirrors as $mirror) {
-                 echo "$mirror/core/$releasever/\$ARCH/os/\n";
-               }
-       }
-    break;
-  case "updates":
-       if ( intval($releasever) >= 7 )
-       {
-               foreach ($mirrors as $mirror) {
-                 echo "$mirror/updates/$releasever/\$ARCH/\n";
-               }
-
-       } else {
-               foreach ($mirrors as $mirror) {
-                 echo "$mirror/core/updates/$releasever/\$ARCH/\n";
-               }
-       }
-    break;
-  }
-
-  // Always list ourselves last
-  echo "https://$PLC_BOOT_HOST/install-rpms/planetlab/\n";
-  exit;
-}
-
-////////////////////////////// plain yum.conf 
-
-// Get admin API handle
-require_once 'plc_api.php';
-global $adm;
-
-// Requesting yum.conf. See above for the mirrorlist definition.
-
-if (isset($_REQUEST['gpgcheck'])) {
-  $gpgcheck = $_REQUEST['gpgcheck'];
-} else {
-  $gpgcheck = 0;
-}
-
-// fedora stock : base & updates 
-
-echo <<<__STD_REPOS__
-[main]
-# Do not scan /etc/yum.repos.d/
-reposdir=/dev/null
-cachedir=/var/cache/yum
-debuglevel=2
-logfile=/var/log/yum.log
-pkgpolicy=newest
-gpgcheck=$gpgcheck
-
-[base]
-name=Fedora Core \$releasever - \$basearch - Base
-mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=base&releasever=\$releasever
-gpgcheck=$gpgcheck
-# PlanetLab builds its own versions of these tools
-exclude=kernel* iptables iproute
-
-[updates]
-name=Fedora Core \$releasever - \$basearch - Released Updates
-mirrorlist=https://$PLC_BOOT_HOST/PlanetLabConf/yum.conf.php?mirrorlist&repo=updates&releasever=\$releasever
-gpgcheck=$gpgcheck
-# PlanetLab builds its own versions of these tools
-exclude=kernel* iptables iproute
-
-__STD_REPOS__;
-
-echo "\n";
-
-# get node family
-if ( ! isset($_REQUEST['slicefamily'])) {
-  # legacy : use the old naming scheme
-  $nodefamily="planetlab";
-  $pldistro="planetlab";
- } else {
-  $slicefamily = $_REQUEST['slicefamily'];
-  echo "# slicefamily $slicefamily \n" ;
-  list( $pldistro, $fcdistro, $arch) = split ("-", $slicefamily);
-  $nodefamily = "$pldistro-$arch";
-  echo "# nodefamily $nodefamily \n" ;
- }
-
-# the nodegroups the node is part of
-$nodegroup_names=array();
-
-if ( ! isset($_REQUEST['node_id'])) {
-  print "# Warning : node_id not set\n";
- } else {
-  $node_id=intval($_REQUEST['node_id']);
-  echo "# node_id $node_id \n";
-  # compute nodegroups
-  $nodes = $adm->GetNodes(array('node_id'=>$node_id));
-  $nodegroup_ids = $nodes[0]['nodegroup_ids'];
-  $nodegroups = $adm->GetNodeGroups($nodegroup_ids);
-  foreach ($nodegroups as $nodegroup) {
-    $nodegroup_name = $nodegroup['name'];
-    $nodegroup_names [] = $nodegroup_name;
-    echo "# in nodegroup $nodegroup_name \n" ;
-  }
- }
-
-$topdir=$_SERVER['DOCUMENT_ROOT'] . "/install-rpms/";
-$topurl="https://$PLC_BOOT_HOST" . "/install-rpms/";
-
-
-# locate the planetlab repo for this node family & nodegroup
-$repo=NULL;
-foreach ($nodegroup_names as $nodegroup_name) {
-  $groupdir = "$nodefamily-$nodegroup_name";
-  # have we got a repo like /install-rpms/planetlab-i386-alpha ?
-  echo "# trying " . $topdir . $groupdir . "\n";
-  if (is_dir (realpath($topdir . $groupdir))) {
-    $repo=array($pldistro, $groupdir, "$PLC_NAME $nodefamily $nodegroup_name");
-    break;
-  }
-}
-
-# if not found yet
-if ( ! $repo) {
-  echo "# trying default " . $topdir . $nodefamily . "\n";
-  if (is_dir (realpath($topdir . $nodefamily))) {
-    $repo = array($pldistro, $nodefamily, "$PLC_NAME $nodefamily regular");
-  }
- }
-
-# default: if we're here it's probably very wrong
-if ( ! $repo) {
-  echo "# WARNING: could not find a decent planetlab repo for this node\n";
-  $repo = array ($pldistro, "planetlab", "default probably wrong");
- }
-
-list( $id, $dir, $name) = $repo;
-
-echo <<< __PLC_REPO__
-[$id]
-name=$name
-baseurl=$topurl/$dir
-gpgcheck=$gpgcheck
-__PLC_REPO__;
-
-#################### I guess this might go to trash, but just in case:
-# mention if exist: install-rpms/planetlab-i386-3rdparty 
-$optional_repos = array (array ('ThirdParty', '3rdparty','Third Party RPMS'));
-
-foreach ($optional_repos as $repo) {
-  list( $id, $dir, $name) = $repo;
-  if (is_dir (realpath($topdir . $dir))) {
-    echo <<< __OPT_REPO__
-[$id]
-name=$name
-baseurl=$topurl/$dir
-gpgcheck=$gpgcheck
-__OPT_REPO__;
-
-  }
-}
-
-?>
index a7ff4cb..93e1d7d 100644 (file)
@@ -40,8 +40,11 @@ reasons these scripts get installed in /var/www/html/PlanetLabConf.
 %setup -q
 
 %build
-echo "There is no build stage for this component."
-echo "All files just need to be installed as is from the codebase."
+EXCLUDE="exclude=kernel* iptables iproute util-vserver*"
+for filein in $(find . -name '*.in') ; do
+    file=$(echo $filein | sed -e "s,\.in$,,")
+    sed -e "s,@EXCLUDE@,$EXCLUDE,g" $filein > $file
+done
 
 %install
 rm -rf $RPM_BUILD_ROOT
@@ -52,7 +55,7 @@ for dir in boot PlanetLabConf PLCAPI ; do
     mkdir -p $RPM_BUILD_ROOT/var/www/html/$dir
 done
 # let's be conservative and exclude codebase files, though there should not be any
-rsync -a --exclude \*.spec --exclude .svn --exclude CVS ./ $RPM_BUILD_ROOT/var/www/html/
+rsync -a --exclude \*.spec --exclude .svn --exclude \*.in ./ $RPM_BUILD_ROOT/var/www/html/
 
 %clean
 rm -rf $RPM_BUILD_ROOT