/[packages]/updates/5/kernel/current/Makefile
ViewVC logotype

Contents of /updates/5/kernel/current/Makefile

Parent Directory Parent Directory | Revision Log Revision Log


Revision 833654 - (show annotations) (download)
Thu Jun 18 23:44:06 2015 UTC (8 years, 5 months ago) by umeabot
File size: 4168 byte(s)
SILENT Branching for Mageia 5
1 PACKAGE = kernel
2 SPEC = SPECS/$(PACKAGE).spec
3 SPECQUERY = --specfile $(SPEC) --define "_topdir $(CURDIR)"
4
5 # Since we now have a correctly versioned srpm, we can query it for the info we need
6 KPATCH := $(shell sed -n '/^%define kpatch\t\t/s///p' $(SPEC) | sed 's/\(.*\)/\1-/' | sed 's/^0-//')
7 MGAREL := $(shell sed -n '/^%define mgarel\t\t/s///p' $(SPEC))
8 VERSION := $(shell rpm -q --qf '%{VERSION}\n' $(SPECQUERY) | head -1 )
9 RELEASE := $(shell rpm -q --qf '%{RELEASE}\n' $(SPECQUERY) | head -1 )
10 KVERREL = $(VERSION)-$(RELEASE)
11 SRPM_NAME := $(shell rpm -q --qf '%{NAME}-%{VERSION}-%{RELEASE}.src.rpm\n' $(SPECQUERY) | head -1)
12 KVERSION = $(shell echo $(VERSION) | cut -d. -f1)
13 KPATCHLEVEL = $(shell echo $(VERSION) | cut -d. -f2)
14 KSUBLEVEL = $(shell echo $(VERSION) | cut -d. -f3)
15 TAR_VER = $(KVERSION).$(KPATCHLEVEL).$(shell expr $(KSUBLEVEL) - 0$(shell echo $(KPATCH) | sed 's/..*/1/'))
16
17 PATCHES_DIR = PATCHES
18 GENFILES_DIR = SOURCES
19 BUILDDIR := $(shell mktemp -d $${TMPDIR:-/tmp}/tmp.XXXXXX)
20
21 LOCAL_DIR = $(shell basename $(CURDIR))
22 SVN_URL := $(shell svn info | sed -n '/^URL[^:]*: *\(.*\)/s//\1/p')
23 SVN_BASE := $(shell dirname $(SVN_URL))
24
25 CP = cp -p
26 RPM_TOP_DIR = $(CURDIR)
27 RPM = rpmbuild --define "_topdir $(RPM_TOP_DIR)"
28
29
30 rpm-dirs = BUILD SPECS SOURCES RPMS SRPMS
31
32 rpm-specfile = $(SPEC)
33
34 raw-tar-kernel = linux-$(TAR_VER).tar.xz
35 tar-kernel = $(GENFILES_DIR)/$(raw-tar-kernel)
36 rpm-tar-kernel = SOURCES/$(raw-tar-kernel)
37
38 patches-kverrel = $(VERSION)-$(KPATCH)mga$(MGAREL)
39 raw-tar-patches = linux-$(patches-kverrel).tar.xz
40 tar-patches = $(GENFILES_DIR)/$(raw-tar-patches)
41 tar-patches-ts = $(GENFILES_DIR)/.time-stamp-linux-$(patches-kverrel)
42 rpm-tar-patches = SOURCES/$(raw-tar-patches)
43
44 rpm-variable-sources = \
45 $(rpm-tar-kernel) $(rpm-tar-patches)
46
47 rpm-immuable-sources = \
48 SOURCES/README.kernel-sources
49
50 help:
51 @echo "This top-level Makefile is for creating Mageia kernel packages."
52 @echo
53 @echo "The following targets are available:"
54 @echo " localsrpm build source package $(SRPM_NAME)"
55 @echo " localrpm build binary packages"
56 @echo " localrpms build both source and binary packages"
57 @echo " svntag tag the current workspace"
58 @echo " changelog update and commit ChangeLog entries"
59 @echo " rpm build all rpms + changelog + svntag"
60 @echo
61 @echo "You can pass extra flags to rpmbuild through the RPM_OPTIONS variable."
62
63 LOGS_DIR = logs
64 $(LOGS_DIR)::
65 @[ -d $(LOGS_DIR) ] || mkdir -p $(LOGS_DIR) > /dev/null 2>&1
66
67 WORK_DIR = $(PWD)/work
68 $(WORK_DIR)::
69 @[ -d $(WORK_DIR) ] || mkdir -p $(WORK_DIR) > /dev/null 2>&1
70
71 $(rpm-dirs):
72 mkdir -p $@
73
74 localrpmprep: $(LOGS_DIR) rpm-tree
75 @echo "### Patching kernel tree"
76 $(RPM) -bp $(RPM_OPTIONS) $(rpm-specfile) >& $(LOGS_DIR)/build-prep-$(PACKAGE)-$(KVERREL).log
77
78 localrpm: $(LOGS_DIR) rpm-tree
79 @echo "### Building binary RPMs"
80 $(RPM) -bb $(RPM_OPTIONS) $(rpm-specfile) >& $(LOGS_DIR)/build-$(PACKAGE)-$(KVERREL).log
81
82 localsrpm: rpm-tree
83 @echo "### Building source RPM"
84 $(RPM) -bs $(rpm-specfile)
85
86 localrpms: localsrpm localrpm
87
88 rpm: changelog localrpms svncommit svntag
89
90 svncommit:
91 svn commit
92
93 svntag:
94 -svn mkdir $(SVN_BASE)/releases/$(VERSION) -m "created directory $(VERSION)"
95 svn cp $(SVN_URL) $(SVN_BASE)/releases/$(VERSION)/$(RELEASE) -m "Tagged as $(KVERREL)"
96
97 changelog:
98 svn log > ChangeLog
99 svn commit -m "Generated by svn log the `date '+%d_%b'`" ChangeLog
100
101 clean:
102 rm -rf $(tar-patches) $(tar-patches-ts) BUILD RPMS SRPMS $(LOGS_DIR)
103 find . -name '*~' | xargs rm -f
104
105 rpm-tree: $(rpm-dirs) $(rpm-specfile) $(rpm-variable-sources) $(rpm-immuable-sources)
106
107 tar-patches: $(tar-patches)
108 srpm-prep: tar-patches
109 $(tar-patches): $(tar-patches-ts)
110 @echo "### Building patches tarball $(raw-tar-patches)"
111 @rm -rf $(BUILDDIR)
112 mkdir -p $(BUILDDIR)/$(patches-kverrel)
113 tar -C $(PATCHES_DIR) -cf - --exclude-vcs --exclude '*~' . | tar xf - -C $(BUILDDIR)/$(patches-kverrel)
114 cd $(BUILDDIR); tar cfa $(raw-tar-patches) $(patches-kverrel)
115 mv $(BUILDDIR)/$(raw-tar-patches) $@
116 rm -rf $(BUILDDIR)
117
118 $(tar-patches-ts)::
119 @if [ -f $@ ]; then \
120 m=`find $(PATCHES_DIR)/ -newer $@`; \
121 [ -z "$$m" ] || touch $@; \
122 else \
123 touch $@; \
124 fi
125
126 # Local Variables:
127 # tab-width: 8
128 # End:

Properties

Name Value
svn:eol-style native

  ViewVC Help
Powered by ViewVC 1.1.28