summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJon Gjengset2015-07-07 17:55:48 -0400
committerJon Gjengset2015-07-07 17:55:48 -0400
commitf4abfa3ba3555b8f262628d5976562ffbcb4c145 (patch)
treede5c91023bd4358d65e072a0519142739f5fd273
downloadaur-f4abfa3ba3555b8f262628d5976562ffbcb4c145.tar.gz
First import
-rw-r--r--.SRCINFO16
-rw-r--r--.gitignore3
-rw-r--r--PKGBUILD20
-rw-r--r--add-cpuset-prefix.patch148
4 files changed, 187 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO
new file mode 100644
index 000000000000..708afdf6f89d
--- /dev/null
+++ b/.SRCINFO
@@ -0,0 +1,16 @@
+pkgbase = cpuset
+ pkgdesc = Cpuset is a Python application to make using the cpusets facilities in the Linux kernel easier.
+ pkgver = 1.5.6
+ pkgrel = 1
+ url = https://code.google.com/p/cpuset/
+ arch = any
+ license = GPL2
+ depends = python2
+ options = !emptydirs
+ source = https://cpuset.googlecode.com/files/cpuset-1.5.6.tar.gz
+ source = add-cpuset-prefix.patch
+ md5sums = 50a0251c31990bb4ad63312e356ffcb5
+ md5sums = f262662dbf0d3bb40aa652a9d06e82b4
+
+pkgname = cpuset
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000000..4f752c559aa4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+src/
+pkg/
+*.xz
diff --git a/PKGBUILD b/PKGBUILD
new file mode 100644
index 000000000000..500b679dcf98
--- /dev/null
+++ b/PKGBUILD
@@ -0,0 +1,20 @@
+# Maintainer: Jon Gjengset <jon@thesquareplanet.com>
+pkgname=cpuset
+pkgver=1.5.6
+pkgrel=1
+pkgdesc="Cpuset is a Python application to make using the cpusets facilities in the Linux kernel easier."
+arch=('any')
+url="https://code.google.com/p/cpuset/"
+license=('GPL2')
+depends=('python2')
+options=('!emptydirs')
+source=("https://cpuset.googlecode.com/files/cpuset-1.5.6.tar.gz"
+ "add-cpuset-prefix.patch")
+md5sums=('50a0251c31990bb4ad63312e356ffcb5'
+ 'f262662dbf0d3bb40aa652a9d06e82b4')
+
+package() {
+ cd "$srcdir/$pkgname-$pkgver"
+ patch -Np1 -i "$srcdir/add-cpuset-prefix.patch"
+ python2 setup.py install --root="$pkgdir/" --optimize=1
+}
diff --git a/add-cpuset-prefix.patch b/add-cpuset-prefix.patch
new file mode 100644
index 000000000000..ba79915d2d5c
--- /dev/null
+++ b/add-cpuset-prefix.patch
@@ -0,0 +1,148 @@
+--- a/cpuset/cset.py 2010-08-01 16:19:49.000000000 -0400
++++ b/cpuset/cset.py 2015-07-07 17:53:05.712530891 -0400
+@@ -32,10 +32,13 @@
+ class CpuSet(object):
+ # sets is a class variable dict that keeps track of all
+ # cpusets discovered such that we can link them in properly.
+- # The basepath is it's base path, the sets are indexed via
++ # The basepath is its base path, the sets are indexed via
+ # a relative path from this basepath.
++ # prefix can be empty or 'cpuset.' in case the filesystem
++ # has its own namespace
+ sets = {}
+ basepath = ''
++ prefix = ''
+
+ def __init__(self, path=None):
+ log.debug("initializing CpuSet")
+@@ -47,7 +50,16 @@
+ log.debug("finding all cpusets")
+ path = self.locate_cpusets()
+ CpuSet.basepath = path
+- log.debug("creating root node at %s", path)
++ if not os.access(path + '/cpus', os.F_OK):
++ log.debug(path + "/cpus doesn't exist, trying to add the cpuset. prefix")
++ CpuSet.prefix = 'cpuset.'
++ if not os.access(path + '/cpuset.cpus', os.F_OK):
++ # definitely not a cpuset directory
++ str = '%s is not a cpuset directory' % (path)
++ log.error(str)
++ raise CpusetException(str)
++
++ log.debug("creating root node at %s with prefix '%s'", path, CpuSet.prefix)
+ self.__root = True
+ self.name = 'root'
+ self.path = '/'
+@@ -56,6 +68,7 @@
+ del CpuSet.sets
+ CpuSet.sets = {}
+ CpuSet.sets[self.path] = self
++
+ # bottom-up search otherwise links will not exist
+ log.debug("starting bottom-up discovery walk...")
+ for dir, dirs, files in os.walk(path, topdown=False):
+@@ -104,12 +117,18 @@
+ log.debug("the cpuset %s already exists, skipping", path)
+ self = CpuSet.sets[path] # questionable....
+ return
+- cpus = CpuSet.basepath + path + "/cpus"
++ cpus = CpuSet.basepath + path + '/' + CpuSet.prefix + "cpus"
+ if not os.access(cpus, os.F_OK):
+- # not a cpuset directory
+- str = '%s is not a cpuset directory' % (CpuSet.basepath + path)
+- log.error(str)
+- raise CpusetException(str)
++ log.debug(cpus + " doesn't exist, trying to add the cpuset. prefix")
++ CpuSet.prefix = 'cpuset.'
++ cpus = CpuSet.basepath + path + '/' + CpuSet.prefix + "cpus"
++ if not os.access(cpus, os.F_OK):
++ # definitely not a cpuset directory
++ str = '%s is not a cpuset directory' % (CpuSet.basepath + path)
++ log.error(str)
++ raise CpusetException(str)
++ else:
++ log.debug(cpus + " successfully found")
+ self.__root = False
+ self.read_cpuset(path)
+ CpuSet.sets[path] = self
+@@ -158,36 +177,36 @@
+ raise AttributeError, "deletion of properties not allowed"
+
+ def getcpus(self):
+- f = file(CpuSet.basepath+self.path+"/cpus")
++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"cpus")
+ return f.readline()[:-1]
+ def setcpus(self, newval):
+ cpuspec_check(newval)
+- f = file(CpuSet.basepath+self.path+"/cpus",'w')
++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"cpus",'w')
+ f.write(str(newval))
+ f.close()
+ log.debug("-> prop_set %s.cpus = %s", self.path, newval)
+ cpus = property(fget=getcpus, fset=setcpus, fdel=delprop, doc="CPU specifier")
+
+ def getmems(self):
+- f = file(CpuSet.basepath+self.path+"/mems")
++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"mems")
+ return f.readline()[:-1]
+ def setmems(self, newval):
+ # FIXME: check format for correctness
+- f = file(CpuSet.basepath+self.path+"/mems",'w')
++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"mems",'w')
+ f.write(str(newval))
+ f.close()
+ log.debug("-> prop_set %s.mems = %s", self.path, newval)
+ mems = property(getmems, setmems, delprop, "Mem node specifier")
+
+ def getcpuxlsv(self):
+- f = file(CpuSet.basepath+self.path+"/cpu_exclusive")
++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"cpu_exclusive")
+ if f.readline()[:-1] == '1':
+ return True
+ else:
+ return False
+ def setcpuxlsv(self, newval):
+ log.debug("-> prop_set %s.cpu_exclusive = %s", self.path, newval)
+- f = file(CpuSet.basepath+self.path+"/cpu_exclusive",'w')
++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"cpu_exclusive",'w')
+ if newval:
+ f.write('1')
+ else:
+@@ -197,14 +216,14 @@
+ "CPU exclusive flag")
+
+ def getmemxlsv(self):
+- f = file(CpuSet.basepath+self.path+"/mem_exclusive")
++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"mem_exclusive")
+ if f.readline()[:-1] == '1':
+ return True
+ else:
+ return False
+ def setmemxlsv(self, newval):
+ log.debug("-> prop_set %s.mem_exclusive = %s", self.path, newval)
+- f = file(CpuSet.basepath+self.path+"/mem_exclusive",'w')
++ f = file(CpuSet.basepath+self.path+'/'+CpuSet.prefix+"mem_exclusive",'w')
+ if newval:
+ f.write('1')
+ else:
+@@ -214,6 +233,7 @@
+ "Memory exclusive flag")
+
+ def gettasks(self):
++ # 'tasks' never seem to have a possible 'cpusets.' prefix
+ f = file(CpuSet.basepath+self.path+"/tasks")
+ lst = []
+ for task in f: lst.append(task[:-1])
+@@ -229,6 +249,7 @@
+ prog = False
+ for task in tasklist:
+ try:
++ # 'tasks' never seem to have a possible 'cpusets.' prefix
+ f = file(CpuSet.basepath+self.path+"/tasks",'w')
+ f.write(task)
+ f.close()
+@@ -513,4 +534,3 @@
+ print 'Found "cantfindmenoway??!? -> ', node
+ except CpusetException, err:
+ print 'Caught exeption for non-existant set (correctly)-> ', err
+-