You are not logged in.

#1 2021-01-18 21:22:29

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 308

[SOLVED] Broke my package by forgetting to git rm it before pushing

I seem to have broken my masterpdfeditor AUR package and am not clear on what to do to fix the problem.

For one release, upstream forgot to include the masterpdfeditor5.desktop file in the release tarball, so I had to add this to the AUR package by hand.

In the new release, masterpdfeditor5.desktop is in the upstream tarball again, but when I went to commit/push the new AUR package, I forgot to run

git rm masterpdfeditor5.desktop

So, I ran git rm masterpdfeditor5.desktop, created a new PKGBUILD file with pkgrel=2 and attempted to commit/push the git repo to the AUR again, but now the system won't let me push:

[pgoetz@frog masterpdfeditor]$ vi PKGBUILD
[pgoetz@frog masterpdfeditor]$ makepkg --printsrcinfo > .SRCINF
[pgoetz@frog masterpdfeditor]$ git rm masterpdfeditor5.desktop
fatal: pathspec 'masterpdfeditor5.desktop' did not match any files
[pgoetz@frog masterpdfeditor]$ git add PKGBUILD .SRCINFO
[pgoetz@frog masterpdfeditor]$ git commit -m "Fixed typo in PKGBUILD file"
[master 1f25d44] Fixed typo in PKGBUILD file
 1 file changed, 1 deletion(-)
[pgoetz@frog masterpdfeditor]$ git push
Enumerating objects: 16, done.
Counting objects: 100% (16/16), done.
Delta compression using up to 8 threads
Compressing objects: 100% (13/13), done.
Writing objects: 100% (13/13), 1.31 KiB | 1.31 MiB/s, done.
Total 13 (delta 7), reused 0 (delta 0), pack-reused 0
remote: error: The following error occurred when parsing commit
remote: error: f9e5f4cba29cadb0173552ced4b4d791989cd39b:
remote: error: missing source file: masterpdfeditor5.desktop
remote: error: hook declined to update refs/heads/master
To ssh://aur.archlinux.org/masterpdfeditor.git
 ! [remote rejected] master -> master (hook declined)
error: failed to push some refs to 'ssh://aur.archlinux.org/masterpdfeditor.git'

One can see that when I try to git rm the file again, it's no longer found by git, but when I attempt to push it's telling me:

remote: error: missing source file: masterpdfeditor5.desktop

I'm confused by this.  Any clues on what's going on?  I've looked over the PKGBUILD file several times and don't see any errors there.

Last edited by pgoetz (2021-01-18 22:59:24)

Offline

#2 2021-01-18 22:25:44

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 8,916

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

Did you remove the file manually before running git rm ?

You probably have to revert changes to your local git repo.
There should be  a clean way to do that, but I don't know it.

I do know a brute force method though* :

create a fresh copy of the aur repo in a temp directory

git clone ssh://aur@aur.archlinux.org/yourpackage.git 

overwrite the PKGBUILD & .SRCINFO with the updated versions , then run git rm , add , commit and try pushing again.

* had to use it several times myself

Last edited by Lone_Wolf (2021-01-18 22:26:33)


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#3 2021-01-18 22:58:02

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 308

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

Lone_Wolf wrote:

I do know a brute force method though* :

create a fresh copy of the aur repo in a temp directory

git clone ssh://aur@aur.archlinux.org/yourpackage.git 

Thank you!  That worked perfectly and I'll have to remember this trick for next time. I spent some time trying to revert the bad commits, but just kept making a bigger and bigger mess.

Marking this as SOLVED.

Offline

#4 2021-01-19 03:09:28

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,936

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

pgoetz wrote:
[pgoetz@frog masterpdfeditor]$ makepkg --printsrcinfo > .SRCINF
[...]
[pgoetz@frog masterpdfeditor]$ git add PKGBUILD .SRCINFO
[pgoetz@frog masterpdfeditor]$ git commit -m "Fixed typo in PKGBUILD file"
[master 1f25d44] Fixed typo in PKGBUILD file
 1 file changed, 1 deletion(-)

???


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#5 2021-01-19 15:44:08

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 308

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

eschwartz wrote:

???

I'll interpret this as asking for more details. I made 2 mistakes, in both parallel and succession, resulting in an inability to commit a corrected package.

