Bug 31218

Summary: How to build release from selected date
Product: Base System Reporter: laa <laa>
Component: miscAssignee: matusita
Status: Closed FIXED    
Severity: Affects Only Me CC: laa
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   

Description laa 2001-10-11 13:00:03 UTC
I write a patch for use cvs ``-D <date>'' feature in
src/release/Makefile.

This feature helps build releases with/from sources prior to selected
date. Now I can run cvsup with ``date='', rebuild system, reboot, and
make release if all fine.

This is my example:
[18:23:39] root@ns # make CHROOTDIR=/home/ftp/pub/FreeBSD/releases/
        BUILDNAME=4.4-20011003053200-STABLE \
        CVSROOT=/home/ncvs \
        RELEASETAG=RELENG_4 \
        NOPORTS=YES NODOC=YES \
        CVSDATE='10/03/2001 03:05:00 UTC' \
        CVSCMDARGS="-D $CVSDATE" \
        release > RELEASE.log 2>&1 &

So, this way I have a release from 03 Oct 2001 03:05:00 UTC.

Fix: This is a patch for src/release/Makefile:



-- 
 Laa--FzXFkYjfiGw9znAFEPxrOBemKqXdHKaDkfYNwk5ddv7lojEG
Content-Type: text/plain; name="file.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="file.diff"

--- Makefile.orig	Wed Sep 26 16:53:38 2001
+++ Makefile	Mon Oct  8 18:28:08 2001
@@ -22,6 +22,12 @@
 BASE = 4.4
 BUILDNAME?=${BASE}-${DATE}-STABLE
 #
+# If you want to make release from sources prior to specified date
+# put CVSDATE and CVSCMDARGS to command line arguments.
+#CVSDATE="10/03/2001 03:05:00 UTC"
+#CVSCMDARGS="-D ${CVSDATE}"
+#
+#
 #CHROOTDIR=/junk/release
 # If this is a -stable snapshot, then set
 #RELEASETAG=RELENG_4
@@ -259,10 +265,11 @@
 	done
 .if !defined(RELEASETAG)
 	cd ${CHROOTDIR}/usr && rm -rf src && \
-		cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE}
+		cvs -R -d ${CVSROOT} co "${CVSCMDARGS}" -P ${RELEASESRCMODULE}
 .else
 	cd ${CHROOTDIR}/usr && rm -rf src && \
-		cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
+		cvs -R -d ${CVSROOT} co "${CVSCMDARGS}" -P -r ${RELEASETAG} \
+		${RELEASESRCMODULE}
 .endif
 .if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
 	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
@@ -272,22 +279,30 @@
 .endif
 .if !defined(NOPORTS)
 .if defined(PORTSRELEASETAG)
-	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
+	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} \
+		co "${CVSCMDARGS}" -P -r ${PORTSRELEASETAG} \
+		${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
 .else
-	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
+	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} \
+		co "${CVSCMDARGS}" -P ${RELEASEPORTSMODULE} && cd ports \
+		&& ${MAKEREADMES}
 .endif
 .elif defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
 .if defined(PORTSRELEASETAG)
-	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${MINIMALDOCPORTS}
+	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} \
+		"${CVSCMDARGS}" co -P -r ${PORTSRELEASETAG} ${MINIMALDOCPORTS}
 .else
-	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${MINIMALDOCPORTS}
+	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} \
+		"${CVSCMDARGS}" co -P ${MINIMALDOCPORTS}
 .endif
 .endif
 .if !defined(NODOC)
 .if defined(DOCRELEASETAG)
-	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
+	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} \
+		"${CVSCMDARGS}" co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
 .else
-	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
+	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} \
+		"${CVSCMDARGS}" co -P ${RELEASEDOCMODULE}
 .endif
 	if [ -d ${DOCDISTFILES}/ ]; then \
 		cp -rp ${DOCDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
@@ -297,20 +312,22 @@
 .if make(rerelease)
 .if !defined(RELEASENOUPDATE)
 .if !defined(RELEASETAG)
-	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d
+	cd ${CHROOTDIR}/usr/src && cvs -R -q up "${CVSCMDARGS}" -P -d
 .else
-	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG}
+	cd ${CHROOTDIR}/usr/src && cvs -R -q up "${CVSCMDARGS}" -P -d \
+		-r ${RELEASETAG}
 .endif
 .if !defined(NOPORTS)
 	cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d
 .endif
 .if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
 	for i in ${MINIMALDOCPORTS}; do \
