Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions make.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,29 +511,6 @@ func createGitRepository(debsrc, gopkg, orig string, u *upstream,
return dir, fmt.Errorf("import-orig: %w", err)
}

{
f, err := os.OpenFile(filepath.Join(dir, ".gitignore"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
return dir, fmt.Errorf("open .gitignore: %w", err)
}
// Beginning newline in case the file already exists and lacks a newline
// (not all editors enforce a newline at the end of the file):
if _, err := f.Write([]byte("\n/.pc/\n/_build/\n")); err != nil {
return dir, fmt.Errorf("write to .gitignore: %w", err)
}
if err := f.Close(); err != nil {
return dir, fmt.Errorf("close .gitignore: %w", err)
}
}

if err := runGitCommandIn(dir, "add", ".gitignore"); err != nil {
return dir, fmt.Errorf("git add .gitignore: %w", err)
}

if err := runGitCommandIn(dir, "commit", "-m", "Ignore _build and quilt .pc dirs via .gitignore"); err != nil {
return dir, fmt.Errorf("git commit (.gitignore): %w", err)
}

return dir, nil
}

Expand Down
7 changes: 6 additions & 1 deletion template.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func writeDebianGitIgnore(dir, debLib, debProg string, pkgType packageType) erro
fmt.Fprintf(f, "*.log\n")
fmt.Fprintf(f, "*.substvars\n")
fmt.Fprintf(f, "/.debhelper/\n")
fmt.Fprintf(f, "/.build/\n")
fmt.Fprintf(f, "/debhelper-build-stamp\n")
fmt.Fprintf(f, "/files\n")

Expand Down Expand Up @@ -299,7 +300,11 @@ func writeDebianRules(dir string, pkgType packageType) error {
fmt.Fprintf(f, "#!/usr/bin/make -f\n")
fmt.Fprintf(f, "\n")
fmt.Fprintf(f, "%%:\n")
fmt.Fprintf(f, "\tdh $@ --builddirectory=_build --buildsystem=golang\n")
fmt.Fprintf(f, "\tdh $@ --builddirectory=debian/.build/upstream --buildsystem=golang\n")
// Note: The above `--builddirectory=debian/.build/upstream` will eventually be obsolete
// in 2028+ then the dh-golang version 1.64+ that has merged
// https://salsa.debian.org/go-team/packages/dh-golang/-/merge_requests/26

if pkgType == typeProgram {
fmt.Fprintf(f, "\n")
fmt.Fprintf(f, "override_dh_auto_install:\n")
Expand Down