launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25943
[Merge] ~cjwatson/launchpad:remove-cscvs into launchpad:master
Colin Watson has proposed merging ~cjwatson/launchpad:remove-cscvs into launchpad:master.
Commit message:
Remove cscvs
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
Related bugs:
Bug #1016334 in Launchpad itself: "cscvs is in sourcecode"
https://bugs.launchpad.net/launchpad/+bug/1016334
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad/+git/launchpad/+merge/395856
Now that lp.codehosting.codeimport has been split out to a separate lp-codeimport project, the only remaining use of cscvs in the main Launchpad tree was to validate CVSROOTs. This isn't worth the fairly significant build system complexity it incurs, and it's an obstacle to running on Python 3, so just inline a cleaned-up version of the relatively small amount of parsing code involved instead.
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~cjwatson/launchpad:remove-cscvs into launchpad:master.
diff --git a/Makefile b/Makefile
index 8d9c527..fd2d794 100644
--- a/Makefile
+++ b/Makefile
@@ -300,10 +300,6 @@ $(subst $(PY),,$(PIP_BIN)): $(PY)
# a prerequisite, to make sure it's up to date when doing deployments.
compile: $(PY)
${SHHH} utilities/relocate-virtualenv env
- if grep -q '^2\.' env/python_version; then \
- ${SHHH} $(MAKE) -C sourcecode build \
- PYTHON=${PYTHON} LPCONFIG=${LPCONFIG}; \
- fi
$(PYTHON) utilities/link-system-packages.py \
"$(SITE_PACKAGES)" system-packages.txt
${SHHH} bin/build-twisted-plugin-cache
diff --git a/lib/CVS b/lib/CVS
deleted file mode 120000
index 36fe982..0000000
--- a/lib/CVS
+++ /dev/null
@@ -1 +0,0 @@
-../sourcecode/cscvs/modules/CVS
\ No newline at end of file
diff --git a/lib/SCM b/lib/SCM
deleted file mode 120000
index ee0d57a..0000000
--- a/lib/SCM
+++ /dev/null
@@ -1 +0,0 @@
-../sourcecode/cscvs/modules/SCM
\ No newline at end of file
diff --git a/lib/cscvs b/lib/cscvs
deleted file mode 120000
index 004f806..0000000
--- a/lib/cscvs
+++ /dev/null
@@ -1 +0,0 @@
-../sourcecode/cscvs/modules/cscvs/
\ No newline at end of file
diff --git a/lib/lp/code/interfaces/codeimport.py b/lib/lp/code/interfaces/codeimport.py
index 534be78..3e4113e 100644
--- a/lib/lp/code/interfaces/codeimport.py
+++ b/lib/lp/code/interfaces/codeimport.py
@@ -47,22 +47,58 @@ from lp.services.fields import (
)
+# CVSROOT parsing based on cscvs.
+
+class CVSRootError(Exception):
+ """Raised when trying to use a CVSROOT with invalid syntax."""
+
+ def __init__(self, root):
+ super(CVSRootError, self).__init__(self, 'bad CVSROOT: %r' % root)
+
+
+_cvs_root_parser = re.compile(r"""
+ ^:(?P<method>[^:]+):
+ (?:
+ (?:
+ (?P<username>[^:/]+)
+ (?::(?P<password>[^:/]+))?
+ @)?
+ (?P<hostname>[^:/]+)
+ (?::(?P<port>\\d+))?
+ :?)?
+ (?P<path>/.*)$
+ """, flags=re.X)
+
+
+def _normalise_cvs_root(root):
+ """Take in a CVSROOT and normalise it to the :scheme:.... format."""
+ root = str(root)
+ if not root:
+ raise CVSRootError(root)
+ if root.startswith(":"):
+ return root
+ if root.startswith("/"):
+ return ":local:%s" % root
+ if ":" not in root:
+ if '/' not in root:
+ raise CVSRootError(root)
+ root = "%s:%s" % (root[:root.find("/")-1], root[root.find("/"):])
+ return ":ext:%s" % root
+
+
def validate_cvs_root(cvsroot):
- # XXX cjwatson 2020-08-12: Move these imports back up to the top level
- # once they work on Python 3.
- from CVS.protocol import (
- CVSRoot,
- CvsRootError,
- )
try:
- root = CVSRoot(cvsroot)
- except CvsRootError as e:
+ match = _cvs_root_parser.match(_normalise_cvs_root(cvsroot))
+ if match is None:
+ raise CVSRootError(cvsroot)
+ method, username, password, hostname, port, path = match.groups()
+ except CVSRootError as e:
raise LaunchpadValidationError(e)
- if root.method == 'local':
+ if method == 'local':
raise LaunchpadValidationError('Local CVS roots are not allowed.')
- if not root.hostname:
+ if not hostname:
raise LaunchpadValidationError('CVS root is invalid.')
- if root.hostname.count('.') == 0:
+ if hostname.count('.') == 0:
raise LaunchpadValidationError(
'Please use a fully qualified host name.')
return True
diff --git a/lib/svn_oo b/lib/svn_oo
deleted file mode 120000
index 8f22695..0000000
--- a/lib/svn_oo
+++ /dev/null
@@ -1 +0,0 @@
-../sourcecode/cscvs/modules/svn_oo/
\ No newline at end of file
diff --git a/sourcecode/Makefile b/sourcecode/Makefile
deleted file mode 100644
index 5813935..0000000
--- a/sourcecode/Makefile
+++ /dev/null
@@ -1,32 +0,0 @@
-PYTHON=python
-# Not all packages have a working Makefile. Work around this by hardcoding
-# the ones we test. If we fix them all to have EITHER a good makefile
-# (build and check targets work), or no makefile we can reenable auto
-# detection.
-build_dirs:=cscvs
-test_dirs:=cscvs
-
-TEST_ENV_VARS = PYTHON=$(PYTHON)
-
-all:
-
-check: build
- @ for subdir in ${test_dirs}; do \
- $(MAKE) -C $$subdir check $(TEST_ENV_VARS) || exit $$?;\
- done
-
-build:
- @ for subdir in ${build_dirs}; do\
- if [ -e $$subdir/Makefile ]; then\
- $(MAKE) -C $$subdir $(TEST_ENV_VARS) || exit $$?;\
- fi;\
- done
-
-clean:
- @ for subdir in ${build_dirs}; do\
- if [ -e $$subdir/Makefile ]; then\
- (cd $$subdir && bzr clean-tree --ignored --force) || exit $$?;\
- fi;\
- done
-
-.PHONY: check all build clean
diff --git a/system-packages.txt b/system-packages.txt
index 11a6f29..84a8548 100644
--- a/system-packages.txt
+++ b/system-packages.txt
@@ -27,7 +27,3 @@ convoy
# lp.services.fields, lp.services.spriteutils
PIL
-
-# Dependency of cscvs.
-sqlite; python_version < "3"
-_sqlite; python_version < "3"
diff --git a/utilities/sourcedeps.cache b/utilities/sourcedeps.cache
index 99f67fb..0742b7f 100644
--- a/utilities/sourcedeps.cache
+++ b/utilities/sourcedeps.cache
@@ -7,10 +7,6 @@
166,
"jelmer@xxxxxxxxx-20190822193925-ydrq7fgdi78lpgm7"
],
- "cscvs": [
- 433,
- "launchpad@xxxxxxxxxxxxxxxxx-20130816043319-bts3l3bckmx431q1"
- ],
"difftacular": [
11,
"cjwatson@xxxxxxxxxxxxx-20190614154330-091l9edcnubsjmsx"
diff --git a/utilities/sourcedeps.conf b/utilities/sourcedeps.conf
index 7755ec7..7fb29f1 100644
--- a/utilities/sourcedeps.conf
+++ b/utilities/sourcedeps.conf
@@ -9,6 +9,5 @@
brz-builder lp:~jelmer/brz-builder/trunk;revno=183
brz-loom lp:~jelmer/brz-loom/trunk;revno=166
-cscvs lp:~launchpad-pqm/launchpad-cscvs/devel;revno=433
difftacular lp:~launchpad/difftacular/trunk;revno=11
loggerhead lp:~loggerhead-team/loggerhead/trunk-rich;revno=511