summaryrefslogtreecommitdiff
path: root/fedora
diff options
context:
space:
mode:
authorRoland McGrath <roland@redhat.com>2009-05-27 03:17:43 -0700
committerRoland McGrath <roland@redhat.com>2009-05-27 03:17:43 -0700
commitdfbbe67270efa9c03f9444d50d2f98a7a64622b4 (patch)
treed0d8ce3dd46969f7ff33532d5534412365a1c612 /fedora
parentd237dcd93bdc0797569af1e9aaa0e7a8d911858d (diff)
Fedora makefile magic using GIT.
Diffstat (limited to 'fedora')
-rw-r--r--fedora/.gitignore (renamed from fedora/.cvsignore)2
-rw-r--r--fedora/Makefile219
-rw-r--r--fedora/branch.mk7
-rw-r--r--fedora/glibc.spec.in20
-rw-r--r--fedora/makepatch.awk57
5 files changed, 113 insertions, 192 deletions
diff --git a/fedora/.cvsignore b/fedora/.gitignore
index 02a03c3ffc..e4faf26ddd 100644
--- a/fedora/.cvsignore
+++ b/fedora/.gitignore
@@ -1,5 +1,5 @@
+*~
glibc-*.tar.bz2
glibc-*.src.rpm
glibc-fedora.patch
glibc.spec
-update.log
diff --git a/fedora/Makefile b/fedora/Makefile
index 30109b7b88..95b67f9d83 100644
--- a/fedora/Makefile
+++ b/fedora/Makefile
@@ -1,72 +1,72 @@
-# Makefile for maintaining glibc fedora-branch and creating Fedora source RPMs.
+# Makefile for maintaining Fedora branches and creating Fedora source RPMs.
glibc.spec: # The default target.
-tag-prefix := fedora-
+.PHONY: follow merge merge-base tag force-tag archive finish_archive srpm rpm
-.PHONY: update commit-merge tag archive finish_archive srpm rpm
+releases-url := ftp://sources.redhat.com/pub/glibc/releases/
+tag-prefix := fedora/
+branch-name := fedora
-snapshot-date-fmt := +'%Y-%m-%d %H:%M %Z'
-snapshot-name-fmt := +'%Y%m%dT%H%M'
+GIT ?= git
+git = $(shell $(GIT) $1 $2)
+gitconf = $(call git,config,--get $1)
+branchname = $(patsubst refs/heads/%,%,$1)
-include branch.mk
+my-branch := $(call branchname,$(call git,symbolic-ref,HEAD))
+upstream-remote := $(call gitconf,branch.$(my-branch).remote)
+upstream-branch := $(call branchname,$(call gitconf,branch.$(my-branch).merge))
+dep-my-branch := $(firstword $(wildcard ../.git/refs/heads/$(my-branch) \
+ ../.git/packed-refs))
+dep-upstream-branch := $(firstword $(wildcard \
+ ../.git/refs/remotes/$(upstream-remote)/$(upstream-branch) \
+ ../.git/packed-refs))
-on-branch = $(filter-out HEAD,$(glibc-base))
+# Use 'make follow branch=release/3.14/master' to switch this checkout
+# to a new upstream branch to merge from.
+follow:
+ifeq (,$(branch))
+ @echo "Use '$(MAKE) follow branch=NAME'"; exit 2
+else
+ $(GIT) rev-parse --verify $(upstream-remote)/$(branch)
+ $(GIT) config branch.$(my-branch).merge $(branch)
+ @$(GIT) branch -v | grep "^. $(subst .,\\.,$(my-branch)) "
+endif
-snapshot-date := $($(glibc-branch)-sync-date)
-snapshot-name := $(shell date -u -d '$(snapshot-date)' $(snapshot-name-fmt))
+# Use this to merge upstream changes into this branch.
+# It will fail if conflict resolution is required.
+# Then you follow up with editting, 'git add FILE...', and git commit.
+merge:
+ $(GIT) pull
-tag-name := glibc$(patsubst glibc-%-branch,-%,\
- $(filter-out HEAD,$(glibc-base)))
-tar-name := $(subst _,.,$(tag-name))
-select-snapshot = -r '$($(glibc-branch)-sync-tag)'
-snapshot-id = $($(glibc-branch)-sync-tag)
+describe-merge = describe --match 'glibc-*'
-branch-name := $(patsubst %-$(patsubst glibc-%,%,$(tag-name)),%,\
- $(glibc-branch))
+merge-base-id := $(call git,merge-base,\
+ HEAD $(upstream-remote)/$(upstream-branch))
+merge-base-name := $(call git,$(describe-merge) $(merge-base-id))
-branch.mk-vars = glibc-branch glibc-base DIST_BRANCH COLLECTION \
- releases-url
+merge-base:
+ @echo $(merge-base-id) $(merge-base-name)
-ifeq (,$(upstream-tag))
-ifneq (,$(upstream))
-upstream-tag := glibc-$(subst .,_,$(upstream))
-endif
-endif
+snapshot-name := $(patsubst glibc-%,%,$(merge-base-name))
+
+tar-name = $(merge-base-name)
-update:
- now=`date -u $(snapshot-date-fmt)`; \
- $(if $(upstream-tag),new='$(upstream-tag)';,\
- name=`date -u -d "$$now" $(snapshot-name-fmt)`; \
- new="$(tag-prefix)$(tag-name)-$$name"; \
- cvs -Q rtag $(if $(on-branch),-r $(glibc-base),-D "$$now") $$new libc;\
- )\
- (echo '# This file is updated automatically by Makefile.'; \
- $(foreach var,$(branch.mk-vars) $(if $(upstream-tag),upstream),\
- $(if $($(var)),echo '$(var) := $($(var))';)) \
- echo "$(glibc-branch)-sync-date := $$now"; \
- echo "$(glibc-branch)-sync-tag := $$new"; \
- ) > branch.mk; \
- cd ..; (set -x; cvs -q update -d -P \
- -j'$($(glibc-branch)-sync-tag)' -j"$$new") \
- 2>&1 | tee fedora/update.log
-
-.PHONY: snapshot-time
-snapshot-time: branch.mk
- date -d '$(snapshot-date)'
-
-commit-merge:
- cd ..; cvs -Q commit -m"Updated to $(snapshot-id)"
-
-glibc.spec: glibc.spec.in ../version.h branch.mk
- (echo '%define glibcdate $(snapshot-name)'; \
- echo '%define glibcname $(tar-name)'; \
- echo '%define glibcsrcdir $(srcdir-name)'; \
- echo '%define glibc_release_tarballs $(if $(upstream),1,0)'; \
- sed -e $$( sed -n '/VERSION/s/^.*"\([^"]*\)"$$/s,@glibcversion@,\1,/p' \
- ../version.h ) \
- $<) > $@.new
+upstream-pristine = \
+ $(GIT) $(describe-merge) --exact-match > /dev/null 2>&1 $(merge-base-id)
+
+glibc.spec: glibc.spec.in $(dep-my-branch)
+ @rm -f $@.new
+ echo '%define glibcsrcdir $(tar-name)' > $@.new
+ if $(upstream-pristine); then \
+ echo '%define glibc_release_url $(releases-url)' >> $@.new; \
+ else : ; fi; \
+ $(GIT) show $(my-branch):version.h \
+ | sed -n '/VERSION/s/^.*"\([^"]*\)"$$/%define glibcversion \1/p' \
+ >> $@.new
+ echo '### $< follows:' >> $@.new
+ cat $< >> $@.new
mv -f $@.new $@
ifeq (,$(wildcard glibc.spec))
@@ -74,78 +74,61 @@ Makefile: glibc.spec ;
else
spec-nvr := $(shell rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}\n' \
- --specfile glibc.spec | sed 1q)
-spec-tag = $(subst .,_,$(spec-nvr))
+ --specfile glibc.spec 2> /dev/null | sed 1q)
+spec-tag = $(spec-nvr)
-ifeq ($(tagged),no)
-select-release = -r $(glibc-branch)-branch
-else
-select-release = -r $(tag-prefix)$(spec-tag)
-endif
+tag-spec = -a -m'$(spec-nvr)' $(tag-prefix)$(spec-tag)
tag: glibc.spec
- cd ..; cvs -Q tag -c $(tag-prefix)$(spec-tag)
+ $(GIT) tag $(tag-spec)
force-tag: glibc.spec
- cd ..; cvs -Q tag -F -c $(tag-prefix)$(spec-tag)
-
-ifeq (,$(upstream))
-srcdir-name = $(tar-name)-$(snapshot-name)
-else
-tar-name = glibc-$(upstream)
-srcdir-name = $(tar-name)
+ $(GIT) tag -f $(tag-spec)
-ifneq ($($(glibc-branch)-sync-tag),$(upstream-tag))
-define upstream-tag-check
- @echo Need to run make update upstream=$(upstream); exit 1
-endef
-endif
endif
-# Note this rule assumes that your working directory (..) is up to date.
-$(tar-name)-$(branch-name).patch: makepatch.awk glibc.spec \
- ../ChangeLog ../*/ChangeLog
- $(upstream-tag-check)
-# Use -kk to suppress patches for $ Id $ differences between branches.
- (cd ..; cvs -q diff -kk -upN $(select-snapshot) $(select-release)) | \
- awk -v OLDVER=$(srcdir-name) \
- -v NEWVER=$(srcdir-name)-$(branch-name) \
- -f $< > patch.tmp
- mv -f patch.tmp $@
-
-# makepatch.awk omits these files from the patch; we put them in a tar file.
-outside-patch = fedora c_stubs rtkaio \
+# Omit these files from the patch and put them in a tar file.
+outside-patch = fedora/ c_stubs/ rtkaio/ \
localedata/charmaps/GB18030 iconvdata/gb18030.c
-$(tar-name)-$(branch-name)-$(snapshot-name).tar.bz2: Makefile branch.mk \
- ../ChangeLog \
- ../*/ChangeLog
- $(upstream-tag-check)
- @rm -rf libc
- cvs -Q export $(select-release) $(addprefix libc/,$(outside-patch))
- tar cf - -C libc $(outside-patch) | bzip2 -9 > $@.new
- rm -rf libc
- mv -f $@.new $@
+glibc-$(branch-name).patch: glibc.spec Makefile $(dep-upstream-branch)
+ @echo "Creating $@ from `$(git-describe) $(my-branch)`..."
+ @$(GIT) diff -a --no-renames $(merge-base-id)..$(my-branch) \
+ | awk '$$1 == "diff" && $$2 == "--git" { file = $$3 } \
+ $$1 == "---" && $$2 == "/dev/null" { $$2 = file } \
+ { print }' \
+ | filterdiff --remove-timestamps --clean --strip=1 \
+ -x '*/.gitignore' \
+ $(patsubst %,-x '*/%',$(patsubst %/,%/*,$(outside-patch)))\
+ --addoldprefix='$(merge-base-name)/' \
+ --addnewprefix='$(spec-nvr)/' \
+ > patch.tmp
+ @mv -f patch.tmp $@
+
+git-describe = $(GIT) describe --long --always
+
+define git-tar
+echo "Creating $@ from `$(git-describe) $1`..."; \
+(cd ..; $(GIT) archive --format=tar --prefix='$(tar-name)/' $1 $2) \
+| bzip2 -9 > $@.new && \
+mv -f $@.new $@
+endef
-glibc-tarballs = $(srcdir-name).tar.bz2
-ifeq (,$(upstream))
-$(srcdir-name).tar.bz2: Makefile branch.mk
- @rm -rf $(srcdir-name)
- cvs -Q export -d $(srcdir-name) $(select-snapshot) libc
- tar cf - $(srcdir-name) | bzip2 -9 > $@.new
- rm -rf $(srcdir-name)
- mv -f $@.new $@
-else
-glibc-tarballs += $(srcdir-name:glibc-%=glibc-linuxthreads-%).tar.bz2 \
- $(srcdir-name:glibc-%=glibc-libidn-%).tar.bz2
+$(tar-name)-$(branch-name).tar.bz2: glibc.spec Makefile
+ @$(call git-tar,$(my-branch),$(outside-patch))
-$(glibc-tarballs):
- curl -O $(releases-url)/$@
-endif
+$(tar-name).tar.bz2: $(dep-upstream-branch) Makefile
+ @if $(upstream-pristine); then \
+ echo 'Fetching from $(releases-url)...'; \
+ curl $(addprefix -C - -O $(releases-url),\
+ $@ $(@:glibc-%=glibc-libidn-%)); \
+ else \
+ $(call git-tar,$(merge-base-id)); \
+ fi
-archives = $(glibc-tarballs) \
- $(tar-name)-$(branch-name)-$(snapshot-name).tar.bz2 \
- $(tar-name)-$(branch-name).patch
+archives = $(tar-name).tar.bz2 \
+ $(tar-name)-$(branch-name).tar.bz2 \
+ glibc-$(branch-name).patch
finish_archive: $(archives)
@@ -173,20 +156,20 @@ $(spec-nvr).src.rpm: glibc.spec $(archives)
ifdef COMMON_DIR
DIST_BRANCH ?= devel
-COLLECTION ?= dist-f8
pkgs-baseurl := cvs://cvs.fedoraproject.org/cvs/pkgs?rpms
pkgs-url = $(pkgs-baseurl)/glibc/$(DIST_BRANCH)\#$(spec-tag)
pkgs-import: $(spec-nvr).src.rpm
+ cd $(COMMON_DIR) && cvs -q update
$(COMMON_DIR)/cvs-import.sh -b $(DIST_BRANCH) $<
rpm -qp $< --queryformat '[%{FILEMD5S} %{FILENAMES}\n]' > $@.new
mv -f $@.new $@
build: pkgs-import
- koji build $(BUILD_FLAGS) $(COLLECTION) '$(pkgs-url)'
+ cd $(COMMON_DIR)/../glibc/$(DIST_BRANCH) && \
+ cvs -q update && \
+ $(MAKE) build
endif
###
-
-endif
diff --git a/fedora/branch.mk b/fedora/branch.mk
deleted file mode 100644
index d261e6cc49..0000000000
--- a/fedora/branch.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-# This file is updated automatically by Makefile.
-glibc-branch := fedora
-glibc-base := HEAD
-DIST_BRANCH := devel
-COLLECTION := dist-f8
-fedora-sync-date := 2009-05-10 18:42 UTC
-fedora-sync-tag := fedora-glibc-20090510T1842
diff --git a/fedora/glibc.spec.in b/fedora/glibc.spec.in
index 7a68f033ed..4ee53a8851 100644
--- a/fedora/glibc.spec.in
+++ b/fedora/glibc.spec.in
@@ -16,9 +16,10 @@
%define rtkaioarches %{ix86} x86_64 ia64 ppc ppc64 s390 s390x
%define debuginfocommonarches %{ix86} alpha alphaev6 sparc sparcv9 sparcv9v sparc64 sparc64v
%define _unpackaged_files_terminate_build 0
+
Summary: The GNU libc libraries
Name: glibc
-Version: @glibcversion@
+Version: %{glibcversion}
Release: 1
# GPLv2+ is used in a bunch of programs, LGPLv2+ is used for libraries.
# Things that are linked directly into dynamically linked programs
@@ -28,14 +29,15 @@ Release: 1
License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Group: System Environment/Libraries
URL: http://sources.redhat.com/glibc/
-Source0: %{glibcsrcdir}.tar.bz2
-%if %{glibc_release_tarballs}
-Source1: %(echo %{glibcsrcdir} | sed s/glibc-/glibc-linuxthreads-/).tar.bz2
-Source2: %(echo %{glibcsrcdir} | sed s/glibc-/glibc-libidn-/).tar.bz2
-%define glibc_release_unpack -a1 -a2
+Source0: %{?glibc_release_url}%{glibcsrcdir}.tar.bz2
+%if 0%{?glibc_release_url:1}
+%define glibc_libidn_tarball %(echo %{glibcsrcdir} | \
+ sed s/glibc-/glibc-libidn-/).tar.bz2
+Source1: %{glibc_release_url}%{glibc_libidn_tarball}
+%define glibc_release_unpack -a1
%endif
-Source3: %{glibcname}-fedora-%{glibcdate}.tar.bz2
-Patch0: %{glibcname}-fedora.patch
+Source2: %{glibcsrcdir}-fedora.tar.bz2
+Patch0: %{name}-fedora.patch
Patch1: %{name}-ia64-lib64.patch
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
Obsoletes: glibc-profile < 2.4
@@ -221,7 +223,7 @@ package or when debugging this package.
%endif
%prep
-%setup -q -n %{glibcsrcdir} %{glibc_release_unpack} -a3
+%setup -q -n %{glibcsrcdir} %{?glibc_release_unpack} -a2
%patch0 -E -p1
%ifarch ia64
%if "%{_lib}" == "lib64"
diff --git a/fedora/makepatch.awk b/fedora/makepatch.awk
deleted file mode 100644
index fba827de4b..0000000000
--- a/fedora/makepatch.awk
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/awk -f
-/^cvs (diff|server): tag.*is not in file/ {
- print
- next
-}
-/^cvs (diff|server): Diffing/ {
- next
-}
-/^\? / {
- next
-}
-/^Index:/ {
- file=$2
- next
-}
-/^===============/ {
- next
-}
-/^RCS/ {
- next
-}
-/^retrieving/ {
- next
-}
-/^diff/ {
- next
-}
-/^---/ {
- if ($2 ~ /^\/dev\/null/ ||
- $2 ~ /^\/tmp\//)
- $2=file
- if ($2 ~ /.cvsignore$/ ||
- $2 ~ /^c_stubs/ ||
- $2 ~ /^rtkaio/ ||
- $2 ~ /^fedora/ ||
- $2 ~ /^localedata\/charmaps\/GB18030/ ||
- $2 ~ /^iconvdata\/gb18030\.c/) {
- hide = 1
- next
- } else {
- hide = 0
- }
- sub(/^---[ ]*/,"--- " OLDVER "/")
-}
-/^\+\+\+/ {
- if (hide)
- next
- if ($2 ~ /^\/dev\/null/ ||
- $2 ~ /^\/tmp\//)
- $2=file
- sub(/^\+\+\+[ ]*/,"+++ " NEWVER "/")
-}
-{
- if (hide)
- next
- print
-}