~ubuntu-branches/ubuntu/vivid/libhtml-wikiconverter-perl/vivid

« back to all changes in this revision

Viewing changes to debian/cdbs/1/rules/upstream-tarball.mk

  • Committer: Bazaar Package Importer
  • Author(s): Krzysztof Krzyżaniak (eloy)
  • Date: 2009-05-12 12:40:57 UTC
  • mfrom: (1.1.4 upstream) (3.1.2 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090512124057-rbldtgk1a29xn02p
Tags: 0.68-1
* New upstream release
* debian/control: update Standards-Version to 3.8.1, add me to Uploaders
* drop cdbs support, use debhelper 7 instead
* debian/copyright: update dates

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# -*- mode: makefile; coding: utf-8 -*-
2
 
# Copyright © 2007-2008 Jonas Smedegaard <dr@jones.dk>
3
 
# Description: Convenience rules for dealing with upstream tarballs
4
 
#
5
 
# This program is free software; you can redistribute it and/or
6
 
# modify it under the terms of the GNU General Public License as
7
 
# published by the Free Software Foundation; either version 2, or (at
8
 
# your option) any later version.
9
 
#
10
 
# This program is distributed in the hope that it will be useful, but
11
 
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13
 
# General Public License for more details.
14
 
#
15
 
# You should have received a copy of the GNU General Public License
16
 
# along with this program; if not, write to the Free Software
17
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
18
 
# 02111-1307 USA.
19
 
 
20
 
_cdbs_scripts_path ?= /usr/lib/cdbs
21
 
_cdbs_rules_path ?= /usr/share/cdbs/1/rules
22
 
_cdbs_class_path ?= /usr/share/cdbs/1/class
23
 
 
24
 
ifndef _cdbs_rules_upstream_tarball
25
 
_cdbs_rules_upstream_tarball := 1
26
 
 
27
 
include $(_cdbs_rules_path)/buildvars.mk$(_cdbs_makefile_suffix)
28
 
 
29
 
CDBS_BUILD_DEPENDS := $(CDBS_BUILD_DEPENDS), cdbs (>= 0.4.39)
30
 
 
31
 
# Prefix for upstream location of all upstream tarballs (mandatory!)
32
 
#DEB_UPSTREAM_URL = 
33
 
 
34
 
DEB_UPSTREAM_PACKAGE = $(DEB_SOURCE_PACKAGE)
35
 
DEB_UPSTREAM_TARBALL_VERSION = $(if $(strip $(DEB_UPSTREAM_REPACKAGE_EXCLUDE)),$(DEB_UPSTREAM_VERSION:$(DEB_UPSTREAM_REPACKAGE_DELIMITER)$(DEB_UPSTREAM_REPACKAGE_TAG)=),$(DEB_UPSTREAM_VERSION))
36
 
DEB_UPSTREAM_TARBALL_EXTENSION = tar.gz
37
 
# Checksum to ensure integrity of downloadeds using get-orig-source (optional)
38
 
#DEB_UPSTREAM_TARBALL_MD5 = 
39
 
 
40
 
DEB_UPSTREAM_WORKDIR = ../tarballs
41
 
 
42
 
# Perl regexp to change locally used string into that in upstream URL and srcdir
43
 
#DEB_UPSTREAM_TARBALL_VERSION_MANGLE
44
 
cdbs_upstream_tarball_version_mangled = $(if $(strip $(DEB_UPSTREAM_TARBALL_VERSION_MANGLE)),$(shell echo '$(DEB_UPSTREAM_TARBALL_VERSION)' | perl -pe '$(DEB_UPSTREAM_TARBALL_VERSION_MANGLE)'),$(DEB_UPSTREAM_TARBALL_VERSION))
45
 
 
46
 
# Base filename (without extension) as used in upstream URL
47
 
DEB_UPSTREAM_TARBALL_BASENAME = $(DEB_UPSTREAM_PACKAGE)-$(cdbs_upstream_tarball_version_mangled)
48
 
 
49
 
# Base directory within tarball
50
 
DEB_UPSTREAM_TARBALL_SRCDIR = $(DEB_UPSTREAM_PACKAGE)-$(cdbs_upstream_tarball_version_mangled)
51
 
 
52
 
# Space-delimited list of directories and files to strip (optional)
53
 
#DEB_UPSTREAM_REPACKAGE_EXCLUDE = CVS .cvsignore doc/rfc*.txt doc/draft*.txt
54
 
DEB_UPSTREAM_REPACKAGE_TAG = dfsg
55
 
DEB_UPSTREAM_REPACKAGE_DELIMITER = ~
56
 
 
57
 
cdbs_upstream_tarball = $(DEB_UPSTREAM_TARBALL_BASENAME).$(DEB_UPSTREAM_TARBALL_EXTENSION)
58
 
cdbs_upstream_local_tarball = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_TARBALL_VERSION).orig.$(if $(findstring $(DEB_UPSTREAM_TARBALL_EXTENSION),tgz),tar.gz,$(DEB_UPSTREAM_TARBALL_EXTENSION))
59
 
cdbs_upstream_repackaged_basename = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_TARBALL_VERSION)$(DEB_UPSTREAM_REPACKAGE_DELIMITER)$(DEB_UPSTREAM_REPACKAGE_TAG).orig
60
 
cdbs_upstream_uncompressed_tarball = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_TARBALL_VERSION).orig.tar
61
 
 
62
 
# # These variables are deprecated
63
 
