summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Di Luigi2015-09-02 21:53:15 +0200
committerWilliam Di Luigi2015-09-02 22:07:46 +0200
commit045a0e29f13121d20f8a230cd2932b29e3f2bd6c (patch)
tree0577620380bed29e58e4bcc8be5a8eb2d28a14af
parent45b8345f0b027230ffeffc853b6f8cde3174176f (diff)
downloadaur-045a0e29f13121d20f8a230cd2932b29e3f2bd6c.tar.gz
Update package
-rw-r--r--.SRCINFO30
-rw-r--r--PKGBUILD88
-rw-r--r--cms-git.install49
-rw-r--r--cms.patch224
4 files changed, 118 insertions, 273 deletions
diff --git a/.SRCINFO b/.SRCINFO
index aa3401e0b5da..3ea8b01afc32 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,43 +1,27 @@
+# Generated by makepkg 4.2.1
+# Wed Sep 2 19:51:52 UTC 2015
pkgbase = cms-git
pkgdesc = CMS, or Contest Management System, is a distributed system for running and (to some extent) organizing a programming contest.
- pkgver = 1.3.0
- pkgrel = 2
+ pkgver = r3151.608a8e4
+ pkgrel = 1
url = http://cms-dev.github.io/
+ install = cms-git.install
arch = any
license = AGPL3
makedepends = git
+ makedepends = python-virtualenv
+ depends = isolate
depends = postgresql
depends = postgresql-libs
depends = python2
- depends = python2-setuptools
- depends = python2-tornado
- depends = python2-psycopg2
- depends = python2-sqlalchemy
- depends = python2-psutil
- depends = python2-netifaces
- depends = python2-crypto
- depends = python2-pytz
- depends = python2-six
depends = iso-codes
depends = shared-mime-info
- depends = python2-beautifulsoup3
- depends = python2-mechanize
- depends = python2-mock
- depends = python2-requests
- depends = python2-werkzeug
- depends = python2-gevent
- depends = python2-coverage
- depends = libcgroup
- depends = patool-py2
optdepends = fpc: support for Pascal submissions
optdepends = sgi-stl-doc: support for STL documentation inside the contest
- optdepends = python2-yaml: support for cmsMake (for tasks in the "italian format")
provides = cms
conflicts = cms
source = git://github.com/cms-dev/cms.git
- source = cms.patch
sha256sums = SKIP
- sha256sums = edb4e5c5da138a4598d1c728e9e02041fcb0acfdb84911ba9aeefb85488fb323
pkgname = cms-git
diff --git a/PKGBUILD b/PKGBUILD
index 8df5fbdd702f..92c16c84270a 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,53 +1,89 @@
# Maintainer: William Di Luigi <williamdiluigi@gmail.com>
-#
-# https://github.com/wil93/aur/tree/master/cms-git
+
+# chosen at random
+CMSUSER_GID=26950
pkgname=cms-git
-pkgver=1.3.0
-pkgrel=2
+pkgver=r3151.608a8e4
+pkgrel=1
pkgdesc="CMS, or Contest Management System, is a distributed system for running and (to some extent) organizing a programming contest."
arch=('any')
url="http://cms-dev.github.io/"
license=('AGPL3')
depends=(
- 'postgresql' 'postgresql-libs' 'python2' 'python2-setuptools'
- 'python2-tornado' 'python2-psycopg2' 'python2-sqlalchemy' 'python2-psutil'
- 'python2-netifaces' 'python2-crypto' 'python2-pytz' 'python2-six'
- 'iso-codes' 'shared-mime-info' 'python2-beautifulsoup3' 'python2-mechanize'
- 'python2-mock' 'python2-requests' 'python2-werkzeug' 'python2-gevent'
- 'python2-coverage' 'libcgroup' 'patool-py2'
+ 'isolate' 'postgresql' 'postgresql-libs' 'python2' 'iso-codes' 'shared-mime-info'
)
optdepends=(
'fpc: support for Pascal submissions'
'sgi-stl-doc: support for STL documentation inside the contest'
- 'python2-yaml: support for cmsMake (for tasks in the "italian format")'
)
-makedepends=('git')
+makedepends=(
+ 'git'
+ 'python-virtualenv'
+)
provides=('cms')
conflicts=('cms')
+install=$pkgname.install
source=(
'git://github.com/cms-dev/cms.git'
- 'cms.patch'
)
sha256sums=(
'SKIP'
- 'edb4e5c5da138a4598d1c728e9e02041fcb0acfdb84911ba9aeefb85488fb323'
)
-prepare() {
- cd "cms"
- patch -p1 -i $srcdir/cms.patch
- sed "s|MAKEPKG_INSTALL_ROOT|$pkgdir|g" -i setup.py
-}
-
-build() {
- cd "cms"
- git submodule update --init
- python2 setup.py build
+pkgver() {
+ cd cms
+ printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
package() {
- cd "cms"
- python2 setup.py install --prefix="/usr" --root="$pkgdir"
+ cd cms
+
+ # Configuration files
+ install -D -m660 -g$CMSUSER_GID config/cms.conf.sample $pkgdir/usr/lib/cms/cms.conf
+ install -D -m660 -g$CMSUSER_GID config/cms.ranking.conf.sample $pkgdir/usr/lib/cms/cms.ranking.conf
+
+ # Logs and cache directories
+ install -d -m770 -g$CMSUSER_GID $pkgdir/var/log/cms
+ install -d -m770 -g$CMSUSER_GID $pkgdir/var/cache/cms
+
+ # I'm not even sure if this is needed at all
+ install -d -m770 -g$CMSUSER_GID $pkgdir/var/lib/cms
+
+ # testlib.h
+ install -D -m644 cmscontrib/loaders/polygon/testlib.h $pkgdir/usr/include/cms/testlib.h
+
+ # Prepare virtual environment
+ virtualenv -p python2 $pkgdir/usr/lib/cms/venv
+ source $pkgdir/usr/lib/cms/venv/bin/activate
+ pip install -r requirements.txt
+
+ # Install the cms python package
+ python setup.py install
+
+ # This will hopefully go away with https://github.com/cms-dev/cms/issues/281
+ install -d $pkgdir/usr/bin
+ for cmd in \
+ cmsContestWebServer cmsResourceService cmsScoringService cmsDropDB \
+ cmsPrintingService cmsInitDB cmsAdminWebServer cmsWorker cmsChecker \
+ cmsEvaluationService cmsProxyService cmsRankingWebServer cmsLogService \
+ cmsSpoolExporter cmsTestFileCacher cmsAdaptContest cmsAddTask cmsMake \
+ cmsYamlImporter cmsRunTests cmsRWSHelper cmsRemoveTask cmsAddUser \
+ cmsContestExporter cmsDumpUpdater cmsDumpExporter cmsYamlReimporter \
+ cmsContestImporter cmsAddContest cmsComputeComplexity cmsRemoveUser \
+ cmsDumpImporter cmsReplayContest
+ do
+ ln -s /usr/lib/cms/venv/bin/$cmd $pkgdir/usr/bin/$cmd
+ done
+
+ # The following will also go away eventually (I hope :/)
+ install -d $pkgdir/var/local/log
+ install -d $pkgdir/var/local/cache
+ install -d $pkgdir/var/local/lib
+ install -d $pkgdir/var/local/run
+ ln -s /var/log/cms $pkgdir/var/local/log/cms
+ ln -s /var/cache/cms $pkgdir/var/local/cache/cms
+ ln -s /var/lib/cms $pkgdir/var/local/lib/cms
+ ln -s /var/run/cms $pkgdir/var/local/run/cms
}
diff --git a/cms-git.install b/cms-git.install
new file mode 100644
index 000000000000..db764e9e8a85
--- /dev/null
+++ b/cms-git.install
@@ -0,0 +1,49 @@
+# chosen at random
+CMSUSER_GID=26950
+CMSUSER_UID=$CMSUSER_GID
+
+post_install() {
+ # Not sure if this is really needed
+ mkdir /var/run/cms
+
+ # Copy configuration files, if they don't already exist
+ cp --archive --no-clobber /usr/lib/cms/cms{,.ranking}.conf /etc/
+
+ echo
+ if ! getent group cmsuser >/dev/null; then
+ groupadd -g$CMSUSER_GID cmsuser
+ fi
+ if ! getent passwd cmsuser >/dev/null; then
+ useradd -u$CMSUSER_UID -g$CMSUSER_GID cmsuser -c 'CMS default user' -M -r -s /bin/false
+ fi
+
+ echo ">>> !! WARNING !!"
+ echo ">>> For now, it is required that you add yourself to the cmsuser group,"
+ echo ">>> for example by issuing this command:"
+ echo ">>> # usermod -a -G cmsuser <your user>"
+ echo ">>> Logout to make the change effective. Also, remember to customize"
+ echo ">>> the configuration files /etc/cms.conf and /etc/cms.ranking.conf."
+ echo
+}
+
+post_upgrade() {
+ post_install $1
+}
+
+post_remove() {
+ echo
+ echo ">>> !! WARNING !!"
+ echo ">>> We won't delete the cmsuser user (nor the group), in case you should"
+ echo ">>> need them for some reason. If you really don't need CMS anymore, then"
+ echo ">>> you can issue:"
+ echo ">>> # userdel -r cmsuser"
+ echo ">>> (ignore the error 'group not removed because it has other members')"
+ echo ">>> And then run:"
+ echo ">>> # groupdel cmsuser"
+ echo ">>> in order to delete the group (and remove every user from it)"
+ echo ">>>"
+ echo ">>> Also, if you want to delete the configuration files, then you can"
+ echo ">>> issue this command:"
+ echo ">>> # rm /etc/cms{,.ranking}.conf"
+ echo
+}
diff --git a/cms.patch b/cms.patch
deleted file mode 100644
index d85392f27cf2..000000000000
--- a/cms.patch
+++ /dev/null
@@ -1,224 +0,0 @@
-diff --git a/README.md b/README.md
-index 3c5833d..4258339 100644
---- a/README.md
-+++ b/README.md
-@@ -57,8 +57,8 @@ proposals and critics, get opinions and reviews, etc.) is
- [github](https://github.com/cms-dev/cms/issues) instead.**
-
- To help with the troubleshooting, you can collect the complete log
--files that are placed in /var/local/log/cms/ (if CMS was running
--installed) or in ./log (if it was running from the local copy).
-+files that are placed in /var/log/cms/ (if CMS was running installed) or
-+in ./log (if it was running from the local copy).
-
-
- Testimonials
-diff --git a/cms/conf.py b/cms/conf.py
-index bf6446c..65535ba 100644
---- a/cms/conf.py
-+++ b/cms/conf.py
-@@ -127,12 +127,11 @@ class Config(object):
- sys.argv[0] != '/usr/bin/python'
-
- if self.installed:
-- self.log_dir = os.path.join("/", "var", "local", "log", "cms")
-- self.cache_dir = os.path.join("/", "var", "local", "cache", "cms")
-- self.data_dir = os.path.join("/", "var", "local", "lib", "cms")
-- self.run_dir = os.path.join("/", "var", "local", "run", "cms")
-- paths = [os.path.join("/", "usr", "local", "etc", "cms.conf"),
-- os.path.join("/", "etc", "cms.conf")]
-+ self.log_dir = os.path.join("/", "var", "log", "cms")
-+ self.cache_dir = os.path.join("/", "var", "cache", "cms")
-+ self.data_dir = os.path.join("/", "var", "lib", "cms")
-+ self.run_dir = os.path.join("/", "var", "run", "cms")
-+ paths = [os.path.join("/", "etc", "cms.conf")]
- else:
- self.log_dir = "log"
- self.cache_dir = "cache"
-@@ -143,8 +142,7 @@ class Config(object):
- paths += [os.path.abspath(os.path.join(
- os.path.dirname(__file__),
- '..', 'config', 'cms.conf'))]
-- paths += [os.path.join("/", "usr", "local", "etc", "cms.conf"),
-- os.path.join("/", "etc", "cms.conf")]
-+ paths += [os.path.join("/", "etc", "cms.conf")]
-
- # Allow user to override config file path using environment
- # variable 'CMS_CONFIG'.
-diff --git a/cms/server/AdminWebServer.py b/cms/server/AdminWebServer.py
-index 470eaf1..05f0b75 100644
---- a/cms/server/AdminWebServer.py
-+++ b/cms/server/AdminWebServer.py
-@@ -207,8 +207,7 @@ class BaseHandler(CommonRequestHandler):
- self.contest = None
-
- if config.installed:
-- localization_dir = os.path.join("/", "usr", "local", "share",
-- "locale")
-+ localization_dir = os.path.join("/", "usr", "share", "locale")
- else:
- localization_dir = os.path.join(os.path.dirname(__file__), "mo")
- if os.path.exists(localization_dir):
-diff --git a/cms/server/ContestWebServer.py b/cms/server/ContestWebServer.py
-index 122f55d..bea0001 100644
---- a/cms/server/ContestWebServer.py
-+++ b/cms/server/ContestWebServer.py
-@@ -440,7 +440,7 @@ class ContestWebServer(WebService):
- # Retrieve the available translations.
- if config.installed:
- self.localization_dir = os.path.join(
-- "/", "usr", "local", "share", "locale")
-+ "/", "usr", "share", "locale")
- else:
- self.localization_dir = os.path.join(
- os.path.dirname(__file__), "mo")
-diff --git a/cmscontrib/PolygonLoader.py b/cmscontrib/PolygonLoader.py
-index 76c668d..f79606d 100644
---- a/cmscontrib/PolygonLoader.py
-+++ b/cmscontrib/PolygonLoader.py
-@@ -330,7 +330,7 @@ class PolygonLoader(Loader):
- if os.path.exists(checker_src):
- logger.info("Checker found, compiling")
- checker_exe = os.path.join(task_path, "files", "checker")
-- testlib_path = "/usr/local/include/cms/testlib.h"
-+ testlib_path = "/usr/include/cms/testlib.h"
- if not config.installed:
- testlib_path = os.path.join(os.path.dirname(__file__),
- "polygon", "testlib.h")
-diff --git a/cmsranking/Config.py b/cmsranking/Config.py
-index 02f80b6..72432d9 100644
---- a/cmsranking/Config.py
-+++ b/cmsranking/Config.py
-@@ -60,19 +60,13 @@ class Config(object):
-
- self.web_dir = pkg_resources.resource_filename("cmsranking", "static")
- if self.installed:
-- self.log_dir = os.path.join("/", "var", "local", "log",
-- "cms", "ranking")
-- self.lib_dir = os.path.join("/", "var", "local", "lib",
-- "cms", "ranking")
-- paths = [os.path.join("/", "usr", "local", "etc",
-- "cms.ranking.conf"),
-- os.path.join("/", "etc", "cms.ranking.conf")]
-+ self.log_dir = os.path.join("/", "var", "log", "cms", "ranking")
-+ self.lib_dir = os.path.join("/", "var", "lib", "cms", "ranking")
-+ paths = [os.path.join("/", "etc", "cms.ranking.conf")]
- else:
- self.log_dir = os.path.join("log", "ranking")
- self.lib_dir = os.path.join("lib", "ranking")
- paths = [os.path.join(".", "config", "cms.ranking.conf"),
-- os.path.join("/", "usr", "local", "etc",
-- "cms.ranking.conf"),
- os.path.join("/", "etc", "cms.ranking.conf")]
-
- try:
-diff --git a/cmstestsuite/RunFunctionalTests.py b/cmstestsuite/RunFunctionalTests.py
-index 349fbf3..6e2975c 100755
---- a/cmstestsuite/RunFunctionalTests.py
-+++ b/cmstestsuite/RunFunctionalTests.py
-@@ -421,7 +421,7 @@ def main():
- CONFIG["TEST_DIR"] = git_root
- CONFIG["CONFIG_PATH"] = "%s/config/cms.conf" % CONFIG["TEST_DIR"]
- if CONFIG["TEST_DIR"] is None:
-- CONFIG["CONFIG_PATH"] = "/usr/local/etc/cms.conf"
-+ CONFIG["CONFIG_PATH"] = "/etc/cms.conf"
- cms_config = get_cms_config()
-
- if not config_is_usable(cms_config):
-diff --git a/cmstestsuite/RunUnitTests.py b/cmstestsuite/RunUnitTests.py
-index b1d4249..c8df039 100755
---- a/cmstestsuite/RunUnitTests.py
-+++ b/cmstestsuite/RunUnitTests.py
-@@ -185,7 +185,7 @@ def main():
- CONFIG["TEST_DIR"] = git_root
- CONFIG["CONFIG_PATH"] = "%s/config/cms.conf" % CONFIG["TEST_DIR"]
- if CONFIG["TEST_DIR"] is None:
-- CONFIG["CONFIG_PATH"] = "/usr/local/etc/cms.conf"
-+ CONFIG["CONFIG_PATH"] = "/etc/cms.conf"
-
- if CONFIG["TEST_DIR"] is not None:
- # Set up our expected environment.
-diff --git a/docs/Internals.rst b/docs/Internals.rst
-index 5ee50ce..0acb587 100644
---- a/docs/Internals.rst
-+++ b/docs/Internals.rst
-@@ -65,8 +65,8 @@ Setting the ``backdoor`` configuration key to true causes services to
- serve a Python console (accessible with netcat), running in the same
- interpreter instance as the service, allowing to inspect and modify its
- data, live. It will be bound to a local UNIX domain socket, usually at
--:file:`/var/local/run/cms/{service}_{shard}`. Access is granted only to
--users belonging to the cmsuser group.
-+:file:`/var/run/cms/{service}_{shard}`. Access is granted only to users
-+belonging to the cmsuser group.
- Although there's no authentication mechanism to prevent unauthorized
- access, the restrictions on the file should make it safe to run the
- backdoor everywhere, even on workers that are used as contestants'
-@@ -76,7 +76,7 @@ following is a complete working connection command:
-
- .. sourcecode:: bash
-
-- rlwrap netcat -U /var/local/run/cms/EvaluationService_0
-+ rlwrap netcat -U /var/run/cms/EvaluationService_0
-
- Substitute ``netcat`` with your implementation (``nc``, ``ncat``, etc.)
- if needed.
-diff --git a/docs/RankingWebServer.rst b/docs/RankingWebServer.rst
-index bcc3762..e24fcc0 100644
---- a/docs/RankingWebServer.rst
-+++ b/docs/RankingWebServer.rst
-@@ -48,7 +48,7 @@ You also need to make sure that RWS is able to keep enough simultaneously active
- Managing it
- ===========
-
--RWS doesn't use the PostgreSQL database. Instead, it stores its data in :file:`/var/local/lib/cms/ranking` (or whatever directory is given as ``lib_dir`` in the configuration file) as a collection of JSON files. Thus, if you want to backup the RWS data, just make a copy of that directory. RWS modifies this data in response to specific (authenticated) HTTP requests it receives.
-+RWS doesn't use the PostgreSQL database. Instead, it stores its data in :file:`/var/lib/cms/ranking` (or whatever directory is given as ``lib_dir`` in the configuration file) as a collection of JSON files. Thus, if you want to backup the RWS data, just make a copy of that directory. RWS modifies this data in response to specific (authenticated) HTTP requests it receives.
-
- The intended way to get data to RWS is to have the rest of CMS send it. The service responsible for that is ProxyService (PS for short). When PS is started for a certain contest, it will send the data for that contest to all RWSs it knows about (i.e. those in its configuration). This data includes the contest itself (its name, its begin and end times, etc.), its tasks, its users and the submissions received so far. Then it will continue to send new submissions as soon as they are scored and it will update them as needed (for example when a user uses a token). Note that hidden users (and their submissions) will not be sent to RWS.
-
-diff --git a/setup.py b/setup.py
-index da5a67d..db78e5c 100755
---- a/setup.py
-+++ b/setup.py
-@@ -42,8 +42,10 @@ from setuptools import setup
-
-
- # Root directories for the /usr and /var trees.
--USR_ROOT = os.path.join("/", "usr", "local")
--VAR_ROOT = os.path.join("/", "var", "local")
-+ROOT = "MAKEPKG_INSTALL_ROOT"
-+USR_ROOT = os.path.join(ROOT, "usr")
-+VAR_ROOT = os.path.join(ROOT, "var")
-+ETC_ROOT = os.path.join(ROOT, "etc")
-
-
- def do_setup():
-@@ -279,16 +281,16 @@ def install():
- root = pwd.getpwnam("root")
- cmsuser_grp = grp.getgrnam("cmsuser")
-
-- print("copying isolate to /usr/local/bin/.")
-+ print("copying isolate to /usr/bin/.")
- makedir(os.path.join(USR_ROOT, "bin"), root, 0755)
- copyfile(os.path.join(".", "isolate", "isolate"),
- os.path.join(USR_ROOT, "bin", "isolate"),
- root, 04750, group=cmsuser_grp)
-
-- print("copying configuration to /usr/local/etc/.")
-- makedir(os.path.join(USR_ROOT, "etc"), root, 0755)
-+ print("copying configuration to /etc/.")
-+ makedir(ETC_ROOT, root, 0755)
- for conf_file_name in ["cms.conf", "cms.ranking.conf"]:
-- conf_file = os.path.join(USR_ROOT, "etc", conf_file_name)
-+ conf_file = os.path.join(ETC_ROOT, conf_file_name)
- # Skip if destination is a symlink
- if os.path.islink(conf_file):
- continue
-@@ -316,7 +318,7 @@ def install():
- dirs = [os.path.join(VAR_ROOT, "log"),
- os.path.join(VAR_ROOT, "cache"),
- os.path.join(VAR_ROOT, "lib"),
-- os.path.join(VAR_ROOT, "run"),
-+ os.path.join(ROOT, "run"), # On Archlinux /var/run is a symlink to /run
- os.path.join(USR_ROOT, "include"),
- os.path.join(USR_ROOT, "share")]
- for _dir in dirs: