-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathscm_rules.mk
More file actions
146 lines (123 loc) · 3.51 KB
/
scm_rules.mk
File metadata and controls
146 lines (123 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# License: GPL v2 or later
# Copyright Red Hat Inc. 2008
ifndef SCM_REMOTE_BRANCH
SCM_REMOTE_BRANCH = dummy
endif
ifndef SCM_LOCAL_BRANCH
SCM_LOCAL_BRANCH = $(SCM_REMOTE_BRANCH)
endif
ifndef SCM_ACTUAL_REMOTE_BRANCH
SCM_ACTUAL_REMOTE_BRANCH = $(SCM_REMOTE_BRANCH)
endif
ifndef SCM_TAG
SCM_TAG = $(PKGNAME)-$(PKGVERSION)
endif
ifndef DATETIME_CMD
DATETIME_CMD = date -u "+%%Y%%m%%d_%%H%%M%%S"
endif
ifndef SCM_REVISION_CMD
SCM_REVISION_CMD = $(DATETIME_CMD)
endif
ifndef SCM_SNAP_TAG
SCM_SNAP_TAG = snap
endif
SCM_SNAP_VERSION = $(PKGVERSION)-$(SCM_SNAP_TAG)-$(shell $(SCM_REVISION_CMD))
ifndef FORCETAG
SCM_FORCE_FLAG =
else
SCM_FORCE_FLAG = -f
endif
ifndef SCM_CHANGED_FILES_SINCE_TAG_COMMAND
SCM_CHANGED_FILES_SINCE_TAG_COMMAND = $(SCM_DIFF_TAG_COMMAND) | grep -v "^[-+][-+][-+][ \t][ \t]*/dev/null$$" | egrep '^---[^-]|^\+\+\+' | sed 's:^...[ \t][ \t]*[ab]/::g' | sort -u
endif
checkmods:
@if $(SCM_CHECK_MODS); then \
echo There are modifications not yet committed. Commit these first. >&2; \
exit 1; \
fi
checkrepo:
ifndef BYPASSUPSTREAM
@x=0; \
if [ -z "$$(echo $(SCM_REMOTEREPO_URL) | egrep -x '$(SCM_REMOTEREPO_RE)')" ]; then \
echo The repository $(SCM_REMOTEREPO_URL) is not the upstream of $(PKGNAME). >&2; \
x=1; \
fi; if [ "$(SCM_REMOTE_BRANCH)" != "$(SCM_ACTUAL_REMOTE_BRANCH)" ]; then \
echo The remote branch must be $(SCM_REMOTE_BRANCH), not $(SCM_ACTUAL_REMOTE_BRANCH) >&2; \
x=1; \
fi; if [ "$$x" -ne 0 ]; then \
echo Pushing to anywhere else may not be helpful when creating an archive. >&2; \
echo Use BYPASSUPSTREAM=1 to not access upstream or FORCEPUSH=1 to push anyway. >&2; \
exit 1; \
fi
endif
incoming: checkrepo
@if $(SCM_CHECK_INCOMING_CHANGES); then \
echo There are incoming changes which need to be integrated. >&2; \
echo Pull them with "$(SCM_PULL_COMMAND)" and resolve possible conflicts. >&2; \
exit 1; \
fi
ifdef UNSTABLE
tag archivepush archive:
@echo Use of target \'$@\' not possible in unstable branch. >&2
@exit 1
else
tag:
ifndef FORCETAG
@if $(SCM_CHECK_TAG); then \
echo "Tag $(SCM_TAG) exists already. Use FORCETAG=1 to force tagging." >&2 ; \
exit 1; \
fi
endif
@if [ -n "$(FORCETAG)" ]; then \
tagcmd="$(SCM_FORCE_TAG_COMMAND)"; \
else \
tagcmd="$(SCM_TAG_COMMAND)"; \
fi; \
if [ -n "$(SCM_LAST_TAG)" -a -z "$$($(SCM_DIFF_LAST_TAG_COMMAND))" ]; then \
echo "No differences to last tagged release '$(SCM_LAST_TAG)'. Not tagging."; \
else \
echo "Tagging '$(SCM_TAG)'."; \
$(SCM_TAG_COMMAND); \
fi
ifdef FORCEPUSH
archivepush:
else
archivepush: checkrepo
endif
ifndef BYPASSUPSTREAM
@echo Pushing to repository $(SCM_REMOTEREPO_URL).
@if ! $(SCM_PUSH_REMOTE_COMMAND); then \
echo Pushing failed. >&2; \
echo Use BYPASSUPSTREAM=1 to bypass pushing. >&2; \
exit 1; \
fi
endif
archive: checkmods incoming tag archivepush
ifndef FORCEARCHIVE
@if [ -e "${PKGNAME}-$(PKGVERSION).tar.bz2" ]; then \
echo "File ${PKGNAME}-$(PKGVERSION).tar.bz2 exists already." >&2; \
echo "Use FORCEARCHIVE=1 to force overwriting it." >&2; \
exit 1; \
fi
endif
@$(SCM_ARCHIVE_COMMAND)
@echo "The archive is in ${PKGNAME}-$(PKGVERSION).tar.bz2"
endif
snaparchive:
@$(SCM_SNAP_ARCHIVE_COMMAND)
@echo "The _local_ snapshot archive is in ${PKGNAME}-$(SCM_SNAP_VERSION).tar.bz2"
dif: diff
diff:
@echo Differences to tag $(SCM_TAG):
@echo
@$(SCM_DIFF_TAG_COMMAND)
sdif: shortdiff
shortdiff:
@echo Files changed since tag $(SCM_TAG):
@echo
@$(SCM_CHANGED_FILES_SINCE_TAG_COMMAND)
llog: lastlog
lastlog:
@echo Log since tag $(SCM_TAG)
@echo
@$(SCM_LASTLOG_COMMAND)