_cdbs_deprecated_vars += DEB_UPSTREAM_TARBALL DEB_UPSTREAM_LOCAL_TARBALL DEB_UPSTREAM_REPACKAGE_TARBALL
64
 
_cdbs_deprecated_vars += DEB_UPSTREAM_REPACKAGE_EXCLUDES
65
 
DEB_UPSTREAM_REPACKAGE_EXCLUDE += $(DEB_UPSTREAM_REPACKAGE_EXCLUDES)
66
 
 
67
 
print-version:
68
 
        @@echo "Debian version:          $(DEB_VERSION)"
69
 
        @@echo "Upstream version:        $(DEB_UPSTREAM_TARBALL_VERSION)"
70
 
 
71
 
get-orig-source:
72
 
        @@dh_testdir
73
 
        @@mkdir -p "$(DEB_UPSTREAM_WORKDIR)"
74
 
 
75
 
        @if [ ! -s "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ] ; then \
76
 
                if [ -f "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ] ; then \
77
 
                        rm "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ; \
78
 
                fi ; \
79
 
                echo "Downloading $(cdbs_upstream_local_tarball) from $(DEB_UPSTREAM_URL)/$(cdbs_upstream_tarball) ..." ; \
80
 
                wget -nv -T10 -t3 -O "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" "$(DEB_UPSTREAM_URL)/$(cdbs_upstream_tarball)" ; \
81
 
        else \
82
 
                echo "Upstream source tarball have been already downloaded: $(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ; \
83
 
        fi
84
 
 
85
 
        @md5current=`md5sum "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" | sed -e 's/ .*//'`; \
86
 
        if [ -n "$(DEB_UPSTREAM_TARBALL_MD5)" ] ; then \
87
 
                if [ "$$md5current" != "$(DEB_UPSTREAM_TARBALL_MD5)" ] ; then \
88
 
                        echo "Expecting upstream tarball md5sum $(DEB_UPSTREAM_TARBALL_MD5), but $$md5current found" ; \
89
 
                        echo "Upstream tarball md5sum is NOT trusted! Possible upstream tarball forge!" ; \
90
 
                        echo "Purging downloaded file. Try new download." ; \
91
 
                        rm -f "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ; \
92
 
                        false ; \
93
 
                else \
94
 
                        echo "Upstream tarball is trusted!" ; \
95
 
                fi; \
96
 
        else \
97
 
                echo "Upstream tarball NOT trusted (current md5sum is $$md5current)!" ; \
98
 
        fi
99
 
 
100
 
# TODO: Rewrite using make variables like cdbs_upstream_unpack_cmd and
101
 
# DEB_UPSTREAM_SUPPORTED_COMPRESSIONS (recent dpkg supports bz2)
102
 
        @untar="tar -x -C"; \
103
 
        case "$(cdbs_upstream_local_tarball)" in \
104
 
            *.tar.gz)  unpack="gunzip -c";; \
105
 
            *.tar.bz2) unpack="bunzip2 -c";    uncompress="bunzip2";; \
106
 
            *.tar.Z)   unpack="uncompress -c"; uncompress="uncompress";; \
107
 
            *.zip)     unpack="unzip -q";      uncompress="false";       untar="-d"; nopipe="true";; \
108
 
            *.tar)     unpack="cat";           uncompress="true";; \
109
 
            *) echo "Unknown extension for upstream tarball $(cdbs_upstream_local_tarball)"; false;; \
110
 
        esac && \
111
 
        if [ -n "$(strip $(DEB_UPSTREAM_REPACKAGE_EXCLUDE))" ] || [ "$$uncompress" = "false" ]; then \
112
 
                echo "Repackaging tarball ..." && \
113
 
                mkdir -p "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" && \
114
 
                if [ -n "$$nopipe" ]; then \
115
 
                        $$unpack "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" \
116
 
                                $$untar "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" $(patsubst %,--exclude='%',$(DEB_UPSTREAM_REPACKAGE_EXCLUDE)); \
117
 
                else \
118
 
                        $$unpack "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" \
119
 
                                | $$untar "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" $(patsubst %,--exclude='%',$(DEB_UPSTREAM_REPACKAGE_EXCLUDE)); \
120
 
                fi && \
121
 
                if [ "$(DEB_UPSTREAM_TARBALL_SRCDIR)" != "$(cdbs_upstream_repackaged_basename)" ]; then \
122
 
                        mv -T "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)/$(DEB_UPSTREAM_TARBALL_SRCDIR)" "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)/$(cdbs_upstream_repackaged_basename)"; \
123
 
                fi && \
124
 
                if [ -n "$(strip $(DEB_UPSTREAM_REPACKAGE_EXCLUDE))" ]; then \
125
 
                        GZIP=-9 tar -b1 -czf "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_repackaged_basename).tar.gz" -C "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" "$(cdbs_upstream_repackaged_basename)"; \
126
 
                else \
127
 
                        GZIP=-9 tar -b1 -czf "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_uncompressed_tarball).gz" -C "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" "$(cdbs_upstream_repackaged_basename)"; \
128
 
                fi && \
129
 
                echo "Cleaning up" && \
130
 
                rm -rf "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)"; \
131
 
        elif [ -n "$$uncompress" ]; then \
132
 
                echo "Recompressing tarball ..." && \
133
 
                $$uncompress "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)"; \
134
 
                gzip -9 "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_uncompressed_tarball)"; \
135
 
        fi
136
 
 
137
 
DEB_PHONY_RULES += print-version get-orig-source
138
 
 
139
 
endif