First, I deleted the masterpdfeditor5.desktop file in the file system, forgetting that I needed it to remove it from git as well.  Second, I overlooked removing the file from the source_x86_64 variable (but didn't notice this until a subsequent commit attempt). I did remove the accompanying SHA1 checksum.  This commit worked, but the resulting package wasn't install-able, as it complained about the missing masterpdfeditor5.desktop (or something like this).

Then I tried committing again after running git rm.  Then I noticed I had forgotten to remove the deleted file from  source_x86_64.

After this, everything in the PKGBUILD was correct, but I was unable to make further commits as per the error message.  I tried using git reset to roll the local git repo back to the state that existed before I attempted any of this, but must not fully understand how this works, as this just resulted in an even bigger mess.  Then Lone_Wolf baled me out by suggesting I could start over with a new clone.  Even though this clone included the broken package commit, I was able to submit the corrected package.

Offline

#6 2021-01-20 02:00:04

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,936

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

pgoetz wrote:
eschwartz wrote:

???

I'll interpret this as asking for more details. I made 2 mistakes, in both parallel and succession, resulting in an inability to commit a corrected package.

No, I actually just wanted you to take a closer look at the carefully picked out lines I excerpted. Take a look at how many files git reported as changed. Look for typos in your commit intended to (ironically) fix a typo.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#7 2021-01-20 10:03:51

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 308

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

eschwartz wrote:

No, I actually just wanted you to take a closer look at the carefully picked out lines I excerpted. Take a look at how many files git reported as changed. Look for typos in your commit intended to (ironically) fix a typo.

Ah, OK.  Yes, that was a copy and paste error which I had already corrected.  I should have posted a version of the error message which didn't have this, as even with the correct pipe to .SRCINFO, I was still getting the same error attempting to push the repo.

Thanks for pointing this out, though.

Offline

#8 2021-01-20 12:10:59

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,936

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

Well, "I fixed the typo but still got errors" is, actually, some pretty important information!

If you try creating a commit and it errors on pushing to the AUR, you cannot create another commit and push that -- you need to fix the old commit. The AUR validates every commit in the history.

You can fix an erroring commit with "git commit --amend".

Last edited by eschwartz (2021-01-20 12:11:21)


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#9 2021-01-20 14:13:47

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 308

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

eschwartz wrote:

You can fix an erroring commit with "git commit --amend".


Does this have command line arguments, or do you just fix the errors and then attempt to re-commit?

Offline

#10 2021-01-20 14:17:07

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,106
Website

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

Why ask here when you can RTFM?


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#11 2021-01-20 14:54:18

progandy
Member
Registered: 2012-05-17
Posts: 4,145

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

Here is some pretty good documentation for git: http://book.git-scm.com/book/en/v2
In this case, especially chapter 2.4: http://book.git-scm.com/book/en/v2/Git- … ing-Things


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#12 2021-01-20 15:28:04

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 308

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

Thanks everyone for the help and suggestions.  Yes, I can (and generally do) RTFM, but it doesn't hurt to have this (topically localized) information appear in searchable discussion forums for the benefit of the next person that comes along with a similar issue.

Offline

#13 2021-01-20 16:16:49

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,106
Website

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

The next person with the same question should also be able to type "man git-commit" then "/amend".  And if you want to provide the information for the next person, that's wonderful, but asking someone else to spoonfeed you the information is not appropriate - this is almost exactly the example of what not to do here.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#14 2021-01-20 16:46:46

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 308

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

Trilby wrote:

The next person with the same question should also be able to type "man git-commit" then "/amend".  And if you want to provide the information for the next person, that's wonderful

I always, and I mean always append a complete solution to any question I ask on the forum once I have the answer, even when I'm the only one who posted anything to that question. That's called being a good community member. As you know, git is complicated, particularly when you get into issues of rebasing, and, reading through the chapter progandy linked, I'm not sure git commit --amend would have worked in this case, as I had already pushed a faulty commit.  Quoting from http://book.git-scm.com/book/en/v2/Git- … ing-Things:

Only amend commits that are still local and have not been pushed somewhere. Amending previously pushed commits and force pushing the branch will cause problems for your collaborators. For more on what happens when you do this and how to recover if you’re on the receiving end read The Perils of Rebasing.

So, since I'm not about to re-break my package to test this out, I don't think my question was entirely inappropriate.  Someone with more experience with this could provide illumination not necessarily provided by the documentation, which for the record I looked at before posting to the forum. However, that is a 500 page book, and I didn't have the time or inclination to read much of it while people are hammering me every 2 minutes with comments about the package being broken and can I please fix ASAP.

Offline

#15 2021-01-20 17:13:25

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 25,106
Website

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

Well we're talking past each other - but my point had nothing to do with the thread in general, but only to the specific response to someone suggesting you us "git commit --amend" and your immediate reply was a very specific question that is very clearly covered in the single paragraph in the man page for that option.  This has nothing to do with reading a 500 page book.

In other words my "why ask here ..." comment was not a reply to your OP which is a valid and good question, but only to the specific interaction of essentially "try --amend" -> "what's --amend".

Last edited by Trilby (2021-01-20 19:37:24)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#16 2021-01-20 19:30:36

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 3,936

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

"git commit --amend" is a modification to "git commit", so a reasonable initial assumption is "they both accept all the same options".

The reasonable initial assumption has the benefit of being correct.

...

While it's true you should not force push as a general rule, the AUR enforces this by requiring Trusted User permissions in order to do so, hence you cannot. And also you don't need to, since you cannot push faulty commits due to the error that you received in the first post of this thread, which caused you to ask for help to begin with.

So you can, of course, "git commit --amend" the commit which the AUR rejected.

Unless you're once again not including important information about what you did?


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#17 2021-01-21 17:00:17

pgoetz
Member
From: Austin, Texas
Registered: 2014-02-21
Posts: 308

Re: [SOLVED] Broke my package by forgetting to git rm it before pushing

eschwartz wrote:

Unless you're once again not including important information about what you did?

No, I didn't try to use the git commit --amend suggestion; just made a note of your comment for future reference. Cloning from the AUR again as per Lone_Wolf's suggestion solved the problem for me, which is why I marked the ticket as solved.  All the subsequent discussion is just that, but nevertheless appreciated.

Offline

Board footer

Powered by FluxBB