~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

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

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# -*- mode: makefile; coding: utf-8 -*-
2
 
# Copyright © 2007 Jonas Smedegaard <dr@jones.dk>
 
2
# Copyright © 2007-2008 Jonas Smedegaard <dr@jones.dk>
3
3
# Description: Convenience rules for dealing with upstream tarballs
4
4
#
5
5
# This program is free software; you can redistribute it and/or
30
30
 
31
31
# Prefix for upstream location of all upstream tarballs (mandatory!)
32
32
#DEB_UPSTREAM_URL = 
 
33
 
33
34
DEB_UPSTREAM_PACKAGE = $(DEB_SOURCE_PACKAGE)
34
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))
35
 
DEB_UPSTREAM_TARBALL_BASENAME = $(DEB_UPSTREAM_PACKAGE)-$(DEB_UPSTREAM_TARBALL_VERSION)
36
36
DEB_UPSTREAM_TARBALL_EXTENSION = tar.gz
37
37
# Checksum to ensure integrity of downloadeds using get-orig-source (optional)
38
38
#DEB_UPSTREAM_TARBALL_MD5 = 
39
39
 
40
40
DEB_UPSTREAM_WORKDIR = ../tarballs
41
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
 
42
49
# Base directory within tarball
43
 
DEB_UPSTREAM_TARBALL_SRCDIR = $(DEB_UPSTREAM_PACKAGE)-$(DEB_UPSTREAM_TARBALL_VERSION)
 
50
DEB_UPSTREAM_TARBALL_SRCDIR = $(DEB_UPSTREAM_PACKAGE)-$(cdbs_upstream_tarball_version_mangled)
44
51
 
45
52
# Space-delimited list of directories and files to strip (optional)
46
53
#DEB_UPSTREAM_REPACKAGE_EXCLUDE = CVS .cvsignore doc/rfc*.txt doc/draft*.txt
47
54
DEB_UPSTREAM_REPACKAGE_TAG = dfsg
48
 
DEB_UPSTREAM_REPACKAGE_DELIMITER = .
 
55
DEB_UPSTREAM_REPACKAGE_DELIMITER = ~
49
56
 
50
57
cdbs_upstream_tarball = $(DEB_UPSTREAM_TARBALL_BASENAME).$(DEB_UPSTREAM_TARBALL_EXTENSION)
51
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))
52
 
cdbs_upstream_repackaged_tarball = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_TARBALL_VERSION)$(DEB_UPSTREAM_REPACKAGE_DELIMITER)$(DEB_UPSTREAM_REPACKAGE_TAG).orig.tar.gz
 
59
cdbs_upstream_repackaged_basename = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_TARBALL_VERSION)$(DEB_UPSTREAM_REPACKAGE_DELIMITER)$(DEB_UPSTREAM_REPACKAGE_TAG).orig
53
60
cdbs_upstream_uncompressed_tarball = $(DEB_SOURCE_PACKAGE)_$(DEB_UPSTREAM_TARBALL_VERSION).orig.tar
54
61
 
55
62
# # These variables are deprecated
70
77
                        rm "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ; \
71
78
                fi ; \
72
79
                echo "Downloading $(cdbs_upstream_local_tarball) from $(DEB_UPSTREAM_URL)/$(cdbs_upstream_tarball) ..." ; \
73
 
                wget -N -nv -T10 -t3 -O "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" "$(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)" ; \
74
81
        else \
75
82
                echo "Upstream source tarball have been already downloaded: $(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" ; \
76
83
        fi
90
97
                echo "Upstream tarball NOT trusted (current md5sum is $$md5current)!" ; \
91
98
        fi
92
99
 
93
 
        @case "$(cdbs_upstream_local_tarball)" in \
 
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 \
94
104
            *.tar.gz)  unpack="gunzip -c";; \
95
105
            *.tar.bz2) unpack="bunzip2 -c";    uncompress="bunzip2";; \
96
106
            *.tar.Z)   unpack="uncompress -c"; uncompress="uncompress";; \
 
107
            *.zip)     unpack="unzip -q";      uncompress="false";       untar="-d"; nopipe="true";; \
97
108
            *.tar)     unpack="cat";           uncompress="true";; \
98
109
            *) echo "Unknown extension for upstream tarball $(cdbs_upstream_local_tarball)"; false;; \
99
110
        esac && \
100
 
        if [ -n "$(strip $(DEB_UPSTREAM_REPACKAGE_EXCLUDE))" ]; then \
 
111
        if [ -n "$(strip $(DEB_UPSTREAM_REPACKAGE_EXCLUDE))" ] || [ "$$uncompress" = "false" ]; then \
101
112
                echo "Repackaging tarball ..." && \
102
113
                mkdir -p "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" && \
103
 
                $$unpack "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)" \
104
 
                        | tar -x -C "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" $(patsubst %,--exclude='%',$(DEB_UPSTREAM_REPACKAGE_EXCLUDE)) && \
105
 
                GZIP=-9 tar -b1 -czf "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_repackaged_tarball)" -C "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)" $(DEB_UPSTREAM_TARBALL_SRCDIR) && \
 
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 && \
106
129
                echo "Cleaning up" && \
107
130
                rm -rf "$(DEB_UPSTREAM_WORKDIR)/$(DEB_UPSTREAM_REPACKAGE_TAG)"; \
108
131
        elif [ -n "$$uncompress" ]; then \
109
132
                echo "Recompressing tarball ..." && \
110
133
                $$uncompress "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_local_tarball)"; \
111
 
                bzip -9 "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_uncompressed_tarball)"; \
 
134
                gzip -9 "$(DEB_UPSTREAM_WORKDIR)/$(cdbs_upstream_uncompressed_tarball)"; \
112
135
        fi
113
136
 
114
137
DEB_PHONY_RULES += print-version get-orig-source