Commit 5f6e4faa authored by Andrew Lee (李健秋)'s avatar Andrew Lee (李健秋)
Browse files

Added forward ported reprepro support.

Differential Revision: https://phabricator.collabora.co.uk/D1111
parent b706c4c2
From 84b142833b22c50b233d39f0290c7b826562a405 Mon Sep 17 00:00:00 2001
From: Hector Oron <hector.oron@collabora.co.uk>
Date: Fri, 22 Mar 2013 14:58:44 +0100
Subject: Add --ignore=unusedarch to reprepro params
When including changes files that contain architecture specific udeb, but
architecture independent deb packages, reprepro needs to pass
--ignore=unusedarch to get those binaries included into repository.
Signed-off-by: Hector Oron <hector.oron@collabora.co.uk>
--- a/src/backend/bs_publish
+++ b/src/backend/bs_publish
@@ -630,6 +630,7 @@
qsystem ('reprepro', '-b', $repo,
'--ignore=wrongdistribution',
'--ignore=updatedarchall',
+ '--ignore=unusedarch',
'-C', $component,
'include', $codename,
"$extrep/$f");
From 290f0dcd30fac56cc9de142598beba34dbe19f58 Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Date: Tue, 8 Jan 2013 15:30:15 +0100
Subject: Add global configuration for a shared reprepro managed repository
Allow configuration in BSConfig to configure a shared reprepro managed
repository. All other repositories will use standard OBS mechanism to
minimize complexity (Given these are mostly home branches which are
small anyway)
--- a/src/backend/bs_publish
+++ b/src/backend/bs_publish
@@ -617,6 +617,33 @@
qsystem('rm', '-rf', "$extrep/descr") if -d "$extrep/descr";
}
+sub updaterepo_reprepro {
+ my ($prp, $extrep, @changed) = @_;
+
+ my $repo = "$extrepodir/$BSConfig::reprepository->{$prp}{'repository'}";
+ my $codename = $BSConfig::reprepository->{$prp}{'codename'};
+ my $component = $BSConfig::reprepository->{$prp}{'component'};
+
+ for my $f (@changed) {
+ if ($f =~ /\.changes/) {
+ print " Updated changes file => $f\n" ;
+ qsystem ('reprepro', '-b', $repo,
+ '--ignore=wrongdistribution',
+ '--ignore=updatedarchall',
+ '-C', $component,
+ 'include', $codename,
+ "$extrep/$f");
+ } elsif ($f =~ /\.dsc/) {
+ print " Updated dsc file => $f\n" ;
+ qsystem ('reprepro', '-b', $repo,
+ '-C', $component,
+ '-P', 'standard',
+ '-S', 'main',
+ 'includedsc', $codename, "$extrep/$f");
+ }
+ }
+}
+
sub createrepo_debian {
my ($extrep, $projid, $repoid, $data, $options) = @_;
@@ -1596,6 +1623,7 @@
my @db_deleted; # for published db update
my @db_changed; # for published db update
my @changed; # all changed files for hooks.
+ my @deleted; # All deleted files for hooks.
my %bins_done;
@archs = sort(ls($extrep));
@@ -1618,6 +1646,7 @@
unlink("$r/$bin") || die("unlink $r/$bin: $!\n");
push @db_deleted, $p if $p =~ /\.(?:$binsufsre)$/;
$changed = 1;
+ push @deleted, $p;
next;
}
if ("$s[9]/$s[7]/$s[1]" ne $bins_id{$p}) {
@@ -2053,7 +2082,11 @@
deleterepo_hdlist2($extrep, $projid, $xrepoid, $data);
}
if ($repotype{'debian'}) {
- createrepo_debian($extrep, $projid, $xrepoid, $data, $repotype{'debian'});
+ if ($BSConfig::reprepository && $BSConfig::reprepository->{$prp}) {
+ updaterepo_reprepro($prp, $extrep, @changed)
+ } else {
+ createrepo_debian($extrep, $projid, $xrepoid, $data, $repotype{'debian'});
+ }
} else {
deleterepo_debian($extrep, $projid, $xrepoid, $data);
}
From e98ba27f95a2c137fe836bf342de427916df9f5a Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Wed, 18 Dec 2013 20:01:01 +0000
Subject: BSConfig.pm.template: include a skeleton reprepro setup
Bug: Collabora #397
Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
--- a/src/backend/BSConfig.pm.template
+++ b/src/backend/BSConfig.pm.template
@@ -202,6 +202,25 @@
# 'main' => 'http://main-backend-server:5252',
# };
+# Manage these projects' repositories with reprepro instead of using
+# dpkg-scanpackages/dpkg-scansources. Before enabling this, you will
+# need to create /srv/obs/repos/shared/exampledistro/
+# with a paragraph in its conf/distributions file containing
+# "Codename: examplesuite" and "Components: examplecomponent othercomponent"
+#
+#our $reprepository = {
+# "exampledistro:examplesuite:examplecomponent/debian_wheezy_main_main" => {
+# "repository" => "shared/exampledistro",
+# "codename" => "examplesuite",
+# "component" => "examplecomponent",
+# },
+# "exampledistro:examplesuite:othercomponent/debian_wheezy_main_main" => {
+# "repository" => "shared/exampledistro",
+# "codename" => "examplesuite",
+# "component" => "othercomponent",
+# },
+#};
+
# host specific configs
my $hostconfig = __FILE__;
$hostconfig =~ s/[^\/]*$/bsconfig.$hostname/;
From a5aaa426ad49246015e2b995ffa2ba9f9f9a791f Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Tue, 17 Dec 2013 16:54:48 +0000
Subject: Include ddebs in reprepro too, and fix inclusion of udebs
We previously looked for Package-Type: in the .changes file to
decide whether it included udebs, but that doesn't work: Package-Type
only appears in the binary package control data (DEBIAN/control).
Parse the binary packages' filenames instead.
Bug: Collabora #397
Reviewed-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
--- a/src/backend/bs_publish
+++ b/src/backend/bs_publish
@@ -627,21 +627,42 @@
for my $f (@changed) {
if ($f =~ /\.changes/) {
print " Updated changes file => $f\n" ;
- qsystem ('reprepro', '-b', $repo,
- '--ignore=wrongdistribution',
- '--ignore=updatedarchall',
- '--ignore=unusedarch',
- '-T', 'deb',
- '-C', $component,
- 'include', $codename,
- "$extrep/$f");
- if (qsystem ('grep', '-q', '^Package-Type:.*',
- "$extrep/$f") == 0) {
+ my %types;
+ if (open (my $fh, '<', "$extrep/$f")) {
+ # Read the .changes file looking for binary packages
+ # (.deb, .udeb, .ddeb)
+ my $in_files = 0;
+ while (my $line = <$fh>) {
+ if ($in_files) {
+ if ($line =~ /^\s/) {
+ if ($line =~ /\.((?:|u|d)deb)$/) {
+ $types{$1} = 1;
+ }
+ } else {
+ $in_files = 0;
+ }
+ } elsif ($line =~ /^Files\s*:/) {
+ $in_files = 1;
+ }
+ }
+ } else {
+ print " unable to open $extrep/$f: $!\n";
+ }
+
+ if (!%types) {
+ # no binary packages at all? assume we must have mis-parsed it,
+ # and run reprepro for the .deb files so we get a better
+ # error report
+ %types = (deb => 1);
+ }
+
+ foreach my $type (keys %types) {
+
qsystem ('reprepro', '-b', $repo,
'--ignore=wrongdistribution',
'--ignore=updatedarchall',
'--ignore=unusedarch',
- '-T', 'udeb',
+ '-T', $type,
'-C', $component,
'include', $codename,
"$extrep/$f");
From c59be3deddd70f6a99eb803112aeb86b45396461 Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Date: Mon, 2 Dec 2013 15:15:50 +0100
Subject: Seperately include debs and udebs into reprepro
Split out the calls for including debs and udebs into reprepro. This
ensure the deb package still get properly included if the udeb isn't
available (mostly for older builds)
--- a/src/backend/bs_publish
+++ b/src/backend/bs_publish
@@ -631,10 +631,21 @@
'--ignore=wrongdistribution',
'--ignore=updatedarchall',
'--ignore=unusedarch',
- '-T', 'deb|udeb',
+ '-T', 'deb',
'-C', $component,
'include', $codename,
"$extrep/$f");
+ if (qsystem ('grep', '-q', '^Package-Type:.*',
+ "$extrep/$f") == 0) {
+ qsystem ('reprepro', '-b', $repo,
+ '--ignore=wrongdistribution',
+ '--ignore=updatedarchall',
+ '--ignore=unusedarch',
+ '-T', 'udeb',
+ '-C', $component,
+ 'include', $codename,
+ "$extrep/$f");
+ }
} elsif ($f =~ /\.dsc/) {
print " Updated dsc file => $f\n" ;
qsystem ('reprepro', '-b', $repo,
From 4e5b72258d098901ee6f88ed3842a8a637349381 Mon Sep 17 00:00:00 2001
From: Simon McVittie <simon.mcvittie@collabora.co.uk>
Date: Mon, 10 Feb 2014 15:03:37 +0000
Subject: bs_publish: improve logging for reprepro invocations
--- a/src/backend/bs_publish
+++ b/src/backend/bs_publish
@@ -633,6 +633,8 @@
# (.deb, .udeb, .ddeb)
my $in_files = 0;
while (my $line = <$fh>) {
+ print " $line";
+
if ($in_files) {
if ($line =~ /^\s/) {
if ($line =~ /\.((?:|u|d)deb)$/) {
@@ -653,12 +655,13 @@
# no binary packages at all? assume we must have mis-parsed it,
# and run reprepro for the .deb files so we get a better
# error report
+ print " warning: no .deb/.udeb/.ddeb found in .changes, assuming .deb only\n";
%types = (deb => 1);
}
foreach my $type (keys %types) {
- qsystem ('reprepro', '-b', $repo,
+ my @args = ('reprepro', '-b', $repo,
'--ignore=wrongdistribution',
'--ignore=updatedarchall',
'--ignore=unusedarch',
@@ -666,14 +669,18 @@
'-C', $component,
'include', $codename,
"$extrep/$f");
+ print(" importing .$type binaries: ", join(' ', @args), "\n");
+ qsystem(@args);
}
} elsif ($f =~ /\.dsc/) {
print " Updated dsc file => $f\n" ;
- qsystem ('reprepro', '-b', $repo,
+ my @args = ('reprepro', '-b', $repo,
'-C', $component,
'-P', 'standard',
'-S', 'main',
'includedsc', $codename, "$extrep/$f");
+ print(" importing sources: ", join(' ', @args), "\n");
+ qsystem(@args);
}
}
}
From 5c61a1a298e1febd6f605666469e229b349a8de2 Mon Sep 17 00:00:00 2001
From: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
Date: Mon, 21 Oct 2013 10:11:25 +0200
Subject: publish: Also accept udebs into reprepro repositories
--- a/src/backend/bs_publish
+++ b/src/backend/bs_publish
@@ -631,6 +631,7 @@
'--ignore=wrongdistribution',
'--ignore=updatedarchall',
'--ignore=unusedarch',
+ '-T', 'deb|udeb',
'-C', $component,
'include', $codename,
"$extrep/$f");
@@ -1466,7 +1467,7 @@
if ($bin =~ /^.+-[^-]+-[^-]+\.([a-zA-Z][^\/\.\-]*)\.d?rpm$/) {
$p = "$1/$bin";
$p = $1 eq 'src' || $1 eq 'nosrc' ? "SRPMS/$bin" : "RPMS/$bin" if $repotype{'resarchhack'};
- } elsif ($bin =~ /^.+_[^_]+_([^_\.]+)\.deb$/) {
+ } elsif ($bin =~ /^.+_[^_]+_([^_\.]+)\.u+deb$/) {
$p = "$1/$bin";
} elsif ($bin =~ /\.exe$/) {
$p = "$bin";
From 872f77567f739de672fa2910e3c2e66d1a80b9ce Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?H=C3=A9ctor=20Or=C3=B3n=20Mart=C3=ADnez?=
<hector.oron@collabora.co.uk>
Date: Tue, 21 Jun 2016 16:20:28 +0200
Subject: publisher: reprepro: set surprising binary
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
surprising binary needs to be passed to reprepro to be able to accept
dbgsym packages.
Signed-off-by: Héctor Orón Martínez <hector.oron@collabora.co.uk>
--- a/src/backend/bs_publish
+++ b/src/backend/bs_publish
@@ -665,6 +665,7 @@
'--ignore=wrongdistribution',
'--ignore=updatedarchall',
'--ignore=unusedarch',
+ '--ignore=surprisingbinary',
'-T', $type,
'-C', $component,
'include', $codename,
......@@ -15,3 +15,11 @@ missing-codemirror-js.patch
Do-not-ship-database.yml.patch
localgem.patch
disable-slp.patch
Add_global_configuration_for_a_shared_reprepro.patch
Add_--ignore=unusedarch_to_reprepro_params.patch
publish_Also_accept_udebs_into_reprepro_repository.patch
Seperately_include_debs_and_udebs_into_reprepro.patch
BSConfig.pm.template_include_a_skeleton_reprepro.patch
Include_ddebs_in_reprepro_too_and_fix_inclusion_of_udebs.patch
bs_publish_improve-logging_for_reprepro_invocations.patch
publisher_reprepro_set_surprising_binary.patch
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment