summaryrefslogtreecommitdiff
path: root/dgit
Commit message (Collapse)AuthorAge
* dgit: Fix trailing whitespaceSean Whitton2017-08-15
| | | | Signed-off-by: Sean Whitton <spwhitton@spwhitton.name>
* dgit: dpkg_source_ignores: Exclude the right set of thingsIan Jackson2017-08-04
| | | | | | | | | Change the dpkg-source -i argument to exclude exactly the right set of things. (Sadly this is not a simple rune.) Previously we might exclude `foo.git', for example ! Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* dgit: Properly shellquote --git-builder argument to gbpIan Jackson2017-08-04
| | | | | | | | This is about to contain more exciting shell metacharacters. (Even now, it is wrong without quoting as we end up telling gbp to pass -i.git/ rather than -i\.git/ to dpkg-source.) Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* dgit: print-dpkg-source-ignores actionIan Jackson2017-08-04
| | | | | | | New print-dpkg-source-ignores option to print the big rune you need to pass to dpkg-source to make it work exactly the right. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* dgit: Break out -i -I rune into a variableIan Jackson2017-08-04
| | | | | | | There is also an instance in dgit-maint-merge.7.pod but that's trickier to unify. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* dgit: Make commit_getclogp not leave a lot of detritus in .git/dgitIan Jackson2017-08-03
| | | | | | | Have it use a fixed filename instead. It's only needed right away so that's fine. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* directory refactor: open_main_gitattrs confesses if $maindir not setIan Jackson2017-08-03
| | | | | | | This improves the error message considerably for "didn't call record_maindir" bugs. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* worktree support: dgit: Fix for .git/logs/refs/Ian Jackson2017-08-03
| | | | | | | | | | | | | Experimentally, both the common dir and the worktree's git dir have a .git/logs. But, as might be expected, the worktree's one has the reflog for its HEAD and not any of the refs/ reflogs. Implicitly, we are deciding here that the dgit quilt cache is shared between all worktrees. That seems fine. I think we don't ever rely on its actual current value, so even concurrent dgit runs ought to be fine. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* worktree support: dgit: Fix for .git/info/attributesIan Jackson2017-08-03
| | | | | | | | | | | | | | | Experimentally, this file is in the common dir, not the per-worktree dir. Honour $maindir_gitcommon everywhere. Rename `open_main_gitattrs'. Previously it could in theory be used in the playtree (but, it isn't). Now it always operates on the main tree. Indeed, as we require, the `setup' stuff is only done in the main tree. The gitattributes fixes for playtrees are done, unconditionally, with the much simpler hammer in playtree_setup. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* directory handling: dgit: Introduce dgit_privdir and use itIan Jackson2017-08-03
| | | | | | This removes another pile of open-coded references to .git/ Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* directory handling: dgit: Use $maindir rather than ../../..Ian Jackson2017-08-03
| | | | | | | Replace all the open-coded ../.. constructs with references to $maindir. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* directory refactoring: dgit clone: call record_maintree in multisuite tooIan Jackson2017-08-03
| | | | Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* directory refactoring: dgit clone: call record_maintreeIan Jackson2017-08-03
| | | | | | | | | | | We are making up our own tree, here. We will need to call record_maintree in case we need to use information which it obtains. Currently, we don't. But git worktrees are complicated: we are going to have to depend on the new $maindir_git* variables, in setup_new_tree. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* directory refactoring: most invocations: call record_maintreeIan Jackson2017-08-03
| | | | | | | | | | | We need to call record_maintree so that $maindir and its friends are set, since we're going to rely on them heavily. Most operations will need them. Any operation that is invoked in a git tree should definitely have this called. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* directory refactoring: Rename no_local_git_cfgIan Jackson2017-08-03
| | | | | | | | This is actually called when we don't know that we are starting in a git tree. We want to use this knowledge to control an automatic call to record_maindir, too. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* playground refactoring: dgit: Use playground facilitiesIan Jackson2017-08-03
| | | | | | | | | | | | | | * Replace implementation of prep_ud with a call to fresh_playground * Replace references to $ud with $playground * Replace hardcoded changedir ../../.. etc. with $maindir The overall functional change is fairly minimal. We now call getcwd more often, and when we want to return to the maindir we changedir to an absolute path instead of a relative one. Later, we may rename prep_ud, mktree_in_ud_here, etc. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* playground refactoring: dgit: Make prep_ud no longer take a directoryIan Jackson2017-08-03
| | | | | | | Nothing passes this argument, so no functional change. This will make forthcoming changes more obviously correct. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* playground: playtree: rename from workareaIan Jackson2017-08-02
| | | | | | | We are going to use "playground" for containing temporary directory, and playtree for git trees within it. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* Dgit: break must_getcwd out into Dgit.pmIan Jackson2017-08-02
| | | | | | No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* dgit: factor out build_or_push_prep_early subSean Whitton2017-07-26
| | | | | | | | | | | | | | | | This is to permit code deduplication between the commands for pushing and building. Both these sets of commands deny usage of -p, and set $isuite, $package and $version based on the changelog. In particular, a command that will perform a build /and/ a push can first perform the check for -p, set $package and then call functions to do the build. These latter functions will not complain that $package is set thanks to the $build_or_push_prep_early_done logic. No functional change. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name> Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* cmd_push: Factor out all prep codeSean Whitton2017-07-26
| | | | | | | Will be re-used by cmd_push_source. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name> Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* dgit: Refactor to create human-readable $subcommandSean Whitton2017-07-26
| | | | | | | | | $cmd,$subcommand now global vars. No functional change. Signed-off-by: Sean Whitton <spwhitton@spwhitton.name> Acked-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* Dgit.pm: changedir: Break out from dgitIan Jackson2017-07-19
| | | | Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* Dgit.pm: git_slurp_config_src: Break out from dgitIan Jackson2017-07-19
| | | | | | | | | | We are going to want this so we can provide better subtree setup functions in Dgit.pm, including the config transfer. No functional change, except that we now run just "git" from the path, rather than honouring dgit's @git (which is not available in Dgit.pm). Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* Dgit.pm: workarea_setup: Break out from dgitIan Jackson2017-07-18
| | | | | | | | | | | This subroutine needs a hash of the main tree's git config, so that some of the config settings which affect the object store can be properly honoured. Purely code motion, except for the changed reference to $gitcfgs. No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* dgit: simplify gitattrs setup in mktree_in_ud_hereIan Jackson2017-07-18
| | | | | | | | | | | | | | | | We are going to want to break the meat of mktree_in_ud here out into Dgit.pm. Dgit.pm doesn't have access_cfg, is_gitattrs_setup, and so on. On the other hand, we don't need any of that here: this is a fresh tree of our own (so there is no existing .git/info/attributes to combine with our new settings), and we ignore the config already. So overall, little functional change: the .git/info/attributes in our private working areas are now slightly simpler: they don't indirect via git-defuse-attrs. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* Dgit.pm: $negate_harmful_gitattrs: Break out from dgitIan Jackson2017-07-18
| | | | | | No functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* Dgit.pm: runcmd: Break out from dgitIan Jackson2017-07-18
| | | | | | | | | | | | Move runcmd into Dgit.pm. We need to change dgit-repos-server too, but luckily its definition is essentially equivalent. No functional change to dgit. dgit-repos-server now prints somewhat better error messages when subprocesses fail. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* Merge branch 'stable' into HEADIan Jackson2017-07-16
|\
| * dgit: unrepres. changes: Tolerate creation of symlinksIan Jackson2017-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Experimentally, dpkg-source on stretch will create patches to create new symlinks. (It will fail on attempts to modify existing symlinks and it ignores attempts to change plain file executability.) Implementation: add an alternative which tolerates the git symlink mode. This replaces the check on $oldmode, which in this context we know is all 0s and can therefore never match. While we're here, change the error message. Closes:#857382. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: unrepres. changes: Tolerate deletion of executable filesIan Jackson2017-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We don't care what the old mode was; if we tell dpkg-source to record the deletion it can do so. But we do care that it was a file. Experimentally, dpkg-source on stretch ignores attempts to delete symlinks. The removal of the check for $newmode has no functional change, because in this context we know that $newmode is all 0s. If it wasn't, we would have been in "both old and new files exist", above. So that limb of the test will never match and should be removed. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: unrepres. changes: Separate out creation and deletionIan Jackson2017-07-16
| | | | | | | | | | | | | | | | | | | | We are going to want to handle these cases separately because the behaviour of dpkg-source is different. In this commit, simply clone the existing code (and add a few comments), so no functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: unrepres. changes: Prepare to tolerate symlinksIan Jackson2017-07-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Permit symlinks (which have mode 120000 in git) to make their way through for more detailed checks. No functional change except to error messages, because: * If neither thing was a symlink, then the existing regexps still match and the new "modified symlink" clause will not, so the flow is unchanged. * Otherwise, if both $oldmode and $newmode match [^0], ie, this is a modification rather than deletion or removal, we insist that $oldmode=$newmode, and then, fail the new "modified symlink" check. * Otherwise, we fail the check for default mode. So in the case we are allowing to proceed further, we fail as before. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit import: Avoid making broken symlinks in ..Ian Jackson2017-07-16
| | | | | | | | | | | | | | | | | | | | | | | | In most cases we could carry on and fail later. But creating a broken symlink is undesirable, particularly because it might prevent dgit from trying to make a non-broken symlink pointing elsewhere in future (or prevent dget from downloading the file). Even worse, if the dsc is in .. but an absolute path was provided, we would make a circular symlink! Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit import: Right error message for missing files in ..Ian Jackson2017-07-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Close examination of this code path reveals that: * The error is generated only if $there contains no slash. * This can only occur if $dscfn matches the first regexp, ie $dscfn is [./]../X in which case $there becomes X * So in this situation, $there is simply the dsc filename which is supposed to be in .. * What we should be testing is ../$f but that is $here which is what are trying to create and which we statted earlier and got ENOENT for. So this occurs when the dsc is in .. and a file it refers to is missing. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit import: Defend against broken symlinks in ..Ian Jackson2017-07-15
| | | | | | | | | | | | | | | | | | Provide a special error message if lstat succeeds but lstat fails. This is not hypothetical - currently even dgit import ../blah.dsc can generate this situation ! Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
* | Merge branch 'stable'Ian Jackson2017-07-09
|\| | | | | | | Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: Regularise patch filenames, and defend against funny commit subjectsIan Jackson2017-07-09
| | | | | | | | | | | | | | * Do not specified patch names which look like series filenames * When we invent a filename based on a commit message, add ".patch". Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: Pass --no-renames to git diff-tree -z, avoiding potential troubleIan Jackson2017-07-09
| | | | | | | | | | | | | | | | | | | | Without this option, git-diff-tree might detect a rename (or possibly even a copy). If it does it prints a different output format with a status of C or R *and a separate filename*. The latter is an additional nul-terminated record and would get dgit's interpreter of the git diff-tree output out of step. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * Actually understand foo,-security (!)Ian Jackson2017-07-08
| | | | | | | | | | | | | | | | | | | | | | | | There does not in fact seem to have been any code which implements this line from dgit(7): If a specified subsuite starts with - then mainsuite is prepended. The code which canonicalises it back to the version with ",-" does work, though. Closes:#867189. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: mkdir .git/info in setup_gitattrsIan Jackson2017-07-08
| | | | | | | | | | | | | | | | This might be necessary if setup_mergechangelogs were disabled. (This is something of a latent bug, since `git init' creates .git/info.) Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: clone multisuite works even without --no-rm-on-error.Ian Jackson2017-07-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is slightly subtle. We need $rmonerror in cmd_clone to be cleared. cmd_clone does that only when clone itself returns. The multisuite plumbing means that currently, clone returns only in the child which set up the tree and set up the first suite. Unsetting $rmonerror there is correct because we want to keep the tree on success, and the parent will remove it if there is a later failure. (Ie, the child remains responsible for removing the tree if it itself fails.) In the parent, we get $multi_fetched==1 if not only our original clone child succeeded, but all the other fetches worked too. We are now responsible for the tree. If our final tasks are successful, again, we need not to delete the tree. Closes:#867434. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: honour more pre-tree git config options in our private treesIan Jackson2017-07-08
| | | | | | | | | | | | | | | | | | | | These share the user's object store and we should manipulate the object store the way the user wants. In particular, core.sharedRepository is important. Prompted by #867603, which is the same bug in dgit-badcommit-fixup. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: tolerate compressor terminating with SIGPIPE.Ian Jackson2017-07-08
| | | | | | | | | | | | Closes:#857694. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: avoid dying with wrong message if compression failsIan Jackson2017-07-08
| | | | | | | | | | | | | | | | | | | | | | When dgit intended to report a decompressor had failed, it would instead crash with no useful message. This was due to generate_commits_from_dsc's @compr_cmd being shadowed inside the if $compr_ext. This is part of #857694. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: Add many pre_* to call no_local_git_cfgIan Jackson2017-07-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For each operation which can meaningfully be run outside a git tree, arrange to call no_local_git_cfg and thus avoid running git config --local There is one slight infelicity: some subcommands (notably archive-api-query) could in theory be run within a git tree and expect that git tree to influence their output. However, this seems unlikely. In fact, I think there are probably only in-tree callers and the in-tree callers do not do this. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: Provide no_local_git_configIan Jackson2017-07-08
| | | | | | | | | | | | | | | | | | | | | | Part of the fix to #865863. No callers yet, so no functional change. This function not only arranges not to call git config --local. Removing 'local' from @gitcfgsources also prevents various config lookup machinery from trying to find information in $cfg{local} now of course does not exist. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: rpush: Do argument parsing and chdir in pre_...Ian Jackson2017-07-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The only thing in between pre_... and cmd_... os git_slurp_config. The code now in pre_... does the following things, all of these should be done before git_slurp_config: * Sets some global variables affecting debugging and logging output. If git_slurp_config is told to print debugging, it should be affected by these changes. * Rearranges its file descriptors so that stdin/stdout are as the rest of dgit expects, and the protocol is on PI/PO. If git_slurp_config were to use stdin/stdout, it ought to use the "normal" versions, and not access the protocol streams. * Checks and calculates the negotiated protocol version. This is not affected by the config, only by the arguments form the caller and our own idea of the protocol versions we support. * Changes to the appropriate working tree. Doing this before slurping the config arranges to honour the local git config from build host working tree. (It also avoids rpush failing on newer git due to asking for git config --local in the wrong place.) Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: Postpone call to git_slurp_configIan Jackson2017-07-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is needed to fix #865863: we need to know what our operation is, before we can decide whether to look for --local git config. The code which now runs earlier is: * The messages about $dryrun_level (which is set only by the command line, and not by configuration - verified by searching for $dryrun_level). * Usage failure if @ARGV empty. This is not affected by configuration. (parseopts does the argument parsing and already runs before git_slurp_config.) * Extracting the $cmd from @ARGV. * Calling $pre_fn. There is only one pre_* sub, which is pre_gbp_build. It provides the default for $quilt_mode. $quilt_mode is indeed somewhat entangled with the git config, but this takes place in parseopts_late_defaults, which is called much later. Therefore there is no functional change. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
| * dgit: curl --proto-redir settings: do not use qw() for ...,...Ian Jackson2017-07-08
| | | | | | | | | | | | | | | | | | | | | | This syntax generates the following spurious warning with buster's perl (but not with stretch's): Possible attempt to separate words with commas at /home/ian/things/Dgit/2dgit/dgit line 103. It seems better to keep this warning everywhere else, and using a different syntax is easier than disabling it around this construct. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>