Apparently, p=p2 and ρ=ρ2, and p is a function of 1/ρ. The quantities q, p1, and ρ1 are constants.
[tex]\frac{\gamma}{\gamma-1}\left(\frac{p}{\rho}-\frac{p_1}{\rho_1}\right)-\frac{1}{2}\left(\frac{1}{\rho_1}+\frac{1}{\rho}\right)(p-p_1)=q[/tex]
If you let x=1/ρ, you can write the equation as
[tex]\frac{\gamma}{\gamma-1}\left(xp(x)-\frac{p_1}{\rho_1}\right)-\frac{1}{2}\left(\frac{1}{\rho_1}+x\right)(p(x)-p_1)=q[/tex]
Differentiate that equation with respect to x and solve for p'(x).