Portdowngrade & Gitup Tweak for Downgrading

Lamia

Aspiring Daemon

Reaction score: 203
Messages: 764

Now that the ports repo does not support svn, how can one downgrade a port like portdowngrade used to do? Perhaps, I need use a method "git" as argument and replace the revision number with a git hash value when using the portdowngrade command. If the port maintainer could do that, it would make things easier.

Someone showed how to use gitup not long ago, but I can't remember how.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,612
Messages: 37,944

Find the commit that updated the port and use git revert to revert that commit. You're going to need a 'complete' git checkout for this to work, it cannot work with gitup ports tree.
 
OP
Lamia

Lamia

Aspiring Daemon

Reaction score: 203
Messages: 764

Many thanks SirDice . How do I do it when the only valuable information I have is the revision number from freshports?

Will git revert not require one having a git account with git.freebsd.org? Or should one rely on ports on github.com for this kind of activity?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 11,612
Messages: 37,944

How do I do it when the only valuable information I have is the revision number from freshports?
Browse on cgit.freebsd.org (or github), lookup the port. Then look at the commit logs to find the commit that updated the port.

Will git revert not require one having a git account with git.freebsd.org?
No, it's applied to your local working copy. Best is to create a new branch, then revert the commit in your own branch. That way you can easily switch back to the main branch to get the original again.

Or should one rely on ports on github.com for this kind of activity?
Doesn't matter.
 
OP
Lamia

Lamia

Aspiring Daemon

Reaction score: 203
Messages: 764

Thanks SirDice; this is too much of a process for new entrants wanting to downgrade a package. I hope one of the existing tools will soon be modified to make life easier as I earlier envisaged.
 

jmehr

Member

Reaction score: 54
Messages: 28

net/gitup should be able to revert your local ports tree to an earlier state. If you have the full hash value of the commit you want to go back to, all you need to do is add it to the command line via the -w parameter:

gitup ports -w 484ae4ecd943ba80353ec6c0629a275018ec06cc
 

rawthey

Member

Reaction score: 23
Messages: 95

Where do we find the full hash?
Beefy16 shows the latest package build for 130amd64-default is ad49ee98c4b6 which I assume is the first part of the hash but gitup doesn't like it:
Code:
curlew:/root# gitup ports -w ad49ee98c4b6
# Host: git.freebsd.org
# Port: 443
# Repository Path: /ports.git
# Target Directory: /usr/ports
# Have: 218ad8035b585651aeaaddbcffc2d423b557dde7
# Want: ad49ee98c4b6
# Branch: (detached)
# Action: pull
gitup: fetch_pack: malformed pack data:

: Inappropriate file type or format
 

rawthey

Member

Reaction score: 23
Messages: 95

Git logs.

Find the port: https://cgit.freebsd.org/ports/tree/ and look at the logs for that port. Each commit will have a full hash.
But that's ok for finding the commit for when a single port was last changed but what I want to do is to find the commit corresponding to the latest build on the package cluster. I use packages for most things but use ports for a small number of packages for which I need different options, e.g. to add ffmpeg to audacity.

In the past I was able to use the build number from the beefy16 web page to get the corresponding version of ports with svn and I had been hoping that I could do similar with gitup but this doesn't work.

beefy16 currently shows the checksum for the latest package run is 0c0a4f4b9148 but gitup fails if I supply this shortened hash.
Code:
curlew:/tmp# gitup ports -w 0c0a4f4b9148
# Host: git.freebsd.org
# Port: 443
# Repository Path: /ports.git
# Target Directory: /usr/ports
# Have: 218ad8035b585651aeaaddbcffc2d423b557dde7
# Want: 0c0a4f4b9148
# Branch: (detached)
# Action: pull
gitup: fetch_pack: malformed pack data:

: Inappropriate file type or format
It looks like gitup needs the full 40 character hash.

I have been able to find the full hash by going to github.com/freebsd/freebsd-ports , clicking the commits link and scrolling through several pages until I found a port with a 10 digit hash matching the first 10 characters of 0c0a4f4b9148. Clicking on that port then took me to a page which displayed the full hash 0c0a4f4b91481ccc3e0ba9df781ab80ec3fee876 which gitup accepts without any problem..

But this is very tedious and I was hoping there was a simpler way of finding the full hash. It would be even better if gitup would accept a shortened hash in the same way as git does. Could it be that this is a bug in gitup?
 

jmehr

Member

Reaction score: 54
Messages: 28

It's not a bug in net/gitup but more of a limitation. The git server only accepts 40 character hashes when requesting a pull or a clone and because net/gitup doesn't currently have the full commit history, it doesn't have a way of looking up the full 40 character hash when given a 10 character hash.

I'm working on adding the full commit history download functionality (it's working for clones but not quite working yet for pulls) and when I get that sorted out, looking up the full hash from a short hash should be pretty straight forward.
 

rawthey

Member

Reaction score: 23
Messages: 95

I'm working on adding the full commit history download functionality (it's working for clones but not quite working yet for pulls) and when I get that sorted out, looking up the full hash from a short hash should be pretty straight forward.
Thanks, that will be a useful feature for me.
 
Top