Skip to content

Commit

Permalink
Patch debrebuild to add sleep (google#345)
Browse files Browse the repository at this point in the history
  • Loading branch information
wbxyz authored Feb 14, 2025
1 parent 9a52bd4 commit 1819abc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
17 changes: 16 additions & 1 deletion pkg/rebuild/debian/strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
package debian

import (
"encoding/base64"
"fmt"
"path"
"regexp"

Expand Down Expand Up @@ -81,6 +83,9 @@ func (b *Debrebuild) ToWorkflow() *rebuild.WorkflowStrategy {
"buildinfoMd5": b.BuildInfo.MD5,
},
}},
Deps: []flow.Step{{
Uses: "debian/deps/patch-debrebuild",
}},
Build: []flow.Step{{
Uses: "debian/build/debrebuild",
With: map[string]string{
Expand Down Expand Up @@ -137,6 +142,16 @@ var toolkit = []*flow.Tool{
Needs: []string{},
}},
},
{
Name: "debian/deps/patch-debrebuild",
Steps: []flow.Step{{
Runs: fmt.Sprintf(`echo %s | base64 -d | patch /usr/bin/debrebuild`, base64.StdEncoding.EncodeToString([]byte(`@@ -725,2 +725,3 @@
),
+ '--customize-hook=sleep 10',
'--customize-hook=chroot "$1" sh -c "'`))),
Needs: []string{"devscripts=2.25.2"},
}},
},
{
Name: "debian/build/handle-binary-version",
Steps: []flow.Step{{
Expand Down Expand Up @@ -169,7 +184,7 @@ var toolkit = []*flow.Tool{
Steps: []flow.Step{
{
Runs: "debrebuild --buildresult=./out --builder=mmdebstrap {{ .With.buildinfo }}",
Needs: []string{"devscripts", "apt-utils", "mmdebstrap"},
Needs: []string{"devscripts=2.25.2", "apt-utils", "mmdebstrap"},
},
{
Uses: "debian/build/handle-binary-version",
Expand Down
6 changes: 4 additions & 2 deletions pkg/rebuild/debian/strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ func TestDebrebuild(t *testing.T) {
env: rebuild.BuildEnv{},
want: rebuild.Instructions{
Source: `wget https://buildinfos.debian.net/buildinfo-pool/a/acl/acl_2.3.2-2_amd64.buildinfo`,
Deps: `echo QEAgLTcyNSwyICs3MjUsMyBAQAogICAgICAgICApLAorICAgICAgICAnLS1jdXN0b21pemUtaG9vaz1zbGVlcCAxMCcsCiAgICAgICAgICctLWN1c3RvbWl6ZS1ob29rPWNocm9vdCAiJDEiIHNoIC1jICIn | base64 -d | patch /usr/bin/debrebuild`,
Build: `debrebuild --buildresult=./out --builder=mmdebstrap acl_2.3.2-2_amd64.buildinfo`,
OutputPath: "acl_2.3.1-3_amd64.deb",
SystemDeps: []string{"wget", "devscripts", "apt-utils", "mmdebstrap"},
SystemDeps: []string{"wget", "devscripts=2.25.2", "apt-utils", "mmdebstrap"},
},
},
{
Expand All @@ -188,10 +189,11 @@ func TestDebrebuild(t *testing.T) {
env: rebuild.BuildEnv{},
want: rebuild.Instructions{
Source: `wget https://buildinfos.debian.net/buildinfo-pool/a/acl/acl_2.3.2-2+b1_amd64.buildinfo`,
Deps: `echo QEAgLTcyNSwyICs3MjUsMyBAQAogICAgICAgICApLAorICAgICAgICAnLS1jdXN0b21pemUtaG9vaz1zbGVlcCAxMCcsCiAgICAgICAgICctLWN1c3RvbWl6ZS1ob29rPWNocm9vdCAiJDEiIHNoIC1jICIn | base64 -d | patch /usr/bin/debrebuild`,
Build: `debrebuild --buildresult=./out --builder=mmdebstrap acl_2.3.2-2+b1_amd64.buildinfo
mv /src/acl_2.3.1-3_amd64.deb /src/acl_2.3.1-3+b1_amd64.deb`,
OutputPath: "acl_2.3.1-3+b1_amd64.deb",
SystemDeps: []string{"wget", "devscripts", "apt-utils", "mmdebstrap"},
SystemDeps: []string{"wget", "devscripts=2.25.2", "apt-utils", "mmdebstrap"},
},
},
}
Expand Down

0 comments on commit 1819abc

Please sign in to comment.