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

format-local does not exist in git 1.8.3 #181

Closed
wants to merge 1 commit into from

Conversation

twimpiex
Copy link

to be able to set the modification date with older git versions (ie on EL 7) you should use another date option (iso)

@monojenkins
Copy link

Hello! I'm the build bot for the Mono project.

I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done.

Contributors can ignore this message.

@dnfclas
Copy link

dnfclas commented Aug 21, 2016

Hi @twimpiex, I'm your friendly neighborhood .NET Foundation Pull Request Bot (You can call me DNFBOT). Thanks for your contribution!

This seems like a small (but important) contribution, so no Contribution License Agreement is required at this point. Real humans will now evaluate your PR.

TTYL, DNFBOT;

@jonpryor
Copy link
Member

touch(1) on OS X does not support the touch --date option, nor does FreeBSD, which means that this patch would break existing build behavior on macOS.

@twimpiex
Copy link
Author

Do you prefer a general solutions or is a condition switch on the OS?

@jonpryor
Copy link
Member

jonpryor commented Aug 25, 2016

Similar code exists in multiple places:

$ git grep 'touch -m -t'
build-tools/android-toolchain/android-toolchain.targets:        Command="touch -m -t `git log -1 --format=%25cd --date=format-local:%25Y%25m%25d%25H%25M.%25S` Makefile"
build-tools/libzip/libzip.targets:        Command="touch -m -t `git log -1 --format=%25cd --date=format-local:%25Y%25m%25d%25H%25M.%25S` CMakeLists.txt"
build-tools/mono-runtimes/mono-runtimes.targets:        Command="touch -m -t `git log -1 --format=%25cd --date=format-local:%25Y%25m%25d%25H%25M.%25S` autogen.sh"
build-tools/mono-runtimes/mono-runtimes.targets:        Command="touch -m -t `git log -1 --format=%25cd --date=format-local:%25Y%25m%25d%25H%25M.%25S` Makefile.config.in"
src/sqlite-xamarin/sqlite-xamarin.targets:        Command="touch -m -t `git log -1 --format=%25cd --date=format-local:%25Y%25m%25d%25H%25M.%25S` README.version"

This PR didn't touch most of them.

What I would instead suggest is to add a new GitCommitTime task to xa-prep-tasks.dll, modeled after e.g. the <GitBranch/> task:

public partial class GitCommitTime : Git {
    // Inherited from Git
    public  ITaskItem       WorkingDirectory    { get; set; }

    // Added
    [Output]
    public  string          Time                { get; set; }
}

This new GitCommitTime task would invoke git --format=%cd --date=format-local:%Y%m%d%H%M.%S, and store the printed value into GItCommitTime.Time. The format of GitCommitTime.Time should be a value that is supported by the Touch.Time property.

Usage would thus replace:

<Exec
      Command="touch -m -t `git log -1 --format=%25cd --date=format-local:%25Y%25m%25d%25H%25M.%25S` autogen.sh"
      WorkingDirectory="$(MonoSourceFullPath)"
/>

With:

<GitCommitTime
    WorkingDirectory="$(MonoSourceFullPath)"
    ToolPath="$(GitToolPath)"
    ToolExe="$(GitToolExe)">
  <Output TaskParameter="Time"   PropertyName="_MonoSourceTime" />
/>
<Touch Files="$(MonoSourceFullPath)\autogen.sh" Time="$(_MonoSourceTime)" />

Minor aside: why wasn't this done the first time? Because the <Exec/> task didn't provide a way to capture output into an MSBuild property, and it was faster to just do the nested exec than to write a new task at the time.

Additionally, the <GitCommitTime/> and <Touch/> task usage could be bundled together into a new @(SetGitCommitTime) item group and SetGitCommitTimes target, a'la @(RequiredProgram). Usage could then become:

<ItemGroup>
  <SetGitCommitTime Include="$(MonoSourceFullPath)\autogen.sh" />
</ItemGroup>

and updating the $(BuildDependsOn) property so that that SetGitCommitTimes is invoked "first."

@monojenkins
Copy link

Hello! I'm the build bot for the Mono project.

I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done.

Contributors can ignore this message.

1 similar comment
@monojenkins
Copy link

