;;;  -*- mode: LISP; Package: CL-USER; Syntax: COMMON-LISP;  Base: 10 -*-
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 
;;; Author      : Mike Byrne
;;; Copyright   : (c)1999 CMU/Mike Byrne, All Rights Reserved
;;; Availability: public domain
;;; Address     : Carnegie Mellon University
;;;             : Psychology Department
;;;             : Pittsburgh,PA 15213-3890
;;;             : byrne@acm.org
;;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; 
;;; Filename    : patch-support.lisp
;;; Version     : 1.0
;;; 
;;; Description : Support functions for adding patches to RPM.
;;; 
;;; Bugs        : 
;;; 
;;; Todo        : 
;;; 
;;; ----- History -----
;;; 99.07.07 Mike Byrne
;;;             :  Incept date.
;;; 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


(defmethod add-patchstr ((mstr-proc master-process) patchstr)
  "Add a patch string to the main RPM version string."
  (unless (search patchstr (version-string mstr-proc))
    (setf (version-string mstr-proc)
          (mkstr (version-string mstr-proc) patchstr))))


;;;; ---------------------------------------------------------------------- ;;;;
;;;; Stuff for messing with RPM parameters.

(defun add-parameter (param)
  "Add a PM parameter."
  (when (assoc (name param) (param-lis *mp*))
    (delete-parameter (name param)))
  (push (list (name param) param) (param-lis *mp*))
  (setf (param-lis *mp*)
        (sort (param-lis *mp*) #'key-lessp :key #'first)))


(defun delete-parameter (name)
  "Delete a PM parameter."
  (setf (param-lis *mp*)
        (delete name (param-lis *mp*) :key 'first)))


(defun key-lessp (k1 k2)
  "Determine if a keyword name is less than another."
  (string-lessp (mkstr k1) (mkstr k2)))



