Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop modifying upstream .gitignore file and put build artifacts in debian/build/ #230

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
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 @@ -516,29 +516,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
3 changes: 2 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,7 @@ 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 --buildsystem=golang\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NACK. There are already too many packages using that path.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an API. There isn't any downside for new packages to use this
clearly cleaner and better way, and old packages are trivial to update, and
testing that the update works correctly is also trivial. The different
gitignore/clean has been used before should not be an argument on its own.
Otherwise no progress could happen, right?

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