Hello! I'm the build bot for the Mono project.

I need approval from a Mono team member to build this pull request. A team member should reply with "approve" to approve a build of this pull request, "whitelist" to whitelist this and all future pull requests from this contributor, or "build" to explicitly request a build, even if one has already been done.

Contributors can ignore this message.

jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Aug 10, 2017
Context: dotnet#181 (in comments)

In several places throughout the build, we are running a command such
as `<Exec Command="touch -m -t `git log -1 --format=%25cd
--date=format-local:%25Y%25m%25d%25H%25M.%25S` Makefile" />`, which
will not work on Windows.

The solution is to create an MSBuild task in xa-prep-tasks named
`GitCommitTime` that will work cross-platform. `GitCommitTime` returns
a string value that can be passed to the `Touch` MSBuild task.
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Aug 10, 2017
Context: dotnet#181 (in comments)

In several places throughout the build, we are running a command such
as `<Exec Command="touch -m -t `git log -1 --format=%25cd
--date=format-local:%25Y%25m%25d%25H%25M.%25S` Makefile" />`, which
will not work on Windows.

The solution is to create an MSBuild task in xa-prep-tasks named
`GitCommitTime` that will work cross-platform. `GitCommitTime` returns
a string value that can be passed to the `Touch` MSBuild task.
jonathanpeppers added a commit to jonathanpeppers/xamarin-android that referenced this pull request Aug 10, 2017
Context: dotnet#181 (in comments)

In several places throughout the build, we are running a command such
as `<Exec Command="touch -m -t `git log -1 --format=%25cd
--date=format-local:%25Y%25m%25d%25H%25M.%25S` Makefile" />`, which
will not work on Windows.

The solution is to create an MSBuild task in xa-prep-tasks named
`GitCommitTime` that will work cross-platform. `GitCommitTime` returns
a string value that can be passed to the `Touch` MSBuild task.
jonpryor pushed a commit that referenced this pull request Aug 10, 2017
Context: #181 (in comments)

In several places throughout the build, we are running a command such
as `<Exec Command="touch -m -t `git log -1 --format=%25cd
--date=format-local:%25Y%25m%25d%25H%25M.%25S` Makefile" />`, which
will not work on Windows.

The solution is to create an MSBuild task in xa-prep-tasks named
`GitCommitTime` that will work cross-platform. `GitCommitTime` returns
a string value that can be passed to the `Touch` MSBuild task.
@atsushieno
Copy link
Contributor

I don't think this change is really in need anymore considering that people should be using fairly recent versions of git that does not expose known vulnerabilities. I'm closing this issue, but thanks for sending us a PR @twimpiex. (And please feel free to reopen this if it should be still alive.)

@atsushieno atsushieno closed this Aug 22, 2017
radical pushed a commit that referenced this pull request May 8, 2018
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=58403

An event names is generated from the method name which was supposed to be
`setOnXxxListener()`. Though we had been generating events for methods that
do not end with "Listener", resulting in weird event names (e.g. it was
"VisibleWidt" for `setOnVisibleWidthChanged` method).

Trim trailing 8 characters only on `setOnXxx**Listener**()` methods.
jonpryor added a commit to jonpryor/xamarin-android that referenced this pull request Aug 24, 2022
Changes: TODO Java.Interop