-		( cd ${CHROOTDIR}/usr/$$i && cvs -R -q update -P -d ) ; \
+		( cd ${CHROOTDIR}/usr/$$i && cvs -R -q up "${CVSCMDARGS}" \
+			-P -d ) ; \
 	done
 .endif
 .if !defined(NODOC)
-	cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d
+	cd ${CHROOTDIR}/usr/doc && cvs -R -q up "${CVSCMDARGS}" -P -d
 .endif
 .endif
 .endif
Comment 1 matusita freebsd_committer freebsd_triage 2002-02-24 03:02:24 UTC
State Changed
From-To: open->analyzed

"Specifying data when extracting sources" is a good idea, and it seems 
that this patch does implement that.  Tests are needed before committing. 


Comment 2 matusita freebsd_committer freebsd_triage 2002-02-24 03:02:24 UTC
Responsible Changed
From-To: freebsd-bugs->matusita

I'll take this since I'm very intersted in this PR.
Comment 3 Makoto Matsushita 2002-04-27 03:41:32 UTC
I would like to modify your patch to be more clear.

* I don't think the double-quote when using CVSCMDARGS, since you can
  quote anything if you set CVSCMDARGS just like this:

	make release CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'" ...

  And, CVSCMDARGS can be used for other purpose; document it that this
  is an optional argument for cvs(1)

* CVSCMDARGS is maybe for "CVS command-line argument for CVS
  commands," however, your patch uses this variable as "CVS
  command-line argument for CVS generic option," when extracting doc/
  modules.  I think it's your typo.

Anyway, attached below is revised patch made from latest 5-current.
Would you please check it?  Feel free to ask me if you really want a
patch for 4-stable.

-- -
Makoto `MAR' Matsushita

Index: Makefile
===================================================================
RCS file: /home/ncvs/src/release/Makefile,v
retrieving revision 1.673
diff -u -r1.673 Makefile
--- Makefile	26 Apr 2002 19:40:45 -0000	1.673
+++ Makefile	27 Apr 2002 02:38:39 -0000
@@ -32,6 +32,8 @@
 #CHROOTDIR=/junk/release
 # If this is a -stable snapshot, then set
 #RELEASETAG=RELENG_4
+# If you want to add other options to CVS commands, then set
+#CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'"
 #
 # Non-zero if ${RELEASETAG} is in the form "RELENG_ver_RELEASE"; we
 # are building an official release.  Otherwise, we are building for
@@ -279,10 +281,10 @@
 	done
 .if !defined(RELEASETAG)
 	cd ${CHROOTDIR}/usr && rm -rf src && \
-		cvs -R -d ${CVSROOT} co -P ${RELEASESRCMODULE}
+		cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P ${RELEASESRCMODULE}
 .else
 	cd ${CHROOTDIR}/usr && rm -rf src && \
-		cvs -R -d ${CVSROOT} co -P -r ${RELEASETAG} ${RELEASESRCMODULE}
+		cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P -r ${RELEASETAG} ${RELEASESRCMODULE}
 .endif
 .if defined(LOCAL_PATCHES) && exists(${LOCAL_PATCHES})
 	cd ${CHROOTDIR}/usr/src && patch ${PATCH_FLAGS} < ${LOCAL_PATCHES}
@@ -292,22 +294,22 @@
 .endif
 .if !defined(NOPORTS)
 .if defined(PORTSRELEASETAG)
-	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
+	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P -r ${PORTSRELEASETAG} ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
 .else
-	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
+	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P ${RELEASEPORTSMODULE} && cd ports && ${MAKEREADMES}
 .endif
 .elif defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
 .if defined(PORTSRELEASETAG)
-	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P -r ${PORTSRELEASETAG} ${MINIMALDOCPORTS}
+	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P -r ${PORTSRELEASETAG} ${MINIMALDOCPORTS}
 .else
-	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co -P ${MINIMALDOCPORTS}
+	cd ${CHROOTDIR}/usr && rm -rf ports && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P ${MINIMALDOCPORTS}
 .endif
 .endif
 .if !defined(NODOC)
 .if defined(DOCRELEASETAG)
-	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
+	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P -r ${DOCRELEASETAG} ${RELEASEDOCMODULE}
 .else
-	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co -P ${RELEASEDOCMODULE}
+	cd ${CHROOTDIR}/usr && rm -rf doc && cvs -R -d ${CVSROOT} co ${CVSCMDARGS} -P ${RELEASEDOCMODULE}
 .endif
 	if [ -d ${RELEASEDISTFILES}/ ]; then \
 		cp -rp ${RELEASEDISTFILES} ${CHROOTDIR}/usr/ports/distfiles; \
@@ -319,20 +321,20 @@
 .if make(rerelease)
 .if !defined(RELEASENOUPDATE)
 .if !defined(RELEASETAG)
-	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -A
+	cd ${CHROOTDIR}/usr/src && cvs -R -q update ${CVSCMDARGS} -P -d -A
 .else
-	cd ${CHROOTDIR}/usr/src && cvs -R -q update -P -d -r ${RELEASETAG}
+	cd ${CHROOTDIR}/usr/src && cvs -R -q update ${CVSCMDARGS} -P -d -r ${RELEASETAG}
 .endif
 .if !defined(NOPORTS)
-	cd ${CHROOTDIR}/usr/ports && cvs -R -q update -P -d
+	cd ${CHROOTDIR}/usr/ports && cvs -R -q update ${CVSCMDARGS} -P -d
 .endif
 .if defined(DOMINIMALDOCPORTS) && ${DOMINIMALDOCPORTS} == "YES"
 	for i in ${MINIMALDOCPORTS}; do \
-		( cd ${CHROOTDIR}/usr/$$i && cvs -R -q update -P -d ) ; \
+		( cd ${CHROOTDIR}/usr/$$i && cvs -R -q update ${CVSCMDARGS} -P -d ) ; \
 	done
 .endif
 .if !defined(NODOC)
-	cd ${CHROOTDIR}/usr/doc && cvs -R -q update -P -d
+	cd ${CHROOTDIR}/usr/doc && cvs -R -q update ${CVSCMDARGS} -P -d
 .endif
 .endif
 .endif
Comment 4 Makoto Matsushita 2002-04-27 03:56:00 UTC
Gimme a chance to fix typo.  Sorry for inconvenience.

matusita>  * I don't think the double-quote when using CVSCMDARGS,
             I think the double-quotes doesn't need when using CVSCMDARGS,
matusita>  since you can quote anything if you set CVSCMDARGS just
matusita>  like this:

-- -
Makoto `MAR' Matsushita
Comment 5 laa 2002-04-27 10:33:40 UTC
hi!

