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

Fix/stlink update #22581

Closed
wants to merge 2 commits into from
Closed

Fix/stlink update #22581

wants to merge 2 commits into from

Conversation

rongcuid
Copy link
Contributor

@rongcuid rongcuid commented Feb 9, 2017

Motivation for this change

To update STLink utility.

Note that I really don't know how to keep my branch up to date with master, since I based it on my current system version. Nowhere in docs did I find any information about how I merge changes from master back. I tried -s ours, -Xtheirs, -Xours, rebase --onto, and none of them work.

Things done
  • Tested using sandboxing
    (nix.useSandbox on NixOS,
    or option build-use-sandbox in nix.conf
    on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • Linux
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Fits CONTRIBUTING.md.

@rongcuid
Copy link
Contributor Author

rongcuid commented Feb 9, 2017

I forgot to turn off verbose, and the udev rules aren't there. I need to fix those.

@rongcuid
Copy link
Contributor Author

rongcuid commented Feb 9, 2017

OK, I have to ask here... I don't have a clue about how I can make udev rules work. They are already in the /etc/udev/rules.d of the package, but they are not loaded, and I can't get them to load. I could really use some help here, but it is totally undocumented.

@FRidh
Copy link
Member

FRidh commented Feb 10, 2017

@rongcuid

if you haven't done so already, add https://github.com/NixOS/nixpkgs-channels as remote.

git remote add channels https://github.com/NixOS/nixpkgs-channels.git
git fetch channels

Checkout nixpkgs-unstable

git checkout channels/nixpkgs-unstable

Cherry-pick this commit you made.

git cherry-pick 604a2f2f1871fbdf2555f9ec4957f303c4d696e7

Save it as a new branch named stlink-update2 (note the 2)

git checkout -b stlink-update2

And force push to this PR

git push -f origin stlink-update2:stlink-update

cc maintainer @bjornfor

@rongcuid
Copy link
Contributor Author

I will test that. But I still want to know how to get those udev rules to work. They are not loaded by any means, despite being in /nix/store/<pkg>/etc/udev/rules.d

@FRidh
Copy link
Member

FRidh commented Feb 10, 2017

I can't help you with that.

@bjornfor
Copy link
Contributor

@rongcuid: If the udev rules are properly installed by the package ($out/etc/udev/rules.d/) you can enable them on your system with services.udev.packages = [ thepackage ] in /etc/nixos/configuration.nix.

@rongcuid
Copy link
Contributor Author

Ah, I see. I will push the new changes once I get back.

@rongcuid rongcuid closed this Feb 12, 2017
@rongcuid rongcuid deleted the fix/stlink-update branch February 12, 2017 03:25
@rongcuid rongcuid restored the fix/stlink-update branch February 12, 2017 03:27
@rongcuid
Copy link
Contributor Author

Um, tried to force push, experimented with stuff and accidentally deleted the branch...

git push -f origin stlink-update2:stlink-update

This doesn't seem to work. Is the syntax correct?

@rongcuid rongcuid reopened this Feb 12, 2017
@rongcuid
Copy link
Contributor Author

OK, it's the slash that causes problem. Trying to fix it

@rongcuid
Copy link
Contributor Author

Ahh, after some --no-ff magic and now it should be fine.

Note that I don't have time to test udev rules yet, but I am still interested in finding a way to inform the user to add the services.udev line in their config. Alternatively, I can write a module... But since I now shifted to openocd, I would probably not do that.

preConfigure = "./autogen.sh";
buildInputs = [ cmake libusb1 ];
patchPhase = ''
sed -i 's@/etc/udev/rules.d@$ENV{out}/etc/udev/rules.d@' CMakeLists.txt
Copy link
Member

Choose a reason for hiding this comment

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

please indent correctly

sed -i 's@/etc/modprobe.d@$ENV{out}/etc/modprobe.d@' CMakeLists.txt
'';
preInstall = ''
mkdir -p $out/etc/udev/rules.d
Copy link
Member

Choose a reason for hiding this comment

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

here as well

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Um, is it possible to do the change directly here without touching my local repo?

Copy link
Member

Choose a reason for hiding this comment

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

you could go to your fork and branch on GitHUb and use the edit button

@FRidh
Copy link
Member

FRidh commented Feb 12, 2017

@bjornfor are these changes okay with out? Now the commits just need to be squashes, but we can do that.

@bjornfor
Copy link
Contributor

@rongcuid: What is fixed in the first commit? If this is more than a version bump I'd like it documented in the commit message. (You can write that here and I can add it to the commit when squashing.)

@rongcuid
Copy link
Contributor Author

Well, first that is what I was told by the Nixpkgs manual to do... Using fix prefix for a version bump.

I also took care of the switch from autotools to cmake.

@bjornfor
Copy link
Contributor

@rongcuid: Hm, I never heard of that convention. Seems odd. Do you have a link? I removed the "fix/" prefix, squashed and pushed to master (9775a26). Thanks!

Btw, I noticed a couple of things (for possible future work):

  1. the pkgconfig file is installed with wrong includedir path. Not sure if it's upstream or us that are messing it up, but it ends up with a version suffix, but in the file system the include dir is version-less. Since this is a new feature (previous versions didn't ship pkgconfig file), I didn't think it was important enough to fix right now.
  2. If cmake finds GTK, it'll build some sort of stlink GUI tool. Perhaps we want to add enable building that (optionally).

@bjornfor bjornfor closed this Feb 13, 2017
@rongcuid
Copy link
Contributor Author

@FRidh
Copy link
Member

FRidh commented Feb 13, 2017

@rongcuid there's an example where the branch starts with fix ($ git checkout -b 'fix/pkg-name-update'). The branch name doesn't matter, that's just up to you as contributor. One can use this kind of notation to describe better what the branch contains.

@rongcuid
Copy link
Contributor Author

Ah, ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants