1 # Makefile for maintaining Fedora branches and creating Fedora source RPMs.
3 glibc.spec
: # The default target.
5 .PHONY
: follow merge merge-base tag force-tag archive finish_archive srpm rpm
7 releases-url
:= ftp
://sources.redhat.com
/pub
/glibc
/releases
/
12 git
= $(shell $(GIT
) $1 $2)
13 gitconf
= $(call git
,config
,--get $1)
14 branchname
= $(patsubst refs
/heads
/%,%,$1)
16 my-branch
:= $(call branchname
,$(call git
,symbolic-ref
,HEAD
))
17 upstream-remote
:= $(call gitconf
,branch.
$(my-branch
).remote
)
18 upstream-branch
:= $(call branchname
,$(call gitconf
,branch.
$(my-branch
).follow
))
20 dep-my-branch
:= $(firstword $(wildcard ..
/.git
/refs
/heads
/$(my-branch
) \
22 dep-upstream-branch
:= $(firstword $(wildcard \
23 ..
/.git
/refs
/remotes
/$(upstream-remote
)/$(upstream-branch
) \
26 # Use 'make follow branch=release/3.14/master' to switch this checkout
27 # to a new upstream branch to merge from.
30 @echo
"Use '$(MAKE) follow branch=NAME'"; exit
2
32 $(GIT
) rev-parse
--verify
$(upstream-remote
)/$(branch
)
33 $(GIT
) config branch.
$(my-branch
).follow
$(branch
)
34 @
$(GIT
) branch
-v | grep
"^. $(subst .,\\.,$(my-branch)) "
37 # Use this to merge upstream changes into this branch.
38 # It will fail if conflict resolution is required.
39 # Then you follow up with editting, 'git add FILE...', and git commit.
42 $(GIT
) merge
$(upstream-remote
)/$(upstream-branch
)
44 describe-merge
= describe
--match
'glibc-*'
46 merge-base-id
:= $(call git
,merge-base
,\
47 HEAD
$(upstream-remote
)/$(upstream-branch
))
48 merge-base-name
:= $(call git
,$(describe-merge
) $(merge-base-id
))
51 @echo
$(merge-base-id
) $(merge-base-name
)
53 snapshot-name
:= $(patsubst glibc-
%,%,$(merge-base-name
))
55 tar-name
= $(merge-base-name
)
58 $(GIT
) $(describe-merge
) --exact-match
> /dev
/null
2>&1 $(merge-base-id
)
60 glibc.spec
: glibc.spec.in
$(dep-my-branch
)
62 echo
'%define glibcsrcdir $(tar-name)' > $@.new
63 if
$(upstream-pristine
); then \
64 echo
'%define glibc_release_url $(releases-url)' >> $@.new
; \
66 $(GIT
) show
$(my-branch
):version.h \
67 | sed
-n
'/VERSION/s/^.*"\([^"]*\)"$$/%define glibcversion \1/p' \
69 echo
'### $< follows:' >> $@.new
73 ifeq (,$(wildcard glibc.spec
))
74 Makefile
: glibc.spec
;
77 spec-nvr
:= $(shell rpm
-q
--qf
'%{NAME}-%{VERSION}-%{RELEASE}\n' \
78 --specfile glibc.spec
2> /dev
/null | sed
1q
)
79 spec-tag
= $(spec-nvr
)
81 tag-spec
= -a
-m
'$(spec-nvr)' $(tag-prefix
)$(spec-tag
)
84 $(GIT
) tag
$(tag-spec
)
87 $(GIT
) tag
-f
$(tag-spec
)
91 # Omit these files from the patch and put them in a tar file.
92 outside-patch
= fedora
/ c_stubs
/ rtkaio
/ \
93 localedata
/charmaps
/GB18030 iconvdata
/gb18030.c
95 glibc-
$(branch-name
).patch
: glibc.spec Makefile
$(dep-upstream-branch
)
96 @echo
"Creating $@ from `$(git-describe) $(my-branch)`..."
97 @
$(GIT
) diff
-a
--no-renames
$(merge-base-id
)..
$(my-branch
) \
98 | awk
'$$1 == "diff" && $$2 == "--git" { file = $$3 } \
99 $$1 == "---" && $$2 == "/dev/null" { $$2 = file } \
101 | filterdiff
--remove-timestamps
--clean --strip=1 \
103 $(patsubst %,-x
'*/%',$(patsubst %/,%/*,$(outside-patch
)))\
104 --addoldprefix
='$(merge-base-name)/' \
105 --addnewprefix
='$(spec-nvr)/' \
109 git-describe
= $(GIT
) describe
--long
--always
112 echo
"Creating $@ from `$(git-describe) $1`..."; \
113 (cd ..
; $(GIT
) archive
--format
=tar --prefix='$(tar-name)/' $1 $2) \
114 | bzip2
-9 > $@.new
&& \
118 $(tar-name
)-$(branch-name
).
tar.bz2
: glibc.spec Makefile
119 @
$(call git-tar
,$(my-branch
),$(outside-patch
))
121 $(tar-name
).
tar.bz2
: $(dep-upstream-branch
) Makefile
122 @if
$(upstream-pristine
); then \
123 echo
'Fetching from $(releases-url)...'; \
124 curl
-C
- -O
$(releases-url
)/$@
; \
126 $(call git-tar
,$(merge-base-id
)); \
129 archives
= $(tar-name
).
tar.bz2 \
130 $(tar-name
)-$(branch-name
).
tar.bz2 \
131 glibc-
$(branch-name
).patch
133 finish_archive
: $(archives
)
136 $(MAKE
) tag finish_archive
138 rpm srpm
: $(spec-nvr
).src.rpm
139 $(spec-nvr
).src.rpm
: glibc.spec
$(archives
)
140 rpmbuild
--define "_sourcedir `pwd`" \
141 --define "_specdir `pwd`" \
142 --define "_srcrpmdir `pwd`" \
146 # These rules are for dealing with the Fedora package repository
149 # To use this, put in ~/.cvspkgsrc at least a line:
150 # COMMON_DIR ?= /some/checkout/of/pkgs/common
151 # We will find cvs-import.sh there and use its CVS/Root for where to commit.
155 -include ~
/.cvspkgsrc
160 pkgs-baseurl
:= cvs
://cvs.fedoraproject.org
/cvs
/pkgs?rpms
161 pkgs-url
= $(pkgs-baseurl
)/glibc
/$(DIST_BRANCH
)\
#$(spec-tag)
163 pkgs-import
: $(spec-nvr
).src.rpm
164 cd
$(COMMON_DIR
) && cvs
-q update
165 $(COMMON_DIR
)/cvs-import.sh
-b
$(DIST_BRANCH
) $<
166 rpm
-qp
$< --queryformat
'[%{FILEMD5S} %{FILENAMES}\n]' > $@.new
170 cd
$(COMMON_DIR
)/..
/glibc
/$(DIST_BRANCH
) && \