On Sat, Apr 27, 2002 at 11:41:32AM +0900, Makoto Matsushita wrote:
> I would like to modify your patch to be more clear.
> 
> * I don't think the double-quote when using CVSCMDARGS, since you can
>   quote anything if you set CVSCMDARGS just like this:
> 
> 	make release CVSCMDARGS="-D '01/01/2002 00:00:00 UTC'" ...
> 
>   And, CVSCMDARGS can be used for other purpose; document it that this
>   is an optional argument for cvs(1)
> 

I agree with You, double-quote don't needed.

> * CVSCMDARGS is maybe for "CVS command-line argument for CVS
>   commands," however, your patch uses this variable as "CVS
>   command-line argument for CVS generic option," when extracting doc/
>   modules.  I think it's your typo.
> 
> Anyway, attached below is revised patch made from latest 5-current.

Your patch looks fine. Thanks.
Sorry, but I can't check it because I have no fbsd boxes for testing ;(

> Would you please check it?  Feel free to ask me if you really want a
> patch for 4-stable.

Yes, I want to apply thsis patch for RELENG_4 before 4.6-REL. Can You
do it?

Thank you very much!

-- 
 Laa
Comment 6 Makoto Matsushita 2002-04-27 14:54:23 UTC
laa> I agree with You, double-quote don't needed.

OK.  I'll commit this patch later.

laa> Yes, I want to apply thsis patch for RELENG_4 before 4.6-REL. Can
laa> You do it?

The code-freeze date for 4.6-RELEASE, May/01/2002 is approaching.  I
do not want to do MFC quickly since it's not trivial nor critical fix.
I'll try asking re@ later; but at this time, I cannot promise you that
this change appears in RELENG_4_6 branch.

-- -
Makoto `MAR' Matsushita
Comment 7 matusita freebsd_committer freebsd_triage 2002-04-27 15:23:41 UTC
State Changed
From-To: analyzed->patched

Commit a modified patch as src/release/Makefile rev 1.674, thanks. 
Awaiting MFC.
Comment 8 matusita freebsd_committer freebsd_triage 2002-05-03 13:56:25 UTC
State Changed
From-To: patched->closed

I've MFCed just now.  Thank you!