Fix a typo, add force-tag
[glibc.git] / fedora / Makefile
blobae5082f01ef12276a423812456a4b1b9dfa3b03b
1 # Makefile for maintaining glibc fedora-branch and creating Fedora source RPMs.
3 glibc.spec: # The default target.
5 tag-prefix := fedora-
7 .PHONY: update commit-merge commit patch tag archive finish_archive srpm rpm
9 snapshot-date-fmt := +'%Y-%m-%d %H:%M %Z'
10 snapshot-name-fmt := +'%Y%m%dT%H%M'
12 include branch.mk
15 on-branch = $(filter-out HEAD,$(glibc-base))
17 snapshot-date := $($(glibc-branch)-sync-date)
18 snapshot-name := $(shell date -u -d '$(snapshot-date)' $(snapshot-name-fmt))
20 tar-name := glibc$(subst _,.,$(patsubst glibc-%-branch,-%,\
21 $(filter-out HEAD,$(glibc-base))))
22 select-snapshot = -r '$($(glibc-branch)-sync-tag)'
23 snapshot-id = $($(glibc-branch)-sync-tag)
26 branch.mk-vars = glibc-branch glibc-base \
27 $(glibc-branch)-sync-date $(glibc-branch)-sync-tag \
28 DIST_BRANCH COLLECTION
30 update:
31 now=`date -u $(snapshot-date-fmt)`; \
32 name=`date -u -d "$$now" $(snapshot-name-fmt)`; \
33 new="$(tag-prefix)$(tar-name)-$$name"; \
34 cvs -Q rtag $(if $(on-branch),-r $(glibc-base),-D "$$now") $$new libc;\
35 (echo '# This file is updated automatically by Makefile.'; \
36 $(foreach var,$(branch.mk-vars),\
37 $(if $($(var)),echo '$(var) := $($(var))';)) \
38 ) > branch.mk; \
39 cd ..; (set -x; cvs -q update -d -P \
40 -j'$($(glibc-branch)-sync-tag)' -j"$$new") \
41 2>&1 | tee fedora/update.log
43 .PHONY: snapshot-time
44 snapshot-time: branch.mk
45 date -d '$(snapshot-date)'
47 commit-merge:
48 cd ..; cvs -Q commit -m"Updated to $(snapshot-id)"
50 glibc.spec: glibc.spec.in ../version.h branch.mk
51 (echo '%define glibcdate $(snapshot-name)'; \
52 sed -n '/VERSION/s/^.*"\([^"]*\)"$$/%define glibcversion \1/p' \
53 ../version.h; \
54 cat $<) > $@.new
55 mv -f $@.new $@
57 ifeq (,$(wildcard glibc.spec))
58 Makefile: glibc.spec ;
59 else
61 spec-nvr := $(shell rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' \
62 --specfile glibc.spec | sed 1q)
63 spec-tag = $(subst .,_,$(spec-nvr))
65 ifeq ($(tagged),no)
66 select-release = -r $(glibc-branch)-branch
67 else
68 select-release = -r $(tag-prefix)$(spec-tag)
69 endif
71 tag: glibc.spec
72 cd ..; cvs -Q tag -c $(tag-prefix)$(spec-tag)
74 force-tag: glibc.spec
75 cd ..; cvs -Q tag -F -c $(tag-prefix)$(spec-tag)
77 # Note this rule assumes that your working directory (..) is up to date.
78 $(tar-name)-$(glibc-branch).patch: makepatch.awk glibc.spec \
79 ../ChangeLog ../*/ChangeLog
80 (cd ..; cvs -q diff -upN $(select-snapshot) $(select-release)) | \
81 awk -v OLDVER=$(tar-name)-$(snapshot-name) \
82 -v NEWVER=$(tar-name)-$(snapshot-name)-$(glibc-branch) \
83 -f $< > patch.tmp
84 mv -f patch.tmp $@
86 # makepatch.awk omits these files from the patch; we put them in a tar file.
87 outside-patch = fedora c_stubs rtkaio glibc-compat \
88 localedata/charmaps/GB18030 iconvdata/gb18030.c
90 $(tar-name)-$(glibc-branch)-$(snapshot-name).tar.bz2: Makefile branch.mk \
91 ../ChangeLog \
92 ../*/ChangeLog
93 @rm -rf libc
94 cvs -Q export $(select-release) $(addprefix libc/,$(outside-patch))
95 tar cf - -C libc $(outside-patch) | bzip2 -9 > $@.new
96 rm -rf libc
97 mv -f $@.new $@
99 $(tar-name)-$(snapshot-name).tar.bz2: Makefile branch.mk
100 @rm -rf $(tar-name)-$(snapshot-name)
101 cvs -Q export -d $(tar-name)-$(snapshot-name) $(select-snapshot) libc
102 tar cf - $(tar-name)-$(snapshot-name) | bzip2 -9 > $@.new
103 rm -rf $(tar-name)-$(snapshot-name)
104 mv -f $@.new $@
106 archives = $(tar-name)-$(snapshot-name).tar.bz2 \
107 $(tar-name)-$(glibc-branch)-$(snapshot-name).tar.bz2 \
108 $(tar-name)-$(glibc-branch).patch
109 finish_archive: $(archives)
111 archive: glibc.spec
112 $(MAKE) tag finish_archive
114 rpm srpm: $(spec-nvr).src.rpm
115 $(spec-nvr).src.rpm: glibc.spec $(archives)
116 rpmbuild --define "_sourcedir `pwd`" \
117 --define "_specdir `pwd`" \
118 --define "_srcrpmdir `pwd`" \
119 --nodeps -bs $<
122 # These rules are for dealing with the Fedora package repository
123 # and the Red Hat internal build system.
125 # To use this, put in ~/.cvsdistrc at least a line:
126 # DIST_COMMON = /some/checkout/of/dist/common
127 # We will find cvs-import.sh there and use its CVS/Root for where to commit.
129 .PHONY: dist-import
131 -include ~/.cvsdistrc
133 ifdef DIST_COMMON
134 DIST_BRANCH ?= devel
135 COLLECTION ?= dist-fc3
136 BHC_FLAGS ?= -n
138 bhc-baseurl := cvs://cvs.devel.redhat.com/cvs/dist?rpms
139 bhc-url = $(bhc-baseurl)/glibc/$(DIST_BRANCH)#$(spec-tag)
141 dist-import: $(spec-nvr).src.rpm
142 $(DIST_COMMON)/cvs-import.sh -b $(DIST_BRANCH) $<
143 ls -l $< > $@
145 dist-build: dist-import
146 bhc $(BHC_FLAGS) $(COLLECTION) '$(bhc-url)'
148 endif
151 endif