Commit ffdb139b authored by Eric Timmons's avatar Eric Timmons
Browse files

Rename epoch to releases-object-version

parent ce7d0264
......@@ -86,8 +86,8 @@ the secondary.
+ =:maintainers= :: A list of person descriptions as described in [[*Person
Description]].
+ =:homepage= :: A string containing the URL of the project's homepage.
+ =:epoch= :: An integer or NIL/missing whose purpose is further described in
[[*Project releases]].
+ =:releases-object-version= :: An integer or NIL/missing whose purpose is
further described in [[*Project releases]].
+ =:version-scheme= :: A keyword describing how this project versions its
releases. =:date= implies a date based version that is comparable with
=#'string<=. =:semantic= implies version numbers that are compatible with
......@@ -96,10 +96,10 @@ the secondary.
* Project releases
For every project in the index, the object =project/PROJECT-NAME/releases= or
=projects/PROJECT-NAME/releases-EPOCH= must exist, where =PROJECT-NAME= is
the URL-encoded project name and =EPOCH= is the epoch defined in the project
metadata. If the epoch is NIL/not provided, only the former must exist,
otherwise the latter must exist.
=projects/PROJECT-NAME/releases-RELEASES-OBJECT-VERSION= must exist, where
=PROJECT-NAME= is the URL-encoded project name and =RELEASES-OBJECT-VERSION=
is defined in the project metadata. If the release object version is NIL/not
provided, only the former must exist, otherwise the latter must exist.
This object contains information about each release of the project. Every
sexp must be of the form: =(version . release-plist)=, where =version= is a
......
......@@ -76,17 +76,17 @@
(dolist (p (index-projects index))
(let ((dirty-p (project-dirty-p p))
(appendable-p (project-changes-appendable-p p))
(epoch (project-epoch p)))
(releases-object-version (project-releases-object-version p)))
(when dirty-p
(when (and epoch (not appendable-p))
(incf (project-epoch p)))
(when (and releases-object-version (not appendable-p))
(incf (project-releases-object-version p)))
(let ((pn (merge-pathnames (project-releases-path p) (file-index-root index))))
(ensure-directories-exist pn)
(with-open-file (s pn
:direction :output
:if-exists (if appendable-p :append :supersede)
:if-does-not-exist :create)
(if (and appendable-p epoch)
(if (and appendable-p releases-object-version)
(project-write-changes-to-stream p s)
(project-write-to-stream p s)))))
(when (metadata-dirty-p (metadata p))
......
......@@ -10,7 +10,7 @@
#:project-changes-appendable-p
#:project-commit-new-releases-to-stream!
#:project-dirty-p
#:project-epoch
#:project-releases-object-version
#:project-index-plist
#:project-load-releases-from-stream!
#:project-missing-version
......@@ -66,9 +66,9 @@ appended to the existing object."))
"Returns a boolean indicating if the project has changes that can be
committed to the backing objects."))
(defgeneric project-epoch (project)
(defgeneric project-releases-object-version (project)
(:documentation
"Return the current epoch of the PROJECT."))
"Return the current releases-object-version of the PROJECT."))
(defgeneric project-index-plist (project)
(:documentation
......
......@@ -48,7 +48,7 @@ instantiated."))
(defmethod initialize-instance :after ((project project)
&key releases backing-objects-exist-p
version-scheme epoch
version-scheme releases-object-version
&allow-other-keys)
(let ((release-ht (make-hash-table :test 'equal)))
(dolist (r releases)
......@@ -58,8 +58,8 @@ instantiated."))
(setf (project-release-data-read-p project) t))
(when version-scheme
(setf (project-version-scheme project) version-scheme))
(when epoch
(setf (project-epoch project) epoch)))
(when releases-object-version
(setf (project-releases-object-version project) releases-object-version)))
(defmethod index-project-class (index)
"Register this as the default project class."
......@@ -85,11 +85,11 @@ instantiated."))
(defmethod project-dirty-p ((project project))
(project-deltas project))
(defmethod project-epoch ((project project))
(metadata-value project :epoch))
(defmethod project-releases-object-version ((project project))
(metadata-value project :releases-object-version))
(defmethod (setf project-epoch) (new-value (project project))
(setf (metadata-value project :epoch) new-value))
(defmethod (setf project-releases-object-version) (new-value (project project))
(setf (metadata-value project :releases-object-version) new-value))
(defmethod project-index-plist ((project project))
(let ((out)
......@@ -137,10 +137,10 @@ instantiated."))
(mapcar (curry #'project-release project) (project-versions project)))
(defmethod project-releases-path ((project project))
(let ((epoch (project-epoch project))
(let ((releases-object-version (project-releases-object-version project))
(encoded-name (urlencode (project-name project))))
(if epoch
(uiop:strcat "projects/" encoded-name "/releases-" (write-to-string epoch))
(if releases-object-version
(uiop:strcat "projects/" encoded-name "/releases-" (write-to-string releases-object-version))
(uiop:strcat "projects/" encoded-name "/releases"))))
(defmethod project-version-scheme ((project project))
......
(:repo (:gitlab :path "a/a") :epoch 0)
(:repo (:gitlab :path "a/a") :releases-object-version 0)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment