dpkg-buildpackage.pl 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. #!/usr/bin/perl
  2. #
  3. # dpkg-buildpackage
  4. #
  5. # Copyright © 1996 Ian Jackson
  6. # Copyright © 2000 Wichert Akkerman
  7. # Copyright © 2006-2010,2012-2013 Guillem Jover <guillem@debian.org>
  8. # Copyright © 2007 Frank Lichtenheld
  9. #
  10. # This program is free software; you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation; either version 2 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this program. If not, see <https://www.gnu.org/licenses/>.
  22. use strict;
  23. use warnings;
  24. use Carp;
  25. use Cwd;
  26. use File::Basename;
  27. use POSIX qw(:sys_wait_h);
  28. use Dpkg ();
  29. use Dpkg::Gettext;
  30. use Dpkg::ErrorHandling;
  31. use Dpkg::BuildOptions;
  32. use Dpkg::BuildProfiles qw(set_build_profiles);
  33. use Dpkg::Compression;
  34. use Dpkg::Checksums;
  35. use Dpkg::Version;
  36. use Dpkg::Control;
  37. use Dpkg::Changelog::Parse;
  38. use Dpkg::Path qw(find_command);
  39. use Dpkg::IPC;
  40. textdomain('dpkg-dev');
  41. sub showversion {
  42. printf _g("Debian %s version %s.\n"), $Dpkg::PROGNAME, $Dpkg::PROGVERSION;
  43. print _g('
  44. This is free software; see the GNU General Public License version 2 or
  45. later for copying conditions. There is NO warranty.
  46. ');
  47. }
  48. sub usage {
  49. printf _g(
  50. 'Usage: %s [<option>...]')
  51. . "\n\n" . _g(
  52. 'Options:
  53. -F (default) normal full build (binaries and sources).
  54. -b binary-only, do not build source.
  55. -B binary-only, no arch-indep files.
  56. -A binary-only, only arch-indep files.
  57. -S source-only, no binary files.
  58. -nc do not clean source tree (implies -b).
  59. -tc clean source tree when finished.
  60. -D (default) check build dependencies and conflicts.
  61. -d do not check build dependencies and conflicts.
  62. -P<profiles> assume given build profiles as active (comma-separated list).
  63. -R<rules> rules file to execute (default is debian/rules).
  64. -T<target> call debian/rules <target> with the proper environment.
  65. --as-root ensure -T calls the target with root rights.
  66. -j[<number>] specify jobs to run simultaneously (passed to <rules>).
  67. -r<gain-root-command>
  68. command to gain root privileges (default is fakeroot).
  69. --check-command=<check-command>
  70. command to check the .changes file (no default).
  71. --check-option=<opt>
  72. pass <opt> to <check-command>.
  73. -p<sign-command>
  74. command to sign .dsc and/or .changes files
  75. (default is gpg2 or gpg).
  76. -k<keyid> the key to use for signing.
  77. -ap add pause before starting signature process.
  78. -us unsigned source package.
  79. -uc unsigned .changes file.
  80. --force-sign
  81. force signing the resulting files.
  82. --admindir=<directory>
  83. change the administrative directory.
  84. -?, --help show this help message.
  85. --version show the version.')
  86. . "\n\n" . _g(
  87. 'Options passed to dpkg-architecture:
  88. -a<arch> Debian architecture we build for.
  89. -t<system> set GNU system type.')
  90. . "\n\n" . _g(
  91. 'Options passed to dpkg-genchanges:
  92. -si (default) source includes orig if new upstream.
  93. -sa uploaded source always includes orig.
  94. -sd uploaded source is diff and .dsc only.
  95. -v<version> changes since version <version>.
  96. -m<maint> maintainer for package is <maint>.
  97. -e<maint> maintainer for release is <maint>.
  98. -C<descfile> changes are described in <descfile>.
  99. --changes-option=<opt>
  100. pass option <opt> to dpkg-genchanges.')
  101. . "\n\n" . _g(
  102. 'Options passed to dpkg-source:
  103. -sn force Debian native source format.
  104. -s[sAkurKUR] see dpkg-source for explanation.
  105. -z<level> compression level to use for source.
  106. -Z<compressor> compression to use for source (gz|xz|bzip2|lzma).
  107. -i[<regex>] ignore diffs of files matching regex.
  108. -I[<pattern>] filter out files when building tarballs.
  109. --source-option=<opt>
  110. pass option <opt> to dpkg-source.
  111. '), $Dpkg::PROGNAME;
  112. }
  113. my $admindir;
  114. my @debian_rules = ('debian/rules');
  115. my @rootcommand = ();
  116. my $signcommand;
  117. my $noclean;
  118. my $cleansource;
  119. my $parallel;
  120. my $checkbuilddep = 1;
  121. my @checkbuilddep_opts;
  122. my @source_opts;
  123. my $check_command = $ENV{DEB_CHECK_COMMAND};
  124. my @check_opts;
  125. my $signpause;
  126. my $signkey = $ENV{DEB_SIGN_KEYID};
  127. my $signforce = 0;
  128. my $signreleased = 1;
  129. my $signsource = 1;
  130. my $signchanges = 1;
  131. my $buildtarget = 'build';
  132. my $binarytarget = 'binary';
  133. my $targetarch = '';
  134. my $targetgnusystem = '';
  135. my @build_profiles = ();
  136. my $call_target = '';
  137. my $call_target_as_root = 0;
  138. my $since;
  139. my $maint;
  140. my $changedby;
  141. my $desc;
  142. my @changes_opts;
  143. use constant BUILD_DEFAULT => 1;
  144. use constant BUILD_SOURCE => 2;
  145. use constant BUILD_ARCH_DEP => 4;
  146. use constant BUILD_ARCH_INDEP => 8;
  147. use constant BUILD_BINARY => BUILD_ARCH_DEP | BUILD_ARCH_INDEP;
  148. use constant BUILD_ALL => BUILD_BINARY | BUILD_SOURCE;
  149. my $include = BUILD_ALL | BUILD_DEFAULT;
  150. sub build_normal() { return ($include & BUILD_ALL) == BUILD_ALL; }
  151. sub build_sourceonly() { return $include == BUILD_SOURCE; }
  152. sub build_binaryonly() { return !($include & BUILD_SOURCE); }
  153. sub build_binaryindep() { return ($include == BUILD_ARCH_INDEP); }
  154. sub build_opt {
  155. if ($include == BUILD_BINARY) {
  156. return '-b';
  157. } elsif ($include == BUILD_ARCH_DEP) {
  158. return '-B';
  159. } elsif ($include == BUILD_ARCH_INDEP) {
  160. return '-A';
  161. } elsif ($include == BUILD_SOURCE) {
  162. return '-S';
  163. } else {
  164. croak "build_opt called with include=$include";
  165. }
  166. }
  167. my $build_opts = Dpkg::BuildOptions->new();
  168. if ($build_opts->has('nocheck')) {
  169. $check_command = undef;
  170. }
  171. while (@ARGV) {
  172. $_ = shift @ARGV;
  173. if (/^(--help|-\?)$/) {
  174. usage;
  175. exit 0;
  176. } elsif (/^--version$/) {
  177. showversion;
  178. exit 0;
  179. } elsif (/^--admindir$/) {
  180. $admindir = shift @ARGV;
  181. } elsif (/^--admindir=(.*)$/) {
  182. $admindir = $1;
  183. } elsif (/^--source-option=(.*)$/) {
  184. push @source_opts, $1;
  185. } elsif (/^--changes-option=(.*)$/) {
  186. push @changes_opts, $1;
  187. } elsif (/^-j(\d*)$/) {
  188. $parallel = $1 || '';
  189. } elsif (/^-r(.*)$/) {
  190. @rootcommand = split /\s+/, $1;
  191. } elsif (/^--check-command=(.*)$/) {
  192. $check_command = $1;
  193. } elsif (/^--check-option=(.*)$/) {
  194. push @check_opts, $1;
  195. } elsif (/^-p(.*)$/) {
  196. $signcommand = $1;
  197. } elsif (/^-k(.*)$/) {
  198. $signkey = $1;
  199. } elsif (/^-([dD])$/) {
  200. $checkbuilddep = ($1 eq 'D');
  201. } elsif (/^-s(gpg|pgp)$/) {
  202. # Deprecated option
  203. warning(_g('-s%s is deprecated; always using gpg style interface'), $1);
  204. } elsif (/^--force-sign$/) {
  205. $signforce = 1;
  206. } elsif (/^-us$/) {
  207. $signsource = 0;
  208. } elsif (/^-uc$/) {
  209. $signchanges = 0;
  210. } elsif (/^-ap$/) {
  211. $signpause = 1;
  212. } elsif (/^-a(.*)$/) {
  213. $targetarch = $1;
  214. } elsif (/^-P(.*)$/) {
  215. @build_profiles = split /,/, $1;
  216. } elsif (/^-s[iad]$/) {
  217. push @changes_opts, $_;
  218. } elsif (/^-(?:s[insAkurKUR]|[zZ].*|i.*|I.*)$/) {
  219. push @source_opts, $_; # passed to dpkg-source
  220. } elsif (/^-tc$/) {
  221. $cleansource = 1;
  222. } elsif (/^-t(.*)$/) {
  223. $targetgnusystem = $1; # Order DOES matter!
  224. } elsif (/^(--target|-T)$/) {
  225. $call_target = shift @ARGV;
  226. } elsif (/^(--target=|-T)(.+)$/) {
  227. $call_target = $2;
  228. } elsif (/^--as-root$/) {
  229. $call_target_as_root = 1;
  230. } elsif (/^-nc$/) {
  231. $noclean = 1;
  232. } elsif (/^-b$/) {
  233. usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
  234. if build_sourceonly;
  235. $include = BUILD_BINARY;
  236. push @changes_opts, '-b';
  237. @checkbuilddep_opts = ();
  238. $buildtarget = 'build';
  239. $binarytarget = 'binary';
  240. } elsif (/^-B$/) {
  241. usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
  242. if build_sourceonly;
  243. $include = BUILD_ARCH_DEP;
  244. push @changes_opts, '-B';
  245. @checkbuilddep_opts = qw(-B);
  246. $buildtarget = 'build-arch';
  247. $binarytarget = 'binary-arch';
  248. } elsif (/^-A$/) {
  249. usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
  250. if build_sourceonly;
  251. $include = BUILD_ARCH_INDEP;
  252. push @changes_opts, '-A';
  253. @checkbuilddep_opts = qw(-A);
  254. $buildtarget = 'build-indep';
  255. $binarytarget = 'binary-indep';
  256. } elsif (/^-S$/) {
  257. usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
  258. if build_binaryonly;
  259. $include = BUILD_SOURCE;
  260. push @changes_opts, '-S';
  261. @checkbuilddep_opts = qw(-A -B);
  262. } elsif (/^-F$/) {
  263. usageerr(_g('cannot combine %s and %s'), build_opt(), $_)
  264. if not build_normal;
  265. $include = BUILD_ALL;
  266. @checkbuilddep_opts = ();
  267. } elsif (/^-v(.*)$/) {
  268. $since = $1;
  269. } elsif (/^-m(.*)$/) {
  270. $maint = $1;
  271. } elsif (/^-e(.*)$/) {
  272. $changedby = $1;
  273. } elsif (/^-C(.*)$/) {
  274. $desc = $1;
  275. } elsif (m/^-[EW]$/) {
  276. # Deprecated option
  277. warning(_g('-E and -W are deprecated, they are without effect'));
  278. } elsif (/^-R(.*)$/) {
  279. @debian_rules = split /\s+/, $1;
  280. } else {
  281. usageerr(_g('unknown option or argument %s'), $_);
  282. }
  283. }
  284. if ($noclean) {
  285. # -nc without -b/-B/-A/-S/-F implies -b
  286. $include = BUILD_BINARY if ($include & BUILD_DEFAULT);
  287. }
  288. if ($< == 0) {
  289. warning(_g('using a gain-root-command while being root')) if (@rootcommand);
  290. } else {
  291. push @rootcommand, 'fakeroot' unless @rootcommand;
  292. }
  293. if (@rootcommand and not find_command($rootcommand[0])) {
  294. if ($rootcommand[0] eq 'fakeroot' and $< != 0) {
  295. error(_g("fakeroot not found, either install the fakeroot\n" .
  296. 'package, specify a command with the -r option, ' .
  297. 'or run this as root'));
  298. } else {
  299. error(_g("gain-root-commmand '%s' not found"), $rootcommand[0]);
  300. }
  301. }
  302. if ($check_command and not find_command($check_command)) {
  303. error(_g("check-commmand '%s' not found"), $check_command);
  304. }
  305. if ($signcommand) {
  306. if (!find_command($signcommand)) {
  307. error(_g("sign-commmand '%s' not found"), $signcommand);
  308. }
  309. } elsif (($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME}) ||
  310. ($ENV{HOME} && -e "$ENV{HOME}/.gnupg")) {
  311. if (find_command('gpg2')) {
  312. $signcommand = 'gpg2';
  313. } elsif (find_command('gpg')) {
  314. $signcommand = 'gpg';
  315. }
  316. }
  317. if (defined $parallel) {
  318. $parallel = $build_opts->get('parallel') if $build_opts->has('parallel');
  319. $ENV{MAKEFLAGS} ||= '';
  320. $ENV{MAKEFLAGS} .= " -j$parallel";
  321. $build_opts->set('parallel', $parallel);
  322. $build_opts->export();
  323. }
  324. set_build_profiles(@build_profiles) if @build_profiles;
  325. my $cwd = cwd();
  326. my $dir = basename($cwd);
  327. my $changelog = changelog_parse();
  328. my $pkg = mustsetvar($changelog->{source}, _g('source package'));
  329. my $version = mustsetvar($changelog->{version}, _g('source version'));
  330. my ($ok, $error) = version_check($version);
  331. error($error) unless $ok;
  332. (my $sversion = $version) =~ s/^\d+://;
  333. my $distribution = mustsetvar($changelog->{distribution}, _g('source distribution'));
  334. my $maintainer;
  335. if ($changedby) {
  336. $maintainer = $changedby;
  337. } elsif ($maint) {
  338. $maintainer = $maint;
  339. } else {
  340. $maintainer = mustsetvar($changelog->{maintainer}, _g('source changed by'));
  341. }
  342. open my $arch_env, '-|', 'dpkg-architecture', "-a$targetarch",
  343. "-t$targetgnusystem", '-f' or subprocerr('dpkg-architecture');
  344. while ($_ = <$arch_env>) {
  345. chomp;
  346. my ($key, $value) = split /=/, $_, 2;
  347. $ENV{$key} = $value;
  348. }
  349. close $arch_env or subprocerr('dpkg-architecture');
  350. my $arch;
  351. if (build_sourceonly) {
  352. $arch = 'source';
  353. } elsif (build_binaryindep) {
  354. $arch = 'all';
  355. } else {
  356. $arch = mustsetvar($ENV{DEB_HOST_ARCH}, _g('host architecture'));
  357. }
  358. my $pv = "${pkg}_$sversion";
  359. my $pva = "${pkg}_${sversion}_$arch";
  360. if (not $signcommand) {
  361. $signsource = 0;
  362. $signchanges = 0;
  363. } elsif ($signforce) {
  364. $signsource = 1;
  365. $signchanges = 1;
  366. } elsif (($signsource or $signchanges) and $distribution eq 'UNRELEASED') {
  367. $signreleased = 0;
  368. $signsource = 0;
  369. $signchanges = 0;
  370. }
  371. if ($signsource && build_binaryonly) {
  372. $signsource = 0;
  373. }
  374. #
  375. # Preparation of environment stops here
  376. #
  377. if (not -x 'debian/rules') {
  378. warning(_g('debian/rules is not executable; fixing that'));
  379. chmod(0755, 'debian/rules'); # No checks of failures, non fatal
  380. }
  381. unless ($call_target) {
  382. chdir('..') or syserr('chdir ..');
  383. withecho('dpkg-source', @source_opts, '--before-build', $dir);
  384. chdir($dir) or syserr("chdir $dir");
  385. }
  386. if ($checkbuilddep) {
  387. push @checkbuilddep_opts, "--admindir=$admindir" if $admindir;
  388. system('dpkg-checkbuilddeps', @checkbuilddep_opts);
  389. if (not WIFEXITED($?)) {
  390. subprocerr('dpkg-checkbuilddeps');
  391. } elsif (WEXITSTATUS($?)) {
  392. warning(_g('build dependencies/conflicts unsatisfied; aborting'));
  393. warning(_g('(Use -d flag to override.)'));
  394. if (build_sourceonly) {
  395. warning(_g('this is currently a non-fatal warning with -S, but ' .
  396. 'will probably become fatal in the future'));
  397. } else {
  398. exit 3;
  399. }
  400. }
  401. }
  402. if ($call_target) {
  403. if ($call_target_as_root or
  404. $call_target =~ /^(clean|binary(|-arch|-indep))$/)
  405. {
  406. withecho(@rootcommand, @debian_rules, $call_target);
  407. } else {
  408. withecho(@debian_rules, $call_target);
  409. }
  410. exit 0;
  411. }
  412. unless ($noclean) {
  413. withecho(@rootcommand, @debian_rules, 'clean');
  414. }
  415. if ($include & BUILD_SOURCE) {
  416. warning(_g('building a source package without cleaning up as you asked; ' .
  417. 'it might contain undesired files')) if $noclean;
  418. chdir('..') or syserr('chdir ..');
  419. withecho('dpkg-source', @source_opts, '-b', $dir);
  420. chdir($dir) or syserr("chdir $dir");
  421. }
  422. if ($buildtarget ne 'build' and scalar(@debian_rules) == 1) {
  423. # Verify that build-{arch,indep} are supported. If not, fallback to build.
  424. # This is a temporary measure to not break too many packages on a flag day.
  425. my $pid = spawn(exec => [ 'make', '-f', @debian_rules, '-qn', $buildtarget ],
  426. from_file => '/dev/null', to_file => '/dev/null',
  427. error_to_file => '/dev/null');
  428. my $cmdline = "make -f @debian_rules -qn $buildtarget";
  429. wait_child($pid, nocheck => 1, cmdline => $cmdline);
  430. my $exitcode = WEXITSTATUS($?);
  431. subprocerr($cmdline) unless WIFEXITED($?);
  432. if ($exitcode == 2) {
  433. warning(_g("%s must be updated to support the 'build-arch' and " .
  434. "'build-indep' targets (at least '%s' seems to be " .
  435. 'missing)'), "@debian_rules", $buildtarget);
  436. $buildtarget = 'build';
  437. }
  438. }
  439. if ($include & BUILD_BINARY) {
  440. withecho(@debian_rules, $buildtarget);
  441. withecho(@rootcommand, @debian_rules, $binarytarget);
  442. }
  443. push @changes_opts, "-m$maint" if defined $maint;
  444. push @changes_opts, "-e$changedby" if defined $changedby;
  445. push @changes_opts, "-v$since" if defined $since;
  446. push @changes_opts, "-C$desc" if defined $desc;
  447. my $chg = "../$pva.changes";
  448. my $changes = Dpkg::Control->new(type => CTRL_FILE_CHANGES);
  449. print { *STDERR } " dpkg-genchanges @changes_opts >$chg\n";
  450. open my $changes_fh, '-|', 'dpkg-genchanges', @changes_opts
  451. or subprocerr('dpkg-genchanges');
  452. $changes->parse($changes_fh, _g('parse changes file'));
  453. $changes->save($chg);
  454. close $changes_fh or subprocerr(_g('dpkg-genchanges'));
  455. if ($cleansource) {
  456. withecho(@rootcommand, @debian_rules, 'clean');
  457. }
  458. chdir('..') or syserr('chdir ..');
  459. withecho('dpkg-source', @source_opts, '--after-build', $dir);
  460. chdir($dir) or syserr("chdir $dir");
  461. printf "$Dpkg::PROGNAME: %s\n", describe_build($changes->{'Files'});
  462. if ($check_command) {
  463. withecho($check_command, @check_opts, $chg);
  464. }
  465. if ($signpause && ($signchanges || $signsource)) {
  466. print _g("Press the return key to start signing process\n");
  467. getc();
  468. }
  469. if ($signsource) {
  470. if (signfile("$pv.dsc")) {
  471. error(_g('failed to sign .dsc and .changes file'));
  472. }
  473. # Recompute the checksums as the .dsc has changed now.
  474. my $checksums = Dpkg::Checksums->new();
  475. $checksums->add_from_control($changes);
  476. $checksums->add_from_file("../$pv.dsc", update => 1, key => "$pv.dsc");
  477. $checksums->export_to_control($changes);
  478. delete $changes->{'Checksums-Md5'};
  479. my $md5sum_regex = checksums_get_property('md5', 'regex');
  480. my $dsc_md5sum = $checksums->get_checksum("$pv.dsc", 'md5');
  481. my $dsc_size = $checksums->get_size("$pv.dsc");
  482. my $dsc_files_regex = qr/$md5sum_regex\s+\d+\s+(\S+\s+\S+\s+$pv\.dsc)/;
  483. $changes->{'Files'} =~ s/^$dsc_files_regex$/$dsc_md5sum $dsc_size $1/m;
  484. $changes->save($chg);
  485. }
  486. if ($signchanges && signfile("$pva.changes")) {
  487. error(_g('failed to sign .changes file'));
  488. }
  489. if (not $signreleased) {
  490. warning(_g('not signing UNRELEASED build; use --force-sign to override'));
  491. }
  492. sub mustsetvar {
  493. my ($var, $text) = @_;
  494. error(_g('unable to determine %s'), $text)
  495. unless defined($var);
  496. print "$Dpkg::PROGNAME: $text $var\n";
  497. return $var;
  498. }
  499. sub withecho {
  500. print { *STDERR } " @_\n";
  501. system(@_)
  502. and subprocerr("@_");
  503. }
  504. sub signfile {
  505. my ($file) = @_;
  506. print { *STDERR } " signfile $file\n";
  507. my $qfile = quotemeta($file);
  508. system("(cat ../$qfile ; echo '') | " .
  509. "$signcommand --utf8-strings --local-user " .
  510. quotemeta($signkey || $maintainer) .
  511. " --clearsign --armor --textmode > ../$qfile.asc");
  512. my $status = $?;
  513. unless ($status) {
  514. system('mv', '--', "../$file.asc", "../$file")
  515. and subprocerr('mv');
  516. } else {
  517. system('rm', '-f', "../$file.asc")
  518. and subprocerr('rm -f');
  519. }
  520. print "\n";
  521. return $status
  522. }
  523. sub fileomitted {
  524. my ($files, $regex) = @_;
  525. return $files !~ /$regex/
  526. }
  527. sub describe_build {
  528. my ($files) = @_;
  529. my $ext = compression_get_file_extension_regex();
  530. if (fileomitted($files, qr/\.deb/)) {
  531. # source-only upload
  532. if (fileomitted($files, qr/\.diff\.$ext/) and
  533. fileomitted($files, qr/\.debian\.tar\.$ext/)) {
  534. return _g('source-only upload: Debian-native package');
  535. } elsif (fileomitted($files, qr/\.orig\.tar\.$ext/)) {
  536. return _g('source-only, diff-only upload (original source NOT included)');
  537. } else {
  538. return _g('source-only upload (original source is included)');
  539. }
  540. } elsif (fileomitted($files, qr/\.dsc/)) {
  541. return _g('binary-only upload (no source included)');
  542. } elsif (fileomitted($files, qr/\.diff\.$ext/) and
  543. fileomitted($files, qr/\.debian\.tar\.$ext/)) {
  544. return _g('full upload; Debian-native package (full source is included)');
  545. } elsif (fileomitted($files, qr/\.orig\.tar\.$ext/)) {
  546. return _g('binary and diff upload (original source NOT included)');
  547. } else {
  548. return _g('full upload (original source is included)');
  549. }
  550. }