Changes: dotnet/android-tools@9c641b3...7cfe683

  * dotnet/android-tools@7cfe683: [ci] Use Microsoft.SourceLink.GitHub (dotnet#192)
  * dotnet/android-tools@01a0dde: [Localization] Import translated resx files (dotnet#189)
  * dotnet/android-tools@cc715d9: [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (dotnet#190)
  * dotnet/android-tools@3c55e9a: Avoid `Environment.SpecialFolder.ApplicationData` (dotnet#188)
  * dotnet/android-tools@0d55472: LEGO: Merge pull request 187
  * dotnet/android-tools@6946512: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (dotnet#186)
  * dotnet/android-tools@6e3433a: Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (dotnet#185)
  * dotnet/android-tools@73c4388: [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (dotnet#184)
  * dotnet/android-tools@da3653e: [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433: [ci] Run OneLocBuild on a schedule (dotnet#180)
  * dotnet/android-tools@8ab60e4: [ci] Use latest macOS and Windows images (dotnet#181)
  * dotnet/android-tools@4dd3292: LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1: [Localization] Add OneLocBuild job (dotnet#175)
  * dotnet/android-tools@14076a6: [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
jonpryor pushed a commit that referenced this pull request Aug 26, 2022
…7309)

Changes: mono/mono.posix@e1269a5...d8994ca

  * mono/mono.posix@d8994ca: Remove Windows support completely for now

    Fixes an issue in which Mono.Unix would try to resolve `libc`
    P/Invokes by looking for the `msvcrt` library on Unix machines.

  * mono/mono.posix@74d504f: Fix yaml template path
  * mono/mono.posix@127cf9e: [build] Don't rebuild managed code on packaging time on Windows

Changes: dotnet/android-libzipsharp@2.0.4...2.0.7

  * dotnet/android-libzipsharp@98e9173: Bump version to 2.0.7
  * dotnet/android-libzipsharp@6e1e1b3: Localized file check-in by OneLocBuild Task: Build definition ID 11678: Build ID 6581869 (#119)
  * dotnet/android-libzipsharp@1c05430: LEGO: Merge pull request 118
  * dotnet/android-libzipsharp@06d44d8: Localized file check-in by OneLocBuild Task: Build definition ID 11678: Build ID 6570668 (#117)
  * dotnet/android-libzipsharp@37f3894: LEGO: Merge pull request 116
  * dotnet/android-libzipsharp@6c0edc5: Update libzip and zlib submodules (#115)
  * dotnet/android-libzipsharp@acd9a54: [Localization] Switch from xlf to resx files  (#112)
  * dotnet/android-libzipsharp@3cece80: LEGO: Merge pull request 114
  * dotnet/android-libzipsharp@fe336b4: LEGO: Merge pull request 113
  * dotnet/android-libzipsharp@9aee99a: [Localization] Add OneLocBuild job (#111)
  * dotnet/android-libzipsharp@bdfa9f8: Bump Mono.Unix to 7.1.0-final.1.21458.1 (#110)

Changes: xamarin/monodroid@210073e...100ccf9

  * xamarin/monodroid@100ccf969: Bump to xamarin/androidtools@81486ab, xamarin/android-sdk-installer@8cac7ea (#1264)

Changes: dotnet/android-tools@9c641b3...29f11f2

  * dotnet/android-tools@29f11f2 Bump to mono/mono.posix@d8994ca, dotnet/android-libzipsharp@98e9173 (#193)
  * dotnet/android-tools@7cfe683 [ci] Use Microsoft.SourceLink.GitHub (#192)
  * dotnet/android-tools@01a0dde [Localization] Import translated resx files (#189)
  * dotnet/android-tools@cc715d9 [Xamarin.Android.Tools.AndroidSdk] Permit NDK r25 (#190)
  * dotnet/android-tools@3c55e9a Avoid `Environment.SpecialFolder.ApplicationData` (#188)
  * dotnet/android-tools@0d55472 LEGO: Merge pull request 187
  * dotnet/android-tools@6946512 Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729154833425. (#186)
  * dotnet/android-tools@6e3433a Juno: check in to juno/hb_befb220e-87ce-47e9-a9e6-10ea592b2337_20220729025332507. (#185)
  * dotnet/android-tools@73c4388 [Xamarin.Android.Tools.AndroidSdk] Update SDK component for API-33 (#184)
  * dotnet/android-tools@da3653e [Xamarin.Android.Tools.AndroidSdk] Add API-33 to KnownVersions
  * dotnet/android-tools@327d433 [ci] Run OneLocBuild on a schedule (#180)
  * dotnet/android-tools@8ab60e4 [ci] Use latest macOS and Windows images (#181)
  * dotnet/android-tools@4dd3292 LEGO: Merge pull request 182
  * dotnet/android-tools@56b61f1 [Localization] Add OneLocBuild job (#175)
  * dotnet/android-tools@14076a6 [Xamarin.Android.Tools.AndroidSdk] Add API-32 to KnownVersions
@github-actions github-actions bot locked and limited conversation to collaborators Feb 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants